本文整理匯總了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());
}
}
示例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());
}
示例3: generateSetter
protected function generateSetter($property)
{
return Code::castSetter($property);
}
示例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());
}