Skip to content

Commit

Permalink
some code and doc blocks tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Gaspar <brunofgaspar1@gmail.com>
  • Loading branch information
brunogaspar committed Sep 2, 2014
1 parent bada85a commit 20c9de4
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 66 deletions.
13 changes: 10 additions & 3 deletions src/Persistences/IlluminatePersistenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ class IlluminatePersistenceRepository implements PersistenceRepositoryInterface
/**
* Create a new Sentinel persistence repository.
*
* @param Cartalyst\Sentinel\Sessions\SessionInterface $session
* @param Cartalyst\Sentinel\Cookies\CookieInterface $cookie
* @param \Cartalyst\Sentinel\Sessions\SessionInterface $session
* @param \Cartalyst\Sentinel\Cookies\CookieInterface $cookie
* @param string $model
* @param bool $single
* @return void
*/
public function __construct(SessionInterface $session, CookieInterface $cookie, $model = null, $single = false)
public function __construct(
SessionInterface $session,
CookieInterface $cookie,
$model = null,
$single = false
)
{
if (isset($model))
{
Expand Down
2 changes: 1 addition & 1 deletion src/Roles/RoleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getUsers();
public static function getUsersModel();

/**
* Set the users model.
* Sets the users model.
*
* @param string $usersModel
* @return void
Expand Down
24 changes: 12 additions & 12 deletions src/Sentinel.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Sentinel {
protected $reminders;

/**
* The closure to retrieve request credentials.
* The closure to retrieve the request credentials.
*
* @var \Closure
*/
Expand Down Expand Up @@ -269,7 +269,7 @@ public function forceCheck()
}

/**
* Returns if we are currently a guest.
* Checks if we are currently a guest.
*
* @return \Cartalyst\Sentinel\Users\UserInterface|bool
*/
Expand Down Expand Up @@ -438,7 +438,7 @@ public function getRequestCredentials()
}

/**
* Set the closure which resolves request credentials.
* Sets the closure which resolves the request credentials.
*
* @param \Closure $requestCredentials
* @return void
Expand Down Expand Up @@ -480,7 +480,7 @@ public function getBasicResponse()
}

/**
* Set the callback which creates a basic response.
* Sets the callback which creates a basic response.
*
* @param \Closure $basicResonse
* @return void
Expand Down Expand Up @@ -525,7 +525,7 @@ public function loginAndRemember(UserInterface $user)
}

/**
* Log the current user out.
* Logs the current user out.
*
* @param \Cartalyst\Sentinel\Users\UserInterface $user
* @param bool $everywhere
Expand Down Expand Up @@ -581,7 +581,7 @@ public function bypassCheckpoints(Closure $callback, $checkpoints = [])
}

/**
* Returns if checkpoints are enabled.
* Checks if checkpoints are enabled.
*
* @return bool
*/
Expand Down Expand Up @@ -683,7 +683,7 @@ public function getUser($check = true)
}

/**
* Set the user associated with Sentinel (does not log in).
* Sets the user associated with Sentinel (does not log in).
*
* @param \Cartalyst\Sentinel\Users\UserInterface $user
* @return void
Expand All @@ -704,7 +704,7 @@ public function getUserRepository()
}

/**
* Set the user repository.
* Sets the user repository.
*
* @param \Cartalyst\Sentinel\Users\UserRepositoryInterface $users
* @return void
Expand All @@ -727,7 +727,7 @@ public function getRoleRepository()
}

/**
* Set the role repository.
* Sets the role repository.
*
* @param \Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles
* @return void
Expand All @@ -748,7 +748,7 @@ public function getPersistenceRepository()
}

/**
* Set the persistences repository.
* Sets the persistences repository.
*
* @param \Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences
* @return void
Expand All @@ -769,7 +769,7 @@ public function getActivationRepository()
}

/**
* Set the activations repository.
* Sets the activations repository.
*
* @param \Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations
* @return void
Expand All @@ -790,7 +790,7 @@ public function getReminderRepository()
}

/**
* Set the reminders repository.
* Sets the reminders repository.
*
* @param \Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface $reminders
* @return void
Expand Down
73 changes: 34 additions & 39 deletions src/Throttling/IlluminateThrottleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,6 @@ public function log($ipAddress = null, UserInterface $user = null)
}
}

/**
* Sets the global interval.
*
* @param int $globalInterval
* @return void
*/
public function setGlobalInterval($globalInterval)
{
$this->globalInterval = (int) $globalInterval;
}

/**
* Returns the global interval.
*
Expand All @@ -235,14 +224,14 @@ public function getGlobalInterval()
}

/**
* Sets the global thresholds.
* Sets the global interval.
*
* @param int|array $globalThresholds
* @param int $globalInterval
* @return void
*/
public function setGlobalThresholds($globalThresholds)
public function setGlobalInterval($globalInterval)
{
$this->globalThresholds = is_array($globalThresholds) ? $globalThresholds : (int) $globalThresholds;
$this->globalInterval = (int) $globalInterval;
}

