Issues (7)

src/Controller/AppLicenseController.php (2 issues)

1
<?php
2
3
namespace Irfa\AppLicenseServer\Controller;
4
5
use Illuminate\Http\Request;
6
use Irfa\AppLicenseServer\Func\License;
7
use Irfa\AppLicenseServer\Core\Json;
8
use App\Http\Controllers\Controller;
0 ignored issues
show
The type App\Http\Controllers\Controller 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class AppLicenseController extends Controller
11
{
12
    public function check(Request $request,License $license,Json $json)
13
    {
14
    	if(empty($request->serial))
15
    	{
16
    		$data['active'] = false;
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
17
    		$data['message'] = "Serial number must be provided.";
18
    		return $json->response(400,'data',$data,[]); 
19
    	}
20
    	$res = $license->serial($request->serial)->check();
21
        if($res->active)
22
        {
23
    	   return $json->response(200,'data',$res,[]); 
24
        } 
25
           return $json->response(400,'data',$res,[$res->message]); 
26
27
    }
28
}
29