Completed
Pull Request — master (#795)
by Sean
03:44
created

ApprovalsDispatcher   B

Complexity

Total Complexity 45

Size/Duplication

Total Lines 302
Duplicated Lines 13.58 %

Coupling/Cohesion

Components 1
Dependencies 9

Importance

Changes 0
Metric Value
wmc 45
lcom 1
cbo 9
dl 41
loc 302
rs 8.3673
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 14 14 3
D submit() 0 44 9
B cancel() 0 32 5
C approve() 12 72 14
C reject() 3 41 7
B validateDeployment() 12 12 5
A getModel() 0 3 1
A Link() 0 3 1

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like ApprovalsDispatcher often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use ApprovalsDispatcher, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
class ApprovalsDispatcher extends Dispatcher {
0 ignored issues
show
Coding Style introduced by
The property $allowed_actions is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $action_types is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	const ACTION_APPROVALS = 'approvals';
6
7
	const ALLOW_APPROVAL = 'ALLOW_APPROVAL';
8
9
	const ALLOW_APPROVAL_BYPASS = 'ALLOW_APPROVAL_BYPASS';
10
11
	/**
12
	 * @var array
13
	 */
14
	private static $allowed_actions = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
15
		'approvers',
16
		'submit',
17
		'cancel',
18
		'approve',
19
		'reject'
20
	];
21
22
	private static $dependencies = [
23
		'formatter' => '%$DeploynautAPIFormatter'
24
	];
25
26
	/**
27
	 * @var \DNProject
28
	 */
29
	protected $project = null;
30
31
	/**
32
	 * @var \DNEnvironment
33
	 */
34
	protected $environment = null;
35
36
	/**
37
	 * @var array
38
	 */
39
	private static $action_types = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $action_types is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
40
		self::ACTION_APPROVALS
41
	];
42
43 View Code Duplication
	public function init() {
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...
44
		parent::init();
45
46
		$this->project = $this->getCurrentProject();
47
		if (!$this->project) {
48
			return $this->project404Response();
49
		}
50
51
		// Performs canView permission check by limiting visible projects
52
		$this->environment = $this->getCurrentEnvironment($this->project);
53
		if (!$this->environment) {
54
			return $this->environment404Response();
55
		}
56
	}
57
58
	/**
59
	 * @param \SS_HTTPRequest $request
60
	 * @return \SS_HTTPResponse
61
	 */
62
	public function submit(\SS_HTTPRequest $request) {
63
		if ($request->httpMethod() !== 'POST') {
64
			return $this->getAPIResponse(['message' => 'Method not allowed, requires POST'], 405);
65
		}
66
67
		$this->checkSecurityToken();
68
69
		$deployment = DNDeployment::get()->byId($request->postVar('id'));
70
		$errorResponse = $this->validateDeployment($deployment);
0 ignored issues
show
Documentation introduced by
$deployment is of type object<DataObject>|null, but the function expects a object<DNDeployment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
		if ($errorResponse instanceof \SS_HTTPResponse) {
72
			return $errorResponse;
73
		}
74
75
		$approver = Member::get()->byId($request->postVar('approver_id'));
76
		if ($approver && $approver->exists()) {
77
			if (!$this->project->allowed(ApprovalsDispatcher::ALLOW_APPROVAL, $approver)) {
0 ignored issues
show
Documentation introduced by
$approver is of type object<DataObject>, but the function expects a object<Member>|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
78
				return $this->getAPIResponse(['message' => 'The given approver does not have permissions to approve'], 403);
79
			}
80
81
			$deployment->ApproverID = $approver->ID;
82
			$deployment->write();
83
		}
84
85
		// title and summary may have changed, ensure they are saved
86
		if ($request->postVar('title')) {
87
			$deployment->Title = $request->postVar('title');
88
		}
89
		if ($request->postVar('summary')) {
90
			$deployment->Summary = $request->postVar('summary');
0 ignored issues
show
Bug introduced by
The property Summary does not seem to exist. Did you mean summary_fields?

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...
91
		}
92
93
		try {
94
			$deployment->getMachine()->apply(DNDeployment::TR_SUBMIT);
95
		} catch (\Exception $e) {
96
			return $this->getAPIResponse([
97
				'message' => $e->getMessage()
98
			], 400);
99
		}
100
101
		return $this->getAPIResponse([
102
			'message' => 'Deployment request has been submitted',
103
			'deployment' => $this->formatter->getDeploymentData($deployment)
0 ignored issues
show
Documentation introduced by
The property formatter does not exist on object<ApprovalsDispatcher>. 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...
104
		], 200);
105
	}
106
107
	/**
108
	 * @param \SS_HTTPRequest $request
109
	 * @return \SS_HTTPResponse
110
	 */
