Issues (24)

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/model/Article.php (3 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
 * Class Article
4
 *
5
 * @author       Denis Shestakov <[email protected]>
6
 * @copyright    Copyright (c) 2017, Lan Publishing
7
 * @license      MIT
8
 */
9
10
namespace Lan\Ebs\Sdk\Model;
11
12
use Exception;
13
use Lan\Ebs\Sdk\Classes\Model;
14
use Lan\Ebs\Sdk\Client;
15
16
/**
17
 * Модель статей
18
 *
19
 * @property mixed name
20
 * @property mixed description
21
 * @property mixed issn
22
 * @property mixed eissn
23
 * @property mixed vac
24
 * @property mixed year
25
 * @property mixed issuesPerYear
26
 * @property mixed editors
27
 * @property mixed publisher
28
 * @property mixed url
29
 *
30
 * @package      Lan\Ebs
31
 * @subpackage   Sdk
32
 * @category     Model
33
 */
34
class Article extends Model
35
{
36
    /**
37
     * Наименование статьи
38
     */
39
    const FIELD_NAME = 'name';
40
41
    /**
42
     * Авторы статьи
43
     */
44
    const FIELD_AUTHORS = 'authors';
45
46
    /**
47
     * Аннотация статьи
48
     */
49
    const FIELD_DESCRIPTION = 'description';
50
51
    /**
52
     * Ключевые слова статьи
53
     */
54
    const FIELD_KEYWORDS = 'keywords';
55
56
    /**
57
     * Страница начала статьи
58
     */
59
    const START_PAGE = 'startPage';
60
61
    /**
62
     * Страница окончания статьи
63
     */
64
    const FINISH_PAGE = 'finishPage';
65
66
    /**
67
     * Библиографическая запись
68
     */
69
    const FIELD_BIBLIOGRAPHIC_RECORD = 'bibliographicRecord';
70
71
    /**
72
     * Конструктор модели пользователя
73
     *
74
     * @param Client $client Инстанс клиента
75
     * @param array $fields Поля для выборки
76
     *
77
     * @throws Exception
78
     */
79
    public function __construct(Client $client, array $fields = array())
80
    {
81
        parent::__construct($client, $fields);
82
    }
83
84
    /**
85
     * Получение текстов статьи
86
     *
87
     * @param int $id Идентификатор модели
88
     *
89
     * @return array
90
     *
91
     * @throws Exception
92
     */
93 View Code Duplication
    public function text($id = null)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
94
    {
95
        if ($id) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $id of type integer|null is loosely compared to true; this is ambiguous if the integer can be zero. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
96
            $this->setId($id);
97
        } else {
98
            $id = $this->getId();
99
        }
100
101
        if (empty($id)) {
102
            throw new Exception(Model::MESSAGE_ID_REQUIRED);
103
        }
104
105
        return $this->getClient()->getResponse($this->getUrl(__FUNCTION__, array($id)))['data'];
106
    }
107
108
    /**
109
     * Получение данных для запроса через API
110
     *
111
     * @param string $method Http-метод запроса
112
     * @param array $params Параметры для формирования урла
113
     *
114
     * @return array
115
     *
116
     * @throws Exception
117
     */
118 View Code Duplication
    public function getUrl($method, array $params = array())
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
119
    {
120
        switch ($method) {
121
            case 'get':
122
                return array(
123
                    'url' => vsprintf('/1.0/resource/journal/article/get/%d', $params),
124
                    'method' => 'GET',
125
                    'code' => 200
126
                );
127
            case 'text':
128
                return array(
129
                    'url' => vsprintf('/1.0/resource/journal/article/text/%d', $params),
130
                    'method' => 'GET',
131
                    'code' => 200
132
                );
133
            default:
134
                throw new Exception('Route for ' . $method . ' not found');
135
        }
136
    }
137
}