TaskController::filter_dashboard()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use LaravelRealtimeChat\Repositories\Team\TeamRepository;
4
use LaravelRealtimeChat\Repositories\Task\TaskRepository;
5
class TaskController extends BaseController {
6
        /**
7
         * @var LaravelRealtimeChat\Repositories\TeamRepository
0 ignored issues
show
Bug introduced by
The type LaravelRealtimeChat\Repositories\TeamRepository 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...
8
         */
9
        private $teamRepository;
10
        /**
11
         * @var LaravelRealtimeChat\Repositories\TaskRepository
0 ignored issues
show
Bug introduced by
The type LaravelRealtimeChat\Repositories\TaskRepository 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...
12
         */
13
        private $taskRepository;
14
15
        public function __construct(TeamRepository $teamRepository, TaskRepository $taskRepository) {
16
                $this->teamRepository = $teamRepository;
0 ignored issues
show
Documentation Bug introduced by
It seems like $teamRepository of type LaravelRealtimeChat\Repo...ies\Team\TeamRepository is incompatible with the declared type LaravelRealtimeChat\Repositories\TeamRepository of property $teamRepository.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
17
                $this->taskRepository = $taskRepository;
0 ignored issues
show
Documentation Bug introduced by
It seems like $taskRepository of type LaravelRealtimeChat\Repo...ies\Task\TaskRepository is incompatible with the declared type LaravelRealtimeChat\Repositories\TaskRepository of property $taskRepository.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
18
        }
19
20 View Code Duplication
        public function dashboard() {
0 ignored issues
show
Duplication introduced by
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...
21
                $channeld = Session::get('channelId');
22
                $teams    = $this->teamRepository->getTeams($channeld);
23
                $projects = $this->taskRepository->getProjects();
24
                $trackers = $this->taskRepository->getTracker();
25
                $status = $this->taskRepository->getStatus();
26
                $priotities = $this->taskRepository->getPriorities();
27
                $data     = array("teams" => $teams, "projects" => $projects,"trackers"=>$trackers,"status"=>$status,"priorities"=>$priotities);
28
              
29
                return View::make('templates/task/dashboard')->with('data', $data);
30
        }
31
32
        /**
33
         *  @function creates project
34
          @param null
35
          @return null
36
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
37
        public function create_project() {
38
                $result = $this->taskRepository->createProject();
39
                return View::make('templates/greeting')->with('info', $result);
40
        }
41
        
42
         /**
43
         *  @function creates task
44
          @param null
45
          @return null
46
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
47
        public function create_task() {
48
                $result = $this->taskRepository->createTask();
49
                return $result;
50
        }
51
        
52
        
53
        /**
54
         *  @function returns members
55
          @param null
56
          @return null
57
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
58
        public function get_members() {
59
                $enTeamId=Input::get("teamId");
0 ignored issues
show
Bug introduced by
The type Input 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...
60
                $teamId=$this->teamRepository->getTeamDecodedId($enTeamId);
61
                $members = $this->teamRepository->getMembers($teamId);
62
                /*
63
                 * Prepare html select options
64
                 */
65
                
66
                $data='';
67
                $data.="<option value=''>Select User</option>";
68
                foreach($members as $values){
69
                        $memDetail=explode("_",$values);
70
                        $data.="<option value=".$memDetail[2].">".$memDetail[0]." ".$memDetail[1]."</option>";
71
                }
72
                return trim($data,'"');
0 ignored issues
show
Bug Best Practice introduced by
The expression return trim($data, '"') returns the type string which is incompatible with the documented return type null.
Loading history...
73
        }
74
        
75
        /**
76
         *  @function rollback task
77
          @param null
78
          @return null
79
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
80
        public function rollback_task() {
81
                $result = $this->taskRepository->rollBackTask();
82
                return $result;
83
        }
84
        
85
          /**
86
         *  @function filter dashboard data
87
          @param null
88
          @return array dashboard data
89
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
90
        public function filter_dashboard() {
91
                $result = $this->taskRepository->filterDashboard();
92
                return $result;
93
        }
94
        
95
          /**
96
         *  @function filter grid data
97
          @param null
98
          @return array grid data
99
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
100
        public function filter_grid() {
101
                $page = \Input::get('current');
102
                $rowCount = \Input::get('rowCount');
103
                
104
                $total='';
0 ignored issues
show
Unused Code introduced by
The assignment to $total is dead and can be removed.
Loading history...
105
                $result = $this->taskRepository->filterGrid();
106
                foreach($result as $values){
107
                       $rows[]=array('un_id'=>$values['un_id'],
108
                            'priority_name'=>$values['priority_name'],
109
                            'status_name'=>$values['status_name'],
110
                            'tracker'=>$values['tracker'],
111
                            'assignee'=>$values['first_name']." ".$values['last_name'],
112
                            'created_at'=>$values['created_at'],
113
                            'start_date'=>$values['start_date'],
114
                             'end_date'=>$values['end_date']) ;
115
                }
116
                $data=array('current'=>$page,'rowCount'=>$rowCount,'rows'=>$rows,'total'=>count($rows));
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $rows seems to be defined by a foreach iteration on line 106. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
117
                return json_encode($data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return json_encode($data) returns the type string which is incompatible with the documented return type array.
Loading history...
118
        }
119
        
120
        /**  @function opens exisiting task
121
          @param null
122
          @return html view
123
         */
0 ignored issues
show
Documentation Bug introduced by
The doc comment @return at position 0 could not be parsed: Unknown type name '@return' at position 0 in @return.
Loading history...
124 View Code Duplication
        public function view_assignment() {
0 ignored issues
show
Duplication introduced by
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...
125
                $trackers = $this->taskRepository->getTracker();
126
                $status = $this->taskRepository->getStatus();
127
                $priotities = $this->taskRepository->getPriorities();
128
                $taskData = $this->taskRepository->getTaskData();
129
                $members = $this->teamRepository->getMembers($taskData['team_id']);
130
                $data     = array("trackers"=>$trackers,"status"=>$status,"priorities"=>$priotities,'members'=>$members,'task_data'=>$taskData);
131
                return View::make('templates/task/create_task_modal')->with('data', $data);
132
        }
133
        
134
        /**  @function list of previous updates on a task
135
          @param task parent id
136
          @return html view
0 ignored issues
show
Bug introduced by
The type html 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...
137
         */
138
        public function recent_updates($parent_task_id) {
139
                $result=$this->taskRepository->getUpdates($parent_task_id);
140
                return View::make('templates/task/recent_task_updates')->with("result",$result);
141
        }
142
        
143
        
144
          /**  @function list of previous updates on a task
145
          @param task parent id
146
          @return html view
147
         */
148
        public function get_project_teams() {
149
                $result=$this->taskRepository->getProjectTeams(Input::get('projectId'));
150
                $data='';
151
                $data.="<option value=''>Select Team</option>";
152
                foreach($result as $teamDetail){
153
                       
154
                        $data.="<option value=".$teamDetail['team_channel_id'].">".$teamDetail['channel_view_name']."</option>";
155
                }
156
                return trim($data,'"');
0 ignored issues
show
Bug Best Practice introduced by
The expression return trim($data, '"') returns the type string which is incompatible with the documented return type html.
Loading history...
157
        }
158
}