Completed
Push — master ( 8260e2...8ffaa6 )
by Nicklas
02:17
created

Comment::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Nicklas\Comment\Modules;
4
5
/**
6
 * A database driven model.
7
 */
8
class Comment extends ActiveRecordModelExtender
9
{
10
11
        /**
12
     * @var string $tableName name of the database table.
13
     */
14
    protected $tableName = "ramverk1_comments";
15
16
    /**
17
     * Columns in the table.
18
     *
19
     * @var integer $id primary key auto incremented.
20
     */
21
    public $id;
22
    public $type; # question/answer/comment
23
    public $parentId; # All posts have different ids
24
25
    public $title;
26
    public $tags;
27
    public $text;
28
29
    public $created;
30
31
    /**
32
     * Returns post with markdown and gravatar
33
     * @param string $sql
34
     * @param array $param
0 ignored issues
show
Documentation introduced by
There is no parameter named $param. Did you maybe mean $params?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
35
     *
36
     * @return array
37
     */
38 2
    public function getComments($sql, $params)
39
    {
40 2
        $comments = $this->findAllWhere("$sql", $params);
41
42 2
        return array_map(function ($comment) {
43 2
            $user = new User($this->db);
44 2
            $user->find("name", $comment->user);
45 2
            $comment->img = $this->gravatar($user->email);
46 2
            $comment->markdown = $this->getMD($comment->text);
47
48 2
            return $comment;
49 2
        }, $comments);
50
    }
51
}
52