本文整理汇总了PHP中Map::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::execute方法的具体用法?PHP Map::execute怎么用?PHP Map::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::execute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFilteredValue
public function testFilteredValue()
{
$map = new Map();
$map->add(Path::factory('/test/description', 'desc')->setDefault('value')->filter(function ($val) {
return strrev($val);
}));
$result = $map->execute($this->object);
$this->assertTrue(is_array($result));
$this->assertArrayHasKey('desc', $result);
$this->assertEquals(strrev("test description"), $result['desc']);
}
示例2: execute
/**
* Checks if all array values match given arguments
* @return boolean
*/
public function execute()
{
$arr = parent::execute();
$args = $this->getArguments();
foreach ($args as $arg) {
if (!in_array($arg, $arr)) {
return false;
}
}
return true;
}
示例3: testWrongPath
public function testWrongPath()
{
$map = new Map();
$map->add(Path::factory('/test', 'test')->addChildren(Path::factory('wrong>path', 'wrong', 'defaultFalse')));
$result = $map->execute(new XmlFile(__DIR__ . '/test.xml'));
$this->assertTrue(is_array($result));
$this->assertArrayHasKey('test', $result);
$this->assertTrue(is_array($result['test']));
$this->assertArrayHasKey('wrong', $result['test']);
$this->assertEquals('defaultFalse', $result['test']['wrong']);
}
示例4: execute
/**
* Checks if any array value matches given arguments
* @return boolean
*/
public function execute()
{
$arr = parent::execute();
$args = $this->getArguments();
foreach ($args as $arg) {
foreach ($arr as $value) {
if ($value == $arg) {
return true;
}
}
}
return false;
}
示例5: execute
/**
* Adds all array values together
* @return integer
*/
public function execute()
{
return array_sum(parent::execute());
}
示例6: execute
/**
* Retrieves item of largest value
* @return integer
*/
public function execute()
{
return max(parent::execute());
}
示例7: execute
/**
* Retrieves the sum value of all array values
* @return integer
*/
public function execute()
{
$arr = parent::execute();
return array_sum($arr) / count($arr);
}