Passed
Push — master ( 07dffb...bd5189 )
by John
11:02 queued 10s
created
core/Command/Encryption/SetDefaultModule.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@
 block discarded – undo
59 59
 		$moduleId = $input->getArgument('module');
60 60
 
61 61
 		if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) {
62
-			$output->writeln('"' . $moduleId . '"" is already the default module');
62
+			$output->writeln('"'.$moduleId.'"" is already the default module');
63 63
 		} else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) {
64
-			$output->writeln('<info>Set default module to "' . $moduleId . '"</info>');
64
+			$output->writeln('<info>Set default module to "'.$moduleId.'"</info>');
65 65
 		} else {
66
-			$output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>');
66
+			$output->writeln('<error>The specified module "'.$moduleId.'" does not exist</error>');
67 67
 		}
68 68
 	}
69 69
 }
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -31,55 +31,55 @@
 block discarded – undo
31 31
 use Symfony\Component\Console\Output\OutputInterface;
32 32
 
33 33
 class SetDefaultModule extends Command {
34
-	/** @var IManager */
35
-	protected $encryptionManager;
34
+    /** @var IManager */
35
+    protected $encryptionManager;
36 36
 
37
-	/** @var IConfig */
38
-	protected $config;
37
+    /** @var IConfig */
38
+    protected $config;
39 39
 
40
-	/**
41
-	 * @param IManager $encryptionManager
42
-	 * @param IConfig $config
43
-	 */
44
-	public function __construct(
45
-		IManager $encryptionManager,
46
-		IConfig $config
47
-	) {
48
-		parent::__construct();
49
-		$this->encryptionManager = $encryptionManager;
50
-		$this->config = $config;
51
-	}
40
+    /**
41
+     * @param IManager $encryptionManager
42
+     * @param IConfig $config
43
+     */
44
+    public function __construct(
45
+        IManager $encryptionManager,
46
+        IConfig $config
47
+    ) {
48
+        parent::__construct();
49
+        $this->encryptionManager = $encryptionManager;
50
+        $this->config = $config;
51
+    }
52 52
 
53
-	protected function configure() {
54
-		parent::configure();
53
+    protected function configure() {
54
+        parent::configure();
55 55
 
56
-		$this
57
-			->setName('encryption:set-default-module')
58
-			->setDescription('Set the encryption default module')
59
-			->addArgument(
60
-				'module',
61
-				InputArgument::REQUIRED,
62
-				'ID of the encryption module that should be used'
63
-			)
64
-		;
65
-	}
56
+        $this
57
+            ->setName('encryption:set-default-module')
58
+            ->setDescription('Set the encryption default module')
59
+            ->addArgument(
60
+                'module',
61
+                InputArgument::REQUIRED,
62
+                'ID of the encryption module that should be used'
63
+            )
64
+        ;
65
+    }
66 66
 
67
-	protected function execute(InputInterface $input, OutputInterface $output) {
68
-		$isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
69
-		if ($isMaintenanceModeEnabled) {
70
-			$output->writeln("Maintenance mode must be disabled when setting default module,");
71
-			$output->writeln("in order to load the relevant encryption modules correctly.");
72
-			return;
73
-		}
67
+    protected function execute(InputInterface $input, OutputInterface $output) {
68
+        $isMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
69
+        if ($isMaintenanceModeEnabled) {
70
+            $output->writeln("Maintenance mode must be disabled when setting default module,");
71
+            $output->writeln("in order to load the relevant encryption modules correctly.");
72
+            return;
73
+        }
74 74
 
75
-		$moduleId = $input->getArgument('module');
75
+        $moduleId = $input->getArgument('module');
76 76
 
77
-		if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) {
78
-			$output->writeln('"' . $moduleId . '"" is already the default module');
79
-		} else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) {
80
-			$output->writeln('<info>Set default module to "' . $moduleId . '"</info>');
81
-		} else {
82
-			$output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>');
83
-		}
84
-	}
77
+        if ($moduleId === $this->encryptionManager->getDefaultEncryptionModuleId()) {
78
+            $output->writeln('"' . $moduleId . '"" is already the default module');
79
+        } else if ($this->encryptionManager->setDefaultEncryptionModule($moduleId)) {
80
+            $output->writeln('<info>Set default module to "' . $moduleId . '"</info>');
81
+        } else {
82
+            $output->writeln('<error>The specified module "' . $moduleId . '" does not exist</error>');
83
+        }
84
+    }
85 85
 }
Please login to merge, or discard this patch.
core/Command/Group/ListCommand.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,58 +34,58 @@
 block discarded – undo
34 34
 use Symfony\Component\Console\Output\OutputInterface;
35 35
 
36 36
 class ListCommand extends Base {
37
-	/** @var IGroupManager */
38
-	protected $groupManager;
37
+    /** @var IGroupManager */
38
+    protected $groupManager;
39 39
 
40
-	/**
41
-	 * @param IGroupManager $groupManager
42
-	 */
43
-	public function __construct(IGroupManager $groupManager) {
44
-		$this->groupManager = $groupManager;
45
-		parent::__construct();
46
-	}
40
+    /**
41
+     * @param IGroupManager $groupManager
42
+     */
43
+    public function __construct(IGroupManager $groupManager) {
44
+        $this->groupManager = $groupManager;
45
+        parent::__construct();
46
+    }
47 47
 
48
-	protected function configure() {
49
-		$this
50
-			->setName('group:list')
51
-			->setDescription('list configured groups')
52
-			->addOption(
53
-				'limit',
54
-				'l',
55
-				InputOption::VALUE_OPTIONAL,
56
-				'Number of groups to retrieve',
57
-				500
58
-			)->addOption(
59
-				'offset',
60
-				'o',
61
-				InputOption::VALUE_OPTIONAL,
62
-				'Offset for retrieving groups',
63
-				0
64
-			)->addOption(
65
-				'output',
66
-				null,
67
-				InputOption::VALUE_OPTIONAL,
68
-				'Output format (plain, json or json_pretty, default is plain)',
69
-				$this->defaultOutputFormat
70
-			);
71
-	}
48
+    protected function configure() {
49
+        $this
50
+            ->setName('group:list')
51
+            ->setDescription('list configured groups')
52
+            ->addOption(
53
+                'limit',
54
+                'l',
55
+                InputOption::VALUE_OPTIONAL,
56
+                'Number of groups to retrieve',
57
+                500
58
+            )->addOption(
59
+                'offset',
60
+                'o',
61
+                InputOption::VALUE_OPTIONAL,
62
+                'Offset for retrieving groups',
63
+                0
64
+            )->addOption(
65
+                'output',
66
+                null,
67
+                InputOption::VALUE_OPTIONAL,
68
+                'Output format (plain, json or json_pretty, default is plain)',
69
+                $this->defaultOutputFormat
70
+            );
71
+    }
72 72
 
73
-	protected function execute(InputInterface $input, OutputInterface $output) {
74
-		$groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset'));
75
-		$this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups));
76
-	}
73
+    protected function execute(InputInterface $input, OutputInterface $output) {
74
+        $groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset'));
75
+        $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups));
76
+    }
77 77
 
