for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Webfactor\Laravel\Backpack\Documents\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Spatie\Fractalistic\ArraySerializer;
class DocumentApiController
{
/**
* Get all documents and return the json response
*
* @return \Illuminate\Http\JsonResponse
\Spatie\Fractal\Fractal
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
*/
public function index(Request $request)
if ($lang = $request->input('lang')) {
\App::setLocale($lang);
}
$model = config('webfactor.documents.model_class');
$documents = $model::all();
if (!$documents || !$documents->count()) {
abort(422);
$transformerClass = config('webfactor.documents.api.transformer');
return fractal($documents, new $transformerClass(), new ArraySerializer());
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.