/** * @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)); }
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; }
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 shouldReturnStringWhenNoMatchedTypes() { //given $int = 1; //when $string = Objects::toString($int); //then $this->assertSame('1', $string); }
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); }
/** * Returns model object as a nicely formatted string. */ public function inspect() { return get_called_class() . Objects::toString(Arrays::filter($this->_attributes, Functions::notNull())); }
public function __construct($message, array $errors) { parent::__construct($message . "\nErrors: " . Objects::toString($errors)); $this->_errors = $errors; }
function toString($object) { return Objects::toString($object); }