78
-	/**
79
-	 * @param IGroup[] $groups
80
-	 * @return array
81
-	 */
82
-	private function formatGroups(array $groups) {
83
-		$keys = array_map(function (IGroup $group) {
84
-			return $group->getGID();
85
-		}, $groups);
86
-		$values = array_map(function (IGroup $group) {
87
-			return array_keys($group->getUsers());
88
-		}, $groups);
89
-		return array_combine($keys, $values);
90
-	}
78
+    /**
79
+     * @param IGroup[] $groups
80
+     * @return array
81
+     */
82
+    private function formatGroups(array $groups) {
83
+        $keys = array_map(function (IGroup $group) {
84
+            return $group->getGID();
85
+        }, $groups);
86
+        $values = array_map(function (IGroup $group) {
87
+            return array_keys($group->getUsers());
88
+        }, $groups);
89
+        return array_combine($keys, $values);
90
+    }
91 91
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	protected function execute(InputInterface $input, OutputInterface $output) {
74
-		$groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset'));
74
+		$groups = $this->groupManager->search('', (int) $input->getOption('limit'), (int) $input->getOption('offset'));
75 75
 		$this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups));
76 76
 	}
77 77
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 * @return array
81 81
 	 */
82 82
 	private function formatGroups(array $groups) {
83
-		$keys = array_map(function (IGroup $group) {
83
+		$keys = array_map(function(IGroup $group) {
84 84
 			return $group->getGID();
85 85
 		}, $groups);
86
-		$values = array_map(function (IGroup $group) {
86
+		$values = array_map(function(IGroup $group) {
87 87
 			return array_keys($group->getUsers());
88 88
 		}, $groups);
89 89
 		return array_combine($keys, $values);
Please login to merge, or discard this patch.
core/Command/Group/RemoveUser.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,47 +33,47 @@
 block discarded – undo
33 33
 use Symfony\Component\Console\Output\OutputInterface;
34 34
 
35 35
 class RemoveUser extends Base {
36
-	/** @var IUserManager */
37
-	protected $userManager;
38
-	/** @var IGroupManager */
39
-	protected $groupManager;
36
+    /** @var IUserManager */
37
+    protected $userManager;
38
+    /** @var IGroupManager */
39
+    protected $groupManager;
40 40
 
41
-	/**
42
-	 * @param IUserManager $userManager
43
-	 * @param IGroupManager $groupManager
44
-	 */
45
-	public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
46
-		$this->userManager = $userManager;
47
-		$this->groupManager = $groupManager;
48
-		parent::__construct();
49
-	}
41
+    /**
42
+     * @param IUserManager $userManager
43
+     * @param IGroupManager $groupManager
44
+     */
45
+    public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
46
+        $this->userManager = $userManager;
47
+        $this->groupManager = $groupManager;
48
+        parent::__construct();
49
+    }
50 50
 
51
-	protected function configure() {
52
-		$this
53
-			->setName('group:removeuser')
54
-			->setDescription('remove a user from a group')
55
-			->addArgument(
56
-				'group',
57
-				InputArgument::REQUIRED,
58
-				'group to remove the user from'
59
-			)->addArgument(
60
-				'user',
61
-				InputArgument::REQUIRED,
62
-				'user to remove from the group'
63
-			);
64
-	}
51
+    protected function configure() {
52
+        $this
53
+            ->setName('group:removeuser')
54
+            ->setDescription('remove a user from a group')
55
+            ->addArgument(
56
+                'group',
57
+                InputArgument::REQUIRED,
58
+                'group to remove the user from'
59
+            )->addArgument(
60
+                'user',
61
+                InputArgument::REQUIRED,
62
+                'user to remove from the group'
63
+            );
64
+    }
65 65
 
66
-	protected function execute(InputInterface $input, OutputInterface $output) {
67
-		$group = $this->groupManager->get($input->getArgument('group'));
68
-		if (is_null($group)) {
69
-			$output->writeln('<error>group not found</error>');
70
-			return 1;
71
-		}
72
-		$user = $this->userManager->get($input->getArgument('user'));
73
-		if (is_null($user)) {
74
-			$output->writeln('<error>user not found</error>');
75
-			return 1;
76
-		}
77
-		$group->removeUser($user);
78
-	}
66
+    protected function execute(InputInterface $input, OutputInterface $output) {
67
+        $group = $this->groupManager->get($input->getArgument('group'));
68
+        if (is_null($group)) {
69
+            $output->writeln('<error>group not found</error>');
70
+            return 1;
71
+        }
72
+        $user = $this->userManager->get($input->getArgument('user'));
73
+        if (is_null($user)) {
74
+            $output->writeln('<error>user not found</error>');
75
+            return 1;
76
+        }
77
+        $group->removeUser($user);
78
+    }
79 79
 }
Please login to merge, or discard this patch.
core/Command/Group/AddUser.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,47 +33,47 @@
 block discarded – undo
33 33
 use Symfony\Component\Console\Output\OutputInterface;
34 34
 
35 35
 class AddUser extends Base {
36
-	/** @var IUserManager */
37
-	protected $userManager;
38
-	/** @var IGroupManager */
39
-	protected $groupManager;
36
+    /** @var IUserManager */
37
+    protected $userManager;
38
+    /** @var IGroupManager */
39
+    protected $groupManager;
40 40
 
41
-	/**
42
-	 * @param IUserManager $userManager
43
-	 * @param IGroupManager $groupManager
44
-	 */
45
-	public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
46
-		$this->userManager = $userManager;
47
-		$this->groupManager = $groupManager;
48
-		parent::__construct();
49
-	}
41
+    /**
42
+     * @param IUserManager $userManager
43
+     * @param IGroupManager $groupManager
44
+     */
45
+    public function __construct(IUserManager $userManager, IGroupManager $groupManager) {
46
+        $this->userManager = $userManager;
47
+        $this->groupManager = $groupManager;
48
+        parent::__construct();
49
+    }
50 50
 
51
-	protected function configure() {
52
-		$this
53
-			->setName('group:adduser')
54
-			->setDescription('add a user to a group')
55
-			->addArgument(
56
-				'group',
57
-				InputArgument::REQUIRED,
58
-				'group to add the user to'
59
-			)->addArgument(
60
-				'user',
61
-				InputArgument::REQUIRED,
62
-				'user to add to the group'
63
-			);
64
-	}
51
+    protected function configure() {
52
+        $this
53
+            ->setName('group:adduser')
54
+            ->setDescription('add a user to a group')
55
+            ->addArgument(
56
+                'group',
57
+                InputArgument::REQUIRED,
58
+                'group to add the user to'
59
+            )->addArgument(
60
+                'user',
61
+                InputArgument::REQUIRED,
62
+                'user to add to the group'
63
+            );
64
+    }
65 65
 
66
-	protected function execute(InputInterface $input, OutputInterface $output) {
67
-		$group = $this->groupManager->get($input->getArgument('group'));
68
-		if (is_null($group)) {
69
-			$output->writeln('<error>group not found</error>');
70
-			return 1;
71
-		}
72
-		$user = $this->userManager->get($input->getArgument('user'));
73
-		if (is_null($user)) {
74
-			$output->writeln('<error>user not found</error>');
75
-			return 1;
76
-		}
77
-		$group->addUser($user);
78
-	}
66
+    protected function execute(InputInterface $input, OutputInterface $output) {
67
+        $group = $this->groupManager->get($input->getArgument('group'));
68
+        if (is_null($group)) {
69
+            $output->writeln('<error>group not found</error>');
70
+            return 1;
71
+        }
72
+        $user = $this->userManager->get($input->getArgument('user'));
73
+        if (is_null($user)) {
74
+            $output->writeln('<error>user not found</error>');
75
+            return 1;
76
+        }
77
+        $group->addUser($user);
78
+    }
79 79
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Db/DoesNotExistException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	 * @param string $msg the error message
38 38
 	 * @since 7.0.0
39 39
 	 */
40
-	public function __construct($msg){
40
+	public function __construct($msg) {
41 41
 		parent::__construct($msg);
42 42
 	}
43 43
 
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@
 block discarded – undo
33 33
  */
34 34
 class DoesNotExistException extends \Exception implements IMapperException {
35 35
 
36
-	/**
37
-	 * Constructor
38
-	 * @param string $msg the error message
39
-	 * @since 7.0.0
40
-	 */
41
-	public function __construct($msg){
42
-		parent::__construct($msg);
43
-	}
36
+    /**
37
+     * Constructor
38
+     * @param string $msg the error message
39
+     * @since 7.0.0
40
+     */
41
+    public function __construct($msg){
42
+        parent::__construct($msg);
43
+    }
44 44
 
45 45
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Command/Delete.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		try {
69 69
 			$mount = $this->globalService->getStorage($mountId);
70 70
 		} catch (NotFoundException $e) {
71
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
71
+			$output->writeln('<error>Mount with id "'.$mountId.' not found, check "occ files_external:list" to get available mounts"</error>');
72 72
 			return 404;
73 73
 		}
74 74
 
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -37,76 +37,76 @@
 block discarded – undo
37 37
 use Symfony\Component\Console\Question\ConfirmationQuestion;
38 38
 
39 39
 class Delete extends Base {
40
-	/**
41
-	 * @var GlobalStoragesService
42
-	 */
43
-	protected $globalService;
40
+    /**
41
+     * @var GlobalStoragesService
42
+     */
43
+    protected $globalService;
44 44
 
45
-	/**
46
-	 * @var UserStoragesService
47
-	 */
48
-	protected $userService;
45
+    /**
46
+     * @var UserStoragesService
47
+     */
48
+    protected $userService;
49 49
 
50
-	/**
51
-	 * @var IUserSession
52
-	 */
53
-	protected $userSession;
50
+    /**
51
+     * @var IUserSession
52
+     */
53
+    protected $userSession;
54 54
 
55
-	/**
56
-	 * @var IUserManager
57
-	 */
58
-	protected $userManager;
55
+    /**
56
+     * @var IUserManager
57
+     */
58
+    protected $userManager;
59 59
 
60
-	function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
61
-		parent::__construct();
62
-		$this->globalService = $globalService;
63
-		$this->userService = $userService;
64
-		$this->userSession = $userSession;
65
-		$this->userManager = $userManager;
66
-	}
60
+    function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
61
+        parent::__construct();
62
+        $this->globalService = $globalService;
63
+        $this->userService = $userService;
64
+        $this->userSession = $userSession;
65
+        $this->userManager = $userManager;
66
+    }
67 67
 
68
-	protected function configure() {
69
-		$this
70
-			->setName('files_external:delete')
71
-			->setDescription('Delete an external mount')
72
-			->addArgument(
73
-				'mount_id',
74
-				InputArgument::REQUIRED,
75
-				'The id of the mount to edit'
76
-			)->addOption(
77
-				'yes',
78
-				'y',
79
-				InputOption::VALUE_NONE,
80
-				'Skip confirmation'
81
-			);
82
-		parent::configure();
83
-	}
68
+    protected function configure() {
69
+        $this
70
+            ->setName('files_external:delete')
71
+            ->setDescription('Delete an external mount')
72
+            ->addArgument(
73
+                'mount_id',
74
+                InputArgument::REQUIRED,
75
+                'The id of the mount to edit'
76
+            )->addOption(
77
+                'yes',
78
+                'y',
79
+                InputOption::VALUE_NONE,
80
+                'Skip confirmation'
81
+            );
82
+        parent::configure();
83
+    }
84 84
 
85
-	protected function execute(InputInterface $input, OutputInterface $output) {
86
-		$mountId = $input->getArgument('mount_id');
87
-		try {
88
-			$mount = $this->globalService->getStorage($mountId);
89
-		} catch (NotFoundException $e) {
90
-			$output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
91
-			return 404;
92
-		}
85
+    protected function execute(InputInterface $input, OutputInterface $output) {
86
+        $mountId = $input->getArgument('mount_id');
87
+        try {
88
+            $mount = $this->globalService->getStorage($mountId);
89
+        } catch (NotFoundException $e) {
90
+            $output->writeln('<error>Mount with id "' . $mountId . ' not found, check "occ files_external:list" to get available mounts"</error>');
91
+            return 404;
92
+        }
93 93
 
94
-		$noConfirm = $input->getOption('yes');
94
+        $noConfirm = $input->getOption('yes');
95 95
 
96
-		if (!$noConfirm) {
97
-			$listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
98
-			$listInput = new ArrayInput([], $listCommand->getDefinition());
99
-			$listInput->setOption('output', $input->getOption('output'));
100
-			$listCommand->listMounts(null, [$mount], $listInput, $output);
96
+        if (!$noConfirm) {
97
+            $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
98
+            $listInput = new ArrayInput([], $listCommand->getDefinition());
99
+            $listInput->setOption('output', $input->getOption('output'));
100
+            $listCommand->listMounts(null, [$mount], $listInput, $output);
101 101
 
102
-			$questionHelper = $this->getHelper('question');
103
-			$question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
102
+            $questionHelper = $this->getHelper('question');
103
+            $question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
104 104
 
105
-			if (!$questionHelper->ask($input, $output, $question)) {
106
-				return null;
107
-			}
108
-		}
105
+            if (!$questionHelper->ask($input, $output, $question)) {
106
+                return null;
107
+            }
108
+        }
109 109
 
110
-		$this->globalService->removeStorage($mountId);
111
-	}
110
+        $this->globalService->removeStorage($mountId);
111
+    }
112 112
 }
Please login to merge, or discard this patch.
apps/files_external/templates/list.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		<tr>
18 18
 			<th id='headerName' class="hidden column-name">
19 19
 				<div id="headerName-container">
20
-					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
20
+					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a>
21 21
 				</div>
22 22
 			</th>
23 23
 			<th id="headerBackend" class="hidden column-backend">
Please login to merge, or discard this patch.
lib/private/DB/MDB2SchemaReader.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					$this->loadTable($schema, $child);
95 95
 					break;
96 96
 				default:
97
-					throw new \DomainException('Unknown element: ' . $child->getName());
97
+					throw new \DomainException('Unknown element: '.$child->getName());
98 98
 
99 99
 			}
100 100
 		}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			 */
115 115
 			switch ($child->getName()) {
116 116
 				case 'name':
117
-					$name = (string)$child;
117
+					$name = (string) $child;
118 118
 					$name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name);
119 119
 					$name = $this->platform->quoteIdentifier($name);
120 120
 					$table = $schema->createTable($name);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 					$this->loadDeclaration($table, $child);
133 133
 					break;
134 134
 				default:
135
-					throw new \DomainException('Unknown element: ' . $child->getName());
135
+					throw new \DomainException('Unknown element: '.$child->getName());
136 136
 
137 137
 			}
