public function __get($field) { $this->_operations[] = function ($input) use($field) { return Objects::getValue($input, $field); }; return $this; }
/** * @test * @dataProvider toBoolean * @param $string * @param $expected */ public function shouldConvertToBoolean($string, $expected) { //when $toBoolean = Booleans::toBoolean($string); //then $this->assertEquals($expected, $toBoolean, 'To convert: ' . Objects::toString($string) . ' Expected: ' . Objects::toString($expected)); }
public function _addBindValue($value) { if (is_array($value)) { $this->_addBindArrayValue($value); } else { $this->_boundValues[] = is_bool($value) ? Objects::booleanToString($value) : $value; } }
private function convertRowToModel($row, $aliasToOffset, $joinsToStore) { $model = $this->extractModelFromResult($this->metaInstance, $row, $aliasToOffset[$this->alias]); foreach ($joinsToStore as $joinedModel) { if ($joinedModel->storeField()) { $instance = $this->extractModelFromResult($joinedModel->getModelObject(), $row, $aliasToOffset[$joinedModel->alias()]); Objects::setValueRecursively($model, $joinedModel->destinationField(), $instance); } } return $model; }
private static function stringifyArrayElements($array) { $elements = array(); $isAssociative = array_keys($array) !== range(0, sizeof($array) - 1); array_walk($array, function ($element, $key) use(&$elements, $isAssociative) { if ($isAssociative) { $elements[] = "<{$key}> => " . Objects::toString($element); } else { $elements[] = Objects::toString($element); } }); return $elements; }
private function substituteParam() { $value = $this->_boundValues[$this->_param_index]; $this->_param_index++; if ($value === null) { return "null"; } if (is_bool($value)) { return Objects::booleanToString($value); } $value = Db::getInstance()->_dbHandle->quote($value); return $value; }
public function render(OuzoExceptionData $exceptionData, $viewName) { /** @noinspection PhpUnusedLocalVariableInspection */ $errorMessage = $exceptionData->getMessage(); $errorTrace = $exceptionData->getStackTrace(); Logger::getLogger(__CLASS__)->error($exceptionData->getOriginalMessage()); Logger::getLogger(__CLASS__)->error(Objects::toString($errorTrace)); $this->clearOutputBuffers(); header($exceptionData->getHeader()); $responseType = ResponseTypeResolve::resolve(); header('Content-type: ' . $responseType); $additionalHeaders = $exceptionData->getAdditionalHeaders(); array_walk($additionalHeaders, function ($header) { header($header); }); /** @noinspection PhpIncludeInspection */ require ViewPathResolver::resolveViewPath($viewName, $responseType); }
public function revertProperty($keys) { $keys = Arrays::toArray($keys); $config =& $this->_config; $overriddenConfig =& $this->_overriddenConfig; $overriddenKey = null; foreach ($keys as $key) { if (!array_key_exists($key, $overriddenConfig)) { throw new InvalidArgumentException('Cannot revert. No configuration override for: ' . Objects::toString($keys)); } $config =& $config[$key]; if (is_array($overriddenConfig[$key])) { $overriddenConfig =& $overriddenConfig[$key]; } else { $overriddenKey = $key; } } $config = $overriddenConfig[$overriddenKey]; }
public function containsKeyAndValue($elements) { $contains = array_intersect_key($this->actual, $elements); $elementsString = Objects::toString($elements); AssertAdapter::assertEquals($elements, $contains, "Cannot find key value pairs {$elementsString} in actual {$this->actualString}"); return $this; }
/** * @test */ public function shouldReturnValueFormMultidimensionalArray() { //given $array = array('id' => 123, 'name' => 'John', 'info' => array('account' => array('number' => '2343-de', 'info' => 'some info about account'))); //when $value = Objects::getValueRecursively($array, 'info->account->number'); //then $this->assertEquals('2343-de', $value); }
public static function toString() { return function ($object) { return Objects::toString($object); }; }
public function _createPdoStatement() { $sqlString = $this->_humanizedSql . ' with params: ' . Objects::toString($this->_boundValues); Logger::getLogger(__CLASS__)->info("Query: %s", array($sqlString)); return $this->_pdoExecutor->createPDOStatement($this->_dbHandle, $this->_sql, $this->_boundValues, $sqlString); }
public function get($names, $default = null) { return Objects::getValueRecursively($this, $names, $default); }
public function __construct($message, array $errors) { parent::__construct($message . "\nErrors: " . Objects::toString($errors)); $this->_errors = $errors; }
function toString($object) { return Objects::toString($object); }