-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cloudingcity/refactor/change-collection-to…
…-array Refactor/change collection to array
- Loading branch information
Showing
19 changed files
with
238 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Clouding\Presto\Collectors; | ||
|
||
class BasicCollector implements Collectorable | ||
{ | ||
/** | ||
* The array of collect data. | ||
* | ||
* @var array | ||
*/ | ||
protected $collection = []; | ||
|
||
/** | ||
* Collect data from presto response. | ||
* | ||
* @param object $response | ||
*/ | ||
public function collect(object $response) | ||
{ | ||
if (!isset($response->data)) { | ||
return; | ||
} | ||
|
||
$this->collection = array_merge($this->collection, $response->data); | ||
} | ||
|
||
/** | ||
* Get collect data. | ||
* | ||
* @return array | ||
*/ | ||
public function get(): array | ||
{ | ||
return $this->collection; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Clouding\Presto\Collectors; | ||
|
||
interface Collectorable | ||
{ | ||
/** | ||
* Collect needs data from presto response. | ||
* | ||
* @param object $response | ||
*/ | ||
public function collect(object $response); | ||
|
||
/** | ||
* Get collect data. | ||
* | ||
* @return array | ||
*/ | ||
public function get(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.