public function testIsIndexed() { $this->assertFalse(ArrayUtilities::isIndexed($this->associative)); $this->assertFalse(ArrayUtilities::isIndexed($this->mixed)); $this->assertTrue(ArrayUtilities::isIndexed($this->indexedSequential)); $this->assertTrue(ArrayUtilities::isIndexed($this->indexedNonSequential)); }
/** * @inheritdoc */ public function activateDecorators() { foreach (func_get_args() as $arg) { if (is_array($arg) && ArrayUtilities::isIndexed($arg)) { // An indexed array, recurse with each element of the array as a separate argument. call_user_func_array(array($this, 'activateDecorators'), $arg); } elseif (is_array($arg)) { // An associative array, ensure it has an 'arguments' key. $this->activeDecorators[] = array_merge(array('arguments' => array()), $arg); } elseif (is_string($arg)) { // A string, use the parseFunctionCall() utility method. $this->activeDecorators[] = PhpSourceUtilities::parseFunctionCall($arg); } else { // Unhandled type. throw new \InvalidArgumentException(sprintf('Cannot use [%s] as decorator specification', TypeUtilities::describe($arg))); } } return $this; }