/** * Puts a list of tokens into the dependency cache. * * @param array The list of new tokens. * @param AgaviVirtualArrayPath The base path to which all tokens are * appended. * * @author Uwe Mesecke <*****@*****.**> * @since 0.11.0 */ public function addDependTokens(array $tokens, AgaviVirtualArrayPath $base) { $currentParts = $base->getParts(); foreach ($tokens as $token) { if ($currentParts && strpos($token, '%') !== false) { // the depends attribute contains sprintf syntax $token = vsprintf($token, $currentParts); } $path = new AgaviVirtualArrayPath($token); $path->setValue($this->depData, true); } }
public function testUnshift() { $obj = new AgaviVirtualArrayPath("path[jump]"); $obj->unshift('front'); $this->assertEquals('front', $obj->get(0)); $this->assertEquals('path', $obj->get(1)); $this->assertEquals('front', $obj->left(true)); $this->assertEquals(array('front', 'path', 'jump'), $obj->getParts()); $obj->unshift('again'); $this->assertEquals(4, $obj->length()); $this->assertEquals('again', $obj->get(0)); $this->assertEquals('front', $obj->get(1)); $this->assertEquals('path', $obj->get(2)); $this->assertEquals('jump', $obj->get(3)); $this->assertEquals(array('again', 'front', 'path', 'jump'), $obj->getParts()); $obj->shift(); $this->assertEquals('front', $obj->left()); $this->assertEquals(array('front', 'path', 'jump'), $obj->getParts()); }