Issues (14)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Helper.php (9 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Radowoj\Yaah;
4
5
use Radowoj\Yaah\Constants\SellFormOpts;
6
use Radowoj\Yaah\Journal\Deal;
7
8
class Helper
9
{
10
    protected $client = null;
11
12 21
    public function __construct(Client $client)
13
    {
14 21
        $this->client = $client;
15 21
    }
16
17
    /**
18
     * Get simplified fields list for given category
19
     * @param  integer $idCategory id of category in question
20
     * @return array of fields metadata
21
     */
22 2
    public function getFieldsByCategory($idCategory)
23
    {
24 2
        $data = $this->client->doGetSellFormFieldsForCategory(['categoryId' => $idCategory]);
0 ignored issues
show
Documentation Bug introduced by
The method doGetSellFormFieldsForCategory does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
25
26 2
        if (!isset($data->sellFormFieldsForCategory->sellFormFieldsList->item)) {
27 1
            throw new Exception('Invalid WebAPI response: ' . print_r($data, 1));
28
        }
29
30 1
        $items = $data->sellFormFieldsForCategory->sellFormFieldsList->item;
31
32
        return array_map(function ($item) {
33
            return [
34 1
                'fid' => $item->sellFormId,
35 1
                'title' => $item->sellFormTitle,
36 1
                'required' => ($item->sellFormOpt == SellFormOpts::SELL_FORM_OPT_REQUIRED),
37 1
                'options' => $item->sellFormOptsValues,
38 1
                'optionsDesc' => $item->sellFormDesc,
39 1
            ];
40 1
        }, $items);
41
    }
42
43
    /**
44
     * Create new auction
45
     *
46
     * @throws Exception on failure
47
     *
48
     * @param  Auction $auction Auction to create
49
     * @param integer $localId - local item id, required by WebAPI
50
     * @return integer id of created auction
51
     */
52 2
    public function newAuction(AuctionInterface $auction, $localId)
53
    {
54 2
        $auctionArray = $auction->toApiRepresentation();
55 2
        $auctionArray['localId'] = $localId;
56
57 2
        $this->client->doNewAuctionExt($auctionArray);
0 ignored issues
show
Documentation Bug introduced by
The method doNewAuctionExt does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
58 2
        $resultVerify = $this->client->doVerifyItem(['localId' => $localId]);
0 ignored issues
show
Documentation Bug introduced by
The method doVerifyItem does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
59
60 2
        if (!is_object($resultVerify) || !isset($resultVerify->itemId)) {
61 1
            throw new Exception("Auction has not been created: " . print_r($resultVerify, 1));
62
        }
63
64 1
        return $resultVerify->itemId;
65
    }
66
67
68
    /**
69
     * Finish a single auction
70
     * @param  integer $auctionId itemId of auction to finish
71
     * @param  integer $cancelAllBids whether to cancel all bids
72
     * @param  string  $finishCancelReason reason
73
     * @return array
74
     */
75 4
    public function finishAuction($auctionId, $cancelAllBids = 0, $finishCancelReason = '')
76
    {
77 4
        return $this->finishAuctions((array)($auctionId), $cancelAllBids, $finishCancelReason);
78
    }
79
80
81
    /**
82
     * Finish a single auction
83
     * @param  array $auctionIds itemIds of auctions to finish
84
     * @param  integer $cancelAllBids whether to cancel all bids
85
     * @param  string  $finishCancelReason reason
86
     * @return array
87
     */
88 8
    public function finishAuctions(array $auctionIds, $cancelAllBids = 0, $finishCancelReason = '')
89
    {
90
        $finishItemsList = array_map(function ($auctionId) use ($cancelAllBids, $finishCancelReason) {
91
            return [
92 8
                'finishItemId' => $auctionId,
93 8
                'finishCancelAllBids' => $cancelAllBids,
94 8
                'finishCancelReason' => $finishCancelReason,
95 8
            ];
96 8
        }, $auctionIds);
97
98 8
        return $this->client->doFinishItems(['finishItemsList' => $finishItemsList]);
0 ignored issues
show
Documentation Bug introduced by
The method doFinishItems does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
99
    }
100
101
    /**
102
     * Change quantity of items available in auction
103
     * @param  integer $auctionId   itemId of auction to change quantity
104
     * @param  integer $newQuantity new quantity to set
105
     * @return array
106
     */
107 1
    public function changeQuantity($auctionId, $newQuantity)
108
    {
109 1
        return $this->client->doChangeQuantityItem([
0 ignored issues
show
Documentation Bug introduced by
The method doChangeQuantityItem does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
110 1
            'itemId' => $auctionId,
111
            'newItemQuantity' => $newQuantity
112 1
        ]);
113
    }
114
115
116
    /**
117
     * Return site journal deals
118
     * @param  integer $journalStart start point (dealEventId)
119
     * @return array
120
     */
121 3
    public function getSiteJournalDeals($journalStart = 0)
122
    {
123 3
        $response = $this->client->doGetSiteJournalDeals(['journalStart' => $journalStart]);
0 ignored issues
show
Documentation Bug introduced by
The method doGetSiteJournalDeals does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
124 3
        if (isset($response->siteJournalDeals->item)) {
125 2
            return array_map(function($deal){
126 2
                return new Deal($deal);
127 2
            }, $response->siteJournalDeals->item);
128
        }
129
130 1
        throw new Exception("Unable to get site journal deals: " . print_r($response, 1));
131
    }
132
133
134
    /**
135
     * @param  integer $itemId id of auction to get
136
     * @return Auction | null
137
     */
138 2
    public function getAuctionByItemId($itemId)
139
    {
140 2
        $response =  $this->client->doGetItemFields(['itemId' => $itemId]);
0 ignored issues
show
Documentation Bug introduced by
The method doGetItemFields does not exist on object<Radowoj\Yaah\Client>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
141 2
        if (!isset($response->itemFields->item)) {
142 1
            throw new Exception('Invalid WebAPI response: ' . print_r($response, 1));
143
        }
144
145 1
        $auction = new Auction();
146 1
        $auction->fromApiRepresentation($response->itemFields->item);
147 1
        return $auction;
148
    }
149
150
151
    /**
152
     * Directly call WebAPI method (prefixed by "do")
153
     * @param  string $name method name
154
     * @param  [type] $args method arguments
0 ignored issues
show
The doc-type [type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
155
     * @return [type]       [description]
0 ignored issues
show
The doc-type [type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
156
     */
157 3
    public function __call($name, $args)
158
    {
159 3
        if (strpos($name, 'do') !== 0) {
160 1
            throw new Exception("Method {$name} is not implemented in " . get_class($this));
161
        }
162
163 2
        return call_user_func_array([$this->client, $name], $args);
164
    }
165
166
}
167