| @@ -191,7 +191,7 @@ discard block | ||
| 191 | 191 |          try { | 
| 192 | 192 | return app()->getLocale(); | 
| 193 | 193 |          } catch (Exception $e) { | 
| 194 | -            if($this->request->request->has('locale')){ | |
| 194 | +            if ($this->request->request->has('locale')) { | |
| 195 | 195 |                  return strtolower($this->request->input('locale')); | 
| 196 | 196 | } | 
| 197 | 197 |              if ($this->request->hasHeader('locale')) { | 
| @@ -203,7 +203,7 @@ discard block | ||
| 203 | 203 |              if ($this->request->hasSession() and $this->request->session()->has('locale')) { | 
| 204 | 204 |                  return $this->request->session()->get('locale'); | 
| 205 | 205 | } | 
| 206 | -            if ($locale = substr($this->request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2) and in_array($locale, config('translation.locales'))){ | |
| 206 | +            if ($locale = substr($this->request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2) and in_array($locale, config('translation.locales'))) { | |
| 207 | 207 | return $locale; | 
| 208 | 208 | } | 
| 209 | 209 | return $this->getConfigDefaultLocale(); | 
| @@ -657,7 +657,7 @@ discard block | ||
| 657 | 657 | * Detects the Default Locale Based on | 
| 658 | 658 | */ | 
| 659 | 659 | |
| 660 | -    public function detectLocale($request){ | |
| 660 | +    public function detectLocale($request) { | |
| 661 | 661 |          if (!$request->hasCookie('locale')) { | 
| 662 | 662 |              $locale = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2); | 
| 663 | 663 | |
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | private function unsignedRightShift($a, $b) | 
| 113 | 113 |      { | 
| 114 | 114 |          if ($b >= 32 || $b < -32) { | 
| 115 | - $m = (int)($b / 32); | |
| 115 | + $m = (int) ($b / 32); | |
| 116 | 116 | $b = $b - ($m * 32); | 
| 117 | 117 | } | 
| 118 | 118 | |
| @@ -146,7 +146,7 @@ discard block | ||
| 146 | 146 | */ | 
| 147 | 147 |      private function JS_charCodeAt($str, $index) { | 
| 148 | 148 | $utf16 = mb_convert_encoding($str, 'UTF-16LE', 'UTF-8'); | 
| 149 | - return ord($utf16[$index*2]) + (ord($utf16[$index*2+1]) << 8); | |
| 149 | + return ord($utf16[$index * 2]) + (ord($utf16[$index * 2 + 1]) << 8); | |
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | 152 | /** | 
| @@ -158,6 +158,6 @@ discard block | ||
| 158 | 158 | */ | 
| 159 | 159 |      private function JS_length($str) { | 
| 160 | 160 | $utf16 = mb_convert_encoding($str, 'UTF-16LE', 'UTF-8'); | 
| 161 | - return strlen($utf16)/2; | |
| 161 | + return strlen($utf16) / 2; | |
| 162 | 162 | } | 
| 163 | 163 | } | 
| @@ -56,15 +56,15 @@ discard block | ||
| 56 | 56 | 'client' => 'webapp', | 
| 57 | 57 | 'hl' => 'en', | 
| 58 | 58 | 'dt' => [ | 
| 59 | - 't', // Translate | |
| 60 | - 'bd', // Full translate with synonym ($bodyArray[1]) | |
| 61 | - 'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word) | |
| 62 | - 'ex', // Example part ($bodyArray[13]) | |
| 63 | - 'ld', // I don't know ($bodyArray[8]) | |
| 64 | - 'md', // Definition part with example ($bodyArray[12]) | |
| 59 | + 't', // Translate | |
| 60 | + 'bd', // Full translate with synonym ($bodyArray[1]) | |
| 61 | + 'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word) | |
| 62 | + 'ex', // Example part ($bodyArray[13]) | |
| 63 | + 'ld', // I don't know ($bodyArray[8]) | |
| 64 | + 'md', // Definition part with example ($bodyArray[12]) | |
| 65 | 65 | 'qca', // I don't know ($bodyArray[8]) | 
| 66 | - 'rw', // Read also part ($bodyArray[14]) | |
| 67 | - 'rm', // I don't know | |
| 66 | + 'rw', // Read also part ($bodyArray[14]) | |
| 67 | + 'rm', // I don't know | |
| 68 | 68 | 'ss' // Full synonym ($bodyArray[11]) | 
| 69 | 69 | ], | 
| 70 | 70 | 'sl' => null, // Source language | 
| @@ -269,7 +269,7 @@ discard block | ||
| 269 | 269 | return $responseArray; | 
| 270 | 270 |          } else { | 
| 271 | 271 |              if (is_array($responseArray[0])) { | 
| 272 | -                return (string) array_reduce($responseArray[0], function ($carry, $item) { | |
| 272 | +                return (string) array_reduce($responseArray[0], function($carry, $item) { | |
| 273 | 273 | $carry .= $item[0]; | 
| 274 | 274 | return $carry; | 
| 275 | 275 | }); | 
| @@ -12,7 +12,7 @@ discard block | ||
| 12 | 12 | */ | 
| 13 | 13 | public function up() | 
| 14 | 14 |      { | 
| 15 | -        Schema::create('locales', function (Blueprint $table) { | |
| 15 | +        Schema::create('locales', function(Blueprint $table) { | |
| 16 | 16 |              $table->string('code')->unique(); | 
| 17 | 17 |              $table->primary('code'); | 
| 18 | 18 |              $table->string('lang_code')->nullable(); | 
| @@ -21,7 +21,7 @@ discard block | ||
| 21 | 21 | $table->timestamps(); | 
| 22 | 22 | }); | 
| 23 | 23 | |
| 24 | -        Schema::create('languages', function ($table) { | |
| 24 | +        Schema::create('languages', function($table) { | |
| 25 | 25 |              $table->increments('id'); | 
| 26 | 26 |              $table->string('locale', 10)->unique(); | 
| 27 | 27 |              $table->string('name', 60)->unique(); | 
| @@ -30,7 +30,7 @@ discard block | ||
| 30 | 30 | }); | 
| 31 | 31 | |
| 32 | 32 | |
| 33 | -        Schema::create('translations', function ($table) { | |
| 33 | +        Schema::create('translations', function($table) { | |
| 34 | 34 |              $table->increments('id'); | 
| 35 | 35 |              $table->string('locale', 10); | 
| 36 | 36 |              $table->string('namespace')->default('*'); | 
| @@ -50,7 +50,7 @@ | ||
| 50 | 50 |              if (!$this->translationCodeFor($attribute)) { | 
| 51 | 51 | $reflected = new \ReflectionClass($this); | 
| 52 | 52 | $group = 'translatable'; | 
| 53 | - $item = strtolower($reflected->getShortName()) . '.' . strtolower($attribute) . '.' . Str::random(); | |
| 53 | + $item = strtolower($reflected->getShortName()).'.'.strtolower($attribute).'.'.Str::random(); | |
| 54 | 54 |                  $this->attributes["{$attribute}_translation"] = "$group.$item"; | 
| 55 | 55 | } | 
| 56 | 56 | } | 
| @@ -237,7 +237,7 @@ discard block | ||
| 237 | 237 | ->whereGroup($group) | 
| 238 | 238 | ->get() | 
| 239 | 239 |              ->keyBy('item') | 
| 240 | -            ->map(function ($translation) { | |
| 240 | +            ->map(function($translation) { | |
| 241 | 241 | return $translation['text']; | 
| 242 | 242 | }) | 
| 243 | 243 | ->toArray(); | 
| @@ -281,7 +281,7 @@ discard block | ||
| 281 | 281 |          $elements = explode('.', $partialCode); | 
| 282 | 282 |          foreach ($elements as $element) { | 
| 283 | 283 |              if ($element) { | 
| 284 | -                $query = $query->where(function ($query) use ($element) { | |
| 284 | +                $query = $query->where(function($query) use ($element) { | |
| 285 | 285 |                      $query->where('group', 'like', "%{$element}%")->orWhere('item', 'like', "%{$element}%")->orWhere('text', 'like', "%{$element}%"); | 
| 286 | 286 | }); | 
| 287 | 287 | } | 
| @@ -361,9 +361,9 @@ discard block | ||
| 361 | 361 | |
| 362 | 362 | return $this->model | 
| 363 | 363 | ->newQuery() | 
| 364 | - ->select($table . '.text') | |
| 364 | + ->select($table.'.text') | |
| 365 | 365 | ->from($table) | 
| 366 | -            ->leftJoin("{$table} as e", function ($join) use ($table, $text, $textLocale) { | |
| 366 | +            ->leftJoin("{$table} as e", function($join) use ($table, $text, $textLocale) { | |
| 367 | 367 |                  $join->on('e.namespace', '=', "{$table}.namespace") | 
| 368 | 368 |                      ->on('e.group', '=', "{$table}.group") | 
| 369 | 369 |                      ->on('e.item', '=', "{$table}.item"); | 
| @@ -466,7 +466,7 @@ discard block | ||
| 466 | 466 | |
| 467 | 467 |          return $this->database->table("$table as $table") | 
| 468 | 468 |              ->select("$table.id") | 
| 469 | -            ->leftJoin("$table as e", function (JoinClause $query) use ($table, $locale) { | |
| 469 | +            ->leftJoin("$table as e", function(JoinClause $query) use ($table, $locale) { | |
| 470 | 470 |                  $query->on('e.namespace', '=', "$table.namespace") | 
| 471 | 471 |                      ->on('e.group', '=', "$table.group") | 
| 472 | 472 |                      ->on('e.item', '=', "$table.item") | 
| @@ -106,8 +106,8 @@ discard block | ||
| 106 | 106 | // Load all files inside subdirectories: | 
| 107 | 107 | $directories = $this->files->directories($path); | 
| 108 | 108 |          foreach ($directories as $directory) { | 
| 109 | - $directoryName = str_replace($path . '/', '', $directory); | |
| 110 | - $dirGroup = $group . basename($directory) . '/'; | |
| 109 | + $directoryName = str_replace($path.'/', '', $directory); | |
| 110 | + $dirGroup = $group.basename($directory).'/'; | |
| 111 | 111 | $this->loadDirectory($directory, $locale, $namespace, $dirGroup); | 
| 112 | 112 | } | 
| 113 | 113 | |
| @@ -129,7 +129,7 @@ discard block | ||
| 129 | 129 | */ | 
| 130 | 130 | public function loadFile($file, $locale, $namespace = '*', $group = '') | 
| 131 | 131 |      { | 
| 132 | - $group = $group . basename($file, '.php'); | |
| 132 | + $group = $group.basename($file, '.php'); | |
| 133 | 133 | $translations = $this->files->getRequire($file); | 
| 134 | 134 | $this->translationRepository->loadArray($translations, $locale, $group, $namespace, $locale == $this->defaultLocale); | 
| 135 | 135 | } | 
| @@ -52,8 +52,8 @@ | ||
| 52 | 52 | * Execute the console command for Laravel 5.5 | 
| 53 | 53 | * this laravel version call handle intead of fire | 
| 54 | 54 | */ | 
| 55 | - public function handle() | |
| 56 | -     { | |
| 57 | - $this->fire(); | |
| 58 | - } | |
| 55 | + public function handle() | |
| 56 | +        { | |
| 57 | + $this->fire(); | |
| 58 | + } | |
| 59 | 59 | } | 
| @@ -109,7 +109,7 @@ | ||
| 109 | 109 | */ | 
| 110 | 110 | protected function pathFromParsedUrl($parsedUrl) | 
| 111 | 111 |      { | 
| 112 | -        $path = '/' . implode('/', $parsedUrl['segments']); | |
| 112 | +        $path = '/'.implode('/', $parsedUrl['segments']); | |
| 113 | 113 |          if ($parsedUrl['query']) { | 
| 114 | 114 |              $path .= "?{$parsedUrl['query']}"; | 
| 115 | 115 | } |