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


PHP Factory::create方法代码示例

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


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

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

示例2: test_create

 public function test_create()
 {
     /** === Test Data === */
     $NAME = 'name';
     /** === Setup Mocks === */
     // $result = $this->_manObj->create(\Praxigento\Core\Transaction\Business\Def\Item::class);
     $mResult = $this->_mock(\Praxigento\Core\Transaction\Business\Def\Item::class);
     $this->mManObj->shouldReceive('create')->once()->andReturn($mResult);
     // $result->setName($name);
     $mResult->shouldReceive('setName')->once()->with($NAME);
     /** === Call and asserts  === */
     $res = $this->obj->create($NAME);
     $this->assertTrue($res instanceof \Praxigento\Core\Transaction\Business\IItem);
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:14,代码来源:Factory_Test.php

示例3: main

function main($k)
{
    $x = Factory::create($k);
    if ($x instanceof Derived) {
        echo "derived\n";
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:interface_instanceof.php

示例4: __construct

 function __construct($macro_nodes, $citeproc)
 {
     foreach ($macro_nodes as $macro) {
         $macro = Factory::create($macro, $citeproc);
         $this->elements[$macro->name()] = $macro;
     }
 }
开发者ID:mettio,项目名称:citeprocessor,代码行数:7,代码来源:Macros.php

示例5: init

 function init($dom_node, $citeproc)
 {
     $etal = '';
     $tag = $dom_node->getElementsByTagName('substitute')->item(0);
     if ($tag) {
         $this->substitutes = Factory::create($tag, $citeproc);
         $dom_node->removeChild($tag);
     }
     $tag = $dom_node->getElementsByTagName('et-al')->item(0);
     if ($tag) {
         $etal = Factory::create($tag, $citeproc);
         $dom_node->removeChild($tag);
     }
     $var = $dom_node->getAttribute('variable');
     foreach ($dom_node->childNodes as $node) {
         if ($node->nodeType == 1) {
             $element = Factory::create($node, $citeproc);
             if ($element instanceof Label) {
                 $element->variable = $var;
             }
             if ($element instanceof Name && $etal) {
                 $element->etal = $etal;
             }
             $this->addElement($element);
         }
     }
 }
开发者ID:mettio,项目名称:citeprocessor,代码行数:27,代码来源:Names.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     Factory::create('migration', ['version' => '20140319-old_migration']);
     $this->service = $this->getMockBuilder('MigrationsService')->setMethods(['scan_migrations_dir', 'run_query', 'get_migration_contents'])->disableOriginalConstructor()->getMock();
     $this->service->expects($this->once())->method('scan_migrations_dir')->will($this->returnValue(['20140319-old_migration.sql', '20140319-new_migration.sql']));
     $this->service->initialize();
 }
开发者ID:szchkt,项目名称:leaklog-web,代码行数:8,代码来源:migrations_service_test.php

示例7: testCreateBasicFactory

 public function testCreateBasicFactory()
 {
     Configuration::$adapter = $this->getMockBuilder('\\Carpenter\\Adapter\\ArrayAdapter')->setMethods(['persist'])->getMock();
     $expected = ['username' => 'Bob', 'password' => 'password1'];
     Configuration::$adapter->expects($this->once())->method('persist')->will($this->returnValue($expected));
     $user = Factory::create('BasicUser');
     $this->assertEquals($expected, $user);
 }
开发者ID:matthewpatterson,项目名称:carpenter,代码行数:8,代码来源:FactoryTest.php

示例8: init

 function init($dom_node, $citeproc)
 {
     $locale_elements = array();
     if ($form = $this->form) {
         $local_date = $this->citeproc->get_locale('date_options', $form);
         $dom_elem = dom_import_simplexml($local_date[0]);
         if ($dom_elem) {
             foreach ($dom_elem->childNodes as $node) {
                 if ($node->nodeType == 1) {
                     $locale_elements[] = Factory::create($node, $citeproc);
                 }
             }
         }
         //debug($dom_node->childNodes);
         foreach ($dom_node->childNodes as $node) {
             if ($node->nodeType == 1) {
                 $element = Factory::create($node, $citeproc);
                 foreach ($locale_elements as $key => $locale_element) {
                     if ($locale_element->name == $element->name) {
                         $locale_elements[$key]->attributes = array_merge($locale_element->attributes, $element->attributes);
                         $locale_elements[$key]->format = $element->format;
                         break;
                     } else {
                         $locale_elements[] = $element;
                     }
                 }
             }
         }
         if ($date_parts = $this->{'date-parts'}) {
             $parts = explode('-', $date_parts);
             foreach ($locale_elements as $key => $element) {
                 if (array_search($element->name, $parts) === FALSE) {
                     unset($locale_elements[$key]);
                 }
             }
             if (count($locale_elements) != count($parts)) {
                 foreach ($parts as $part) {
                     $element = new DatePart();
                     $element->name = $part;
                     $locale_elements[] = $element;
                 }
             }
             // now re-order the elements
             foreach ($parts as $part) {
                 foreach ($locale_elements as $key => $element) {
                     if ($element->name == $part) {
                         $this->elements[] = $element;
                         unset($locale_elements[$key]);
                     }
                 }
             }
         } else {
             $this->elements = $locale_elements;
         }
     } else {
         parent::init($dom_node, $citeproc);
     }
 }
开发者ID:mettio,项目名称:citeprocessor,代码行数:58,代码来源:Date.php

示例9: postCreate

 public function postCreate()
 {
     $number = $_POST['number'];
     $faker = Factory::create();
     $user = [];
     for ($i = 0; $i < $number; $i++) {
         $user[$i] = factory(p3\User::class)->create();
     }
     return view('ipsum.show', compact('user', $user));
 }
开发者ID:stephenallman,项目名称:p3,代码行数:10,代码来源:userController.php

示例10: postCreate

 public function postCreate(Request $request)
 {
     $number = $_POST['number'];
     //instantiate a faker generator
     $faker = Factory::create();
     for ($i = 0; $i < $number; $i++) {
         $text = $faker->paragraph;
         return view('ipsum.show', compact('text', $text));
     }
 }
开发者ID:stephenallman,项目名称:p3,代码行数:10,代码来源:ipsumController.php

示例11: testShouldCreateCacheProviderNonConnectable

 public function testShouldCreateCacheProviderNonConnectable()
 {
     $cacheSettings = ['adapter_name' => 'Array'];
     $factory = new Factory();
     $mockedProxy = $this->getMockBuilder('Pcelta\\Doctrine\\Cache\\Proxy')->setMethods(['getAdapter'])->getMock();
     $mockedProxy->expects($this->never())->method('getAdapter');
     $factory->setProxy($mockedProxy);
     $result = $factory->create($cacheSettings);
     $this->assertInstanceOf('Doctrine\\Common\\Cache\\ArrayCache', $result);
 }
开发者ID:pcelta,项目名称:doctrine-cache-factory,代码行数:10,代码来源:FactoryTest.php

示例12: setProvider

 private function setProvider($pos)
 {
     $this->providerName = $this->namedProvidersList[$pos];
     if (isset($this->providersList[$pos])) {
         $this->provider = $this->providersList[$pos];
         return;
     }
     $this->provider = Factory::create($this->namedProvidersList[$pos], $this->options, $this->cachedDir);
     $this->providersList[$pos] = $this->provider;
 }
开发者ID:nicodmf,项目名称:HighlightBundle,代码行数:10,代码来源:Providers.php

示例13: init

 function init($dom_node, $citeproc)
 {
     if (!$dom_node) {
         return;
     }
     foreach ($dom_node->childNodes as $node) {
         if ($node->nodeType == 1) {
             $this->addElement(Factory::create($node, $citeproc));
         }
     }
 }
开发者ID:mettio,项目名称:citeprocessor,代码行数:11,代码来源:Element.php

示例14: run

 function run()
 {
     //10+20=30
     $operate = Factory::create('Jia');
     $operate->a = 10;
     $operate->b = 20;
     echo $operate->getRes() . "\n";
     //100-20=80
     $operate = Factory::create('Jian');
     $operate->a = 100;
     $operate->b = 20;
     echo $operate->getRes() . "\n";
 }
开发者ID:arkulo56,项目名称:my_program,代码行数:13,代码来源:demo.php

示例15: findEc2Instances

 /**
  * @param array $filters
  * @return \AwsInspector\Model\Collection
  * @throws \Exception
  */
 public function findEc2Instances(array $filters = [])
 {
     $ec2Client = \AwsInspector\SdkFactory::getClient('ec2');
     /* @var $ec2Client \Aws\Ec2\Ec2Client */
     $result = $ec2Client->describeInstances(['Filters' => $filters]);
     $rows = $result->search('Reservations[].Instances[]');
     $collection = new \AwsInspector\Model\Collection();
     foreach ($rows as $row) {
         $instance = Factory::create($row);
         if ($instance !== false) {
             $collection->attach($instance);
         }
     }
     return $collection;
 }
开发者ID:AOEpeople,项目名称:AwsInspector,代码行数:20,代码来源:Repository.php


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