GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (1410)

Security Analysis    not enabled

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.

protected/share/helpers/PriceHelper.php (1 issue)

Severity

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
 * @author Alexey Tatarinov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2014 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 * @package 
8
 */
9
class PriceHelper
10
{
11
  const LONG_DASH = '&mdash;';
12
13
  const ZERO = '0';
14
15
  const EMPTY_SPACE = '';
16
17
  /**
18
   * Проверяет пустое занчение
19
   * Поддерживает тип decimal
20
   * @param integer|string|decimal $value
21
   *
22
   * @return bool
23
   */
24 23
  public static function isEmpty($value)
25
  {
26 23
    $float = floatval($value);
27
28 23
    if( empty($float) )
29 23
      return true;
30
31 15
    return false;
32
  }
33
34
  /**
35
   * Проверяет не пустое занчение
36
   * Поддерживает тип decimal
37
   * @param integer|string|decimal $value
38
   *
39
   * @return bool
40
   */
41 17
  public static function isNotEmpty($value)
42
  {
43 17
    return !self::isEmpty($value);
44
  }
45
46
  /**
47
   * Форматирует цену
48
   * @param $price
49
   * @param string $priceSuffix
50
   * @param string $alternativeText
51
   *
52
   * @return string
53
   */
54 12
  public static function price($price, $priceSuffix = '', $alternativeText = '<span class="call">Звоните</span>')
55
  {
56 12
    return self::isNotEmpty($price) ? self::number($price).$priceSuffix : $alternativeText;
57
  }
58
59
  /**
60
   * Возвращает форматированое по правлам SFormatter число
61
   *
62
   * @param string|integer $number
63
   * @param string $defaultEmpty
64
   *
65
   * @return string
66
   */
67 12
  public static function number($number, $defaultEmpty = self::ZERO)
68
  {
69 12
    return  self::isNotEmpty($number) ? Yii::app()->format->formatNumber($number) : $defaultEmpty;
70
  }
71
72
  /**
73
   * Возврашает разницу цен
74
   * @param $oldPrice
75
   * @param $price
76
   * @param bool $ceil округлять до целого
77
   *
78
   * @return float|int
79
   */
80 2
  public static function getEconomy($oldPrice, $price, $ceil = true)
81
  {
82 2
    $economy = $oldPrice - $price;
83
84
    if( $ceil )
85 2
      $economy = ceil($economy);
86
87 2
    return $economy > 0 ? $economy : 0;
88
  }
89
90
  /**
91
   * Возвращает процент "экономии"
92
   * @param $oldPrice
93
   * @param $price
94
   * @param bool $ceil округлять до целого
95
   *
96
   * @return float
97
   */
98 1
  public static function getEconomyPercent($oldPrice, $price, $ceil = true)
99
  {
100 1
    $economy = self::getEconomy($oldPrice, $price, $ceil);
101
102 1
    return self::isNotEmpty($economy) ? self::getCalcPercent($economy, $oldPrice, $ceil) : 0;
103
  }
104
105
  /**
106
   * Возвращает процент числа $price от числа $ofPrice
107
   *
108
   * @param $price числа
109
   * @param $ofPrice числа
110
   * @param bool $ceil округлять до целого
111
   * @param int $round
112
   *
113
   * @return float процент
114
   */
115 2
  public static function getCalcPercent($price, $ofPrice, $ceil = true, $round = 1)
116
  {
117 2
    $percent = round(($price * 100) / $ofPrice, $round);
118
119
    if( $ceil )
120 2
      $percent = ceil($percent);
121
122 2
    return $percent;
123
  }
124
125
  /**
126
   * Возвращает число процентного соотношения $percent от числа $price
127
   *
128
   * @param $price число
129
   * @param $percent процент
130
   * @param bool $ceil округлять до целого
131
   *
132
   * @return float число
133
   */
134
  public static function getPercent($price, $percent, $ceil = true)
135
  {
136
     $discount = $percent * $price / 100;
137
138
    if( $ceil )
139
      $discount = ceil($discount);
140
141
    return $discount;
142
  }
143
144
  /**
145
   * Преобразует массив decimal во float
146
   * @param $array
147
   *
148
   * @return $array
0 ignored issues
show
The doc-type $array could not be parsed: Unknown type name "$array" 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...
149
   */
150
  public static function decimalToFloat($array)
151
  {
152
    array_walk($array, function(&$value) {
153
      $value = floatval($value);
154
    });
155
156
    return $array;
157
  }
158
159
  /**
160
   * Удалает из цены все символы кроме 0-9 и "."
161
   * @param $price
162
   *
163
   * @return mixed
164
   */
165
  public static function clear($price)
166
  {
167
    return floatval(str_replace(',', '.', preg_replace('/[^0-9,.]/', '', $price)));
168
  }
169
}