diff --git a/examples/ares.php b/examples/ares.php index dbf6ff2..43d9c8b 100644 --- a/examples/ares.php +++ b/examples/ares.php @@ -1,6 +1,6 @@ balancer = $balancer; } - $this->cacheDir = $cacheDir.'/ares'; + $this->cacheDir = $cacheDir . '/ares'; $this->debug = $debug; // Create cache dirs if they doesn't exist @@ -118,10 +122,10 @@ public function getLastUrl() /** * @param $id * - * @throws InvalidArgumentException + * @return AresRecord * @throws Ares\AresException * - * @return AresRecord + * @throws InvalidArgumentException */ public function findByIdentificationNumber($id) { @@ -132,9 +136,9 @@ public function findByIdentificationNumber($id) throw new AresException('IČ firmy musí být zadáno.'); } - $cachedFileName = $id.'_'.date($this->cacheStrategy).'.php'; - $cachedFile = $this->cacheDir.'/bas_'.$cachedFileName; - $cachedRawFile = $this->cacheDir.'/bas_raw_'.$cachedFileName; + $cachedFileName = $id . '_' . date($this->cacheStrategy) . '.php'; + $cachedFile = $this->cacheDir . '/bas_' . $cachedFileName; + $cachedRawFile = $this->cacheDir . '/bas_raw_' . $cachedFileName; if (is_file($cachedFile)) { return unserialize(file_get_contents($cachedFile)); @@ -144,7 +148,7 @@ public function findByIdentificationNumber($id) $url = $this->wrapUrl(sprintf(self::URL_BAS, $id)); try { - $aresRequest = file_get_contents($url, null, stream_context_create($this->contextOptions)); + $aresRequest = file_get_contents($url, null, stream_context_create($this->contextOptions)); if ($this->debug) { file_put_contents($cachedRawFile, $aresRequest); } @@ -175,9 +179,9 @@ public function findByIdentificationNumber($id) } if (strval($elements->AA->N) === 'Praha') { //Praha - $record->setTown(strval($elements->AA->NMC).' - '.strval($elements->AA->NCO)); + $record->setTown(strval($elements->AA->NMC) . ' - ' . strval($elements->AA->NCO)); } elseif (strval($elements->AA->NCO) !== strval($elements->AA->N)) { //Ostrava - $record->setTown(strval($elements->AA->N).' - '.strval($elements->AA->NCO)); + $record->setTown(strval($elements->AA->N) . ' - ' . strval($elements->AA->NCO)); } else { $record->setTown(strval($elements->AA->N)); } @@ -187,7 +191,7 @@ public function findByIdentificationNumber($id) throw new AresException('Databáze ARES není dostupná.'); } } catch (\Exception $e) { - throw new AresException($e->getMessage()); + throw new AresException($e->getMessage()); } file_put_contents($cachedFile, serialize($record)); @@ -198,10 +202,10 @@ public function findByIdentificationNumber($id) /** * @param $id * - * @throws InvalidArgumentException + * @return AresRecord * @throws Ares\AresException * - * @return AresRecord + * @throws InvalidArgumentException */ public function findInResById($id) { @@ -211,9 +215,9 @@ public function findInResById($id) // Sestaveni URL $url = $this->wrapUrl(sprintf(self::URL_RES, $id)); - $cachedFileName = $id.'_'.date($this->cacheStrategy).'.php'; - $cachedFile = $this->cacheDir.'/res_'.$cachedFileName; - $cachedRawFile = $this->cacheDir.'/res_raw_'.$cachedFileName; + $cachedFileName = $id . '_' . date($this->cacheStrategy) . '.php'; + $cachedFile = $this->cacheDir . '/res_' . $cachedFileName; + $cachedRawFile = $this->cacheDir . '/res_raw_' . $cachedFileName; if (is_file($cachedFile)) { return unserialize(file_get_contents($cachedFile)); @@ -258,10 +262,10 @@ public function findInResById($id) /** * @param $id * - * @throws InvalidArgumentException + * @return string * @throws \Exception * - * @return string + * @throws InvalidArgumentException */ public function findVatById($id) { @@ -272,9 +276,9 @@ public function findVatById($id) // Sestaveni URL $url = $this->wrapUrl(sprintf(self::URL_TAX, $id)); - $cachedFileName = $id.'_'.date($this->cacheStrategy).'.php'; - $cachedFile = $this->cacheDir.'/tax_'.$cachedFileName; - $cachedRawFile = $this->cacheDir.'/tax_raw_'.$cachedFileName; + $cachedFileName = $id . '_' . date($this->cacheStrategy) . '.php'; + $cachedFile = $this->cacheDir . '/tax_' . $cachedFileName; + $cachedRawFile = $this->cacheDir . '/tax_raw_' . $cachedFileName; if (is_file($cachedFile)) { return unserialize(file_get_contents($cachedFile)); @@ -313,10 +317,10 @@ public function findVatById($id) * @param string $name * @param null $city * - * @throws InvalidArgumentException + * @return array|AresRecord[]|AresRecords * @throws AresException * - * @return array|AresRecord[]|AresRecords + * @throws InvalidArgumentException */ public function findByName($name, $city = null) { @@ -330,9 +334,9 @@ public function findByName($name, $city = null) urlencode(Lib::stripDiacritics($city)) )); - $cachedFileName = date($this->cacheStrategy).'_'.md5($name.$city).'.php'; - $cachedFile = $this->cacheDir.'/find_'.$cachedFileName; - $cachedRawFile = $this->cacheDir.'/find_raw_'.$cachedFileName; + $cachedFileName = date($this->cacheStrategy) . '_' . md5($name . $city) . '.php'; + $cachedFile = $this->cacheDir . '/find_' . $cachedFileName; + $cachedRawFile = $this->cacheDir . '/find_raw_' . $cachedFileName; if (is_file($cachedFile)) { return unserialize(file_get_contents($cachedFile)); diff --git a/src/Ares/AresException.php b/src/Ares/AresException.php index 7fe0851..98145d5 100644 --- a/src/Ares/AresException.php +++ b/src/Ares/AresException.php @@ -9,4 +9,5 @@ */ class AresException extends \Exception { + } diff --git a/src/Ares/AresRecord.php b/src/Ares/AresRecord.php index 78dc7a3..298bb93 100644 --- a/src/Ares/AresRecord.php +++ b/src/Ares/AresRecord.php @@ -14,6 +14,7 @@ */ class AresRecord { + /** * @var int */ @@ -80,7 +81,8 @@ public function __construct( $streetOrientationNumber = null, $town = null, $zip = null - ) { + ) + { $this->companyId = $companyId; $this->taxId = !empty($taxId) ? $taxId : null; $this->companyName = $companyName; @@ -96,10 +98,10 @@ public function __construct( */ public function getStreetWithNumbers() { - return $this->street.' ' - .($this->streetOrientationNumber + return $this->street . ' ' + . ($this->streetOrientationNumber ? - $this->streetHouseNumber.'/'.$this->streetOrientationNumber + $this->streetHouseNumber . '/' . $this->streetOrientationNumber : $this->streetHouseNumber); } diff --git a/src/Ares/AresRecords.php b/src/Ares/AresRecords.php index 3fec549..90fad97 100644 --- a/src/Ares/AresRecords.php +++ b/src/Ares/AresRecords.php @@ -11,6 +11,7 @@ */ final class AresRecords implements \ArrayAccess, \IteratorAggregate, \Countable { + /** * @var AresRecord[] */ @@ -45,7 +46,7 @@ public function offsetGet($offset) } /** - * @param mixed $offset + * @param mixed $offset * @param AresRecord $value */ public function offsetSet($offset, $value) diff --git a/src/Ares/TaxRecord.php b/src/Ares/TaxRecord.php index fcf0a65..c9e7cbb 100644 --- a/src/Ares/TaxRecord.php +++ b/src/Ares/TaxRecord.php @@ -9,6 +9,7 @@ */ class TaxRecord { + /** * @var string */ diff --git a/src/Justice.php b/src/Justice.php index 2f7c467..9ff7877 100644 --- a/src/Justice.php +++ b/src/Justice.php @@ -12,6 +12,7 @@ final class Justice { + /** * @var string */ @@ -40,9 +41,9 @@ public function __construct(Client $client) /** * @param string $id * + * @return JusticeRecord|false * @throws SubjectNotFoundException * - * @return JusticeRecord|false */ public function findById($id) { @@ -94,6 +95,6 @@ private function extractDetailUrlFromCrawler(Crawler $crawler) return false; } - return self::URL_BASE.$href[1]; + return self::URL_BASE . $href[1]; } } diff --git a/src/Justice/JusticeRecord.php b/src/Justice/JusticeRecord.php index ae91543..e3048b6 100644 --- a/src/Justice/JusticeRecord.php +++ b/src/Justice/JusticeRecord.php @@ -6,6 +6,7 @@ final class JusticeRecord { + /** * @var array|Person[] */ diff --git a/src/Justice/SubjectNotFoundException.php b/src/Justice/SubjectNotFoundException.php index c554206..fc997f9 100644 --- a/src/Justice/SubjectNotFoundException.php +++ b/src/Justice/SubjectNotFoundException.php @@ -6,4 +6,5 @@ final class SubjectNotFoundException extends Exception { + } diff --git a/src/Parser/DateTimeParser.php b/src/Parser/DateTimeParser.php index b0084fa..2c439bd 100644 --- a/src/Parser/DateTimeParser.php +++ b/src/Parser/DateTimeParser.php @@ -7,6 +7,7 @@ final class DateTimeParser { + /** * @var string[] */ diff --git a/src/Parser/Helper/StringHelper.php b/src/Parser/Helper/StringHelper.php index eaac7ab..ada04bc 100644 --- a/src/Parser/Helper/StringHelper.php +++ b/src/Parser/Helper/StringHelper.php @@ -4,6 +4,7 @@ final class StringHelper { + /** * @param string $text * diff --git a/src/Parser/JusticeJednatelPersonParser.php b/src/Parser/JusticeJednatelPersonParser.php index 22a3830..9829e2c 100644 --- a/src/Parser/JusticeJednatelPersonParser.php +++ b/src/Parser/JusticeJednatelPersonParser.php @@ -8,6 +8,7 @@ final class JusticeJednatelPersonParser { + /** * @param Crawler $crawler * diff --git a/src/Parser/JusticeSpolecnikPersonParser.php b/src/Parser/JusticeSpolecnikPersonParser.php index 497132f..ba44553 100644 --- a/src/Parser/JusticeSpolecnikPersonParser.php +++ b/src/Parser/JusticeSpolecnikPersonParser.php @@ -8,6 +8,7 @@ final class JusticeSpolecnikPersonParser { + /** * @param Crawler $crawler * diff --git a/src/ValueObject/Person.php b/src/ValueObject/Person.php index eae961d..a73cd2d 100644 --- a/src/ValueObject/Person.php +++ b/src/ValueObject/Person.php @@ -7,6 +7,7 @@ final class Person { + /** * @var string */ diff --git a/tests/AresTest.php b/tests/AresTest.php index bec3581..c4c2e92 100644 --- a/tests/AresTest.php +++ b/tests/AresTest.php @@ -7,6 +7,7 @@ final class AresTest extends TestCase { + /** * @var Ares */ @@ -39,12 +40,12 @@ public function testFindByIdentificationNumberWithLeadingZeros() public function testFindByIdentificationNumberException() { $this->expectException(\Webnazakazku\Ares\AresException::class); - $this->ares->findByIdentificationNumber('A1234'); + $this->ares->findByIdentificationNumber('A1234'); } public function testFindByEmptyStringException() { - $this->expectException(\Webnazakazku\Ares\AresException::class); + $this->expectException(\Webnazakazku\Ares\AresException::class); $this->ares->findByIdentificationNumber(''); } @@ -57,10 +58,10 @@ public function testFindByName() public function testFindByNameNonExistentName() { - $this->expectException(\Webnazakazku\Ares\AresException::class); - $this->expectExceptionMessage('Nic nebylo nalezeno.'); + $this->expectException(\Webnazakazku\Ares\AresException::class); + $this->expectExceptionMessage('Nic nebylo nalezeno.'); - $this->ares->findByName('some non-existent company name'); + $this->ares->findByName('some non-existent company name'); } public function testGetCompanyPeople() @@ -77,9 +78,9 @@ public function testGetCompanyPeople() public function testBalancer() { - if ($this->isCI()) { - $this->markTestSkipped('GitHun Actions cannot connect to Justice.cz'); - } + if ($this->isCI()) { + $this->markTestSkipped('GitHun Actions cannot connect to Justice.cz'); + } $ares = new Ares(); $ares->setBalancer('http://some.loadbalancer.domain'); @@ -90,7 +91,7 @@ public function testBalancer() } $this->assertEquals( 'http://some.loadbalancer.domain' - .'?url=http%3A%2F%2Fwwwinfo.mfcr.cz%2Fcgi-bin%2Fares%2Fdarv_bas.cgi%3Fico%3D26168685', + . '?url=http%3A%2F%2Fwwwinfo.mfcr.cz%2Fcgi-bin%2Fares%2Fdarv_bas.cgi%3Fico%3D26168685', $ares->getLastUrl() ); } diff --git a/tests/JusticeTest.php b/tests/JusticeTest.php index 9d39a3b..0d3c7e6 100644 --- a/tests/JusticeTest.php +++ b/tests/JusticeTest.php @@ -8,6 +8,7 @@ final class JusticeTest extends TestCase { + /** * @var Justice */ @@ -42,15 +43,15 @@ public function testNotFoundFindId() $this->assertFalse($justiceRecord); } - /** - * @return bool - */ - private function isCI() - { - if (getenv('CI')) { - return true; - } - - return false; - } + /** + * @return bool + */ + private function isCI() + { + if (getenv('CI')) { + return true; + } + + return false; + } }