/** * creates collection elements for sections * * @param Array $sections * @return Collection * @author Dan Cox */ public function createCollectionSections(array $sections) { $collection = new Collection(); foreach ($sections as $map => $key) { $section = new Collection(); $collection->add($key, $section); } return $collection; }
/** * Removes the registered environment from the Application. * * @param String $name - the environment name * @return Application * @author Dan Cox */ public function deregisterEnvironment($name) { if ($this->envCollection->exists($name)) { $this->envCollection->remove($name); return $this; } // Throw exception throw new UnknownEnvironment($name); }
/** * Calls the validation method for each fields rules * * @return Boolean * @author Dan Cox */ public function validate() { $passes = true; $this->checkCSRFToken(); foreach ($this->fields as $field) { if (!$field->validate()) { $this->errors->add($field->getID(), $field->errors()); $passes = false; } } return $passes; }
/** * Test prepending dat * * @return void * @author Dan Cox */ public function test_prepend() { $collection = new Collection(['foo' => 'bar']); $collection->prepend(['test' => 'test']); $this->assertEquals(['test' => 'test', 'foo' => 'bar'], $collection->all()); }
/** * Loads a configuration * * @param String $name - The name of the connection * @param Array $configuration - The database settings for this connection * @return ConnectionCollection * @author Dan Cox */ public function add($name, $configuration = array(), $type = 'Array') { parent::add($name, $this->DI->get('connection.validator')->load($configuration, $type, $this->modelDirectories)); }