Skip to content

Commit

Permalink
Merge bd35573 into 7aace20
Browse files Browse the repository at this point in the history
  • Loading branch information
scrutinizer-auto-fixer committed Jul 15, 2018
2 parents 7aace20 + bd35573 commit c5915b7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Accent/Accent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function unparseUrl($parsed_url)
$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
$pass = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : '';
$url .= $user.(($user || $pass) ? "$pass@" : '');
if (! empty($url)) {
if (!empty($url)) {
$url .= isset($parsed_url['path']) ? '/'.ltrim($parsed_url['path'], '/') : '';
} elseif (empty($url)) {
$url .= isset($parsed_url['path']) ? $parsed_url['path'] : '';
Expand Down
6 changes: 3 additions & 3 deletions src/Dialect.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public function translateAll($excludeCurrentLocale = true)
public function translate($routeName, $routeAttributes = null, $locale = null)
{
// If no locale is given, we use the current locale
if (! $locale) {
if (!$locale) {
$locale = tongue()->current();
}

if (! $this->parsed_url) {
if (!$this->parsed_url) {
$this->parsed_url = Accent::parseCurrentUrl();
}

Expand Down Expand Up @@ -163,7 +163,7 @@ public function interpret($routeName)
{
$routePath = Accent::findRoutePathByName($routeName);

if (! isset($this->translatedRoutes[$routeName])) {
if (!isset($this->translatedRoutes[$routeName])) {
$this->translatedRoutes[$routeName] = $routePath;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Localization/Localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static function decipherTongue()
{
$locale = self::fromUrl();

if (! $locale) {
if (! Config::beautify()) {
if (!$locale) {
if (!Config::beautify()) {
return Config::fallbackLocale(); //redirects see test it_ignoes_cookies_and_redirects....
}

Expand Down Expand Up @@ -85,7 +85,7 @@ protected static function currentTongue()
*/
protected static function languageIsSet()
{
return ! app()->runningInConsole() || array_has(request()->server(), 'HTTP_ACCEPT_LANGUAGE');
return !app()->runningInConsole() || array_has(request()->server(), 'HTTP_ACCEPT_LANGUAGE');
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Localization/TongueDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function negotiateLanguage()
$matches = $this->getMatchesFromAcceptedLanguages();

foreach ($matches as $key => $q) {
if (! empty($this->supportedLanguages[$key])) {
if (!empty($this->supportedLanguages[$key])) {
return $key;
}

Expand All @@ -87,10 +87,10 @@ public function negotiateLanguage()
return key($this->supportedLanguages);
}

if ($this->use_intl && ! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
if ($this->use_intl && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$http_accept_language = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);

if (! empty($this->supportedLanguages[$http_accept_language])) {
if (!empty($this->supportedLanguages[$http_accept_language])) {
return $http_accept_language;
}
}
Expand All @@ -99,7 +99,7 @@ public function negotiateLanguage()
$remote_host = explode('.', $this->request->server('REMOTE_HOST'));
$lang = strtolower(end($remote_host));

if (! empty($this->supportedLanguages[$lang])) {
if (!empty($this->supportedLanguages[$lang])) {
return $lang;
}
}
Expand Down Expand Up @@ -143,7 +143,7 @@ private function getMatchesFromAcceptedLanguages()
//less than it's parent.
$l_ops = explode('-', $l);
array_pop($l_ops);
while (! empty($l_ops)) {
while (!empty($l_ops)) {
//The new generic option needs to be slightly less important than it's base
$q -= 0.001;
$op = implode('-', $l_ops);
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function register()
'localization'
);

$this->app->singleton('tongue', function ($app) {
$this->app->singleton('tongue', function($app) {
return new Tongue($app);
});

$this->app->singleton('dialect', function ($app) {
$this->app->singleton('dialect', function($app) {
return new Dialect($app);
});
}
Expand Down
14 changes: 7 additions & 7 deletions src/Tongue.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function current($key = null)
{
$locale = $this->app->getLocale();

if (! $key) {
if (!$key) {
return $locale;
}

Expand Down Expand Up @@ -89,7 +89,7 @@ public function twister()
//fallback language is the same as the current language
if (Config::beautify() && $this->current() === Config::fallbackLocale()) {
//didn't found locale means browser is set to exmaple.com
if (! $locale) {
if (!$locale) {
return false;
}
//browser is set to en.example.com but should be forced back to example.com
Expand All @@ -111,7 +111,7 @@ public function twister()
*/
public function speaks(string $locale)
{
if (! $this->isSpeaking($locale)) {
if (!$this->isSpeaking($locale)) {
return abort(404); //oder error?
}

Expand Down Expand Up @@ -153,15 +153,15 @@ public function speaking($key = null, $locale = null)
{
$locales = Config::supportedLocales();

if (empty($locales) || ! is_array($locales)) {
if (empty($locales) || !is_array($locales)) {
throw new SupportedLocalesNotDefined();
}

if (! $key) {
if (!$key) {
return collect($locales);
}

if (! array_has($locales, "{$locale}.{$key}")) {
if (!array_has($locales, "{$locale}.{$key}")) {
throw new SupportedLocalesNotDefined();
}

Expand All @@ -176,7 +176,7 @@ public function speaking($key = null, $locale = null)
*/
protected function findLocale()
{
if (! Config::subdomain()) {
if (!Config::subdomain()) {
return false; //use Mcamara Localization
}

Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use Pmochine\LaravelTongue\Tongue;
use Pmochine\LaravelTongue\Dialect;

if (! function_exists('tongue')) {
if (!function_exists('tongue')) {
function tongue()
{
return app()->make(Tongue::class);
}
}
if (! function_exists('dialect')) {
if (!function_exists('dialect')) {
function dialect()
{
return app()->make(Dialect::class);
Expand Down

0 comments on commit c5915b7

Please sign in to comment.