1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
5
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
6
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
7
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
8
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
9
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
10
|
|
|
* THE SOFTWARE. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Ytake\LaravelCouchbase; |
14
|
|
|
|
15
|
|
|
use Illuminate\Support\ServiceProvider; |
16
|
|
|
use Ytake\LaravelCouchbase\Console\IndexFinderCommand; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class ConsoleServiceProvider. |
20
|
|
|
* |
21
|
|
|
* @author Yuuki Takezawa<[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class ConsoleServiceProvider extends ServiceProvider |
24
|
|
|
{ |
25
|
|
|
/** @var bool */ |
26
|
|
|
protected $defer = true; |
27
|
|
|
|
28
|
|
|
public function boot() |
29
|
|
|
{ |
30
|
|
|
$this->registerCommands(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* {@inheritdoc} |
35
|
|
|
*/ |
36
|
|
|
public function register() |
37
|
|
|
{ |
38
|
|
|
// TODO: Implement register() method. |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* register laravel-couchbase commands |
43
|
|
|
*/ |
44
|
|
|
protected function registerCommands() |
45
|
|
|
{ |
46
|
|
|
$this->app->singleton('command.couchbase.list-indexes', function ($app) { |
47
|
|
|
return new IndexFinderCommand($app['config'], $app['files']); |
|
|
|
|
48
|
|
|
}); |
49
|
|
|
|
50
|
|
|
$this->commands([ |
51
|
|
|
'command.couchbase.list-indexes', |
52
|
|
|
]); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* {@inheritdoc} |
57
|
|
|
*/ |
58
|
|
|
public function provides() |
59
|
|
|
{ |
60
|
|
|
return [ |
61
|
|
|
'command.couchbase.list-indexes', |
62
|
|
|
]; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.