@@ -37,6 +37,9 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | + /** |
|
| 41 | + * @param string $title |
|
| 42 | + */ |
|
| 40 | 43 | public function setTitle($title) { |
| 41 | 44 | $this->addData('title', $title); |
| 42 | 45 | } |
@@ -142,7 +145,7 @@ discard block |
||
| 142 | 145 | * Evita chamada de um metodo que nao existe |
| 143 | 146 | * @param string $name |
| 144 | 147 | * @param mixed[] $arguments |
| 145 | - * @return boolean |
|
| 148 | + * @return boolean|null |
|
| 146 | 149 | */ |
| 147 | 150 | public function __call($name, $arguments) { |
| 148 | 151 | $this->app->pageNotFound(); |
@@ -53,6 +53,7 @@ |
||
| 53 | 53 | /** |
| 54 | 54 | * Retorna total de caracteres da string UTF-8 |
| 55 | 55 | * @param string |
| 56 | + * @param string $string |
|
| 56 | 57 | * @return int |
| 57 | 58 | */ |
| 58 | 59 | function strLength($string) { |
@@ -64,8 +64,10 @@ |
||
| 64 | 64 | if (is_dir($path)): |
| 65 | 65 | $this->removeAllFiles(); |
| 66 | 66 | return rmdir($path); |
| 67 | - else: |
|
| 67 | + else { |
|
| 68 | + : |
|
| 68 | 69 | return false; |
| 70 | + } |
|
| 69 | 71 | endif; |
| 70 | 72 | } |
| 71 | 73 | |
@@ -30,7 +30,6 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Cria o diretório para salvar a imagem |
| 33 | - * @param string $pathetorio Caminho do novo diretório |
|
| 34 | 33 | * @param int $chmod permissões deste diretório |
| 35 | 34 | * @return boolean Retorna TRUE caso obtenha algum sucesso |
| 36 | 35 | */ |
@@ -64,7 +63,6 @@ discard block |
||
| 64 | 63 | |
| 65 | 64 | /** |
| 66 | 65 | * Exclui o diretório e os arquivos dentro dele |
| 67 | - * @param string $path |
|
| 68 | 66 | * @return boolean |
| 69 | 67 | */ |
| 70 | 68 | public function remove() { |
@@ -34,105 +34,105 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | class OAuth |
| 36 | 36 | { |
| 37 | - /** |
|
| 38 | - * An instance of the League OAuth Client Provider. |
|
| 39 | - * |
|
| 40 | - * @var AbstractProvider |
|
| 41 | - */ |
|
| 42 | - protected $provider = null; |
|
| 37 | + /** |
|
| 38 | + * An instance of the League OAuth Client Provider. |
|
| 39 | + * |
|
| 40 | + * @var AbstractProvider |
|
| 41 | + */ |
|
| 42 | + protected $provider = null; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * The current OAuth access token. |
|
| 46 | - * |
|
| 47 | - * @var AccessToken |
|
| 48 | - */ |
|
| 49 | - protected $oauthToken = null; |
|
| 44 | + /** |
|
| 45 | + * The current OAuth access token. |
|
| 46 | + * |
|
| 47 | + * @var AccessToken |
|
| 48 | + */ |
|
| 49 | + protected $oauthToken = null; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * The user's email address, usually used as the login ID |
|
| 53 | - * and also the from address when sending email. |
|
| 54 | - * |
|
| 55 | - * @var string |
|
| 56 | - */ |
|
| 57 | - protected $oauthUserEmail = ''; |
|
| 51 | + /** |
|
| 52 | + * The user's email address, usually used as the login ID |
|
| 53 | + * and also the from address when sending email. |
|
| 54 | + * |
|
| 55 | + * @var string |
|
| 56 | + */ |
|
| 57 | + protected $oauthUserEmail = ''; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * The client secret, generated in the app definition of the service you're connecting to. |
|
| 61 | - * |
|
| 62 | - * @var string |
|
| 63 | - */ |
|
| 64 | - protected $oauthClientSecret = ''; |
|
| 59 | + /** |
|
| 60 | + * The client secret, generated in the app definition of the service you're connecting to. |
|
| 61 | + * |
|
| 62 | + * @var string |
|
| 63 | + */ |
|
| 64 | + protected $oauthClientSecret = ''; |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * The client ID, generated in the app definition of the service you're connecting to. |
|
| 68 | - * |
|
| 69 | - * @var string |
|
| 70 | - */ |
|
| 71 | - protected $oauthClientId = ''; |
|
| 66 | + /** |
|
| 67 | + * The client ID, generated in the app definition of the service you're connecting to. |
|
| 68 | + * |
|
| 69 | + * @var string |
|
| 70 | + */ |
|
| 71 | + protected $oauthClientId = ''; |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * The refresh token, used to obtain new AccessTokens. |
|
| 75 | - * |
|
| 76 | - * @var string |
|
| 77 | - */ |
|
| 78 | - protected $oauthRefreshToken = ''; |
|
| 73 | + /** |
|
| 74 | + * The refresh token, used to obtain new AccessTokens. |
|
| 75 | + * |
|
| 76 | + * @var string |
|
| 77 | + */ |
|
| 78 | + protected $oauthRefreshToken = ''; |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * OAuth constructor. |
|
| 82 | - * |
|
| 83 | - * @param array $options Associative array containing |
|
| 84 | - * `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements |
|
| 85 | - */ |
|
| 86 | - public function __construct($options) |
|
| 87 | - { |
|
| 88 | - $this->provider = $options['provider']; |
|
| 89 | - $this->oauthUserEmail = $options['userName']; |
|
| 90 | - $this->oauthClientSecret = $options['clientSecret']; |
|
| 91 | - $this->oauthClientId = $options['clientId']; |
|
| 92 | - $this->oauthRefreshToken = $options['refreshToken']; |
|
| 93 | - } |
|
| 80 | + /** |
|
| 81 | + * OAuth constructor. |
|
| 82 | + * |
|
| 83 | + * @param array $options Associative array containing |
|
| 84 | + * `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements |
|
| 85 | + */ |
|
| 86 | + public function __construct($options) |
|
| 87 | + { |
|
| 88 | + $this->provider = $options['provider']; |
|
| 89 | + $this->oauthUserEmail = $options['userName']; |
|
| 90 | + $this->oauthClientSecret = $options['clientSecret']; |
|
| 91 | + $this->oauthClientId = $options['clientId']; |
|
| 92 | + $this->oauthRefreshToken = $options['refreshToken']; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Get a new RefreshToken. |
|
| 97 | - * |
|
| 98 | - * @return RefreshToken |
|
| 99 | - */ |
|
| 100 | - protected function getGrant() |
|
| 101 | - { |
|
| 102 | - return new RefreshToken(); |
|
| 103 | - } |
|
| 95 | + /** |
|
| 96 | + * Get a new RefreshToken. |
|
| 97 | + * |
|
| 98 | + * @return RefreshToken |
|
| 99 | + */ |
|
| 100 | + protected function getGrant() |
|
| 101 | + { |
|
| 102 | + return new RefreshToken(); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Get a new AccessToken. |
|
| 107 | - * |
|
| 108 | - * @return AccessToken |
|
| 109 | - */ |
|
| 110 | - protected function getToken() |
|
| 111 | - { |
|
| 112 | - return $this->provider->getAccessToken( |
|
| 113 | - $this->getGrant(), |
|
| 114 | - ['refresh_token' => $this->oauthRefreshToken] |
|
| 115 | - ); |
|
| 116 | - } |
|
| 105 | + /** |
|
| 106 | + * Get a new AccessToken. |
|
| 107 | + * |
|
| 108 | + * @return AccessToken |
|
| 109 | + */ |
|
| 110 | + protected function getToken() |
|
| 111 | + { |
|
| 112 | + return $this->provider->getAccessToken( |
|
| 113 | + $this->getGrant(), |
|
| 114 | + ['refresh_token' => $this->oauthRefreshToken] |
|
| 115 | + ); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Generate a base64-encoded OAuth token. |
|
| 120 | - * |
|
| 121 | - * @return string |
|
| 122 | - */ |
|
| 123 | - public function getOauth64() |
|
| 124 | - { |
|
| 125 | - // Get a new token if it's not available or has expired |
|
| 126 | - if (null === $this->oauthToken or $this->oauthToken->hasExpired()) { |
|
| 127 | - $this->oauthToken = $this->getToken(); |
|
| 128 | - } |
|
| 118 | + /** |
|
| 119 | + * Generate a base64-encoded OAuth token. |
|
| 120 | + * |
|
| 121 | + * @return string |
|
| 122 | + */ |
|
| 123 | + public function getOauth64() |
|
| 124 | + { |
|
| 125 | + // Get a new token if it's not available or has expired |
|
| 126 | + if (null === $this->oauthToken or $this->oauthToken->hasExpired()) { |
|
| 127 | + $this->oauthToken = $this->getToken(); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - return base64_encode( |
|
| 131 | - 'user=' . |
|
| 132 | - $this->oauthUserEmail . |
|
| 133 | - "\001auth=Bearer " . |
|
| 134 | - $this->oauthToken . |
|
| 135 | - "\001\001" |
|
| 136 | - ); |
|
| 137 | - } |
|
| 130 | + return base64_encode( |
|
| 131 | + 'user=' . |
|
| 132 | + $this->oauthUserEmail . |
|
| 133 | + "\001auth=Bearer " . |
|
| 134 | + $this->oauthToken . |
|
| 135 | + "\001\001" |
|
| 136 | + ); |
|
| 137 | + } |
|
| 138 | 138 | } |
@@ -27,13 +27,13 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class Exception extends \Exception |
| 29 | 29 | { |
| 30 | - /** |
|
| 31 | - * Prettify error message output. |
|
| 32 | - * |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function errorMessage() |
|
| 36 | - { |
|
| 37 | - return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n"; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Prettify error message output. |
|
| 32 | + * |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function errorMessage() |
|
| 36 | + { |
|
| 37 | + return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n"; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | /** |
| 4 | 4 | * Autoload Controller |
| 5 | 5 | */ |
| 6 | -spl_autoload_register(function ($className) { |
|
| 6 | +spl_autoload_register(function($className) { |
|
| 7 | 7 | $file = BASE_PATH . '/app/' . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php'; |
| 8 | 8 | if (file_exists($file)): |
| 9 | 9 | return require $file; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * Autoload Model |
| 15 | 15 | */ |
| 16 | -spl_autoload_register(function ($className) { |
|
| 16 | +spl_autoload_register(function($className) { |
|
| 17 | 17 | $file = BASE_PATH . '/app/model/' . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php'; |
| 18 | 18 | if (file_exists($file)): |
| 19 | 19 | return require $file; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Autoload Lib |
| 25 | 25 | */ |
| 26 | -spl_autoload_register(function ($className) { |
|
| 26 | +spl_autoload_register(function($className) { |
|
| 27 | 27 | $file = BASE_PATH . '/lib/vendor/' . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php'; |
| 28 | 28 | if (file_exists($file)): |
| 29 | 29 | return require $file; |
@@ -31,7 +31,6 @@ |
||
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Exibe o conteúdo HTML do alerta |
| 34 | - * @param Alert $alert |
|
| 35 | 34 | */ |
| 36 | 35 | public function load() { |
| 37 | 36 | $block = new Block('layout/html/alert', ['alert' => $this]); |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | |
| 42 | 42 | $app->controller->setTitle('My Custom Test Title'); |
| 43 | 43 | |
| 44 | - $app->view->addData('title','My Custom Test Title'); |
|
| 45 | - $this->assertEquals('My Custom Test Title' , $app->view->getTitle()); |
|
| 44 | + $app->view->addData('title', 'My Custom Test Title'); |
|
| 45 | + $this->assertEquals('My Custom Test Title', $app->view->getTitle()); |
|
| 46 | 46 | |
| 47 | 47 | $app->pageNotFound(); |
| 48 | - $this->assertNotEquals('My Custom Test Title' , $app->view->getTitle()); |
|
| 48 | + $this->assertNotEquals('My Custom Test Title', $app->view->getTitle()); |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | } |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function getTitle() { |
| 76 | - if (empty($this->getData('title'))){ |
|
| 76 | + if (empty($this->getData('title'))) { |
|
| 77 | 77 | $this->addData('title', Title::otimize(ucwords(str_replace('-', ' ', $this->app->getPage())))); |
| 78 | 78 | } |
| 79 | 79 | return $this->getData('title'); |