Issues (3884)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

app/Itil/Controllers/RelesesController.php (33 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace App\Itil\Controllers;
4
5
use App\Itil\Controllers\BaseServiceDeskController;
6
use App\Itil\Models\Releases\SdReleasestatus;
7
use App\Itil\Models\Releases\SdReleasepriorities;
8
use App\Itil\Models\Releases\SdReleasetypes;
9
use App\Itil\Models\Releases\SdLocations;
10
use App\Itil\Models\Releases\SdReleases;
11
use App\Itil\Requests\CreateReleaseRequest;
12
use Exception;
13
14
class RelesesController extends BaseServiceDeskController {
15
16
    public function releasesindex() {
17
        try {
18
            return view('itil::releases.index');
19
        } catch (Exception $ex) {
20
            return redirect()->back()->with('fails', $ex->getMessage());
21
        }
22
    }
23
24 View Code Duplication
    public function getReleases() {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
        try {
26
            $releses = new SdReleases();
27
            $relese = $releses->select('id', 'description', 'subject', 'planned_start_date', 'planned_end_date', 'status_id', 'priority_id', 'release_type_id', 'location_id')->get();
0 ignored issues
show
Documentation Bug introduced by
The method select does not exist on object<App\Itil\Models\Releases\SdReleases>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
28
            return \Datatable::Collection($relese)
29
                            ->showColumns('subject', 'planned_start_date', 'planned_end_date')
30
                            ->addColumn('Action', function($model) {
31
                                $url = url('service-desk/releases/' . $model->id . '/delete');
32
                                $delete = \App\Itil\Controllers\UtilityController::deletePopUp($model->id, $url, "Delete $model->subject");
33
                                return "<a href=" . url('service-desk/releases/' . $model->id . '/edit') . " class='btn btn-info btn-sm'>Edit</a> "
34
                                        . $delete
35
                                        . " <a href=" . url('service-desk/releases/' . $model->id . '/show') . " class='btn btn-primary btn-sm'>View</a>";
36
                            })
37
                            ->searchColumns('subject', 'description')
38
                            ->orderColumns('subject', 'reason', 'impact', 'rollout_plan', 'backout_plan', 'status_id', 'priority_id', 'change_type_id', 'impact_id', 'location_id', 'approval_id')
39
                            ->make();
40
        } catch (Exception $ex) {
41
            return redirect()->back()->with('fails', $ex->getMessage());
42
        }
43
    }
44
45 View Code Duplication
    public function view($id) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
        try {
47
            $releases = new SdReleases();
48
            $release = $releases->find($id);
0 ignored issues
show
Documentation Bug introduced by
The method find does not exist on object<App\Itil\Models\Releases\SdReleases>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
49
            //dd($release);
50
            if ($release) {
51
                return view('itil::releases.show', compact('release'));
52
            } else {
53
                throw new \Exception('Sorry we can not find your request');
54
            }
55
        } catch (Exception $ex) {
56
            return redirect()->back()->with('fails', $ex->getMessage());
57
        }
58
    }
59
60 View Code Duplication
    public function releasescreate() {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
61
        try {
62
63
            $sd_release_status = SdReleasestatus::lists('name', 'id')->toArray();
64
            $sd_release_priorities = SdReleasepriorities::lists('name', 'id')->toArray();
65
            $sd_release_types = SdReleasetypes::lists('name', 'id')->toArray();
66
            $sd_locations = SdLocations::lists('title', 'id')->toArray();
67
//            $assets = SdAssets::lists('name', 'id')->toArray();
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
68
69
            return view('itil::releases.create', compact('sd_release_status', 'sd_release_priorities', 'sd_release_types', 'sd_locations'));
70
        } catch (Exception $ex) {
71
            return redirect()->back()->with('fails', $ex->getMessage());
72
        }
73
    }
74
75 View Code Duplication
    public function releaseshandleCreate(CreateReleaseRequest $request, $return = false) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
76
        //dd($return);
77
        try {
78
            // dd($request);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
79
            $sd_releases = new SdReleases;
80
            $sd_releases->description = $request->description;
0 ignored issues
show
The property description does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property description does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
81
            $sd_releases->subject = $request->subject;
0 ignored issues
show
The property subject does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property subject does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
82
            $sd_releases->planned_start_date = $request->plan_start_date;
0 ignored issues
show
The property planned_start_date does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property plan_start_date does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
83
            $sd_releases->planned_end_date = $request->plan_end_date;
0 ignored issues
show
The property planned_end_date does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property plan_end_date does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
84
            $sd_releases->status_id = $request->status;
0 ignored issues
show
The property status_id does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property status does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
85
            $sd_releases->priority_id = $request->priority;
0 ignored issues
show
The property priority_id does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property priority does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
86
            $sd_releases->release_type_id = $request->releasetype;
0 ignored issues
show
The property release_type_id does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property releasetype does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
87
            $sd_releases->location_id = $request->location;
0 ignored issues
show
The property location_id does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
The property location does not seem to exist in App\Itil\Requests\CreateReleaseRequest.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
88
89
            $sd_releases->save();
90
            \App\Itil\Controllers\UtilityController::attachment($sd_releases->id, 'sd_releases', $request->file('attachments'));
0 ignored issues
show
The property id does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
91
            if (isAsset() == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
92
                \App\Itil\Controllers\UtilityController::storeAssetRelation('sd_releases', $sd_releases->id, $request->input('asset'));
0 ignored issues
show
The property id does not exist on object<App\Itil\Models\Releases\SdReleases>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
It seems like $request->input('asset') targeting Illuminate\Http\Request::input() can also be of type string; however, App\Itil\Controllers\Uti...r::storeAssetRelation() does only seem to accept array, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
93
            }
94
            if ($return === false) {
95
                return \Redirect::route('service-desk.releases.index')->with('message', 'Release successfully create !!!');
96
            }
97
            return $sd_releases;
98
        } catch (Exception $ex) {
99
            return redirect()->back()->with('fails', $ex->getMessage());
100
        }
101
    }
