Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like FlexiBeeRO often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use FlexiBeeRO, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class FlexiBeeRO extends \Ease\Brick |
||
17 | { |
||
18 | /** |
||
19 | * Version of FlexiPeeHP library |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | public static $libVersion = '1.6.4.2'; |
||
24 | |||
25 | /** |
||
26 | * Základní namespace pro komunikaci s FlexiBee. |
||
27 | * Basic namespace for communication with FlexiBee |
||
28 | * |
||
29 | * @var string Jmený prostor datového bloku odpovědi |
||
30 | */ |
||
31 | public $nameSpace = 'winstrom'; |
||
32 | |||
33 | /** |
||
34 | * URL of object data in FlexiBee |
||
35 | * @var string url |
||
36 | */ |
||
37 | public $apiURL = null; |
||
38 | |||
39 | /** |
||
40 | * Datový blok v poli odpovědi. |
||
41 | * Data block in response field. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | public $resultField = 'results'; |
||
46 | |||
47 | /** |
||
48 | * Verze protokolu použitého pro komunikaci. |
||
49 | * Communication protocol version used. |
||
50 | * |
||
51 | * @var string Verze použitého API |
||
52 | */ |
||
53 | public $protoVersion = '1.0'; |
||
54 | |||
55 | /** |
||
56 | * Evidence užitá objektem. |
||
57 | * Evidence used by object |
||
58 | * |
||
59 | * @link https://demo.flexibee.eu/c/demo/evidence-list Přehled evidencí |
||
60 | * @var string |
||
61 | */ |
||
62 | public $evidence = null; |
||
63 | |||
64 | /** |
||
65 | * Výchozí formát pro komunikaci. |
||
66 | * Default communication format. |
||
67 | * |
||
68 | * @link https://www.flexibee.eu/api/dokumentace/ref/format-types Přehled možných formátů |
||
69 | * |
||
70 | * @var string json|xml|... |
||
71 | */ |
||
72 | public $format = 'json'; |
||
73 | |||
74 | /** |
||
75 | * formát příchozí odpovědi |
||
76 | * response format |
||
77 | * |
||
78 | * @link https://www.flexibee.eu/api/dokumentace/ref/format-types Přehled možných formátů |
||
79 | * |
||
80 | * @var string json|xml|... |
||
81 | */ |
||
82 | public $responseFormat = 'json'; |
||
83 | |||
84 | /** |
||
85 | * Curl Handle. |
||
86 | * |
||
87 | * @var resource |
||
88 | */ |
||
89 | public $curl = null; |
||
90 | |||
91 | /** |
||
92 | * @link https://demo.flexibee.eu/devdoc/company-identifier Identifikátor firmy |
||
93 | * @var string |
||
94 | */ |
||
95 | public $company = null; |
||
96 | |||
97 | /** |
||
98 | * Server[:port] |
||
99 | * @var string |
||
100 | */ |
||
101 | public $url = null; |
||
102 | |||
103 | /** |
||
104 | * REST API Username |
||
105 | * @var string |
||
106 | */ |
||
107 | public $user = null; |
||
108 | |||
109 | /** |
||
110 | * REST API Password |
||
111 | * @var string |
||
112 | */ |
||
113 | public $password = null; |
||
114 | |||
115 | /** |
||
116 | * @var array Pole HTTP hlaviček odesílaných s každým požadavkem |
||
117 | */ |
||
118 | public $defaultHttpHeaders = ['User-Agent' => 'FlexiPeeHP']; |
||
119 | |||
120 | /** |
||
121 | * Default additional request url parameters after question mark |
||
122 | * |
||
123 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls Common params |
||
124 | * @link https://www.flexibee.eu/api/dokumentace/ref/paging Paging params |
||
125 | * @var array |
||
126 | */ |
||
127 | public $defaultUrlParams = ['limit' => 0]; |
||
128 | |||
129 | /** |
||
130 | * Identifikační řetězec. |
||
131 | * |
||
132 | * @var string |
||
133 | */ |
||
134 | public $init = null; |
||
135 | |||
136 | /** |
||
137 | * Sloupeček s názvem. |
||
138 | * |
||
139 | * @var string |
||
140 | */ |
||
141 | public $nameColumn = 'nazev'; |
||
142 | |||
143 | /** |
||
144 | * Sloupeček obsahující datum vložení záznamu do shopu. |
||
145 | * |
||
146 | * @var string |
||
147 | */ |
||
148 | public $myCreateColumn = 'false'; |
||
149 | |||
150 | /** |
||
151 | * Slopecek obsahujici datum poslení modifikace záznamu do shopu. |
||
152 | * |
||
153 | * @var string |
||
154 | */ |
||
155 | public $myLastModifiedColumn = 'lastUpdate'; |
||
156 | |||
157 | /** |
||
158 | * Klíčový idendifikátor záznamu. |
||
159 | * |
||
160 | * @var string |
||
161 | */ |
||
162 | public $fbKeyColumn = 'id'; |
||
163 | |||
164 | /** |
||
165 | * Informace o posledním HTTP requestu. |
||
166 | * |
||
167 | * @var * |
||
168 | */ |
||
169 | public $curlInfo; |
||
170 | |||
171 | /** |
||
172 | * Informace o poslední HTTP chybě. |
||
173 | * |
||
174 | * @var string |
||
175 | */ |
||
176 | public $lastCurlError = null; |
||
177 | |||
178 | /** |
||
179 | * Used codes storage. |
||
180 | * |
||
181 | * @var array |
||
182 | */ |
||
183 | public $codes = null; |
||
184 | |||
185 | /** |
||
186 | * Last Inserted ID. |
||
187 | * |
||
188 | * @var int |
||
189 | */ |
||
190 | public $lastInsertedID = null; |
||
191 | |||
192 | /** |
||
193 | * Default Line Prefix. |
||
194 | * |
||
195 | * @var string |
||
196 | */ |
||
197 | public $prefix = '/c/'; |
||
198 | |||
199 | /** |
||
200 | * Raw Content of last curl response |
||
201 | * |
||
202 | * @var string |
||
203 | */ |
||
204 | public $lastCurlResponse; |
||
205 | |||
206 | /** |
||
207 | * HTTP Response code of last request |
||
208 | * |
||
209 | * @var int |
||
210 | */ |
||
211 | public $lastResponseCode = null; |
||
212 | |||
213 | /** |
||
214 | * Body data for next curl POST operation |
||
215 | * |
||
216 | * @var string |
||
217 | */ |
||
218 | protected $postFields = null; |
||
219 | |||
220 | /** |
||
221 | * Last operation result data or message(s) |
||
222 | * |
||
223 | * @var array |
||
224 | */ |
||
225 | public $lastResult = null; |
||
226 | |||
227 | /** |
||
228 | * Nuber from @rowCount |
||
229 | * @var int |
||
230 | */ |
||
231 | public $rowCount = null; |
||
232 | |||
233 | /** |
||
234 | * @link https://www.flexibee.eu/api/dokumentace/ref/zamykani-odemykani/ |
||
235 | * @var string filter query |
||
236 | */ |
||
237 | public $filter; |
||
238 | |||
239 | /** |
||
240 | * @link https://demo.flexibee.eu/devdoc/actions Provádění akcí |
||
241 | * @var string |
||
242 | */ |
||
243 | protected $action; |
||
244 | |||
245 | /** |
||
246 | * Pole akcí které podporuje ta která evidence |
||
247 | * @link https://demo.flexibee.eu/c/demo/faktura-vydana/actions.json Např. Akce faktury |
||
248 | * @var array |
||
249 | */ |
||
250 | public $actionsAvailable = null; |
||
251 | |||
252 | /** |
||
253 | * Parmetry pro URL |
||
254 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Všechny podporované parametry |
||
255 | * @var array |
||
256 | */ |
||
257 | public $urlParams = [ |
||
258 | 'idUcetniObdobi', |
||
259 | 'dry-run', |
||
260 | 'fail-on-warning', |
||
261 | 'report-name', |
||
262 | 'report-lang', |
||
263 | 'report-sign', |
||
264 | 'detail', //See: https://www.flexibee.eu/api/dokumentace/ref/detail-levels |
||
265 | 'mode', |
||
266 | 'limit', |
||
267 | 'start', |
||
268 | 'order', |
||
269 | 'sort', |
||
270 | 'add-row-count', |
||
271 | 'relations', |
||
272 | 'includes', |
||
273 | 'use-ext-id', |
||
274 | 'use-internal-id', |
||
275 | 'stitky-as-ids', |
||
276 | 'only-ext-ids', |
||
277 | 'no-ext-ids', |
||
278 | 'no-ids', |
||
279 | 'code-as-id', |
||
280 | 'no-http-errors', |
||
281 | 'export-settings', |
||
282 | 'as-gui', |
||
283 | 'code-in-response', |
||
284 | 'add-global-version', |
||
285 | 'encoding', |
||
286 | 'delimeter', |
||
287 | 'format', |
||
288 | 'auth', |
||
289 | 'skupina-stitku', |
||
290 | 'dir', |
||
291 | 'relations', |
||
292 | 'relations', |
||
293 | 'xpath', // See: https://www.flexibee.eu/api/dokumentace/ref/xpath/ |
||
294 | 'dry-run', // See: https://www.flexibee.eu/api/dokumentace/ref/dry-run/ |
||
295 | 'inDesktopApp' // Note: Undocumented function (html only) |
||
296 | ]; |
||
297 | |||
298 | /** |
||
299 | * Save 404 results to log ? |
||
300 | * @var boolean |
||
301 | */ |
||
302 | protected $ignoreNotFound = false; |
||
303 | |||
304 | /** |
||
305 | * Array of errors caused by last request |
||
306 | * @var array |
||
307 | */ |
||
308 | private $errors = []; |
||
309 | |||
310 | /** |
||
311 | * List of Error500 reports sent |
||
312 | * @var array |
||
313 | */ |
||
314 | private $reports = []; |
||
315 | |||
316 | /** |
||
317 | * Send Error500 Report to |
||
318 | * @var string email address |
||
319 | */ |
||
320 | public $reportRecipient = '[email protected]'; |
||
321 | |||
322 | /** |
||
323 | * Class for read only interaction with FlexiBee. |
||
324 | * |
||
325 | * @param mixed $init default record id or initial data |
||
326 | * @param array $options Connection settings override |
||
327 | */ |
||
328 | 24 | public function __construct($init = null, $options = []) |
|
339 | |||
340 | /** |
||
341 | * SetUp Object to be ready for connect |
||
342 | * |
||
343 | * @param array $options Object Options (company,url,user,password,evidence, |
||
344 | * prefix,defaultUrlParams,debug) |
||
345 | */ |
||
346 | 47 | public function setUp($options = []) |
|
362 | |||
363 | /** |
||
364 | * Set up one of properties |
||
365 | * |
||
366 | * @param array $options array of given properties |
||
367 | * @param string $name name of property to process |
||
368 | * @param string $constant load default property value from constant |
||
369 | */ |
||
370 | 24 | public function setupProperty($options, $name, $constant = null) |
|
380 | |||
381 | /** |
||
382 | * Inicializace CURL |
||
383 | */ |
||
384 | 70 | public function curlInit() |
|
396 | |||
397 | /** |
||
398 | * Zinicializuje objekt dle daných dat. Možné hodnoty: |
||
399 | * |
||
400 | * * 234 - interní číslo záznamu k načtení |
||
401 | * * code:LOPATA - kód záznamu |
||
402 | * * BAGR - kód záznamu ka načtení |
||
403 | * * ['id'=>24,'nazev'=>'hoblík'] - pole hodnot k předvyplnění |
||
404 | * * 743.json?relations=adresa,vazby - část url s parametry k načtení |
||
405 | * |
||
406 | * @param mixed $init číslo/"(code:)kód"/(část)URI záznamu k načtení | pole hodnot k předvyplnění |
||
407 | */ |
||
408 | 44 | public function processInit($init) |
|
421 | |||
422 | /** |
||
423 | * Set URL prefix |
||
424 | * |
||
425 | * @param string $prefix |
||
426 | */ |
||
427 | 45 | public function setPrefix($prefix) |
|
448 | |||
449 | /** |
||
450 | * Set communication format. |
||
451 | * One of html|xml|json|csv|dbf|xls|isdoc|isdocx|edi|pdf|pdf|vcf|ical |
||
452 | * |
||
453 | * @param string $format |
||
454 | * @return boolen format is availble |
||
455 | */ |
||
456 | 23 | public function setFormat($format) |
|
471 | |||
472 | /** |
||
473 | * Nastaví Evidenci pro Komunikaci. |
||
474 | * Set evidence for communication |
||
475 | * |
||
476 | * @param string $evidence evidence pathName to use |
||
477 | * @return boolean evidence switching status |
||
478 | */ |
||
479 | 45 | public function setEvidence($evidence) |
|
499 | |||
500 | /** |
||
501 | * Vrací právě používanou evidenci pro komunikaci |
||
502 | * Obtain current used evidence |
||
503 | * |
||
504 | * @return string |
||
505 | */ |
||
506 | 47 | public function getEvidence() |
|
510 | |||
511 | /** |
||
512 | * Set used company. |
||
513 | * Nastaví Firmu. |
||
514 | * |
||
515 | * @param string $company |
||
516 | */ |
||
517 | 23 | public function setCompany($company) |
|
521 | |||
522 | /** |
||
523 | * Obtain company now used |
||
524 | * Vrací právě používanou firmu |
||
525 | * |
||
526 | * @return string |
||
527 | */ |
||
528 | 23 | public function getCompany() |
|
532 | |||
533 | /** |
||
534 | * Vrací název evidence použité v odpovědích z FlexiBee |
||
535 | * |
||
536 | * @return string |
||
537 | */ |
||
538 | 44 | public function getResponseEvidence() |
|
553 | |||
554 | /** |
||
555 | * Převede rekurzivně Objekt na pole. |
||
556 | * |
||
557 | * @param object|array $object |
||
558 | * |
||
559 | * @return array |
||
560 | */ |
||
561 | 23 | public static function object2array($object) |
|
581 | |||
582 | /** |
||
583 | * Převede rekurzivně v poli všechny objekty na jejich identifikátory. |
||
584 | * |
||
585 | * @param object|array $object |
||
586 | * |
||
587 | * @return array |
||
588 | */ |
||
589 | 23 | public static function objectToID($object) |
|
606 | |||
607 | /** |
||
608 | * Return basic URL for used Evidence |
||
609 | * |
||
610 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL |
||
611 | * |
||
612 | * @return string Evidence URL |
||
613 | */ |
||
614 | 45 | public function getEvidenceURL() |
|
623 | |||
624 | /** |
||
625 | * Add suffix to Evidence URL |
||
626 | * |
||
627 | * @param string $urlSuffix |
||
628 | * |
||
629 | * @return string |
||
630 | */ |
||
631 | public function evidenceUrlWithSuffix($urlSuffix) |
||
643 | |||
644 | /** |
||
645 | * Update $this->apiURL |
||
646 | */ |
||
647 | 24 | public function updateApiURL() |
|
656 | |||
657 | /** |
||
658 | * Funkce, která provede I/O operaci a vyhodnotí výsledek. |
||
659 | * |
||
660 | * @param string $urlSuffix část URL za identifikátorem firmy. |
||
661 | * @param string $method HTTP/REST metoda |
||
662 | * @param string $format Requested format |
||
663 | * @return array|boolean Výsledek operace |
||
664 | */ |
||
665 | 44 | public function performRequest($urlSuffix = null, $method = 'GET', |
|
666 | $format = null) |
||
667 | { |
||
668 | 44 | $this->rowCount = null; |
|
669 | |||
670 | 44 | if (preg_match('/^http/', $urlSuffix)) { |
|
671 | 22 | $url = $urlSuffix; |
|
672 | 44 | } elseif ($urlSuffix[0] == '/') { |
|
673 | 2 | $url = $this->url.$urlSuffix; |
|
674 | 2 | } else { |
|
675 | 21 | $url = $this->evidenceUrlWithSuffix($urlSuffix); |
|
676 | } |
||
677 | |||
678 | 44 | $responseCode = $this->doCurlRequest($url, $method, $format); |
|
679 | |||
680 | 44 | return $this->parseResponse($this->rawResponseToArray($this->lastCurlResponse, |
|
681 | 44 | $this->responseFormat), $responseCode); |
|
682 | } |
||
683 | |||
684 | /** |
||
685 | * Parse Raw FlexiBee response in several formats |
||
686 | * |
||
687 | * @param string $responseRaw raw response body |
||
688 | * @param string $format Raw Response format json|xml|etc |
||
689 | * |
||
690 | * @return array |
||
691 | */ |
||
692 | 23 | public function rawResponseToArray($responseRaw, $format) |
|
718 | |||
719 | /** |
||
720 | * Parse Response array |
||
721 | * |
||
722 | * @param array $responseDecoded |
||
723 | * @param int $responseCode Request Response Code |
||
724 | * |
||
725 | * @return array main data part of response |
||
726 | */ |
||
727 | 23 | public function parseResponse($responseDecoded, $responseCode) |
|
766 | |||
767 | /** |
||
768 | * Parse error message response |
||
769 | * |
||
770 | * @param array $responseDecoded |
||
771 | * @return int number of errors processed |
||
772 | 9 | */ |
|
773 | public function parseError(array $responseDecoded) |
||
784 | |||
785 | /** |
||
786 | * Vykonej HTTP požadavek |
||
787 | * |
||
788 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL |
||
789 | * @param string $url URL požadavku |
||
790 | * @param string $method HTTP Method GET|POST|PUT|OPTIONS|DELETE |
||
791 | * @param string $format požadovaný formát komunikace |
||
792 | * @return int HTTP Response CODE |
||
793 | 23 | */ |
|
794 | public function doCurlRequest($url, $method, $format = null) |
||
845 | |||
846 | /** |
||
847 | * Nastaví druh prováděné akce. |
||
848 | * |
||
849 | * @link https://demo.flexibee.eu/devdoc/actions Provádění akcí |
||
850 | * @param string $action |
||
851 | 20 | * @return boolean |
|
852 | */ |
||
853 | 20 | public function setAction($action) |
|
864 | |||
865 | /** |
||
866 | * Convert XML to array. |
||
867 | * |
||
868 | * @param string $xml |
||
869 | * |
||
870 | 23 | * @return array |
|
871 | */ |
||
872 | 23 | public static function xml2array($xml) |
|
890 | |||
891 | /** |
||
892 | 23 | * Odpojení od FlexiBee. |
|
893 | */ |
||
894 | 23 | public function disconnect() |
|
901 | |||
902 | /** |
||
903 | 23 | * Disconnect CURL befere pass away |
|
904 | */ |
||
905 | 23 | public function __destruct() |
|
909 | |||
910 | /** |
||
911 | * Načte řádek dat z FlexiBee. |
||
912 | * |
||
913 | * @param int $recordID id požadovaného záznamu |
||
914 | * |
||
915 | 23 | * @return array |
|
916 | */ |
||
917 | 23 | public function getFlexiRow($recordID) |
|
927 | |||
928 | /** |
||
929 | * Oddělí z pole podmínek ty jenž patří za ? v URL požadavku |
||
930 | * |
||
931 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL |
||
932 | * @param array $conditions pole podmínek - rendrují se do () |
||
933 | * @param array $urlParams pole parametrů - rendrují za ? |
||
934 | */ |
||
935 | public function extractUrlParams(&$conditions, &$urlParams) |
||
943 | |||
944 | /** |
||
945 | * Načte data z FlexiBee. |
||
946 | * |
||
947 | * @param string $suffix dotaz |
||
948 | * @param string|array $conditions Volitelný filtrovací výraz |
||
949 | * |
||
950 | 41 | * @return array Data obtained |
|
951 | */ |
||
952 | 41 | public function getFlexiData($suffix = null, $conditions = null) |
|
1005 | |||
1006 | /** |
||
1007 | * Načte záznam z FlexiBee a uloží v sobě jeho data |
||
1008 | 45 | * Read FlexiBee record and store it inside od object |
|
1009 | * |
||
1010 | 45 | * @param int $id ID or conditions |
|
1011 | 45 | * |
|
1012 | 23 | * @return int počet načtených položek |
|
1013 | 23 | */ |
|
1014 | 45 | public function loadFromFlexiBee($id = null) |
|
1030 | |||
1031 | /** |
||
1032 | * Převede data do Json formátu pro FlexiBee. |
||
1033 | 23 | * Convert data to FlexiBee like Json format |
|
1034 | * |
||
1035 | * @param array $data |
||
1036 | 23 | * |
|
1037 | 23 | * @return string |
|
1038 | 23 | */ |
|
1039 | 23 | public function jsonizeData($data) |
|
1059 | 23 | ||
1060 | /** |
||
1061 | 23 | * Test if given record ID exists in FlexiBee. |
|
1062 | * |
||
1063 | * @param string|int $identifer |
||
1064 | 23 | */ |
|
1065 | 23 | public function idExists($identifer = null) |
|
1076 | |||
1077 | 15 | /** |
|
1078 | * Test if given record exists in FlexiBee. |
||
1079 | * |
||
1080 | 15 | * @param array $data |
|
1081 | 15 | * @return boolean Record presence status |
|
1082 | 15 | */ |
|
1083 | public function recordExists($data = []) |
||
1101 | |||
1102 | /** |
||
1103 | * Vrací z FlexiBee sloupečky podle podmínek. |
||
1104 | * |
||
1105 | * @param array|int|string $conditions pole podmínek nebo ID záznamu |
||
1106 | * @param string $indexBy klice vysledku naplnit hodnotou ze |
||
1107 | * sloupečku |
||
1108 | * @return array |
||
1109 | */ |
||
1110 | public function getAllFromFlexibee($conditions = null, $indexBy = null) |
||
1124 | |||
1125 | /** |
||
1126 | * Vrací z FlexiBee sloupečky podle podmínek. |
||
1127 | * |
||
1128 | 23 | * @param string[] $columnsList seznam položek |
|
1129 | * @param array $conditions pole podmínek nebo ID záznamu |
||
1130 | * @param string $indexBy Sloupeček podle kterého indexovat záznamy |
||
1131 | 23 | * |
|
1132 | 23 | * @return array |
|
1133 | 23 | */ |
|
1134 | public function getColumnsFromFlexibee($columnsList, $conditions = [], |
||
1172 | |||
1173 | /** |
||
1174 | * Vrací kód záznamu. |
||
1175 | 23 | * Obtain record CODE |
|
1176 | * |
||
1177 | 23 | * @param mixed $data |
|
1178 | * |
||
1179 | 23 | * @return string |
|
1180 | 23 | */ |
|
1181 | 23 | public function getKod($data = null, $unique = true) |
|
1234 | |||
1235 | /** |
||
1236 | 32 | * Write Operation Result. |
|
1237 | * |
||
1238 | 32 | * @param array $resultData |
|
1239 | 32 | * @param string $url URL |
|
1240 | 31 | * @return boolean Log save success |
|
1241 | 8 | */ |
|
1242 | 8 | public function logResult($resultData = null, $url = null) |
|
1291 | |||
1292 | /** |
||
1293 | * Save RAW Curl Request & Response to files in Temp directory |
||
1294 | */ |
||
1295 | public function saveDebugFiles() |
||
1304 | |||
1305 | /** |
||
1306 | * Připraví data pro odeslání do FlexiBee |
||
1307 | * |
||
1308 | * @param string $data |
||
1309 | */ |
||
1310 | public function setPostFields($data) |
||
1314 | |||
1315 | /** |
||
1316 | * Generuje fragment url pro filtrování. |
||
1317 | * |
||
1318 | * @see https://www.flexibee.eu/api/dokumentace/ref/filters |
||
1319 | * |
||
1320 | 23 | * @param array $data |
|
1321 | * @param string $joiner default and/or |
||
1322 | 23 | * @param string $defop default operator |
|
1323 | * |
||
1324 | 23 | * @return string |
|
1325 | 23 | */ |
|
1326 | 23 | public static function flexiUrl(array $data, $joiner = 'and', $defop = 'eq') |
|
1362 | |||
1363 | /** |
||
1364 | 47 | * Obtain record/object identificator code: or id: |
|
1365 | * Vrací identifikátor objektu code: nebo id: |
||
1366 | 47 | * |
|
1367 | 47 | * @link https://demo.flexibee.eu/devdoc/identifiers Identifikátory záznamů |
|
1368 | 33 | * @return string|int indentifikátor záznamu reprezentovaného objektem |
|
1369 | 33 | */ |
|
1370 | 47 | public function getRecordID() |
|
1384 | |||
1385 | /** |
||
1386 | 47 | * Obtain record/object identificator code: or id: |
|
1387 | * Vrací identifikátor objektu code: nebo id: |
||
1388 | 47 | * |
|
1389 | * @link https://demo.flexibee.eu/devdoc/identifiers Identifikátory záznamů |
||
1390 | * @return string indentifikátor záznamu reprezentovaného objektem |
||
1391 | */ |
||
1392 | public function __toString() |
||
1396 | |||
1397 | 23 | /** |
|
1398 | * Gives you FlexiPeeHP class name for Given Evidence |
||
1399 | 23 | * |
|
1400 | * @param string $evidence |
||
1401 | * @return string Class name |
||
1402 | */ |
||
1403 | public static function evidenceToClassName($evidence) |
||
1407 | 22 | ||
1408 | /** |
||
1409 | 22 | * Obtain ID of first record in evidence |
|
1410 | 22 | * |
|
1411 | 22 | * @return string|null id or null if no records |
|
1412 | 19 | */ |
|
1413 | 19 | public function getFirstRecordID() |
|
1423 | |||
1424 | 23 | /** |
|
1425 | * Vrací hodnotu daného externího ID |
||
1426 | 23 | * |
|
1427 | 23 | * @param string $want Which ? If empty,you obtain the first one. |
|
1428 | 23 | * @return string |
|
1429 | */ |
||
1430 | public function getExternalID($want = null) |
||
1449 | |||
1450 | /** |
||
1451 | 22 | * Obtain actual GlobalVersion |
|
1452 | * Vrací aktuální globální verzi změn |
||
1453 | 22 | * |
|
1454 | 22 | * @link https://www.flexibee.eu/api/dokumentace/ref/changes-api#globalVersion Globální Verze |
|
1455 | 22 | * @return type |
|
1456 | 22 | */ |
|
1457 | 22 | public function getGlobalVersion() |
|
1471 | 23 | ||
1472 | /** |
||
1473 | 23 | * Obtain content type of last response |
|
1474 | 23 | * |
|
1475 | 23 | * @return string |
|
1476 | */ |
||
1477 | public function getResponseFormat() |
||
1486 | |||
1487 | 35 | /** |
|
1488 | * Return the same response format for one and multiplete results |
||
1489 | 35 | * |
|
1490 | 35 | * @param array $responseBody |
|
1491 | 22 | * @return array |
|
1492 | 22 | */ |
|
1493 | 35 | public function unifyResponseFormat($responseBody) |
|
1518 | |||
1519 | 23 | /** |
|
1520 | * Obtain structure for current (or given) evidence |
||
1521 | 23 | * |
|
1522 | 23 | * @param string $evidence |
|
1523 | 23 | * @return array Evidence structure |
|
1524 | 23 | */ |
|
1525 | 23 | View Code Duplication | public function getColumnsInfo($evidence = null) |
1537 | |||
1538 | 23 | /** |
|
1539 | * Obtain actions for current (or given) evidence |
||
1540 | 23 | * |
|
1541 | 23 | * @param string $evidence |
|
1542 | 23 | * @return array Evidence structure |
|
1543 | 23 | */ |
|
1544 | 23 | View Code Duplication | public function getActionsInfo($evidence = null) |
1556 | |||
1557 | 23 | /** |
|
1558 | * Obtain relations for current (or given) evidence |
||
1559 | 23 | * |
|
1560 | 23 | * @param string $evidence |
|
1561 | 23 | * @return array Evidence structure |
|
1562 | 23 | */ |
|
1563 | 23 | public function getRelationsInfo($evidence = null) |
|
1575 | |||
1576 | 23 | /** |
|
1577 | * Obtain info for current (or given) evidence |
||
1578 | 23 | * |
|
1579 | 23 | * @param string $evidence |
|
1580 | 23 | * @return array Evidence info |
|
1581 | 23 | */ |
|
1582 | 23 | View Code Duplication | public function getEvidenceInfo($evidence = null) |
1593 | |||
1594 | 23 | /** |
|
1595 | * Obtain name for current (or given) evidence path |
||
1596 | 23 | * |
|
1597 | 23 | * @param string $evidence Evidence Path |
|
1598 | 23 | * @return array Evidence info |
|
1599 | 23 | */ |
|
1600 | 23 | View Code Duplication | public function getEvidenceName($evidence = null) |
1611 | |||
1612 | /** |
||
1613 | * Perform given action (if availble) on current evidence/record |
||
1614 | 15 | * @url https://demo.flexibee.eu/devdoc/actions |
|
1615 | * |
||
1616 | 15 | * @param string $action one of evidence actions |
|
1617 | * @param string $method ext|int External method call operation in URL. |
||
1618 | 15 | * Internal add the @action element to request body |
|
1619 | 15 | */ |
|
1620 | 15 | public function performAction($action, $method = 'ext') |
|
1655 | 23 | ||
1656 | /** |
||
1657 | 23 | * Save current object to file |
|
1658 | 1 | * |
|
1659 | 1 | * @param string $destfile path to file |
|
1660 | 23 | */ |
|
1661 | 23 | public function saveResponseToFile($destfile) |
|
1668 | 9 | ||
1669 | /** |
||
1670 | 9 | * Obtain established relations listing |
|
1671 | 9 | * |
|
1672 | 9 | * @return array Null or Relations |
|
1673 | 9 | */ |
|
1674 | 7 | public function getVazby($id = null) |
|
1689 | |||
1690 | /** |
||
1691 | * Gives You URL for Current Record in FlexiBee web interface |
||
1692 | * |
||
1693 | * @return string url |
||
1694 | */ |
||
1695 | public function getFlexiBeeURL() |
||
1708 | |||
1709 | /** |
||
1710 | * Set Record Key |
||
1711 | * |
||
1712 | * @param int|string $myKeyValue |
||
1713 | * @return boolean |
||
1714 | */ |
||
1715 | public function setMyKey($myKeyValue) |
||
1721 | |||
1722 | /** |
||
1723 | * Set or get ignore not found pages flag |
||
1724 | * |
||
1725 | * @param boolean $ignore set flag to |
||
1726 | * |
||
1727 | * @return boolean get flag state |
||
1728 | */ |
||
1729 | public function ignore404($ignore = null) |
||
1736 | |||
1737 | /** |
||
1738 | * Send Document by mail |
||
1739 | * |
||
1740 | * @url https://www.flexibee.eu/api/dokumentace/ref/odesilani-mailem/ |
||
1741 | * |
||
1742 | * @param string $to |
||
1743 | * @param string $subject |
||
1744 | * @param string $body Email Text |
||
1745 | * |
||
1746 | * @return int http response code |
||
1747 | */ |
||
1748 | public function sendByMail($to, $subject, $body, $cc = null) |
||
1755 | |||
1756 | /** |
||
1757 | * Send all unsent Invoices by mail |
||
1758 | * |
||
1759 | * @url https://www.flexibee.eu/api/dokumentace/ref/odesilani-mailem/ |
||
1760 | * @return int http response code |
||
1761 | */ |
||
1762 | public function sendUnsent() |
||
1767 | |||
1768 | /** |
||
1769 | * FlexiBee date to PHP DateTime |
||
1770 | * |
||
1771 | * @param string $flexidate |
||
1772 | * |
||
1773 | * @return \DateTime | false |
||
1774 | */ |
||
1775 | public static function flexiDateToDateTime($flexidate) |
||
1779 | |||
1780 | /** |
||
1781 | * Získá dokument v daném formátu |
||
1782 | * Obtain document in given format |
||
1783 | * |
||
1784 | * @param string $format pdf/csv/xml/json/ ... |
||
1785 | * |
||
1786 | * @return string|null filename downloaded or none |
||
1787 | */ |
||
1788 | public function getInFormat($format) |
||
1799 | |||
1800 | /** |
||
1801 | * Uloží dokument v daném formátu do složky v systému souborů |
||
1802 | * Save document in given format to directory in filesystem |
||
1803 | * |
||
1804 | * @param string $format pdf/csv/xml/json/ ... |
||
1805 | * @param string $destDir where to put file (prefix) |
||
1806 | * |
||
1807 | * @return string|null filename downloaded or none |
||
1808 | */ |
||
1809 | public function downloadInFormat($format, $destDir = './') |
||
1821 | |||
1822 | /** |
||
1823 | * Compile and send Report about Error500 to FlexiBee developers |
||
1824 | * If FlexiBee is running on localost try also include java backtrace |
||
1825 | * |
||
1826 | * @param array $errorResponse result of parseError(); |
||
1827 | */ |
||
1828 | public function error500Reporter($errorResponse) |
||
1894 | |||
1895 | /** |
||
1896 | * Returns code:CODE |
||
1897 | * |
||
1898 | * @param string $code |
||
1899 | * |
||
1900 | * @return string |
||
1901 | */ |
||
1902 | public static function code($code) |
||
1906 | |||
1907 | /** |
||
1908 | * Returns CODE without code: prefix |
||
1909 | * |
||
1910 | * @param string $code |
||
1911 | * |
||
1912 | * @return string |
||
1913 | */ |
||
1914 | public static function uncode($code) |
||
1918 | |||
1919 | /** |
||
1920 | * Reconnect After unserialization |
||
1921 | */ |
||
1922 | public function __wakeup() |
||
1927 | } |
||
1928 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.