/** * * @param \blaze\io\File $dir * @param boolean $recursive * @return \blaze\collections\ListI */ private function parseDir(\blaze\io\File $dir, $recursive) { $mappings = new \blaze\collections\lists\ArrayList(); $files = $dir->listFiles(); foreach ($files as $file) { if ($recursive && $file->isDirectory()) { $mappings->addAll($this->parseDir($file, $recursive)); } if ($file->getFileName()->endsWith('.xml')) { $mappings->add($this->parseFile($file)); } } return $mappings; }
public function getDatabases() { $rs = $this->prepareStatement('SHOW DATABASES')->executeQuery(); $list = new \blaze\collections\lists\ArrayList(); while ($rs->next()) { $list->add($this->getDatabase($rs->getString(0))); } return $list; }
public function testRetainAll() { // Remove the following lines when you implement this test. $col = new \blaze\collections\lists\ArrayList(); $col->add(5); $col->add(2); $col->add(1); $this->object->retainAll($col); }
private function getBindings($node) { $bindings = new \blaze\collections\lists\ArrayList(); foreach ($node->childNodes as $child) { if ($child->nodeType == XML_ELEMENT_NODE && $child->localName == 'bindings') { foreach ($child as $binding) { $name = $binding->getAttribute('name'); $reference = $binding->getAttribute('reference'); $default = $binding->getAttribute('default'); $bindings->add(new \blaze\web\application\Binding($name, $reference, $default)); } } } return $bindings; }
private static function getMappings($node) { $mappings = new \blaze\collections\lists\ArrayList(); foreach ($node->childNodes as $child) { if ($child->localName == 'mapping') { $mappings->add($child->getAttribute('pattern')); } } return $mappings; }
private function getRequestedFilters(\blaze\netlet\http\HttpNetletRequest $request, \blaze\netlet\NetletContext $context) { $uri = $request->getRequestURI()->getPath(); if (!$uri->endsWith('/')) { $uri = $uri->concat('/'); } $filterArr = new \blaze\collections\lists\ArrayList(); // Looking in the filter mapping for a filter that fits the url foreach ($context->getFilterMapping() as $key => $name) { // Make a regex placeholders of the wildcards $regex = '/' . strtolower(str_replace(array('/', '*'), array('\\/', '.*'), $key)) . '/'; // Check if the requested url fits a netlet mapping if ($uri->matches($regex)) { $filters = $context->getFilters(); $filterArr->add($filters->get($name)); } } return $filterArr; }
public function values() { $list = new \blaze\collections\lists\ArrayList(); foreach ($this as $val) { $list->add($val); } return $list; }
public function testRetainAll() { // Remove the following lines when you implement this test. $list = new \blaze\collections\lists\ArrayList(); $list->add(5); $list->add(6); $list->add(7); $this->assertTrue($this->object->retainAll($list)); }