当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::build方法代码示例

本文整理汇总了PHP中Factory::build方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::build方法的具体用法?PHP Factory::build怎么用?PHP Factory::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory的用法示例。


在下文中一共展示了Factory::build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 /**
  * @throws \Exception
  */
 private function postProcess()
 {
     foreach ($this->config->PostProcessors as $processor) {
         if (Classes::validateProcessor($processor)) {
             $process = Factory::build($processor);
             $process->process($this);
         } else {
             throw new \Exception('Mongular: Attempt to access invalid processor ' . $this->request);
         }
     }
 }
开发者ID:mongular,项目名称:mongular,代码行数:14,代码来源:Mongular.php

示例2: testJsonFormatter

 public function testJsonFormatter()
 {
     $factory = new Factory();
     $format = $factory->build('json');
     $data = $format->convertToArray($this->rawData);
     $this->assertTrue(is_array($data));
     $this->assertCount(5, $data);
 }
开发者ID:phaniso,项目名称:phpmonitor,代码行数:8,代码来源:JsonTest.php

示例3: getGuess

 public function getGuess($letter)
 {
     $hangman = Factory::build('Hangman');
     $this->template->hangman = $hangman;
     if ($hangman->guess(strtoupper($letter))) {
         $this->template->render('winner');
     }
     $this->template->render('guess');
 }
开发者ID:radekstepan,项目名称:soprano,代码行数:9,代码来源:application.php

示例4: buildParameters

 /**
  * @param $parameters
  * @param $class
  * @return array
  * @throws \Exception
  */
 private static function buildParameters($parameters, $class)
 {
     $di_params = array();
     foreach ($parameters as $key => $parameter) {
         $di_class = $parameter->getClass();
         if (is_object($di_class)) {
             $di_params[$parameter->name] = Factory::build('\\' . $di_class->name);
         } else {
             $error = 'Mongular DI error for Controller class ' . $class . ' on parameter ' . $parameter->name;
             throw new \Exception($error);
         }
     }
     return $di_params;
 }
开发者ID:mongular,项目名称:mongular,代码行数:20,代码来源:Factory.php

示例5: getDefinition

 public function getDefinition()
 {
     if (empty($this->definitions)) {
         $wordnik = Factory::build('Wordnik');
         $definitions = $wordnik->getDefinitions(strtolower($this->word));
         if (!is_null($definitions)) {
             foreach ($definitions as $definition) {
                 if (isset($definition->text)) {
                     $this->definition = str_ireplace($this->word, '[WORD]', $definition->text);
                     break;
                 }
             }
         }
     }
     return $this->definition;
 }
开发者ID:radekstepan,项目名称:soprano,代码行数:16,代码来源:HangmanModel.php

示例6: set

 public static function set()
 {
     $num_args = func_num_args();
     if ($num_args === 1) {
         self::$config['url'] = self::URL;
         self::$config['key'] = func_get_arg(0);
         self::$config['url'] = Factory::build('account')->authenticate()->url;
     } elseif ($num_args === 2) {
         self::$config['url'] = $url = func_get_arg(0);
         if ($is_subdomain = strpos($url, '.') === false) {
             self::$config['url'] = self::URL;
         }
         self::$config['key'] = func_get_arg(1);
         if ($is_subdomain) {
             $url = Factory::build('account')->authenticate()->url;
         }
         self::$config['url'] = $url;
     }
 }
开发者ID:theboxer,项目名称:TeamWorkPmPhpApi,代码行数:19,代码来源:Auth.php

示例7: testNonExistentFactory

 /**
  * @expectedException \Carpenter\FactoryNotFoundException
  * @expectedExceptionMessage "ImaginaryFactory" is not a registered factory
  */
 public function testNonExistentFactory()
 {
     Factory::build('ImaginaryFactory');
 }
开发者ID:matthewpatterson,项目名称:carpenter,代码行数:8,代码来源:FactoryTest.php

示例8: build

    public static function build($type)
    {
        $class = 'Format' . $type;
        if (!class_exists($class)) {
            throw new Exception('Missing format class.');
        }
        return new $class();
    }
}
/**
 * Class FormatString
 */
class FormatString implements Format
{
}
/**
 * Class FormatNumber
 */
class FormatNumber implements Format
{
}
try {
    $string = Factory::build('String');
} catch (Exception $e) {
    echo $e->getMessage();
}
try {
    $number = Factory::build('Number');
} catch (Exception $e) {
    echo $e->getMessage();
}
开发者ID:alxolr,项目名称:php-dp,代码行数:31,代码来源:FactoryMethod.php

示例9: __construct

 /**
  * Constructor.
  *
  * @param array $config
  */
 private final function __construct(array $config)
 {
     $this->db = Factory::build(new Configuration($config));
     $this->db->connect();
 }
开发者ID:froq,项目名称:froq-beta-archive,代码行数:10,代码来源:Mysql.php

示例10:

<?php

namespace Mongular\Core;

require '../../vendor/autoload.php';
$mongular = Factory::build('\\Mongular\\Core\\Mongular');
/*
 * Uncomment to add memcache support.
 */
//$mongular->addCache();
echo $mongular->build();
开发者ID:mongular,项目名称:mongular,代码行数:11,代码来源:index.php

示例11: build

 public function build(string $filter, callable $callback)
 {
     $conditions = $this->parser->parse($filter);
     list($predicates, $types, $rooms) = $this->compiler->compile($conditions);
     return $this->factory->build($filter, $predicates, $types, $rooms, $callback);
 }
开发者ID:Room-11,项目名称:Jeeves,代码行数:6,代码来源:Builder.php

示例12: Factory

<?php

require_once __DIR__ . '/../vendor/autoload.php';
class Factory extends Rtablada\IbmDataStruct\StructFactory
{
    protected static $rules = ['name_short' => 22, 'name_long' => ['length' => 10]];
    protected static $structBuilderType = 'Rtablada\\IbmDataStruct\\IbmStructBuilder';
}
$factory = new Factory();
$values = ['name_long' => 'Ryan Tablada', 'name_short' => 'Ryan Tablada'];
echo $factory->build($values);
开发者ID:rtablada,项目名称:ibm-data-struct,代码行数:11,代码来源:factoryTest.php

示例13: testBuildingFormatParser

 public function testBuildingFormatParser()
 {
     $factory = new Factory();
     $formatParser = $factory->build('json');
     $this->assertTrue(is_object($formatParser));
 }
开发者ID:phaniso,项目名称:phpmonitor,代码行数:6,代码来源:FactoryTest.php

示例14: testIfWeCanBuildNonExistentController

 /**
  * @expectedException Api\Exception\Controller
  */
 public function testIfWeCanBuildNonExistentController()
 {
     $factory = new Factory();
     $controller = $factory->build('InvalidController');
 }
开发者ID:phaniso,项目名称:phpmonitor-api,代码行数:8,代码来源:FactoryTest.php

示例15: remove

 /**
  * @param $name
  */
 public static function remove($name)
 {
     Factory::build(__CLASS__);
     unset($_SESSION[$name]);
 }
开发者ID:mongular,项目名称:mongular,代码行数:8,代码来源:Session.php


注:本文中的Factory::build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。