for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yab\FlightDeck;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
class FlightDeck
{
/**
* Generate an authorization token
*
* @param string $name
* @param string $expires_at
* @param integer $length
* @return string
*/
public static function generate(string $name, string $expires_at = null, int $length = 60) : string
$token = Str::random($length);
DB::table('api_tokens')->insert([
'name' => $name,
'token' => $token,
'expires_at' => $expires_at ?? now()->addDays(config('flightdeck.tokens.expire_days')),
]);
return $token;
}
* Check if the token is valid
* @param string $token
$token
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @return boolean
public static function checkToken(string $api_token = null) : bool
$token = DB::table('api_tokens')
->where('token', $api_token)
->where('expires_at', '>', now()->toDateTimeString())
->first();
if ($token) {
return true;
return false;
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.