Completed
Pull Request — master (#489)
by Helpful
03:34
created
code/control/Dispatcher.php 3 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -1,174 +1,174 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Dispatcher provides functionality to make it easier to work with frontend React components.
4
- * See deploynaut/docs/dispatcher.md for more information.
5
- *
6
- * @todo: currently we can't have more than one component mounted in parallel on any given Dispatcher,
7
- * because the SecurityID will diverge as soon as one of these components submit.
8
- */
3
+	 * Dispatcher provides functionality to make it easier to work with frontend React components.
4
+	 * See deploynaut/docs/dispatcher.md for more information.
5
+	 *
6
+	 * @todo: currently we can't have more than one component mounted in parallel on any given Dispatcher,
7
+	 * because the SecurityID will diverge as soon as one of these components submit.
8
+	 */
9 9
 
10 10
 abstract class Dispatcher extends DNRoot
11 11
 {
12 12
 
13
-    /**
14
-     * Generate the data structure used by the frontend component.
15
-     *
16
-     * @param string $name of the component
17
-     * @return array
18
-     */
19
-    abstract public function getModel($name);
20
-
21
-    /**
22
-     * Renders the initial HTML needed to bootstrap the react component.
23
-     *
24
-     * Usage: $getReactComponent(YourComponent);
25
-     *
26
-     * @param string $name Used to name the DOM elements and obtain the initial model.
27
-     * @return string A snippet good for adding to a SS template.
28
-     */
29
-    public function getReactComponent($name)
30
-    {
31
-        $model = $this->getModel($name);
32
-        $model['InitialSecurityID'] = $this->getSecurityToken()->getValue();
33
-
34
-        return $this->customise([
35
-            'Name' => $name,
36
-            'Model' => htmlentities(json_encode($model))
37
-        ])->renderWith('ReactTemplate');
38
-    }
39
-
40
-    protected function getSecurityToken($name = null)
41
-    {
42
-        if (is_null($name)) {
43
-            $name = sprintf('%sSecurityID', get_class($this));
44
-        }
45
-        return new \SecurityToken($name);
46
-    }
47
-
48
-    protected function checkSecurityToken($name = null)
49
-    {
50
-        $postVar = is_null($name) ? 'SecurityID' : $name;
51
-        if (is_null($name)) {
52
-            $name = sprintf('%sSecurityID', get_class($this));
53
-        }
54
-        $securityToken = $this->getSecurityToken($name);
55
-
56
-        // By default the security token is always represented by a "SecurityID" post var,
57
-        // even if the backend uses different names for the token. This too means only one security token
58
-        // can be managed by one dispatcher if the default is used.
59
-        if (!$securityToken->check($this->request->postVar($postVar))) {
60
-            $this->httpError(400, 'Invalid security token, try reloading the page.');
61
-        }
62
-    }
63
-
64
-    /**
65
-     * Return the validator errors as AJAX response.
66
-     *
67
-     * @param int $code HTTP status code.
68
-     * @param array $validatorErrors Result of calling Validator::validate, e.g.
69
-     *	[{"fieldName":"Name","message":"Message.","messageType":"bad"}]
70
-     * @return \SS_HTTPResponse
71
-     */
72
-    public function asJSONValidatorErrors($code, $validatorErrors)
73
-    {
74
-        $fieldErrors = [];
75
-        foreach ($validatorErrors as $error) {
76
-            $fieldErrors[$error['fieldName']] = $error['message'];
77
-        }
78
-        return $this->asJSONFormFieldErrors($code, $fieldErrors);
79
-    }
80
-
81
-    /**
82
-     * Return field-specific errors as AJAX response.
83
-     *
84
-     * @param int $code HTTP status code.
85
-     * @param array $fieldErrors FieldName => message structure.
86
-     * @return \SS_HTTPResponse
87
-     */
88
-    public function asJSONFormFieldErrors($code, $fieldErrors)
89
-    {
90
-        $response = $this->getResponse();
91
-        $response->addHeader('Content-Type', 'application/json');
92
-        $response->setBody(json_encode([
93
-            'InputErrors' => $fieldErrors
94
-        ]));
95
-        $response->setStatusCode($code);
96
-        return $response;
97
-    }
98
-
99
-    /**
100
-     * Respond to an AJAX request.
101
-     * Automatically updates the security token and proxy pending redirects.
102
-     *
103
-     * @param array $data Data to be passed to the frontend.
104
-     */
105
-    public function asJSON($data = [])
106
-    {
107
-        $securityToken = $this->getSecurityToken();
108
-        $securityToken->reset();
109
-        $data['NewSecurityID'] = $securityToken->getValue();
110
-
111
-        $response = $this->getResponse();
112
-
113
-        // If we received an AJAX request, we can't redirect in an ordinary way: the browser will
114
-        // interpret the 302 responses internally and the response will never reach JS.
115
-        //
116
-        // To get around that, upon spotting an active redirect, we change the response code to 200,
117
-        // and move the redirect into the "RedirectTo" field in the JSON response. Frontend can
118
-        // then interpret this and trigger a redirect.
119
-        if ($this->redirectedTo()) {
120
-            $data['RedirectTo'] = $this->response->getHeader('Location');
121
-            // Pop off the header - we are no longer redirecting via the usual mechanism.
122
-            $this->response->removeHeader('Location');
123
-        }
124
-
125
-        $response->addHeader('Content-Type', 'application/json');
126
-        $response->setBody(json_encode($data));
127
-        $response->setStatusCode(200);
128
-        return $response;
129
-    }
130
-
131
-    /**
132
-     * Decode the data submitted by the form.jsx control.
133
-     *
134
-     * @return array
135
-     */
136
-    protected function getFormData()
137
-    {
138
-        return $this->stripNonPrintables(json_decode($this->request->postVar('Details'), true));
139
-    }
140
-
141
-    /**
142
-     * @param string|array
143
-     * @return string
144
-     */
145
-    protected function trimWhitespace($val)
146
-    {
147
-        if (is_array($val)) {
148
-            foreach ($val as $k => $v) {
149
-                $val[$k] = $this->trimWhitespace($v);
150
-            }
151
-            return $val;
152
-        } else {
153
-            return trim($val);
154
-        }
155
-    }
156
-
157
-    /**
158
-     * Remove control characters from the input.
159
-     *
160
-     * @param string|array
161
-     * @return string
162
-     */
163
-    protected function stripNonPrintables($val)
164
-    {
165
-        if (is_array($val)) {
166
-            foreach ($val as $k => $v) {
167
-                $val[$k] = $this->stripNonPrintables($v);
168
-            }
169
-            return $val;
170
-        } else {
171
-            return preg_replace('/[[:cntrl:]]/', '', $val);
172
-        }
173
-    }
13
+	/**
14
+	 * Generate the data structure used by the frontend component.
15
+	 *
16
+	 * @param string $name of the component
17
+	 * @return array
18
+	 */
19
+	abstract public function getModel($name);
20
+
21
+	/**
22
+	 * Renders the initial HTML needed to bootstrap the react component.
23
+	 *
24
+	 * Usage: $getReactComponent(YourComponent);
25
+	 *
26
+	 * @param string $name Used to name the DOM elements and obtain the initial model.
27
+	 * @return string A snippet good for adding to a SS template.
28
+	 */
29
+	public function getReactComponent($name)
30
+	{
31
+		$model = $this->getModel($name);
32
+		$model['InitialSecurityID'] = $this->getSecurityToken()->getValue();
33
+
34
+		return $this->customise([
35
+			'Name' => $name,
36
+			'Model' => htmlentities(json_encode($model))
37
+		])->renderWith('ReactTemplate');
38
+	}
39
+
40
+	protected function getSecurityToken($name = null)
41
+	{
42
+		if (is_null($name)) {
43
+			$name = sprintf('%sSecurityID', get_class($this));
44
+		}
45
+		return new \SecurityToken($name);
46
+	}
47
+
48
+	protected function checkSecurityToken($name = null)
49
+	{
50
+		$postVar = is_null($name) ? 'SecurityID' : $name;
51
+		if (is_null($name)) {
52
+			$name = sprintf('%sSecurityID', get_class($this));
53
+		}
54
+		$securityToken = $this->getSecurityToken($name);
55
+
56
+		// By default the security token is always represented by a "SecurityID" post var,
57
+		// even if the backend uses different names for the token. This too means only one security token
58
+		// can be managed by one dispatcher if the default is used.
59
+		if (!$securityToken->check($this->request->postVar($postVar))) {
60
+			$this->httpError(400, 'Invalid security token, try reloading the page.');
61
+		}
62
+	}
63
+
64
+	/**
65
+	 * Return the validator errors as AJAX response.
66
+	 *
67
+	 * @param int $code HTTP status code.
68
+	 * @param array $validatorErrors Result of calling Validator::validate, e.g.
69
+	 *	[{"fieldName":"Name","message":"Message.","messageType":"bad"}]
70
+	 * @return \SS_HTTPResponse
71
+	 */
72
+	public function asJSONValidatorErrors($code, $validatorErrors)
73
+	{
74
+		$fieldErrors = [];
75
+		foreach ($validatorErrors as $error) {
76
+			$fieldErrors[$error['fieldName']] = $error['message'];
77
+		}
78
+		return $this->asJSONFormFieldErrors($code, $fieldErrors);
79
+	}
80
+
81
+	/**
82
+	 * Return field-specific errors as AJAX response.
83
+	 *
84
+	 * @param int $code HTTP status code.
85
+	 * @param array $fieldErrors FieldName => message structure.
86
+	 * @return \SS_HTTPResponse
87
+	 */
88
+	public function asJSONFormFieldErrors($code, $fieldErrors)
89
+	{
90
+		$response = $this->getResponse();
91
+		$response->addHeader('Content-Type', 'application/json');
92
+		$response->setBody(json_encode([
93
+			'InputErrors' => $fieldErrors
94
+		]));
95
+		$response->setStatusCode($code);
96
+		return $response;
97
+	}
98
+
99
+	/**
100
+	 * Respond to an AJAX request.
101
+	 * Automatically updates the security token and proxy pending redirects.
102
+	 *
103
+	 * @param array $data Data to be passed to the frontend.
104
+	 */
105
+	public function asJSON($data = [])
106
+	{
107
+		$securityToken = $this->getSecurityToken();
108
+		$securityToken->reset();
109
+		$data['NewSecurityID'] = $securityToken->getValue();
110
+
111
+		$response = $this->getResponse();
112
+
113
+		// If we received an AJAX request, we can't redirect in an ordinary way: the browser will
114
+		// interpret the 302 responses internally and the response will never reach JS.
115
+		//
116
+		// To get around that, upon spotting an active redirect, we change the response code to 200,
117
+		// and move the redirect into the "RedirectTo" field in the JSON response. Frontend can
118
+		// then interpret this and trigger a redirect.
119
+		if ($this->redirectedTo()) {
120
+			$data['RedirectTo'] = $this->response->getHeader('Location');
121
+			// Pop off the header - we are no longer redirecting via the usual mechanism.
122
+			$this->response->removeHeader('Location');
123
+		}
124
+
125
+		$response->addHeader('Content-Type', 'application/json');
126
+		$response->setBody(json_encode($data));
127
+		$response->setStatusCode(200);
128
+		return $response;
129
+	}
130
+
131
+	/**
132
+	 * Decode the data submitted by the form.jsx control.
133
+	 *
134
+	 * @return array
135
+	 */
136
+	protected function getFormData()
137
+	{
138
+		return $this->stripNonPrintables(json_decode($this->request->postVar('Details'), true));
139
+	}
140
+
141
+	/**
142
+	 * @param string|array
143
+	 * @return string
144
+	 */
145
+	protected function trimWhitespace($val)
146
+	{
147
+		if (is_array($val)) {
148
+			foreach ($val as $k => $v) {
149
+				$val[$k] = $this->trimWhitespace($v);
150
+			}
151
+			return $val;
152
+		} else {
153
+			return trim($val);
154
+		}
155
+	}
156
+
157
+	/**
158
+	 * Remove control characters from the input.
159
+	 *
160
+	 * @param string|array
161
+	 * @return string
162
+	 */
163
+	protected function stripNonPrintables($val)
164
+	{
165
+		if (is_array($val)) {
166
+			foreach ($val as $k => $v) {
167
+				$val[$k] = $this->stripNonPrintables($v);
168
+			}
169
+			return $val;
170
+		} else {
171
+			return preg_replace('/[[:cntrl:]]/', '', $val);
172
+		}
173
+	}
174 174
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     protected function getSecurityToken($name = null)
41 41
     {
42
-        if (is_null($name)) {
42
+        if(is_null($name)) {
43 43
             $name = sprintf('%sSecurityID', get_class($this));
44 44
         }
45 45
         return new \SecurityToken($name);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     protected function checkSecurityToken($name = null)
49 49
     {
50 50
         $postVar = is_null($name) ? 'SecurityID' : $name;
51
-        if (is_null($name)) {
51
+        if(is_null($name)) {
52 52
             $name = sprintf('%sSecurityID', get_class($this));
53 53
         }
54 54
         $securityToken = $this->getSecurityToken($name);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         // By default the security token is always represented by a "SecurityID" post var,
57 57
         // even if the backend uses different names for the token. This too means only one security token
58 58
         // can be managed by one dispatcher if the default is used.
59
-        if (!$securityToken->check($this->request->postVar($postVar))) {
59
+        if(!$securityToken->check($this->request->postVar($postVar))) {
60 60
             $this->httpError(400, 'Invalid security token, try reloading the page.');
61 61
         }
62 62
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function asJSONValidatorErrors($code, $validatorErrors)
73 73
     {
74 74
         $fieldErrors = [];
75
-        foreach ($validatorErrors as $error) {
75
+        foreach($validatorErrors as $error) {
76 76
             $fieldErrors[$error['fieldName']] = $error['message'];
77 77
         }
78 78
         return $this->asJSONFormFieldErrors($code, $fieldErrors);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         // To get around that, upon spotting an active redirect, we change the response code to 200,
117 117
         // and move the redirect into the "RedirectTo" field in the JSON response. Frontend can
118 118
         // then interpret this and trigger a redirect.
119
-        if ($this->redirectedTo()) {
119
+        if($this->redirectedTo()) {
120 120
             $data['RedirectTo'] = $this->response->getHeader('Location');
121 121
             // Pop off the header - we are no longer redirecting via the usual mechanism.
122 122
             $this->response->removeHeader('Location');
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function trimWhitespace($val)
146 146
     {
147
-        if (is_array($val)) {
148
-            foreach ($val as $k => $v) {
147
+        if(is_array($val)) {
148
+            foreach($val as $k => $v) {
149 149
                 $val[$k] = $this->trimWhitespace($v);
150 150
             }
151 151
             return $val;
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function stripNonPrintables($val)
164 164
     {
165
-        if (is_array($val)) {
166
-            foreach ($val as $k => $v) {
165
+        if(is_array($val)) {
166
+            foreach($val as $k => $v) {
167 167
                 $val[$k] = $this->stripNonPrintables($v);
168 168
             }
169 169
             return $val;
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
  * because the SecurityID will diverge as soon as one of these components submit.
8 8
  */
9 9
 
10
-abstract class Dispatcher extends DNRoot
11
-{
10
+abstract class Dispatcher extends DNRoot {
12 11
 
13 12
     /**
14 13
      * Generate the data structure used by the frontend component.
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
      * @param string $name Used to name the DOM elements and obtain the initial model.
27 26
      * @return string A snippet good for adding to a SS template.
28 27
      */
29
-    public function getReactComponent($name)
30
-    {
28
+    public function getReactComponent($name) {
31 29
         $model = $this->getModel($name);
32 30
         $model['InitialSecurityID'] = $this->getSecurityToken()->getValue();
33 31
 
@@ -37,16 +35,14 @@  discard block
 block discarded – undo
37 35
         ])->renderWith('ReactTemplate');
38 36
     }
39 37
 
40
-    protected function getSecurityToken($name = null)
41
-    {
38
+    protected function getSecurityToken($name = null) {
42 39
         if (is_null($name)) {
43 40
             $name = sprintf('%sSecurityID', get_class($this));
44 41
         }
45 42
         return new \SecurityToken($name);
46 43
     }
47 44
 
48
-    protected function checkSecurityToken($name = null)
49
-    {
45
+    protected function checkSecurityToken($name = null) {
50 46
         $postVar = is_null($name) ? 'SecurityID' : $name;
51 47
         if (is_null($name)) {
52 48
             $name = sprintf('%sSecurityID', get_class($this));
@@ -69,8 +65,7 @@  discard block
 block discarded – undo
69 65
      *	[{"fieldName":"Name","message":"Message.","messageType":"bad"}]
70 66
      * @return \SS_HTTPResponse
71 67
      */
72
-    public function asJSONValidatorErrors($code, $validatorErrors)
73
-    {
68
+    public function asJSONValidatorErrors($code, $validatorErrors) {
74 69
         $fieldErrors = [];
75 70
         foreach ($validatorErrors as $error) {
76 71
             $fieldErrors[$error['fieldName']] = $error['message'];
@@ -85,8 +80,7 @@  discard block
 block discarded – undo
85 80
      * @param array $fieldErrors FieldName => message structure.
86 81
      * @return \SS_HTTPResponse
87 82
      */
88
-    public function asJSONFormFieldErrors($code, $fieldErrors)
89
-    {
83
+    public function asJSONFormFieldErrors($code, $fieldErrors) {
90 84
         $response = $this->getResponse();
91 85
         $response->addHeader('Content-Type', 'application/json');
92 86
         $response->setBody(json_encode([
@@ -102,8 +96,7 @@  discard block
 block discarded – undo
102 96
      *
103 97
      * @param array $data Data to be passed to the frontend.
104 98
      */
105
-    public function asJSON($data = [])
106
-    {
99
+    public function asJSON($data = []) {
107 100
         $securityToken = $this->getSecurityToken();
108 101
         $securityToken->reset();
109 102
         $data['NewSecurityID'] = $securityToken->getValue();
@@ -133,8 +126,7 @@  discard block
 block discarded – undo
133 126
      *
134 127
      * @return array
135 128
      */
136
-    protected function getFormData()
137
-    {
129
+    protected function getFormData() {
138 130
         return $this->stripNonPrintables(json_decode($this->request->postVar('Details'), true));
139 131
     }
140 132
 
@@ -142,8 +134,7 @@  discard block
 block discarded – undo
142 134
      * @param string|array
143 135
      * @return string
144 136
      */
145
-    protected function trimWhitespace($val)
146
-    {
137
+    protected function trimWhitespace($val) {
147 138
         if (is_array($val)) {
148 139
             foreach ($val as $k => $v) {
149 140
                 $val[$k] = $this->trimWhitespace($v);
@@ -160,8 +151,7 @@  discard block
 block discarded – undo
160 151
      * @param string|array
161 152
      * @return string
162 153
      */
163
-    protected function stripNonPrintables($val)
164
-    {
154
+    protected function stripNonPrintables($val) {
165 155
         if (is_array($val)) {
166 156
             foreach ($val as $k => $v) {
167 157
                 $val[$k] = $this->stripNonPrintables($v);
Please login to merge, or discard this patch.
code/control/EmailMessagingService.php 3 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -7,101 +7,101 @@
 block discarded – undo
7 7
 class EmailMessagingService implements ConfirmationMessagingService
8 8
 {
9 9
 
10
-    /**
11
-     * @config
12
-     * @var string
13
-     */
14
-    private static $default_from = '[email protected]';
10
+	/**
11
+	 * @config
12
+	 * @var string
13
+	 */
14
+	private static $default_from = '[email protected]';
15 15
 
16
-    /**
17
-     * @config
18
-     * @var string
19
-     */
20
-    private static $default_subject = 'Deploynaut notification';
16
+	/**
17
+	 * @config
18
+	 * @var string
19
+	 */
20
+	private static $default_subject = 'Deploynaut notification';
21 21
 
22
-    public function sendMessage($source, $message, $recipients, $arguments = array())
23
-    {
24
-        $from = empty($arguments['from'])
25
-            ? Config::inst()->get(get_class($this), 'default_from')
26
-            : $arguments['from'];
27
-        $subject = empty($arguments['subject'])
28
-            ? Config::inst()->get(get_class($this), 'default_subject')
29
-            : $arguments['subject'];
22
+	public function sendMessage($source, $message, $recipients, $arguments = array())
23
+	{
24
+		$from = empty($arguments['from'])
25
+			? Config::inst()->get(get_class($this), 'default_from')
26
+			: $arguments['from'];
27
+		$subject = empty($arguments['subject'])
28
+			? Config::inst()->get(get_class($this), 'default_subject')
29
+			: $arguments['subject'];
30 30
 
31
-        // Split users and send individually
32
-        $this->sendIndividualMessages($source, $message, $recipients, $from, $subject);
33
-    }
31
+		// Split users and send individually
32
+		$this->sendIndividualMessages($source, $message, $recipients, $from, $subject);
33
+	}
34 34
 
35
-    /**
36
-     * Separates recipients into individual users
37
-     *
38
-     * @param PipelineStep $source Source client step
39
-     * @param string $message Plain text message
40
-     * @param mixed $recipients Either a Member object, string, or array of strings or Member objects
41
-     * @param string $from
42
-     * @param string $subject
43
-     * @return boolean True if success
44
-     */
45
-    protected function sendIndividualMessages($source, $message, $recipients, $from, $subject)
46
-    {
47
-        // Split recipients that are comma separated
48
-        if (is_string($recipients) && stripos($recipients, ',')) {
49
-            $recipients = explode(',', $recipients);
50
-            return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject);
51
-        }
35
+	/**
36
+	 * Separates recipients into individual users
37
+	 *
38
+	 * @param PipelineStep $source Source client step
39
+	 * @param string $message Plain text message
40
+	 * @param mixed $recipients Either a Member object, string, or array of strings or Member objects
41
+	 * @param string $from
42
+	 * @param string $subject
43
+	 * @return boolean True if success
44
+	 */
45
+	protected function sendIndividualMessages($source, $message, $recipients, $from, $subject)
46
+	{
47
+		// Split recipients that are comma separated
48
+		if (is_string($recipients) && stripos($recipients, ',')) {
49
+			$recipients = explode(',', $recipients);
50
+			return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject);
51
+		}
52 52
 
53
-        // Iterate through arrays
54
-        if (is_array($recipients) || $recipients instanceof SS_List) {
55
-            foreach ($recipients as $recipient) {
56
-                $this->sendIndividualMessages($source, $message, $recipient, $from, $subject);
57
-            }
58
-            return true;
59
-        }
53
+		// Iterate through arrays
54
+		if (is_array($recipients) || $recipients instanceof SS_List) {
55
+			foreach ($recipients as $recipient) {
56
+				$this->sendIndividualMessages($source, $message, $recipient, $from, $subject);
57
+			}
58
+			return true;
59
+		}
60 60
 
61
-        if ($recipients) {
62
-            $this->sendMessageTo($source, $from, $recipients, $subject, $message);
63
-            return true;
64
-        }
61
+		if ($recipients) {
62
+			$this->sendMessageTo($source, $from, $recipients, $subject, $message);
63
+			return true;
64
+		}
65 65
 
66
-        // Can't send to empty recipient
67
-        return false;
68
-    }
66
+		// Can't send to empty recipient
67
+		return false;
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * Send an message to a single recipient
73
-     *
74
-     * @param PipelineStep $source Client step
75
-     * @param string $from
76
-     * @param string|Member $to
77
-     * @param string $subject
78
-     * @param string $body
79
-     */
80
-    protected function sendMessageTo($source, $from, $to, $subject, $body)
81
-    {
82
-        if ($to instanceof Member) {
83
-            $to = $to->Email;
84
-        }
85
-        $this->sendViaEmail($source, $from, $to, $subject, $body);
86
-    }
71
+	/**
72
+	 * Send an message to a single recipient
73
+	 *
74
+	 * @param PipelineStep $source Client step
75
+	 * @param string $from
76
+	 * @param string|Member $to
77
+	 * @param string $subject
78
+	 * @param string $body
79
+	 */
80
+	protected function sendMessageTo($source, $from, $to, $subject, $body)
81
+	{
82
+		if ($to instanceof Member) {
83
+			$to = $to->Email;
84
+		}
85
+		$this->sendViaEmail($source, $from, $to, $subject, $body);
86
+	}
87 87
 
88
-    /**
89
-     * Send an email to a single recipient
90
-     *
91
-     * @param PipelineStep $source Client step
92
-     * @param string $from
93
-     * @param string $to
94
-     * @param string $subject
95
-     * @param string $body
96
-     */
97
-    protected function sendViaEmail($source, $from, $to, $subject, $body)
98
-    {
99
-        $email = new Email($from, $to, $subject, $body);
100
-        if ($source->getDryRun()) {
101
-            $source->log("[Skipped] Sent message to $to (subject: $subject)");
102
-        } else {
103
-            $email->sendPlain();
104
-            $source->log("Sent message to $to (subject: $subject)");
105
-        }
106
-    }
88
+	/**
89
+	 * Send an email to a single recipient
90
+	 *
91
+	 * @param PipelineStep $source Client step
92
+	 * @param string $from
93
+	 * @param string $to
94
+	 * @param string $subject
95
+	 * @param string $body
96
+	 */
97
+	protected function sendViaEmail($source, $from, $to, $subject, $body)
98
+	{
99
+		$email = new Email($from, $to, $subject, $body);
100
+		if ($source->getDryRun()) {
101
+			$source->log("[Skipped] Sent message to $to (subject: $subject)");
102
+		} else {
103
+			$email->sendPlain();
104
+			$source->log("Sent message to $to (subject: $subject)");
105
+		}
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
     protected function sendIndividualMessages($source, $message, $recipients, $from, $subject)
46 46
     {
47 47
         // Split recipients that are comma separated
48
-        if (is_string($recipients) && stripos($recipients, ',')) {
48
+        if(is_string($recipients) && stripos($recipients, ',')) {
49 49
             $recipients = explode(',', $recipients);
50 50
             return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject);
51 51
         }
52 52
 
53 53
         // Iterate through arrays
54
-        if (is_array($recipients) || $recipients instanceof SS_List) {
55
-            foreach ($recipients as $recipient) {
54
+        if(is_array($recipients) || $recipients instanceof SS_List) {
55
+            foreach($recipients as $recipient) {
56 56
                 $this->sendIndividualMessages($source, $message, $recipient, $from, $subject);
57 57
             }
58 58
             return true;
59 59
         }
60 60
 
61
-        if ($recipients) {
61
+        if($recipients) {
62 62
             $this->sendMessageTo($source, $from, $recipients, $subject, $message);
63 63
             return true;
64 64
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     protected function sendMessageTo($source, $from, $to, $subject, $body)
81 81
     {
82
-        if ($to instanceof Member) {
82
+        if($to instanceof Member) {
83 83
             $to = $to->Email;
84 84
         }
85 85
         $this->sendViaEmail($source, $from, $to, $subject, $body);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     protected function sendViaEmail($source, $from, $to, $subject, $body)
98 98
     {
99 99
         $email = new Email($from, $to, $subject, $body);
100
-        if ($source->getDryRun()) {
100
+        if($source->getDryRun()) {
101 101
             $source->log("[Skipped] Sent message to $to (subject: $subject)");
102 102
         } else {
103 103
             $email->sendPlain();
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
  * @package deploynaut
5 5
  * @subpackage control
6 6
  */
7
-class EmailMessagingService implements ConfirmationMessagingService
8
-{
7
+class EmailMessagingService implements ConfirmationMessagingService {
9 8
 
10 9
     /**
11 10
      * @config
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
      */
20 19
     private static $default_subject = 'Deploynaut notification';
21 20
 
22
-    public function sendMessage($source, $message, $recipients, $arguments = array())
23
-    {
21
+    public function sendMessage($source, $message, $recipients, $arguments = array()) {
24 22
         $from = empty($arguments['from'])
25 23
             ? Config::inst()->get(get_class($this), 'default_from')
26 24
             : $arguments['from'];
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
      * @param string $subject
43 41
      * @return boolean True if success
44 42
      */
45
-    protected function sendIndividualMessages($source, $message, $recipients, $from, $subject)
46
-    {
43
+    protected function sendIndividualMessages($source, $message, $recipients, $from, $subject) {
47 44
         // Split recipients that are comma separated
48 45
         if (is_string($recipients) && stripos($recipients, ',')) {
49 46
             $recipients = explode(',', $recipients);
@@ -77,8 +74,7 @@  discard block
 block discarded – undo
77 74
      * @param string $subject
78 75
      * @param string $body
79 76
      */
80
-    protected function sendMessageTo($source, $from, $to, $subject, $body)
81
-    {
77
+    protected function sendMessageTo($source, $from, $to, $subject, $body) {
82 78
         if ($to instanceof Member) {
83 79
             $to = $to->Email;
84 80
         }
@@ -94,8 +90,7 @@  discard block
 block discarded – undo
94 90
      * @param string $subject
95 91
      * @param string $body
96 92
      */
97
-    protected function sendViaEmail($source, $from, $to, $subject, $body)
98
-    {
93
+    protected function sendViaEmail($source, $from, $to, $subject, $body) {
99 94
         $email = new Email($from, $to, $subject, $body);
100 95
         if ($source->getDryRun()) {
101 96
             $source->log("[Skipped] Sent message to $to (subject: $subject)");
Please login to merge, or discard this patch.
code/control/PipelineController.php 3 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -3,85 +3,85 @@
 block discarded – undo
3 3
 class PipelineController extends Controller
4 4
 {
5 5
 
6
-    private static $allowed_actions = array(
7
-        'abort',
8
-        'log',
9
-        'step'
10
-    );
6
+	private static $allowed_actions = array(
7
+		'abort',
8
+		'log',
9
+		'step'
10
+	);
11 11
 
12
-    protected $controller = null;
12
+	protected $controller = null;
13 13
 
14
-    protected $pipeline = null;
14
+	protected $pipeline = null;
15 15
 
16
-    public function __construct($controller, Pipeline $pipeline)
17
-    {
18
-        $this->controller = $controller;
19
-        parent::__construct();
20
-        $this->pipeline = $pipeline;
21
-    }
16
+	public function __construct($controller, Pipeline $pipeline)
17
+	{
18
+		$this->controller = $controller;
19
+		parent::__construct();
20
+		$this->pipeline = $pipeline;
21
+	}
22 22
 
23
-    /**
24
-     * Shows status of this pipeline
25
-     */
26
-    public function index()
27
-    {
28
-        return $this->controller->customise(new ArrayData(array(
29
-            'Pipeline' => $this->pipeline
30
-        )))->renderWith('DNRoot_pipeline');
31
-    }
23
+	/**
24
+	 * Shows status of this pipeline
25
+	 */
26
+	public function index()
27
+	{
28
+		return $this->controller->customise(new ArrayData(array(
29
+			'Pipeline' => $this->pipeline
30
+		)))->renderWith('DNRoot_pipeline');
31
+	}
32 32
 
33
-    /**
34
-     * Get log for this pipeline
35
-     */
36
-    public function log()
37
-    {
38
-        $log = $this->pipeline->getLogger();
39
-        if ($log->exists()) {
40
-            $content = $log->content();
41
-        } else {
42
-            $content = 'Waiting for action to start';
43
-        }
33
+	/**
34
+	 * Get log for this pipeline
35
+	 */
36
+	public function log()
37
+	{
38
+		$log = $this->pipeline->getLogger();
39
+		if ($log->exists()) {
40
+			$content = $log->content();
41
+		} else {
42
+			$content = 'Waiting for action to start';
43
+		}
44 44
 
45
-        $sendJSON = (strpos($this->request->getHeader('Accept'), 'application/json') !== false)
46
-            || $this->request->getExtension() == 'json';
45
+		$sendJSON = (strpos($this->request->getHeader('Accept'), 'application/json') !== false)
46
+			|| $this->request->getExtension() == 'json';
47 47
 
48
-        $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content);
49
-        if ($sendJSON) {
50
-            $this->response->addHeader("Content-type", "application/json");
51
-            return json_encode(array(
52
-                'status' => $this->pipeline->Status,
53
-                'content' => $content,
54
-            ));
55
-        } else {
56
-            $this->response->addHeader("Content-type", "text/plain");
57
-            return $content;
58
-        }
59
-    }
48
+		$content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content);
49
+		if ($sendJSON) {
50
+			$this->response->addHeader("Content-type", "application/json");
51
+			return json_encode(array(
52
+				'status' => $this->pipeline->Status,
53
+				'content' => $content,
54
+			));
55
+		} else {
56
+			$this->response->addHeader("Content-type", "text/plain");
57
+			return $content;
58
+		}
59
+	}
60 60
 
61
-    /**
62
-     * Aborts the current pipeline
63
-     */
64
-    public function abort()
65
-    {
66
-        if ($this->pipeline->canAbort()) {
67
-            $this->pipeline->markAborted();
68
-        }
69
-        return $this->redirect($this->pipeline->Environment()->Link());
70
-    }
61
+	/**
62
+	 * Aborts the current pipeline
63
+	 */
64
+	public function abort()
65
+	{
66
+		if ($this->pipeline->canAbort()) {
67
+			$this->pipeline->markAborted();
68
+		}
69
+		return $this->redirect($this->pipeline->Environment()->Link());
70
+	}
71 71
 
72
-    /**
73
-     * Perform an action on the current pipeline step
74
-     */
75
-    public function step()
76
-    {
77
-        $action = $this->request->param('ID');
78
-        $step = $this->pipeline->CurrentStep();
72
+	/**
73
+	 * Perform an action on the current pipeline step
74
+	 */
75
+	public function step()
76
+	{
77
+		$action = $this->request->param('ID');
78
+		$step = $this->pipeline->CurrentStep();
79 79
 
80
-        // Check if the action is available on this step
81
-        if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) {
82
-            // Execute this action, allowing it to override the httpresponse given
83
-            $step->$action();
84
-        }
85
-        return $this->redirect($this->pipeline->Environment()->Link());
86
-    }
80
+		// Check if the action is available on this step
81
+		if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) {
82
+			// Execute this action, allowing it to override the httpresponse given
83
+			$step->$action();
84
+		}
85
+		return $this->redirect($this->pipeline->Environment()->Link());
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function log()
37 37
     {
38 38
         $log = $this->pipeline->getLogger();
39
-        if ($log->exists()) {
39
+        if($log->exists()) {
40 40
             $content = $log->content();
41 41
         } else {
42 42
             $content = 'Waiting for action to start';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             || $this->request->getExtension() == 'json';
47 47
 
48 48
         $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content);
49
-        if ($sendJSON) {
49
+        if($sendJSON) {
50 50
             $this->response->addHeader("Content-type", "application/json");
51 51
             return json_encode(array(
52 52
                 'status' => $this->pipeline->Status,
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function abort()
65 65
     {
66
-        if ($this->pipeline->canAbort()) {
66
+        if($this->pipeline->canAbort()) {
67 67
             $this->pipeline->markAborted();
68 68
         }
69 69
         return $this->redirect($this->pipeline->Environment()->Link());
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $step = $this->pipeline->CurrentStep();
79 79
 
80 80
         // Check if the action is available on this step
81
-        if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) {
81
+        if($step && ($actions = $step->allowedActions()) && isset($actions[$action])) {
82 82
             // Execute this action, allowing it to override the httpresponse given
83 83
             $step->$action();
84 84
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class PipelineController extends Controller
4
-{
3
+class PipelineController extends Controller {
5 4
 
6 5
     private static $allowed_actions = array(
7 6
         'abort',
@@ -13,8 +12,7 @@  discard block
 block discarded – undo
13 12
 
14 13
     protected $pipeline = null;
15 14
 
16
-    public function __construct($controller, Pipeline $pipeline)
17
-    {
15
+    public function __construct($controller, Pipeline $pipeline) {
18 16
         $this->controller = $controller;
19 17
         parent::__construct();
20 18
         $this->pipeline = $pipeline;
@@ -23,8 +21,7 @@  discard block
 block discarded – undo
23 21
     /**
24 22
      * Shows status of this pipeline
25 23
      */
26
-    public function index()
27
-    {
24
+    public function index() {
28 25
         return $this->controller->customise(new ArrayData(array(
29 26
             'Pipeline' => $this->pipeline
30 27
         )))->renderWith('DNRoot_pipeline');
@@ -33,8 +30,7 @@  discard block
 block discarded – undo
33 30
     /**
34 31
      * Get log for this pipeline
35 32
      */
36
-    public function log()
37
-    {
33
+    public function log() {
38 34
         $log = $this->pipeline->getLogger();
39 35
         if ($log->exists()) {
40 36
             $content = $log->content();
@@ -61,8 +57,7 @@  discard block
 block discarded – undo
61 57
     /**
62 58
      * Aborts the current pipeline
63 59
      */
64
-    public function abort()
65
-    {
60
+    public function abort() {
66 61
         if ($this->pipeline->canAbort()) {
67 62
             $this->pipeline->markAborted();
68 63
         }
@@ -72,8 +67,7 @@  discard block
 block discarded – undo
72 67
     /**
73 68
      * Perform an action on the current pipeline step
74 69
      */
75
-    public function step()
76
-    {
70
+    public function step() {
77 71
         $action = $this->request->param('ID');
78 72
         $step = $this->pipeline->CurrentStep();
79 73
 
Please login to merge, or discard this patch.
code/dbtypes/GitSHA.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -3,29 +3,29 @@
 block discarded – undo
3 3
 class GitSHA extends Varchar
4 4
 {
5 5
 
6
-    /**
7
-     * @param string|null $name
8
-     * @param array $options
9
-     */
10
-    public function __construct($name = null, $options = array())
11
-    {
12
-        // Size should probably be 40, but to avoid schema change leave for now
13
-        parent::__construct($name, 255, $options);
14
-    }
6
+	/**
7
+	 * @param string|null $name
8
+	 * @param array $options
9
+	 */
10
+	public function __construct($name = null, $options = array())
11
+	{
12
+		// Size should probably be 40, but to avoid schema change leave for now
13
+		parent::__construct($name, 255, $options);
14
+	}
15 15
 
16
-    /**
17
-     * @return string
18
-     */
19
-    public function FullHash()
20
-    {
21
-        return $this->value;
22
-    }
16
+	/**
17
+	 * @return string
18
+	 */
19
+	public function FullHash()
20
+	{
21
+		return $this->value;
22
+	}
23 23
 
24
-    /**
25
-     * @return string
26
-     */
27
-    public function ShortHash()
28
-    {
29
-        return substr($this->value, 0, 7);
30
-    }
24
+	/**
25
+	 * @return string
26
+	 */
27
+	public function ShortHash()
28
+	{
29
+		return substr($this->value, 0, 7);
30
+	}
31 31
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,14 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class GitSHA extends Varchar
4
-{
3
+class GitSHA extends Varchar {
5 4
 
6 5
     /**
7 6
      * @param string|null $name
8 7
      * @param array $options
9 8
      */
10
-    public function __construct($name = null, $options = array())
11
-    {
9
+    public function __construct($name = null, $options = array()) {
12 10
         // Size should probably be 40, but to avoid schema change leave for now
13 11
         parent::__construct($name, 255, $options);
14 12
     }
@@ -16,16 +14,14 @@  discard block
 block discarded – undo
16 14
     /**
17 15
      * @return string
18 16
      */
19
-    public function FullHash()
20
-    {
17
+    public function FullHash() {
21 18
         return $this->value;
22 19
     }
23 20
 
24 21
     /**
25 22
      * @return string
26 23
      */
27
-    public function ShortHash()
28
-    {
24
+    public function ShortHash() {
29 25
         return substr($this->value, 0, 7);
30 26
     }
31 27
 }
Please login to merge, or discard this patch.
code/events/DeploynautEventInterface.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -3,29 +3,29 @@
 block discarded – undo
3 3
 interface DeploynautEventInterface extends \League\Event\EventInterface
4 4
 {
5 5
 
6
-    /**
7
-     * Should return the event name, e.g 'event.name'
8
-     *
9
-     * @return string
10
-     */
11
-    public function getName();
6
+	/**
7
+	 * Should return the event name, e.g 'event.name'
8
+	 *
9
+	 * @return string
10
+	 */
11
+	public function getName();
12 12
 
13
-    /**
14
-     * Get the value for the $keyname or empty string
15
-     *
16
-     * @param string $keyname
17
-     *
18
-     * @return string
19
-     */
20
-    public function get($keyname);
13
+	/**
14
+	 * Get the value for the $keyname or empty string
15
+	 *
16
+	 * @param string $keyname
17
+	 *
18
+	 * @return string
19
+	 */
20
+	public function get($keyname);
21 21
 
22
-    /**
23
-     * @return array
24
-     */
25
-    public function asArray();
22
+	/**
23
+	 * @return array
24
+	 */
25
+	public function asArray();
26 26
 
27
-    /**
28
-     * @return string - returns the data as json
29
-     */
30
-    public function asJSON();
27
+	/**
28
+	 * @return string - returns the data as json
29
+	 */
30
+	public function asJSON();
31 31
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-interface DeploynautEventInterface extends \League\Event\EventInterface
4
-{
3
+interface DeploynautEventInterface extends \League\Event\EventInterface {
5 4
 
6 5
     /**
7 6
      * Should return the event name, e.g 'event.name'
Please login to merge, or discard this patch.
code/events/GenericEvent.php 3 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -23,83 +23,83 @@
 block discarded – undo
23 23
 class GenericEvent extends AbstractEvent implements DeploynautEventInterface
24 24
 {
25 25
 
26
-    /**
27
-     * @var string
28
-     */
29
-    protected $name = '';
26
+	/**
27
+	 * @var string
28
+	 */
29
+	protected $name = '';
30 30
 
31
-    /**
32
-     * @var array
33
-     */
34
-    protected $data = [];
31
+	/**
32
+	 * @var array
33
+	 */
34
+	protected $data = [];
35 35
 
36
-    /**
37
-     * @param string $name - event name
38
-     * @param array $data
39
-     *
40
-     * @return GenericEvent
41
-     */
42
-    public static function create($name, array $data)
43
-    {
44
-        return Injector::inst()->createWithArgs(get_called_class(), [$name, $data]);
45
-    }
36
+	/**
37
+	 * @param string $name - event name
38
+	 * @param array $data
39
+	 *
40
+	 * @return GenericEvent
41
+	 */
42
+	public static function create($name, array $data)
43
+	{
44
+		return Injector::inst()->createWithArgs(get_called_class(), [$name, $data]);
45
+	}
46 46
 
47
-    /**
48
-     * Event constructor
49
-     *
50
-     * @param string $eventName - e.g. 'event.name'
51
-     * @param array $data
52
-     */
53
-    public function __construct($eventName, array $data)
54
-    {
55
-        $this->name = $eventName;
56
-        $this->data = $data;
57
-    }
47
+	/**
48
+	 * Event constructor
49
+	 *
50
+	 * @param string $eventName - e.g. 'event.name'
51
+	 * @param array $data
52
+	 */
53
+	public function __construct($eventName, array $data)
54
+	{
55
+		$this->name = $eventName;
56
+		$this->data = $data;
57
+	}
58 58
 
59
-    /**
60
-     * get the event name, e.g 'event.name'
61
-     *
62
-     * @return string
63
-     */
64
-    public function getName()
65
-    {
66
-        return $this->name;
67
-    }
59
+	/**
60
+	 * get the event name, e.g 'event.name'
61
+	 *
62
+	 * @return string
63
+	 */
64
+	public function getName()
65
+	{
66
+		return $this->name;
67
+	}
68 68
 
69
-    /**
70
-     * Get the value for the $keyname or empty string
71
-     *
72
-     * @param string $keyname
73
-     *
74
-     * @return string
75
-     */
76
-    public function get($keyname)
77
-    {
78
-        if (array_key_exists($keyname, $this->data)) {
79
-            return $this->data[$keyname];
80
-        }
81
-        return '';
82
-    }
69
+	/**
70
+	 * Get the value for the $keyname or empty string
71
+	 *
72
+	 * @param string $keyname
73
+	 *
74
+	 * @return string
75
+	 */
76
+	public function get($keyname)
77
+	{
78
+		if (array_key_exists($keyname, $this->data)) {
79
+			return $this->data[$keyname];
80
+		}
81
+		return '';
82
+	}
83 83
 
84
-    /**
85
-     * return all the data as an array, including the event name as 'event';
86
-     *
87
-     * @return array
88
-     */
89
-    public function asArray()
90
-    {
91
-        $payload = $this->data;
92
-        $payload['event'] = $this->getName();
93
-        return $payload;
94
-    }
84
+	/**
85
+	 * return all the data as an array, including the event name as 'event';
86
+	 *
87
+	 * @return array
88
+	 */
89
+	public function asArray()
90
+	{
91
+		$payload = $this->data;
92
+		$payload['event'] = $this->getName();
93
+		return $payload;
94
+	}
95 95
 
96
-    /**
97
-     * return all the data as a JSON string, including the event name as 'event';
98
-     *
99
-     * @return string - returns the data as json
100
-     */
101
-    public function asJSON()
102
-    {
103
-        return json_encode($this->asArray());
104
-    }
96
+	/**
97
+	 * return all the data as a JSON string, including the event name as 'event';
98
+	 *
99
+	 * @return string - returns the data as json
100
+	 */
101
+	public function asJSON()
102
+	{
103
+		return json_encode($this->asArray());
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
      */
76 76
     public function get($keyname)
77 77
     {
78
-        if (array_key_exists($keyname, $this->data)) {
78
+        if(array_key_exists($keyname, $this->data)) {
79 79
             return $this->data[$keyname];
80 80
         }
81 81
         return '';
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * See more on how to use the event system here: http://event.thephpleague.com/2.0/
22 22
  */
23
-class GenericEvent extends AbstractEvent implements DeploynautEventInterface
24
-{
23
+class GenericEvent extends AbstractEvent implements DeploynautEventInterface {
25 24
 
26 25
     /**
27 26
      * @var string
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
      *
40 39
      * @return GenericEvent
41 40
      */
42
-    public static function create($name, array $data)
43
-    {
41
+    public static function create($name, array $data) {
44 42
         return Injector::inst()->createWithArgs(get_called_class(), [$name, $data]);
45 43
     }
46 44
 
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
      * @param string $eventName - e.g. 'event.name'
51 49
      * @param array $data
52 50
      */
53
-    public function __construct($eventName, array $data)
54
-    {
51
+    public function __construct($eventName, array $data) {
55 52
         $this->name = $eventName;
56 53
         $this->data = $data;
57 54
     }
@@ -61,8 +58,7 @@  discard block
 block discarded – undo
61 58
      *
62 59
      * @return string
63 60
      */
64
-    public function getName()
65
-    {
61
+    public function getName() {
66 62
         return $this->name;
67 63
     }
68 64
 
@@ -73,8 +69,7 @@  discard block
 block discarded – undo
73 69
      *
74 70
      * @return string
75 71
      */
76
-    public function get($keyname)
77
-    {
72
+    public function get($keyname) {
78 73
         if (array_key_exists($keyname, $this->data)) {
79 74
             return $this->data[$keyname];
80 75
         }
@@ -86,8 +81,7 @@  discard block
 block discarded – undo
86 81
      *
87 82
      * @return array
88 83
      */
89
-    public function asArray()
90
-    {
84
+    public function asArray() {
91 85
         $payload = $this->data;
92 86
         $payload['event'] = $this->getName();
93 87
         return $payload;
@@ -98,8 +92,7 @@  discard block
 block discarded – undo
98 92
      *
99 93
      * @return string - returns the data as json
100 94
      */
101
-    public function asJSON()
102
-    {
95
+    public function asJSON() {
103 96
         return json_encode($this->asArray());
104 97
     }
105 98
 }
Please login to merge, or discard this patch.
code/extensions/DeploynautFileExtension.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 class DeploynautFileExtension extends DataExtension
3 3
 {
4
-    /**
5
-     * If this file is attached to a {@link DNDataArchive}, then we need to check security permissions, to ensure the
6
-     * currently logged in {@link Member} can download the file.
7
-     *
8
-     * This uses the secureassets module to provide the security of these assets.
9
-     */
10
-    public function canDownload()
11
-    {
12
-        $member = Member::currentUser();
13
-        $file = $this->owner;
14
-        $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First();
4
+	/**
5
+	 * If this file is attached to a {@link DNDataArchive}, then we need to check security permissions, to ensure the
6
+	 * currently logged in {@link Member} can download the file.
7
+	 *
8
+	 * This uses the secureassets module to provide the security of these assets.
9
+	 */
10
+	public function canDownload()
11
+	{
12
+		$member = Member::currentUser();
13
+		$file = $this->owner;
14
+		$archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First();
15 15
 
16
-        if ($archive) {
17
-            return $archive->canDownload($member);
18
-        }
16
+		if ($archive) {
17
+			return $archive->canDownload($member);
18
+		}
19 19
 
20
-        return true; // By default, files can be downloaded from assets/ normally
21
-    }
20
+		return true; // By default, files can be downloaded from assets/ normally
21
+	}
22 22
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
         $file = $this->owner;
14 14
         $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First();
15 15
 
16
-        if ($archive) {
16
+        if($archive) {
17 17
             return $archive->canDownload($member);
18 18
         }
19 19
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,14 +1,12 @@
 block discarded – undo
1 1
 <?php
2
-class DeploynautFileExtension extends DataExtension
3
-{
2
+class DeploynautFileExtension extends DataExtension {
4 3
     /**
5 4
      * If this file is attached to a {@link DNDataArchive}, then we need to check security permissions, to ensure the
6 5
      * currently logged in {@link Member} can download the file.
7 6
      *
8 7
      * This uses the secureassets module to provide the security of these assets.
9 8
      */
10
-    public function canDownload()
11
-    {
9
+    public function canDownload() {
12 10
         $member = Member::currentUser();
13 11
         $file = $this->owner;
14 12
         $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First();
Please login to merge, or discard this patch.
code/extensions/DeploynautSecurityExtension.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 class DeploynautSecurityExtension extends Extension
4 4
 {
5 5
 
6
-    public function onAfterInit()
7
-    {
8
-        // the 'ping' action is called via AJAX from the /admin and will cause
9
-        // the admin section to 'grow' over time. We only need the css and js
10
-        // for login, reset, logout and so on.
11
-        if (!$this->owner->getRequest()->isAjax()) {
12
-            DNRoot::include_requirements();
13
-        }
14
-    }
6
+	public function onAfterInit()
7
+	{
8
+		// the 'ping' action is called via AJAX from the /admin and will cause
9
+		// the admin section to 'grow' over time. We only need the css and js
10
+		// for login, reset, logout and so on.
11
+		if (!$this->owner->getRequest()->isAjax()) {
12
+			DNRoot::include_requirements();
13
+		}
14
+	}
15 15
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
         // the 'ping' action is called via AJAX from the /admin and will cause
9 9
         // the admin section to 'grow' over time. We only need the css and js
10 10
         // for login, reset, logout and so on.
11
-        if (!$this->owner->getRequest()->isAjax()) {
11
+        if(!$this->owner->getRequest()->isAjax()) {
12 12
             DNRoot::include_requirements();
13 13
         }
14 14
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class DeploynautSecurityExtension extends Extension
4
-{
3
+class DeploynautSecurityExtension extends Extension {
5 4
 
6
-    public function onAfterInit()
7
-    {
5
+    public function onAfterInit() {
8 6
         // the 'ping' action is called via AJAX from the /admin and will cause
9 7
         // the admin section to 'grow' over time. We only need the css and js
10 8
         // for login, reset, logout and so on.
Please login to merge, or discard this patch.
code/extensions/FrontendLink.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,15 +3,15 @@
 block discarded – undo
3 3
 class FrontendLink extends DataExtension
4 4
 {
5 5
 
6
-    public function updateItemEditForm($form)
7
-    {
8
-        if ($this->owner->record->hasMethod('Link')) {
9
-            $link = sprintf(
10
-                '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview &raquo;</a>',
11
-                $this->owner->record->Link()
12
-            );
13
-            $actions = $form->Actions();
14
-            $actions->push(LiteralField::create('FrontendLink', $link));
15
-        }
16
-    }
6
+	public function updateItemEditForm($form)
7
+	{
8
+		if ($this->owner->record->hasMethod('Link')) {
9
+			$link = sprintf(
10
+				'<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview &raquo;</a>',
11
+				$this->owner->record->Link()
12
+			);
13
+			$actions = $form->Actions();
14
+			$actions->push(LiteralField::create('FrontendLink', $link));
15
+		}
16
+	}
17 17
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
     public function updateItemEditForm($form)
7 7
     {
8
-        if ($this->owner->record->hasMethod('Link')) {
8
+        if($this->owner->record->hasMethod('Link')) {
9 9
             $link = sprintf(
10 10
                 '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview &raquo;</a>',
11 11
                 $this->owner->record->Link()
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FrontendLink extends DataExtension
4
-{
3
+class FrontendLink extends DataExtension {
5 4
 
6
-    public function updateItemEditForm($form)
7
-    {
5
+    public function updateItemEditForm($form) {
8 6
         if ($this->owner->record->hasMethod('Link')) {
9 7
             $link = sprintf(
10 8
                 '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview &raquo;</a>',
Please login to merge, or discard this patch.