This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 Mozammil\Putio\Endpoints; |
||
4 | |||
5 | use Mozammil\Putio\Http\Client; |
||
6 | |||
7 | class Feeds |
||
8 | { |
||
9 | /** |
||
10 | * The Http Client. |
||
11 | * |
||
12 | * @var \Mozammil\Putio\Http\Client |
||
13 | */ |
||
14 | protected $client; |
||
15 | |||
16 | public function __construct(Client $client) |
||
17 | { |
||
18 | $this->client = $client; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Creates an RSS feed with the given parameters. |
||
23 | * |
||
24 | * @param string $title Title of the RSS feed as will appear on the site |
||
25 | * @param string $rss_source_url The URL of the RSS feed to be watched |
||
26 | * @param int $parent_dir_id The file ID of the folder to place the RSS feed files in |
||
27 | * @param bool $delete_old_files Should old files in the folder be deleted when space is low |
||
28 | * @param bool $dont_process_whole_feed Should the current items in the feed, at creation time, be ignored |
||
29 | * @param array $keywords Only items with titles that contain any of these words will be transferred |
||
30 | * @param array $unwanted_keywords No items with titles that contain any of these words will be transferred |
||
31 | * @param bool $paused Should the RSS feed be created in the paused state |
||
32 | * |
||
33 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
34 | * |
||
35 | * @see https://api.put.io/v2/docs/feeds.html#post--rss-create |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | View Code Duplication | public function create( |
|
0 ignored issues
–
show
|
|||
40 | string $title, |
||
41 | string $rss_source_url, |
||
42 | int $parent_dir_id = 0, |
||
43 | bool $delete_old_files = false, |
||
44 | bool $dont_process_whole_feed = false, |
||
45 | array $keywords = [], |
||
46 | array $unwanted_keywords = [], |
||
47 | bool $paused = false |
||
48 | ) { |
||
49 | return $this->client->post('rss/create', [ |
||
50 | 'form_params' => [ |
||
51 | 'title' => $title, |
||
52 | 'rss_source_url' => $rss_source_url, |
||
53 | 'parent_dir_id' => $parent_dir_id, |
||
54 | 'delete_old_files' => $delete_old_files, |
||
55 | 'dont_process_whole_feed' => $dont_process_whole_feed, |
||
56 | 'keywords' => count($keywords) ? implode(',', $keywords) : null, |
||
57 | 'unwanted_keywords' => count($unwanted_keywords) ? implode(',', $unwanted_keywords) : null, |
||
58 | 'paused' => $paused, |
||
59 | ], |
||
60 | ]); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Lists RSS feeds. |
||
65 | * |
||
66 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
67 | * |
||
68 | * @see https://api.put.io/v2/docs/feeds.html#get--rss-list |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function list() |
||
73 | { |
||
74 | return $this->client->get('rss/list'); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Gives detailed information about the given feed id. |
||
79 | * |
||
80 | * @param int $id |
||
81 | * |
||
82 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
83 | * |
||
84 | * @see https://api.put.io/v2/docs/feeds.html#get--rss-list |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function get(int $id) |
||
89 | { |
||
90 | return $this->client->get(sprintf('rss/%d', $id)); |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * Updates an RSS feed with the given parameters. |
||
95 | * |
||
96 | * @param int $id Id of the RSS feed to be updated |
||
97 | * @param string $title Title of the RSS feed as will appear on the site |
||
98 | * @param string $rss_source_url The URL of the RSS feed to be watched |
||
99 | * @param int $parent_dir_id The file ID of the folder to place the RSS feed files in |
||
100 | * @param bool $delete_old_files Should old files in the folder be deleted when space is low |
||
101 | * @param bool $dont_process_whole_feed Should the current items in the feed, at creation time, be ignored |
||
102 | * @param array $keywords Only items with titles that contain any of these words will be transferred |
||
103 | * @param array $unwanted_keywords No items with titles that contain any of these words will be transferred |
||
104 | * @param bool $paused Should the RSS feed be created in the paused state |
||
105 | * |
||
106 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
107 | * |
||
108 | * @see https://api.put.io/v2/docs/feeds.html#update |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | View Code Duplication | public function update( |
|
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. ![]() |
|||
113 | int $id, |
||
114 | string $title, |
||
115 | string $rss_source_url, |
||
116 | int $parent_dir_id = 0, |
||
117 | bool $delete_old_files = false, |
||
118 | bool $dont_process_whole_feed = false, |
||
119 | array $keywords = [], |
||
120 | array $unwanted_keywords = [], |
||
121 | bool $paused = false |
||
122 | ) { |
||
123 | return $this->client->post(sprintf('rss/%d', $id), [ |
||
124 | 'form_params' => [ |
||
125 | 'title' => $title, |
||
126 | 'rss_source_url' => $rss_source_url, |
||
127 | 'parent_dir_id' => $parent_dir_id, |
||
128 | 'delete_old_files' => $delete_old_files, |
||
129 | 'dont_process_whole_feed' => $dont_process_whole_feed, |
||
130 | 'keywords' => count($keywords) ? implode(',', $keywords) : null, |
||
131 | 'unwanted_keywords' => count($unwanted_keywords) ? implode(',', $unwanted_keywords) : null, |
||
132 | 'paused' => $paused, |
||
133 | ], |
||
134 | ]); |
||
135 | } |
||
136 | |||
137 | /** |
||
138 | * Pauses the RSS feed, so that it is not polled for new items anymore. |
||
139 | * |
||
140 | * @param int $id |
||
141 | * |
||
142 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
143 | * |
||
144 | * @see https://api.put.io/v2/docs/feeds.html#post--rss--feed_id--pause |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function pause(int $id) |
||
149 | { |
||
150 | return $this->client->post(sprintf('rss/%d/pause', $id)); |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * Resumes the RSS feed, so that it starts being polled for new items again. |
||
155 | * |
||
156 | * @param int $id |
||
157 | * |
||
158 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
159 | * |
||
160 | * @see https://api.put.io/v2/docs/feeds.html#post--rss--feed_id--resume |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | public function resume(int $id) |
||
165 | { |
||
166 | return $this->client->post(sprintf('rss/%d/resume', $id)); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * Deletes given RSS feed. |
||
171 | * |
||
172 | * @param int $id |
||
173 | * |
||
174 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
175 | * |
||
176 | * @see https://api.put.io/v2/docs/feeds.html#post--rss--feed_id--delete |
||
177 | * |
||
178 | * @return string |
||
179 | */ |
||
180 | public function delete(int $id) |
||
181 | { |
||
182 | return $this->client->post(sprintf('rss/%d/delete', $id)); |
||
183 | } |
||
184 | } |
||
185 |
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.