111
	public function cancel(\SS_HTTPRequest $request) {
112
		if ($request->httpMethod() !== 'POST') {
113
			return $this->getAPIResponse(['message' => 'Method not allowed, requires POST'], 405);
114
		}
115
116
		$this->checkSecurityToken();
117
118
		$deployment = DNDeployment::get()->byId($request->postVar('id'));
119
		$errorResponse = $this->validateDeployment($deployment);
0 ignored issues
show
Documentation introduced by
$deployment is of type object<DataObject>|null, but the function expects a object<DNDeployment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
120
		if ($errorResponse instanceof \SS_HTTPResponse) {
121
			return $errorResponse;
122
		}
123
124
		// if the person cancelling is not the one who created the deployment, update the deployer
125
		if (Member::currentUserID() !== $deployment->DeployerID) {
126
			$deployment->DeployerID = Member::currentUserID();
127
			$deployment->write();
128
		}
129
130
		try {
131
			$deployment->getMachine()->apply(DNDeployment::TR_NEW);
132
		} catch (\Exception $e) {
133
			return $this->getAPIResponse([
134
				'message' => $e->getMessage()
135
			], 400);
136
		}
137
138
		return $this->getAPIResponse([
139
			'message' => 'Deployment request has been cancelled',
140
			'deployment' => $this->formatter->getDeploymentData($deployment)
0 ignored issues
show
Documentation introduced by
The property formatter does not exist on object<ApprovalsDispatcher>. 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...
141
		], 200);
142
	}
143
144
	/**
145
	 * @param \SS_HTTPRequest $request
146
	 * @return \SS_HTTPResponse
147
	 */
148
	public function approve(\SS_HTTPRequest $request) {
149
		if ($request->httpMethod() !== 'POST') {
150
			return $this->getAPIResponse(['message' => 'Method not allowed, requires POST'], 405);
151
		}
152
153
		$this->checkSecurityToken();
154
155
		$deployment = DNDeployment::get()->byId($request->postVar('id'));
156
		$errorResponse = $this->validateDeployment($deployment);
0 ignored issues
show
Documentation introduced by
$deployment is of type object<DataObject>|null, but the function expects a object<DNDeployment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
157
		if ($errorResponse instanceof \SS_HTTPResponse) {
158
			return $errorResponse;
159
		}
160
161
		// ensure we have either bypass or approval permission of the logged in user
162
		if (
163
			!$this->project->allowed(self::ALLOW_APPROVAL_BYPASS, Member::currentUser())
0 ignored issues
show
Bug introduced by
It seems like \Member::currentUser() targeting Member::currentUser() can also be of type object<DataObject>; however, DNProject::allowed() does only seem to accept object<Member>|null, 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...
164
			|| !$this->project->allowed(self::ALLOW_APPROVAL, Member::currentUser())
0 ignored issues
show
Bug introduced by
It seems like \Member::currentUser() targeting Member::currentUser() can also be of type object<DataObject>; however, DNProject::allowed() does only seem to accept object<Member>|null, 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...
165
		) {
166
			return $this->getAPIResponse(['message' => 'You are not authorised to approve or bypass this deployment'], 403);
167
		}
168
169
		// check for specific permission depending on the current state of the deployment:
170
		// submitted => approved requires approval permissions
171
		// new => approved requires bypass permissions.
172 View Code Duplication
		if (
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
173
			$deployment->State === DNDeployment::STATE_SUBMITTED
174
			&& !$this->project->allowed(self::ALLOW_APPROVAL, Member::currentUser())
0 ignored issues
show
Bug introduced by
It seems like \Member::currentUser() targeting Member::currentUser() can also be of type object<DataObject>; however, DNProject::allowed() does only seem to accept object<Member>|null, 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...
175
		) {
176
			return $this->getAPIResponse(['message' => 'You are not authorised to approve this deployment'], 403);
177
		}
178 View Code Duplication
		if (
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
179
			$deployment->State === DNDeployment::STATE_NEW
180
			&& !$this->project->allowed(self::ALLOW_APPROVAL_BYPASS, Member::currentUser())
0 ignored issues
show
Bug introduced by
It seems like \Member::currentUser() targeting Member::currentUser() can also be of type object<DataObject>; however, DNProject::allowed() does only seem to accept object<Member>|null, 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...
181
		) {
182
			return $this->getAPIResponse(['message' => 'You are not authorised to bypass approval of this deployment'], 403);
183
		}
184
185
		if ($deployment->State === DNDeployment::STATE_NEW) {
186
			// Bypassing approval: Ensure that approver is not set. This may happen when someone has requested approval,
187
			// cancelled approval, then bypassed.
188
			$deployment->ApproverID = 0;
189
			$deployment->write();
190
		} else {
191
			// if the current user is not the person who was selected for approval on submit, but they got
192
			// here because they still have permission, then change the approver to the current user
193
			if (Member::currentUserID() !== $deployment->ApproverID) {
194
				$deployment->ApproverID = Member::currentUserID();
195
				$deployment->write();
196
			}
197
		}
198
199
		// title and summary may have changed, ensure they are saved
200
		if ($request->postVar('title')) {
201
			$deployment->Title = $request->postVar('title');
202
		}
203
		if ($request->postVar('summary')) {
204
			$deployment->Summary = $request->postVar('summary');
0 ignored issues
show
Bug introduced by
The property Summary does not seem to exist. Did you mean summary_fields?

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...
205
		}
206
207
		try {
208
			$deployment->getMachine()->apply(DNDeployment::TR_APPROVE);
209
		} catch (\Exception $e) {
210
			return $this->getAPIResponse([
211
				'message' => $e->getMessage()
212
			], 400);
213
		}
214
215
		return $this->getAPIResponse([
216
			'message' => 'Deployment request has been approved',
217
			'deployment' => $this->formatter->getDeploymentData($deployment)
0 ignored issues
show
Documentation introduced by
The property formatter does not exist on object<ApprovalsDispatcher>. 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...
218
		], 200);
219
	}