138 138
 		}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 					$this->loadIndex($table, $child);
157 157
 					break;
158 158
 				default:
159
-					throw new \DomainException('Unknown element: ' . $child->getName());
159
+					throw new \DomainException('Unknown element: '.$child->getName());
160 160
 
161 161
 			}
162 162
 		}
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
 	 * @throws \DomainException
169 169
 	 */
170 170
 	private function loadField($table, $xml) {
171
-		$options = array( 'notnull' => false );
171
+		$options = array('notnull' => false);
172 172
 		foreach ($xml->children() as $child) {
173 173
 			/**
174 174
 			 * @var \SimpleXMLElement $child
175 175
 			 */
176 176
 			switch ($child->getName()) {
177 177
 				case 'name':
178
-					$name = (string)$child;
178
+					$name = (string) $child;
179 179
 					$name = $this->platform->quoteIdentifier($name);
180 180
 					break;
181 181
 				case 'type':
182
-					$type = (string)$child;
182
+					$type = (string) $child;
183 183
 					switch ($type) {
184 184
 						case 'text':
185 185
 							$type = 'string';
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 					}
197 197
 					break;
198 198
 				case 'length':
199
-					$length = (string)$child;
199
+					$length = (string) $child;
200 200
 					$options['length'] = $length;
201 201
 					break;
202 202
 				case 'unsigned':
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 					$options['autoincrement'] = $autoincrement;
213 213
 					break;
214 214
 				case 'default':
215
-					$default = (string)$child;
215
+					$default = (string) $child;
216 216
 					$options['default'] = $default;
217 217
 					break;
218 218
 				case 'comments':
219
-					$comment = (string)$child;
219
+					$comment = (string) $child;
220 220
 					$options['comment'] = $comment;
221 221
 					break;
222 222
 				case 'primary':
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 					$options['primary'] = $primary;
225 225
 					break;
226 226
 				case 'precision':
227
-					$precision = (string)$child;
227
+					$precision = (string) $child;
228 228
 					$options['precision'] = $precision;
229 229
 					break;
230 230
 				case 'scale':
231
-					$scale = (string)$child;
231
+					$scale = (string) $child;
232 232
 					$options['scale'] = $scale;
233 233
 					break;
234 234
 				default:
235
-					throw new \DomainException('Unknown element: ' . $child->getName());
235
+					throw new \DomainException('Unknown element: '.$child->getName());
236 236
 
237 237
 			}
238 238
 		}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				}
