first commit

This commit is contained in:
root
2020-02-19 16:42:35 +01:00
commit d668d90f82
2224 changed files with 334338 additions and 0 deletions

View File

@ -0,0 +1,33 @@
<?php
/**
* PHP Exif Hydrator Interface: Defines the interface for a hydrator
*
* @link http://github.com/miljar/PHPExif for the canonical source repository
* @copyright Copyright (c) 2015 Tom Van Herreweghe <tom@theanalogguy.be>
* @license http://github.com/miljar/PHPExif/blob/master/LICENSE MIT License
* @category PHPExif
* @package Hydrator
* @codeCoverageIgnore
*/
namespace PHPExif\Hydrator;
/**
* PHP Exif Hydrator
*
* Defines the interface for a hydrator
*
* @category PHPExif
* @package Hydrator
*/
interface HydratorInterface
{
/**
* Hydrates given array of data into the given Exif object
*
* @param object $object
* @param array $data
* @return void
*/
public function hydrate($object, array $data);
}

View File

@ -0,0 +1,56 @@
<?php
/**
* PHP Exif Mutator Hydrator: Hydrate an object
* by manipulating the object with its mutator methods
*
* @link http://github.com/miljar/PHPExif for the canonical source repository
* @copyright Copyright (c) 2015 Tom Van Herreweghe <tom@theanalogguy.be>
* @license http://github.com/miljar/PHPExif/blob/master/LICENSE MIT License
* @category PHPExif
* @package Hydrator
*/
namespace PHPExif\Hydrator;
/**
* PHP Exif Mutator Hydrator
*
* Hydrates an object by setting data with
* the class mutator methods
*
* @category PHPExif
* @package Hydrator
*/
class Mutator implements HydratorInterface
{
/**
* Hydrates given array of data into the given Exif object
*
* @param object $object
* @param array $data
* @return void
*/
public function hydrate($object, array $data)
{
foreach ($data as $property => $value) {
$mutator = $this->determineMutator($property);
if (method_exists($object, $mutator)) {
$object->$mutator($value);
}
}
}
/**
* Determines the name of the mutator method for given property name
*
* @param string $property The property to determine the mutator for
* @return string The name of the mutator method
*/
protected function determineMutator($property)
{
$method = 'set' . ucfirst($property);
return $method;
}
}