/**
Expand All @@ -256,14 +245,14 @@ public function getGlobalThresholds()
}

/**
* Sets the IP address interval.
* Sets the global thresholds.
*
* @param int $globalThresholds
* @param int|array $globalThresholds
* @return void
*/
public function setIpInterval($ipInterval)
public function setGlobalThresholds($globalThresholds)
{
$this->ipInterval = (int) $ipInterval;
$this->globalThresholds = is_array($globalThresholds) ? $globalThresholds : (int) $globalThresholds;
}

/**
Expand All @@ -277,14 +266,14 @@ public function getIpInterval()
}

/**
* Sets the IP address thresholds.
* Sets the IP address interval.
*
* @param int|array $ipThresholds
* @param int $ipInterval
* @return void
*/
public function setIpThresholds($ipThresholds)
public function setIpInterval($ipInterval)
{
$this->ipThresholds = is_array($ipThresholds) ? $ipThresholds : (int) $ipThresholds;
$this->ipInterval = (int) $ipInterval;
}

/**
Expand All @@ -298,14 +287,14 @@ public function getIpThresholds()
}

/**
* Sets the user interval.
* Sets the IP address thresholds.
*
* @param int $globalThresholds
* @param int|array $ipThresholds
* @return void
*/
public function setUserInterval($userInterval)
public function setIpThresholds($ipThresholds)
{
$this->userInterval = (int) $userInterval;
$this->ipThresholds = is_array($ipThresholds) ? $ipThresholds : (int) $ipThresholds;
}

/**
Expand All @@ -319,14 +308,14 @@ public function getUserInterval()
}

/**
* Sets the user thresholds.
* Sets the user interval.
*
* @param int|array $userThresholds
* @param int $userInterval
* @return void
*/
public function setUserThresholds($userThresholds)
public function setUserInterval($userInterval)
{
$this->userThresholds = is_array($userThresholds) ? $userThresholds : (int) $userThresholds;
$this->userInterval = (int) $userInterval;
}

/**
Expand All @@ -339,6 +328,17 @@ public function getUserThresholds()
return $this->userThresholds;
}

/**
* Sets the user thresholds.
*
* @param int|array $userThresholds
* @return void
*/
public function setUserThresholds($userThresholds)
{
$this->userThresholds = is_array($userThresholds) ? $userThresholds : (int) $userThresholds;
}

/**
* Returns a delay for the given type.
*
Expand Down Expand Up @@ -494,21 +494,16 @@ protected function loadUserThrottles(UserInterface $user)
}

/**
* Returns the seconds to free based on the given throttle
* and the presented delay in seconds, by comparing it to
* now.
* Returns the seconds to free based on the given throttle and
* the presented delay in seconds, by comparing it to now.
*
* @param \Cartalyst\Sentinel\Throttling\EloquentThrottle $throttle
* @param int $interval
* @return int
*/
protected function secondsToFree(EloquentThrottle $throttle, $interval)
{
$free = $throttle
->created_at
->addSeconds($interval);

return $free->diffInSeconds();
return $throttle->created_at->addSeconds($interval)->diffInSeconds();
}

}
20 changes: 10 additions & 10 deletions src/Users/EloquentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function getUserPassword()
}

/**
* Get the roles model.
* Returns the roles model.
*
* @return string
*/
Expand All @@ -300,7 +300,7 @@ public static function getRolesModel()
}

/**
* Set the roles model.
* Sets the roles model.
*
* @param string $rolesModel
* @return void
Expand All @@ -311,7 +311,7 @@ public static function setRolesModel($rolesModel)
}

/**
* Get the persistences model.
* Returns the persistences model.
*
* @return string
*/
Expand All @@ -321,7 +321,7 @@ public static function getPersistencesModel()
}

/**
* Set the persistences model.
* Sets the persistences model.
*
* @param string $persistencesModel
* @return void
Expand All @@ -332,7 +332,7 @@ public static function setPersistencesModel($persistencesModel)
}

/**
* Get the activations model.
* Returns the activations model.
*
* @return string
*/
Expand All @@ -342,7 +342,7 @@ public static function getActivationsModel()
}

/**
* Set the activations model.
* Sets the activations model.
*
* @param string $activationsModel
* @return void
Expand All @@ -353,7 +353,7 @@ public static function setActivationsModel($activationsModel)
}

/**
* Get the reminders model.
* Returns the reminders model.
*
* @return string
*/
Expand All @@ -363,7 +363,7 @@ public static function getRemindersModel()
}

/**
* Set the reminders model.
* Sets the reminders model.
*
* @param string $remindersModel
* @return void
Expand All @@ -374,7 +374,7 @@ public static function setRemindersModel($remindersModel)
}

/**
* Get the throttling model.
* Returns the throttling model.
*
* @return string
*/
Expand All @@ -384,7 +384,7 @@ public static function getThrottlingModel()
}

/**
* Set the throttling model.
* Sets the throttling model.
*
* @param string $throttlingModel
* @return void
Expand Down
2 changes: 1 addition & 1 deletion src/Users/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getUserLogin();
public function getUserLoginName();

/**
* Returns the user passwrd.
* Returns the user password.
*
* @return string
*/
Expand Down

0 comments on commit 20c9de4

Please sign in to comment.