/** * Apply styles to output * @param $str String to be styled * @param $styles String or Array<String> with styles to apply * Examples: * * Console::apply('Bob is going home', 'italic'); * Console::apply('Bob is going home', ['italic', 'red']); * * @return String styled */ public static function apply($str, $styles) { Arguments::validate($str, ['string']); Arguments::validate($styles, ['string', 'array']); if (!is_array($styles)) { $styles = [$styles]; } foreach ($styles as $style) { $str = self::_apply($str, $style); } return $str; }
/** * Must pass without complaining */ public function testNotNullOk() { $this->assertTrue(Arguments::notNull(1)); }
/** * Returns the current locale * @return String PHP locale string */ public static function getLocale() { $locale = Arguments::prioritize([\Locale::acceptFromHttp(self::safeHeader('HTTP_ACCEPT_LANGUAGE')), \Locale::getDefault(), Config::get('default_locale')]); return $locale; }