255 255
 			}
256 256
 			if ($type === 'integer' && isset($options['default'])) {
257
-				$options['default'] = (int)$options['default'];
257
+				$options['default'] = (int) $options['default'];
258 258
 			}
259 259
 			if ($type === 'integer' && isset($options['length'])) {
260 260
 				$length = $options['length'];
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			 */
294 294
 			switch ($child->getName()) {
295 295
 				case 'name':
296
-					$name = (string)$child;
296
+					$name = (string) $child;
297 297
 					break;
298 298
 				case 'primary':
299 299
 					$primary = $this->asBool($child);
@@ -308,20 +308,20 @@  discard block
 block discarded – undo
308 308
 						 */
309 309
 						switch ($field->getName()) {
310 310
 							case 'name':
311
-								$field_name = (string)$field;
311
+								$field_name = (string) $field;
312 312
 								$field_name = $this->platform->quoteIdentifier($field_name);
313 313
 								$fields[] = $field_name;
314 314
 								break;
315 315
 							case 'sorting':
316 316
 								break;
317 317
 							default:
318
-								throw new \DomainException('Unknown element: ' . $field->getName());
318
+								throw new \DomainException('Unknown element: '.$field->getName());
319 319
 
320 320
 						}
321 321
 					}
322 322
 					break;
323 323
 				default:
324
-					throw new \DomainException('Unknown element: ' . $child->getName());
324
+					throw new \DomainException('Unknown element: '.$child->getName());
325 325
 
326 326
 			}
