當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。