sonrac /
laravel-wamp
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Created by PhpStorm. |
||||||
| 4 | * |
||||||
| 5 | * @author Donii Sergii <[email protected]> |
||||||
| 6 | * Date: 10/23/17 |
||||||
| 7 | * Time: 3:41 PM |
||||||
| 8 | */ |
||||||
| 9 | |||||||
| 10 | namespace sonrac\WAMP; |
||||||
| 11 | |||||||
| 12 | use Illuminate\Support\ServiceProvider; |
||||||
| 13 | use Monolog\Formatter\LineFormatter; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 14 | use Monolog\Handler\StreamHandler; |
||||||
|
0 ignored issues
–
show
The type
Monolog\Handler\StreamHandler was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 15 | use Monolog\Logger as MonologLogger; |
||||||
|
0 ignored issues
–
show
The type
Monolog\Logger was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 16 | use Thruway\Logging\Logger; |
||||||
| 17 | use Thruway\Transport\RawSocketClientTransportProvider; |
||||||
|
0 ignored issues
–
show
The type
Thruway\Transport\RawSocketClientTransportProvider was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 18 | |||||||
| 19 | /** |
||||||
| 20 | * Class WAMPServiceProvider. |
||||||
| 21 | */ |
||||||
| 22 | class WAMPServiceProvider extends ServiceProvider |
||||||
| 23 | { |
||||||
| 24 | /** |
||||||
| 25 | * Register WAMP. |
||||||
| 26 | */ |
||||||
| 27 | public function register() |
||||||
| 28 | { |
||||||
| 29 | $config = require __DIR__.'/../config/wamp.php'; |
||||||
| 30 | $file = base_path('config/wamp.php'); |
||||||
|
0 ignored issues
–
show
The function
base_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 31 | if (class_exists('\Laravel\Lumen\Application')) { |
||||||
| 32 | // Configure wamp config for lumen |
||||||
| 33 | app()->configure('wamp'); |
||||||
|
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 34 | $config = config('wamp') ?? $config; |
||||||
|
0 ignored issues
–
show
The function
config was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 35 | } else { |
||||||
| 36 | if (file_exists($file)) { |
||||||
| 37 | // Get laravel config for WAMP |
||||||
| 38 | $config = require $file; |
||||||
| 39 | } |
||||||
| 40 | } |
||||||
| 41 | |||||||
| 42 | /* |
||||||
| 43 | * Register facade alias |
||||||
| 44 | */ |
||||||
| 45 | $this->app->alias('wamp', '\sonrac\WAMP\Facades\WAMP'); |
||||||
| 46 | |||||||
| 47 | /* |
||||||
| 48 | * Register console command |
||||||
| 49 | */ |
||||||
| 50 | $this->app->singleton('wamp.run', '\sonrac\WAMP\Commands\RunServer'); |
||||||
| 51 | |||||||
| 52 | $this->app->singleton('wampClient', function () use ($config) { |
||||||
| 53 | return new Client($config['realm']); |
||||||
| 54 | }); |
||||||
| 55 | |||||||
| 56 | /* |
||||||
| 57 | * Register routers |
||||||
| 58 | */ |
||||||
| 59 | foreach ([ |
||||||
| 60 | 'rpcRouter' => [ |
||||||
| 61 | 'sonrac\WAMP\Contracts\RPCRouterInterface', |
||||||
| 62 | 'sonrac\WAMP\Routers\RPCRouter', |
||||||
| 63 | ], |
||||||
| 64 | 'pubSubRouter' => [ |
||||||
| 65 | 'sonrac\WAMP\Contracts\PubSubRouterInterface', |
||||||
| 66 | 'sonrac\WAMP\Routers\PubSubRouter', |
||||||
| 67 | ], |
||||||
| 68 | 'wampRouter' => [ |
||||||
| 69 | 'sonrac\WAMP\Contracts\WAMPRouterInterface', |
||||||
| 70 | 'sonrac\WAMP\Routers\Router', |
||||||
| 71 | ], |
||||||
| 72 | ] as $alias => $abstract) { |
||||||
| 73 | $this->app->singleton($abstract[0], $abstract[1]); |
||||||
| 74 | $this->app->alias($abstract[0], $alias); |
||||||
| 75 | } |
||||||
| 76 | |||||||
| 77 | $this->app->singleton('sonrac\WAMP\Contracts\ClientTransportServiceProvider', function () use ($config) { |
||||||
| 78 | return new RawSocketClientTransportProvider($config['host'], $config['port']); |
||||||
| 79 | }); |
||||||
| 80 | |||||||
| 81 | /* |
||||||
| 82 | * Register loggers |
||||||
| 83 | */ |
||||||
| 84 | $this->app->singleton('wamp.server.logger', function () use ($config) { |
||||||
| 85 | $fileName = isset($config['log_file_server']) && $config['log_file_server'] ? $config['log_file_server'] : 'wamp-server.log'; |
||||||
| 86 | $path = storage_path('logs/'.$fileName); |
||||||
|
0 ignored issues
–
show
The function
storage_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 87 | |||||||
| 88 | $handler = (new StreamHandler($path, MonologLogger::DEBUG)) |
||||||
| 89 | ->setFormatter(new LineFormatter(null, null, true, true)); |
||||||
| 90 | |||||||
| 91 | return new MonologLogger($fileName, [$handler]); |
||||||
| 92 | }); |
||||||
| 93 | |||||||
| 94 | $this->app->singleton('wamp.client.logger', function () use ($config) { |
||||||
| 95 | $fileName = isset($config['log_file_client']) && $config['log_file_client'] ? $config['log_file_client'] : 'wamp-client.log'; |
||||||
| 96 | $path = storage_path('logs/'.$fileName); |
||||||
|
0 ignored issues
–
show
The function
storage_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 97 | |||||||
| 98 | $handler = (new StreamHandler($path, MonologLogger::DEBUG)) |
||||||
| 99 | ->setFormatter(new LineFormatter(null, null, true, true)); |
||||||
| 100 | |||||||
| 101 | return new MonologLogger($fileName, [$handler]); |
||||||
| 102 | }); |
||||||
| 103 | /* |
||||||
| 104 | * Set logging |
||||||
| 105 | */ |
||||||
| 106 | if (isset($config['pathLogFile']) && null !== $config['pathLogFile']) { |
||||||
| 107 | $handler = (new StreamHandler($config['pathLogFile'], MonologLogger::DEBUG)) |
||||||
| 108 | ->setFormatter(new LineFormatter(null, null, true, true)); |
||||||
| 109 | |||||||
| 110 | $logger = new MonologLogger('wamp-client', [$handler]); |
||||||
| 111 | |||||||
| 112 | Logger::set($logger); |
||||||
| 113 | } |
||||||
| 114 | } |
||||||
| 115 | } |
||||||
| 116 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths