本文整理汇总了PHP中ReflectionMethod::invokeArgs方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionMethod::invokeArgs方法的具体用法?PHP ReflectionMethod::invokeArgs怎么用?PHP ReflectionMethod::invokeArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionMethod
的用法示例。
在下文中一共展示了ReflectionMethod::invokeArgs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOn_escapeTemplate
/**
* @covers LightnCandy\SafeString::escapeTemplate
*/
public function testOn_escapeTemplate()
{
$method = new \ReflectionMethod('LightnCandy\\SafeString', 'escapeTemplate');
$this->assertEquals('abc', $method->invokeArgs(null, array_by_ref(array('abc'))));
$this->assertEquals('a\\\\bc', $method->invokeArgs(null, array_by_ref(array('a\\bc'))));
$this->assertEquals('a\\\'bc', $method->invokeArgs(null, array_by_ref(array('a\'bc'))));
}
示例2: execute
public function execute($argv)
{
if (!is_array($argv)) {
$argv = array($argv);
}
$argc = count($argv);
if (empty($this->action)) {
throw new \Jolt\Exception('controller_action_not_set');
}
try {
$action = new \ReflectionMethod($this, $this->action);
} catch (\ReflectionException $e) {
throw new \Jolt\Exception('controller_action_not_part_of_class');
}
$paramCount = $action->getNumberOfRequiredParameters();
if ($paramCount != $argc && $paramCount > $argc) {
$argv = array_pad($argv, $paramCount, NULL);
}
ob_start();
if ($action->isPublic()) {
if ($action->isStatic()) {
$action->invokeArgs(NULL, $argv);
} else {
$action->invokeArgs($this, $argv);
}
}
$renderedController = ob_get_clean();
if (!empty($renderedController)) {
$this->renderedController = $renderedController;
} else {
$this->renderedController = $this->renderedView;
}
return $this->renderedController;
}
示例3: testOn_handleError
/**
* @covers LightnCandy\LightnCandy::handleError
*/
public function testOn_handleError()
{
$method = new \ReflectionMethod('LightnCandy\\LightnCandy', 'handleError');
$method->setAccessible(true);
$this->assertEquals(false, $method->invokeArgs(null, array_by_ref(array(array('error' => array())))));
$this->assertEquals(true, $method->invokeArgs(null, array_by_ref(array(array('error' => array('some error'), 'flags' => array('errorlog' => 0, 'exception' => 0))))));
}
示例4: testOn_toString
/**
* @covers LightnCandy\Token::toString
*/
public function testOn_toString()
{
$method = new \ReflectionMethod('LightnCandy\\Token', 'toString');
$this->assertEquals('c', $method->invokeArgs(null, array_by_ref(array(array(0, 'a', 'b', 'c', 'd', 'e')))));
$this->assertEquals('cd', $method->invokeArgs(null, array_by_ref(array(array(0, 'a', 'b', 'c', 'd', 'e', 'f')))));
$this->assertEquals('qd', $method->invokeArgs(null, array_by_ref(array(array(0, 'a', 'b', 'c', 'd', 'e', 'f'), array(3 => 'q')))));
}
示例5: testAddOrderBy
/**
* @dataProvider orderByProvider
*/
public function testAddOrderBy($alias, $orderBy, $expectedOrderBy)
{
foreach ($expectedOrderBy as $field => $order) {
$this->queryBuilder->addOrderBy($field, $order)->shouldBeCalledTimes(1);
}
$this->addOrderByFunction->invokeArgs($this->orderByTrait, [$this->queryBuilder->reveal(), $alias, $orderBy]);
}
示例6: testRelToAbs
public function testRelToAbs()
{
$method = new ReflectionMethod('gsavastano\\Dssg\\Dssg', 'relToAbs');
$method->setAccessible(TRUE);
$this->assertEquals('http://www.example.com/rel2abs', $method->invokeArgs(new Dssg(), array('/rel2abs', 'http://www.example.com/')));
$this->assertEquals('http://www.example.com/../rel2abs', $method->invokeArgs(new Dssg(), array('../rel2abs', 'http://www.example.com/')));
$this->assertNotEquals('http://www.example.com/rel2abs', $method->invokeArgs(new Dssg(), array('http://example.com/rel2abs', 'http://www.example.com/')));
}
示例7: call
/**
* Call a class reference method with set parameters.
* @param $classInstance instantiated class name
*/
public function call($classInstance)
{
if (isset($this->parameters)) {
$this->method->invokeArgs($classInstance, $this->parameters);
} else {
$this->method->invoke($classInstance);
}
}
示例8: __call
public function __call($methodName, array $args)
{
$method = new \ReflectionMethod($this->class, $methodName);
if (!$method->isPublic()) {
$method->setAccessible(true);
}
return $method->isStatic() ? $method->invokeArgs(null, $args) : $method->invokeArgs($this->object, $args);
}
示例9: testOn_addUsageCount
/**
* @covers LightnCandy\Compiler::addUsageCount
*/
public function testOn_addUsageCount()
{
$method = new \ReflectionMethod('LightnCandy\\Compiler', 'addUsageCount');
$method->setAccessible(true);
$this->assertEquals(1, $method->invokeArgs(null, array_by_ref(array(array('usedCount' => array('test' => array())), 'test', 'testname'))));
$this->assertEquals(3, $method->invokeArgs(null, array_by_ref(array(array('usedCount' => array('test' => array('testname' => 2))), 'test', 'testname'))));
$this->assertEquals(5, $method->invokeArgs(null, array_by_ref(array(array('usedCount' => array('test' => array('testname' => 2))), 'test', 'testname', 3))));
}
示例10: testOn_encq
/**
* @covers LightnCandy\Encoder::encq
*/
public function testOn_encq()
{
$method = new \ReflectionMethod('LightnCandy\\Encoder', 'encq');
$this->assertEquals('a', $method->invokeArgs(null, array_by_ref(array(array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'))));
$this->assertEquals('a&b', $method->invokeArgs(null, array_by_ref(array(array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a&b'))));
$this->assertEquals('a'b', $method->invokeArgs(null, array_by_ref(array(array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a\'b'))));
$this->assertEquals('`a'b', $method->invokeArgs(null, array_by_ref(array(array('flags' => array('mustlam' => 0, 'lambda' => 0)), '`a\'b'))));
}
示例11: testCountryCodeSearch
public function testCountryCodeSearch()
{
$method = new ReflectionMethod('Player', 'countryCode');
$method->setAccessible(TRUE);
$player = new Player(null);
$this->assertEquals('FI', $method->invokeArgs($player, array('Finland')));
$this->assertEquals('UNK', $method->invokeArgs($player, array('Random')));
$this->assertEquals('UNK', $method->invokeArgs($player, array(123)));
}
示例12: testOn_prePartial
/**
* @covers LightnCandy\Partial::prePartial
*/
public function testOn_prePartial()
{
$method = new \ReflectionMethod('LightnCandy\\Partial', 'prePartial');
$method->setAccessible(true);
$this->assertEquals('hey', $method->invokeArgs(null, array_by_ref(array(array('prepartial' => false), 'hey', 'haha'))));
$this->assertEquals('haha-hoho', $method->invokeArgs(null, array_by_ref(array(array('prepartial' => function ($cx, $tmpl, $name) {
return "{$name}-{$tmpl}";
}), 'hoho', 'haha'))));
}
示例13: testCreateTableDDL
public function testCreateTableDDL()
{
$driver = new \T4\Dbal\Drivers\Mysql();
$reflector = new ReflectionMethod($driver, 'createTableDDL');
$reflector->setAccessible(true);
$this->assertEquals('CREATE TABLE `foo`' . "\n" . '(' . "\n" . '`__id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,' . "\n" . 'PRIMARY KEY (`__id`)' . "\n" . ')', $reflector->invokeArgs($driver, ['foo', []]));
$this->assertEquals('CREATE TABLE `foo`' . "\n" . '(' . "\n" . '`__id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,' . "\n" . '`foo` INT(11),' . "\n" . '`bar` VARCHAR(255),' . "\n" . 'PRIMARY KEY (`__id`)' . "\n" . ')', $reflector->invokeArgs($driver, ['foo', ['foo' => ['type' => 'int'], 'bar' => ['type' => 'string']]]));
$this->assertEquals('CREATE TABLE `foo`' . "\n" . '(' . "\n" . '`__id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,' . "\n" . '`lnk` BIGINT UNSIGNED NOT NULL DEFAULT \'0\',' . "\n" . '`foo` INT(11),' . "\n" . '`bar` VARCHAR(255),' . "\n" . 'PRIMARY KEY (`__id`),' . "\n" . 'INDEX `lnk_idx` (`lnk`)' . "\n" . ')', $reflector->invokeArgs($driver, ['foo', ['lnk' => ['type' => 'link'], 'foo' => ['type' => 'int'], 'bar' => ['type' => 'string']]]));
}
示例14: testCreateTableDDL
public function testCreateTableDDL()
{
$driver = new \T4\Dbal\Drivers\Pgsql();
$reflector = new ReflectionMethod($driver, 'createTableDDL');
$reflector->setAccessible(true);
$this->assertEquals(['CREATE TABLE "foo"' . "\n" . '("__id" BIGSERIAL PRIMARY KEY)'], $reflector->invokeArgs($driver, ['foo', []]));
$this->assertEquals(['CREATE TABLE "foo"' . "\n" . '("__id" BIGSERIAL PRIMARY KEY, "foo" INTEGER, "bar" VARCHAR)'], $reflector->invokeArgs($driver, ['foo', ['foo' => ['type' => 'int'], 'bar' => ['type' => 'string']]]));
$this->assertEquals(['CREATE TABLE "foo"' . "\n" . '("__id" BIGSERIAL PRIMARY KEY, "lnk" BIGINT NOT NULL DEFAULT \'0\', "foo" INTEGER, "bar" VARCHAR)', 'CREATE INDEX ON "foo" ("lnk")'], $reflector->invokeArgs($driver, ['foo', ['lnk' => ['type' => 'link'], 'foo' => ['type' => 'int'], 'bar' => ['type' => 'string']]]));
}
示例15: testEvalGroupParsesSimpleAndsAndOrs
public function testEvalGroupParsesSimpleAndsAndOrs()
{
$reflectionMethod = new \ReflectionMethod($this->evaluator, 'evalGroup');
$reflectionMethod->setAccessible(\true);
$result = $reflectionMethod->invokeArgs($this->evaluator, [[1 => '0|0|0|1|0&1']]);
$this->assertSame(1, $result);
$result = $reflectionMethod->invokeArgs($this->evaluator, [[1 => '0|0|0|0|0&0']]);
$this->assertSame(0, $result);
}