Passed
Push — master ( f1b940...81ea28 )
by Joas
14:36 queued 15s
created
apps/cloud_federation_api/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\CloudFederationAPI\\' => array($baseDir . '/../lib'),
9
+    'OCA\\CloudFederationAPI\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
apps/workflowengine/composer/composer/ClassLoader.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
     private function findFileWithExtension($class, $ext)
371 371
     {
372 372
         // PSR-4 lookup
373
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
373
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext;
374 374
 
375 375
         $first = $class[0];
376 376
         if (isset($this->prefixLengthsPsr4[$first])) {
377 377
             $subPath = $class;
378 378
             while (false !== $lastPos = strrpos($subPath, '\\')) {
379 379
                 $subPath = substr($subPath, 0, $lastPos);
380
-                $search = $subPath . '\\';
380
+                $search = $subPath.'\\';
381 381
                 if (isset($this->prefixDirsPsr4[$search])) {
382
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
382
+                    $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1);
383 383
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
-                        if (file_exists($file = $dir . $pathEnd)) {
384
+                        if (file_exists($file = $dir.$pathEnd)) {
385 385
                             return $file;
386 386
                         }
387 387
                     }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         // PSR-4 fallback dirs
393 393
         foreach ($this->fallbackDirsPsr4 as $dir) {
394
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
394
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
395 395
                 return $file;
396 396
             }
397 397
         }
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404 404
         } else {
405 405
             // PEAR-like class name
406
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
406
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext;
407 407
         }
408 408
 
409 409
         if (isset($this->prefixesPsr0[$first])) {
410 410
             foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411 411
                 if (0 === strpos($class, $prefix)) {
412 412
                     foreach ($dirs as $dir) {
413
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
413
+                        if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
414 414
                             return $file;
415 415
                         }
416 416
                     }
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 
421 421
         // PSR-0 fallback dirs
422 422
         foreach ($this->fallbackDirsPsr0 as $dir) {
423
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
423
+            if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
424 424
                 return $file;
425 425
             }
426 426
         }
Please login to merge, or discard this patch.
apps/workflowengine/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\WorkflowEngine\\' => array($baseDir . '/../lib'),
9
+    'OCA\\WorkflowEngine\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
lib/public/Security/IContentSecurityPolicyManager.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@
 block discarded – undo
31 31
  * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
32 32
  */
33 33
 interface IContentSecurityPolicyManager {
34
-	/**
35
-	 * Allows to inject something into the default content policy. This is for
36
-	 * example useful when you're injecting Javascript code into a view belonging
37
-	 * to another controller and cannot modify its Content-Security-Policy itself.
38
-	 * Note that the adjustment is only applied to applications that use AppFramework
39
-	 * controllers.
40
-	 *
41
-	 * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
42
-	 * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
43
-	 *
44
-	 * WARNING: Using this API incorrectly may make the instance more insecure.
45
-	 * Do think twice before adding whitelisting resources. Please do also note
46
-	 * that it is not possible to use the `disallowXYZ` functions.
47
-	 *
48
-	 * @param EmptyContentSecurityPolicy $policy
49
-	 * @since 9.0.0
50
-	 * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
51
-	 */
52
-	public function addDefaultPolicy(EmptyContentSecurityPolicy $policy);
34
+    /**
35
+     * Allows to inject something into the default content policy. This is for
36
+     * example useful when you're injecting Javascript code into a view belonging
37
+     * to another controller and cannot modify its Content-Security-Policy itself.
38
+     * Note that the adjustment is only applied to applications that use AppFramework
39
+     * controllers.
40
+     *
41
+     * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
42
+     * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
43
+     *
44
+     * WARNING: Using this API incorrectly may make the instance more insecure.
45
+     * Do think twice before adding whitelisting resources. Please do also note
46
+     * that it is not possible to use the `disallowXYZ` functions.
47
+     *
48
+     * @param EmptyContentSecurityPolicy $policy
49
+     * @since 9.0.0
50
+     * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
51
+     */
52
+    public function addDefaultPolicy(EmptyContentSecurityPolicy $policy);
53 53
 }
Please login to merge, or discard this patch.
lib/public/Preview/IVersionedPreviewFile.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
  * @since 17.0.0
32 32
  */
33 33
 interface IVersionedPreviewFile {
34
-	/**
35
-	 * @return string
36
-	 * @since 17.0.0
37
-	 */
38
-	public function getPreviewVersion(): string;
34
+    /**
35
+     * @return string
36
+     * @since 17.0.0
37
+     */
38
+    public function getPreviewVersion(): string;
39 39
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Token/IWipeableToken.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 
27 27
 interface IWipeableToken extends IToken {
28 28
 
29
-	/**
30
-	 * Mark the token for remote wipe
31
-	 */
32
-	public function wipe(): void;
29
+    /**
30
+     * Mark the token for remote wipe
31
+     */
32
+    public function wipe(): void;
33 33
 
34 34
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Token/RemoteWipe.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$tokens = $this->tokenProvider->getTokenByUser($user->getUID());
86 86
 
87 87
 		/** @var IWipeableToken[] $wipeable */
88
-		$wipeable = array_filter($tokens, function (IToken $token) {
88
+		$wipeable = array_filter($tokens, function(IToken $token) {
89 89
 			return $token instanceof IWipeableToken;
90 90
 		});
91 91
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 		$dbToken = $e->getToken();
123 123
 
124
-		$this->logger->info("user " . $dbToken->getUID() . " started a remote wipe");
124
+		$this->logger->info("user ".$dbToken->getUID()." started a remote wipe");
125 125
 
126 126
 		$this->eventDispatcher->dispatch(RemoteWipeStarted::class, new RemoteWipeStarted($dbToken));
127 127
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		$this->tokenProvider->invalidateToken($token);
151 151
 
152
-		$this->logger->info("user " . $dbToken->getUID() . " finished a remote wipe");
152
+		$this->logger->info("user ".$dbToken->getUID()." finished a remote wipe");
153 153
 		$this->eventDispatcher->dispatch(RemoteWipeFinished::class, new RemoteWipeFinished($dbToken));
154 154
 
155 155
 		return true;
Please login to merge, or discard this patch.
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -39,117 +39,117 @@
 block discarded – undo
39 39
 
40 40
 class RemoteWipe {
41 41
 
42
-	/** @var IProvider */
43
-	private $tokenProvider;
44
-
45
-	/** @var IEventDispatcher */
46
-	private $eventDispatcher;
47
-
48
-	/** @var LoggerInterface */
49
-	private $logger;
50
-
51
-	public function __construct(IProvider $tokenProvider,
52
-								IEventDispatcher $eventDispatcher,
53
-								LoggerInterface $logger) {
54
-		$this->tokenProvider = $tokenProvider;
55
-		$this->eventDispatcher = $eventDispatcher;
56
-		$this->logger = $logger;
57
-	}
58
-
59
-	/**
60
-	 * @param IToken $token
61
-	 * @return bool
62
-	 *
63
-	 * @throws InvalidTokenException
64
-	 * @throws WipeTokenException
65
-	 */
66
-	public function markTokenForWipe(IToken $token): bool {
67
-		if (!$token instanceof IWipeableToken) {
68
-			return false;
69
-		}
70
-
71
-		$token->wipe();
72
-		$this->tokenProvider->updateToken($token);
73
-
74
-		return true;
75
-	}
76
-
77
-	/**
78
-	 * @param IUser $user
79
-	 *
80
-	 * @return bool true if any tokens have been marked for remote wipe
81
-	 */
82
-	public function markAllTokensForWipe(IUser $user): bool {
83
-		$tokens = $this->tokenProvider->getTokenByUser($user->getUID());
84
-
85
-		/** @var IWipeableToken[] $wipeable */
86
-		$wipeable = array_filter($tokens, function (IToken $token) {
87
-			return $token instanceof IWipeableToken;
88
-		});
89
-
90
-		if (empty($wipeable)) {
91
-			return false;
92
-		}
93
-
94
-		foreach ($wipeable as $token) {
95
-			$token->wipe();
96
-			$this->tokenProvider->updateToken($token);
97
-		}
98
-
99
-		return true;
100
-	}
101
-
102
-	/**
103
-	 * @param string $token
104
-	 *
105
-	 * @return bool whether wiping was started
106
-	 * @throws InvalidTokenException
107
-	 *
108
-	 */
109
-	public function start(string $token): bool {
110
-		try {
111
-			$this->tokenProvider->getToken($token);
112
-
113
-			// We expect a WipedTokenException here. If we reach this point this
114
-			// is an ordinary token
115
-			return false;
116
-		} catch (WipeTokenException $e) {
117
-			// Expected -> continue below
118
-		}
119
-
120
-		$dbToken = $e->getToken();
121
-
122
-		$this->logger->info("user " . $dbToken->getUID() . " started a remote wipe");
123
-
124
-		$this->eventDispatcher->dispatch(RemoteWipeStarted::class, new RemoteWipeStarted($dbToken));
125
-
126
-		return true;
127
-	}
128
-
129
-	/**
130
-	 * @param string $token
131
-	 *
132
-	 * @return bool whether wiping could be finished
133
-	 * @throws InvalidTokenException
134
-	 */
135
-	public function finish(string $token): bool {
136
-		try {
137
-			$this->tokenProvider->getToken($token);
138
-
139
-			// We expect a WipedTokenException here. If we reach this point this
140
-			// is an ordinary token
141
-			return false;
142
-		} catch (WipeTokenException $e) {
143
-			// Expected -> continue below
144
-		}
145
-
146
-		$dbToken = $e->getToken();
147
-
148
-		$this->tokenProvider->invalidateToken($token);
149
-
150
-		$this->logger->info("user " . $dbToken->getUID() . " finished a remote wipe");
151
-		$this->eventDispatcher->dispatch(RemoteWipeFinished::class, new RemoteWipeFinished($dbToken));
152
-
153
-		return true;
154
-	}
42
+    /** @var IProvider */
43
+    private $tokenProvider;
44
+
45
+    /** @var IEventDispatcher */
46
+    private $eventDispatcher;
47
+
48
+    /** @var LoggerInterface */
49
+    private $logger;
50
+
51
+    public function __construct(IProvider $tokenProvider,
52
+                                IEventDispatcher $eventDispatcher,
53
+                                LoggerInterface $logger) {
54
+        $this->tokenProvider = $tokenProvider;
55
+        $this->eventDispatcher = $eventDispatcher;
56
+        $this->logger = $logger;
57
+    }
58
+
59
+    /**
60
+     * @param IToken $token
61
+     * @return bool
62
+     *
63
+     * @throws InvalidTokenException
64
+     * @throws WipeTokenException
65
+     */
66
+    public function markTokenForWipe(IToken $token): bool {
67
+        if (!$token instanceof IWipeableToken) {
68
+            return false;
69
+        }
70
+
71
+        $token->wipe();
72
+        $this->tokenProvider->updateToken($token);
73
+
74
+        return true;
75
+    }
76
+
77
+    /**
78
+     * @param IUser $user
79
+     *
80
+     * @return bool true if any tokens have been marked for remote wipe
81
+     */
82
+    public function markAllTokensForWipe(IUser $user): bool {
83
+        $tokens = $this->tokenProvider->getTokenByUser($user->getUID());
84
+
85
+        /** @var IWipeableToken[] $wipeable */
86
+        $wipeable = array_filter($tokens, function (IToken $token) {
87
+            return $token instanceof IWipeableToken;
88
+        });
89
+
90
+        if (empty($wipeable)) {
91
+            return false;
92
+        }
93
+
94
+        foreach ($wipeable as $token) {
95
+            $token->wipe();
96
+            $this->tokenProvider->updateToken($token);
97
+        }
98
+
99
+        return true;
100
+    }
101
+
102
+    /**
103
+     * @param string $token
104
+     *
105
+     * @return bool whether wiping was started
106
+     * @throws InvalidTokenException
107
+     *
108
+     */
109
+    public function start(string $token): bool {
110
+        try {
111
+            $this->tokenProvider->getToken($token);
112
+
113
+            // We expect a WipedTokenException here. If we reach this point this
114
+            // is an ordinary token
115
+            return false;
116
+        } catch (WipeTokenException $e) {
117
+            // Expected -> continue below
118
+        }
119
+
120
+        $dbToken = $e->getToken();
121
+
122
+        $this->logger->info("user " . $dbToken->getUID() . " started a remote wipe");
123
+
124
+        $this->eventDispatcher->dispatch(RemoteWipeStarted::class, new RemoteWipeStarted($dbToken));
125
+
126
+        return true;
127
+    }
128
+
129
+    /**
130
+     * @param string $token
131
+     *
132
+     * @return bool whether wiping could be finished
133
+     * @throws InvalidTokenException
134
+     */
135
+    public function finish(string $token): bool {
136
+        try {
137
+            $this->tokenProvider->getToken($token);
138
+
139
+            // We expect a WipedTokenException here. If we reach this point this
140
+            // is an ordinary token
141
+            return false;
142
+        } catch (WipeTokenException $e) {
143
+            // Expected -> continue below
144
+        }
145
+
146
+        $dbToken = $e->getToken();
147
+
148
+        $this->tokenProvider->invalidateToken($token);
149
+
150
+        $this->logger->info("user " . $dbToken->getUID() . " finished a remote wipe");
151
+        $this->eventDispatcher->dispatch(RemoteWipeFinished::class, new RemoteWipeFinished($dbToken));
152
+
153
+        return true;
154
+    }
155 155
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Notifications/Notifier.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,65 +32,65 @@
 block discarded – undo
32 32
 
33 33
 class Notifier implements INotifier {
34 34
 
35
-	/** @var IL10nFactory */
36
-	private $factory;
35
+    /** @var IL10nFactory */
36
+    private $factory;
37 37
 
38
-	public function __construct(IL10nFactory $l10nFactory) {
39
-		$this->factory = $l10nFactory;
40
-	}
38
+    public function __construct(IL10nFactory $l10nFactory) {
39
+        $this->factory = $l10nFactory;
40
+    }
41 41
 
42
-	/**
43
-	 * @inheritDoc
44
-	 */
45
-	public function prepare(INotification $notification, string $languageCode): INotification {
46
-		if ($notification->getApp() !== 'auth') {
47
-			// Not my app => throw
48
-			throw new InvalidArgumentException();
49
-		}
42
+    /**
43
+     * @inheritDoc
44
+     */
45
+    public function prepare(INotification $notification, string $languageCode): INotification {
46
+        if ($notification->getApp() !== 'auth') {
47
+            // Not my app => throw
48
+            throw new InvalidArgumentException();
49
+        }
50 50
 
51
-		// Read the language from the notification
52
-		$l = $this->factory->get('lib', $languageCode);
51
+        // Read the language from the notification
52
+        $l = $this->factory->get('lib', $languageCode);
53 53
 
54
-		switch ($notification->getSubject()) {
55
-			case 'remote_wipe_start':
56
-				$notification->setParsedSubject(
57
-					$l->t('Remote wipe started')
58
-				)->setParsedMessage(
59
-					$l->t('A remote wipe was started on device %s', $notification->getSubjectParameters())
60
-				);
54
+        switch ($notification->getSubject()) {
55
+            case 'remote_wipe_start':
56
+                $notification->setParsedSubject(
57
+                    $l->t('Remote wipe started')
58
+                )->setParsedMessage(
59
+                    $l->t('A remote wipe was started on device %s', $notification->getSubjectParameters())
60
+                );
61 61
 
62
-				return $notification;
63
-			case 'remote_wipe_finish':
64
-				$notification->setParsedSubject(
65
-					$l->t('Remote wipe finished')
66
-				)->setParsedMessage(
67
-					$l->t('The remote wipe on %s has finished', $notification->getSubjectParameters())
68
-				);
62
+                return $notification;
63
+            case 'remote_wipe_finish':
64
+                $notification->setParsedSubject(
65
+                    $l->t('Remote wipe finished')
66
+                )->setParsedMessage(
67
+                    $l->t('The remote wipe on %s has finished', $notification->getSubjectParameters())
68
+                );
69 69
 
70
-				return $notification;
71
-			default:
72
-				// Unknown subject => Unknown notification => throw
73
-				throw new InvalidArgumentException();
74
-		}
75
-	}
70
+                return $notification;
71
+            default:
72
+                // Unknown subject => Unknown notification => throw
73
+                throw new InvalidArgumentException();
74
+        }
75
+    }
76 76
 
77
-	/**
78
-	 * Identifier of the notifier, only use [a-z0-9_]
79
-	 *
80
-	 * @return string
81
-	 * @since 17.0.0
82
-	 */
83
-	public function getID(): string {
84
-		return 'auth';
85
-	}
77
+    /**
78
+     * Identifier of the notifier, only use [a-z0-9_]
79
+     *
80
+     * @return string
81
+     * @since 17.0.0
82
+     */
83
+    public function getID(): string {
84
+        return 'auth';
85
+    }
86 86
 
87
-	/**
88
-	 * Human readable name describing the notifier
89
-	 *
90
-	 * @return string
91
-	 * @since 17.0.0
92
-	 */
93
-	public function getName(): string {
94
-		return $this->factory->get('lib')->t('Authentication');
95
-	}
87
+    /**
88
+     * Human readable name describing the notifier
89
+     *
90
+     * @return string
91
+     * @since 17.0.0
92
+     */
93
+    public function getName(): string {
94
+        return $this->factory->get('lib')->t('Authentication');
95
+    }
96 96
 }
Please login to merge, or discard this patch.
lib/private/Notification/Action.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -28,146 +28,146 @@
 block discarded – undo
28 28
 
29 29
 class Action implements IAction {
30 30
 
31
-	/** @var string */
32
-	protected $label;
33
-
34
-	/** @var string */
35
-	protected $labelParsed;
36
-
37
-	/** @var string */
38
-	protected $link;
39
-
40
-	/** @var string */
41
-	protected $requestType;
42
-
43
-	/** @var string */
44
-	protected $icon;
45
-
46
-	/** @var bool */
47
-	protected $primary;
48
-
49
-	public function __construct() {
50
-		$this->label = '';
51
-		$this->labelParsed = '';
52
-		$this->link = '';
53
-		$this->requestType = '';
54
-		$this->primary = false;
55
-	}
56
-
57
-	/**
58
-	 * @param string $label
59
-	 * @return $this
60
-	 * @throws \InvalidArgumentException if the label is invalid
61
-	 * @since 8.2.0
62
-	 */
63
-	public function setLabel(string $label): IAction {
64
-		if ($label === '' || isset($label[32])) {
65
-			throw new \InvalidArgumentException('The given label is invalid');
66
-		}
67
-		$this->label = $label;
68
-		return $this;
69
-	}
70
-
71
-	/**
72
-	 * @return string
73
-	 * @since 8.2.0
74
-	 */
75
-	public function getLabel(): string {
76
-		return $this->label;
77
-	}
78
-
79
-	/**
80
-	 * @param string $label
81
-	 * @return $this
82
-	 * @throws \InvalidArgumentException if the label is invalid
83
-	 * @since 8.2.0
84
-	 */
85
-	public function setParsedLabel(string $label): IAction {
86
-		if ($label === '') {
87
-			throw new \InvalidArgumentException('The given parsed label is invalid');
88
-		}
89
-		$this->labelParsed = $label;
90
-		return $this;
91
-	}
92
-
93
-	/**
94
-	 * @return string
95
-	 * @since 8.2.0
96
-	 */
97
-	public function getParsedLabel(): string {
98
-		return $this->labelParsed;
99
-	}
100
-
101
-	/**
102
-	 * @param $primary bool
103
-	 * @return $this
104
-	 * @since 9.0.0
105
-	 */
106
-	public function setPrimary(bool $primary): IAction {
107
-		$this->primary = $primary;
108
-		return $this;
109
-	}
110
-
111
-	/**
112
-	 * @return bool
113
-	 * @since 9.0.0
114
-	 */
115
-	public function isPrimary(): bool {
116
-		return $this->primary;
117
-	}
118
-
119
-	/**
120
-	 * @param string $link
121
-	 * @param string $requestType
122
-	 * @return $this
123
-	 * @throws \InvalidArgumentException if the link is invalid
124
-	 * @since 8.2.0
125
-	 */
126
-	public function setLink(string $link, string $requestType): IAction {
127
-		if ($link === '' || isset($link[256])) {
128
-			throw new \InvalidArgumentException('The given link is invalid');
129
-		}
130
-		if (!in_array($requestType, [
131
-			self::TYPE_GET,
132
-			self::TYPE_POST,
133
-			self::TYPE_PUT,
134
-			self::TYPE_DELETE,
135
-			self::TYPE_WEB,
136
-		], true)) {
137
-			throw new \InvalidArgumentException('The given request type is invalid');
138
-		}
139
-		$this->link = $link;
140
-		$this->requestType = $requestType;
141
-		return $this;
142
-	}
143
-
144
-	/**
145
-	 * @return string
146
-	 * @since 8.2.0
147
-	 */
148
-	public function getLink(): string {
149
-		return $this->link;
150
-	}
151
-
152
-	/**
153
-	 * @return string
154
-	 * @since 8.2.0
155
-	 */
156
-	public function getRequestType(): string {
157
-		return $this->requestType;
158
-	}
159
-
160
-	/**
161
-	 * @return bool
162
-	 */
163
-	public function isValid(): bool {
164
-		return $this->label !== '' && $this->link !== '';
165
-	}
166
-
167
-	/**
168
-	 * @return bool
169
-	 */
170
-	public function isValidParsed(): bool {
171
-		return $this->labelParsed !== '' && $this->link !== '';
172
-	}
31
+    /** @var string */
32
+    protected $label;
33
+
34
+    /** @var string */
35
+    protected $labelParsed;
36
+
37
+    /** @var string */
38
+    protected $link;
39
+
40
+    /** @var string */
41
+    protected $requestType;
42
+
43
+    /** @var string */
44
+    protected $icon;
45
+
46
+    /** @var bool */
47
+    protected $primary;
48
+
49
+    public function __construct() {
50
+        $this->label = '';
51
+        $this->labelParsed = '';
52
+        $this->link = '';
53
+        $this->requestType = '';
54
+        $this->primary = false;
55
+    }
56
+
57
+    /**
58
+     * @param string $label
59
+     * @return $this
60
+     * @throws \InvalidArgumentException if the label is invalid
61
+     * @since 8.2.0
62
+     */
63
+    public function setLabel(string $label): IAction {
64
+        if ($label === '' || isset($label[32])) {
65
+            throw new \InvalidArgumentException('The given label is invalid');
66
+        }
67
+        $this->label = $label;
68
+        return $this;
69
+    }
70
+
71
+    /**
72
+     * @return string
73
+     * @since 8.2.0
74
+     */
75
+    public function getLabel(): string {
76
+        return $this->label;
77
+    }
78
+
79
+    /**
80
+     * @param string $label
81
+     * @return $this
82
+     * @throws \InvalidArgumentException if the label is invalid
83
+     * @since 8.2.0
84
+     */
85
+    public function setParsedLabel(string $label): IAction {
86
+        if ($label === '') {
87
+            throw new \InvalidArgumentException('The given parsed label is invalid');
88
+        }
89
+        $this->labelParsed = $label;
90
+        return $this;
91
+    }
92
+
93
+    /**
94
+     * @return string
95
+     * @since 8.2.0
96
+     */
97
+    public function getParsedLabel(): string {
98
+        return $this->labelParsed;
99
+    }
100
+
101
+    /**
102
+     * @param $primary bool
103
+     * @return $this
104
+     * @since 9.0.0
105
+     */
106
+    public function setPrimary(bool $primary): IAction {
107
+        $this->primary = $primary;
108
+        return $this;
109
+    }
110
+
111
+    /**
112
+     * @return bool
113
+     * @since 9.0.0
114
+     */
115
+    public function isPrimary(): bool {
116
+        return $this->primary;
117
+    }
118
+
119
+    /**
120
+     * @param string $link
121
+     * @param string $requestType
122
+     * @return $this
123
+     * @throws \InvalidArgumentException if the link is invalid
124
+     * @since 8.2.0
125
+     */
126
+    public function setLink(string $link, string $requestType): IAction {
127
+        if ($link === '' || isset($link[256])) {
128
+            throw new \InvalidArgumentException('The given link is invalid');
129
+        }
130
+        if (!in_array($requestType, [
131
+            self::TYPE_GET,
132
+            self::TYPE_POST,
133
+            self::TYPE_PUT,
134
+            self::TYPE_DELETE,
135
+            self::TYPE_WEB,
136
+        ], true)) {
137
+            throw new \InvalidArgumentException('The given request type is invalid');
138
+        }
139
+        $this->link = $link;
140
+        $this->requestType = $requestType;
141
+        return $this;
142
+    }
143
+
144
+    /**
145
+     * @return string
146
+     * @since 8.2.0
147
+     */
148
+    public function getLink(): string {
149
+        return $this->link;
150
+    }
151
+
152
+    /**
153
+     * @return string
154
+     * @since 8.2.0
155
+     */
156
+    public function getRequestType(): string {
157
+        return $this->requestType;
158
+    }
159
+
160
+    /**
161
+     * @return bool
162
+     */
163
+    public function isValid(): bool {
164
+        return $this->label !== '' && $this->link !== '';
165
+    }
166
+
167
+    /**
168
+     * @return bool
169
+     */
170
+    public function isValidParsed(): bool {
171
+        return $this->labelParsed !== '' && $this->link !== '';
172
+    }
173 173
 }
Please login to merge, or discard this patch.