102
103
    public function releasesedit($id) {
104
        try {
105
            $release = SdReleases::findOrFail($id);
106
            $sd_release_status = SdReleasestatus::lists('name', 'id')->toArray();
107
            $sd_release_priorities = SdReleasepriorities::lists('name', 'id')->toArray();
108
            $sd_release_types = SdReleasetypes::lists('name', 'id')->toArray();
109
            $sd_locations = SdLocations::lists('title', 'id')->toArray();
110
//            $assets = SdAssets::lists('name', 'id')->toArray();
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
111
112
            return view('itil::releases.edit', compact('sd_release_status', 'sd_release_priorities', 'sd_release_types', 'sd_locations', 'locations_address', 'release'));
113
        } catch (Exception $ex) {
114
            return redirect()->back()->with('fails', $ex->getMessage());
115
        }
116
    }
117
118 View Code Duplication
    public function releaseshandleEdit($id, CreateReleaseRequest $request) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
119
        try {
120
121
            $sd_releases = SdReleases::findOrFail($id);
122
            $sd_releases->fill($request->input())->save();
123
            \App\Itil\Controllers\UtilityController::attachment($sd_releases->id, 'sd_releases', $request->file('attachments'));
124
            if (isAsset() == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
125
                \App\Itil\Controllers\UtilityController::storeAssetRelation('sd_releases', $sd_releases->id, $request->input('asset'));
0 ignored issues
show
It seems like $request->input('asset') targeting Illuminate\Http\Request::input() can also be of type string; however, App\Itil\Controllers\Uti...r::storeAssetRelation() does only seem to accept array, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
126
            }
127
            return \Redirect::route('service-desk.releases.index')->with('message', 'Release successfully Edit !!!');
128
        } catch (Exception $ex) {
129
            return redirect()->back()->with('fails', $ex->getMessage());
130
        }
131
    }
132
133
    public function releasesHandledelete($id) {
134
        try {
135
            $sd_releases = SdReleases::findOrFail($id);
136
            $sd_releases->delete();
137
138
            return \Redirect::route('service-desk.releases.index')->with('message', 'Release successfully Delete !!!');
139
        } catch (Exception $ex) {
140
            return redirect()->back()->with('fails', $ex->getMessage());
141
        }
142
    }
143
144
    public function sendCab($id, $cabid) {
145
        $activity = 'sd_releases';
146
        $owner = "$activity:$id";
147
        $url = url("service-desk/cabs/vote/$cabid/$owner");
148
        \App\Itil\Controllers\UtilityController::cabMessage($cabid, $activity, $url);
149
    }
150
151
    public function complete($id) {
152
        try {
153
            $releases = new SdReleases();
154
            $release = $releases->find($id);
0 ignored issues
show
Documentation Bug introduced by
The method find does not exist on object<App\Itil\Models\Releases\SdReleases>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
155
            if ($release) {
156
                $release->status_id = 5;
157
                $release->save();
158
            } else {
159
                throw new Exception('Sorry we can not find your request');
160
            }
161
            return redirect()->back()->with('success', 'updated');
162
        } catch (Exception $ex) {
163
            return redirect()->back()->with('fails', $ex->getMessage());
164
        }
165
    }
166
167
}
168