formatting
This commit is contained in:
parent
7f16b67d02
commit
2f5aa63306
@ -1,8 +1,12 @@
|
||||
{
|
||||
"com.thorlaksson.phpcs.formatOnSave" : true,
|
||||
"com.thorlaksson.phpcs.runOnChange" : "onSave",
|
||||
"com.thorlaksson.phpcs.standard" : "phpcs.xml",
|
||||
"editor.default_syntax" : "php",
|
||||
"php.validate" : "onSave",
|
||||
"prettier.format-on-save" : "Disable",
|
||||
"prettier.format-on-save.ignore-remote" : "Disable",
|
||||
"prettier.format-on-save.ignore-without-config" : "Disable",
|
||||
"workspace.color" : 1,
|
||||
"workspace.name" : "APnutI"
|
||||
}
|
||||
|
@ -18,10 +18,10 @@
|
||||
<property name="eolChar" value="\n"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<arg name="tab-width" value="2"/>
|
||||
<arg name="tab-width" value="4"/>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
<property name="indent" value="2"/>
|
||||
<property name="indent" value="4"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
|
1616
src/APnutI.php
1616
src/APnutI.php
File diff suppressed because it is too large
Load Diff
74
src/Meta.php
74
src/Meta.php
@ -9,43 +9,43 @@ use APnutI\Exceptions\HttpPnutForbiddenException;
|
||||
|
||||
class Meta
|
||||
{
|
||||
public bool $more = false;
|
||||
public ?int $max_id = null;
|
||||
public ?int $min_id = null;
|
||||
public ?int $code = -1;
|
||||
public bool $more = false;
|
||||
public ?int $max_id = null;
|
||||
public ?int $min_id = null;
|
||||
public ?int $code = -1;
|
||||
|
||||
public function __construct(array $json)
|
||||
{
|
||||
if (empty($json['meta'])) {
|
||||
return;
|
||||
public function __construct(array $json)
|
||||
{
|
||||
if (empty($json['meta'])) {
|
||||
return;
|
||||
}
|
||||
$meta = (array)$json['meta'];
|
||||
if (!empty($meta['more'])) {
|
||||
$this->more = (bool)$meta['more'];
|
||||
}
|
||||
if (!empty($meta['max_id'])) {
|
||||
$this->max_id = (int)$meta['max_id'];
|
||||
}
|
||||
if (!empty($meta['min_id'])) {
|
||||
$this->min_id = (int)$meta['min_id'];
|
||||
}
|
||||
if (!empty($meta['code'])) {
|
||||
$this->code = $meta['code'];
|
||||
if ($this->code === 400) {
|
||||
throw new PnutException($meta['error_message']);
|
||||
}
|
||||
if ($this->code === 401) {
|
||||
throw new NotAuthorizedException($meta['error_message']);
|
||||
}
|
||||
if ($this->code === 403) {
|
||||
throw new HttpPnutForbiddenException();
|
||||
}
|
||||
if ($this->code === 404) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
if ($meta['code'] < 200 || $meta['code'] >= 300) {
|
||||
throw new PnutException($meta['error_message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$meta = (array)$json['meta'];
|
||||
if (!empty($meta['more'])) {
|
||||
$this->more = (bool)$meta['more'];
|
||||
}
|
||||
if (!empty($meta['max_id'])) {
|
||||
$this->max_id = (int)$meta['max_id'];
|
||||
}
|
||||
if (!empty($meta['min_id'])) {
|
||||
$this->min_id = (int)$meta['min_id'];
|
||||
}
|
||||
if (!empty($meta['code'])) {
|
||||
$this->code = $meta['code'];
|
||||
if ($this->code === 400) {
|
||||
throw new PnutException($meta['error_message']);
|
||||
}
|
||||
if ($this->code === 401) {
|
||||
throw new NotAuthorizedException($meta['error_message']);
|
||||
}
|
||||
if ($this->code === 403) {
|
||||
throw new HttpPnutForbiddenException();
|
||||
}
|
||||
if ($this->code === 404) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
if ($meta['code'] < 200 || $meta['code'] >= 300) {
|
||||
throw new PnutException($meta['error_message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user