Exemplo n.º 1
0
 /**
  * Checks whether a list of dependencies is met.
  * 
  * @param      array  The list of dependencies that have to meet.
  * @param      AgaviVirtualArrayPath The base path to which all tokens are 
  *                                   appended.
  * 
  * @return     bool all dependencies are met
  * 
  * @author     Uwe Mesecke <*****@*****.**>
  * @since      0.11.0
  */
 public function checkDependencies(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);
         if (!$path->getValue($this->depData)) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 2
0
 public function testSetValueByChildPath()
 {
     $array = array("path" => array("jump" => array("sip" => "whatever")));
     $default = array('more' => 'less');
     $path = 'sip';
     $value = 'sup';
     $obj = new AgaviVirtualArrayPath("path[jump]");
     $obj->setValueByChildPath($path, $array, $value);
     $this->assertEquals(array('sip' => 'sup'), $obj->getValue($array));
 }