327 327
 		}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 				}
340 340
 			}
341 341
 		} else {
342
-			throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true));
342
+			throw new \DomainException('Empty index definition: '.$name.' options:'.print_r($fields, true));
343 343
 		}
344 344
 	}
345 345
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 	 * @return bool
349 349
 	 */
350 350
 	private function asBool($xml) {
351
-		$result = (string)$xml;
351
+		$result = (string) $xml;
352 352
 		if ($result == 'true') {
353 353
 			$result = true;
354 354
 		} elseif ($result == 'false') {
355 355
 			$result = false;
356 356
 		}
357
-		return (bool)$result;
357
+		return (bool) $result;
358 358
 	}
359 359
 
360 360
 }
Please login to merge, or discard this patch.
Indentation   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -39,313 +39,313 @@
 block discarded – undo
39 39
 
40 40
 class MDB2SchemaReader {
41 41
 
42
-	/**
43
-	 * @var string $DBTABLEPREFIX
44
-	 */
45
-	protected $DBTABLEPREFIX;
42
+    /**
43
+     * @var string $DBTABLEPREFIX
44
+     */
45
+    protected $DBTABLEPREFIX;
46 46
 
47
-	/**
48
-	 * @var \Doctrine\DBAL\Platforms\AbstractPlatform $platform
49
-	 */
50
-	protected $platform;
47
+    /**
48
+     * @var \Doctrine\DBAL\Platforms\AbstractPlatform $platform
49
+     */
50
+    protected $platform;
51 51
 
52
-	/** @var IConfig */
53
-	protected $config;
52
+    /** @var IConfig */
53
+    protected $config;
54 54
 
55
-	/**
56
-	 * @param \OCP\IConfig $config
57
-	 * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
58
-	 */
59
-	public function __construct(IConfig $config, AbstractPlatform $platform) {
60
-		$this->platform = $platform;
61
-		$this->config = $config;
62
-		$this->DBTABLEPREFIX = $config->getSystemValue('dbtableprefix', 'oc_');
63
-	}
55
+    /**
56
+     * @param \OCP\IConfig $config
57
+     * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
58
+     */
59
+    public function __construct(IConfig $config, AbstractPlatform $platform) {
60
+        $this->platform = $platform;
61
+        $this->config = $config;
62
+        $this->DBTABLEPREFIX = $config->getSystemValue('dbtableprefix', 'oc_');
63
+    }
64 64
 
65
-	/**
66
-	 * @param string $file
67
-	 * @param Schema $schema
68
-	 * @return Schema
69
-	 * @throws \DomainException
70
-	 */
71
-	public function loadSchemaFromFile($file, Schema $schema) {
72
-		$loadEntities = libxml_disable_entity_loader(false);
73
-		$xml = simplexml_load_file($file);
74
-		libxml_disable_entity_loader($loadEntities);
75
-		foreach ($xml->children() as $child) {
76
-			/**
77
-			 * @var \SimpleXMLElement $child
78
-			 */
79
-			switch ($child->getName()) {
80
-				case 'name':
81
-				case 'create':
82
-				case 'overwrite':
83
-				case 'charset':
84
-					break;
85
-				case 'table':
86
-					$this->loadTable($schema, $child);
87
-					break;
88
-				default:
89
-					throw new \DomainException('Unknown element: ' . $child->getName());
65
+    /**
66
+     * @param string $file
67
+     * @param Schema $schema
68
+     * @return Schema
69
+     * @throws \DomainException
70
+     */
71
+    public function loadSchemaFromFile($file, Schema $schema) {
72
+        $loadEntities = libxml_disable_entity_loader(false);
73
+        $xml = simplexml_load_file($file);
74
+        libxml_disable_entity_loader($loadEntities);
75
+        foreach ($xml->children() as $child) {
76
+            /**
77
+             * @var \SimpleXMLElement $child
78
+             */
79
+            switch ($child->getName()) {
80
+                case 'name':
81
+                case 'create':
82
+                case 'overwrite':
83
+                case 'charset':
84
+                    break;
85
+                case 'table':
86
+                    $this->loadTable($schema, $child);
87
+                    break;
88
+                default:
89
+                    throw new \DomainException('Unknown element: ' . $child->getName());
90 90
 
91
-			}
92
-		}
93
-		return $schema;
94
-	}
91
+            }
92
+        }
93
+        return $schema;
94
+    }
95 95
 
96
-	/**
97
-	 * @param \Doctrine\DBAL\Schema\Schema $schema
98
-	 * @param \SimpleXMLElement $xml
99
-	 * @throws \DomainException
100
-	 */
101
-	private function loadTable($schema, $xml) {
102
-		$table = null;
103
-		foreach ($xml->children() as $child) {
104
-			/**
105
-			 * @var \SimpleXMLElement $child
106
-			 */
107
-			switch ($child->getName()) {
108
-				case 'name':
109
-					$name = (string)$child;
110
-					$name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name);
111
-					$name = $this->platform->quoteIdentifier($name);
112
-					$table = $schema->createTable($name);
113
-					break;
114
-				case 'create':
115
-				case 'overwrite':
116
-				case 'charset':
117
-					break;
118
-				case 'declaration':
119
-					if (is_null($table)) {
120
-						throw new \DomainException('Table declaration before table name');
121
-					}
122
-					$this->loadDeclaration($table, $child);
123
-					break;
124
-				default:
125
-					throw new \DomainException('Unknown element: ' . $child->getName());
96
+    /**
97
+     * @param \Doctrine\DBAL\Schema\Schema $schema
98
+     * @param \SimpleXMLElement $xml
99
+     * @throws \DomainException
100
+     */
101
+    private function loadTable($schema, $xml) {
102
+        $table = null;
103
+        foreach ($xml->children() as $child) {
104
+            /**
105
+             * @var \SimpleXMLElement $child
106
+             */
107
+            switch ($child->getName()) {
108
+                case 'name':
109
+                    $name = (string)$child;
110
+                    $name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name);
111
+                    $name = $this->platform->quoteIdentifier($name);
112
+                    $table = $schema->createTable($name);
113
+                    break;
114
+                case 'create':
115
+                case 'overwrite':
116
+                case 'charset':
117
+                    break;
118
+                case 'declaration':
119
+                    if (is_null($table)) {
120
+                        throw new \DomainException('Table declaration before table name');
121
+                    }
122
+                    $this->loadDeclaration($table, $child);
123
+                    break;
124
+                default:
125
+                    throw new \DomainException('Unknown element: ' . $child->getName());
126 126
 
127
-			}
128
-		}
129
-	}
127
+            }
128
+        }
129
+    }
130 130
 
