Completed
Push — master ( c855ce...73f67a )
by
unknown
25:31 queued 15:31
created
src/Commands/Database/MigrationStatusCommand.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -20,81 +20,81 @@
 block discarded – undo
20 20
  */
21 21
 class MigrationStatusCommand extends AbstractCommand
22 22
 {
23
-    /**
24
-     * The default command name
25
-     *
26
-     * @var  string|null
27
-     */
28
-    protected static $defaultName = 'database:migrations:status';
23
+	/**
24
+	 * The default command name
25
+	 *
26
+	 * @var  string|null
27
+	 */
28
+	protected static $defaultName = 'database:migrations:status';
29 29
 
30
-    /**
31
-     * Database migrations helper
32
-     *
33
-     * @var  Migrations
34
-     */
35
-    private $migrations;
30
+	/**
31
+	 * Database migrations helper
32
+	 *
33
+	 * @var  Migrations
34
+	 */
35
+	private $migrations;
36 36
 
37
-    /**
38
-     * Constructor.
39
-     *
40
-     * @param   Migrations  $migrations  Database migrations helper
41
-     */
42
-    public function __construct(Migrations $migrations)
43
-    {
44
-        $this->migrations = $migrations;
37
+	/**
38
+	 * Constructor.
39
+	 *
40
+	 * @param   Migrations  $migrations  Database migrations helper
41
+	 */
42
+	public function __construct(Migrations $migrations)
43
+	{
44
+		$this->migrations = $migrations;
45 45
 
46
-        parent::__construct();
47
-    }
46
+		parent::__construct();
47
+	}
48 48
 
49
-    /**
50
-     * Internal function to execute the command.
51
-     *
52
-     * @param   InputInterface   $input   The input to inject into the command.
53
-     * @param   OutputInterface  $output  The output to inject into the command.
54
-     *
55
-     * @return  integer  The command exit code
56
-     */
57
-    protected function doExecute(InputInterface $input, OutputInterface $output): int
58
-    {
59
-        $symfonyStyle = new SymfonyStyle($input, $output);
49
+	/**
50
+	 * Internal function to execute the command.
51
+	 *
52
+	 * @param   InputInterface   $input   The input to inject into the command.
53
+	 * @param   OutputInterface  $output  The output to inject into the command.
54
+	 *
55
+	 * @return  integer  The command exit code
56
+	 */
57
+	protected function doExecute(InputInterface $input, OutputInterface $output): int
58
+	{
59
+		$symfonyStyle = new SymfonyStyle($input, $output);
60 60
 
61
-        $symfonyStyle->title('Database Migrations: Check Status');
61
+		$symfonyStyle->title('Database Migrations: Check Status');
62 62
 
63
-        $status = $this->migrations->checkStatus();
63
+		$status = $this->migrations->checkStatus();
64 64
 
65
-        if (!$status->tableExists) {
66
-            $symfonyStyle->comment('The migrations table does not exist, run the "database:migrate" command to set up the database.');
67
-        } elseif ($status->latest) {
68
-            $symfonyStyle->success('Your database is up-to-date.');
69
-        } else {
70
-            $symfonyStyle->comment(sprintf('Your database is not up-to-date. You are missing %d migration(s).', $status->missingMigrations));
65
+		if (!$status->tableExists) {
66
+			$symfonyStyle->comment('The migrations table does not exist, run the "database:migrate" command to set up the database.');
67
+		} elseif ($status->latest) {
68
+			$symfonyStyle->success('Your database is up-to-date.');
69
+		} else {
70
+			$symfonyStyle->comment(sprintf('Your database is not up-to-date. You are missing %d migration(s).', $status->missingMigrations));
71 71
 
72
-            $symfonyStyle->table(
73
-                [
74
-                    'Current Version',
75
-                    'Latest Version',
76
-                ],
77
-                [
78
-                    [
79
-                        $status->currentVersion,
80
-                        $status->latestVersion,
81
-                    ],
82
-                ]
83
-            );
72
+			$symfonyStyle->table(
73
+				[
74
+					'Current Version',
75
+					'Latest Version',
76
+				],
77
+				[
78
+					[
79
+						$status->currentVersion,
80
+						$status->latestVersion,
81
+					],
82
+				]
83
+			);
84 84
 
85
-            $symfonyStyle->comment('To update, run the "database:migrate" command.');
86
-        }
85
+			$symfonyStyle->comment('To update, run the "database:migrate" command.');
86
+		}
87 87
 
88
-        return 0;
89
-    }
88
+		return 0;
89
+	}
90 90
 
91
-    /**
92
-     * Configures the current command.
93
-     *
94
-     * @return  void
95
-     */
96
-    protected function configure(): void
97
-    {
98
-        $this->setDescription('Check the database migration status.');
99
-    }
91
+	/**
92
+	 * Configures the current command.
93
+	 *
94
+	 * @return  void
95
+	 */
96
+	protected function configure(): void
97
+	{
98
+		$this->setDescription('Check the database migration status.');
99
+	}
100 100
 }
Please login to merge, or discard this patch.
src/Commands/SnapshotCommand.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -24,102 +24,102 @@
 block discarded – undo
24 24
  */
25 25
 class SnapshotCommand extends AbstractCommand
