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


PHP Code::castSetter方法代码示例

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


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

示例1: testSetMockCollection

 /**
  * @dataProvider provideMockCollections
  */
 public function testSetMockCollection($colls)
 {
     $entity = $this->createTestEntity();
     foreach ($colls as $coll) {
         $set = \Psc\Code\Code::castSetter($coll);
         $this->assertChainable($set($this->emm, array($entity)));
         $this->assertEquals(array($entity), $this->emm->getMockCollection($coll)->toArray());
     }
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:12,代码来源:EntityManagerTest.php

示例2: doExecute

 protected function doExecute($input, $output)
 {
     $extensionGClass = $this->parseExtensionGClass($input);
     $inputParams = $this->parseParams($input);
     $constructParams = array();
     foreach ($this->getConstructorFields($extensionGClass) as $name) {
         if (array_key_exists($name, $inputParams)) {
             $constructParams[] = $inputParams[$name];
             unset($inputParams[$name]);
         }
     }
     $extension = $extensionGClass->newInstance($constructParams);
     foreach ($inputParams as $name => $value) {
         $set = Code::castSetter($name);
         $set($extension, $value);
     }
     $compiler = $this->getCompiler();
     $compiler->addExtension($extension);
     $compiler->compile($this->getOutFile());
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:20,代码来源:GenericCompileCommand.php

示例3: generateSetter

 protected function generateSetter($property)
 {
     return Code::castSetter($property);
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:4,代码来源:CodeTester.php

示例4: testCastSetter

 public function testCastSetter()
 {
     $object = new TestingClass('v1', 'v2');
     // pre
     $this->assertEquals('v1', $object->getProp1());
     $this->assertEquals('v2', $object->getProp2());
     // test
     $setter = Code::castSetter('prop1');
     $setter($object, 'setv1');
     $this->assertEquals('setv1', $object->getProp1());
     $setter = Code::castSetter('prop2');
     $setter($object, 'setv2');
     $this->assertEquals('setv2', $object->getProp2());
     $setter = Code::castSetter('setProp1');
     $setter($object, 'setv1');
     $this->assertEquals('setv1', $object->getProp1());
     $setter = Code::castSetter('setProp2');
     $setter($object, 'setv2');
     $this->assertEquals('setv2', $object->getProp2());
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:20,代码来源:CodeTest.php


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