131
-	/**
132
-	 * @param \Doctrine\DBAL\Schema\Table $table
133
-	 * @param \SimpleXMLElement $xml
134
-	 * @throws \DomainException
135
-	 */
136
-	private function loadDeclaration($table, $xml) {
137
-		foreach ($xml->children() as $child) {
138
-			/**
139
-			 * @var \SimpleXMLElement $child
140
-			 */
141
-			switch ($child->getName()) {
142
-				case 'field':
143
-					$this->loadField($table, $child);
144
-					break;
145
-				case 'index':
146
-					$this->loadIndex($table, $child);
147
-					break;
148
-				default:
149
-					throw new \DomainException('Unknown element: ' . $child->getName());
131
+    /**
132
+     * @param \Doctrine\DBAL\Schema\Table $table
133
+     * @param \SimpleXMLElement $xml
134
+     * @throws \DomainException
135
+     */
136
+    private function loadDeclaration($table, $xml) {
137
+        foreach ($xml->children() as $child) {
138
+            /**
139
+             * @var \SimpleXMLElement $child
140
+             */
141
+            switch ($child->getName()) {
142
+                case 'field':
143
+                    $this->loadField($table, $child);
144
+                    break;
145
+                case 'index':
146
+                    $this->loadIndex($table, $child);
147
+                    break;
148
+                default:
149
+                    throw new \DomainException('Unknown element: ' . $child->getName());
150 150
 
151
-			}
152
-		}
153
-	}
151
+            }
152
+        }
153
+    }
154 154
 