26 26
 {
27
-    /**
28
-     * The default command name
29
-     *
30
-     * @var  string|null
31
-     */
32
-    protected static $defaultName = 'snapshot';
33
-
34
-    /**
35
-     * JSON view for displaying the statistics.
36
-     *
37
-     * @var  StatsJsonView
38
-     */
39
-    private $view;
40
-
41
-    /**
42
-     * Filesystem adapter for the snapshots space.
43
-     *
44
-     * @var  Filesystem
45
-     */
46
-    private $filesystem;
47
-
48
-    /**
49
-     * Constructor.
50
-     *
51
-     * @param   StatsJsonView  $view        JSON view for displaying the statistics.
52
-     * @param   Filesystem     $filesystem  Filesystem adapter for the snapshots space.
53
-     */
54
-    public function __construct(StatsJsonView $view, Filesystem $filesystem)
55
-    {
56
-        $this->view       = $view;
57
-        $this->filesystem = $filesystem;
58
-
59
-        parent::__construct();
60
-    }
61
-
62
-    /**
63
-     * Internal function to execute the command.
64
-     *
65
-     * @param   InputInterface   $input   The input to inject into the command.
66
-     * @param   OutputInterface  $output  The output to inject into the command.
67
-     *
68
-     * @return  integer  The command exit code
69
-     */
70
-    protected function doExecute(InputInterface $input, OutputInterface $output): int
71
-    {
72
-        $symfonyStyle = new SymfonyStyle($input, $output);
73
-
74
-        $symfonyStyle->title('Creating Statistics Snapshot');
75
-
76
-        // We want the full raw data set for our snapshot
77
-        $this->view->isAuthorizedRaw(true);
78
-
79
-        $source = $input->getOption('source');
80
-
81
-        $filename = date('YmdHis');
82
-
83
-        if ($source) {
84
-            if (!\in_array($source, StatisticsRepository::ALLOWED_SOURCES)) {
85
-                throw new InvalidOptionException(
86
-                    \sprintf(
87
-                        'Invalid source "%s" given, valid options are: %s',
88
-                        $source,
89
-                        implode(', ', StatisticsRepository::ALLOWED_SOURCES)
90
-                    )
91
-                );
92
-            }
93
-
94
-            $this->view->setSource($source);
95
-
96
-            $filename .= '_' . $source;
97
-        }
98
-
99
-        if (!$this->filesystem->write($filename, $this->view->render())) {
100
-            $symfonyStyle->error('Failed writing snapshot to the filesystem.');
101
-
102
-            return 1;
103
-        }
104
-
105
-        $symfonyStyle->success('Snapshot recorded.');
106
-
107
-        return 0;
108
-    }
109
-
110
-    /**
111
-     * Configures the current command.
112
-     *
113
-     * @return  void
114
-     */
115
-    protected function configure(): void
116
-    {
117
-        $this->setDescription('Takes a snapshot of the statistics data.');
118
-        $this->addOption(
119
-            'source',
120
-            null,
121
-            InputOption::VALUE_OPTIONAL,
122
-            'If given, filters the snapshot to a single source.'
123
-        );
124
-    }
27
+	/**
28
+	 * The default command name
29
+	 *
30
+	 * @var  string|null
31
+	 */
32
+	protected static $defaultName = 'snapshot';
33
+
34
+	/**
35
+	 * JSON view for displaying the statistics.
36
+	 *
37
+	 * @var  StatsJsonView
38
+	 */
39
+	private $view;
40
+
41
+	/**
42
+	 * Filesystem adapter for the snapshots space.
43
+	 *
44
+	 * @var  Filesystem
45
+	 */
46
+	private $filesystem;
47
+
48
+	/**
49
+	 * Constructor.
50
+	 *
51
+	 * @param   StatsJsonView  $view        JSON view for displaying the statistics.
52
+	 * @param   Filesystem     $filesystem  Filesystem adapter for the snapshots space.
53
+	 */
54
+	public function __construct(StatsJsonView $view, Filesystem $filesystem)
55
+	{
56
+		$this->view       = $view;
57
+		$this->filesystem = $filesystem;
58
+
59
+		parent::__construct();
60
+	}
61
+
62
+	/**
63
+	 * Internal function to execute the command.
64
+	 *
65
+	 * @param   InputInterface   $input   The input to inject into the command.
66
+	 * @param   OutputInterface  $output  The output to inject into the command.
67
+	 *
68
+	 * @return  integer  The command exit code
69
+	 */
70
+	protected function doExecute(InputInterface $input, OutputInterface $output): int
71
+	{
72
+		$symfonyStyle = new SymfonyStyle($input, $output);
73
+
74
+		$symfonyStyle->title('Creating Statistics Snapshot');
75
+
76
+		// We want the full raw data set for our snapshot
77
+		$this->view->isAuthorizedRaw(true);
78
+
79
+		$source = $input->getOption('source');
80
+
81
+		$filename = date('YmdHis');
82
+
83
+		if ($source) {
84
+			if (!\in_array($source, StatisticsRepository::ALLOWED_SOURCES)) {
85
+				throw new InvalidOptionException(
86
+					\sprintf(
87
+						'Invalid source "%s" given, valid options are: %s',
88
+						$source,
89
+						implode(', ', StatisticsRepository::ALLOWED_SOURCES)
90
+					)
91
+				);
92
+			}
93
+
94
+			$this->view->setSource($source);
95
+
96
+			$filename .= '_' . $source;
97
+		}
98
+
99
+		if (!$this->filesystem->write($filename, $this->view->render())) {
100
+			$symfonyStyle->error('Failed writing snapshot to the filesystem.');
101
+
102
+			return 1;
103
+		}
104
+
105
+		$symfonyStyle->success('Snapshot recorded.');
106
+
107
+		return 0;
108
+	}
109
+
110
+	/**
111
+	 * Configures the current command.
112
+	 *
113
+	 * @return  void
114
+	 */
115
+	protected function configure(): void
116
+	{
117
+		$this->setDescription('Takes a snapshot of the statistics data.');
118
+		$this->addOption(
119
+			'source',
120
+			null,
121
+			InputOption::VALUE_OPTIONAL,
122
+			'If given, filters the snapshot to a single source.'
123
+		);
124
+	}
125 125
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 
94 94
             $this->view->setSource($source);
95 95
 
96
-            $filename .= '_' . $source;
96
+            $filename .= '_'.$source;
97 97
         }
98 98
 
