Product::listProducts()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * This file is part of product_management
4
 * User: Sinan TURGUT <[email protected]>
5
 * Date: 24.06.2019
6
 * php version 7.2
7
 *
8
 * @category Assessment
9
 * @package  ProductManagement
10
 * @author   Sinan TURGUT <[email protected]>
11
 * @license  See LICENSE file
12
 * @link     https://dev.sinanturgut.com.tr
13
 */
14
15
namespace App\Model;
16
17
use Exception;
18
use App\Core;
19
20
/**
21
 * Class Product
22
 * @package App\Model
23
 */
24
class Product extends Core\Model
25
{
26
    /**
27
     * @return |null
0 ignored issues
show
Documentation Bug introduced by
The doc comment |null at position 0 could not be parsed: Unknown type name '|' at position 0 in |null.
Loading history...
28
     */
29
    public static function getInstance()
30
    {
31
        $Rec = new Product();
0 ignored issues
show
Unused Code introduced by
The assignment to $Rec is dead and can be removed.
Loading history...
32
        return null;
33
    }
34
35
    /**
36
     * @param int $start
37
     * @return Product
38
     */
39
    public function listProducts($start = 0)
0 ignored issues
show
Unused Code introduced by
The parameter $start is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

39
    public function listProducts(/** @scrutinizer ignore-unused */ $start = 0)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        return($this->query("select p.*,u.user_name from posts p join users u on p.user_id=u.id order by p.post_date_created desc"));
42
    }
43
44
45
    /**
46
     * @param $productName
47
     * @param $productCategory
48
     * @param $productSummary
49
     * @param $productPrice
50
     * @return Product
51
     */
52
    public function addProduct($productName, $productCategory, $productSummary, $productPrice)
0 ignored issues
show
Unused Code introduced by
The parameter $productSummary is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

52
    public function addProduct($productName, $productCategory, /** @scrutinizer ignore-unused */ $productSummary, $productPrice)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $productName is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

52
    public function addProduct(/** @scrutinizer ignore-unused */ $productName, $productCategory, $productSummary, $productPrice)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $productCategory is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

52
    public function addProduct($productName, /** @scrutinizer ignore-unused */ $productCategory, $productSummary, $productPrice)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $productPrice is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

52
    public function addProduct($productName, $productCategory, $productSummary, /** @scrutinizer ignore-unused */ $productPrice)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
53
    {
54
        return $this->query("INSERT INTO post_titles(post_id,post_title,post_slug)".
55
            " values (".$this->clearSQLParam($id).",'".$this->clearSQLParam($title)."','".$this->clearSQLParam($slug)."')");
56
    }
57
58
}