@@ -89,6 +89,9 @@ |
||
| 89 | 89 | return $this->requestUrl; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | + /** |
|
| 93 | + * @param string $apiUrl |
|
| 94 | + */ |
|
| 92 | 95 | private function download($apiUrl /* ... params */) |
| 93 | 96 | { |
| 94 | 97 | $args = func_get_args(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | - * @param string|DateTime $str |
|
| 119 | + * @param string $str |
|
| 120 | 120 | * @return self |
| 121 | 121 | */ |
| 122 | 122 | public function setDate($str) |
@@ -173,6 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | abstract protected function getExpectedProperty(); |
| 175 | 175 | |
| 176 | + /** |
|
| 177 | + * @return string |
|
| 178 | + */ |
|
| 176 | 179 | abstract public function getStartXmlElement(); |
| 177 | 180 | |
| 178 | 181 | private function getProperties() |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | $this->setDate('now'); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @return self |
|
| 66 | - * @throws Fio\InvalidArgumentException |
|
| 67 | - */ |
|
| 64 | + /** |
|
| 65 | + * @return self |
|
| 66 | + * @throws Fio\InvalidArgumentException |
|
| 67 | + */ |
|
| 68 | 68 | public function setAmount($val) |
| 69 | 69 | { |
| 70 | 70 | $this->amount = floatval($val); |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | abstract public function setAccountTo($accountTo); |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Currency code ISO 4217. |
|
| 85 | - * @param string $code case insensitive |
|
| 86 | - * @return self |
|
| 87 | - * @throws Fio\InvalidArgumentException |
|
| 88 | - */ |
|
| 83 | + /** |
|
| 84 | + * Currency code ISO 4217. |
|
| 85 | + * @param string $code case insensitive |
|
| 86 | + * @return self |
|
| 87 | + * @throws Fio\InvalidArgumentException |
|
| 88 | + */ |
|
| 89 | 89 | public function setCurrency($code) |
| 90 | 90 | { |
| 91 | 91 | if (!preg_match('~[a-z]{3}~i', $code)) { |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | return $this; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * @param string $ks |
|
| 100 | - * @return self |
|
| 101 | - * @throws Fio\InvalidArgumentException |
|
| 102 | - */ |
|
| 98 | + /** |
|
| 99 | + * @param string $ks |
|
| 100 | + * @return self |
|
| 101 | + * @throws Fio\InvalidArgumentException |
|
| 102 | + */ |
|
| 103 | 103 | public function setConstantSymbol($ks) |
| 104 | 104 | { |
| 105 | 105 | if (!$ks) { |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | return $this; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * @return self |
|
| 136 | - * @throws Fio\InvalidArgumentException |
|
| 137 | - */ |
|
| 134 | + /** |
|
| 135 | + * @return self |
|
| 136 | + * @throws Fio\InvalidArgumentException |
|
| 137 | + */ |
|
| 138 | 138 | public function setPaymentReason($code) |
| 139 | 139 | { |
| 140 | 140 | if (!$code) { |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | return $this; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - /** |
|
| 150 | - * @param string $ss |
|
| 151 | - * @return self |
|
| 152 | - * @throws Fio\InvalidArgumentException |
|
| 153 | - */ |
|
| 149 | + /** |
|
| 150 | + * @param string $ss |
|
| 151 | + * @return self |
|
| 152 | + * @throws Fio\InvalidArgumentException |
|
| 153 | + */ |
|
| 154 | 154 | public function setSpecificSymbol($ss) |
| 155 | 155 | { |
| 156 | 156 | if (!$ss) { |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | return $this; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * @param string|int $vs |
|
| 167 | - * @return self |
|
| 168 | - * @throws Fio\InvalidArgumentException |
|
| 169 | - */ |
|
| 165 | + /** |
|
| 166 | + * @param string|int $vs |
|
| 167 | + * @return self |
|
| 168 | + * @throws Fio\InvalidArgumentException |
|
| 169 | + */ |
|
| 170 | 170 | public function setVariableSymbol($vs) |
| 171 | 171 | { |
| 172 | 172 | if (!$vs) { |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | /** @var string */ |
| 21 | 21 | private $temp; |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $temp |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct($temp) |
| 24 | 27 | { |
| 25 | 28 | $this->temp = $temp; |
@@ -25,6 +25,9 @@ discard block |
||
| 25 | 25 | /** @var string */ |
| 26 | 26 | private $tempDir; |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $tempDir |
|
| 30 | + */ |
|
| 28 | 31 | public function __construct($tempDir) |
| 29 | 32 | { |
| 30 | 33 | $this->tempDir = $tempDir; |
@@ -90,7 +93,7 @@ discard block |
||
| 90 | 93 | |
| 91 | 94 | /** |
| 92 | 95 | * @param $token |
| 93 | - * @param $fallback |
|
| 96 | + * @param \Closure $fallback |
|
| 94 | 97 | * @param string $action |
| 95 | 98 | * @return GuzzleHttp\Psr7\Stream |
| 96 | 99 | * @throws Fio\QueueLimitException |
@@ -142,6 +145,9 @@ discard block |
||
| 142 | 145 | } |
| 143 | 146 | } |
| 144 | 147 | |
| 148 | + /** |
|
| 149 | + * @param string $filename |
|
| 150 | + */ |
|
| 145 | 151 | private static function sleep($filename) |
| 146 | 152 | { |
| 147 | 153 | $criticalTime = time() - filemtime($filename); |
@@ -164,6 +170,9 @@ discard block |
||
| 164 | 170 | return self::$tokens[$key]; |
| 165 | 171 | } |
| 166 | 172 | |
| 173 | + /** |
|
| 174 | + * @param string $filename |
|
| 175 | + */ |
|
| 167 | 176 | private static function safeProtocol($filename) |
| 168 | 177 | { |
| 169 | 178 | return Utils\SafeStream::PROTOCOL . '://' . $filename; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | }, 'download'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @return Pay\IResponse |
|
| 75 | - * @throws Fio\QueueLimitException |
|
| 76 | - * @throws Fio\ServiceUnavailableException |
|
| 77 | - */ |
|
| 73 | + /** |
|
| 74 | + * @return Pay\IResponse |
|
| 75 | + * @throws Fio\QueueLimitException |
|
| 76 | + * @throws Fio\ServiceUnavailableException |
|
| 77 | + */ |
|
| 78 | 78 | public function upload($url, $token, array $post, $filename) |
| 79 | 79 | { |
| 80 | 80 | $newPost = []; |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | self::sleep($tempFile); |
| 120 | 120 | $next = true; |
| 121 | 121 | } catch (GuzzleHttp\Exception\ServerException $e) { |
| 122 | - if($e->hasResponse()) { |
|
| 123 | - self::detectDownloadResponse( $e->getResponse() ); |
|
| 124 | - } |
|
| 125 | - throw new Fio\ServiceUnavailableException('Service is currently unavailable'); |
|
| 126 | - } |
|
| 122 | + if($e->hasResponse()) { |
|
| 123 | + self::detectDownloadResponse( $e->getResponse() ); |
|
| 124 | + } |
|
| 125 | + throw new Fio\ServiceUnavailableException('Service is currently unavailable'); |
|
| 126 | + } |
|
| 127 | 127 | } while ($next); |
| 128 | 128 | fclose($file); |
| 129 | 129 | touch($tempFile); |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | return $response->getBody(); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * @param $response |
|
| 140 | - * @throws Fio\ServiceUnavailableException |
|
| 141 | - */ |
|
| 142 | - private static function detectDownloadResponse($response) |
|
| 138 | + /** |
|
| 139 | + * @param $response |
|
| 140 | + * @throws Fio\ServiceUnavailableException |
|
| 141 | + */ |
|
| 142 | + private static function detectDownloadResponse($response) |
|
| 143 | 143 | { |
| 144 | 144 | /* @var $contentTypeHeaders array */ |
| 145 | 145 | $contentTypeHeaders = $response->getHeader('Content-Type'); |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | /** @var string */ |
| 15 | 15 | private $token; |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * FioAccount constructor. |
|
| 19 | - * @param $account |
|
| 20 | - * @param $token |
|
| 21 | - * @throws \h4kuna\Fio\AccountException |
|
| 22 | - */ |
|
| 23 | - public function __construct($account, $token) |
|
| 17 | + /** |
|
| 18 | + * FioAccount constructor. |
|
| 19 | + * @param $account |
|
| 20 | + * @param $token |
|
| 21 | + * @throws \h4kuna\Fio\AccountException |
|
| 22 | + */ |
|
| 23 | + public function __construct($account, $token) |
|
| 24 | 24 | { |
| 25 | 25 | $this->account = new Bank($account); |
| 26 | 26 | $this->token = $token; |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | return reset($this->accounts); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param string $alias |
|
| 38 | - * @param FioAccount $account |
|
| 39 | - * @return self |
|
| 40 | - * @throws \h4kuna\Fio\AccountException |
|
| 41 | - */ |
|
| 36 | + /** |
|
| 37 | + * @param string $alias |
|
| 38 | + * @param FioAccount $account |
|
| 39 | + * @return self |
|
| 40 | + * @throws \h4kuna\Fio\AccountException |
|
| 41 | + */ |
|
| 42 | 42 | public function addAccount($alias, FioAccount $account) |
| 43 | 43 | { |
| 44 | 44 | if (isset($this->accounts[$alias])) { |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | return $data; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @param $data |
|
| 43 | - * @param $dateFormat |
|
| 44 | - * @return TransactionAbstract|null|string |
|
| 45 | - * @throws Fio\InvalidArgumentException |
|
| 46 | - * @throws Fio\TransactionExtendException |
|
| 47 | - * @throws Fio\TransactionPropertyException |
|
| 48 | - */ |
|
| 49 | - public function createTransaction($data, $dateFormat) |
|
| 41 | + /** |
|
| 42 | + * @param $data |
|
| 43 | + * @param $dateFormat |
|
| 44 | + * @return TransactionAbstract|null|string |
|
| 45 | + * @throws Fio\InvalidArgumentException |
|
| 46 | + * @throws Fio\TransactionExtendException |
|
| 47 | + * @throws Fio\TransactionPropertyException |
|
| 48 | + */ |
|
| 49 | + public function createTransaction($data, $dateFormat) |
|
| 50 | 50 | { |
| 51 | 51 | $transaction = $this->createTransactionObject($dateFormat); |
| 52 | 52 | foreach (self::metaProperty($transaction) as $id => $meta) { |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | return new TransactionList($info); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @param $dateFormat |
|
| 67 | - * @return TransactionAbstract|null|string |
|
| 68 | - * @throws Fio\InvalidArgumentException |
|
| 69 | - * @throws Fio\TransactionExtendException |
|
| 70 | - */ |
|
| 71 | - protected function createTransactionObject($dateFormat) |
|
| 65 | + /** |
|
| 66 | + * @param $dateFormat |
|
| 67 | + * @return TransactionAbstract|null|string |
|
| 68 | + * @throws Fio\InvalidArgumentException |
|
| 69 | + * @throws Fio\TransactionExtendException |
|
| 70 | + */ |
|
| 71 | + protected function createTransactionObject($dateFormat) |
|
| 72 | 72 | { |
| 73 | 73 | if ($this->transactionClassCheck === false) { |
| 74 | 74 | if (is_string($this->transactionClass)) { |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | return clone $this->transactionClass; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @param $class |
|
| 92 | - * @return array|string[] |
|
| 93 | - * @throws Fio\TransactionPropertyException |
|
| 94 | - */ |
|
| 95 | - private static function metaProperty($class) |
|
| 90 | + /** |
|
| 91 | + * @param $class |
|
| 92 | + * @return array|string[] |
|
| 93 | + * @throws Fio\TransactionPropertyException |
|
| 94 | + */ |
|
| 95 | + private static function metaProperty($class) |
|
| 96 | 96 | { |
| 97 | 97 | if (self::$property !== null) { |
| 98 | 98 | return self::$property; |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | $this->dateFormat = $dateFormat; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @param $name |
|
| 27 | - * @return mixed |
|
| 28 | - * @throws Fio\TransactionPropertyException |
|
| 29 | - */ |
|
| 30 | - public function __get($name) |
|
| 25 | + /** |
|
| 26 | + * @param $name |
|
| 27 | + * @return mixed |
|
| 28 | + * @throws Fio\TransactionPropertyException |
|
| 29 | + */ |
|
| 30 | + public function __get($name) |
|
| 31 | 31 | { |
| 32 | 32 | if (array_key_exists($name, $this->properties)) { |
| 33 | 33 | return $this->properties[$name]; |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | $this->xmlFile = $xmlFile; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - /** @return Pay\Payment\Euro |
|
| 32 | - * @throws InvalidArgumentException |
|
| 33 | - * @throws InvalidArgumentException |
|
| 34 | - */ |
|
| 31 | + /** @return Pay\Payment\Euro |
|
| 32 | + * @throws InvalidArgumentException |
|
| 33 | + * @throws InvalidArgumentException |
|
| 34 | + */ |
|
| 35 | 35 | public function createEuro($amount, $accountTo, $name) |
| 36 | 36 | { |
| 37 | 37 | return (new Pay\Payment\Euro($this->account)) |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | ->setAmount($amount); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - /** @return Pay\Payment\National |
|
| 44 | - * @throws InvalidArgumentException |
|
| 45 | - */ |
|
| 43 | + /** @return Pay\Payment\National |
|
| 44 | + * @throws InvalidArgumentException |
|
| 45 | + */ |
|
| 46 | 46 | public function createNational($amount, $accountTo, $bankCode = null) |
| 47 | 47 | { |
| 48 | 48 | return (new Pay\Payment\National($this->account)) |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | ->setAmount($amount); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - /** @return Pay\Payment\International |
|
| 54 | - * @throws InvalidArgumentException |
|
| 55 | - */ |
|
| 53 | + /** @return Pay\Payment\International |
|
| 54 | + * @throws InvalidArgumentException |
|
| 55 | + */ |
|
| 56 | 56 | public function createInternational($amount, $accountTo, $bic, $name, $street, $city, $country, $info) |
| 57 | 57 | { |
| 58 | 58 | return (new Pay\Payment\International($this->account)) |