/** * */ public function testLengthWithWrongDatatype() { $this->assertFalse(Collection::length('abc')); }
/** * */ protected function generateRandomPassword() { $password = ''; for ($i = 0; $i < $this->numberOfPasswords; $i++) { for ($j = 0; $j < $this->passwordLength; $j++) { $password .= $this->charArray[rand(0, Collection::length($this->charArray) - 1)]; } } $this->passwords[] = $password; }
/** * Load one or more data sets * * @param int|string $primaryValue The value for the primary key * * @return void */ public function load($primaryValue = null) { $model = $this->model; $query = []; /** @noinspection PhpUndefinedFieldInspection */ $query[] = 'SELECT * FROM ' . $model::TABLE; $query = $this->loadWithPrimaryKey($primaryValue, $model, $query); $dataCollection = $this->databaseObject->getInstance()->setQuery(Collection::implode($query, ''))->fetch(); if (Collection::length($dataCollection) === 1 || $primaryValue === null) { $this->loadSingleEntry($dataCollection, $model); } elseif (Collection::length($dataCollection) > 2) { $this->setProperties($dataCollection[0], $this); } }