/** * @test */ public function parseRecognizesHttpsUris() { assert(Parse::toType('https://example.net/'), equals(HttpUri::fromString('https://example.net/'))); }
/** * returns boolean property which is retrieved via is$PROPERTYNAME() * * @param string $propertyName * @return bool */ protected function getBooleanProperty(string $propertyName) : bool { if (count($this->values) === 1 && isset($this->values['__value'])) { return Parse::toBool($this->values['__value']); } if (isset($this->values[$propertyName])) { return Parse::toBool($this->values[$propertyName]); } return false; }
/** * * @param mixed $expected * @param string $method * @test * @dataProvider methods * @since 5.0.0 */ public function parseNullWithDefaultReturnsDefault($expected, string $method) { $parse = new Parse(null); assert($parse->defaultingTo('foo')->{$method}(), equals('foo')); }
/** * Functions in namespace stubbles\peer\http. */ namespace stubbles\peer\http; /** * returns an empty accept header representation * * @return \stubbles\peer\http\AcceptHeader * @since 4.0.0 * @api */ function emptyAcceptHeader() : AcceptHeader { return new AcceptHeader(); } if (class_exists('stubbles\\values\\Parse')) { \stubbles\values\Parse::addRecognition(function ($string) { if (substr($string, 0, 4) === Http::SCHEME) { try { return HttpUri::fromString($string); } catch (\stubbles\peer\MalformedUri $murle) { } } return; }, HttpUri::class); } if (class_exists('stubbles\\values\\Value')) { \stubbles\values\Value::defineCheck('isHttpUri', [HttpUri::class, 'isValid']); \stubbles\values\Value::defineCheck('isExistingHttpUri', [HttpUri::class, 'exists']); }