155
-	/**
156
-	 * @param \Doctrine\DBAL\Schema\Table $table
157
-	 * @param \SimpleXMLElement $xml
158
-	 * @throws \DomainException
159
-	 */
160
-	private function loadField($table, $xml) {
161
-		$options = array( 'notnull' => false );
162
-		foreach ($xml->children() as $child) {
163
-			/**
164
-			 * @var \SimpleXMLElement $child
165
-			 */
166
-			switch ($child->getName()) {
167
-				case 'name':
168
-					$name = (string)$child;
169
-					$name = $this->platform->quoteIdentifier($name);
170
-					break;
171
-				case 'type':
172
-					$type = (string)$child;
173
-					switch ($type) {
174
-						case 'text':
175
-							$type = 'string';
176
-							break;
177
-						case 'clob':
178
-							$type = 'text';
179
-							break;
180
-						case 'timestamp':
181
-							$type = 'datetime';
182
-							break;
183
-						case 'numeric':
184
-							$type = 'decimal';
185
-							break;
186
-					}
187
-					break;
188
-				case 'length':
189
-					$length = (string)$child;
190
-					$options['length'] = $length;
191
-					break;
192
-				case 'unsigned':
193
-					$unsigned = $this->asBool($child);
194
-					$options['unsigned'] = $unsigned;
195
-					break;
196
-				case 'notnull':
197
-					$notnull = $this->asBool($child);
198
-					$options['notnull'] = $notnull;
199
-					break;
200
-				case 'autoincrement':
201
-					$autoincrement = $this->asBool($child);
202
-					$options['autoincrement'] = $autoincrement;
203
-					break;
204
-				case 'default':
205
-					$default = (string)$child;
206
-					$options['default'] = $default;
207
-					break;
208
-				case 'comments':
209
-					$comment = (string)$child;
210
-					$options['comment'] = $comment;
211
-					break;
212
-				case 'primary':
213
-					$primary = $this->asBool($child);
214
-					$options['primary'] = $primary;
215
-					break;
216
-				case 'precision':
217
-					$precision = (string)$child;
218
-					$options['precision'] = $precision;
219
-					break;
220
-				case 'scale':
221
-					$scale = (string)$child;
222
-					$options['scale'] = $scale;
223
-					break;
224
-				default:
225
-					throw new \DomainException('Unknown element: ' . $child->getName());
155
+    /**
156
+     * @param \Doctrine\DBAL\Schema\Table $table
157
+     * @param \SimpleXMLElement $xml
158
+     * @throws \DomainException
159
+     */
160
+    private function loadField($table, $xml) {
161
+        $options = array( 'notnull' => false );
162
+        foreach ($xml->children() as $child) {
163
+            /**
164
+             * @var \SimpleXMLElement $child
165
+             */
166
+            switch ($child->getName()) {
167
+                case 'name':
168
+                    $name = (string)$child;
169
+                    $name = $this->platform->quoteIdentifier($name);
170
+                    break;
171
+                case 'type':
172
+                    $type = (string)$child;
173
+                    switch ($type) {
174
+                        case 'text':
175
+                            $type = 'string';
176
+                            break;
177
+                        case 'clob':
178
+                            $type = 'text';
179
+                            break;
180
+                        case 'timestamp':
181
+                            $type = 'datetime';
182
+                            break;
183
+                        case 'numeric':
184
+                            $type = 'decimal';
185
+                            break;
186
+                    }
187
+                    break;
188
+                case 'length':
189
+                    $length = (string)$child;
190
+                    $options['length'] = $length;
191
+                    break;
192
+                case 'unsigned':
193
+                    $unsigned = $this->asBool($child);
194
+                    $options['unsigned'] = $unsigned;
195
+                    break;
196
+                case 'notnull':
197
+                    $notnull = $this->asBool($child);
198
+                    $options['notnull'] = $notnull;
199
+                    break;
200
+                case 'autoincrement':
201
+                    $autoincrement = $this->asBool($child);
202
+                    $options['autoincrement'] = $autoincrement;
203
+                    break;
204
+                case 'default':
205
+                    $default = (string)$child;
206
+                    $options['default'] = $default;
207
+                    break;
208
+                case 'comments':
209
+                    $comment = (string)$child;
210
+                    $options['comment'] = $comment;
211
+                    break;
212
+                case 'primary':
213
+                    $primary = $this->asBool($child);
214
+                    $options['primary'] = $primary;
215
+                    break;
216
+                case 'precision':
217
+                    $precision = (string)$child;
218
+                    $options['precision'] = $precision;
219
+                    break;
220
+                case 'scale':
221
+                    $scale = (string)$child;
222
+                    $options['scale'] = $scale;
223
+                    break;
224
+                default:
225
+                    throw new \DomainException('Unknown element: ' . $child->getName());
226 226
 
227
-			}
228
-		}
229
-		if (isset($name) && isset($type)) {
230
-			if (isset($options['default']) && empty($options['default'])) {
231
-				if (empty($options['notnull']) || !$options['notnull']) {
232
-					unset($options['default']);
233
-					$options['notnull'] = false;
234
-				} else {
235
-					$options['default'] = '';
236
-				}
237
-				if ($type == 'integer' || $type == 'decimal') {
238
-					$options['default'] = 0;
239
-				} elseif ($type == 'boolean') {
240
-					$options['default'] = false;
241
-				}
242
-				if (!empty($options['autoincrement']) && $options['autoincrement']) {
243
-					unset($options['default']);
244
-				}
245
-			}
246
-			if ($type === 'integer' && isset($options['default'])) {
247
-				$options['default'] = (int)$options['default'];
248
-			}
249
-			if ($type === 'integer' && isset($options['length'])) {
250
-				$length = $options['length'];
251
-				if ($length < 4) {
252
-					$type = 'smallint';
253
-				} else if ($length > 4) {
254
-					$type = 'bigint';
255
-				}
256
-			}
257
-			if ($type === 'boolean' && isset($options['default'])) {
258
-				$options['default'] = $this->asBool($options['default']);
259
-			}
260
-			if (!empty($options['autoincrement'])
261
-				&& !empty($options['notnull'])
262
-			) {
263
-				$options['primary'] = true;
264
-			}
227
+            }
228
+        }
229
+        if (isset($name) && isset($type)) {
230
+            if (isset($options['default']) && empty($options['default'])) {
231
+                if (empty($options['notnull']) || !$options['notnull']) {
232
+                    unset($options['default']);
233
+                    $options['notnull'] = false;
234
+                } else {
235
+                    $options['default'] = '';
236
+                }
237
+                if ($type == 'integer' || $type == 'decimal') {
238
+                    $options['default'] = 0;
239
+                } elseif ($type == 'boolean') {
240
+                    $options['default'] = false;
241
+                }
242
+                if (!empty($options['autoincrement']) && $options['autoincrement']) {
243
+                    unset($options['default']);
244
+                }
245
+            }
246
+            if ($type === 'integer' && isset($options['default'])) {
247
+                $options['default'] = (int)$options['default'];
248
+            }
249
+            if ($type === 'integer' && isset($options['length'])) {
250
+                $length = $options['length'];
251
+                if ($length < 4) {
252
+                    $type = 'smallint';
253
+                } else if ($length > 4) {
254
+                    $type = 'bigint';
255
+                }
256
+            }
257
+            if ($type === 'boolean' && isset($options['default'])) {
258
+                $options['default'] = $this->asBool($options['default']);
259
+            }
260
+            if (!empty($options['autoincrement'])
261
+                && !empty($options['notnull'])
262
+            ) {
263
+                $options['primary'] = true;
264
+            }
265 265
 
266
-			$table->addColumn($name, $type, $options);
267
-			if (!empty($options['primary']) && $options['primary']) {
268
-				$table->setPrimaryKey(array($name));
269
-			}
270
-		}
271
-	}
266
+            $table->addColumn($name, $type, $options);
267
+            if (!empty($options['primary']) && $options['primary']) {
268
+                $table->setPrimaryKey(array($name));
269
+            }
270
+        }
271
+    }
272 272
 
