Completed
Push — master ( ab069f...de59d0 )
by Mike
03:18 queued 25s
created

TranslatableServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 2 Features 0
Metric Value
eloc 9
c 4
b 2
f 0
dl 0
loc 14
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: mikeh
5
 * Date: 2018-05-28
6
 * Time: 8:27 AM.
7
 */
8
9
namespace Mikehins\Translatable;
10
11
use Illuminate\Support\Collection;
12
use Illuminate\Support\ServiceProvider;
13
14
class TranslatableServiceProvider extends ServiceProvider
15
{
16
	public function boot()
17
	{
18
		$this->loadMigrationsFrom(__DIR__ . '/database/migrations/');
0 ignored issues
show
Bug introduced by
The method loadMigrationsFrom() does not exist on Mikehins\Translatable\TranslatableServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
		$this->/** @scrutinizer ignore-call */ 
19
         loadMigrationsFrom(__DIR__ . '/database/migrations/');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
		
20
		$this->publishes([
0 ignored issues
show
Bug introduced by
The method publishes() does not exist on Mikehins\Translatable\TranslatableServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
		$this->/** @scrutinizer ignore-call */ 
21
         publishes([

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
			__DIR__ . '/database/migrations/' => database_path('migrations')
22
		], 'migrations');
23
		
24
		$this->publishes([
25
			__DIR__ . '/config/languages.php' => config_path('languages.php'),
26
		], 'config');
27
		
28
		Collection::macro('for', function ($field, $code) {
29
			return $this->where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field;
0 ignored issues
show
Bug introduced by
The method where() does not exist on Mikehins\Translatable\TranslatableServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
			return $this->/** @scrutinizer ignore-call */ where('key', $field)->where('locale', $code)->pluck('value')->first() ?? $field;

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
		});
31
	}
32
	
33
	public function register()
34
	{
35
	}
36
}
37