Art4\JsonApiClient\Utils\FactoryManagerInterface::getFactory PHP Method

getFactory() public method

Get a factory from the manager
public getFactory ( ) : Art4\JsonApiClient\Utils\FactoryInterface
return Art4\JsonApiClient\Utils\FactoryInterface
    public function getFactory();

Usage Example

 /**
  * @param object $object The link object
  *
  * @return self
  *
  * @throws ValidationException
  */
 public function __construct($object, FactoryManagerInterface $manager)
 {
     if (!is_object($object)) {
         throw new ValidationException('RelationshipLink has to be an object, "' . gettype($object) . '" given.');
     }
     if (!property_exists($object, 'self') and !property_exists($object, 'related')) {
         throw new ValidationException('RelationshipLink has to be at least a "self" or "related" link');
     }
     $this->manager = $manager;
     $this->container = new DataContainer();
     if (property_exists($object, 'self')) {
         if (!is_string($object->self)) {
             throw new ValidationException('property "self" has to be a string, "' . gettype($object->self) . '" given.');
         }
         $this->container->set('self', strval($object->self));
     }
     if (property_exists($object, 'related')) {
         if (!is_string($object->related)) {
             throw new ValidationException('property "related" has to be a string, "' . gettype($object->related) . '" given.');
         }
         $this->container->set('related', strval($object->related));
     }
     if (property_exists($object, 'pagination')) {
         $this->container->set('pagination', $this->manager->getFactory()->make('Pagination', [$object->pagination, $this->manager]));
     }
 }
All Usage Examples Of Art4\JsonApiClient\Utils\FactoryManagerInterface::getFactory
FactoryManagerInterface