Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 628f9dd

Browse files
Merge pull request #5 from adrorocker/analysis-qvKVvv
Apply fixes from StyleCI
2 parents 3441c28 + 5b6df0c commit 628f9dd

24 files changed

+212
-207
lines changed

‎extra/Entities/Bridge.php‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
10+
911
namespace PhpFirebase\Entities;
1012

1113
use ReflectionObject;
@@ -23,17 +25,16 @@ class Bridge
2325
*/
2426
protected $properties = [];
2527

26-
2728
/**
28-
* Make non-public members of the given object accessible
29+
* Make non-public members of the given object accessible.
2930
*
3031
* @param object $object.- Object which members we'll make accessible
3132
*/
3233
public function __construct($object)
3334
{
3435
$this->object = $object;
3536
$reflected = new ReflectionObject($this->object);
36-
$this->properties = array();
37+
$this->properties = [];
3738

3839
$properties = $reflected->getProperties(
3940
ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE | ReflectionProperty::IS_PUBLIC
@@ -51,7 +52,7 @@ public function getProperties()
5152
}
5253

5354
/**
54-
* Returns a property of $this->object
55+
* Returns a property of $this->object.
5556
*
5657
* @param string $name
5758
*
@@ -64,7 +65,5 @@ public function __get($name)
6465
if (isset($this->properties[$name])) {
6566
return $this->properties[$name]->getValue($this->object);
6667
}
67-
68-
return null;
6968
}
7069
}

‎extra/Entities/Call.php‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
10+
911
namespace PhpFirebase\Entities;
1012

1113
use BadMethodCallException;
@@ -15,10 +17,10 @@
1517
trait Call
1618
{
1719
/**
18-
* Get or Set property
20+
* Get or Set property.
1921
*
20-
* @param string $name Name of the method
21-
* @param array $arguments Arguments
22+
* @param string $name Name of the method
23+
* @param array $arguments Arguments
2224
*
2325
* @throws BadMethodCallException If the $name is not a property
2426
*/
@@ -32,9 +34,9 @@ public function __call($name, $arguments)
3234
}
3335
if ($arguments && count($arguments) == 1) {
3436
$reflect = new ReflectionClass($this);
35-
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
37+
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
3638
foreach ($props as $prop) {
37-
if ($prop->getName() == $name) {
39+
if ($prop->getName() == $name) {
3840
$this->{$name} = $arguments[0];
3941
}
4042
}

‎extra/Entities/Entity.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
9-
namespace PhpFirebase\Entities;
1010

11-
use ReflectionObject;
12-
use ReflectionProperty;
11+
namespace PhpFirebase\Entities;
1312

1413
class Entity implements EntityInterface
1514
{

‎extra/Entities/EntityInterface.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
10+
911
namespace PhpFirebase\Entities;
1012

1113
interface EntityInterface

‎extra/Entities/Repository/Repository.php‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
10+
911
namespace PhpFirebase\Entities\Repository;
1012

13+
use PhpFirebase\Clients\GuzzleClient;
1114
use PhpFirebase\Entities\Entity;
1215
use PhpFirebase\Entities\EntityInterface;
1316
use PhpFirebase\Firebase;
14-
use PhpFirebase\Clients\GuzzleClient;
1517

1618
abstract class Repository implements RepositoryInterface
1719
{
@@ -41,7 +43,7 @@ public function __construct($base, $token = null, $endpoint = null)
4143
$this->firebase = new Firebase(
4244
$this->base,
4345
$this->token,
44-
new GuzzleClient(['verify' => false,])
46+
new GuzzleClient(['verify' => false])
4547
);
4648

4749
$this->endpoint = $endpoint;
@@ -58,23 +60,22 @@ public function store($entity)
5860
foreach ($entity as &$record) {
5961
$id = $record->id() ? $record->id() : guid();
6062
$record->id($id);
61-
$this->firebase->put($this->endpoint . '/'.$id, $record->toArray());
63+
$this->firebase->put($this->endpoint.'/'.$id, $record->toArray());
6264
$record = $this->find($id);
6365
}
6466
} elseif ($entity instanceof EntityInterface) {
6567
$id = $entity->id() ? $entity->id() : guid();
6668
$entity->id($id);
67-
$response = $this->firebase->put($this->endpoint . '/'.$id, $entity->toArray());
69+
$response = $this->firebase->put($this->endpoint.'/'.$id, $entity->toArray());
6870
$entity = $this->find($id);
6971
}
7072

71-
7273
return $entity;
7374
}
7475

7576
public function find($id)
7677
{
77-
$model = (array) $this->firebase->get($this->endpoint . '/'.$id);
78+
$model = (array) $this->firebase->get($this->endpoint.'/'.$id);
7879
$class = $this->class;
7980
$this->model = new $class($model);
8081

‎extra/Entities/Repository/RepositoryInterface.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
10+
911
namespace PhpFirebase\Entities\Repository;
1012

1113
interface RepositoryInterface

‎extra/Entities/functions.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
9-
1010
function guid()
1111
{
1212
if (function_exists('com_create_guid') === true) {

‎src/Clients/GuzzleClient.php‎

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,55 @@
11
<?php
22
/**
3-
* PHP-Firebase
3+
* PHP-Firebase.
44
*
55
* @link https://github.com/adrorocker/php-firebase
6+
*
67
* @copyright Copyright (c) 2018 Adro Rocker
78
* @author Adro Rocker <mes@adro.rocks>
89
*/
10+
911
namespace PhpFirebase\Clients;
1012

11-
use InvalidArgumentException;
12-
use PhpFirebase\Interfaces\ClientInterface;
1313
use GuzzleHttp\Client as HttpClient;
14-
use GuzzleHttp\Exception\ClientException;
1514
use GuzzleHttp\Psr7\Request;
1615
use GuzzleHttp\Psr7\Response;
17-
use GuzzleHttp\Psr7\Uri;
16+
use PhpFirebase\Interfaces\ClientInterface;
1817
use function GuzzleHttp\Psr7\stream_for;
1918

2019
/**
2120
* Guzzle Client.
2221
*
23-
* @package PhpFirebase
24-
* @subpackage Clients
2522
* @since 0.1.0
2623
*/
2724
class GuzzleClient implements ClientInterface
2825
{
2926
/**
30-
* Guzzle client
27+
* Guzzle client.
3128
*
3229
* @var \GuzzleHttp\Client
3330
*/
3431
protected $guzzle;
3532

3633
/**
37-
* Set the the guzzle client
34+
* Set the the guzzle client.
3835
*
39-
* @param array $options The options to set the defaul
40-
* @param Object|null $client Client to make the requests
36+
* @param array $options The options to set the defaul
37+
* @param object|null $client Client to make the requests
4138
*/
4239
public function __construct(array $options = [], $client = null)
4340
{
4441
if (!$client) {
4542
$client = new HttpClient($options);
4643
}
47-
44+
4845
$this->guzzle = $client;
4946
}
5047

5148
/**
52-
* Create a new GET reuest
49+
* Create a new GET reuest.
5350
*
5451
* @param string $endpoint The sub endpoint
55-
* @param array $headers Request headers
52+
* @param array $headers Request headers
5653
*
5754
* @return array
5855
*/
@@ -66,11 +63,11 @@ public function get($endpoint, $headers = [])
6663
}
6764

6865
/**
69-
* Create a new POST reuest
66+
* Create a new POST reuest.
7067
*
71-
* @param string $endpoint The sub endpoint
72-
* @param string|array $data The data to be submited
73-
* @param array $headers Request headers
68+
* @param string $endpoint The sub endpoint
69+
* @param string|array $data The data to be submited
70+
* @param array $headers Request headers
7471
*
7572
* @return array
7673
*/
@@ -84,11 +81,11 @@ public function post($endpoint, $data, $headers = [])
8481
}
8582

8683
/**
87-
* Create a new PUT reuest
84+
* Create a new PUT reuest.
8885
*
89-
* @param string $endpoint The sub endpoint
90-
* @param string|array $data The data to be submited
91-
* @param array $headers Request headers
86+
* @param string $endpoint The sub endpoint
87+
* @param string|array $data The data to be submited
88+
* @param array $headers Request headers
9289
*
9390
* @return array
9491
*/
@@ -102,11 +99,11 @@ public function put($endpoint, $data, $headers = [])
10299
}
103100

104101
/**
105-
* Create a new PATCH reuest
102+
* Create a new PATCH reuest.
106103
*
107-
* @param string $endpoint The sub endpoint
108-
* @param string|array $data The data to be submited
109-
* @param array $headers Request headers
104+
* @param string $endpoint The sub endpoint
105+
* @param string|array $data The data to be submited
106+
* @param array $headers Request headers
110107
*
111108
* @return array
112109
*/
@@ -120,10 +117,10 @@ public function patch($endpoint, $data, $headers = [])
120117
}
121118

122119
/**
123-
* Create a new DELETE reuest
120+
* Create a new DELETE reuest.
124121
*
125122
* @param string $endpoint The sub endpoint
126-
* @param array $headers Request headers
123+
* @param array $headers Request headers
127124
*
128125
* @return array
129126
*/
@@ -136,10 +133,8 @@ public function delete($endpoint, $headers = [])
136133
return $this->handle($response);
137134
}
138135

139-
140-
141136
/**
142-
* Handle the response
137+
* Handle the response.
143138
*
144139
* @param \GuzzleHttp\Psr7\Response $response The response
145140
*

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /