本文整理汇总了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());
}