273
-	/**
274
-	 * @param \Doctrine\DBAL\Schema\Table $table
275
-	 * @param \SimpleXMLElement $xml
276
-	 * @throws \DomainException
277
-	 */
278
-	private function loadIndex($table, $xml) {
279
-		$name = null;
280
-		$fields = array();
281
-		foreach ($xml->children() as $child) {
282
-			/**
283
-			 * @var \SimpleXMLElement $child
284
-			 */
285
-			switch ($child->getName()) {
286
-				case 'name':
287
-					$name = (string)$child;
288
-					break;
289
-				case 'primary':
290
-					$primary = $this->asBool($child);
291
-					break;
292
-				case 'unique':
293
-					$unique = $this->asBool($child);
294
-					break;
295
-				case 'field':
296
-					foreach ($child->children() as $field) {
297
-						/**
298
-						 * @var \SimpleXMLElement $field
299
-						 */
300
-						switch ($field->getName()) {
301
-							case 'name':
302
-								$field_name = (string)$field;
303
-								$field_name = $this->platform->quoteIdentifier($field_name);
304
-								$fields[] = $field_name;
305
-								break;
306
-							case 'sorting':
307
-								break;
308
-							default:
309
-								throw new \DomainException('Unknown element: ' . $field->getName());
273
+    /**
274
+     * @param \Doctrine\DBAL\Schema\Table $table
275
+     * @param \SimpleXMLElement $xml
276
+     * @throws \DomainException
277
+     */
278
+    private function loadIndex($table, $xml) {
279
+        $name = null;
280
+        $fields = array();
281
+        foreach ($xml->children() as $child) {
282
+            /**
283
+             * @var \SimpleXMLElement $child
284
+             */
285
+            switch ($child->getName()) {
286
+                case 'name':
287
+                    $name = (string)$child;
288
+                    break;
289
+                case 'primary':
290
+                    $primary = $this->asBool($child);
291
+                    break;
292
+                case 'unique':
293
+                    $unique = $this->asBool($child);
294
+                    break;
295
+                case 'field':
296
+                    foreach ($child->children() as $field) {
297
+                        /**
298
+                         * @var \SimpleXMLElement $field
299
+                         */
300
+                        switch ($field->getName()) {
301
+                            case 'name':
302
+                                $field_name = (string)$field;
303
+                                $field_name = $this->platform->quoteIdentifier($field_name);
304
+                                $fields[] = $field_name;
305
+                                break;
306
+                            case 'sorting':
307
+                                break;
308
+                            default:
309
+                                throw new \DomainException('Unknown element: ' . $field->getName());
310 310
 
311
-						}
312
-					}
313
-					break;
314
-				default:
315
-					throw new \DomainException('Unknown element: ' . $child->getName());
311
+                        }
312
+                    }
313
+                    break;
314
+                default:
315
+                    throw new \DomainException('Unknown element: ' . $child->getName());
316 316
 
317
-			}
318
-		}
319
-		if (!empty($fields)) {
320
-			if (isset($primary) && $primary) {
321
-				if ($table->hasPrimaryKey()) {
322
-					return;
323
-				}
324
-				$table->setPrimaryKey($fields, $name);
325
-			} else {
326
-				if (isset($unique) && $unique) {
327
-					$table->addUniqueIndex($fields, $name);
328
-				} else {
329
-					$table->addIndex($fields, $name);
330
-				}
331
-			}
332
-		} else {
333
-			throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true));
334
-		}
335
-	}
317
+            }
318
+        }
319
+        if (!empty($fields)) {
320
+            if (isset($primary) && $primary) {
321
+                if ($table->hasPrimaryKey()) {
322
+                    return;
323
+                }
324
+                $table->setPrimaryKey($fields, $name);
325
+            } else {
326
+                if (isset($unique) && $unique) {
327
+                    $table->addUniqueIndex($fields, $name);
328
+                } else {
329
+                    $table->addIndex($fields, $name);
330
+                }
331
+            }
332
+        } else {
333
+            throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true));
334
+        }
335
+    }
336 336
 
337
-	/**
338
-	 * @param \SimpleXMLElement|string $xml
339
-	 * @return bool
340
-	 */
341
-	private function asBool($xml) {
342
-		$result = (string)$xml;
343
-		if ($result == 'true') {
344
-			$result = true;
345
-		} elseif ($result == 'false') {
346
-			$result = false;
347
-		}
348
-		return (bool)$result;
349
-	}
337
+    /**
338
+     * @param \SimpleXMLElement|string $xml
339
+     * @return bool
340
+     */
341
+    private function asBool($xml) {
342
+        $result = (string)$xml;
343
+        if ($result == 'true') {
344
+            $result = true;
345
+        } elseif ($result == 'false') {
346
+            $result = false;
347
+        }
348
+        return (bool)$result;
349
+    }
350 350
 
351 351
 }
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/ActionFactory.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@
 block discarded – undo
30 30
 
31 31
 class ActionFactory implements IActionFactory {
32 32
 
33
-	/**
34
-	 * @param string $icon
35
-	 * @param string $name
36
-	 * @param string $href
37
-	 * @return ILinkAction
38
-	 */
39
-	public function newLinkAction($icon, $name, $href) {
40
-		$action = new LinkAction();
41
-		$action->setName($name);
42
-		$action->setIcon($icon);
43
-		$action->setHref($href);
44
-		return $action;
45
-	}
33
+    /**
34
+     * @param string $icon
35
+     * @param string $name
36
+     * @param string $href
37
+     * @return ILinkAction
38
+     */
39
+    public function newLinkAction($icon, $name, $href) {
40
+        $action = new LinkAction();
41
+        $action->setName($name);
42
+        $action->setIcon($icon);
43
+        $action->setHref($href);
44
+        return $action;
45
+    }
46 46
 
47
-	/**
48
-	 * @param string $icon
49
-	 * @param string $name
50
-	 * @param string $email
51
-	 * @return ILinkAction
52
-	 */
53
-	public function newEMailAction($icon, $name, $email) {
54
-		return $this->newLinkAction($icon, $name, 'mailto:' . urlencode($email));
55
-	}
47
+    /**
48
+     * @param string $icon
49
+     * @param string $name
50
+     * @param string $email
51
+     * @return ILinkAction
52
+     */
53
+    public function newEMailAction($icon, $name, $email) {
54
+        return $this->newLinkAction($icon, $name, 'mailto:' . urlencode($email));
55
+    }
56 56
 
57 57
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	 * @return ILinkAction
52 52
 	 */
53 53
 	public function newEMailAction($icon, $name, $email) {
54
-		return $this->newLinkAction($icon, $name, 'mailto:' . urlencode($email));
54
+		return $this->newLinkAction($icon, $name, 'mailto:'.urlencode($email));
55 55
 	}
56 56
 
57 57
 }
Please login to merge, or discard this patch.