99 99
         if (!$this->filesystem->write($filename, $this->view->render())) {
Please login to merge, or discard this patch.
src/Commands/SnapshotRecentlyUpdatedCommand.php 2 patches
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -24,103 +24,103 @@
 block discarded – undo
24 24
  */
25 25
 class SnapshotRecentlyUpdatedCommand extends AbstractCommand
26 26
 {
27
-    /**
28
-     * The default command name
29
-     *
30
-     * @var  string|null
31
-     */
32
-    protected static $defaultName = 'snapshot:recently-updated';
33
-
34
-    /**
35
-     * JSON view for displaying the statistics.
36
-     *
37
-     * @var  StatsJsonView
38
-     */
39
-    private $view;
40
-
41
-    /**
42
-     * Filesystem adapter for the snapshots space.
43
-     *
44
-     * @var  Filesystem
45
-     */
46
-    private $filesystem;
47
-
48
-    /**
49
-     * Constructor.
50
-     *
51
-     * @param   StatsJsonView  $view        JSON view for displaying the statistics.
52
-     * @param   Filesystem     $filesystem  Filesystem adapter for the snapshots space.
53
-     */
54
-    public function __construct(StatsJsonView $view, Filesystem $filesystem)
55
-    {
56
-        $this->view       = $view;
57
-        $this->filesystem = $filesystem;
58
-
59
-        parent::__construct();
60
-    }
61
-
62
-    /**
63
-     * Internal function to execute the command.
64
-     *
65
-     * @param   InputInterface   $input   The input to inject into the command.
66
-     * @param   OutputInterface  $output  The output to inject into the command.
67
-     *
68
-     * @return  integer  The command exit code
69
-     */
70
-    protected function doExecute(InputInterface $input, OutputInterface $output): int
71
-    {
72
-        $symfonyStyle = new SymfonyStyle($input, $output);
73
-
74
-        $symfonyStyle->title('Creating Statistics Snapshot');
75
-
76
-        // We want the full raw data set for our snapshot
77
-        $this->view->isAuthorizedRaw(true);
78
-        $this->view->isRecent(true);
79
-
80
-        $source = $input->getOption('source');
81
-
82
-        $filename = date('YmdHis') . '_recent';
83
-
84
-        if ($source) {
85
-            if (!\in_array($source, StatisticsRepository::ALLOWED_SOURCES)) {
86
-                throw new InvalidOptionException(
87
-                    \sprintf(
88
-                        'Invalid source "%s" given, valid options are: %s',
89
-                        $source,
90
-                        implode(', ', StatisticsRepository::ALLOWED_SOURCES)
91
-                    )
92
-                );
93
-            }
94
-
95
-            $this->view->setSource($source);
96
-
97
-            $filename .= '_' . $source;
98
-        }
99
-
100
-        if (!$this->filesystem->write($filename, $this->view->render())) {
101
-            $symfonyStyle->error('Failed writing snapshot to the filesystem.');
102
-
103
-            return 1;
104
-        }
105
-
106
-        $symfonyStyle->success('Snapshot recorded.');
107
-
108
-        return 0;
109
-    }
110
-
111
-    /**
112
-     * Configures the current command.
113
-     *
114
-     * @return  void
115
-     */
116
-    protected function configure(): void
117
-    {
118
-        $this->setDescription('Takes a snapshot of the recently updated statistics data.');
119
-        $this->addOption(
120
-            'source',
121
-            null,
122
-            InputOption::VALUE_OPTIONAL,
123
-            'If given, filters the snapshot to a single source.'
124
-        );
125
-    }
27
+	/**
28
+	 * The default command name
29
+	 *
30
+	 * @var  string|null
31
+	 */
32
+	protected static $defaultName = 'snapshot:recently-updated';
33
+
34
+	/**
35
+	 * JSON view for displaying the statistics.
36
+	 *
37
+	 * @var  StatsJsonView
38
+	 */
39
+	private $view;
40
+
41
+	/**
42
+	 * Filesystem adapter for the snapshots space.
43
+	 *
44
+	 * @var  Filesystem
45
+	 */
46
+	private $filesystem;
47
+
48
+	/**
49
+	 * Constructor.
50
+	 *
51
+	 * @param   StatsJsonView  $view        JSON view for displaying the statistics.
52
+	 * @param   Filesystem     $filesystem  Filesystem adapter for the snapshots space.
53
+	 */
54
+	public function __construct(StatsJsonView $view, Filesystem $filesystem)
55
+	{
56
+		$this->view       = $view;
57
+		$this->filesystem = $filesystem;
58
+
59
+		parent::__construct();
60
+	}
61
+
62
+	/**
63
+	 * Internal function to execute the command.
64
+	 *
65
+	 * @param   InputInterface   $input   The input to inject into the command.
66
+	 * @param   OutputInterface  $output  The output to inject into the command.
67
+	 *
68
+	 * @return  integer  The command exit code
69
+	 */
70
+	protected function doExecute(InputInterface $input, OutputInterface $output): int
71
+	{
72
+		$symfonyStyle = new SymfonyStyle($input, $output);
73
+
74
+		$symfonyStyle->title('Creating Statistics Snapshot');
75
+
76
+		// We want the full raw data set for our snapshot
77
+		$this->view->isAuthorizedRaw(true);
78
+		$this->view->isRecent(true);
79
+
80
+		$source = $input->getOption('source');
81
+
82
+		$filename = date('YmdHis') . '_recent';
83
+
84
+		if ($source) {
85
+			if (!\in_array($source, StatisticsRepository::ALLOWED_SOURCES)) {
86
+				throw new InvalidOptionException(
87
+					\sprintf(
88
+						'Invalid source "%s" given, valid options are: %s',
89
+						$source,
90
+						implode(', ', StatisticsRepository::ALLOWED_SOURCES)
91
+					)
92
+				);
93
+			}
94
+
95
+			$this->view->setSource($source);
96
+
97
+			$filename .= '_' . $source;
98
+		}
99
+
100
+		if (!$this->filesystem->write($filename, $this->view->render())) {
101
+			$symfonyStyle->error('Failed writing snapshot to the filesystem.');
102
+
103
+			return 1;
104
+		}
105
+
106
+		$symfonyStyle->success('Snapshot recorded.');
107
+
108
+		return 0;
109
+	}
110
+
111
+	/**
112
+	 * Configures the current command.
113
+	 *
114
+	 * @return  void
115
+	 */
116
+	protected function configure(): void
117
+	{
118
+		$this->setDescription('Takes a snapshot of the recently updated statistics data.');
119
+		$this->addOption(
120
+			'source',
121
+			null,
122
+			InputOption::VALUE_OPTIONAL,
123
+			'If given, filters the snapshot to a single source.'
124
+		);
125
+	}
126 126
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         $source = $input->getOption('source');
81 81
 
82
-        $filename = date('YmdHis') . '_recent';
82
+        $filename = date('YmdHis').'_recent';
83 83
 
84 84
         if ($source) {
85 85
             if (!\in_array($source, StatisticsRepository::ALLOWED_SOURCES)) {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
             $this->view->setSource($source);
96 96
 
97
-            $filename .= '_' . $source;
97
+            $filename .= '_'.$source;
98 98
         }
99 99
 
100 100
         if (!$this->filesystem->write($filename, $this->view->render())) {
Please login to merge, or discard this patch.
src/GitHub/GitHub.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@
 block discarded – undo
18 18
  */
19 19
 class GitHub extends JGitHub
20 20
 {
21
-    /**
22
-     * Magic method to lazily create API objects
23
-     *
24
-     * @param   string  $name  Name of property to retrieve
25
-     *
26
-     * @return  \Joomla\Github\AbstractGithubObject  GitHub API object (gists, issues, pulls, etc).
27
-     *
28
-     * @throws  \InvalidArgumentException If $name is not a valid sub class.
29
-     */
30
-    public function __get($name)
31
-    {
32
-        $class = __NAMESPACE__ . '\\Package\\' . ucfirst($name);
21
+	/**
22
+	 * Magic method to lazily create API objects
23
+	 *
24
+	 * @param   string  $name  Name of property to retrieve
25
+	 *
26
+	 * @return  \Joomla\Github\AbstractGithubObject  GitHub API object (gists, issues, pulls, etc).
27
+	 *
28
+	 * @throws  \InvalidArgumentException If $name is not a valid sub class.
29
+	 */
30
+	public function __get($name)
31
+	{
32
+		$class = __NAMESPACE__ . '\\Package\\' . ucfirst($name);
33 33
 
34
-        if (class_exists($class)) {
35
-            if (!isset($this->$name)) {
36
-                $this->$name = new $class($this->options, $this->client);
37
-            }
34
+		if (class_exists($class)) {
35
+			if (!isset($this->$name)) {
36
+				$this->$name = new $class($this->options, $this->client);
37
+			}
38 38
 
39
-            return $this->$name;
40
-        }
39
+			return $this->$name;
40
+		}
41 41
 
42
-        return parent::__get($name);
43
-    }
42
+		return parent::__get($name);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     public function __get($name)
31 31
     {
32
-        $class = __NAMESPACE__ . '\\Package\\' . ucfirst($name);
32
+        $class = __NAMESPACE__.'\\Package\\'.ucfirst($name);
33 33
 
34 34
         if (class_exists($class)) {
35 35
             if (!isset($this->$name)) {
Please login to merge, or discard this patch.
src/GitHub/Package.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,27 +16,27 @@
 block discarded – undo
16 16
  */
17 17
 abstract class Package extends BasePackage
18 18
 {
19
-    /**
20
-     * Magic method to lazily create API objects
21
-     *
22
-     * @param   string  $name  Name of property to retrieve
23
-     *
24
-     * @return  Package  GitHub API package object.
25
-     *
26
-     * @throws  \InvalidArgumentException
27
-     */
28
-    public function __get($name)
29
-    {
30
-        $class = __NAMESPACE__ . '\\' . $this->package . '\\' . ucfirst($name);
19
+	/**
20
+	 * Magic method to lazily create API objects
21
+	 *
22
+	 * @param   string  $name  Name of property to retrieve
23
+	 *
24
+	 * @return  Package  GitHub API package object.
25
+	 *
26
+	 * @throws  \InvalidArgumentException
27
+	 */
28
+	public function __get($name)
29
+	{
30
+		$class = __NAMESPACE__ . '\\' . $this->package . '\\' . ucfirst($name);
31 31
 
32
-        if (class_exists($class)) {
33
-            if (!isset($this->$name)) {
34
-                $this->$name = new $class($this->options, $this->client);
35
-            }
32
+		if (class_exists($class)) {
33
+			if (!isset($this->$name)) {
34
+				$this->$name = new $class($this->options, $this->client);
35
+			}
36 36
 
37
-            return $this->$name;
38
-        }
37
+			return $this->$name;
38
+		}
39 39
 
40
-        return parent::__get($name);
41
-    }
40
+		return parent::__get($name);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     public function __get($name)
29 29
     {
30
-        $class = __NAMESPACE__ . '\\' . $this->package . '\\' . ucfirst($name);
30
+        $class = __NAMESPACE__.'\\'.$this->package.'\\'.ucfirst($name);
31 31
 
32 32
         if (class_exists($class)) {
33 33
             if (!isset($this->$name)) {
Please login to merge, or discard this patch.
src/GitHub/Package/Repositories.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -17,43 +17,43 @@
 block discarded – undo
17 17
  */
18 18
 class Repositories extends BaseRepositories
19 19
 {
20
-    /**
21
-     * API Response object
22
-     *
23
-     * @var  Response
24
-     */
25
-    private $apiResponse;
26
-
27
-    /**
28
-     * Get the last API response if one is set
29
-     *
30
-     * @return  Response|null
31
-     */
32
-    public function getApiResponse()
33
-    {
34
-        return $this->apiResponse;
35
-    }
36
-
37
-    /**
38
-     * Get a list of tags on a repository.
39
-     *
40
-     * Note: This is different from the parent `getListTags` method as it adds support for the API's pagination. This extended method can be removed
41
-     * if the upstream class gains this support.
42
-     *
43
-     * @param   string   $owner  Repository owner.
44
-     * @param   string   $repo   Repository name.
45
-     * @param   integer  $page   The page number from which to get items.
46
-     *
47
-     * @return  object
48
-     */
49
-    public function getTags($owner, $repo, $page = 0)
50
-    {
51
-        // Build the request path.
52
-        $path = '/repos/' . $owner . '/' . $repo . '/tags';
53
-
54
-        // Send the request.
55
-        $this->apiResponse = $this->client->get($this->fetchUrl($path, $page));
56
-
57
-        return $this->processResponse($this->apiResponse);
58
-    }
20
+	/**
21
+	 * API Response object
22
+	 *
23
+	 * @var  Response
24
+	 */
25
+	private $apiResponse;
26
+
27
+	/**
28
+	 * Get the last API response if one is set
29
+	 *
30
+	 * @return  Response|null
31
+	 */
32
+	public function getApiResponse()
33
+	{
34
+		return $this->apiResponse;
35
+	}
36
+
37
+	/**
38
+	 * Get a list of tags on a repository.
39
+	 *
40
+	 * Note: This is different from the parent `getListTags` method as it adds support for the API's pagination. This extended method can be removed
41
+	 * if the upstream class gains this support.
42
+	 *
43
+	 * @param   string   $owner  Repository owner.
44
+	 * @param   string   $repo   Repository name.
45
+	 * @param   integer  $page   The page number from which to get items.
46
+	 *
47
+	 * @return  object
48
+	 */
49
+	public function getTags($owner, $repo, $page = 0)
50
+	{
51
+		// Build the request path.
52
+		$path = '/repos/' . $owner . '/' . $repo . '/tags';
53
+
54
+		// Send the request.
55
+		$this->apiResponse = $this->client->get($this->fetchUrl($path, $page));
56
+
57
+		return $this->processResponse($this->apiResponse);
58
+	}
59 59
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     public function getTags($owner, $repo, $page = 0)
50 50
     {
51 51
         // Build the request path.
52
-        $path = '/repos/' . $owner . '/' . $repo . '/tags';
52
+        $path = '/repos/'.$owner.'/'.$repo.'/tags';
53 53
 
54 54
         // Send the request.
55 55
         $this->apiResponse = $this->client->get($this->fetchUrl($path, $page));
Please login to merge, or discard this patch.
src/Database/Migrations.php 2 patches
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -22,196 +22,196 @@
 block discarded – undo
22 22
  */
23 23
 class Migrations
24 24
 {
25
-    /**
26
-     * Database connector
27
-     *
28
-     * @var  DatabaseDriver
29
-     */
30
-    private $database;
31
-
32
-    /**
33
-     * Filesystem adapter
34
-     *
35
-     * @var  Filesystem
36
-     */
37
-    private $filesystem;
38
-
39
-    /**
40
-     * Constructor
41
-     *
42
-     * @param   DatabaseDriver  $database    Database connector
43
-     * @param   Filesystem      $filesystem  Filesystem adapter
44
-     */
45
-    public function __construct(DatabaseDriver $database, Filesystem $filesystem)
46
-    {
47
-        $this->database   = $database;
48
-        $this->filesystem = $filesystem;
49
-    }
50
-
51
-    /**
52
-     * Checks the migration status of the current installation
53
-     *
54
-     * @return  MigrationsStatus
55
-     */
56
-    public function checkStatus(): MigrationsStatus
57
-    {
58
-        $response = new MigrationsStatus();
59
-
60
-        try {
61
-            // First get the list of applied migrations
62
-            $appliedMigrations = $this->database->setQuery(
63
-                $this->database->getQuery(true)
64
-                    ->select('version')
65
-                    ->from('#__migrations')
66
-            )->loadColumn();
67
-        } catch (ExecutionFailureException | PrepareStatementFailureException $exception) {
68
-            // On PDO we're checking "42S02, 1146, Table 'XXX.#__migrations' doesn't exist"
69
-            if (strpos($exception->getMessage(), "migrations' doesn't exist") === false) {
70
-                throw $exception;
71
-            }
72
-
73
-            $response->tableExists = false;
74
-
75
-            return $response;
76
-        }
77
-
78
-        // Now get the list of all known migrations
79
-        $knownMigrations = [];
80
-
81
-        foreach ($this->filesystem->listContents() as $migrationFiles) {
82
-            $knownMigrations[] = $migrationFiles['filename'];
83
-        }
84
-
85
-        // Don't rely on file system ordering.
86
-        sort($knownMigrations);
87
-
88
-        // Validate all migrations are applied; the count and latest versions should match
89
-        if (\count($appliedMigrations) === \count($knownMigrations)) {
90
-            $appliedValues = array_values($appliedMigrations);
91
-            $knownValues   = array_values($knownMigrations);
92
-
93
-            $latestApplied = (int) end($appliedValues);
94
-            $latestKnown   = (int) end($knownValues);
95
-
96
-            // Versions match, good to go
97
-            if ($latestApplied === $latestKnown) {
98
-                $response->latest = true;
99
-
100
-                return $response;
101
-            }
102
-        }
103
-
104
-        // The system is not on the latest version, get the relevant data
105
-        $response->missingMigrations = \count($knownMigrations) - \count($appliedMigrations);
106
-        $response->currentVersion    = array_pop($appliedMigrations);
107
-        $response->latestVersion     = array_pop($knownMigrations);
108
-
109
-        return $response;
110
-    }
111
-
112
-    /**
113
-     * Migrate the database
114
-     *
115
-     * @param   string|null  $version  Optional migration version to run
116
-     *
117
-     * @return  void
118
-     */
119
-    public function migrateDatabase(?string $version = null): void
120
-    {
121
-        try {
122
-            // Determine the migrations to apply
123
-            $appliedMigrations = $this->database->setQuery(
124
-                $this->database->getQuery(true)
125
-                    ->select('version')
126
-                    ->from('#__migrations')
127
-            )->loadColumn();
128
-        } catch (ExecutionFailureException | PrepareStatementFailureException $exception) {
129
-            // If the table does not exist, we can still try to run migrations
130
-            if (strpos($exception->getMessage(), "migrations' doesn't exist") === false) {
131
-                throw $exception;
132
-            }
133
-
134
-            // If given a version, we can only execute it if it is the first migration, otherwise we've got other problems
135
-            if ($version !== null && $version !== '') {
136
-                $firstMigration = $this->filesystem->listContents()[0];
137
-
138
-                if ($firstMigration['filename'] !== $version) {
139
-                    throw new CannotInitializeMigrationsException(
140
-                        'The migrations have not yet been initialized and the first migration has not been given as the version to run.'
141
-                    );
142
-                }
143
-            }
144
-
145
-            $appliedMigrations = [];
146
-        }
147
-
148
-        // If a version is specified, check if that migration is already applied and if not, run that one only
149
-        if ($version !== null && $version !== '') {
150
-            // If it's already applied, there's nothing to do here
151
-            if (\in_array($version, $appliedMigrations)) {
152
-                return;
153
-            }
154
-
155
-            $this->doMigration($version);
156
-
157
-            return;
158
-        }
159
-
160
-        // We need to check the known migrations and filter out the applied ones to know what to do
161
-        $knownMigrations = [];
162
-
163
-        foreach ($this->filesystem->listContents() as $migrationFiles) {
164
-            $knownMigrations[] = $migrationFiles['filename'];
165
-        }
166
-
167
-        foreach (array_diff($knownMigrations, $appliedMigrations) as $version) {
168
-            $this->doMigration($version);
169
-        }
170
-    }
171
-
172
-    /**
173
-     * Perform the database migration for the specified version
174
-     *
175
-     * @param   string  $version  Migration version to run
176
-     *
177
-     * @return  void
178
-     *
179
-     * @throws  UnknownMigrationException
180
-     * @throws  UnreadableFileException
181
-     */
182
-    private function doMigration(string $version): void
183
-    {
184
-        $sqlFile = $version . '.sql';
185
-
186
-        if (!$this->filesystem->has($sqlFile)) {
187
-            throw new UnknownMigrationException($sqlFile);
188
-        }
189
-
190
-        $queries = $this->filesystem->read($sqlFile);
191
-
192
-        if ($queries === false) {
193
-            throw new UnreadableFileException(
194
-                sprintf(
195
-                    'Could not read data from the %s SQL file, please update the database manually.',
196
-                    $sqlFile
197
-                )
198
-            );
199
-        }
200
-
201
-        foreach (DatabaseDriver::splitSql($queries) as $query) {
202
-            $query = trim($query);
203
-
204
-            if (!empty($query)) {
205
-                $this->database->setQuery($query)->execute();
206
-            }
207
-        }
208
-
209
-        // Log the migration into the database
210
-        $this->database->setQuery(
211
-            $this->database->getQuery(true)
212
-                ->insert('#__migrations')
213
-                ->columns('version')
214
-                ->values($version)
215
-        )->execute();
216
-    }
25
+	/**
26
+	 * Database connector
27
+	 *
28
+	 * @var  DatabaseDriver
29
+	 */
30
+	private $database;
31
+
32
+	/**
33
+	 * Filesystem adapter
34
+	 *
35
+	 * @var  Filesystem
36
+	 */
37
+	private $filesystem;
38
+
39
+	/**
40
+	 * Constructor
41
+	 *
42
+	 * @param   DatabaseDriver  $database    Database connector
43
+	 * @param   Filesystem      $filesystem  Filesystem adapter
44
+	 */
45
+	public function __construct(DatabaseDriver $database, Filesystem $filesystem)
46
+	{
47
+		$this->database   = $database;
48
+		$this->filesystem = $filesystem;
49
+	}
50
+
51
+	/**
52
+	 * Checks the migration status of the current installation
53
+	 *
54
+	 * @return  MigrationsStatus
55
+	 */
56
+	public function checkStatus(): MigrationsStatus
57
+	{
58
+		$response = new MigrationsStatus();
59
+
60
+		try {
61
+			// First get the list of applied migrations
62
+			$appliedMigrations = $this->database->setQuery(
63
+				$this->database->getQuery(true)
64
+					->select('version')
65
+					->from('#__migrations')
66
+			)->loadColumn();
67
+		} catch (ExecutionFailureException | PrepareStatementFailureException $exception) {
68
+			// On PDO we're checking "42S02, 1146, Table 'XXX.#__migrations' doesn't exist"
69
+			if (strpos($exception->getMessage(), "migrations' doesn't exist") === false) {
70
+				throw $exception;
71
+			}
72
+
73
+			$response->tableExists = false;
74
+
75
+			return $response;
76
+		}
77
+
78
+		// Now get the list of all known migrations
79
+		$knownMigrations = [];
80
+
81
+		foreach ($this->filesystem->listContents() as $migrationFiles) {
82
+			$knownMigrations[] = $migrationFiles['filename'];
83
+		}
84
+
85
+		// Don't rely on file system ordering.
86
+		sort($knownMigrations);
87
+
88
+		// Validate all migrations are applied; the count and latest versions should match
89
+		if (\count($appliedMigrations) === \count($knownMigrations)) {
90
+			$appliedValues = array_values($appliedMigrations);
91
+			$knownValues   = array_values($knownMigrations);
92
+
93
+			$latestApplied = (int) end($appliedValues);
94
+			$latestKnown   = (int) end($knownValues);
95
+
96
+			// Versions match, good to go
97
+			if ($latestApplied === $latestKnown) {
98
+				$response->latest = true;
99
+
100
+				return $response;
101
+			}
102
+		}
103
+
104
+		// The system is not on the latest version, get the relevant data
105
+		$response->missingMigrations = \count($knownMigrations) - \count($appliedMigrations);
106
+		$response->currentVersion    = array_pop($appliedMigrations);
107
+		$response->latestVersion     = array_pop($knownMigrations);
108
+
109
+		return $response;
110
+	}
111
+
112
+	/**
113
+	 * Migrate the database
114
+	 *
115
+	 * @param   string|null  $version  Optional migration version to run
116
+	 *
117
+	 * @return  void
118
+	 */
119
+	public function migrateDatabase(?string $version = null): void
120
+	{
121
+		try {
122
+			// Determine the migrations to apply
123
+			$appliedMigrations = $this->database->setQuery(
124
+				$this->database->getQuery(true)
125
+					->select('version')
126
+					->from('#__migrations')
127
+			)->loadColumn();
128
+		} catch (ExecutionFailureException | PrepareStatementFailureException $exception) {
129
+			// If the table does not exist, we can still try to run migrations
130
+			if (strpos($exception->getMessage(), "migrations' doesn't exist") === false) {
131
+				throw $exception;
132
+			}
133
+
134
+			// If given a version, we can only execute it if it is the first migration, otherwise we've got other problems
135
+			if ($version !== null && $version !== '') {
136
+				$firstMigration = $this->filesystem->listContents()[0];
137
+
138
+				if ($firstMigration['filename'] !== $version) {
139
+					throw new CannotInitializeMigrationsException(
140
+						'The migrations have not yet been initialized and the first migration has not been given as the version to run.'
141
+					);
142
+				}
143
+			}
144
+
145
+			$appliedMigrations = [];
146
+		}
147
+
148
+		// If a version is specified, check if that migration is already applied and if not, run that one only
149
+		if ($version !== null && $version !== '') {
150
+			// If it's already applied, there's nothing to do here
151
+			if (\in_array($version, $appliedMigrations)) {
152
+				return;
153
+			}
154
+
155
+			$this->doMigration($version);
156
+
157
+			return;
158
+		}
159
+
160
+		// We need to check the known migrations and filter out the applied ones to know what to do
161
+		$knownMigrations = [];
162
+
163
+		foreach ($this->filesystem->listContents() as $migrationFiles) {
164
+			$knownMigrations[] = $migrationFiles['filename'];
165
+		}
166
+
167
+		foreach (array_diff($knownMigrations, $appliedMigrations) as $version) {
168
+			$this->doMigration($version);
169
+		}
170
+	}
171
+
172
+	/**
173
+	 * Perform the database migration for the specified version
174
+	 *
175
+	 * @param   string  $version  Migration version to run
176
+	 *
177
+	 * @return  void
178
+	 *
179
+	 * @throws  UnknownMigrationException
180
+	 * @throws  UnreadableFileException
181
+	 */
182
+	private function doMigration(string $version): void
183
+	{
184
+		$sqlFile = $version . '.sql';
185
+
186
+		if (!$this->filesystem->has($sqlFile)) {
187
+			throw new UnknownMigrationException($sqlFile);
188
+		}
189
+
190
+		$queries = $this->filesystem->read($sqlFile);
191
+
192
+		if ($queries === false) {
193
+			throw new UnreadableFileException(
194
+				sprintf(
195
+					'Could not read data from the %s SQL file, please update the database manually.',
196
+					$sqlFile
197
+				)
198
+			);
199
+		}
200
+
201
+		foreach (DatabaseDriver::splitSql($queries) as $query) {
202
+			$query = trim($query);
203
+
204
+			if (!empty($query)) {
205
+				$this->database->setQuery($query)->execute();
206
+			}
207
+		}
208
+
209
+		// Log the migration into the database
210
+		$this->database->setQuery(
211
+			$this->database->getQuery(true)
212
+				->insert('#__migrations')
213
+				->columns('version')
214
+				->values($version)
215
+		)->execute();
216
+	}
217 217
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@
 block discarded – undo
181 181
      */
182 182
     private function doMigration(string $version): void
183 183
     {
184
-        $sqlFile = $version . '.sql';
184
+        $sqlFile = $version.'.sql';
185 185
 
186 186
         if (!$this->filesystem->has($sqlFile)) {
187 187
             throw new UnknownMigrationException($sqlFile);
Please login to merge, or discard this patch.
src/Database/MigrationsStatus.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -14,38 +14,38 @@
 block discarded – undo
14 14
  */
15 15
 class MigrationsStatus
16 16
 {
17
-    /**
18
-     * The currently applied migration version
19
-     *
20
-     * @var  string|null
21
-     */
22
-    public $currentVersion;
17
+	/**
18
+	 * The currently applied migration version
19
+	 *
20
+	 * @var  string|null
21
+	 */
22
+	public $currentVersion;
23 23
 
24
-    /**
25
-     * Is the database at the latest version?
26
-     *
27
-     * @var  boolean
28
-     */
29
-    public $latest = false;
24
+	/**
25
+	 * Is the database at the latest version?
26
+	 *
27
+	 * @var  boolean
28
+	 */
29
+	public $latest = false;
30 30
 
31
-    /**
32
-     * The newest available migration version
33
-     *
34
-     * @var  string|null
35
-     */
36
-    public $latestVersion;
31
+	/**
32
+	 * The newest available migration version
33
+	 *
34
+	 * @var  string|null
35
+	 */
36
+	public $latestVersion;
37 37
 
38
-    /**
39
-     * Count of the number of missing migrations
40
-     *
41
-     * @var  integer
42
-     */
43
-    public $missingMigrations = 0;
38
+	/**
39
+	 * Count of the number of missing migrations
40
+	 *
41
+	 * @var  integer
42
+	 */
43
+	public $missingMigrations = 0;
44 44
 
45
-    /**
46
-     * Does the migrations table even exist?
47
-     *
48
-     * @var  boolean
49
-     */
50
-    public $tableExists = true;
45
+	/**
46
+	 * Does the migrations table even exist?
47
+	 *
48
+	 * @var  boolean
49
+	 */
50
+	public $tableExists = true;
51 51
 }
Please login to merge, or discard this patch.
src/WebApplication.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -24,69 +24,69 @@
 block discarded – undo
24 24
  */
25 25
 class WebApplication extends AbstractWebApplication
26 26
 {
27
-    /**
28
-     * The application's controller resolver.
29
-     *
30
-     * @var    ControllerResolverInterface
31
-     * @since  __DEPLOY_VERSION__
32
-     */
33
-    protected $controllerResolver;
27
+	/**
28
+	 * The application's controller resolver.
29
+	 *
30
+	 * @var    ControllerResolverInterface
31
+	 * @since  __DEPLOY_VERSION__
32
+	 */
33
+	protected $controllerResolver;
34 34
 
35
-    /**
36
-     * The application's router.
37
-     *
38
-     * @var    Router
39
-     * @since  __DEPLOY_VERSION__
40
-     */
41
-    protected $router;
35
+	/**
36
+	 * The application's router.
37
+	 *
38
+	 * @var    Router
39
+	 * @since  __DEPLOY_VERSION__
40
+	 */
41
+	protected $router;
42 42
 
43
-    /**
44
-     * Class constructor.
45
-     *
46
-     * @param   ControllerResolverInterface  $controllerResolver  The application's controller resolver
47
-     * @param   Router                       $router              The application's router
48
-     * @param   Input                        $input               An optional argument to provide dependency injection for the application's
49
-     *                                                            input object.
50
-     * @param   Registry                     $config              An optional argument to provide dependency injection for the application's
51
-     *                                                            config object.
52
-     * @param   WebClient                    $client              An optional argument to provide dependency injection for the application's
53
-     *                                                            client object.
54
-     * @param   ResponseInterface            $response            An optional argument to provide dependency injection for the application's
55
-     *                                                            response object.
56
-     *
57
-     * @since   __DEPLOY_VERSION__
58
-     */
59
-    public function __construct(
60
-        ControllerResolverInterface $controllerResolver,
61
-        Router $router,
62
-        Input $input = null,
63
-        Registry $config = null,
64
-        WebClient $client = null,
65
-        ResponseInterface $response = null
66
-    ) {
67
-        $this->controllerResolver = $controllerResolver;
68
-        $this->router             = $router;
43
+	/**
44
+	 * Class constructor.
45
+	 *
46
+	 * @param   ControllerResolverInterface  $controllerResolver  The application's controller resolver
47
+	 * @param   Router                       $router              The application's router
48
+	 * @param   Input                        $input               An optional argument to provide dependency injection for the application's
49
+	 *                                                            input object.
50
+	 * @param   Registry                     $config              An optional argument to provide dependency injection for the application's
51
+	 *                                                            config object.
52
+	 * @param   WebClient                    $client              An optional argument to provide dependency injection for the application's
53
+	 *                                                            client object.
54
+	 * @param   ResponseInterface            $response            An optional argument to provide dependency injection for the application's
55
+	 *                                                            response object.
56
+	 *
57
+	 * @since   __DEPLOY_VERSION__
58
+	 */
59
+	public function __construct(
60
+		ControllerResolverInterface $controllerResolver,
61
+		Router $router,
62
+		Input $input = null,
63
+		Registry $config = null,
64
+		WebClient $client = null,
65
+		ResponseInterface $response = null
66
+	) {
67
+		$this->controllerResolver = $controllerResolver;
68
+		$this->router             = $router;
69 69
 
70
-        // Call the constructor as late as possible (it runs `initialise`).
71
-        parent::__construct($input, $config, $client, $response);
72
-    }
70
+		// Call the constructor as late as possible (it runs `initialise`).
71
+		parent::__construct($input, $config, $client, $response);
72
+	}
73 73
 
74
-    /**
75
-     * Method to run the application routines.
76
-     *
77
-     * @return  void
78
-     *
79
-     * @since   __DEPLOY_VERSION__
80
-     */
81
-    protected function doExecute(): void
82
-    {
83
-        $route = $this->router->parseRoute($this->get('uri.route'), $this->input->getMethod());
74
+	/**
75
+	 * Method to run the application routines.
76
+	 *
77
+	 * @return  void
78
+	 *
79
+	 * @since   __DEPLOY_VERSION__
80
+	 */
81
+	protected function doExecute(): void
82
+	{
83
+		$route = $this->router->parseRoute($this->get('uri.route'), $this->input->getMethod());
84 84
 
85
-        // Add variables to the input if not already set
86
-        foreach ($route->getRouteVariables() as $key => $value) {
87
-            $this->input->def($key, $value);
88
-        }
85
+		// Add variables to the input if not already set
86
+		foreach ($route->getRouteVariables() as $key => $value) {
87
+			$this->input->def($key, $value);
88
+		}
89 89
 
90
-        \call_user_func($this->controllerResolver->resolve($route));
91
-    }
90
+		\call_user_func($this->controllerResolver->resolve($route));
91
+	}
92 92
 }
Please login to merge, or discard this patch.