Skip to content

Commit 7c82aef

Browse files
committed
Updates arrays to use shorter syntax.
1 parent 392fe67 commit 7c82aef

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Provider.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class Provider
2222
*
2323
* @return Provider|bool
2424
*/
25-
public static function instance(string $provider, array $data = array())
25+
public static function instance(string $provider, array $data = [])
2626
{
2727
$class = __NAMESPACE__ . '\\Provider\\' . ucfirst($provider);
2828
if (!class_exists($class)) {
@@ -39,7 +39,7 @@ public static function instance(string $provider, array $data = array())
3939
*
4040
* @return void
4141
*/
42-
public function __construct(array $data = array())
42+
public function __construct(array $data = [])
4343
{
4444
$this->loadData($data);
4545
}
@@ -51,7 +51,7 @@ public function __construct(array $data = array())
5151
*
5252
* @return void
5353
*/
54-
protected function loadData(array $data = array())
54+
protected function loadData(array $data = [])
5555
{
5656
foreach ($data as $key => $value) {
5757
if (property_exists($this, $key)) {

src/Provider/Embedly.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ class Embedly extends Provider
2525
*
2626
* @return void
2727
*/
28-
public function __construct(array $data = array())
28+
public function __construct(array $data = [])
2929
{
3030
parent::__construct($data);
3131

32-
$this->extractor = new EmbedlySDK(array(
32+
$this->extractor = new EmbedlySDK([
3333
'key' => $this->api_key,
34-
));
34+
]);
3535
}
3636

3737
/**
@@ -43,7 +43,7 @@ public function __construct(array $data = array())
4343
*/
4444
public function extract(string $url): Content
4545
{
46-
$data = $this->extractor->extract(array('url' => $url));
46+
$data = $this->extractor->extract(['url' => $url]);
4747

4848
$content = new Content();
4949
$content->text = $this->cleanText($data[0]->content);

src/Provider/Goose.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Goose extends Provider
1818
*
1919
* @return void
2020
*/
21-
public function __construct(array $data = array())
21+
public function __construct(array $data = [])
2222
{
2323
parent::__construct($data);
2424

tests/Unit/ProviderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testProviderIsInvalid()
2929

3030
public function testProviderMetaDataIsSet()
3131
{
32-
$provider = Provider::instance('embedly', array('api_key' => 'SDGJ8924TFDSF713J'));
32+
$provider = Provider::instance('embedly', ['api_key' => 'SDGJ8924TFDSF713J']);
3333

3434
$this->assertObjectHasAttribute('api_key', $provider);
3535
$this->assertAttributeEquals('SDGJ8924TFDSF713J', 'api_key', $provider);

0 commit comments

Comments
 (0)