for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Controllers\Admin;
use App\Models\CategoryModel;
use App\Models\TagsModel;
use Core\AdminController;
class Post extends AdminController
{
/**
* page for new post
*/
public function new()
$this->onlyAdmin();
$categoryModel = new CategoryModel($this->container);
$tagModel = new TagsModel($this->container);
$this->data['categories'] = $categoryModel->getCategories();
$this->data['tags'] = $tagModel->getTags();
$this->renderView('Admin/NewPost');
}
* Lists all the posts
public function list()
* Shows the post to modify and update
* @param $idPost
public function modify($idPost)
$idPost
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function modify(/** @scrutinizer ignore-unused */ $idPost)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
public function createNewPost()
//Security checks
if (!$this->request->isPost()) {
$this->alertBox->setAlert('Only post messages allowed', 'error');
$this->response->redirect('admin');
$posts = $this->container->getRequest()->getDataFull();
//TODO
//Slug, check if duplicate
//Tags, check if duplicate before creating new tag
//Tags, must have created the post and got the id before associating the tags
//grab author from session
echo "<pre>";
var_dump($posts);
var_dump($posts)
die();
exit
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.