Completed
Push — master ( ab2185...c08f71 )
by Sherif
01:55
created
src/Modules/Notifications/Notifications/ResetPassword.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@
 block discarded – undo
9 9
 
10 10
 class ResetPassword extends Notification implements ShouldQueue
11 11
 {
12
-    use Queueable;
12
+	use Queueable;
13 13
 
14
-    protected $token;
14
+	protected $token;
15 15
 
16
-    /**
17
-     * Init new object.
18
-     *
19
-     * @return  void
20
-     */
21
-    public function __construct($token)
22
-    {
23
-        $this->token = $token;
24
-    }
16
+	/**
17
+	 * Init new object.
18
+	 *
19
+	 * @return  void
20
+	 */
21
+	public function __construct($token)
22
+	{
23
+		$this->token = $token;
24
+	}
25 25
 
26
-    /**
27
-     * Get the notification's delivery channels.
28
-     *
29
-     * @param  mixed  $notifiable
30
-     * @return string[]
31
-     */
32
-    public function via($notifiable)
33
-    {
34
-        return ['mail'];
35
-    }
26
+	/**
27
+	 * Get the notification's delivery channels.
28
+	 *
29
+	 * @param  mixed  $notifiable
30
+	 * @return string[]
31
+	 */
32
+	public function via($notifiable)
33
+	{
34
+		return ['mail'];
35
+	}
36 36
 
37
-    /**
38
-     * Get the mail representation of the notification.
39
-     *
40
-     * @param  mixed  $notifiable
41
-     * @return \Illuminate\Notifications\Messages\MailMessage
42
-     */
43
-    public function toMail($notifiable)
44
-    {
45
-        return (new MailMessage)
46
-            ->subject('Reset passowrd')
47
-            ->line('Reset passowrd')
48
-            ->line('To reset your password click on the button below')
49
-            ->action('Reset password', config('user.reset_password_url').'/'.$this->token);
50
-    }
37
+	/**
38
+	 * Get the mail representation of the notification.
39
+	 *
40
+	 * @param  mixed  $notifiable
41
+	 * @return \Illuminate\Notifications\Messages\MailMessage
42
+	 */
43
+	public function toMail($notifiable)
44
+	{
45
+		return (new MailMessage)
46
+			->subject('Reset passowrd')
47
+			->line('Reset passowrd')
48
+			->line('To reset your password click on the button below')
49
+			->action('Reset password', config('user.reset_password_url').'/'.$this->token);
50
+	}
51 51
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Notifications/ConfirmEmail.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -9,41 +9,41 @@
 block discarded – undo
9 9
 
10 10
 class ConfirmEmail extends Notification implements ShouldQueue
11 11
 {
12
-    use Queueable;
12
+	use Queueable;
13 13
 
14
-    /**
15
-     * Init new object.
16
-     *
17
-     * @return  void
18
-     */
19
-    public function __construct()
20
-    {
21
-        //
22
-    }
14
+	/**
15
+	 * Init new object.
16
+	 *
17
+	 * @return  void
18
+	 */
19
+	public function __construct()
20
+	{
21
+		//
22
+	}
23 23
 
24
-    /**
25
-     * Get the notification's delivery channels.
26
-     *
27
-     * @param  mixed  $notifiable
28
-     * @return string[]
29
-     */
30
-    public function via($notifiable)
31
-    {
32
-        return ['mail'];
33
-    }
24
+	/**
25
+	 * Get the notification's delivery channels.
26
+	 *
27
+	 * @param  mixed  $notifiable
28
+	 * @return string[]
29
+	 */
30
+	public function via($notifiable)
31
+	{
32
+		return ['mail'];
33
+	}
34 34
 
35
-    /**
36
-     * Get the mail representation of the notification.
37
-     *
38
-     * @param  mixed  $notifiable
39
-     * @return \Illuminate\Notifications\Messages\MailMessage
40
-     */
41
-    public function toMail($notifiable)
42
-    {
43
-        return (new MailMessage)
44
-            ->subject('Email verification')
45
-            ->line('Email verification')
46
-            ->line('To validate your email click on the button below')
47
-            ->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code);
48
-    }
35
+	/**
36
+	 * Get the mail representation of the notification.
37
+	 *
38
+	 * @param  mixed  $notifiable
39
+	 * @return \Illuminate\Notifications\Messages\MailMessage
40
+	 */
41
+	public function toMail($notifiable)
42
+	{
43
+		return (new MailMessage)
44
+			->subject('Email verification')
45
+			->line('Email verification')
46
+			->line('To validate your email click on the button below')
47
+			->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code);
48
+	}
49 49
 }
