"Fossies" - the Fresh Open Source Software Archive

Member "grav/vendor/miljar/php-exif/lib/PHPExif/Adapter/AdapterAbstract.php" (8 Jun 2020, 2939 Bytes) of package /linux/www/grav-v1.6.26.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AdapterAbstract.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /**
    3  * PHP Exif Reader Adapter Abstract: Common functionality for adapters
    4  *
    5  * @link        http://github.com/miljar/PHPExif for the canonical source repository
    6  * @copyright   Copyright (c) 2013 Tom Van Herreweghe <tom@theanalogguy.be>
    7  * @license     http://github.com/miljar/PHPExif/blob/master/LICENSE MIT License
    8  * @category    PHPExif
    9  * @package     Reader
   10  */
   11 
   12 namespace PHPExif\Adapter;
   13 
   14 use PHPExif\Mapper\MapperInterface;
   15 use PHPExif\Hydrator\HydratorInterface;
   16 
   17 /**
   18  * PHP Exif Reader Adapter Abstract
   19  *
   20  * Implements common functionality for the reader adapters
   21  *
   22  * @category    PHPExif
   23  * @package     Reader
   24  */
   25 abstract class AdapterAbstract implements AdapterInterface
   26 {
   27     /**
   28      * @var string
   29      */
   30     protected $hydratorClass = '\\PHPExif\\Hydrator\\Mutator';
   31 
   32     /**
   33      * @var \PHPExif\Mapper\MapperInterface
   34      */
   35     protected $mapper;
   36 
   37     /**
   38      * @var \PHPExif\Hydrator\HydratorInterface
   39      */
   40     protected $hydrator;
   41 
   42     /**
   43      * @var string
   44      */
   45     protected $mapperClass = '';
   46 
   47     /**
   48      * Class constructor
   49      *
   50      * @param array $options Optional array of data to initialize the object with
   51      */
   52     public function __construct(array $options = array())
   53     {
   54         if (!empty($options)) {
   55             $this->setOptions($options);
   56         }
   57     }
   58 
   59     /**
   60      * Mutator for the data mapper
   61      *
   62      * @param \PHPExif\Mapper\MapperInterface $mapper
   63      * @return \PHPExif\Adapter\AdapterInterface
   64      */
   65     public function setMapper(MapperInterface $mapper)
   66     {
   67         $this->mapper = $mapper;
   68 
   69         return $this;
   70     }
   71 
   72     /**
   73      * Accessor for the data mapper
   74      *
   75      * @return \PHPExif\Mapper\MapperInterface
   76      */
   77     public function getMapper()
   78     {
   79         if (null === $this->mapper) {
   80             // lazy load one
   81             $mapper = new $this->mapperClass;
   82 
   83             $this->setMapper($mapper);
   84         }
   85 
   86         return $this->mapper;
   87     }
   88 
   89     /**
   90      * Mutator for the hydrator
   91      *
   92      * @param \PHPExif\Hydrator\HydratorInterface $hydrator
   93      * @return \PHPExif\Adapter\AdapterInterface
   94      */
   95     public function setHydrator(HydratorInterface $hydrator)
   96     {
   97         $this->hydrator = $hydrator;
   98 
   99         return $this;
  100     }
  101 
  102     /**
  103      * Accessor for the data hydrator
  104      *
  105      * @return \PHPExif\Hydrator\HydratorInterface
  106      */
  107     public function getHydrator()
  108     {
  109         if (null === $this->hydrator) {
  110             // lazy load one
  111             $hydrator = new $this->hydratorClass;
  112 
  113             $this->setHydrator($hydrator);
  114         }
  115 
  116         return $this->hydrator;
  117     }
  118 
  119     /**
  120      * Set array of options in the current object
  121      *
  122      * @param array $options
  123      * @return \PHPExif\Reader\AdapterAbstract
  124      */
  125     public function setOptions(array $options)
  126     {
  127         $hydrator = $this->getHydrator();
  128         $hydrator->hydrate($this, $options);
  129 
  130         return $this;
  131     }
  132 }