本文整理汇总了PHP中static::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP static::factory方法的具体用法?PHP static::factory怎么用?PHP static::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
public static function setup()
{
if (!static::$factory) {
static::$factory = new \Illuminate\Validation\Factory(new \Symfony\Component\Translation\Translator(get_locale()));
}
return static::$factory;
}
示例2: getFactory
public static function getFactory()
{
if (!static::$factory) {
static::$factory = new DataExtractorFactory();
}
return static::$factory;
}
示例3: __construct
private function __construct($target)
{
if (!isset(static::$factory)) {
static::$factory = new ReflectionFactory();
}
$this->reflection = static::$factory->produce($target);
}
示例4: get
/**
* 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;
}
示例5: getFactory
public static function getFactory()
{
if (!static::$factory) {
$featureSet = new FeatureSet(Uuid::class, static::class);
static::$factory = new PeclUuidFactory(new UuidFactory($featureSet));
}
return self::$factory;
}
示例6: instance
public static function instance()
{
if (!static::$factory) {
$translator = new Translator("en");
static::$factory = new Factory($translator);
}
return static::$factory;
}
示例7: getFactory
public static function getFactory()
{
if (!static::$factory) {
$featureSet = new FeatureSet(static::class, DegradedUuid::class);
static::$factory = new UuidFactory($featureSet);
}
return self::$factory;
}
示例8: instance
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;
}
示例9: setFactory
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;
}
示例10: setFactory
/**
* Set the gateway factory
*
* @param GatewayFactory $factory A GatewayFactory instance
*/
public static function setFactory(GatewayFactory $factory = null)
{
static::$factory = $factory;
}
示例11: setAsGlobal
/**
* @return \Wandu\Validator\ValidatorFactory
*/
public function setAsGlobal()
{
$oldFactory = static::$factory;
static::$factory = $this;
return $oldFactory;
}
示例12: factory
/**
* Set user factory
*
* @param \Closure $factory
*/
public static function factory(\Closure $factory)
{
static::$factory = $factory;
}
示例13: __construct
public function __construct()
{
if (static::$factory === null) {
static::$factory = new \Plop\RecordFactory(new \Plop\Interpolator\Psr3());
}
}
示例14: create
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);
}
示例15: setFactory
private static function setFactory(Factory $factory = null)
{
static::$factory = $factory;
}