GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 6c805f...bce16d )
by Igor
09:12 queued 14s
created
src/Route4Me/V5/TelematicsPlatform/Connection.php 1 patch
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -9,130 +9,130 @@
 block discarded – undo
9 9
  */
10 10
 class Connection extends Common
11 11
 {
12
-    /**
13
-     * Telemetics connection name
14
-     * @var type string
15
-     */
16
-    public $name;
17
-    
18
-    /**
19
-     * Telemetics connection type
20
-     * @var type string
21
-     */
22
-    public $vendor;
12
+	/**
13
+	 * Telemetics connection name
14
+	 * @var type string
15
+	 */
16
+	public $name;
17
+    
18
+	/**
19
+	 * Telemetics connection type
20
+	 * @var type string
21
+	 */
22
+	public $vendor;
23 23
    
24
-    /**
25
-     * Telematics connection access host
26
-     * @var type string
27
-     */
28
-    public $host;
29
-    
30
-    /**
31
-     * Telematics connection access api_key
32
-     * @var type string
33
-     */
34
-    public $api_key;
35
-    
36
-    /**
37
-     * Telematics connection access account ID.
38
-     * @var type string
39
-     */
40
-    public $account_id;
41
-    
42
-    /**
43
-     * Telematics connection access username
44
-     * @var type string
45
-     */
46
-    public $username;
47
-    
48
-    /**
49
-     * Telematics connection access password
50
-     * @var type string
51
-     */
52
-    public $password;
53
-    
54
-    /**
55
-     * Telematics connection access token
56
-     * @var type string
57
-     */
58
-    public $connection_token;
59
-    
60
-    /**
61
-     * Telemetics connection type ID
62
-     * @var type integer
63
-     */
64
-    public $vendor_id;
65
-    
66
-    /**
67
-     * Disable/enable vehicle tracking
68
-     * @var type Boolean
69
-     */
70
-    public $is_enabled;
71
-    
72
-    /**
73
-     * Vehicle tracking interval in seconds
74
-     * @var type integer
75
-     */
76
-    public $vehicle_position_refresh_rate;
77
-    
78
-    /**
79
-     * Maximum idle time
80
-     * @var type integer
81
-     */
82
-    public $max_idle_time;
83
-    
84
-    /**
85
-     * Syncronized vehicles count
86
-     * @var type integer
87
-     */
88
-    public $synced_vehicles_count;
89
-    
90
-    /**
91
-     * Total vehicles count
92
-     * @var type integer
93
-     */
94
-    public $total_vehicles_count;
95
-    
96
-    /**
97
-     * Total addresses count
98
-     * @var type integer
99
-     */
100
-    public $total_addresses_count;
101
-    
102
-    /**
103
-     * The last timestamp the vehicles reloaded
104
-     * @var type string
105
-     */
106
-    public $last_vehicles_reload;
107
-    
108
-    /**
109
-     * The last timestamp the addresses reloaded
110
-     * @var type string
111
-     */
112
-    public $last_addresses_reload;
113
-    
114
-    /**
115
-     * The last timestamp the postions reloaded
116
-     * @var type string
117
-     */
118
-    public $last_position_reload;
119
-    
120
-    /**
121
-     * Metadata, custom key-value storage.
122
-     * @var type array
123
-     */
124
-    public $metadata = [];
125
-    
126
-    public static function fromArray(array $params)
127
-    {
128
-        $thisParams = new self();
24
+	/**
25
+	 * Telematics connection access host
26
+	 * @var type string
27
+	 */
28
+	public $host;
29
+    
30
+	/**
31
+	 * Telematics connection access api_key
32
+	 * @var type string
33
+	 */
34
+	public $api_key;
35
+    
36
+	/**
37
+	 * Telematics connection access account ID.
38
+	 * @var type string
39
+	 */
40
+	public $account_id;
41
+    
42
+	/**
43
+	 * Telematics connection access username
44
+	 * @var type string
45
+	 */
46
+	public $username;
47
+    
48
+	/**
49
+	 * Telematics connection access password
50
+	 * @var type string
51
+	 */
52
+	public $password;
53
+    
54
+	/**
55
+	 * Telematics connection access token
56
+	 * @var type string
57
+	 */
58
+	public $connection_token;
59
+    
60
+	/**
61
+	 * Telemetics connection type ID
62
+	 * @var type integer
63
+	 */
64
+	public $vendor_id;
65
+    
66
+	/**
67
+	 * Disable/enable vehicle tracking
68
+	 * @var type Boolean
69
+	 */
70
+	public $is_enabled;
71
+    
72
+	/**
73
+	 * Vehicle tracking interval in seconds
74
+	 * @var type integer
75
+	 */
76
+	public $vehicle_position_refresh_rate;
77
+    
78
+	/**
79
+	 * Maximum idle time
80
+	 * @var type integer
81
+	 */
82
+	public $max_idle_time;
83
+    
84
+	/**
85
+	 * Syncronized vehicles count
86
+	 * @var type integer
87
+	 */
88
+	public $synced_vehicles_count;
89
+    
90
+	/**
91
+	 * Total vehicles count
92
+	 * @var type integer
93
+	 */
94
+	public $total_vehicles_count;
95
+    
96
+	/**
97
+	 * Total addresses count
98
+	 * @var type integer
99
+	 */
100
+	public $total_addresses_count;
101
+    
102
+	/**
103
+	 * The last timestamp the vehicles reloaded
104
+	 * @var type string
105
+	 */
106
+	public $last_vehicles_reload;
107
+    
108
+	/**
109
+	 * The last timestamp the addresses reloaded
110
+	 * @var type string
111
+	 */
112
+	public $last_addresses_reload;
113
+    
114
+	/**
115
+	 * The last timestamp the postions reloaded
116
+	 * @var type string
117
+	 */
118
+	public $last_position_reload;
119
+    
120
+	/**
121
+	 * Metadata, custom key-value storage.
122
+	 * @var type array
123
+	 */
124
+	public $metadata = [];
125
+    
126
+	public static function fromArray(array $params)
127
+	{
128
+		$thisParams = new self();
129 129
 
130
-        foreach ($params as $key => $value) {
131
-            if (property_exists($thisParams, $key)) {
132
-                $thisParams->{$key} = $value;
133
-            }
134
-        }
130
+		foreach ($params as $key => $value) {
131
+			if (property_exists($thisParams, $key)) {
132
+				$thisParams->{$key} = $value;
133
+			}
134
+		}
135 135
 
136
-        return $thisParams;
137
-    }
136
+		return $thisParams;
137
+	}
138 138
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/TelematicsPlatform/ConnectionParameters.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -10,96 +10,96 @@
 block discarded – undo
10 10
  */
11 11
 class ConnectionParameters extends Common
12 12
 {
13
-    /**
14
-     * Telemetics connection type
15
-     * @var type string
16
-     */
17
-    public $vendor;
13
+	/**
14
+	 * Telemetics connection type
15
+	 * @var type string
16
+	 */
17
+	public $vendor;
18 18
     
19
-    /**
20
-     * Telemetics connection type ID
21
-     * @var type integer
22
-     */
23
-    public $vendor_id;
19
+	/**
20
+	 * Telemetics connection type ID
21
+	 * @var type integer
22
+	 */
23
+	public $vendor_id;
24 24
     
25
-    /**
26
-     * Telemetics connection name
27
-     * Required for telematics connection registration.
28
-     * @var type string
29
-     */
30
-    public $name;
25
+	/**
26
+	 * Telemetics connection name
27
+	 * Required for telematics connection registration.
28
+	 * @var type string
29
+	 */
30
+	public $name;
31 31
     
32
-    /**
33
-     * Telematics connection access host.
34
-     * @var type string
35
-     */
36
-    public $host;
32
+	/**
33
+	 * Telematics connection access host.
34
+	 * @var type string
35
+	 */
36
+	public $host;
37 37
     
38
-    /**
39
-     * Telematics connection access api_key.
40
-     * @var type string
41
-     */
42
-    public $api_key;
38
+	/**
39
+	 * Telematics connection access api_key.
40
+	 * @var type string
41
+	 */
42
+	public $api_key;
43 43
     
44
-    /**
45
-     * Telematics connection access account_id.
46
-     * @var type string
47
-     */
48
-    public $account_id;
44
+	/**
45
+	 * Telematics connection access account_id.
46
+	 * @var type string
47
+	 */
48
+	public $account_id;
49 49
     
50
-    /**
51
-     * Telematics connection access username
52
-     * @var type string
53
-     */
54
-    public $username;
50
+	/**
51
+	 * Telematics connection access username
52
+	 * @var type string
53
+	 */
54
+	public $username;
55 55
     
56
-    /**
57
-     * Telematics connection access password.
58
-     * @var type string
59
-     */
60
-    public $password;
56
+	/**
57
+	 * Telematics connection access password.
58
+	 * @var type string
59
+	 */
60
+	public $password;
61 61
     
62
-    /**
63
-     * Vehicle tracking interval in seconds (default value 60).
64
-     * @var type integer
65
-     */
66
-    public $vehicle_position_refresh_rate;
62
+	/**
63
+	 * Vehicle tracking interval in seconds (default value 60).
64
+	 * @var type integer
65
+	 */
66
+	public $vehicle_position_refresh_rate;
67 67
     
68
-    /**
69
-     * Validate connections credentials.
70
-     * @var type Boolean
71
-     */
72
-    public $validate_remote_credentials;
68
+	/**
69
+	 * Validate connections credentials.
70
+	 * @var type Boolean
71
+	 */
72
+	public $validate_remote_credentials;
73 73
     
74
-    /**
75
-     * Disable/enable vehicle tracking.
76
-     * @var type Boolean
77
-     */
78
-    public $is_enabled;
74
+	/**
75
+	 * Disable/enable vehicle tracking.
76
+	 * @var type Boolean
77
+	 */
78
+	public $is_enabled;
79 79
     
80
-    /**
81
-     * Metadata
82
-     * @var type string
83
-     */
84
-    public $metadata;
80
+	/**
81
+	 * Metadata
82
+	 * @var type string
83
+	 */
84
+	public $metadata;
85 85
     
86
-    /**
87
-     * Telematics connection access token.
88
-     * Required to show specified connection.
89
-     * @var type string
90
-     */
91
-    public $connection_token;
86
+	/**
87
+	 * Telematics connection access token.
88
+	 * Required to show specified connection.
89
+	 * @var type string
90
+	 */
91
+	public $connection_token;
92 92
 
93
-    public static function fromArray(array $params)
94
-    {
95
-        $thisParams = new self();
93
+	public static function fromArray(array $params)
94
+	{
95
+		$thisParams = new self();
96 96
 
97
-        foreach ($params as $key => $value) {
98
-            if (property_exists($thisParams, $key)) {
99
-                $thisParams->{$key} = $value;
100
-            }
101
-        }
97
+		foreach ($params as $key => $value) {
98
+			if (property_exists($thisParams, $key)) {
99
+				$thisParams->{$key} = $value;
100
+			}
101
+		}
102 102
 
103
-        return $thisParams;
104
-    }
103
+		return $thisParams;
104
+	}
105 105
 }
Please login to merge, or discard this patch.
src/Route4Me/V5/OptimizationProblemParams.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -8,131 +8,131 @@
 block discarded – undo
8 8
 
9 9
 class OptimizationProblemParams extends \Route4Me\Common
10 10
 {
11
-    public $optimization_problem_id;
12
-    public $reoptimize;
13
-    public $addresses = [];
14
-    public $depots = [];
15
-    public $parameters;
16
-    public $directions;
17
-    public $format;
18
-    public $route_path_output;
19
-    public $optimized_callback_url;
20
-    public $redirect = true;
21
-
22
-    public static function fromArray($params)
23
-    {
24
-        $param = new self();
25
-        if (!isset($params['addresses'])) {
26
-            throw new BadParam('addresses must be provided.');
27
-        }
28
-
29
-        if (!isset($params['parameters'])) {
30
-            throw new BadParam('parameters must be provided.');
31
-        }
32
-
33
-        if ($params['parameters'] instanceof RouteParameters) {
34
-            $param->setParameters($params['parameters']);
35
-        } else {
36
-            $param->setParameters(RouteParameters::fromArray($params['parameters']));
37
-        }
38
-
39
-        foreach ($params['addresses'] as $address) {
40
-            if (!($address instanceof AddressV5)) {
41
-                $address = AddressV5::fromArray($address);
42
-            }
43
-
44
-            $param->addAddress($address);
45
-        }
46
-
47
-        if (isset($params['depots'] )) {
48
-            foreach ($params['depots'] as $depot) {
49
-                if (!($depot instanceof AddressV5)) {
50
-                    $depot = AddressV5::fromArray($depot);
51
-                }
52
-
53
-                $param->addAddress($address);
54
-            }
55
-        }
56
-
57
-        $param->directions = self::getValue($params, 'directions');
58
-        $param->format = self::getValue($params, 'format');
59
-        $param->route_path_output = self::getValue($params, 'route_path_output');
60
-        $param->optimized_callback_url = self::getValue($params, 'optimized_callback_url');
61
-        $param->optimization_problem_id = self::getValue($params, 'optimization_problem_id');
62
-        $param->reoptimize = self::getValue($params, 'reoptimize');
63
-        $param->redirect = filter_var(self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN);
64
-
65
-        return $param;
66
-    }
67
-
68
-    public function __construct()
69
-    {
70
-        $this->parameters = new RouteParameters();
71
-    }
72
-
73
-    public function setParameters(RouteParameters $params)
74
-    {
75
-        $this->parameters = $params;
76
-
77
-        return $this;
78
-    }
79
-
80
-    public function addAddress(AddressV5 $address)
81
-    {
82
-        $this->addresses[] = $address;
83
-
84
-        return $this;
85
-    }
86
-
87
-    public function addDepot(AddressV5 $depot)
88
-    {
89
-        $this->depots[] = $depot;
90
-
91
-        return $this;
92
-    }
93
-
94
-    public function getAddressesArray()
95
-    {
96
-        $addresses = [];
97
-
98
-        foreach ($this->addresses as $address) {
99
-            $addresses[] = $address->toArray();
100
-        }
101
-
102
-        return $addresses;
103
-    }
104
-
105
-    public function getDepotsArray()
106
-    {
107
-        $depots = [];
108
-
109
-        foreach ($this->depots as $depot) {
110
-            $depots[] = $depot->toArray();
111
-        }
112
-
113
-        return $depots;
114
-    }
115
-
116
-    public function getParametersArray()
117
-    {
118
-        return $this->parameters->toArray();
119
-    }
120
-
121
-    public function setAddresses(array $addresses)
122
-    {
123
-        foreach ($addresses as $address) {
124
-            $this->addAddress($address);
125
-        }
126
-
127
-        return $this;
128
-    }
129
-
130
-    public function setDepots(array $depots)
131
-    {
132
-        foreach ($depots as $depot) {
133
-            $this->addDepot($depot);
134
-        }
135
-
136
-        return $this;
137
-    }
11
+	public $optimization_problem_id;
12
+	public $reoptimize;
13
+	public $addresses = [];
14
+	public $depots = [];
15
+	public $parameters;
16
+	public $directions;
17
+	public $format;
18
+	public $route_path_output;
19
+	public $optimized_callback_url;
20
+	public $redirect = true;
21
+
22
+	public static function fromArray($params)
23
+	{
24
+		$param = new self();
25
+		if (!isset($params['addresses'])) {
26
+			throw new BadParam('addresses must be provided.');
27
+		}
28
+
29
+		if (!isset($params['parameters'])) {
30
+			throw new BadParam('parameters must be provided.');
31
+		}
32
+
33
+		if ($params['parameters'] instanceof RouteParameters) {
34
+			$param->setParameters($params['parameters']);
35
+		} else {
36
+			$param->setParameters(RouteParameters::fromArray($params['parameters']));
37
+		}
38
+
39
+		foreach ($params['addresses'] as $address) {
40
+			if (!($address instanceof AddressV5)) {
41
+				$address = AddressV5::fromArray($address);
42
+			}
43
+
44
+			$param->addAddress($address);
45
+		}
46
+
47
+		if (isset($params['depots'] )) {
48
+			foreach ($params['depots'] as $depot) {
49
+				if (!($depot instanceof AddressV5)) {
50
+					$depot = AddressV5::fromArray($depot);
51
+				}
52
+
53
+				$param->addAddress($address);
54
+			}
55
+		}
56
+
57
+		$param->directions = self::getValue($params, 'directions');
58
+		$param->format = self::getValue($params, 'format');
59
+		$param->route_path_output = self::getValue($params, 'route_path_output');
60
+		$param->optimized_callback_url = self::getValue($params, 'optimized_callback_url');
61
+		$param->optimization_problem_id = self::getValue($params, 'optimization_problem_id');
62
+		$param->reoptimize = self::getValue($params, 'reoptimize');
63
+		$param->redirect = filter_var(self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN);
64
+
65
+		return $param;
66
+	}
67
+
68
+	public function __construct()
69
+	{
70
+		$this->parameters = new RouteParameters();
71
+	}
72
+
73
+	public function setParameters(RouteParameters $params)
74
+	{
75
+		$this->parameters = $params;
76
+
77
+		return $this;
78
+	}
79
+
80
+	public function addAddress(AddressV5 $address)
81
+	{
82
+		$this->addresses[] = $address;
83
+
84
+		return $this;
85
+	}
86
+
87
+	public function addDepot(AddressV5 $depot)
88
+	{
89
+		$this->depots[] = $depot;
90
+
91
+		return $this;
92
+	}
93
+
94
+	public function getAddressesArray()
95
+	{
96
+		$addresses = [];
97
+
98
+		foreach ($this->addresses as $address) {
99
+			$addresses[] = $address->toArray();
100
+		}
101
+
102
+		return $addresses;
103
+	}
104
+
105
+	public function getDepotsArray()
106
+	{
107
+		$depots = [];
108
+
109
+		foreach ($this->depots as $depot) {
110
+			$depots[] = $depot->toArray();
111
+		}
112
+
113
+		return $depots;
114
+	}
115
+
116
+	public function getParametersArray()
117
+	{
118
+		return $this->parameters->toArray();
119
+	}
120
+
121
+	public function setAddresses(array $addresses)
122
+	{
123
+		foreach ($addresses as $address) {
124
+			$this->addAddress($address);
125
+		}
126
+
127
+		return $this;
128
+	}
129
+
130
+	public function setDepots(array $depots)
131
+	{
132
+		foreach ($depots as $depot) {
133
+			$this->addDepot($depot);
134
+		}
135
+
136
+		return $this;
137
+	}
138 138
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
             $param->addAddress($address);
45 45
         }
46 46
 
47
-        if (isset($params['depots'] )) {
47
+        if (isset($params['depots'])) {
48 48
             foreach ($params['depots'] as $depot) {
49 49
                 if (!($depot instanceof AddressV5)) {
50 50
                     $depot = AddressV5::fromArray($depot);
Please login to merge, or discard this patch.
src/Route4Me/V5/OptimizationProblem.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -13,154 +13,154 @@
 block discarded – undo
13 13
 
14 14
 class OptimizationProblem extends Common
15 15
 {
16
-    /** @var int $state
17
-     * An optimization problem state.
18
-     * Available values:
19
-     * OptimizationStateNew = 0,
20
-     * Initial = 1,
21
-     * MatrixProcessing = 2,
22
-     * Optimizing = 3,
23
-     * Optimized = 4,
24
-     * Error = 5,
25
-     * ComputingDirections = 6,
26
-     * OptimizationStateInQueue = 7
27
-     */
28
-    public $state;
29
-
30
-    /** @var string[] $user_errors
31
-     * An array of the user errors.
32
-     */
33
-    public $user_errors;
34
-
35
-    /** @var string[] $optimization_errors
36
-     * An array of the optimization errors.
37
-     */
38
-    public $optimization_errors;
39
-
40
-    /** @var boolean $sent_to_background
41
-     * If true it means the solution was not returned (it is being computed in the background).
42
-     */
43
-    public $sent_to_background;
44
-
45
-    /** @var long $scheduled_for
46
-     * An Unix Timestamp the Optimization Problem was scheduled for.
47
-     */
48
-    public $scheduled_for;
49
-
50
-    /** @var Route[] $routes
51
-     * An array ot the DataObjectRoute type objects.
52
-     * The routes included in the optimization problem.
53
-     */
54
-    public $routes;
55
-
56
-    /** @var integer $total_addresses
57
-     * Total number of the addresses in the optimization problem.
58
-     */
59
-    public $total_addresses;
60
-
61
-    public function __construct()
62
-    {
63
-        /**
64
-         * TO DO: Replace endpoint after finishing Optimization Wrapper in API 5
65
-         */
66
-        \Route4Me\Route4Me::setBaseUrl(EndpointV4::BASE_URL);
67
-        $this->parameters = new RouteParameters();
68
-    }
69
-
70
-    public static function fromArray(array $params)
71
-    {
72
-        $problem = new self();
73
-        $routeClass = new Route();
74
-
75
-
76
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
77
-        $problem->user_errors = Common::getValue($params, 'user_errors', []);
78
-        $problem->state = Common::getValue($params, 'state', []);
79
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', []);
80
-        $problem->links = Common::getValue($params, 'links', []);
81
-
82
-        if (isset($params['parameters'])) {
83
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
84
-        }
85
-
86
-        if (isset($params['addresses'])) {
87
-            $addresses = [];
88
-
89
-            foreach ($params['addresses'] as $address) {
90
-                $addresses[] = Address::fromArray($address);
91
-            }
92
-
93
-            $problem->addresses = $addresses;
94
-        }
95
-
96
-        if (isset($params['routes'])) {
97
-            $routes = [];
98
-
99
-            foreach ($params['routes'] as $route) {
100
-                $routes[] = $routeClass::fromArray($route);
101
-            }
102
-
103
-            $problem->routes = $routes;
104
-        }
105
-
106
-        return $problem;
107
-    }
108
-
109
-    public static function optimize(OptimizationProblemParams $params)
110
-    {
111
-        $allQueryFields = ['redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'];
112
-
113
-        $optimize = Route4Me::makeRequst([
114
-            'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
115
-            'method'    => 'POST',
116
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
117
-            'body'      => [
118
-                'addresses'     => $params->getAddressesArray(),
119
-                'depots'        => $params->getDepotsArray(),
120
-                'parameters'    => $params->getParametersArray(),
121
-            ],
122
-        ]);
123
-
124
-        return self::fromArray($optimize);
125
-    }
126
-
127
-    public static function get($params)
128
-    {
129
-        $allQueryFields = ['state', 'limit', 'format', 'offset',
130
-            'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
131
-
132
-        $result = Route4Me::makeRequst([
133
-            'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
134
-            'method'    => 'GET',
135
-            'query'     => \Route4Me\Route4Me::generateRequestParameters($allQueryFields, $params),
136
-        ]);
137
-
138
-        if (isset($result['optimizations'])) {
139
-            $problems = [];
140
-
141
-            foreach ($result['optimizations'] as $problem) {
142
-                $problems[] = self::fromArray($problem);
143
-            }
144
-
145
-            return $problems;
146
-        } else {
147
-            return self::fromArray($result);
148
-        }
149
-    }
150
-
151
-    public function removeOptimization($params)
152
-    {
153
-        $allQueryFields = ['redirect'];
154
-        $allBodyFields = ['optimization_problem_ids'];
155
-
156
-        $response = Route4Me::makeRequst([
157
-            'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
158
-            'method'    => 'DELETE',
159
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
160
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
161
-        ]);
162
-
163
-        return $response;
164
-    }
16
+	/** @var int $state
17
+	 * An optimization problem state.
18
+	 * Available values:
19
+	 * OptimizationStateNew = 0,
20
+	 * Initial = 1,
21
+	 * MatrixProcessing = 2,
22
+	 * Optimizing = 3,
23
+	 * Optimized = 4,
24
+	 * Error = 5,
25
+	 * ComputingDirections = 6,
26
+	 * OptimizationStateInQueue = 7
27
+	 */
28
+	public $state;
29
+
30
+	/** @var string[] $user_errors
31
+	 * An array of the user errors.
32
+	 */
33
+	public $user_errors;
34
+
35
+	/** @var string[] $optimization_errors
36
+	 * An array of the optimization errors.
37
+	 */
38
+	public $optimization_errors;
39
+
40
+	/** @var boolean $sent_to_background
41
+	 * If true it means the solution was not returned (it is being computed in the background).
42
+	 */
43
+	public $sent_to_background;
44
+
45
+	/** @var long $scheduled_for
46
+	 * An Unix Timestamp the Optimization Problem was scheduled for.
47
+	 */
48
+	public $scheduled_for;
49
+
50
+	/** @var Route[] $routes
51
+	 * An array ot the DataObjectRoute type objects.
52
+	 * The routes included in the optimization problem.
53
+	 */
54
+	public $routes;
55
+
56
+	/** @var integer $total_addresses
57
+	 * Total number of the addresses in the optimization problem.
58
+	 */
59
+	public $total_addresses;
60
+
61
+	public function __construct()
62
+	{
63
+		/**
64
+		 * TO DO: Replace endpoint after finishing Optimization Wrapper in API 5
65
+		 */
66
+		\Route4Me\Route4Me::setBaseUrl(EndpointV4::BASE_URL);
67
+		$this->parameters = new RouteParameters();
68
+	}
69
+
70
+	public static function fromArray(array $params)
71
+	{
72
+		$problem = new self();
73
+		$routeClass = new Route();
74
+
75
+
76
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
77
+		$problem->user_errors = Common::getValue($params, 'user_errors', []);
78
+		$problem->state = Common::getValue($params, 'state', []);
79
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', []);
80
+		$problem->links = Common::getValue($params, 'links', []);
81
+
82
+		if (isset($params['parameters'])) {
83
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
84
+		}
85
+
86
+		if (isset($params['addresses'])) {
87
+			$addresses = [];
88
+
89
+			foreach ($params['addresses'] as $address) {
90
+				$addresses[] = Address::fromArray($address);
91
+			}
92
+
93
+			$problem->addresses = $addresses;
94
+		}
95
+
96
+		if (isset($params['routes'])) {
97
+			$routes = [];
98
+
99
+			foreach ($params['routes'] as $route) {
100
+				$routes[] = $routeClass::fromArray($route);
101
+			}
102
+
103
+			$problem->routes = $routes;
104
+		}
105
+
106
+		return $problem;
107
+	}
108
+
109
+	public static function optimize(OptimizationProblemParams $params)
110
+	{
111
+		$allQueryFields = ['redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'];
112
+
113
+		$optimize = Route4Me::makeRequst([
114
+			'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
115
+			'method'    => 'POST',
116
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
117
+			'body'      => [
118
+				'addresses'     => $params->getAddressesArray(),
119
+				'depots'        => $params->getDepotsArray(),
120
+				'parameters'    => $params->getParametersArray(),
121
+			],
122
+		]);
123
+
124
+		return self::fromArray($optimize);
125
+	}
126
+
127
+	public static function get($params)
128
+	{
129
+		$allQueryFields = ['state', 'limit', 'format', 'offset',
130
+			'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
131
+
132
+		$result = Route4Me::makeRequst([
133
+			'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
134
+			'method'    => 'GET',
135
+			'query'     => \Route4Me\Route4Me::generateRequestParameters($allQueryFields, $params),
136
+		]);
137
+
138
+		if (isset($result['optimizations'])) {
139
+			$problems = [];
140
+
141
+			foreach ($result['optimizations'] as $problem) {
142
+				$problems[] = self::fromArray($problem);
143
+			}
144
+
145
+			return $problems;
146
+		} else {
147
+			return self::fromArray($result);
148
+		}
149
+	}
150
+
151
+	public function removeOptimization($params)
152
+	{
153
+		$allQueryFields = ['redirect'];
154
+		$allBodyFields = ['optimization_problem_ids'];
155
+
156
+		$response = Route4Me::makeRequst([
157
+			'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
158
+			'method'    => 'DELETE',
159
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
160
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
161
+		]);
162
+
163
+		return $response;
164
+	}
165 165
 
166 166
 }
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@
 block discarded – undo
127 127
     public static function get($params)
128 128
     {
129 129
         $allQueryFields = ['state', 'limit', 'format', 'offset',
130
-            'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
130
+            'optimization_problem_id', 'wait_for_final_state', 'start_date', 'end_date', ];
131 131
 
132 132
         $result = Route4Me::makeRequst([
133 133
             'url'       => \Route4Me\Enum\Endpoint::OPTIMIZATION_PROBLEM,
Please login to merge, or discard this patch.
src/Route4Me/V5/ResultResponse.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
  */
12 12
 class ResultResponse extends \Route4Me\Common
13 13
 {
14
-    /** Status  (true/false)
15
-     * @var boolean $status
16
-     */
17
-    public $status;
18
-
19
-    /** Status code
20
-     * @var integer $code
21
-     */
22
-    public $code;
23
-
24
-    /** Exit code
25
-     * @var integer $exit_code
26
-     */
27
-    public $exit_code;
28
-
29
-    /** An array of the error messages.
30
-     * @var Array $messages
31
-     */
32
-    public $messages;
33
-
34
-    public static function fromArray(array $params)
35
-    {
36
-        $resultResponse = new self();
37
-
38
-        foreach ($params as $key => $value) {
39
-            if (property_exists($resultResponse, $key)) {
40
-                $resultResponse->{$key} = $value;
41
-            }
42
-        }
43
-
44
-        return $resultResponse;
45
-    }
14
+	/** Status  (true/false)
15
+	 * @var boolean $status
16
+	 */
17
+	public $status;
18
+
19
+	/** Status code
20
+	 * @var integer $code
21
+	 */
22
+	public $code;
23
+
24
+	/** Exit code
25
+	 * @var integer $exit_code
26
+	 */
27
+	public $exit_code;
28
+
29
+	/** An array of the error messages.
30
+	 * @var Array $messages
31
+	 */
32
+	public $messages;
33
+
34
+	public static function fromArray(array $params)
35
+	{
36
+		$resultResponse = new self();
37
+
38
+		foreach ($params as $key => $value) {
39
+			if (property_exists($resultResponse, $key)) {
40
+				$resultResponse->{$key} = $value;
41
+			}
42
+		}
43
+
44
+		return $resultResponse;
45
+	}
46 46
 
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Addresses/AddressBundling.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
  */
12 12
 class AddressBundling extends Common
13 13
 {
14
-    /**
15
-     * Address bundling mode
16
-     * @see Enum\AddressBundlingModes\Mode
17
-     * @var integer
18
-     */
19
-    public $mode;
14
+	/**
15
+	 * Address bundling mode
16
+	 * @see Enum\AddressBundlingModes\Mode
17
+	 * @var integer
18
+	 */
19
+	public $mode;
20 20
 
21
-    /**
22
-     * Address bundling mode parameters:
23
-     * - If Mode=3, contains an array of the field names of the Address object;
24
-     * - If Mode=4, contains an array of the custom fields of the Address object.
25
-     * @var string[]
26
-     */
27
-    public $mode_params;
21
+	/**
22
+	 * Address bundling mode parameters:
23
+	 * - If Mode=3, contains an array of the field names of the Address object;
24
+	 * - If Mode=4, contains an array of the custom fields of the Address object.
25
+	 * @var string[]
26
+	 */
27
+	public $mode_params;
28 28
 
29
-    /**
30
-     * Address bundling merge mode
31
-     * @see Enum\AddressBundlingModes\MergeMode
32
-     * @var integer
33
-     */
34
-    public $merge_mode;
29
+	/**
30
+	 * Address bundling merge mode
31
+	 * @see Enum\AddressBundlingModes\MergeMode
32
+	 * @var integer
33
+	 */
34
+	public $merge_mode;
35 35
 
36
-    /**
37
-     * Service time rules of the address bundling
38
-     * @var ServiceTimeRulesClass
39
-     */
40
-    public $service_time_rules;
36
+	/**
37
+	 * Service time rules of the address bundling
38
+	 * @var ServiceTimeRulesClass
39
+	 */
40
+	public $service_time_rules;
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Addresses/AddressNote.php 3 patches
Indentation   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -12,223 +12,223 @@
 block discarded – undo
12 12
  */
13 13
 class AddressNote extends Common
14 14
 {
15
-    /** An unique ID of a note
16
-     * @var integer $note_id
17
-     */
18
-    public $note_id;
19
-
20
-    /** The route ID
21
-     * @var string $route_id
22
-     */
23
-    public $route_id;
24
-
25
-    /** The route destination ID
26
-     * @var integer $route_destination_id
27
-     */
28
-    public $route_destination_id;
29
-
30
-    /** An unique ID of an uploaded file
31
-     * @var string $upload_id
32
-     */
33
-    public $upload_id;
34
-
35
-    /** When the note was added
36
-     * @var integer $ts_added
37
-     */
38
-    public $ts_added;
39
-
40
-    /** The position latitude where the address note was added
41
-     * @var double $lat
42
-     */
43
-    public $lat;
44
-
45
-    /** The position longitude where the address note was added
46
-     * @var double $lng
47
-     */
48
-    public $lng;
49
-
50
-    /** The activity type
51
-     * @var string $activity_type
52
-     */
53
-    public $activity_type;
54
-
55
-    /** The note text contents
56
-     * @var string $contents
57
-     */
58
-    public $contents;
59
-
60
-    /** An upload type of the note
61
-     * @var string $upload_type
62
-     */
63
-    public $upload_type;
64
-
65
-    /** An upload url - where a file-note was uploaded.
66
-     * @var string $upload_url
67
-     */
68
-    public $upload_url;
69
-
70
-    /** An extension of the uploaded file.
71
-     * @var string $upload_extension
72
-     */
73
-    public $upload_extension;
74
-
75
-    /** The device a note was uploaded from
76
-     * @var string $device_type
77
-     */
78
-    public $device_type;
79
-
80
-    /** Array of the custom type notes
81
-     * @var AddressCustomNote[] $custom_types
82
-     */
83
-    public $custom_types = [];
84
-
85
-    public function __construct()
86
-    {
87
-
88
-    }
89
-
90
-    public static function fromArray(array $params)
91
-    {
92
-        $addressNote = new self();
93
-
94
-        foreach ($params as $key => $value) {
95
-            if (property_exists($addressNote, $key)) {
96
-                $addressNote->{$key} = $value;
97
-            } else {
98
-                throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
99
-            }
100
-        }
101
-
102
-        return $addressNote;
103
-    }
104
-
105
-    /*Get notes from the specified route destination
15
+	/** An unique ID of a note
16
+	 * @var integer $note_id
17
+	 */
18
+	public $note_id;
19
+
20
+	/** The route ID
21
+	 * @var string $route_id
22
+	 */
23
+	public $route_id;
24
+
25
+	/** The route destination ID
26
+	 * @var integer $route_destination_id
27
+	 */
28
+	public $route_destination_id;
29
+
30
+	/** An unique ID of an uploaded file
31
+	 * @var string $upload_id
32
+	 */
33
+	public $upload_id;
34
+
35
+	/** When the note was added
36
+	 * @var integer $ts_added
37
+	 */
38
+	public $ts_added;
39
+
40
+	/** The position latitude where the address note was added
41
+	 * @var double $lat
42
+	 */
43
+	public $lat;
44
+
45
+	/** The position longitude where the address note was added
46
+	 * @var double $lng
47
+	 */
48
+	public $lng;
49
+
50
+	/** The activity type
51
+	 * @var string $activity_type
52
+	 */
53
+	public $activity_type;
54
+
55
+	/** The note text contents
56
+	 * @var string $contents
57
+	 */
58
+	public $contents;
59
+
60
+	/** An upload type of the note
61
+	 * @var string $upload_type
62
+	 */
63
+	public $upload_type;
64
+
65
+	/** An upload url - where a file-note was uploaded.
66
+	 * @var string $upload_url
67
+	 */
68
+	public $upload_url;
69
+
70
+	/** An extension of the uploaded file.
71
+	 * @var string $upload_extension
72
+	 */
73
+	public $upload_extension;
74
+
75
+	/** The device a note was uploaded from
76
+	 * @var string $device_type
77
+	 */
78
+	public $device_type;
79
+
80
+	/** Array of the custom type notes
81
+	 * @var AddressCustomNote[] $custom_types
82
+	 */
83
+	public $custom_types = [];
84
+
85
+	public function __construct()
86
+	{
87
+
88
+	}
89
+
90
+	public static function fromArray(array $params)
91
+	{
92
+		$addressNote = new self();
93
+
94
+		foreach ($params as $key => $value) {
95
+			if (property_exists($addressNote, $key)) {
96
+				$addressNote->{$key} = $value;
97
+			} else {
98
+				throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
99
+			}
100
+		}
101
+
102
+		return $addressNote;
103
+	}
104
+
105
+	/*Get notes from the specified route destination
106 106
      * Returns an address object with notes, if an address exists, otherwise - return null.
107 107
      */
108
-    public static function GetAddressesNotes($noteParams)
109
-    {
110
-        $address = Route4Me::makeRequst([
111
-            'url'       => Endpoint::ADDRESS_V4,
112
-            'method'    => 'GET',
113
-            'query'     => [
114
-                'route_id'              => isset($noteParams['route_id']) ? $noteParams['route_id'] : null,
115
-                'route_destination_id'  => isset($noteParams['route_destination_id'])
116
-                    ? $noteParams['route_destination_id'] : null,
117
-                'notes' => 1,
118
-            ],
119
-        ]);
120
-
121
-        return $address;
122
-    }
123
-
124
-    public function createCustomNoteType($params)
125
-    {
126
-        $allBodyFields = ['type', 'values'];
127
-
128
-        $result = Route4Me::makeRequst([
129
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
130
-            'method'    => 'POST',
131
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
132
-        ]);
133
-
134
-        return $result;
135
-    }
136
-
137
-    public function removeCustomNoteType($params)
138
-    {
139
-        $result = Route4Me::makeRequst([
140
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
141
-            'method'    => 'DELETE',
142
-            'body'      => [
143
-                'id' => isset($params['id']) ? $params['id'] : null,
144
-            ],
145
-        ]);
146
-
147
-        return $result;
148
-    }
149
-
150
-    public function getAllCustomNoteTypes()
151
-    {
152
-        $result = Route4Me::makeRequst([
153
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
154
-            'method'    => 'GET',
155
-        ]);
156
-
157
-        return $result;
158
-    }
159
-
160
-    public function getCustomNoteTypeByKey($params)
161
-    {
162
-        $result = Route4Me::makeRequst([
163
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
164
-            'method'    => 'GET',
165
-        ]);
166
-
167
-        if (is_null($result) || !is_array($result)) return null;
168
-
169
-        foreach ($result as $custNoteType) {
170
-            if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) {
171
-                return $custNoteType;
172
-            }
173
-        }
174
-    }
175
-
176
-    public function AddAddressNote($params)
177
-    {
178
-        $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
179
-        $allBodyFields = ['strNoteContents', 'strUpdateType'];
180
-
181
-        $result = Route4Me::makeRequst([
182
-            'url'           => Endpoint::ROUTE_NOTES_ADD,
183
-            'method'        => 'POST',
184
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
185
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
186
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
187
-        ]);
188
-
189
-        return $result;
190
-    }
191
-
192
-    public function AddNoteFile($params)
193
-    {
194
-        $fname = isset($params['strFilename']) ? $params['strFilename'] : null;
195
-
196
-        $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
197
-        $allBodyFields = ['strFilename', 'strUpdateType', 'strNoteContents'];
198
-
199
-        $result = Route4Me::makeRequst([
200
-            'url'           => Endpoint::ROUTE_NOTES_ADD,
201
-            'method'        => 'POST',
202
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
203
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
204
-            'FILE'          => $fname,
205
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data'
206
-        ]);
207
-
208
-        return $result;
209
-    }
210
-
211
-    public function addCustomNoteToRoute($params)
212
-    {
213
-        $customArray = [];
214
-
215
-        foreach ($params as $key => $value) {
216
-            if (false !== strpos($key, 'custom_note_type')) {
217
-                $customArray[$key] = $value;
218
-            }
219
-        }
220
-
221
-        $allQueryFields = ['route_id', 'address_id', 'format', 'dev_lat', 'dev_lng'];
222
-        $allBodyFields = ['strUpdateType', 'strUpdateType', 'strNoteContents'];
223
-
224
-        $result = Route4Me::makeRequst([
225
-            'url'           => Endpoint::ROUTE_NOTES_ADD,
226
-            'method'        => 'POST',
227
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
228
-            'body'          => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray),
229
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
230
-        ]);
231
-
232
-        return $result;
233
-    }
108
+	public static function GetAddressesNotes($noteParams)
109
+	{
110
+		$address = Route4Me::makeRequst([
111
+			'url'       => Endpoint::ADDRESS_V4,
112
+			'method'    => 'GET',
113
+			'query'     => [
114
+				'route_id'              => isset($noteParams['route_id']) ? $noteParams['route_id'] : null,
115
+				'route_destination_id'  => isset($noteParams['route_destination_id'])
116
+					? $noteParams['route_destination_id'] : null,
117
+				'notes' => 1,
118
+			],
119
+		]);
120
+
121
+		return $address;
122
+	}
123
+
124
+	public function createCustomNoteType($params)
125
+	{
126
+		$allBodyFields = ['type', 'values'];
127
+
128
+		$result = Route4Me::makeRequst([
129
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
130
+			'method'    => 'POST',
131
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
132
+		]);
133
+
134
+		return $result;
135
+	}
136
+
137
+	public function removeCustomNoteType($params)
138
+	{
139
+		$result = Route4Me::makeRequst([
140
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
141
+			'method'    => 'DELETE',
142
+			'body'      => [
143
+				'id' => isset($params['id']) ? $params['id'] : null,
144
+			],
145
+		]);
146
+
147
+		return $result;
148
+	}
149
+
150
+	public function getAllCustomNoteTypes()
151
+	{
152
+		$result = Route4Me::makeRequst([
153
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
154
+			'method'    => 'GET',
155
+		]);
156
+
157
+		return $result;
158
+	}
159
+
160
+	public function getCustomNoteTypeByKey($params)
161
+	{
162
+		$result = Route4Me::makeRequst([
163
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
164
+			'method'    => 'GET',
165
+		]);
166
+
167
+		if (is_null($result) || !is_array($result)) return null;
168
+
169
+		foreach ($result as $custNoteType) {
170
+			if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) {
171
+				return $custNoteType;
172
+			}
173
+		}
174
+	}
175
+
176
+	public function AddAddressNote($params)
177
+	{
178
+		$allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
179
+		$allBodyFields = ['strNoteContents', 'strUpdateType'];
180
+
181
+		$result = Route4Me::makeRequst([
182
+			'url'           => Endpoint::ROUTE_NOTES_ADD,
183
+			'method'        => 'POST',
184
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
185
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
186
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
187
+		]);
188
+
189
+		return $result;
190
+	}
191
+
192
+	public function AddNoteFile($params)
193
+	{
194
+		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
195
+
196
+		$allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
197
+		$allBodyFields = ['strFilename', 'strUpdateType', 'strNoteContents'];
198
+
199
+		$result = Route4Me::makeRequst([
200
+			'url'           => Endpoint::ROUTE_NOTES_ADD,
201
+			'method'        => 'POST',
202
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
203
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
204
+			'FILE'          => $fname,
205
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data'
206
+		]);
207
+
208
+		return $result;
209
+	}
210
+
211
+	public function addCustomNoteToRoute($params)
212
+	{
213
+		$customArray = [];
214
+
215
+		foreach ($params as $key => $value) {
216
+			if (false !== strpos($key, 'custom_note_type')) {
217
+				$customArray[$key] = $value;
218
+			}
219
+		}
220
+
221
+		$allQueryFields = ['route_id', 'address_id', 'format', 'dev_lat', 'dev_lng'];
222
+		$allBodyFields = ['strUpdateType', 'strUpdateType', 'strNoteContents'];
223
+
224
+		$result = Route4Me::makeRequst([
225
+			'url'           => Endpoint::ROUTE_NOTES_ADD,
226
+			'method'        => 'POST',
227
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
228
+			'body'          => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray),
229
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
230
+		]);
231
+
232
+		return $result;
233
+	}
234 234
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         if (is_null($result) || !is_array($result)) return null;
182 182
 
183 183
         foreach ($result as $custNoteType) {
184
-            if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) {
184
+            if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"]==$params) {
185 185
                 return $custNoteType;
186 186
             }
187 187
         }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $customArray = [];
228 228
 
229 229
         foreach ($params as $key => $value) {
230
-            if (false !== strpos($key, 'custom_note_type')) {
230
+            if (false!==strpos($key, 'custom_note_type')) {
231 231
                 $customArray[$key] = $value;
232 232
             }
233 233
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,9 @@
 block discarded – undo
178 178
             'method'    => 'GET',
179 179
         ]);
180 180
 
181
-        if (is_null($result) || !is_array($result)) return null;
181
+        if (is_null($result) || !is_array($result)) {
182
+        	return null;
183
+        }
182 184
 
183 185
         foreach ($result as $custNoteType) {
184 186
             if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) {
Please login to merge, or discard this patch.
src/Route4Me/V5/Addresses/RouteAdvancedConstraints.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -11,72 +11,72 @@
 block discarded – undo
11 11
  */
12 12
 class RouteAdvancedConstraints extends Common
13 13
 {
14
-    /**
15
-     * Maximum cargo volume per route.
16
-     * @var double
17
-     */
18
-    public $max_cargo_volume;
14
+	/**
15
+	 * Maximum cargo volume per route.
16
+	 * @var double
17
+	 */
18
+	public $max_cargo_volume;
19 19
 
20
-    /**
21
-     * Vehicle capacity.<br>
22
-     * How much total cargo can be transported per route (units, e.g. cubic meters)
23
-     * @var integer
24
-     */
25
-    public $max_capacity;
20
+	/**
21
+	 * Vehicle capacity.<br>
22
+	 * How much total cargo can be transported per route (units, e.g. cubic meters)
23
+	 * @var integer
24
+	 */
25
+	public $max_capacity;
26 26
 
27
-    /**
28
-     * Legacy feature which permits a user to request an example number of optimized routes.
29
-     * @var integer
30
-     */
31
-    public $members_count;
27
+	/**
28
+	 * Legacy feature which permits a user to request an example number of optimized routes.
29
+	 * @var integer
30
+	 */
31
+	public $members_count;
32 32
 
33
-    /**
34
-     * An array of the available time windows (e.g. [ [25200, 75000 ] )
35
-     * @var integer[]
36
-     */
37
-    public $available_time_windows;
33
+	/**
34
+	 * An array of the available time windows (e.g. [ [25200, 75000 ] )
35
+	 * @var integer[]
36
+	 */
37
+	public $available_time_windows;
38 38
 
39
-    /**
40
-     * The driver tags specified in a team member's custom data.<br>
41
-     * e.g. "driver skills":<br>
42
-     * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"]
43
-     * @var string[]
44
-     */
45
-    public $tags;
39
+	/**
40
+	 * The driver tags specified in a team member's custom data.<br>
41
+	 * e.g. "driver skills":<br>
42
+	 * ["Class A CDL", "Class B CDL", "Forklift", "Skid Steer Loader", "Independent Contractor"]
43
+	 * @var string[]
44
+	 */
45
+	public $tags;
46 46
 
47
-    /**
48
-     * An array of the skilled driver IDs.
49
-     * @var integer[]
50
-     */
51
-    public $route4me_members_id;
47
+	/**
48
+	 * An array of the skilled driver IDs.
49
+	 * @var integer[]
50
+	 */
51
+	public $route4me_members_id;
52 52
 
53
-    /**
54
-     * An array containing Address objects.
55
-     * @var Address
56
-     */
57
-    public $depot_address;
53
+	/**
54
+	 * An array containing Address objects.
55
+	 * @var Address
56
+	 */
57
+	public $depot_address;
58 58
 
59
-    /**
60
-     * An array of locations.
61
-     * @var object[]
62
-     */
63
-    public $location_sequence_pattern;
59
+	/**
60
+	 * An array of locations.
61
+	 * @var object[]
62
+	 */
63
+	public $location_sequence_pattern;
64 64
 
65
-    /**
66
-     * Group.
67
-     * @var string
68
-     */
69
-    public $group;
65
+	/**
66
+	 * Group.
67
+	 * @var string
68
+	 */
69
+	public $group;
70 70
 
71
-    public static function fromArray(array $params)
72
-    {
73
-        $routeParams = new self();
74
-        foreach ($params as $key => $value) {
75
-            if (property_exists($routeParams, $key)) {
76
-                $routeParams->{$key} = $value;
77
-            }
78
-        }
71
+	public static function fromArray(array $params)
72
+	{
73
+		$routeParams = new self();
74
+		foreach ($params as $key => $value) {
75
+			if (property_exists($routeParams, $key)) {
76
+				$routeParams->{$key} = $value;
77
+			}
78
+		}
79 79
 
80
-        return $routeParams;
81
-    }
80
+		return $routeParams;
81
+	}
82 82
 }
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/V5/Addresses/BundledItemResponse.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -12,69 +12,69 @@
 block discarded – undo
12 12
  */
13 13
 class BundledItemResponse extends \Route4Me\Common
14 14
 {
15
-    /** Summary cube value of the bundled addresses
16
-     * @var double $cube
17
-     */
18
-    public $cube;
19
-
20
-    /** Summary revenue value of the bundled addresses
21
-     * @var double $revenue
22
-     */
23
-    public $revenue;
24
-
25
-    /** Summary pieces value of the bundled addresses
26
-     * @var integer $pieces
27
-     */
28
-    public $pieces;
29
-
30
-    /** Summary weight value of the bundled addresses
31
-     * @var double $weight
32
-     */
33
-    public $weight;
34
-
35
-    /** Summary cost value of the bundled addresses
36
-     * @var double $cost
37
-     */
38
-    public $cost;
39
-
40
-    /** Service time of the bundled addresses
41
-     * @var integer $service_time
42
-     */
43
-    public $service_time;
44
-
45
-    /** Time window start of the bundled addresses
46
-     * @var integer $time_window_start
47
-     */
48
-    public $time_window_start;
49
-
50
-    /** Time window emd of the bundled addresses
51
-     * @var integer $time_window_end
52
-     */
53
-    public $time_window_end;
54
-
55
-    /** TO DO: Adjust description
56
-     * @var array $custom_data
57
-     */
58
-    public $custom_data = [];
59
-
60
-    /** Array of the IDs of the bundeld addresses.
61
-     * @var integer[] $addresses_id
62
-     */
63
-    public $addresses_id = [];
64
-
65
-    public static function fromArray(array $params)
66
-    {
67
-        $boundedItemResp = new self();
68
-
69
-        foreach ($params as $key => $value) {
70
-            if (property_exists($boundedItemResp, $key)) {
71
-                $boundedItemResp->{$key} = $value;
72
-            } else {
73
-                throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
74
-            }
75
-        }
76
-
77
-        return $boundedItemResp;
78
-    }
15
+	/** Summary cube value of the bundled addresses
16
+	 * @var double $cube
17
+	 */
18
+	public $cube;
19
+
20
+	/** Summary revenue value of the bundled addresses
21
+	 * @var double $revenue
22
+	 */
23
+	public $revenue;
24
+
25
+	/** Summary pieces value of the bundled addresses
26
+	 * @var integer $pieces
27
+	 */
28
+	public $pieces;
29
+
30
+	/** Summary weight value of the bundled addresses
31
+	 * @var double $weight
32
+	 */
33
+	public $weight;
34
+
35
+	/** Summary cost value of the bundled addresses
36
+	 * @var double $cost
37
+	 */
38
+	public $cost;
39
+
40
+	/** Service time of the bundled addresses
41
+	 * @var integer $service_time
42
+	 */
43
+	public $service_time;
44
+
45
+	/** Time window start of the bundled addresses
46
+	 * @var integer $time_window_start
47
+	 */
48
+	public $time_window_start;
49
+
50
+	/** Time window emd of the bundled addresses
51
+	 * @var integer $time_window_end
52
+	 */
53
+	public $time_window_end;
54
+
55
+	/** TO DO: Adjust description
56
+	 * @var array $custom_data
57
+	 */
58
+	public $custom_data = [];
59
+
60
+	/** Array of the IDs of the bundeld addresses.
61
+	 * @var integer[] $addresses_id
62
+	 */
63
+	public $addresses_id = [];
64
+
65
+	public static function fromArray(array $params)
66
+	{
67
+		$boundedItemResp = new self();
68
+
69
+		foreach ($params as $key => $value) {
70
+			if (property_exists($boundedItemResp, $key)) {
71
+				$boundedItemResp->{$key} = $value;
72
+			} else {
73
+				throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
74
+			}
75
+		}
76
+
77
+		return $boundedItemResp;
78
+	}
79 79
 
80 80
 }
81 81
\ No newline at end of file
Please login to merge, or discard this patch.