PHP code should follow PSR-1 basic coding standard 105

  • Info
  • Codestyle

More information: https://insight.sensiolabs.com/what-we-analyse/php.psr1

  1. /**
  2. * POST /admin/config/saveattribute
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function config_post_saveattribute(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $attribute = str_replace("-", ".", $f3->get("POST.attribute"));
  9. $value = $f3->get("POST.value");
  10. $response = array("error" => null);
  1. /**
  2. * GET /admin/plugins/@id
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function plugin_single(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $this->_userId = $this->_requireAdmin(5);
  9. $plugins = $f3->get("plugins");
  10. if ($plugin = $plugins[$params["id"]]) {
  11. $f3->set("plugin", $plugin);
  1. /**
  2. * GET /admin/users/deleted
  3. * @param \Base $f3
  4. */
  5. public function deleted_users(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3->set("title", $f3->get("dict.users"));
  8. $users = new \Model\User();
  9. $f3->set("users", $users->find("deleted_date IS NOT NULL AND role != 'group'"));
  1. * GET /admin/users/@id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function user_edit(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3->set("title", $f3->get("dict.edit_user"));
  9. $user = new \Model\User();
  10. $user->load($params["id"]);
  1. /**
  2. * GET /admin/users/new
  3. * @param \Base $f3
  4. */
  5. public function user_new(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3->set("title", $f3->get("dict.new_user"));
  8. $f3->set("rand_color", sprintf("#%02X%02X%02X", mt_rand(0, 0xFF), mt_rand(0, 0xFF), mt_rand(0, 0xFF)));
  9. $this->_render("admin/users/edit.html");
  10. }
  1. /**
  2. * POST /admin/users, POST /admin/users/@id
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function user_save(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $security = \Helper\Security::instance();
  9. $user = new \Model\User;
  10. try {
  1. * POST /admin/users/delete/@id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function user_delete(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $user = new \Model\User();
  9. $user->load($params["id"]);
  10. if (!$user->id) {
  11. $f3->reroute("/admin/users");
  1. * POST /admin/users/undelete/@id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function user_undelete(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $user = new \Model\User();
  9. $user->load($params["id"]);
  10. if (!$user->id) {
  11. $f3->reroute("/admin/users");
  1. /**
  2. * POST /admin/groups/new
  3. * @param \Base $f3
  4. */
  5. public function group_new(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3->set("title", $f3->get("dict.groups"));
  8. if ($f3->get("POST")) {
  9. $group = new \Model\User();
  1. * GET /admin/groups/@id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function group_edit(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3->set("title", $f3->get("dict.groups"));
  9. $group = new \Model\User();
  10. $group->load(array("id = ? AND deleted_date IS NULL AND role = 'group'", $params["id"]));
  1. * POST /admin/groups/delete/@id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function group_delete(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $group = new \Model\User();
  9. $group->load($params["id"]);
  10. $group->delete();
  11. if ($f3->get("AJAX")) {
  1. /**
  2. * POST /admin/groups/ajax
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function group_ajax(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if (!$f3->get("AJAX")) {
  9. $f3->error(400);
  10. }
  1. * POST /admin/groups/@id/setmanager/@user_group_id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function group_setmanager(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $db = $f3->get("db.instance");
  9. $group = new \Model\User();
  10. $group->load(array("id = ? AND deleted_date IS NULL AND role = 'group'", $params["id"]));
  1. /**
  2. * POST /admin/sprints/new
  3. * @param \Base $f3
  4. */
  5. public function sprint_new(\Base $f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3->set("title", $f3->get("dict.sprints"));
  8. if ($post = $f3->get("POST")) {
  9. if (empty($post["start_date"]) || empty($post["end_date"])) {
  1. * GET /admin/sprints/@id, POST /admin/sprints/@id
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function sprint_edit(\Base $f3, array $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3->set("title", $f3->get("dict.sprints"));
  9. $sprint = new \Model\Sprint;
  10. $sprint->load($params["id"]);
  1. * Converts an issue into a Redmine API-style multidimensional array
  2. * This isn't pretty.
  3. * @param Detail $issue
  4. * @return array
  5. */
  6. protected function _issueMultiArray(\Model\Issue\Detail $issue)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $casted = $issue->cast();
  9. // Convert ALL the fields!
  10. $result = array();
  1. "issue" => $issue->cast()
  2. ));
  3. }
  4. // Update an existing issue
  5. public function single_put($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $issue = new \Model\Issue;
  8. $issue->load($params["id"]);
  9. if (!$issue->id) {
  1. $this->printJson(array("updated_fields" => $updated, "issue" => $this->_issueMultiArray($issue)));
  2. }
  3. // Get a single issue's details
  4. public function single_get($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  5. {
  6. $issue = new \Model\Issue\Detail;
  7. $issue->load($params["id"]);
  8. if ($issue->id) {
  9. $this->_printJson(array("issue" => $this->_issueMultiArray($issue)));
  1. $f3->error(404);
  2. }
  3. }
  4. // Delete a single issue
  5. public function single_delete($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $issue = new \Model\Issue;
  8. $issue->load($params["id"]);
  9. $issue->delete();
  1. "deleted" => $params["id"]
  2. ));
  3. }
  4. // List issue comments
  5. public function single_comments($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $issue = new \Model\Issue;
  8. $issue->load($params["id"]);
  9. if (!$issue->id) {
  10. $f3->error(404);
  1. $this->_printJson($return);
  2. }
  3. // Add a comment on an issue
  4. public function single_comments_post($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  5. {
  6. $issue = new \Model\Issue;
  7. $issue->load($params["id"]);
  8. if (!$issue->id) {
  9. $f3->error(404);
  1. $tags = $tag->cloud();
  2. $this->_printJson($tags);
  3. }
  4. // List issues by tag
  5. public function tag_single($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $tag = new \Model\Issue\Tag;
  8. $issueIds = $tag->issues($params['tag']);
  9. $return = array();
  10. if ($issueIds) {
  1. }
  2. $this->_printJson($return);
  3. }
  4. // List past sprints
  5. public function sprints_old()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $sprint_model = new \Model\Sprint;
  8. $sprints = $sprint_model->find(array("end_date < ?", $this->now(false)), array("order" => "start_date ASC"));
  9. $return = array();
  10. foreach ($sprints as $sprint) {
  1. /**
  2. * Require an API key. Sends an HTTP 401 if one is not supplied.
  3. * @return int|bool
  4. */
  5. protected function _requireAuth()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $user = new \Model\User();
  1. namespace Controller\Api;
  2. class User extends \Controller\Api
  3. {
  4. protected function user_array(\Model\User $user)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  5. {
  6. $group_id = $user->id;
  7. if ($user->role == 'group') {
  8. $group = new \Model\Custom("user_group");
  1. );
  2. return ($result);
  3. }
  4. public function single_get($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  5. {
  6. if ($params["username"] == "me") {
  7. $user = $f3->get("user_obj");
  8. } else {
  9. $user = new \Model\User();
  1. } else {
  2. $f3->error(404);
  3. }
  4. }
  5. public function single_email($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $user = new \Model\User();
  8. $user->load(array("email = ? AND deleted_date IS NULL", $params["email"]));
  9. if ($user->id) {
  10. $this->_printJson($this->user_array($user));
  1. ));
  2. }
  3. // Gets a list of Uers
  4. public function get_group($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  5. {
  6. $pagLimit = $f3->get("GET.limit") ?: 30;
  7. if ($pagLimit == -1) {
  8. $pagLimit = 100000;
  1. /**
  2. * GET /backlog/old
  3. * @param \Base $f3
  4. */
  5. public function index_old($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $sprint_model = new \Model\Sprint();
  8. $sprints = $sprint_model->find(array("end_date < ?", $this->now(false)), array("order" => "start_date DESC"));
  9. $type = new \Model\Issue\Type;
  1. {
  2. /**
  3. * Force the framework to use the local filesystem cache method if possible
  4. */
  5. protected function _useFileCache()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $f3->set("CACHE", "folder=" . $f3->get("TEMP") . "cache/");
  9. }
  1. * @param string $mime
  2. * @param string $filename
  3. * @param bool $force
  4. * @return int|bool
  5. */
  6. protected function _sendFile($file, $mime = "", $filename = "", $force = true)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if (!is_file($file)) {
  9. return false;
  10. }
  1. *
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function reset_complete($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if ($f3->get("user.id")) {
  9. $f3->reroute("/");
  10. return;
  11. }
  1. /**
  2. * GET|POST /reset/forced
  3. *
  4. * @param \Base $f3
  5. */
  6. public function reset_forced($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $user = new \Model\User;
  9. $user->loadCurrent();
  10. if ($f3->get("POST.password1") != $f3->get("POST.password2")) {
  1. * Collapses whitespace, then trims
  2. *
  3. * @param string $string
  4. * @return string
  5. */
  6. protected function _cleanJson($string)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return trim(preg_replace('/\s+/', ' ', $string));
  9. }
  10. /**
  1. /**
  2. * Build a WHERE clause for issue listings based on the current filters and sort options
  3. *
  4. * @return array
  5. */
  6. protected function _buildFilter()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. $db = $f3->get("db.instance");
  10. $issues = new \Model\Issue\Detail;
  1. * POST /issues/bulk_update
  2. * Update a list of issues
  3. *
  4. * @param \Base $f3
  5. */
  6. public function bulk_update($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $post = $f3->get("POST");
  9. $issue = new \Model\Issue;
  10. if (!empty($post["id"]) && is_array($post["id"])) {
  1. }
  2. /**
  3. * @param \Base $f3
  4. */
  5. public function add_selecttype($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $type = new \Model\Issue\Type;
  8. $f3->set("types", $type->find(null, null, $f3->get("cache_expire.db")));
  9. $f3->set("title", $f3->get("dict.new_n", $f3->get("dict.issues")));
  1. /**
  2. * Save an updated issue
  3. *
  4. * @return \Model\Issue
  5. */
  6. protected function _saveUpdate()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. $post = array_map("trim", $f3->get("POST"));
  10. $issue = new \Model\Issue;
  1. /**
  2. * Create a new issue from $_POST
  3. *
  4. * @return \Model\Issue
  5. */
  6. protected function _saveNew()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. $data = $f3->get("POST");
  10. $originalAuthor = null;
  11. if (!empty($data['author_id']) && $data['author_id'] != $this->_userId) {
  1. * Add a watcher
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function add_watcher($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load(array("id=?", $params["id"]));
  10. if (!$issue->id) {
  11. $f3->error(404);
  1. * Delete a watcher
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function delete_watcher($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load(array("id=?", $params["id"]));
  10. if (!$issue->id) {
  11. $f3->error(404);
  1. * Add a dependency
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function add_dependency($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load(array("id=?", $params["id"]));
  10. if (!$issue->id) {
  11. $f3->error(404);
  1. * Delete a dependency
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function delete_dependency($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load(array("id=?", $params["id"]));
  10. if (!$issue->id) {
  11. $f3->error(404);
  1. * AJAX call for issue history
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function single_history($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. // Build updates array
  9. $updates_array = array();
  10. $update_model = new \Model\Custom("issue_update_detail");
  11. $updates = $update_model->find(array("issue_id = ?", $params["id"]), array("order" => "created_date DESC, id DESC"));
  1. *
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function single_related($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load($params["id"]);
  10. if ($issue->id) {
  1. * AJAX call for issue watchers
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function single_watchers($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $watchers = new \Model\Custom("issue_watcher_user");
  9. $f3->set("watchers", $watchers->find(array("issue_id = ?", $params["id"])));
  10. $users = new \Model\User;
  11. $f3->set("users", $users->find("deleted_date IS NULL AND role != 'group'", array("order" => "name ASC")));
  1. *
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function single_dependencies($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load($params["id"]);
  10. if ($issue->id) {
  1. *
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function single_delete($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load($params["id"]);
  10. $user = $f3->get("user_obj");
  11. if ($user->role == "admin" || $user->rank >= \Model\User::RANK_MANAGER || $issue->author_id == $user->id) {
  1. *
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function single_undelete($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $issue = new \Model\Issue;
  9. $issue->load($params["id"]);
  10. $user = $f3->get("user_obj");
  11. if ($user->role == "admin" || $user->rank >= \Model\User::RANK_MANAGER || $issue->author_id == $user->id) {
  1. * Save a comment
  2. *
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function comment_save($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $post = $f3->get("POST");
  9. $issue = new \Model\Issue;
  10. $issue->load($post["issue_id"]);
  1. * Delete a comment
  2. *
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function comment_delete($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $this->_requireAdmin();
  9. $comment = new \Model\Issue\Comment;
  10. $comment->load($f3->get("POST.id"));
  11. $comment->delete();
  1. * Delete a file
  2. *
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function file_delete($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $file = new \Model\Issue\File;
  9. $file->load($f3->get("POST.id"));
  10. $file->delete();
  11. $this->_printJson($file->cast());
  1. * Un-delete a file
  2. *
  3. * @param \Base $f3
  4. * @throws \Exception
  5. */
  6. public function file_undelete($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $file = new \Model\Issue\File;
  9. $file->load($f3->get("POST.id"));
  10. $file->deleted_date = null;
  11. $file->save();
  1. * Build an issue search query WHERE clause
  2. *
  3. * @param string $q User query string
  4. * @return array [string, keyword, ...]
  5. */
  6. protected function _buildSearchWhere($q)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if (!$q) {
  9. return array("deleted_date IS NULL");
  10. }
  11. $return = array();
  1. * Project Overview action
  2. *
  3. * @param \Base $f3
  4. * @param array $params
  5. */
  6. public function project_overview($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. // Load issue
  9. $project = new \Model\Issue\Detail;
  10. $project->load($params["id"]);
  11. if (!$project->id) {
  1. * GET /issues/parent_ajax
  2. * Load all matching issues
  3. *
  4. * @param \Base $f3
  5. */
  6. public function parent_ajax($f3)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if (!$f3->get("AJAX")) {
  9. $f3->error(400);
  10. }
in app/controller.php, line 11
  1. /**
  2. * Require a user to be logged in. Redirects to /login if a session is not found.
  3. * @param int $rank
  4. * @return int|bool
  5. */
  6. protected function _requireLogin($rank = \Model\User::RANK_CLIENT)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. if ($id = $f3->get("user.id")) {
  10. if ($f3->get("user.rank") >= $rank) {
  11. return $id;
in app/controller.php, line 51
  1. /**
  2. * Require a user to be an administrator. Throws HTTP 403 if logged in, but not an admin.
  3. * @param int $rank
  4. * @return int|bool
  5. */
  6. protected function _requireAdmin($rank = \Model\User::RANK_ADMIN)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $id = $this->_requireLogin();
  9. $f3 = \Base::instance();
  10. if ($f3->get("user.role") == "admin" && $f3->get("user.rank") >= $rank) {
in app/controller.php, line 72
  1. * @param string $file
  2. * @param string $mime
  3. * @param array $hive
  4. * @param integer $ttl
  5. */
  6. protected function _render($file, $mime = "text/html", array $hive = null, $ttl = 0)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. echo \Helper\View::instance()->render($file, $mime, $hive, $ttl);
  9. }
  10. /**
in app/controller.php, line 81
  1. /**
  2. * Output object as JSON and set appropriate headers
  3. * @param mixed $object
  4. */
  5. protected function _printJson($object)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. if (!headers_sent()) {
  8. header("Content-type: application/json");
  9. }
  10. echo json_encode($object);
  1. /**
  2. * Get a list of users from a filter
  3. * @param string $params URL Parameters
  4. * @return array
  5. */
  6. protected function _filterUsers($params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if ($params["filter"] == "groups") {
  9. $group_model = new \Model\User\Group();
  10. $groups_result = $group_model->find(array("user_id = ?", $this->_userId));
  11. $filter_users = array($this->_userId);
  1. /**
  2. * Get array of theme names
  3. * @return array
  4. */
  5. private function _loadThemes()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $themes = array("bootstrap.min");
  8. foreach (glob("css/bootstrap-*.css") as $file) {
  9. $themes[] = pathinfo($file, PATHINFO_FILENAME);
  10. }
  1. * Convert a flat issue array to a tree array. Child issues are added to
  2. * the 'children' key in each issue.
  3. * @param array $array Flat array of issues, including all parents needed
  4. * @return array Tree array where each issue contains its child issues
  5. */
  6. protected function _buildTree($array)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $tree = array();
  9. // Create an associative array with each key being the ID of the item
  10. foreach ($array as $k => &$v) {
  1. *
  2. * @param \Base $f3
  3. * @param array $params
  4. * @throws \Exception
  5. */
  6. public function single_tree($f3, $params)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $this->_requireLogin();
  9. $user = new \Model\User;
  10. $user->load(array("username = ? AND deleted_date IS NULL", $params["username"]));
  1. ),
  2. array("order" => $this->_order)
  3. );
  4. }
  5. public function repeat_work()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $ownerString = implode(",", $this->getOwnerIds());
  8. return $this->getIssue()->find(
  9. "owner_id IN ($ownerString) AND deleted_date IS NULL AND closed_date IS NULL AND status_closed = 0 AND repeat_cycle IS NOT NULL",
  10. array("order" => $this->_order)
  1. ),
  2. array("order" => $this->_order)
  3. );
  4. }
  5. public function my_comments()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $comment = new \Model\Issue\Comment\Detail;
  9. return $comment->find(array("user_id = ? AND issue_deleted_date IS NULL", $f3->get("user.id")), array("order" => "created_date DESC", "limit" => 10));
  10. }
  1. $f3 = \Base::instance();
  2. $comment = new \Model\Issue\Comment\Detail;
  3. return $comment->find(array("user_id = ? AND issue_deleted_date IS NULL", $f3->get("user.id")), array("order" => "created_date DESC", "limit" => 10));
  4. }
  5. public function recent_comments()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $issue = new \Model\Issue;
  9. $ownerString = implode(",", $this->getOwnerIds());
  1. $issueIds = implode(",", $ids);
  2. $comment = new \Model\Issue\Comment\Detail;
  3. return $comment->find(array("issue_id IN ($issueIds) AND user_id != ?", $f3->get("user.id")), array("order" => "created_date DESC", "limit" => 15));
  4. }
  5. public function open_comments()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $issue = new \Model\Issue;
  9. $ownerString = implode(",", $this->getOwnerIds());
  1. /**
  2. * Get data for Issue Tree widget
  3. * @return array
  4. */
  5. public function issue_tree()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $userId = $f3->get("this_user") ? $f3->get("this_user")->id : $f3->get("user.id");
  9. // Load assigned issues
  1. * Convert a flat issue array to a tree array. Child issues are added to
  2. * the 'children' key in each issue.
  3. * @param array $array Flat array of issues, including all parents needed
  4. * @return array Tree array where each issue contains its child issues
  5. */
  6. protected function _buildTree($array)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $tree = array();
  9. // Create an associative array with each key being the ID of the item
  10. foreach ($array as $k => &$v) {
  1. /**
  2. * Send an email to watchers with the comment body
  3. * @param int $issue_id
  4. * @param int $comment_id
  5. */
  6. public function issue_comment($issue_id, $comment_id)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. if ($f3->get("mail.from")) {
  10. $log = new \Log("mail.log");
  1. /**
  2. * Send an email to watchers detailing the updated fields
  3. * @param int $issue_id
  4. * @param int $update_id
  5. */
  6. public function issue_update($issue_id, $update_id)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. if ($f3->get("mail.from")) {
  10. $log = new \Log("mail.log");
  1. /**
  2. * Send an email to watchers detailing the updated fields
  3. * @param int $issue_id
  4. */
  5. public function issue_create($issue_id)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $f3 = \Base::instance();
  8. $log = new \Log("mail.log");
  9. if ($f3->get("mail.from")) {
  10. $log = new \Log("mail.log");
  1. /**
  2. * Send an email to watchers with the file info
  3. * @param int $issue_id
  4. * @param int $file_id
  5. */
  6. public function issue_file($issue_id, $file_id)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. if ($f3->get("mail.from")) {
  10. $log = new \Log("mail.log");
  1. /**
  2. * Send a user a password reset email
  3. * @param int $user_id
  4. * @param string $token
  5. */
  6. public function user_reset($user_id, $token)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. if ($f3->get("mail.from")) {
  10. $user = new \Model\User;
  11. $user->load($user_id);
  1. * @param \Model\User $user
  2. * @param array $due
  3. * @param array $overdue
  4. * @return bool
  5. */
  6. public function user_due_issues(\Model\User $user, array $due, array $overdue)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. if ($f3->get("mail.from")) {
  10. $f3->set("due", $due);
  11. $f3->set("overdue", $overdue);
  1. /**
  2. * Get array of email addresses of all watchers on an issue
  3. * @param int $issue_id
  4. * @return array
  5. */
  6. protected function _issue_watchers($issue_id)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $db = \Base::instance()->get("db.instance");
  9. $recipients = array();
  10. // Add issue author and owner
  1. * @param string $mime
  2. * @param array $hive
  3. * @param integer $ttl
  4. * @return string
  5. */
  6. protected function _render($file, $mime = "text/html", array $hive = null, $ttl = 0)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return \Helper\View::instance()->render($file, $mime, $hive, $ttl);
  9. }
  10. }
  1. /**
  2. * Generate a secure SHA1 salt for hasing
  3. * @return string
  4. */
  5. public function salt_sha1()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. return sha1($this->randBytes(64));
  8. }
  9. /**
  1. /**
  2. * Generate a secure SHA-256/384/512 salt
  3. * @param integer $size 256, 384, or 512
  4. * @return string
  5. */
  6. public function salt_sha2($size = 256)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $allSizes = array(256, 384, 512);
  9. if (!in_array($size, $allSizes)) {
  10. throw new \Exception("Hash size must be one of: " . implode(", ", $allSizes));
  11. }
in app/helper/view.php, line 96
  1. /**
  2. * Replaces IDs with links to their corresponding issues
  3. * @param string $str
  4. * @return string
  5. */
  6. protected function _parseIds($str)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $url = \Base::instance()->get("site.url");
  9. // Find all IDs
  10. $count = preg_match_all("/(?<=[^a-z\\/&]#|^#)[0-9]+(?=[^a-z\\/]|$)/i", $str, $matches);
in app/helper/view.php, line 142
  1. /**
  2. * Replaces hashtags with links to their corresponding tag pages
  3. * @param string $str
  4. * @return string
  5. */
  6. protected function _parseHashtags($str)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return preg_replace_callback("/(?<=[^a-z\\/&]|^)#([a-z][a-z0-9_-]*[a-z0-9]+)(?=[^a-z\\/]|$)/i", function ($matches) {
  9. $url = \Base::instance()->get("site.url");
  10. $tag = preg_replace("/[_-]+/", "-", $matches[1]);
  11. return "<a href=\"{$url}tag/$tag\">#$tag</a>";
in app/helper/view.php, line 156
  1. /**
  2. * Replaces URLs with links
  3. * @param string $str
  4. * @return string
  5. */
  6. protected function _parseUrls($str)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $str = ' ' . $str;
  9. // In testing, using arrays here was found to be faster
  10. $str = preg_replace_callback('#([\s>])([\w]+?://[\w\\x80-\\xff\#!$%&~/.\-;:=,?@\[\]+]*)#is', function ($matches) {
in app/helper/view.php, line 209
  1. /**
  2. * Replaces text emoticons with Emoji versions
  3. * @param string $str
  4. * @return string
  5. */
  6. protected function _parseEmoticons($str)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. // Custom Emoji map, based on UTF::emojify
  9. $map = [
  10. ':(' => "\xF0\x9F\x99\x81", // frown
  11. ':)' => "\xF0\x9F\x99\x82", // smile
in app/helper/view.php, line 240
  1. /**
  2. * Passes a string through the Textile parser
  3. * @param string $str
  4. * @return string
  5. */
  6. protected function _parseTextile($str, $escape = true)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $tex = new \Netcarver\Textile\Parser('html5');
  9. $tex->setDimensionlessImages(true);
  10. $tex->setRestricted($escape);
  11. return $tex->parse($str);
in app/helper/view.php, line 253
  1. /**
  2. * Passes a string through the Markdown parser
  3. * @param string $str
  4. * @return string
  5. */
  6. protected function _parseMarkdown($str, $escape = true)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $mkd = new \Parsedown();
  9. $mkd->setUrlsLinked(false);
  10. $mkd->setMarkupEscaped($escape);
  11. return $mkd->text($str);
  1. * Find dependency issues by issue_id
  2. * @param int $issue_id
  3. * @param string $orderby
  4. * @return array
  5. */
  6. public function findby_issue($issue_id, $orderby = 'due_date')

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return $this->db->exec(
  9. 'SELECT d.id as d_id,i.id, i.name, i.start_date, i.due_date, i.status_closed, i.author_name, i.author_username, i.owner_name, i.owner_username, i.status_name, i.status, d.dependency_type '.
  10. 'FROM issue_detail i JOIN issue_dependency d on i.id = d.dependency_id '.
  11. 'WHERE d.issue_id = :issue_id AND i.deleted_date IS NULL '.
  1. * Find dependent issues by issue_id
  2. * @param int $issue_id
  3. * @param string $orderby
  4. * @return array
  5. */
  6. public function findby_dependent($issue_id, $orderby = 'due_date')

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return $this->db->exec(
  9. 'SELECT d.id as d_id, i.id, i.name, i.start_date, i.due_date, i.status_closed, i.author_name, i.author_username, i.owner_name, i.owner_username, i.status_name, i.status, d.dependency_type '.
  10. 'FROM issue_detail i JOIN issue_dependency d on i.id = d.issue_id '.
  11. 'WHERE d.dependency_id = :issue_id AND i.deleted_date IS NULL '.
in app/model/issue.php, line 146
  1. /**
  2. * Delete a complete issue tree
  3. * @return Issue
  4. */
  5. protected function _deleteTree()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $children = $this->find(array("parent_id = ?", $this->id));
  8. foreach ($children as $child) {
  9. $child->delete();
  10. }
in app/model/issue.php, line 173
  1. /**
  2. * Restore a complete issue tree
  3. * @return Issue
  4. */
  5. protected function _restoreTree()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $children = $this->find(array("parent_id = ? AND deleted_date IS NOT NULL", $this->id));
  8. foreach ($children as $child) {
  9. $child->restore();
  10. }
in app/model/issue.php, line 258
  1. /**
  2. * Log and save an issue update
  3. * @param boolean $notify
  4. * @return Issue\Update
  5. */
  6. protected function _saveUpdate($notify = true)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $f3 = \Base::instance();
  9. // Ensure issue is not tied to itself as a parent
  10. if ($this->id == $this->parent_id) {
in app/model/issue.php, line 464
  1. * Duplicate a complete issue tree, starting from a duplicated issue created by duplicate()
  2. * @param int $id
  3. * @param int $new_id
  4. * @return Issue $this
  5. */
  6. protected function _duplicateTree($id, $new_id)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. // Find all child issues
  9. $children = $this->find(array("parent_id = ?", $id));
  10. if (count($children)) {
  11. $f3 = \Base::instance();
  1. * Find watched issues by user ID
  2. * @param int $user_id
  3. * @param string $orderby
  4. * @return array
  5. */
  6. public function findby_watcher($user_id, $orderby = 'id')

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return $this->db->exec(
  9. 'SELECT i.* FROM issue_detail i JOIN issue_watcher w on i.id = w.issue_id '.
  10. 'WHERE w.user_id = :user_id AND i.deleted_date IS NULL AND i.closed_date IS NULL AND i.status_closed = 0 AND i.owner_id != :user_id2 '.
  11. 'ORDER BY :orderby ',
in app/model.php, line 123
  1. * the from and to dates in YYYY-MM-DD format.
  2. * @param string $strDateFrom
  3. * @param string $strDateTo
  4. * @return array
  5. */
  6. protected function _createDateRangeArray($dateFrom, $dateTo)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. $range = array();
  9. $from = strtotime($dateFrom);
  10. $to = strtotime($dateTo);
in app/model.php, line 146
  1. /**
  2. * Get most recent value of field
  3. * @param string $key
  4. * @return mixed
  5. */
  6. protected function _getPrev($key)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if (!$this->query) {
  9. return null;
  10. }
  11. $prev_fields = $this->query[count($this->query) - 1]->fields;
in app/model/user.php, line 332
  1. $issue->save();
  2. }
  3. return count($issues);
  4. }
  5. public function date_picker()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $lang = $this->language ?: \Base::instance()->get("LANGUAGE");
  8. return (object) array("language" => $lang, "js" => ($lang != "en"));
  9. }
in app/plugin.php, line 12
  1. protected $_meta;
  2. /**
  3. * Initialize the plugin including any hooks
  4. */
  5. abstract public function _load();

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. /**
  7. * Runs installation code required for plugin, if any is required
  8. *
  9. * This method is called if _installed() returns false
in app/plugin.php, line 19
  1. /**
  2. * Runs installation code required for plugin, if any is required
  3. *
  4. * This method is called if _installed() returns false
  5. */
  6. public function _install()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. }
  9. /**
  10. * Check if plugin is installed
in app/plugin.php, line 29
  1. * Check if plugin is installed
  2. *
  3. * The return value of this method should be cached when possible
  4. * @return bool
  5. */
  6. public function _installed()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. return true;
  9. }
  10. /**
in app/plugin.php, line 42
  1. * @link http://www.phproject.org/plugins.html
  2. * @param string $hook
  3. * @param callable $action
  4. * @return Plugin
  5. */
  6. final protected function _hook($hook, callable $action)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. \Helper\Plugin::instance()->addHook($hook, $action);
  9. return $this;
  10. }
in app/plugin.php, line 56
  1. * @param string $title
  2. * @param string $match Optional regex, will highlight if the URL matches
  3. * @param string $location Optional location, valid values: 'root', 'user', 'new', 'browse'
  4. * @return Plugin
  5. */
  6. final protected function _addNav($href, $title, $match = null, $location = 'root')

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. \Helper\Plugin::instance()->addNavItem($href, $title, $match, $location);
  9. return $this;
  10. }
in app/plugin.php, line 69
  1. * @param string $value Code or file path
  2. * @param string $type Whether to include as "code" or a "file"
  3. * @param string $match Optional regex, will include if the URL matches
  4. * @return Plugin
  5. */
  6. final protected function _addJs($value, $type = "code", $match = null)

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  7. {
  8. if ($type == "file") {
  9. \Helper\Plugin::instance()->addJsFile($value, $match);
  10. } else {
  11. \Helper\Plugin::instance()->addJsCode($value, $match);
in app/plugin.php, line 93
  1. /**
  2. * Get plugin's metadata including author, package, version, etc.
  3. * @return array
  4. */
  5. final public function _meta()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. if ($this->_meta) {
  8. return $this->_meta;
  9. }
in app/plugin.php, line 118
  1. /**
  2. * Get plugin's package name
  3. * @return string
  4. */
  5. final public function _package()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $meta = $this->_meta();
  8. return $meta["package"];
  9. }
in app/plugin.php, line 128
  1. /**
  2. * Get plugin's version number, if any
  3. * @return string
  4. */
  5. final public function _version()

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Alan Hardman
  6. {
  7. $meta = $this->_meta();
  8. return $meta["version"];
  9. }
  10. }