220
221
	/**
222
	 * @param \SS_HTTPRequest $request
223
	 * @return \SS_HTTPResponse
224
	 */
225
	public function reject(\SS_HTTPRequest $request) {
226
		if ($request->httpMethod() !== 'POST') {
227
			return $this->getAPIResponse(['message' => 'Method not allowed, requires POST'], 405);
228
		}
229
230
		$this->checkSecurityToken();
231
232
		$deployment = DNDeployment::get()->byId($request->postVar('id'));
233
		$errorResponse = $this->validateDeployment($deployment);
0 ignored issues
show
Documentation introduced by
$deployment is of type object<DataObject>|null, but the function expects a object<DNDeployment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
234
		if ($errorResponse instanceof \SS_HTTPResponse) {
235
			return $errorResponse;
236
		}
237
		// reject permissions are the same as can approve
238 View Code Duplication
		if (!$this->project->allowed(self::ALLOW_APPROVAL, Member::currentUser())) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
Bug introduced by
It seems like \Member::currentUser() targeting Member::currentUser() can also be of type object<DataObject>; however, DNProject::allowed() does only seem to accept object<Member>|null, 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...
239
			return $this->getAPIResponse(['message' => 'You are not authorised to reject this deployment'], 403);
240
		}
241
242
		// if the current user is not the person who was selected for approval on submit, but they got
243
		// here because they still have permission, then change the approver to the current user
244
		if (Member::currentUserID() !== $deployment->ApproverID) {
245
			$deployment->ApproverID = Member::currentUserID();
246
			$deployment->write();
247
		}
248
249
		if ($request->postVar('rejected_reason')) {
250
			$deployment->RejectedReason = $request->postVar('rejected_reason');
251
		}
252
253
		try {
254
			$deployment->getMachine()->apply(DNDeployment::TR_REJECT);
255
		} catch (\Exception $e) {
256
			return $this->getAPIResponse([
257
				'message' => $e->getMessage()
258
			], 400);
259
		}
260
261
		return $this->getAPIResponse([
262
			'message' => 'Deployment request has been rejected',
263
			'deployment' => $this->formatter->getDeploymentData($deployment)
0 ignored issues
show
Documentation introduced by
The property formatter does not exist on object<ApprovalsDispatcher>. 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...
264
		], 200);
265
	}
266
267
	/**
268
	 * Check if a DNDeployment exists and do permission checks on it. If there is something wrong it will return
269
	 * an APIResponse with the error, otherwise null.
270
	 *
271
	 * @param \DNDeployment $deployment
272
	 *
273
	 * @return null|SS_HTTPResponse
274
	 */
275 View Code Duplication
	protected function validateDeployment($deployment) {
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...
276
		if (!$deployment || !$deployment->exists()) {
277
			return $this->getAPIResponse(['message' => 'This deployment does not exist'], 404);
278
		}
279
		if ($deployment->EnvironmentID != $this->environment->ID) {
280
			return $this->getAPIResponse(['message' => 'This deployment does not belong to the environment'], 403);
281
		}
282
		if (!$deployment->canView()) {
283
			return $this->getAPIResponse(['message' => 'You are not authorised to view this deployment'], 403);
284
		}
285
		return null;
286
	}
287
288
	/**
289
	 * @param string $name
290
	 * @return array
291
	 */
292
	public function getModel($name = '') {
293
		return [];
294
	}
295
296
	/**
297
	 * @param string $action
298
	 * @return string
299
	 */
300
	public function Link($action = '') {
301
		return \Controller::join_links($this->environment->Link(), self::ACTION_APPROVALS, $action);
302
	}
303
304
}
305