Skip to content

Commit e9a3e2d

Browse files
committed
Fix CS from previous merge
1 parent 09b4523 commit e9a3e2d

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

lib/Github/Api/Repository/Contents.php

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class Contents extends AbstractApi
1717
* Get content of README file in a repository
1818
* @link http://developer.github.com/v3/repos/contents/
1919
*
20-
* @param string $username the user who owns the repository
21-
* @param string $repository the name of the repository
22-
* @param string $reference reference to a branch or commit
20+
* @param string $username the user who owns the repository
21+
* @param string $repository the name of the repository
22+
* @param null|string $reference reference to a branch or commit
2323
*
2424
* @return array information for README file
2525
*/
@@ -34,10 +34,10 @@ public function readme($username, $repository, $reference = null)
3434
* Get contents of any file or directory in a repository
3535
* @link http://developer.github.com/v3/repos/contents/
3636
*
37-
* @param string $username the user who owns the repository
38-
* @param string $repository the name of the repository
39-
* @param string $path path to file or directory
40-
* @param string $reference reference to a branch or commit
37+
* @param string $username the user who owns the repository
38+
* @param string $repository the name of the repository
39+
* @param null|string $path path to file or directory
40+
* @param null|string $reference reference to a branch or commit
4141
*
4242
* @return array information for file | information for each item in directory
4343
*/
@@ -57,10 +57,10 @@ public function show($username, $repository, $path = null, $reference = null)
5757
* Get content of archives in a repository
5858
* @link http://developer.github.com/v3/repos/contents/
5959
*
60-
* @param string $username the user who owns the repository
61-
* @param string $repository the name of the repository
62-
* @param string $format format of archive: tarball or zipball
63-
* @param string $reference reference to a branch or commit
60+
* @param string $username the user who owns the repository
61+
* @param string $repository the name of the repository
62+
* @param string $format format of archive: tarball or zipball
63+
* @param null|string $reference reference to a branch or commit
6464
*
6565
* @return array information for archives
6666
*/
@@ -78,20 +78,20 @@ public function archive($username, $repository, $format, $reference = null)
7878
/**
7979
* Get the contents of a file in a repository
8080
*
81-
* @param string $username the user who owns the repository
82-
* @param string $repository the name of the repository
83-
* @param string $path path to file
84-
* @param string $reference reference to a branch or commit
81+
* @param string $username the user who owns the repository
82+
* @param string $repository the name of the repository
83+
* @param string $path path to file
84+
* @param null|string $reference reference to a branch or commit
8585
*
86-
* @return string|null content of file, or null in case of base64_decode failure
86+
* @return null|string content of file, or null in case of base64_decode failure
8787
*
8888
* @throws InvalidArgumentException If $path is not a file or if its encoding is different from base64
8989
* @throws ErrorException If $path doesn't include a 'content' index
9090
*/
9191
public function download($username, $repository, $path, $reference = null)
9292
{
9393
$file = $this->show($username, $repository, $path, $reference);
94-
94+
9595
if (!isset($file['type']) || 'file' !== $file['type']) {
9696
throw new InvalidArgumentException(sprintf('Path "%s" is not a file.', $path));
9797
}
@@ -101,8 +101,10 @@ public function download($username, $repository, $path, $reference = null)
101101
}
102102

103103
if (!isset($file['encoding'])) {
104-
throw new InvalidArgumentException(sprintf('Can\t decode contents of file "%s" as no encoding is defined.', $path));
105-
} elseif ('base64' !== $file['encoding']) {
104+
throw new InvalidArgumentException(sprintf('Can\'t decode content of file "%s", as no encoding is defined.', $path));
105+
}
106+
107+
if ('base64' !== $file['encoding']) {
106108
throw new InvalidArgumentException(sprintf('Encoding "%s" of file "%s" is not supported.', $file['encoding'], $path));
107109
}
108110

0 commit comments

Comments
 (0)