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


PHP Factory类代码示例

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


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

示例1: createNewServer

 public function createNewServer()
 {
     $F = new Factory("xCal");
     $F->sA("xCalServerActive", "1");
     $F->sA("xCalUserID", Session::currentUser()->getID());
     $F->store();
 }
开发者ID:nemiah,项目名称:fheME,代码行数:7,代码来源:mxCalGUI.class.php

示例2: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config_authentification_form');
     $factory = new Factory();
     $form = $factory->createForm($config);
     return $form;
 }
开发者ID:sanPgut,项目名称:Exos-ZFPhp,代码行数:7,代码来源:AuthentificationFormFactory.php

示例3: test_create_new

 public function test_create_new()
 {
     /** === Test Data === */
     $TRANS = 'transaction name';
     $CONN = 'connection name';
     /** === Setup Mocks === */
     // $result = $this->_manObj->create(\Praxigento\Core\Transaction\Database\Def\Item::class);
     $mResult = $this->_mock(\Praxigento\Core\Transaction\Database\Def\Item::class);
     $this->mManObj->shouldReceive('create')->once()->andReturn($mResult);
     // $result->setTransactionName($transactionName);
     $mResult->shouldReceive('setTransactionName')->once()->with($TRANS);
     // $result->setConnectionName($connectionName);
     $mResult->shouldReceive('setConnectionName')->once()->with($CONN);
     // $cfgData = $this->_configDeployment->get($cfgName);
     $mCfgData = [];
     $this->mConfigDeployment->shouldReceive('get')->once()->andReturn($mCfgData);
     // $conn = $this->_factoryConn->create($cfgData);
     $mConn = $this->_mock(\Magento\Framework\DB\Adapter\AdapterInterface::class);
     $this->mFactoryConn->shouldReceive('create')->once()->andReturn($mConn);
     // $result->setConnection($conn);
     $mResult->shouldReceive('setConnection')->once();
     /** === Call and asserts  === */
     $res = $this->obj->create($TRANS, $CONN);
     $this->assertTrue($res instanceof \Praxigento\Core\Transaction\Database\IItem);
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:25,代码来源:Factory_Test.php

示例4: handle_create

 public function handle_create(Command\Create $cmd, Factory $factory)
 {
     $this->assert->not(Invariant\UserHasPendingCart::class);
     $cart = $factory->make_new();
     $cart->create($cmd->id, $cmd->customer_id);
     $this->repo->store($cart);
 }
开发者ID:barryosull,项目名称:bounded-context-sample,代码行数:7,代码来源:Handler.php

示例5: createNew

 public function createNew()
 {
     $F = new Factory("TinkerforgeBricklet");
     $F->sA("TinkerforgeBrickletTinkerforgeID", $this->getID());
     $F->store();
     echo $this->bricklets();
 }
开发者ID:nemiah,项目名称:fheME,代码行数:7,代码来源:TinkerforgeGUI.class.php

示例6: validator

 /**
  * Custom validator to check email array
  * 
  * @param  Factory $factory
  * @return $object
  */
 public function validator($factory)
 {
     $campaign_id = $this->route('campaigns');
     $validation = $factory->make($this->all(), $this->rules());
     $validation->each('add_user_email_notification', ['exists:user_has_roles,user_id,campaign_id,' . $campaign_id]);
     return $validation;
 }
开发者ID:henrytung,项目名称:Bodie-CRM,代码行数:13,代码来源:StoreLandingPageRequest.php

示例7: test_getReflection_should_return_instance_of_current_routed_class

 function test_getReflection_should_return_instance_of_current_routed_class()
 {
     $route = new Factory('any', '/', 'DateTime', function () {
         return new \DateTime();
     });
     $refl = $route->getReflection('format');
     $this->assertInstanceOf('ReflectionMethod', $refl);
 }
开发者ID:nickl-,项目名称:Rest,代码行数:8,代码来源:FactoryTest.php

示例8: testShouldFactoryTypeParserWhenSomeArgumentKeyIsANumber

 public function testShouldFactoryTypeParserWhenSomeArgumentKeyIsANumber()
 {
     $factory = new Factory();
     $arguments = array('a' => true, 'b' => 42, 'c');
     $expectedInstanceType = 'PHPFluent\\Callback\\ArgumentParser\\Type';
     $actualInstance = $factory->parser($arguments);
     $this->assertInstanceOf($expectedInstanceType, $actualInstance);
 }
开发者ID:phpfluent,项目名称:callback,代码行数:8,代码来源:FactoryTest.php

示例9: 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

示例10: buildContent

 /**
  * [buildContent description]
  * @param  Factory $fieldFactory The field factory with all fields for the 
  *                               content
  * @param  array   $data         The content data, this should be specified
  *                               as ['group' => [$field_1, $field_2, ...], ...]
  *                               where $field_1 & $field_2 are a stdClass
  *                               objects containing at least 'field' and 
  *                               'value' properties
  * @param  string|ContentInterface $content Content class or class name
  * @return ContentInterface       Returns the build content
  */
 public function buildContent(Factory $fieldFactory, $data, $content = '\\Message\\Cog\\Field\\Content')
 {
     if (!$content instanceof ContentInterface) {
         if (!is_string($content)) {
             throw new \InvalidArgumentException('content must be either ContentInterface or string, ' . gettype($content) == 'object' ? get_class($content) : gettype($content) . ' given');
         }
         $content = new $content();
     }
     foreach ($fieldFactory as $name => $field) {
         if ($field instanceof Group && $field->isRepeatable()) {
             // add sequence variable
             $field->add($fieldFactory->getField('hidden', self::SEQUENCE_FIELD));
             $field = new RepeatableContainer($field);
         }
         $content->set($name, $field);
     }
     // Loop through the content, grouped by group
     foreach ($data as $groupName => $rows) {
         foreach ($rows as $row) {
             // If this field is in a group
             if ($groupName) {
                 $group = $content->get($groupName);
                 if (!$group) {
                     continue;
                 }
                 // Get the right group instance if it's a repeatable group
                 if ($group instanceof RepeatableContainer) {
                     // Ensure the right number of groups are defined
                     while (!$group->get($row->sequence)) {
                         $group->add();
                     }
                     $group = $group->get($row->sequence);
                     // set sequence field value
                     $group->get('_sequence')->setValue($row->sequence);
                 }
                 // Set the field
                 try {
                     $field = $group->{$row->field};
                 } catch (\OutOfBoundsException $e) {
                     continue;
                 }
             } else {
                 $field = $content->get($row->field);
             }
             // Skip the field if we can't find it
             if (!isset($field)) {
                 continue;
             }
             // Set the values
             if ($field instanceof MultipleValueField) {
                 $field->setValue($row->data_name, $row->value);
             } elseif ($field instanceof BaseField) {
                 $field->setValue($row->value);
             }
         }
     }
     return $content;
 }
开发者ID:mothership-ec,项目名称:cog,代码行数:70,代码来源:ContentBuilder.php

示例11: __construct

 public function __construct(Factory $factory)
 {
     $this->factory = $factory;
     $this->db = $factory->getDb();
     $this->logger = $factory->getLogger();
     $this->mainTable = $this->getMainTable();
     $this->relationsTable = $this->getRelationsTable();
     $this->createTables();
 }
开发者ID:michelezamuner,项目名称:groph-php-simple,代码行数:9,代码来源:Collection.php

示例12: main

 public function main()
 {
     $myShapes = array();
     $myFactory = new Factory();
     $myShapes = $myFactory->getShapes();
     foreach ($myShapes as $myShape) {
         $myShape->draw();
     }
 }
开发者ID:nouka,项目名称:DesignPatternsExplained,代码行数:9,代码来源:10-3.php

示例13: testBehaviorOwner

 public function testBehaviorOwner()
 {
     $factory = new Factory('http://localhost/');
     $factory->setRequestClassNamespace('\\Sokil\\Rest\\Client\\RequestMock');
     $factory->attachBehavior('my', new \Sokil\Rest\Client\MyBehavior());
     // exec behavior
     $requert = $factory->createRequest('GetRequestMock');
     $this->assertEquals('http://localhost/some/resource', $requert->getRequestUrl());
 }
开发者ID:sokil,项目名称:php-rest,代码行数:9,代码来源:FactoryBehaviorTest.php

示例14: crawlComments

 /**
  * Crawl comments page
  *
  * @param array $comment previously received comments page link
  * @param bool $proceed  proceed or not with received comments
  * @return array
  */
 public function crawlComments($comments, $proceed = true)
 {
     $importer = new Factory($this->plugin->config);
     $result = $importer->getImporter()->getComments($comments['page']);
     if ($result && $proceed) {
         $this->proceedPostComments($comments['postId'], $result);
     }
     return $result;
 }
开发者ID:evgenykireev,项目名称:wp-facebook-import,代码行数:16,代码来源:Service.php

示例15: validator

 /**
  * Custom validator to check email array
  * 
  * @param  Factory $factory
  * @return $object
  */
 public function validator($factory)
 {
     $landing_page_id = $this->route('landing_pages');
     $campaign_id = Landing_Page::where('id', $landing_page_id)->first()->campaign->id;
     // Validate email users are part of campaign
     $validation = $factory->make($this->all(), $this->rules());
     $validation->each('add_user_email_notification', ['exists:user_has_roles,user_id,campaign_id,' . $campaign_id]);
     return $validation;
 }
开发者ID:henrytung,项目名称:Bodie-CRM,代码行数:15,代码来源:StoreRequest.php


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