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 | static public $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://demo.flexibee.eu/devdoc/actions Provádění akcí |
||
235 | * @var string |
||
236 | */ |
||
237 | protected $action; |
||
238 | |||
239 | /** |
||
240 | * Pole akcí které podporuje ta která evidence |
||
241 | * @link https://demo.flexibee.eu/c/demo/faktura-vydana/actions.json Např. Akce faktury |
||
242 | * @var array |
||
243 | */ |
||
244 | public $actionsAvailable = null; |
||
245 | |||
246 | /** |
||
247 | * Parmetry pro URL |
||
248 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Všechny podporované parametry |
||
249 | * @var array |
||
250 | */ |
||
251 | public $urlParams = [ |
||
252 | 'idUcetniObdobi', |
||
253 | 'dry-run', |
||
254 | 'fail-on-warning', |
||
255 | 'report-name', |
||
256 | 'report-lang', |
||
257 | 'report-sign', |
||
258 | 'detail', //See: https://www.flexibee.eu/api/dokumentace/ref/detail-levels |
||
259 | 'mode', |
||
260 | 'limit', |
||
261 | 'start', |
||
262 | 'order', |
||
263 | 'sort', |
||
264 | 'add-row-count', |
||
265 | 'relations', |
||
266 | 'includes', |
||
267 | 'use-ext-id', |
||
268 | 'use-internal-id', |
||
269 | 'stitky-as-ids', |
||
270 | 'only-ext-ids', |
||
271 | 'no-ext-ids', |
||
272 | 'no-ids', |
||
273 | 'code-as-id', |
||
274 | 'no-http-errors', |
||
275 | 'export-settings', |
||
276 | 'as-gui', |
||
277 | 'code-in-response', |
||
278 | 'add-global-version', |
||
279 | 'encoding', |
||
280 | 'delimeter', |
||
281 | 'format', |
||
282 | 'auth', |
||
283 | 'skupina-stitku', |
||
284 | 'dir', |
||
285 | 'relations', |
||
286 | 'relations', |
||
287 | 'xpath', // See: https://www.flexibee.eu/api/dokumentace/ref/xpath/ |
||
288 | 'dry-run', // See: https://www.flexibee.eu/api/dokumentace/ref/dry-run/ |
||
289 | 'inDesktopApp' // Note: Undocumented function (html only) |
||
290 | ]; |
||
291 | |||
292 | /** |
||
293 | * Save 404 results to log ? |
||
294 | * @var boolean |
||
295 | */ |
||
296 | protected $ignoreNotFound = false; |
||
297 | |||
298 | /** |
||
299 | * Array of errors caused by last request |
||
300 | * @var array |
||
301 | */ |
||
302 | private $errors = []; |
||
303 | |||
304 | /** |
||
305 | * Class for read only interaction with FlexiBee. |
||
306 | * |
||
307 | * @param mixed $init default record id or initial data |
||
308 | * @param array $options Connection settings override |
||
309 | */ |
||
310 | public function __construct($init = null, $options = []) |
||
321 | |||
322 | /** |
||
323 | * SetUp Object to be ready for connect |
||
324 | * |
||
325 | * @param array $options Object Options (company,url,user,password,evidence, |
||
326 | * prefix,defaultUrlParams,debug) |
||
327 | */ |
||
328 | public function setUp($options = []) |
||
371 | |||
372 | /** |
||
373 | * Inicializace CURL |
||
374 | */ |
||
375 | public function curlInit() |
||
387 | |||
388 | /** |
||
389 | * Zinicializuje objekt dle daných dat. Možné hodnoty: |
||
390 | * |
||
391 | * * 234 - interní číslo záznamu k načtení |
||
392 | * * code:LOPATA - kód záznamu |
||
393 | * * BAGR - kód záznamu ka načtení |
||
394 | * * ['id'=>24,'nazev'=>'hoblík'] - pole hodnot k předvyplnění |
||
395 | * * 743.json?relations=adresa,vazby - část url s parametry k načtení |
||
396 | * |
||
397 | * @param mixed $init číslo/"(code:)kód"/(část)URI záznamu k načtení | pole hodnot k předvyplnění |
||
398 | */ |
||
399 | public function processInit($init) |
||
412 | |||
413 | /** |
||
414 | * Set URL prefix |
||
415 | * |
||
416 | * @param string $prefix |
||
417 | */ |
||
418 | public function setPrefix($prefix) |
||
439 | |||
440 | /** |
||
441 | * Set communication format. |
||
442 | * One of html|xml|json|csv|dbf|xls|isdoc|isdocx|edi|pdf|pdf|vcf|ical |
||
443 | * |
||
444 | * @param string $format |
||
445 | * @return boolen format is availble |
||
446 | */ |
||
447 | public function setFormat($format) |
||
463 | |||
464 | /** |
||
465 | * Nastaví Evidenci pro Komunikaci. |
||
466 | * Set evidence for communication |
||
467 | * |
||
468 | * @param string $evidence evidence pathName to use |
||
469 | * @return boolean evidence switching status |
||
470 | */ |
||
471 | public function setEvidence($evidence) |
||
491 | |||
492 | /** |
||
493 | * Vrací právě používanou evidenci pro komunikaci |
||
494 | * Obtain current used evidence |
||
495 | * |
||
496 | * @return string |
||
497 | */ |
||
498 | public function getEvidence() |
||
502 | |||
503 | /** |
||
504 | * Set used company. |
||
505 | * Nastaví Firmu. |
||
506 | * |
||
507 | * @param string $company |
||
508 | */ |
||
509 | public function setCompany($company) |
||
513 | |||
514 | /** |
||
515 | * Obtain company now used |
||
516 | * Vrací právě používanou firmu |
||
517 | * |
||
518 | * @return string |
||
519 | */ |
||
520 | public function getCompany() |
||
524 | |||
525 | /** |
||
526 | * Vrací název evidence použité v odpovědích z FlexiBee |
||
527 | * |
||
528 | * @return string |
||
529 | */ |
||
530 | public function getResponseEvidence() |
||
545 | |||
546 | /** |
||
547 | * Převede rekurzivně Objekt na pole. |
||
548 | * |
||
549 | * @param object|array $object |
||
550 | * |
||
551 | * @return array |
||
552 | */ |
||
553 | public static function object2array($object) |
||
573 | |||
574 | /** |
||
575 | * Převede rekurzivně v poli všechny objekty na jejich identifikátory. |
||
576 | * |
||
577 | * @param object|array $object |
||
578 | * |
||
579 | * @return array |
||
580 | */ |
||
581 | public static function objectToID($object) |
||
598 | |||
599 | /** |
||
600 | * Return basic URL for used Evidence |
||
601 | * |
||
602 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL |
||
603 | * @param string $urlSuffix |
||
604 | */ |
||
605 | public function getEvidenceURL($urlSuffix = null) |
||
614 | |||
615 | /** |
||
616 | * Update $this->apiURL |
||
617 | */ |
||
618 | public function updateApiURL() |
||
627 | |||
628 | /** |
||
629 | * Funkce, která provede I/O operaci a vyhodnotí výsledek. |
||
630 | * |
||
631 | * @param string $urlSuffix část URL za identifikátorem firmy. |
||
632 | * @param string $method HTTP/REST metoda |
||
633 | * @param string $format Requested format |
||
634 | * @return array|boolean Výsledek operace |
||
635 | */ |
||
636 | public function performRequest($urlSuffix = null, $method = 'GET', |
||
652 | |||
653 | /** |
||
654 | * Parse Raw FlexiBee response in several formats |
||
655 | * |
||
656 | * @param string $responseRaw raw response body |
||
657 | * @param string $format Raw Response format json|xml|etc |
||
658 | * |
||
659 | * @return array |
||
660 | */ |
||
661 | public function rawResponseToArray($responseRaw, $format) |
||
687 | |||
688 | /** |
||
689 | * Parse Response array |
||
690 | * |
||
691 | * @param array $responseDecoded |
||
692 | * @param int $responseCode Request Response Code |
||
693 | * |
||
694 | * @return array main data part of response |
||
695 | */ |
||
696 | public function parseResponse($responseDecoded, $responseCode) |
||
732 | |||
733 | /** |
||
734 | * Parse error message response |
||
735 | * |
||
736 | * @param array $responseDecoded |
||
737 | * @return int number of errors processed |
||
738 | */ |
||
739 | public function parseError(array $responseDecoded) |
||
748 | |||
749 | /** |
||
750 | * Vykonej HTTP požadavek |
||
751 | * |
||
752 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL |
||
753 | * @param string $url URL požadavku |
||
754 | * @param string $method HTTP Method GET|POST|PUT|OPTIONS|DELETE |
||
755 | * @param string $format požadovaný formát komunikace |
||
756 | * @return int HTTP Response CODE |
||
757 | */ |
||
758 | public function doCurlRequest($url, $method, $format = null) |
||
806 | |||
807 | /** |
||
808 | * Nastaví druh prováděné akce. |
||
809 | * |
||
810 | * @link https://demo.flexibee.eu/devdoc/actions Provádění akcí |
||
811 | * @param string $action |
||
812 | * @return boolean |
||
813 | */ |
||
814 | public function setAction($action) |
||
824 | |||
825 | /** |
||
826 | * Convert XML to array. |
||
827 | * |
||
828 | * @param string $xml |
||
829 | * |
||
830 | * @return array |
||
831 | */ |
||
832 | public static function xml2array($xml) |
||
850 | |||
851 | /** |
||
852 | * Odpojení od FlexiBee. |
||
853 | */ |
||
854 | public function disconnect() |
||
861 | |||
862 | /** |
||
863 | * Disconnect CURL befere pass away |
||
864 | */ |
||
865 | public function __destruct() |
||
869 | |||
870 | /** |
||
871 | * Načte řádek dat z FlexiBee. |
||
872 | * |
||
873 | * @param int $recordID id požadovaného záznamu |
||
874 | * |
||
875 | * @return array |
||
876 | */ |
||
877 | public function getFlexiRow($recordID) |
||
887 | |||
888 | /** |
||
889 | * Oddělí z pole podmínek ty jenž patří za ? v URL požadavku |
||
890 | * |
||
891 | * @link https://www.flexibee.eu/api/dokumentace/ref/urls/ Sestavování URL |
||
892 | * @param array $conditions pole podmínek - rendrují se do () |
||
893 | * @param array $urlParams pole parametrů - rendrují za ? |
||
894 | */ |
||
895 | public function extractUrlParams(&$conditions, &$urlParams) |
||
903 | |||
904 | /** |
||
905 | * Načte data z FlexiBee. |
||
906 | * |
||
907 | * @param string $suffix dotaz |
||
908 | * @param string|array $conditions Volitelný filtrovací výraz |
||
909 | */ |
||
910 | public function getFlexiData($suffix = null, $conditions = null) |
||
950 | |||
951 | /** |
||
952 | * Načte záznam z FlexiBee. |
||
953 | * |
||
954 | * @param int $id ID záznamu |
||
955 | * |
||
956 | * @return int počet načtených položek |
||
957 | */ |
||
958 | public function loadFromFlexiBee($id = null) |
||
972 | |||
973 | /** |
||
974 | * Převede data do Json formátu pro FlexiBee. |
||
975 | * Convert data to FlexiBee like Json format |
||
976 | * |
||
977 | * @param array $data |
||
978 | * |
||
979 | * @return string |
||
980 | */ |
||
981 | public function jsonizeData($data) |
||
997 | |||
998 | /** |
||
999 | * Test if given record ID exists in FlexiBee. |
||
1000 | * |
||
1001 | * @param string|int $identifer |
||
1002 | */ |
||
1003 | public function idExists($identifer = null) |
||
1013 | |||
1014 | /** |
||
1015 | * Test if given record exists in FlexiBee. |
||
1016 | * |
||
1017 | * @param array $data |
||
1018 | * @return boolean Record presence status |
||
1019 | */ |
||
1020 | public function recordExists($data = null) |
||
1038 | |||
1039 | /** |
||
1040 | * Vrací z FlexiBee sloupečky podle podmínek. |
||
1041 | * |
||
1042 | * @param array|int|string $conditions pole podmínek nebo ID záznamu |
||
1043 | * @param string $indexBy klice vysledku naplnit hodnotou ze |
||
1044 | * sloupečku |
||
1045 | * @return array |
||
1046 | */ |
||
1047 | public function getAllFromFlexibee($conditions = null, $indexBy = null) |
||
1061 | |||
1062 | /** |
||
1063 | * Vrací z FlexiBee sloupečky podle podmínek. |
||
1064 | * |
||
1065 | * @param string[] $columnsList seznam položek |
||
1066 | * @param array $conditions pole podmínek nebo ID záznamu |
||
1067 | * @param string $indexBy Sloupeček podle kterého indexovat záznamy |
||
1068 | * |
||
1069 | * @return array |
||
1070 | */ |
||
1071 | public function getColumnsFromFlexibee($columnsList, $conditions = null, |
||
1107 | |||
1108 | /** |
||
1109 | * Vrací kód záznamu. |
||
1110 | * |
||
1111 | * @param mixed $data |
||
1112 | * |
||
1113 | * @return string |
||
1114 | */ |
||
1115 | public function getKod($data = null, $unique = true) |
||
1168 | |||
1169 | /** |
||
1170 | * Write Operation Result. |
||
1171 | * |
||
1172 | * @param array $resultData |
||
1173 | * @param string $url URL |
||
1174 | * @return boolean Log save success |
||
1175 | */ |
||
1176 | public function logResult($resultData = null, $url = null) |
||
1225 | |||
1226 | /** |
||
1227 | * Save RAW Curl Request & Response to files in Temp directory |
||
1228 | */ |
||
1229 | public function saveDebugFiles() |
||
1237 | |||
1238 | /** |
||
1239 | * Připraví data pro odeslání do FlexiBee |
||
1240 | * |
||
1241 | * @param string $data |
||
1242 | */ |
||
1243 | public function setPostFields($data) |
||
1247 | |||
1248 | /** |
||
1249 | * Generuje fragment url pro filtrování. |
||
1250 | * |
||
1251 | * @see https://www.flexibee.eu/api/dokumentace/ref/filters |
||
1252 | * |
||
1253 | * @param array $data |
||
1254 | * @param string $joiner default and/or |
||
1255 | * @param string $defop default operator |
||
1256 | * |
||
1257 | * @return string |
||
1258 | */ |
||
1259 | public static function flexiUrl(array $data, $joiner = 'and', $defop = 'eq') |
||
1286 | |||
1287 | /** |
||
1288 | * Obtain record/object identificator code: or id: |
||
1289 | * Vrací identifikátor objektu code: nebo id: |
||
1290 | * |
||
1291 | * @link https://demo.flexibee.eu/devdoc/identifiers Identifikátory záznamů |
||
1292 | * @return string|int indentifikátor záznamu reprezentovaného objektem |
||
1293 | */ |
||
1294 | public function getRecordID() |
||
1308 | |||
1309 | /** |
||
1310 | * Obtain record/object identificator code: or id: |
||
1311 | * Vrací identifikátor objektu code: nebo id: |
||
1312 | * |
||
1313 | * @link https://demo.flexibee.eu/devdoc/identifiers Identifikátory záznamů |
||
1314 | * @return string indentifikátor záznamu reprezentovaného objektem |
||
1315 | */ |
||
1316 | public function __toString() |
||
1320 | |||
1321 | /** |
||
1322 | * Gives you FlexiPeeHP class name for Given Evidence |
||
1323 | * |
||
1324 | * @param string $evidence |
||
1325 | * @return string Class name |
||
1326 | */ |
||
1327 | static public function evidenceToClassName($evidence) |
||
1331 | |||
1332 | /** |
||
1333 | * Vrací hodnotu daného externího ID |
||
1334 | * |
||
1335 | * @param string $want Which ? If empty,you obtain the first one. |
||
1336 | * @return string |
||
1337 | */ |
||
1338 | public function getExternalID($want = null) |
||
1357 | |||
1358 | /** |
||
1359 | * Obtain actual GlobalVersion |
||
1360 | * Vrací aktuální globální verzi změn |
||
1361 | * |
||
1362 | * @link https://www.flexibee.eu/api/dokumentace/ref/changes-api#globalVersion Globální Verze |
||
1363 | * @return type |
||
1364 | */ |
||
1365 | public function getGlobalVersion() |
||
1379 | |||
1380 | /** |
||
1381 | * Obtain content type of last response |
||
1382 | * |
||
1383 | * @return string |
||
1384 | */ |
||
1385 | public function getResponseFormat() |
||
1394 | |||
1395 | /** |
||
1396 | * Return the same response format for one and multiplete results |
||
1397 | * |
||
1398 | * @param array $responseBody |
||
1399 | * @return array |
||
1400 | */ |
||
1401 | public function unifyResponseFormat($responseBody) |
||
1426 | |||
1427 | /** |
||
1428 | * Obtain structure for current (or given) evidence |
||
1429 | * |
||
1430 | * @param string $evidence |
||
1431 | * @return array Evidence structure |
||
1432 | */ |
||
1433 | View Code Duplication | public function getColumnsInfo($evidence = null) |
|
1445 | |||
1446 | /** |
||
1447 | * Obtain actions for current (or given) evidence |
||
1448 | * |
||
1449 | * @param string $evidence |
||
1450 | * @return array Evidence structure |
||
1451 | */ |
||
1452 | View Code Duplication | public function getActionsInfo($evidence = null) |
|
1464 | |||
1465 | /** |
||
1466 | * Obtain relations for current (or given) evidence |
||
1467 | * |
||
1468 | * @param string $evidence |
||
1469 | * @return array Evidence structure |
||
1470 | */ |
||
1471 | public function getRelationsInfo($evidence = null) |
||
1483 | |||
1484 | /** |
||
1485 | * Obtain info for current (or given) evidence |
||
1486 | * |
||
1487 | * @param string $evidence |
||
1488 | * @return array Evidence info |
||
1489 | */ |
||
1490 | View Code Duplication | public function getEvidenceInfo($evidence = null) |
|
1501 | |||
1502 | /** |
||
1503 | * Obtain name for current (or given) evidence path |
||
1504 | * |
||
1505 | * @param string $evidence Evidence Path |
||
1506 | * @return array Evidence info |
||
1507 | */ |
||
1508 | View Code Duplication | public function getEvidenceName($evidence = null) |
|
1519 | |||
1520 | /** |
||
1521 | * Perform given action (if availble) on current evidence/record |
||
1522 | * @url https://demo.flexibee.eu/devdoc/actions |
||
1523 | * |
||
1524 | * @param string $action one of evidence actions |
||
1525 | * @param string $method ext|int External method call operation in URL. |
||
1526 | * Internal add the @action element to request body |
||
1527 | */ |
||
1528 | public function performAction($action, $method = 'ext') |
||
1563 | |||
1564 | /** |
||
1565 | * Save current object to file |
||
1566 | * |
||
1567 | * @param string $destfile path to file |
||
1568 | */ |
||
1569 | public function saveResponseToFile($destfile) |
||
1576 | |||
1577 | /** |
||
1578 | * Obtain established relations listing |
||
1579 | * |
||
1580 | * @return array Null or Relations |
||
1581 | */ |
||
1582 | public function getVazby() |
||
1592 | |||
1593 | /** |
||
1594 | * Gives You URL for Current Record in FlexiBee web interface |
||
1595 | * |
||
1596 | * @return string url |
||
1597 | */ |
||
1598 | public function getFlexiBeeURL() |
||
1611 | |||
1612 | /** |
||
1613 | * Set Record Key |
||
1614 | * |
||
1615 | * @param int|string $myKeyValue |
||
1616 | * @return boolean |
||
1617 | */ |
||
1618 | public function setMyKey($myKeyValue) |
||
1624 | |||
1625 | /** |
||
1626 | * Set or get ignore not found pages flag |
||
1627 | * |
||
1628 | * @param boolean $ignore set flag to |
||
1629 | * |
||
1630 | * @return boolean get flag state |
||
1631 | */ |
||
1632 | public function ignore404($ignore = null) |
||
1639 | |||
1640 | /** |
||
1641 | * Send Document by mail |
||
1642 | * |
||
1643 | * @url https://www.flexibee.eu/api/dokumentace/ref/odesilani-mailem/ |
||
1644 | * |
||
1645 | * @param string $to |
||
1646 | * @param string $subject |
||
1647 | * @param string $body Email Text |
||
1648 | * |
||
1649 | * @return int http response code |
||
1650 | */ |
||
1651 | public function sendByMail($to, $subject, $body, $cc = null) |
||
1659 | |||
1660 | /** |
||
1661 | * Send all unsent Invoices by mail |
||
1662 | * |
||
1663 | * @url https://www.flexibee.eu/api/dokumentace/ref/odesilani-mailem/ |
||
1664 | * @return int http response code |
||
1665 | */ |
||
1666 | public function sendUnsent() |
||
1671 | |||
1672 | /** |
||
1673 | * FlexiBee date to PHP DateTime |
||
1674 | * |
||
1675 | * @param string $flexidate |
||
1676 | * @return \DateTime |
||
1677 | */ |
||
1678 | public static function flexiDateToDateTime($flexidate) |
||
1682 | |||
1683 | /** |
||
1684 | * Uloží dokument v daném formátu do složky v systému souborů |
||
1685 | * Save document in given format to directory in filesystem |
||
1686 | * |
||
1687 | * @param string $format pdf/csv/xml/json/ ... |
||
1688 | * @param string $destDir where to put file (prefix) |
||
1689 | * |
||
1690 | * @return string|null filename downloaded or none |
||
1691 | */ |
||
1692 | public function downloadInFormat($format, $destDir = './') |
||
1704 | |||
1705 | public function error500Reporter($errorResponse) |
||
1712 | } |
||
1713 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.