Please login to merge, or discard this patch.
src/Modules/Roles/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'roles');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'roles');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'roles');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('roles', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('roles', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('roles', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('roles', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('roles', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/PassportInstallCommand.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@
 block discarded – undo
7 7
 
8 8
 class PassportInstallCommand extends Command
9 9
 {
10
-    /**
11
-     * The name and signature of the console command.
12
-     *
13
-     * @var string
14
-     */
15
-    protected $signature = 'module:passport:install
10
+	/**
11
+	 * The name and signature of the console command.
12
+	 *
13
+	 * @var string
14
+	 */
15
+	protected $signature = 'module:passport:install
16 16
                             {--force : Overwrite keys they already exist}
17 17
                             {--length=4096 : The length of the private key}';
18 18
 
19
-    /**
20
-     * The console command description.
21
-     *
22
-     * @var string
23
-     */
24
-    protected $description = 'Run the commands necessary to prepare Passport for use';
19
+	/**
20
+	 * The console command description.
21
+	 *
22
+	 * @var string
23
+	 */
24
+	protected $description = 'Run the commands necessary to prepare Passport for use';
25 25
 
26
-    /**
27
-     * Execute the console command.
28
-     *
29
-     * @return void
30
-     */
31
-    public function handle(ClientRepository $client)
32
-    {
33
-        $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]);
34
-        if( ! \Core::oauthCLients()->first(['password_client' => 1])) {
26
+	/**
27
+	 * Execute the console command.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function handle(ClientRepository $client)
32
+	{
33
+		$this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]);
34
+		if( ! \Core::oauthCLients()->first(['password_client' => 1])) {
35 35
     
36
-            $client = $client->createPasswordGrantClient(
37
-                null, config('app.name'), 'http://localhost'
38
-            );
39
-            \DotenvEditor::setKey('PASSWORD_CLIENT_ID', $client->id);
40
-            \DotenvEditor::setKey('PASSWORD_CLIENT_SECRET', $client->secret);
41
-            \DotenvEditor::save();
42
-        }
43
-    }
36
+			$client = $client->createPasswordGrantClient(
37
+				null, config('app.name'), 'http://localhost'
38
+			);
39
+			\DotenvEditor::setKey('PASSWORD_CLIENT_ID', $client->id);
40
+			\DotenvEditor::setKey('PASSWORD_CLIENT_SECRET', $client->secret);
41
+			\DotenvEditor::save();
42
+		}
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     public function handle(ClientRepository $client)
32 32
     {
33 33
         $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]);
34
-        if( ! \Core::oauthCLients()->first(['password_client' => 1])) {
34
+        if ( ! \Core::oauthCLients()->first(['password_client' => 1])) {
35 35
     
36 36
             $client = $client->createPasswordGrantClient(
37 37
                 null, config('app.name'), 'http://localhost'
Please login to merge, or discard this patch.
Core/Console/Commands/Stubs/Module/Providers/ModuleServiceProvider.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'DummyModuleSlug');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'DummyModuleSlug');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'DummyModuleSlug');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'DummyModuleSlug');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('DummyModuleSlug', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('DummyModuleSlug', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('DummyModuleSlug', 'Config', 'app'));
23
-        }
24
-    }
19
+		$this->loadMigrationsFrom(module_path('DummyModuleSlug', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('DummyModuleSlug', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('DummyModuleSlug', 'Config', 'app'));
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        $this->app->register(RouteServiceProvider::class);
34
-    }
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		$this->app->register(RouteServiceProvider::class);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('DummyModuleSlug', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('DummyModuleSlug', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('DummyModuleSlug', 'Config', 'app'));
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/GenerateDocCommand.php 1 patch
Indentation   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -8,280 +8,280 @@
 block discarded – undo
8 8
 
9 9
 class GenerateDocCommand extends Command
10 10
 {
11
-    /**
12
-     * The name and signature of the console command.
13
-     *
14
-     * @var string
15
-     */
16
-    protected $signature = 'doc:generate';
17
-
18
-    /**
19
-     * The console command description.
20
-     *
21
-     * @var string
22
-     */
23
-    protected $description = 'Generate api documentation';
24
-
25
-    /**
26
-     * @var ReprotService
27
-     */
28
-    protected $reportService;
29
-
30
-    /**
31
-     * Init new object.
32
-     *
33
-     * @return  void
34
-     */
35
-    public function __construct(ReportService $reportService)
36
-    {
37
-        $this->reportService = $reportService;
38
-        parent::__construct();
39
-    }
40
-
41
-    /**
42
-     * Execute the console command.
43
-     *
44
-     * @return mixed
45
-     */
46
-    public function handle()
47
-    {
48
-        $docData           = [];
49
-        $docData['models'] = [];
50
-        $routes            = $this->getRoutes();
51
-        foreach ($routes as $route) {
52
-            if ($route) {
53
-                $actoinArray = explode('@', $route['action']);
54
-                if (Arr::get($actoinArray, 1, false)) {
55
-
56
-                    $prefix = $route['prefix'];
57
-                    $module = \Str::camel(str_replace('/', '_', str_replace('api', '', $prefix)));
58
-                    if($prefix === 'telescope') {
59
-                        continue;
60
-                    }
61
-
62
-                    $controller       = $actoinArray[0];
63
-                    $method           = $actoinArray[1];
64
-                    $route['name']    = $method !== 'index' ? $method : 'list';
11
+	/**
12
+	 * The name and signature of the console command.
13
+	 *
14
+	 * @var string
15
+	 */
16
+	protected $signature = 'doc:generate';
17
+
18
+	/**
19
+	 * The console command description.
20
+	 *
21
+	 * @var string
22
+	 */
23
+	protected $description = 'Generate api documentation';
24
+
25
+	/**
26
+	 * @var ReprotService
27
+	 */
28
+	protected $reportService;
29
+
30
+	/**
31
+	 * Init new object.
32
+	 *
33
+	 * @return  void
34
+	 */
35
+	public function __construct(ReportService $reportService)
36
+	{
37
+		$this->reportService = $reportService;
38
+		parent::__construct();
39
+	}
40
+
41
+	/**
42
+	 * Execute the console command.
43
+	 *
44
+	 * @return mixed
45
+	 */
46
+	public function handle()
47
+	{
48
+		$docData           = [];
49
+		$docData['models'] = [];
50
+		$routes            = $this->getRoutes();
51
+		foreach ($routes as $route) {
52
+			if ($route) {
53
+				$actoinArray = explode('@', $route['action']);
54
+				if (Arr::get($actoinArray, 1, false)) {
55
+
56
+					$prefix = $route['prefix'];
57
+					$module = \Str::camel(str_replace('/', '_', str_replace('api', '', $prefix)));
58
+					if($prefix === 'telescope') {
59
+						continue;
60
+					}
61
+
62
+					$controller       = $actoinArray[0];
63
+					$method           = $actoinArray[1];
64
+					$route['name']    = $method !== 'index' ? $method : 'list';
65 65
                     
66
-                    $reflectionClass  = new \ReflectionClass($controller);
67
-                    $reflectionMethod = $reflectionClass->getMethod($method);
68
-                    $classProperties  = $reflectionClass->getDefaultProperties();
69
-                    $skipLoginCheck   = Arr::get($classProperties, 'skipLoginCheck', false);
70
-                    $modelName        = explode('\\', $controller);
71
-                    $modelName        = lcfirst(str_replace('Controller', '', end($modelName)));
72
-
73
-                    $this->processDocBlock($route, $reflectionMethod);
74
-                    $this->getHeaders($route, $method, $skipLoginCheck);
75
-                    $this->getPostData($route, $reflectionMethod);
76
-
77
-                    $route['response'] = $this->getResponseObject($modelName, $route['name'], $route['returnDocBlock']);
78
-                    $docData['modules'][$module][] = $route;
79
-
80
-                    $this->getModels($modelName, $docData, $reflectionClass);
81
-                }
82
-            }
83
-        }
66
+					$reflectionClass  = new \ReflectionClass($controller);
67
+					$reflectionMethod = $reflectionClass->getMethod($method);
68
+					$classProperties  = $reflectionClass->getDefaultProperties();
69
+					$skipLoginCheck   = Arr::get($classProperties, 'skipLoginCheck', false);
70
+					$modelName        = explode('\\', $controller);
71
+					$modelName        = lcfirst(str_replace('Controller', '', end($modelName)));
72
+
73
+					$this->processDocBlock($route, $reflectionMethod);
74
+					$this->getHeaders($route, $method, $skipLoginCheck);
75
+					$this->getPostData($route, $reflectionMethod);
76
+
77
+					$route['response'] = $this->getResponseObject($modelName, $route['name'], $route['returnDocBlock']);
78
+					$docData['modules'][$module][] = $route;
79
+
80
+					$this->getModels($modelName, $docData, $reflectionClass);
81
+				}
82
+			}
83
+		}
84 84
         
85
-        $docData['errors']  = $this->getErrors();
86
-        $docData['reports'] = $this->reportService->all();
87
-        \File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
88
-    }
89
-
90
-    /**
91
-     * Get list of all registered routes.
92
-     *
93
-     * @return collection
94
-     */
95
-    protected function getRoutes()
96
-    {
97
-        return collect(\Route::getRoutes())->map(function ($route) {
98
-            if (strpos($route->uri(), 'api/') !== false) {
99
-                return [
100
-                    'method' => $route->methods()[0],
101
-                    'uri'    => $route->uri(),
102
-                    'action' => $route->getActionName(),
103
-                    'prefix' => $route->getPrefix()
104
-                ];
105
-            }
106
-            return false;
107
-        })->all();
108
-    }
109
-
110
-    /**
111
-     * Generate headers for the given route.
112
-     *
113
-     * @param  array  &$route
114
-     * @param  string $method
115
-     * @param  array  $skipLoginCheck
116
-     * @return void
117
-     */
118
-    protected function getHeaders(&$route, $method, $skipLoginCheck)
119
-    {
120
-        $route['headers'] = [
121
-        'Accept'       => 'application/json',
122
-        'Content-Type' => 'application/json',
123
-        'locale'       => 'The language of the returned data: ar, en or all.',
124
-        'time-zone'    => 'Your locale time zone',
125
-        ];
126
-
127
-
128
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
129
-            $route['headers']['Authorization'] = 'Bearer {token}';
130
-        }
131
-    }
132
-
133
-    /**
134
-     * Generate description and params for the given route
135
-     * based on the docblock.
136
-     *
137
-     * @param  array  &$route
138
-     * @param  \ReflectionMethod $reflectionMethod
139
-     * @return void
140
-     */
141
-    protected function processDocBlock(&$route, $reflectionMethod)
142
-    {
143
-        $factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
144
-        $docblock                = $factory->create($reflectionMethod->getDocComment());
145
-        $route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
146
-        $params                  = $docblock->getTagsByName('param');
147
-        $route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
148
-
149
-        foreach ($params as $param) {
150
-            $name = $param->getVariableName();
151
-            if ($name !== 'request') {
152
-                $route['parametars'][$param->getVariableName()] = $param->getDescription()->render();
153
-            }
154
-        }
155
-
156
-        if ($route['name'] === 'list') {
157
-            $route['parametars']['perPage'] = 'perPage?';
158
-            $route['parametars']['sortBy']  = 'sortBy?';
159
-            $route['parametars']['desc']    = 'desc?';
160
-            $route['parametars']['trashed'] = 'trashed?';
161
-        }
162
-    }
163
-
164
-    /**
165
-     * Generate post body for the given route.
166
-     *
167
-     * @param  array  &$route
168
-     * @param  \ReflectionMethod $reflectionMethod
169
-     * @return void
170
-     */
171
-    protected function getPostData(&$route, $reflectionMethod)
172
-    {
173
-        $parameters = $reflectionMethod->getParameters();
174
-        if (count($parameters)) {
175
-            $className = optional($reflectionMethod->getParameters()[0]->getType())->getName();
176
-            if ($className) {
177
-                $reflectionClass  = new \ReflectionClass($className);
85
+		$docData['errors']  = $this->getErrors();
86
+		$docData['reports'] = $this->reportService->all();
87
+		\File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
88
+	}
89
+
90
+	/**
91
+	 * Get list of all registered routes.
92
+	 *
93
+	 * @return collection
94
+	 */
95
+	protected function getRoutes()
96
+	{
97
+		return collect(\Route::getRoutes())->map(function ($route) {
98
+			if (strpos($route->uri(), 'api/') !== false) {
99
+				return [
100
+					'method' => $route->methods()[0],
101
+					'uri'    => $route->uri(),
102
+					'action' => $route->getActionName(),
103
+					'prefix' => $route->getPrefix()
104
+				];
105
+			}
106
+			return false;
107
+		})->all();
108
+	}
109
+
110
+	/**
111
+	 * Generate headers for the given route.
112
+	 *
113
+	 * @param  array  &$route
114
+	 * @param  string $method
115
+	 * @param  array  $skipLoginCheck
116
+	 * @return void
117
+	 */
118
+	protected function getHeaders(&$route, $method, $skipLoginCheck)
119
+	{
120
+		$route['headers'] = [
121
+		'Accept'       => 'application/json',
122
+		'Content-Type' => 'application/json',
123
+		'locale'       => 'The language of the returned data: ar, en or all.',
124
+		'time-zone'    => 'Your locale time zone',
125
+		];
126
+
127
+
128
+		if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
129
+			$route['headers']['Authorization'] = 'Bearer {token}';
130
+		}
131
+	}
132
+
133
+	/**
134
+	 * Generate description and params for the given route
135
+	 * based on the docblock.
136
+	 *
137
+	 * @param  array  &$route
138
+	 * @param  \ReflectionMethod $reflectionMethod
139
+	 * @return void
140
+	 */
141
+	protected function processDocBlock(&$route, $reflectionMethod)
142
+	{
143
+		$factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
144
+		$docblock                = $factory->create($reflectionMethod->getDocComment());
145
+		$route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
146
+		$params                  = $docblock->getTagsByName('param');
147
+		$route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
148
+
149
+		foreach ($params as $param) {
150
+			$name = $param->getVariableName();
151
+			if ($name !== 'request') {
152
+				$route['parametars'][$param->getVariableName()] = $param->getDescription()->render();
153
+			}
154
+		}
155
+
156
+		if ($route['name'] === 'list') {
157
+			$route['parametars']['perPage'] = 'perPage?';
158
+			$route['parametars']['sortBy']  = 'sortBy?';
159
+			$route['parametars']['desc']    = 'desc?';
160
+			$route['parametars']['trashed'] = 'trashed?';
161
+		}
162
+	}
163
+
164
+	/**
165
+	 * Generate post body for the given route.
166
+	 *
167
+	 * @param  array  &$route
168
+	 * @param  \ReflectionMethod $reflectionMethod
169
+	 * @return void
170
+	 */
171
+	protected function getPostData(&$route, $reflectionMethod)
172
+	{
173
+		$parameters = $reflectionMethod->getParameters();
174
+		if (count($parameters)) {
175
+			$className = optional($reflectionMethod->getParameters()[0]->getType())->getName();
176
+			if ($className) {
177
+				$reflectionClass  = new \ReflectionClass($className);
178 178
     
179
-                if ($reflectionClass->hasMethod('rules')) {
180
-                    $reflectionMethod = $reflectionClass->getMethod('rules');
181
-                    $route['body'] = $reflectionMethod->invoke(new $className);
179
+				if ($reflectionClass->hasMethod('rules')) {
180
+					$reflectionMethod = $reflectionClass->getMethod('rules');
181
+					$route['body'] = $reflectionMethod->invoke(new $className);
182 182
         
183
-                    foreach ($route['body'] as &$rule) {
184
-                        if (strpos($rule, 'unique')) {
185
-                            $rule = substr($rule, 0, strpos($rule, 'unique') + 6);
186
-                        } elseif (strpos($rule, 'exists')) {
187
-                            $rule = substr($rule, 0, strpos($rule, 'exists') - 1);
188
-                        }
189
-                    }
190
-                }
191
-            }
192
-        }
193
-    }
194
-
195
-    /**
196
-     * Generate application errors.
197
-     *
198
-     * @return array
199
-     */
200
-    protected function getErrors()
201
-    {
202
-        $errors = [];
203
-        foreach (\Module::all() as $module) {
204
-            $nameSpace = 'App\\Modules\\' . $module['basename'] ;
205
-            $class = $nameSpace . '\\Errors\\'  . $module['basename'] . 'Errors';
206
-            $reflectionClass = new \ReflectionClass($class);
207
-            foreach ($reflectionClass->getMethods() as $method) {
208
-                $methodName       = $method->name;
209
-                $reflectionMethod = $reflectionClass->getMethod($methodName);
210
-                $body             = $this->getMethodBody($reflectionMethod);
211
-
212
-                preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match);
213
-
214
-                if (count($match)) {
215
-                    $errors[$match[1]][] = $methodName;
216
-                }
217
-            }
218
-        }
219
-
220
-        return $errors;
221
-    }
222
-
223
-    /**
224
-     * Get the given method body code.
225
-     *
226
-     * @param  object $reflectionMethod
227
-     * @return string
228
-     */
229
-    protected function getMethodBody($reflectionMethod)
230
-    {
231
-        $filename   = $reflectionMethod->getFileName();
232
-        $start_line = $reflectionMethod->getStartLine() - 1;
233
-        $end_line   = $reflectionMethod->getEndLine();
234
-        $length     = $end_line - $start_line;
235
-        $source     = file($filename);
236
-        $body       = implode("", array_slice($source, $start_line, $length));
237
-        $body       = trim(preg_replace('/\s+/', '', $body));
238
-
239
-        return $body;
240
-    }
241
-
242
-    /**
243
-     * Get example object of all availble models.
244
-     *
245
-     * @param  string $modelName
246
-     * @param  array  $docData
247
-     * @return string
248
-     */
249
-    protected function getModels($modelName, &$docData, $reflectionClass)
250
-    {
251
-        if ($modelName && ! Arr::has($docData['models'], $modelName)) {
252
-            $modelClass = get_class(call_user_func_array("\Core::{$modelName}", [])->model);
253
-            $model      = factory($modelClass)->make();
254
-
255
-            $property = $reflectionClass->getProperty('modelResource');
256
-            $property->setAccessible(true);
257
-            $modelResource = $property->getValue(\App::make($reflectionClass->getName()));
258
-            $modelResource = new $modelResource($model);
259
-            $modelArr      = $modelResource->toArray([]);
260
-
261
-            foreach ($modelArr as $key => $attr) {
262
-                if (is_object($attr) && property_exists($attr, 'resource') && $attr->resource instanceof \Illuminate\Http\Resources\MissingValue) {
263
-                    unset($modelArr[$key]);
264
-                }
265
-            }
266
-
267
-            $docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
268
-        }
269
-    }
270
-
271
-    /**
272
-     * Get the route response object type.
273
-     *
274
-     * @param  string $modelName
275
-     * @param  string $method
276
-     * @param  string $returnDocBlock
277
-     * @return array
278
-     */
279
-    protected function getResponseObject($modelName, $method, $returnDocBlock)
280
-    {
281
-        $relations = config('core.relations');
282
-        $relations = Arr::has($relations, $modelName) ? Arr::has($relations[$modelName], $method) ? $relations[$modelName] : false : false;
283
-        $modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
284
-
285
-        return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
286
-    }
183
+					foreach ($route['body'] as &$rule) {
184
+						if (strpos($rule, 'unique')) {
185
+							$rule = substr($rule, 0, strpos($rule, 'unique') + 6);
186
+						} elseif (strpos($rule, 'exists')) {
187
+							$rule = substr($rule, 0, strpos($rule, 'exists') - 1);
188
+						}
189
+					}
190
+				}
191
+			}
192
+		}
193
+	}
194
+
195
+	/**
196
+	 * Generate application errors.
197
+	 *
198
+	 * @return array
199
+	 */
200
+	protected function getErrors()
201
+	{
202
+		$errors = [];
203
+		foreach (\Module::all() as $module) {
204
+			$nameSpace = 'App\\Modules\\' . $module['basename'] ;
205
+			$class = $nameSpace . '\\Errors\\'  . $module['basename'] . 'Errors';
206
+			$reflectionClass = new \ReflectionClass($class);
207
+			foreach ($reflectionClass->getMethods() as $method) {
208
+				$methodName       = $method->name;
209
+				$reflectionMethod = $reflectionClass->getMethod($methodName);
210
+				$body             = $this->getMethodBody($reflectionMethod);
211
+
212
+				preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match);
213
+
214
+				if (count($match)) {
215
+					$errors[$match[1]][] = $methodName;
216
+				}
217
+			}
218
+		}
219
+
220
+		return $errors;
221
+	}
222
+
223
+	/**
224
+	 * Get the given method body code.
225
+	 *
226
+	 * @param  object $reflectionMethod
227
+	 * @return string
228
+	 */
229
+	protected function getMethodBody($reflectionMethod)
230
+	{
231
+		$filename   = $reflectionMethod->getFileName();
232
+		$start_line = $reflectionMethod->getStartLine() - 1;
233
+		$end_line   = $reflectionMethod->getEndLine();
234
+		$length     = $end_line - $start_line;
235
+		$source     = file($filename);
236
+		$body       = implode("", array_slice($source, $start_line, $length));
237
+		$body       = trim(preg_replace('/\s+/', '', $body));
238
+
239
+		return $body;
240
+	}
241
+
242
+	/**
243
+	 * Get example object of all availble models.
244
+	 *
245
+	 * @param  string $modelName
246
+	 * @param  array  $docData
247
+	 * @return string
248
+	 */
249
+	protected function getModels($modelName, &$docData, $reflectionClass)
250
+	{
251
+		if ($modelName && ! Arr::has($docData['models'], $modelName)) {
252
+			$modelClass = get_class(call_user_func_array("\Core::{$modelName}", [])->model);
253
+			$model      = factory($modelClass)->make();
254
+
255
+			$property = $reflectionClass->getProperty('modelResource');
256
+			$property->setAccessible(true);
257
+			$modelResource = $property->getValue(\App::make($reflectionClass->getName()));
258
+			$modelResource = new $modelResource($model);
259
+			$modelArr      = $modelResource->toArray([]);
260
+
261
+			foreach ($modelArr as $key => $attr) {
262
+				if (is_object($attr) && property_exists($attr, 'resource') && $attr->resource instanceof \Illuminate\Http\Resources\MissingValue) {
263
+					unset($modelArr[$key]);
264
+				}
265
+			}
266
+
267
+			$docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
268
+		}
269
+	}
270
+
271
+	/**
272
+	 * Get the route response object type.
273
+	 *
274
+	 * @param  string $modelName
275
+	 * @param  string $method
276
+	 * @param  string $returnDocBlock
277
+	 * @return array
278
+	 */
279
+	protected function getResponseObject($modelName, $method, $returnDocBlock)
280
+	{
281
+		$relations = config('core.relations');
282
+		$relations = Arr::has($relations, $modelName) ? Arr::has($relations[$modelName], $method) ? $relations[$modelName] : false : false;
283
+		$modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
284
+
285
+		return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
286
+	}
287 287
 }
Please login to merge, or discard this patch.
src/Modules/Core/Routes/web.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,5 +11,5 @@
 block discarded – undo
11 11
 |
12 12
 */
13 13
 if (\App::environment('local')) {
14
-    Route::get('/docs', 'ApiDocumentController@index');    
14
+	Route::get('/docs', 'ApiDocumentController@index');    
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/Core/Providers/ModuleServiceProvider.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -6,51 +6,51 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core');
18
-
19
-        $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
22
-            $this->loadConfigsFrom(module_path('core', 'Config', 'app'));
23
-        }
24
-    }
25
-
26
-    /**
27
-     * Register the module services.
28
-     *
29
-     * @return void
30
-     */
31
-    public function register()
32
-    {
33
-        //Bind Core Facade to the Service Container
34
-        $this->app->singleton('Core', function () {
35
-            return new \App\Modules\Core\Core;
36
-        });
37
-
38
-        //Bind Errors Facade to the Service Container
39
-        $this->app->singleton('Errors', function () {
40
-            return new \App\Modules\Core\Errors\Errors;
41
-        });
42
-
43
-        //Bind Media Facade to the Service Container
44
-        $this->app->singleton('Media', function () {
45
-            return new \App\Modules\Core\Utl\Media;
46
-        });
47
-
48
-        //Bind ApiConsumer Facade to the Service Container
49
-        $this->app->singleton('ApiConsumer', function () {
50
-            $app = app();
51
-            return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']);
52
-        });
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core');
18
+
19
+		$this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app'));
21
+		if(!$this->app->configurationIsCached()) {
22
+			$this->loadConfigsFrom(module_path('core', 'Config', 'app'));
23
+		}
24
+	}
25
+
26
+	/**
27
+	 * Register the module services.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function register()
32
+	{
33
+		//Bind Core Facade to the Service Container
34
+		$this->app->singleton('Core', function () {
35
+			return new \App\Modules\Core\Core;
36
+		});
37
+
38
+		//Bind Errors Facade to the Service Container
39
+		$this->app->singleton('Errors', function () {
40
+			return new \App\Modules\Core\Errors\Errors;
41
+		});
42
+
43
+		//Bind Media Facade to the Service Container
44
+		$this->app->singleton('Media', function () {
45
+			return new \App\Modules\Core\Utl\Media;
46
+		});
47
+
48
+		//Bind ApiConsumer Facade to the Service Container
49
+		$this->app->singleton('ApiConsumer', function () {
50
+			$app = app();
51
+			return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']);
52
+		});
53 53
         
54
-        $this->app->register(RouteServiceProvider::class);
55
-    }
54
+		$this->app->register(RouteServiceProvider::class);
55
+	}
56 56
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
         $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app'));
20 20
         $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app'));
21
-        if(!$this->app->configurationIsCached()) {
21
+        if ( ! $this->app->configurationIsCached()) {
22 22
             $this->loadConfigsFrom(module_path('core', 'Config', 'app'));
23 23
         }
24 24
     }
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
     public function register()
32 32
     {
33 33
         //Bind Core Facade to the Service Container
34
-        $this->app->singleton('Core', function () {
34
+        $this->app->singleton('Core', function() {
35 35
             return new \App\Modules\Core\Core;
36 36
         });
37 37
 
38 38
         //Bind Errors Facade to the Service Container
39
-        $this->app->singleton('Errors', function () {
39
+        $this->app->singleton('Errors', function() {
40 40
             return new \App\Modules\Core\Errors\Errors;
41 41
         });
42 42
 
43 43
         //Bind Media Facade to the Service Container
44
-        $this->app->singleton('Media', function () {
44
+        $this->app->singleton('Media', function() {
45 45
             return new \App\Modules\Core\Utl\Media;
46 46
         });
47 47
 
48 48
         //Bind ApiConsumer Facade to the Service Container
49
-        $this->app->singleton('ApiConsumer', function () {
49
+        $this->app->singleton('ApiConsumer', function() {
50 50
             $app = app();
51 51
             return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']);
52 52
         });
Please login to merge, or discard this patch.
src/Modules/Core/Errors/Errors.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@
 block discarded – undo
6 6
 
7 7
 class Errors implements BaseFactoryInterface
8 8
 {
9
-    /**
10
-     * Construct the config class name based on
11
-     * the method name called, search in the
12
-     * given namespaces for the class and
13
-     * return an instance.
14
-     *
15
-     * @param  string $name the called method name
16
-     * @param  array  $arguments the method arguments
17
-     * @return object
18
-     */
19
-    public function __call($name, $arguments)
20
-    {
21
-        foreach (\Module::all() as $module) {
22
-            $nameSpace = 'App\\Modules\\' . $module['basename'];
23
-            $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors';
9
+	/**
10
+	 * Construct the config class name based on
11
+	 * the method name called, search in the
12
+	 * given namespaces for the class and
13
+	 * return an instance.
14
+	 *
15
+	 * @param  string $name the called method name
16
+	 * @param  array  $arguments the method arguments
17
+	 * @return object
18
+	 */
19
+	public function __call($name, $arguments)
20
+	{
21
+		foreach (\Module::all() as $module) {
22
+			$nameSpace = 'App\\Modules\\' . $module['basename'];
23
+			$class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors';
24 24
 
25
-            if (class_exists($class)) {
26
-                $class = \App::make($class);
27
-                if (method_exists($class, $name)) {
28
-                    return call_user_func_array([$class, $name], $arguments);
29
-                }
30
-            }
31
-        }
32
-    }
25
+			if (class_exists($class)) {
26
+				$class = \App::make($class);
27
+				if (method_exists($class, $name)) {
28
+					return call_user_func_array([$class, $name], $arguments);
29
+				}
30
+			}
31
+		}
32
+	}
33 33
 }
Please login to merge, or discard this patch.