public static function setup()
 {
     if (!static::$factory) {
         static::$factory = new \Illuminate\Validation\Factory(new \Symfony\Component\Translation\Translator(get_locale()));
     }
     return static::$factory;
 }
 public static function getFactory()
 {
     if (!static::$factory) {
         static::$factory = new DataExtractorFactory();
     }
     return static::$factory;
 }
Example #3
0
 private function __construct($target)
 {
     if (!isset(static::$factory)) {
         static::$factory = new ReflectionFactory();
     }
     $this->reflection = static::$factory->produce($target);
 }
 /**
  * Get a stream factory.
  *
  * @throws \RuntimeException if no factory is set.
  *
  * @return callable
  */
 public static function get()
 {
     if (static::$factory === null) {
         static::$factory = static::autodetectFactory();
     }
     return static::$factory;
 }
Example #5
0
 public static function getFactory()
 {
     if (!static::$factory) {
         $featureSet = new FeatureSet(Uuid::class, static::class);
         static::$factory = new PeclUuidFactory(new UuidFactory($featureSet));
     }
     return self::$factory;
 }
Example #6
0
 public static function instance()
 {
     if (!static::$factory) {
         $translator = new Translator("en");
         static::$factory = new Factory($translator);
     }
     return static::$factory;
 }
Example #7
0
 public static function getFactory()
 {
     if (!static::$factory) {
         $featureSet = new FeatureSet(static::class, DegradedUuid::class);
         static::$factory = new UuidFactory($featureSet);
     }
     return self::$factory;
 }
 public static function instance()
 {
     if (!static::$factory) {
         $translator = new Translator('en');
         static::$factory = new \Illuminate\Validation\Factory($translator);
         static::$factory->setPresenceVerifier(new DatabasePresenceVerifier(Eloquent::getConnectionResolver()));
     }
     return static::$factory;
 }
Example #9
0
 public static function setFactory($callable)
 {
     if (is_object($callable) === false || method_exists($callable, '__invoke') === false) {
         throw new InvalidArgumentException('Callback is not a Closure or invokable object.');
     }
     static::$factory = $callable;
 }
Example #10
0
 /**
  * Set the gateway factory
  *
  * @param GatewayFactory $factory A GatewayFactory instance
  */
 public static function setFactory(GatewayFactory $factory = null)
 {
     static::$factory = $factory;
 }
Example #11
0
 /**
  * @return \Wandu\Validator\ValidatorFactory
  */
 public function setAsGlobal()
 {
     $oldFactory = static::$factory;
     static::$factory = $this;
     return $oldFactory;
 }
Example #12
0
 /**
  * Set user factory
  *
  * @param \Closure $factory
  */
 public static function factory(\Closure $factory)
 {
     static::$factory = $factory;
 }
Example #13
0
 public function __construct()
 {
     if (static::$factory === null) {
         static::$factory = new \Plop\RecordFactory(new \Plop\Interpolator\Psr3());
     }
 }
Example #14
0
 public static function create(LoopInterface $loop, $params)
 {
     if (null === static::$factory or !static::$factory instanceof Factory) {
         static::$factory = new Factory($loop);
     }
     return (new static(static::$factory->createClient($params)))->setLoop($loop);
 }
 private static function setFactory(Factory $factory = null)
 {
     static::$factory = $factory;
 }
Example #16
0
 protected static function load()
 {
     /** @var Gantry $instance */
     $instance = new static();
     $instance->register(new ConfigServiceProvider());
     $instance->register(new StreamsServiceProvider());
     $instance['request'] = function ($c) {
         return new Request();
     };
     $instance['events'] = function ($c) {
         return new EventDispatcher();
     };
     $instance['platform'] = function ($c) {
         return new Platform($c);
     };
     $instance['translator'] = function ($c) {
         return new Translator();
     };
     $instance['site'] = function ($c) {
         return new Site();
     };
     $instance['menu'] = function ($c) {
         return new Menu();
     };
     $instance['messages'] = function ($c) {
         return new Messages();
     };
     $instance['page'] = function ($c) {
         return new Page($c);
     };
     // Make sure that nobody modifies the original collection by making it a factory.
     $instance['configurations'] = $instance->factory(function ($c) {
         static $collection;
         if (!$collection) {
             $collection = (new Outlines($c))->load();
         }
         return $collection->copy();
     });
     $instance['positions'] = $instance->factory(function ($c) {
         static $collection;
         if (!$collection) {
             $collection = (new Positions($c))->load();
         }
         return $collection->copy();
     });
     $instance['global'] = function ($c) {
         $data = $c->loadGlobal() + ['debug' => false, 'production' => false, 'asset_timestamps' => true, 'asset_timestamps_period' => 7];
         return new Config($data);
     };
     return $instance;
 }
Example #17
0
 public static function setFactory(FactoryInterface $factory)
 {
     static::$factory = $factory;
 }
Example #18
0
 protected static function load()
 {
     /** @var Gantry $instance */
     $instance = new static();
     $instance->register(new ConfigServiceProvider());
     $instance->register(new StreamsServiceProvider());
     $instance['request'] = function ($c) {
         return new Request();
     };
     $instance['events'] = function ($c) {
         return new EventDispatcher();
     };
     $instance['platform'] = function ($c) {
         return new Platform($c);
     };
     $instance['translator'] = function ($c) {
         return new Translator();
     };
     // Make sure that nobody modifies the original collection by making it a factory.
     $instance['configurations'] = $instance->factory(function ($c) {
         static $collection;
         if (!$collection) {
             $collection = (new Configurations($c))->load();
         }
         return $collection->copy();
     });
     return $instance;
 }
Example #19
0
 /**
  * @param Factory $factory
  *
  * @return null
  */
 public static function setFactory($factory)
 {
     static::$factory = $factory;
 }
 /**
  * Set the Facade Factory
  *
  * @param FacadeFactory $factory
  */
 public static function setFactory(FacadeFactory $factory = null)
 {
     static::$factory = $factory;
 }