Passed
Push — master ( cb2b38...37146c )
by Roeland
12:06 queued 11s
created
lib/private/Group/Backend.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	*/
50 50
 	public function getSupportedActions() {
51 51
 		$actions = 0;
52
-		foreach($this->possibleActions AS $action => $methodName) {
53
-			if(method_exists($this, $methodName)) {
52
+		foreach ($this->possibleActions AS $action => $methodName) {
53
+			if (method_exists($this, $methodName)) {
54 54
 				$actions |= $action;
55 55
 			}
56 56
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	* compared with \OC\Group\Backend::CREATE_GROUP etc.
68 68
 	*/
69 69
 	public function implementsActions($actions) {
70
-		return (bool)($this->getSupportedActions() & $actions);
70
+		return (bool) ($this->getSupportedActions() & $actions);
71 71
 	}
72 72
 
73 73
 	/**
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -28,107 +28,107 @@
 block discarded – undo
28 28
  * Abstract base class for user management
29 29
  */
30 30
 abstract class Backend implements \OCP\GroupInterface {
31
-	/**
32
-	 * error code for functions not provided by the group backend
33
-	 */
34
-	const NOT_IMPLEMENTED = -501;
31
+    /**
32
+     * error code for functions not provided by the group backend
33
+     */
34
+    const NOT_IMPLEMENTED = -501;
35 35
 
36
-	protected $possibleActions = [
37
-		self::CREATE_GROUP => 'createGroup',
38
-		self::DELETE_GROUP => 'deleteGroup',
39
-		self::ADD_TO_GROUP => 'addToGroup',
40
-		self::REMOVE_FROM_GOUP => 'removeFromGroup',
41
-		self::COUNT_USERS => 'countUsersInGroup',
42
-		self::GROUP_DETAILS => 'getGroupDetails',
43
-		self::IS_ADMIN => 'isAdmin',
44
-	];
36
+    protected $possibleActions = [
37
+        self::CREATE_GROUP => 'createGroup',
38
+        self::DELETE_GROUP => 'deleteGroup',
39
+        self::ADD_TO_GROUP => 'addToGroup',
40
+        self::REMOVE_FROM_GOUP => 'removeFromGroup',
41
+        self::COUNT_USERS => 'countUsersInGroup',
42
+        self::GROUP_DETAILS => 'getGroupDetails',
43
+        self::IS_ADMIN => 'isAdmin',
44
+    ];
45 45
 
46
-	/**
47
-	* Get all supported actions
48
-	* @return int bitwise-or'ed actions
49
-	*
50
-	* Returns the supported actions as int to be
51
-	* compared with \OC\Group\Backend::CREATE_GROUP etc.
52
-	*/
53
-	public function getSupportedActions() {
54
-		$actions = 0;
55
-		foreach($this->possibleActions AS $action => $methodName) {
56
-			if(method_exists($this, $methodName)) {
57
-				$actions |= $action;
58
-			}
59
-		}
46
+    /**
47
+     * Get all supported actions
48
+     * @return int bitwise-or'ed actions
49
+     *
50
+     * Returns the supported actions as int to be
51
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
52
+     */
53
+    public function getSupportedActions() {
54
+        $actions = 0;
55
+        foreach($this->possibleActions AS $action => $methodName) {
56
+            if(method_exists($this, $methodName)) {
57
+                $actions |= $action;
58
+            }
59
+        }
60 60
 
61
-		return $actions;
62
-	}
61
+        return $actions;
62
+    }
63 63
 
64
-	/**
65
-	* Check if backend implements actions
66
-	* @param int $actions bitwise-or'ed actions
67
-	* @return bool
68
-	*
69
-	* Returns the supported actions as int to be
70
-	* compared with \OC\Group\Backend::CREATE_GROUP etc.
71
-	*/
72
-	public function implementsActions($actions) {
73
-		return (bool)($this->getSupportedActions() & $actions);
74
-	}
64
+    /**
65
+     * Check if backend implements actions
66
+     * @param int $actions bitwise-or'ed actions
67
+     * @return bool
68
+     *
69
+     * Returns the supported actions as int to be
70
+     * compared with \OC\Group\Backend::CREATE_GROUP etc.
71
+     */
72
+    public function implementsActions($actions) {
73
+        return (bool)($this->getSupportedActions() & $actions);
74
+    }
75 75
 
76
-	/**
77
-	 * is user in group?
78
-	 * @param string $uid uid of the user
79
-	 * @param string $gid gid of the group
80
-	 * @return bool
81
-	 *
82
-	 * Checks whether the user is member of a group or not.
83
-	 */
84
-	public function inGroup($uid, $gid) {
85
-		return in_array($gid, $this->getUserGroups($uid));
86
-	}
76
+    /**
77
+     * is user in group?
78
+     * @param string $uid uid of the user
79
+     * @param string $gid gid of the group
80
+     * @return bool
81
+     *
82
+     * Checks whether the user is member of a group or not.
83
+     */
84
+    public function inGroup($uid, $gid) {
85
+        return in_array($gid, $this->getUserGroups($uid));
86
+    }
87 87
 
88
-	/**
89
-	 * Get all groups a user belongs to
90
-	 * @param string $uid Name of the user
91
-	 * @return array an array of group names
92
-	 *
93
-	 * This function fetches all groups a user belongs to. It does not check
94
-	 * if the user exists at all.
95
-	 */
96
-	public function getUserGroups($uid) {
97
-		return [];
98
-	}
88
+    /**
89
+     * Get all groups a user belongs to
90
+     * @param string $uid Name of the user
91
+     * @return array an array of group names
92
+     *
93
+     * This function fetches all groups a user belongs to. It does not check
94
+     * if the user exists at all.
95
+     */
96
+    public function getUserGroups($uid) {
97
+        return [];
98
+    }
99 99
 
100
-	/**
101
-	 * get a list of all groups
102
-	 * @param string $search
103
-	 * @param int $limit
104
-	 * @param int $offset
105
-	 * @return array an array of group names
106
-	 *
107
-	 * Returns a list with all groups
108
-	 */
100
+    /**
101
+     * get a list of all groups
102
+     * @param string $search
103
+     * @param int $limit
104
+     * @param int $offset
105
+     * @return array an array of group names
106
+     *
107
+     * Returns a list with all groups
108
+     */
109 109
 
110
-	public function getGroups($search = '', $limit = -1, $offset = 0) {
111
-		return [];
112
-	}
110
+    public function getGroups($search = '', $limit = -1, $offset = 0) {
111
+        return [];
112
+    }
113 113
 
114
-	/**
115
-	 * check if a group exists
116
-	 * @param string $gid
117
-	 * @return bool
118
-	 */
119
-	public function groupExists($gid) {
120
-		return in_array($gid, $this->getGroups($gid, 1));
121
-	}
114
+    /**
115
+     * check if a group exists
116
+     * @param string $gid
117
+     * @return bool
118
+     */
119
+    public function groupExists($gid) {
120
+        return in_array($gid, $this->getGroups($gid, 1));
121
+    }
122 122
 
123
-	/**
124
-	 * get a list of all users in a group
125
-	 * @param string $gid
126
-	 * @param string $search
127
-	 * @param int $limit
128
-	 * @param int $offset
129
-	 * @return array an array of user ids
130
-	 */
131
-	public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
132
-		return [];
133
-	}
123
+    /**
124
+     * get a list of all users in a group
125
+     * @param string $gid
126
+     * @param string $search
127
+     * @param int $limit
128
+     * @param int $offset
129
+     * @return array an array of user ids
130
+     */
131
+    public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
132
+        return [];
133
+    }
134 134
 }
Please login to merge, or discard this patch.
ocs/v2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,4 +20,4 @@
 block discarded – undo
20 20
  *
21 21
  */
22 22
 
23
-require_once __DIR__ . '/v1.php';
23
+require_once __DIR__.'/v1.php';
Please login to merge, or discard this patch.
ocs-provider/index.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
 $server = \OC::$server;
27 27
 
28 28
 $controller = new \OC\OCS\Provider(
29
-	'ocs_provider',
30
-	$server->getRequest(),
31
-	$server->getAppManager()
29
+    'ocs_provider',
30
+    $server->getRequest(),
31
+    $server->getAppManager()
32 32
 );
33 33
 echo $controller->buildProviderList()->render();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
  *
20 20
  */
21 21
 
22
-require_once __DIR__ . '/../lib/base.php';
22
+require_once __DIR__.'/../lib/base.php';
23 23
 
24 24
 header('Content-Type: application/json');
25 25
 
Please login to merge, or discard this patch.
core/templates/exception.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-	/** @var array $_ */
3
-	/** @var \OCP\IL10N $l */
2
+    /** @var array $_ */
3
+    /** @var \OCP\IL10N $l */
4 4
 
5 5
 style('core', ['styles', 'header']);
6 6
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	<ul>
15 15
 		<li><?php p($l->t('Remote Address: %s', [$_['remoteAddr']])) ?></li>
16 16
 		<li><?php p($l->t('Request ID: %s', [$_['requestID']])) ?></li>
17
-		<?php if($_['debugMode']): ?>
17
+		<?php if ($_['debugMode']): ?>
18 18
 			<li><?php p($l->t('Type: %s', [$_['errorClass']])) ?></li>
19 19
 			<li><?php p($l->t('Code: %s', [$_['errorCode']])) ?></li>
20 20
 			<li><?php p($l->t('Message: %s', [$_['errorMsg']])) ?></li>
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		<?php endif; ?>
24 24
 	</ul>
25 25
 
26
-	<?php if($_['debugMode']): ?>
26
+	<?php if ($_['debugMode']): ?>
27 27
 		<br />
28 28
 		<h3><?php p($l->t('Trace')) ?></h3>
29 29
 		<pre><?php p($_['trace']) ?></pre>
Please login to merge, or discard this patch.
core/Command/Security/RemoveCertificate.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,28 +34,28 @@
 block discarded – undo
34 34
 
35 35
 class RemoveCertificate extends Base {
36 36
 
37
-	/** @var ICertificateManager */
38
-	protected $certificateManager;
39
-
40
-	public function __construct(ICertificateManager $certificateManager) {
41
-		$this->certificateManager = $certificateManager;
42
-		parent::__construct();
43
-	}
44
-
45
-	protected function configure() {
46
-		$this
47
-			->setName('security:certificates:remove')
48
-			->setDescription('remove trusted certificate')
49
-			->addArgument(
50
-				'name',
51
-				InputArgument::REQUIRED,
52
-				'the file name of the certificate to remove'
53
-			);
54
-	}
55
-
56
-	protected function execute(InputInterface $input, OutputInterface $output) {
57
-		$name = $input->getArgument('name');
58
-
59
-		$this->certificateManager->removeCertificate($name);
60
-	}
37
+    /** @var ICertificateManager */
38
+    protected $certificateManager;
39
+
40
+    public function __construct(ICertificateManager $certificateManager) {
41
+        $this->certificateManager = $certificateManager;
42
+        parent::__construct();
43
+    }
44
+
45
+    protected function configure() {
46
+        $this
47
+            ->setName('security:certificates:remove')
48
+            ->setDescription('remove trusted certificate')
49
+            ->addArgument(
50
+                'name',
51
+                InputArgument::REQUIRED,
52
+                'the file name of the certificate to remove'
53
+            );
54
+    }
55
+
56
+    protected function execute(InputInterface $input, OutputInterface $output) {
57
+        $name = $input->getArgument('name');
58
+
59
+        $this->certificateManager->removeCertificate($name);
60
+    }
61 61
 }
Please login to merge, or discard this patch.
core/Command/Security/ListCertificates.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -34,64 +34,64 @@
 block discarded – undo
34 34
 
35 35
 class ListCertificates extends Base {
36 36
 
37
-	/** @var ICertificateManager */
38
-	protected $certificateManager;
39
-	/** @var IL10N */
40
-	protected $l;
37
+    /** @var ICertificateManager */
38
+    protected $certificateManager;
39
+    /** @var IL10N */
40
+    protected $l;
41 41
 
42
-	public function __construct(ICertificateManager $certificateManager, IL10N $l) {
43
-		$this->certificateManager = $certificateManager;
44
-		$this->l = $l;
45
-		parent::__construct();
46
-	}
42
+    public function __construct(ICertificateManager $certificateManager, IL10N $l) {
43
+        $this->certificateManager = $certificateManager;
44
+        $this->l = $l;
45
+        parent::__construct();
46
+    }
47 47
 
48
-	protected function configure() {
49
-		$this
50
-			->setName('security:certificates')
51
-			->setDescription('list trusted certificates');
52
-		parent::configure();
53
-	}
48
+    protected function configure() {
49
+        $this
50
+            ->setName('security:certificates')
51
+            ->setDescription('list trusted certificates');
52
+        parent::configure();
53
+    }
54 54
 
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$outputType = $input->getOption('output');
57
-		if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
58
-			$certificates = array_map(function (ICertificate $certificate) {
59
-				return [
60
-					'name' => $certificate->getName(),
61
-					'common_name' => $certificate->getCommonName(),
62
-					'organization' => $certificate->getOrganization(),
63
-					'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM),
64
-					'issuer' => $certificate->getIssuerName(),
65
-					'issuer_organization' => $certificate->getIssuerOrganization(),
66
-					'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM)
67
-				];
68
-			}, $this->certificateManager->listCertificates());
69
-			if ($outputType === self::OUTPUT_FORMAT_JSON) {
70
-				$output->writeln(json_encode(array_values($certificates)));
71
-			} else {
72
-				$output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT));
73
-			}
74
-		} else {
75
-			$table = new Table($output);
76
-			$table->setHeaders([
77
-				'File Name',
78
-				'Common Name',
79
-				'Organization',
80
-				'Valid Until',
81
-				'Issued By'
82
-			]);
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $outputType = $input->getOption('output');
57
+        if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
58
+            $certificates = array_map(function (ICertificate $certificate) {
59
+                return [
60
+                    'name' => $certificate->getName(),
61
+                    'common_name' => $certificate->getCommonName(),
62
+                    'organization' => $certificate->getOrganization(),
63
+                    'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM),
64
+                    'issuer' => $certificate->getIssuerName(),
65
+                    'issuer_organization' => $certificate->getIssuerOrganization(),
66
+                    'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM)
67
+                ];
68
+            }, $this->certificateManager->listCertificates());
69
+            if ($outputType === self::OUTPUT_FORMAT_JSON) {
70
+                $output->writeln(json_encode(array_values($certificates)));
71
+            } else {
72
+                $output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT));
73
+            }
74
+        } else {
75
+            $table = new Table($output);
76
+            $table->setHeaders([
77
+                'File Name',
78
+                'Common Name',
79
+                'Organization',
80
+                'Valid Until',
81
+                'Issued By'
82
+            ]);
83 83
 
84
-			$rows = array_map(function (ICertificate $certificate) {
85
-				return [
86
-					$certificate->getName(),
87
-					$certificate->getCommonName(),
88
-					$certificate->getOrganization(),
89
-					$this->l->l('date', $certificate->getExpireDate()),
90
-					$certificate->getIssuerName()
91
-				];
92
-			}, $this->certificateManager->listCertificates());
93
-			$table->setRows($rows);
94
-			$table->render();
95
-		}
96
-	}
84
+            $rows = array_map(function (ICertificate $certificate) {
85
+                return [
86
+                    $certificate->getName(),
87
+                    $certificate->getCommonName(),
88
+                    $certificate->getOrganization(),
89
+                    $this->l->l('date', $certificate->getExpireDate()),
90
+                    $certificate->getIssuerName()
91
+                ];
92
+            }, $this->certificateManager->listCertificates());
93
+            $table->setRows($rows);
94
+            $table->render();
95
+        }
96
+    }
97 97
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	protected function execute(InputInterface $input, OutputInterface $output) {
56 56
 		$outputType = $input->getOption('output');
57 57
 		if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
58
-			$certificates = array_map(function (ICertificate $certificate) {
58
+			$certificates = array_map(function(ICertificate $certificate) {
59 59
 				return [
60 60
 					'name' => $certificate->getName(),
61 61
 					'common_name' => $certificate->getCommonName(),
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				'Issued By'
82 82
 			]);
83 83
 
84
-			$rows = array_map(function (ICertificate $certificate) {
84
+			$rows = array_map(function(ICertificate $certificate) {
85 85
 				return [
86 86
 					$certificate->getName(),
87 87
 					$certificate->getCommonName(),
Please login to merge, or discard this patch.
core/Command/Security/ImportCertificate.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,36 +33,36 @@
 block discarded – undo
33 33
 
34 34
 class ImportCertificate extends Base {
35 35
 
36
-	/** @var ICertificateManager */
37
-	protected $certificateManager;
36
+    /** @var ICertificateManager */
37
+    protected $certificateManager;
38 38
 
39
-	public function __construct(ICertificateManager $certificateManager) {
40
-		$this->certificateManager = $certificateManager;
41
-		parent::__construct();
42
-	}
39
+    public function __construct(ICertificateManager $certificateManager) {
40
+        $this->certificateManager = $certificateManager;
41
+        parent::__construct();
42
+    }
43 43
 
44
-	protected function configure() {
45
-		$this
46
-			->setName('security:certificates:import')
47
-			->setDescription('import trusted certificate')
48
-			->addArgument(
49
-				'path',
50
-				InputArgument::REQUIRED,
51
-				'path to the certificate to import'
52
-			);
53
-	}
44
+    protected function configure() {
45
+        $this
46
+            ->setName('security:certificates:import')
47
+            ->setDescription('import trusted certificate')
48
+            ->addArgument(
49
+                'path',
50
+                InputArgument::REQUIRED,
51
+                'path to the certificate to import'
52
+            );
53
+    }
54 54
 
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$path = $input->getArgument('path');
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $path = $input->getArgument('path');
57 57
 
58
-		if (!file_exists($path)) {
59
-			$output->writeln('<error>certificate not found</error>');
60
-			return;
61
-		}
58
+        if (!file_exists($path)) {
59
+            $output->writeln('<error>certificate not found</error>');
60
+            return;
61
+        }
62 62
 
63
-		$certData = file_get_contents($path);
64
-		$name = basename($path);
63
+        $certData = file_get_contents($path);
64
+        $name = basename($path);
65 65
 
66
-		$this->certificateManager->addCertificate($certData, $name);
67
-	}
66
+        $this->certificateManager->addCertificate($certData, $name);
67
+    }
68 68
 }
Please login to merge, or discard this patch.
core/Command/Integrity/SignCore.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -37,69 +37,69 @@
 block discarded – undo
37 37
  * @package OC\Core\Command\Integrity
38 38
  */
39 39
 class SignCore extends Command {
40
-	/** @var Checker */
41
-	private $checker;
42
-	/** @var FileAccessHelper */
43
-	private $fileAccessHelper;
40
+    /** @var Checker */
41
+    private $checker;
42
+    /** @var FileAccessHelper */
43
+    private $fileAccessHelper;
44 44
 
45
-	/**
46
-	 * @param Checker $checker
47
-	 * @param FileAccessHelper $fileAccessHelper
48
-	 */
49
-	public function __construct(Checker $checker,
50
-								FileAccessHelper $fileAccessHelper) {
51
-		parent::__construct(null);
52
-		$this->checker = $checker;
53
-		$this->fileAccessHelper = $fileAccessHelper;
54
-	}
45
+    /**
46
+     * @param Checker $checker
47
+     * @param FileAccessHelper $fileAccessHelper
48
+     */
49
+    public function __construct(Checker $checker,
50
+                                FileAccessHelper $fileAccessHelper) {
51
+        parent::__construct(null);
52
+        $this->checker = $checker;
53
+        $this->fileAccessHelper = $fileAccessHelper;
54
+    }
55 55
 
56
-	protected function configure() {
57
-		$this
58
-			->setName('integrity:sign-core')
59
-			->setDescription('Sign core using a private key.')
60
-			->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing')
61
-			->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing')
62
-			->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign');
63
-	}
56
+    protected function configure() {
57
+        $this
58
+            ->setName('integrity:sign-core')
59
+            ->setDescription('Sign core using a private key.')
60
+            ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing')
61
+            ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing')
62
+            ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign');
63
+    }
64 64
 
65
-	/**
66
-	 * {@inheritdoc }
67
-	 */
68
-	protected function execute(InputInterface $input, OutputInterface $output) {
69
-		$privateKeyPath = $input->getOption('privateKey');
70
-		$keyBundlePath = $input->getOption('certificate');
71
-		$path = $input->getOption('path');
72
-		if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
73
-			$output->writeln('--privateKey, --certificate and --path are required.');
74
-			return null;
75
-		}
65
+    /**
66
+     * {@inheritdoc }
67
+     */
68
+    protected function execute(InputInterface $input, OutputInterface $output) {
69
+        $privateKeyPath = $input->getOption('privateKey');
70
+        $keyBundlePath = $input->getOption('certificate');
71
+        $path = $input->getOption('path');
72
+        if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
73
+            $output->writeln('--privateKey, --certificate and --path are required.');
74
+            return null;
75
+        }
76 76
 
77
-		$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
78
-		$keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
77
+        $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
78
+        $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
79 79
 
80
-		if($privateKey === false) {
81
-			$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
82
-			return null;
83
-		}
80
+        if($privateKey === false) {
81
+            $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
82
+            return null;
83
+        }
84 84
 
85
-		if($keyBundle === false) {
86
-			$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
87
-			return null;
88
-		}
85
+        if($keyBundle === false) {
86
+            $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
87
+            return null;
88
+        }
89 89
 
90
-		$rsa = new RSA();
91
-		$rsa->loadKey($privateKey);
92
-		$x509 = new X509();
93
-		$x509->loadX509($keyBundle);
94
-		$x509->setPrivateKey($rsa);
90
+        $rsa = new RSA();
91
+        $rsa->loadKey($privateKey);
92
+        $x509 = new X509();
93
+        $x509->loadX509($keyBundle);
94
+        $x509->setPrivateKey($rsa);
95 95
 
96
-		try {
97
-			$this->checker->writeCoreSignature($x509, $rsa, $path);
98
-			$output->writeln('Successfully signed "core"');
99
-		} catch (\Exception $e){
100
-			$output->writeln('Error: ' . $e->getMessage());
101
-			return 1;
102
-		}
103
-		return 0;
104
-	}
96
+        try {
97
+            $this->checker->writeCoreSignature($x509, $rsa, $path);
98
+            $output->writeln('Successfully signed "core"');
99
+        } catch (\Exception $e){
100
+            $output->writeln('Error: ' . $e->getMessage());
101
+            return 1;
102
+        }
103
+        return 0;
104
+    }
105 105
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$privateKeyPath = $input->getOption('privateKey');
70 70
 		$keyBundlePath = $input->getOption('certificate');
71 71
 		$path = $input->getOption('path');
72
-		if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
72
+		if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
73 73
 			$output->writeln('--privateKey, --certificate and --path are required.');
74 74
 			return null;
75 75
 		}
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 		$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
78 78
 		$keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
79 79
 
80
-		if($privateKey === false) {
80
+		if ($privateKey === false) {
81 81
 			$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
82 82
 			return null;
83 83
 		}
84 84
 
85
-		if($keyBundle === false) {
85
+		if ($keyBundle === false) {
86 86
 			$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
87 87
 			return null;
88 88
 		}
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 		try {
97 97
 			$this->checker->writeCoreSignature($x509, $rsa, $path);
98 98
 			$output->writeln('Successfully signed "core"');
99
-		} catch (\Exception $e){
100
-			$output->writeln('Error: ' . $e->getMessage());
99
+		} catch (\Exception $e) {
100
+			$output->writeln('Error: '.$e->getMessage());
101 101
 			return 1;
102 102
 		}
103 103
 		return 0;
Please login to merge, or discard this patch.
core/Command/Integrity/SignApp.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -38,76 +38,76 @@
 block discarded – undo
38 38
  * @package OC\Core\Command\Integrity
39 39
  */
40 40
 class SignApp extends Command {
41
-	/** @var Checker */
42
-	private $checker;
43
-	/** @var FileAccessHelper */
44
-	private $fileAccessHelper;
45
-	/** @var IURLGenerator */
46
-	private $urlGenerator;
41
+    /** @var Checker */
42
+    private $checker;
43
+    /** @var FileAccessHelper */
44
+    private $fileAccessHelper;
45
+    /** @var IURLGenerator */
46
+    private $urlGenerator;
47 47
 
48
-	/**
49
-	 * @param Checker $checker
50
-	 * @param FileAccessHelper $fileAccessHelper
51
-	 * @param IURLGenerator $urlGenerator
52
-	 */
53
-	public function __construct(Checker $checker,
54
-								FileAccessHelper $fileAccessHelper,
55
-								IURLGenerator $urlGenerator) {
56
-		parent::__construct(null);
57
-		$this->checker = $checker;
58
-		$this->fileAccessHelper = $fileAccessHelper;
59
-		$this->urlGenerator = $urlGenerator;
60
-	}
48
+    /**
49
+     * @param Checker $checker
50
+     * @param FileAccessHelper $fileAccessHelper
51
+     * @param IURLGenerator $urlGenerator
52
+     */
53
+    public function __construct(Checker $checker,
54
+                                FileAccessHelper $fileAccessHelper,
55
+                                IURLGenerator $urlGenerator) {
56
+        parent::__construct(null);
57
+        $this->checker = $checker;
58
+        $this->fileAccessHelper = $fileAccessHelper;
59
+        $this->urlGenerator = $urlGenerator;
60
+    }
61 61
 
62
-	protected function configure() {
63
-		$this
64
-			->setName('integrity:sign-app')
65
-			->setDescription('Signs an app using a private key.')
66
-			->addOption('path', null, InputOption::VALUE_REQUIRED, 'Application to sign')
67
-			->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing')
68
-			->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing');
69
-	}
62
+    protected function configure() {
63
+        $this
64
+            ->setName('integrity:sign-app')
65
+            ->setDescription('Signs an app using a private key.')
66
+            ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Application to sign')
67
+            ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing')
68
+            ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing');
69
+    }
70 70
 
71
-	/**
72
-	 * {@inheritdoc }
73
-	 */
74
-	protected function execute(InputInterface $input, OutputInterface $output) {
75
-		$path = $input->getOption('path');
76
-		$privateKeyPath = $input->getOption('privateKey');
77
-		$keyBundlePath = $input->getOption('certificate');
78
-		if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
79
-			$documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity');
80
-			$output->writeln('This command requires the --path, --privateKey and --certificate.');
81
-			$output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"');
82
-			$output->writeln('For more information please consult the documentation: '. $documentationUrl);
83
-			return null;
84
-		}
71
+    /**
72
+     * {@inheritdoc }
73
+     */
74
+    protected function execute(InputInterface $input, OutputInterface $output) {
75
+        $path = $input->getOption('path');
76
+        $privateKeyPath = $input->getOption('privateKey');
77
+        $keyBundlePath = $input->getOption('certificate');
78
+        if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
79
+            $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity');
80
+            $output->writeln('This command requires the --path, --privateKey and --certificate.');
81
+            $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"');
82
+            $output->writeln('For more information please consult the documentation: '. $documentationUrl);
83
+            return null;
84
+        }
85 85
 
86
-		$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
87
-		$keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
86
+        $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
87
+        $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
88 88
 
89
-		if($privateKey === false) {
90
-			$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
91
-			return null;
92
-		}
89
+        if($privateKey === false) {
90
+            $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
91
+            return null;
92
+        }
93 93
 
94
-		if($keyBundle === false) {
95
-			$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
96
-			return null;
97
-		}
94
+        if($keyBundle === false) {
95
+            $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
96
+            return null;
97
+        }
98 98
 
99
-		$rsa = new RSA();
100
-		$rsa->loadKey($privateKey);
101
-		$x509 = new X509();
102
-		$x509->loadX509($keyBundle);
103
-		$x509->setPrivateKey($rsa);
104
-		try {
105
-			$this->checker->writeAppSignature($path, $x509, $rsa);
106
-			$output->writeln('Successfully signed "'.$path.'"');
107
-		} catch (\Exception $e){
108
-			$output->writeln('Error: ' . $e->getMessage());
109
-			return 1;
110
-		}
111
-		return 0;
112
-	}
99
+        $rsa = new RSA();
100
+        $rsa->loadKey($privateKey);
101
+        $x509 = new X509();
102
+        $x509->loadX509($keyBundle);
103
+        $x509->setPrivateKey($rsa);
104
+        try {
105
+            $this->checker->writeAppSignature($path, $x509, $rsa);
106
+            $output->writeln('Successfully signed "'.$path.'"');
107
+        } catch (\Exception $e){
108
+            $output->writeln('Error: ' . $e->getMessage());
109
+            return 1;
110
+        }
111
+        return 0;
112
+    }
113 113
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
 		$path = $input->getOption('path');
76 76
 		$privateKeyPath = $input->getOption('privateKey');
77 77
 		$keyBundlePath = $input->getOption('certificate');
78
-		if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
78
+		if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
79 79
 			$documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity');
80 80
 			$output->writeln('This command requires the --path, --privateKey and --certificate.');
81 81
 			$output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"');
82
-			$output->writeln('For more information please consult the documentation: '. $documentationUrl);
82
+			$output->writeln('For more information please consult the documentation: '.$documentationUrl);
83 83
 			return null;
84 84
 		}
85 85
 
86 86
 		$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
87 87
 		$keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
88 88
 
89
-		if($privateKey === false) {
89
+		if ($privateKey === false) {
90 90
 			$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
91 91
 			return null;
92 92
 		}
93 93
 
94
-		if($keyBundle === false) {
94
+		if ($keyBundle === false) {
95 95
 			$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
96 96
 			return null;
97 97
 		}
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 		try {
105 105
 			$this->checker->writeAppSignature($path, $x509, $rsa);
106 106
 			$output->writeln('Successfully signed "'.$path.'"');
107
-		} catch (\Exception $e){
108
-			$output->writeln('Error: ' . $e->getMessage());
107
+		} catch (\Exception $e) {
108
+			$output->writeln('Error: '.$e->getMessage());
109 109
 			return 1;
110 110
 		}
111 111
 		return 0;
Please login to merge, or discard this patch.