From c9e9e72585378e1356473a8ffc1ec1cd9743734e Mon Sep 17 00:00:00 2001 From: crynobone Date: Wed, 3 Sep 2014 17:25:37 +0800 Subject: [PATCH 1/2] Update travis config. Signed-off-by: crynobone --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ca67892..077a39e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php -php: +php: - 5.3 - 5.4 - 5.5 @@ -8,8 +8,8 @@ php: - hhvm before_script: - - composer self-update - - composer require satooshi/php-coveralls:~0.6 --prefer-source --no-interaction --dev + - travis_retry composer self-update + - travis_retry composer require satooshi/php-coveralls:~0.6 --prefer-source --no-interaction --dev script: phpunit -c phpunit.xml --coverage-text @@ -18,6 +18,5 @@ after_script: matrix: allow_failures: - - php: 5.6 - php: hhvm fash_finish: true From 556e0cb664610b860e283fefa932ca989fd3400c Mon Sep 17 00:00:00 2001 From: crynobone Date: Wed, 3 Sep 2014 17:27:01 +0800 Subject: [PATCH 2/2] Improve docblock and update uses. Signed-off-by: crynobone --- src/Auth/Acl/Container.php | 36 ++++++++++++++--------------- src/Auth/Acl/Environment.php | 5 ++-- src/Auth/Acl/Fluent.php | 21 +++++++++-------- src/Auth/AuthServiceProvider.php | 3 ++- src/Auth/CommandServiceProvider.php | 3 ++- 5 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/Auth/Acl/Container.php b/src/Auth/Acl/Container.php index d5085c0..86f881e 100644 --- a/src/Auth/Acl/Container.php +++ b/src/Auth/Acl/Container.php @@ -66,7 +66,7 @@ public function __construct(Guard $auth, $name, Provider $memory = null) * Bind current ACL instance with a Memory instance. * * @param \Orchestra\Memory\Provider $memory - * @return Container + * @return void * @throws \RuntimeException if `\Orchestra\Memory\Provider` has * been attached. */ @@ -89,7 +89,7 @@ public function attach(Provider $memory = null) /** * Initiate acl data from memory. * - * @return Container + * @return $this */ protected function initiate() { @@ -116,7 +116,7 @@ protected function initiate() * Sync memory with acl instance, make sure anything that added before * ->with($memory) got called is appended to memory as well. * - * @return Container + * @return $this */ public function sync() { @@ -138,7 +138,7 @@ public function sync() * actions based on available type of access. * * @param string $action A string of action name - * @return boolean + * @return bool */ public function can($action) { @@ -157,9 +157,9 @@ public function can($action) * Verify whether given roles has sufficient roles to access the * actions based on available type of access. * - * @param string|array $roles A string or an array of roles - * @param string $action A string of action name - * @return boolean + * @param string|array $roles A string or an array of roles + * @param string $action A string of action name + * @return bool * @throws \InvalidArgumentException */ public function check($roles, $action) @@ -189,8 +189,8 @@ public function check($roles, $action) * * @param string|array $roles A string or an array of roles * @param string|array $actions A string or an array of action name - * @param boolean $allow - * @return Container + * @param bool $allow + * @return $this * @throws \InvalidArgumentException */ public function allow($roles, $actions, $allow = true) @@ -212,10 +212,10 @@ public function allow($roles, $actions, $allow = true) /** * Grouped assign actions to have access. * - * @param string $role - * @param array $actions - * @param boolean $allow - * @return boolean + * @param string $role + * @param array $actions + * @param bool $allow + * @return bool * @throws \InvalidArgumentException */ protected function groupedAssignAction($role, array $actions, $allow = true) @@ -234,9 +234,9 @@ protected function groupedAssignAction($role, array $actions, $allow = true) /** * Assign a key combination of $roles + $actions to have access. * - * @param string $roles A key or string representation of roles - * @param string $actions A key or string representation of action name - * @param boolean $allow + * @param string $role A key or string representation of roles + * @param string $action A key or string representation of action name + * @param bool $allow * @return void */ protected function assign($role = null, $action = null, $allow = true) @@ -256,7 +256,7 @@ protected function assign($role = null, $action = null, $allow = true) * * @param string|array $roles A string or an array of roles * @param string|array $actions A string or an array of action name - * @return Container + * @return $this */ public function deny($roles, $actions) { @@ -356,7 +356,7 @@ protected function resolveDynamicExecution($method) * operation was used. * * @param string $operation - * @param boolean $multiple + * @param bool $multiple * @return string */ protected function resolveOperationName($operation, $multiple = true) diff --git a/src/Auth/Acl/Environment.php b/src/Auth/Acl/Environment.php index c770e73..e8d6e96 100644 --- a/src/Auth/Acl/Environment.php +++ b/src/Auth/Acl/Environment.php @@ -22,7 +22,7 @@ class Environment /** * Construct a new Environment. * - * @param \Illuminate\Auth\Guard $auth + * @param \Orchestra\Auth\Guard $auth */ public function __construct(Guard $auth) { @@ -91,7 +91,7 @@ public function __call($method, array $parameters) /** * Shutdown/finish all ACL. * - * @return Environment + * @return $this */ public function finish() { @@ -118,6 +118,7 @@ public function all() /** * Get ACL instance by name. * + * @param string $name * @return Container */ public function get($name) diff --git a/src/Auth/Acl/Fluent.php b/src/Auth/Acl/Fluent.php index b01b468..5de7a91 100644 --- a/src/Auth/Acl/Fluent.php +++ b/src/Auth/Acl/Fluent.php @@ -34,7 +34,8 @@ public function __construct($name) * Add a key to collection. * * @param string $key - * @return boolean + * @return bool + * @throws \InvalidArgumentException */ public function add($key) { @@ -61,7 +62,7 @@ public function add($key) * Add multiple key to collection. * * @param array $keys - * @return boolean + * @return bool */ public function attach(array $keys) { @@ -76,7 +77,7 @@ public function attach(array $keys) * Remove multiple key to collection. * * @param array $keys - * @return boolean + * @return bool */ public function detach(array $keys) { @@ -90,7 +91,7 @@ public function detach(array $keys) /** * Check if an id is set in the collection. * - * @param integer $id + * @param int $id * @return bool */ public function exist($id) @@ -105,7 +106,7 @@ public function exist($id) * * @deprecated * @param array $keys - * @return boolean + * @return bool */ public function fill(array $keys) { @@ -160,7 +161,7 @@ public function get() * Determine whether a key exists in collection. * * @param string $key - * @return boolean + * @return bool */ public function has($key) { @@ -174,7 +175,8 @@ public function has($key) * Remove a key from collection. * * @param string $key - * @return boolean + * @return bool + * @throws \InvalidArgumentException */ public function remove($key) { @@ -195,7 +197,7 @@ public function remove($key) * * @param string $from * @param string $to - * @return boolean + * @return bool */ public function rename($from, $to) { @@ -212,7 +214,7 @@ public function rename($from, $to) * Get the ID from a key. * * @param string $key - * @return integer + * @return int */ public function search($key) { @@ -231,6 +233,7 @@ public function search($key) * Get slug name. * * @param string $name + * @return string */ protected function getSlugFromName($name) { diff --git a/src/Auth/AuthServiceProvider.php b/src/Auth/AuthServiceProvider.php index c7f848e..1d2c1e5 100644 --- a/src/Auth/AuthServiceProvider.php +++ b/src/Auth/AuthServiceProvider.php @@ -1,6 +1,7 @@ app->bindShared('orchestra.acl', function ($app) { - return new Acl\Environment($app['auth']->driver()); + return new Environment($app['auth']->driver()); }); } diff --git a/src/Auth/CommandServiceProvider.php b/src/Auth/CommandServiceProvider.php index 5a8ea89..0f6d194 100644 --- a/src/Auth/CommandServiceProvider.php +++ b/src/Auth/CommandServiceProvider.php @@ -1,6 +1,7 @@ app->bindShared('orchestra.commands.auth', function () { - return new Console\AuthCommand; + return new AuthCommand; }); $this->commands('orchestra.commands.auth');