/** * 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; }
/** * 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; }
/** * Registers an environment so it can be used in App start up. * * @param String $name - the name of the environment * @param String $class - fully qualified class name as a string * @return Application * @author Dan Cox */ public function registerEnvironment($name, $class) { $this->envCollection->add($name, $class); return $this; }
/** * Test adding a new record through the "Add" method * * @return void * @author Dan Cox */ public function test_add() { $collection = new Collection(array('foo' => 'bar')); $collection->add('key', 'value'); $this->assertTrue(isset($collection['key'])); }
/** * 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)); }