Skip to content

Commit

Permalink
Re-generating code with generator updates
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasmiller committed Feb 19, 2020
1 parent 1d9a355 commit 6a917cc
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 222 deletions.
1 change: 1 addition & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag"/>
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
<exclude name="PEAR.Commenting.FunctionComment.ParamCommentAlignment"/>
<exclude name="Generic.Files.LineLength.TooLong"/>
</rule>

<!-- How to scan -->
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^0.12.11",
"phpunit/phpunit": "^8",
"squizlabs/php_codesniffer": "^3.5"
},
Expand Down
6 changes: 3 additions & 3 deletions lib/recurly/base_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract protected function apiVersion(): string;
*
* @return \Recurly\RecurlyResource A Recurly Resource
*/
protected function makeRequest(string $method, string $path, ?array $body = [], ?array $params = []): \Recurly\RecurlyResource // phpcs:ignore Generic.Files.LineLength.TooLong
protected function makeRequest(string $method, string $path, ?array $body = [], ?array $params = []): \Recurly\RecurlyResource
{
$response = $this->_getResponse($method, $path, $body, $params);
$resource = $response->toResource();
Expand Down Expand Up @@ -168,11 +168,11 @@ private function _headers(): string
*/
public function setApiUrl(string $url): void
{
echo "[SECURITY WARNING] setApiUrl is for testing only and not supported in production." . PHP_EOL; // phpcs:ignore Generic.Files.LineLength.TooLong
echo "[SECURITY WARNING] setApiUrl is for testing only and not supported in production." . PHP_EOL;
if (getenv("RECURLY_INSECURE") == "true") {
$this->_baseUrl = $url;
} else {
echo "ApiUrl not changed. To change, set the environment variable RECURLY_INSECURE to true" . PHP_EOL; // phpcs:ignore Generic.Files.LineLength.TooLong
echo "ApiUrl not changed. To change, set the environment variable RECURLY_INSECURE to true" . PHP_EOL;
}
}

Expand Down
515 changes: 309 additions & 206 deletions lib/recurly/client.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/recurly/pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Pager implements \Iterator
* @param string $path Tokenized path to request
* @param array $params (optional) Query string parameters
*/
public function __construct(\Recurly\BaseClient $client, string $path, ?array $params = []) // phpcs:ignore Generic.Files.LineLength.TooLong
public function __construct(\Recurly\BaseClient $client, string $path, ?array $params = [])
{
$this->_client = $client;
$this->_path = $path;
Expand Down
4 changes: 2 additions & 2 deletions lib/recurly/recurly_error.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RecurlyError extends \Error
* @param string $message The error message from the API response
* @param \Recurly\Resources\ErrorMayHaveTransaction $api_error The error from the API response
*/
public function __construct(string $message, \Recurly\Resources\ErrorMayHaveTransaction $api_error = null) // phpcs:ignore Generic.Files.LineLength.TooLong
public function __construct(string $message, \Recurly\Resources\ErrorMayHaveTransaction $api_error = null)
{
parent::__construct($message);
$this->_api_error = $api_error;
Expand All @@ -39,7 +39,7 @@ public function getApiError(): \Recurly\Resources\ErrorMayHaveTransaction
*
* @return \Recurly\RecurlyError
*/
public static function fromResponse(\Recurly\Response $response): \Recurly\RecurlyError // phpcs:ignore Generic.Files.LineLength.TooLong
public static function fromResponse(\Recurly\Response $response): \Recurly\RecurlyError
{

if ($response->getContentType() == 'application/json') {
Expand Down
17 changes: 8 additions & 9 deletions lib/recurly/recurly_resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __set(string $key, $value): void
*
* @return \Recurly\EmptyResource
*/
public static function fromEmpty(\Recurly\Response $response): \Recurly\EmptyResource // phpcs:ignore Generic.Files.LineLength.TooLong
public static function fromEmpty(\Recurly\Response $response): \Recurly\EmptyResource
{
$klass = new \Recurly\EmptyResource();

Expand All @@ -79,7 +79,7 @@ public static function fromEmpty(\Recurly\Response $response): \Recurly\EmptyRes
*
* @return \Recurly\RecurlyResource An instance of a Recurly Resource
*/
public static function fromResponse(\Recurly\Response $response, object $json = null): \Recurly\RecurlyResource // phpcs:ignore Generic.Files.LineLength.TooLong
public static function fromResponse(\Recurly\Response $response, object $json = null): \Recurly\RecurlyResource
{
$json = is_null($json) ? $response->getJsonResponse() : $json;
$klass_name = static::resourceClass($json->object);
Expand All @@ -96,7 +96,7 @@ public static function fromResponse(\Recurly\Response $response, object $json =
*
* @return \Recurly\RecurlyResource An instance of a Recurly Resource
*/
public static function cast(object $data): \Recurly\RecurlyResource // phpcs:ignore Generic.Files.LineLength.TooLong
public static function cast(object $data): \Recurly\RecurlyResource
{
$klass = new static();
foreach ($data as $key => $value) {
Expand All @@ -111,7 +111,7 @@ public static function cast(object $data): \Recurly\RecurlyResource // phpcs:ign
array_map(
function ($item) use ($setter) {
if (property_exists($item, 'object')) {
$item_class = static::resourceClass($item->object); // phpcs:ignore Generic.Files.LineLength.TooLong
$item_class = static::resourceClass($item->object);
} else {
// TODO: Ensure that there is a hintArrayType method
$item_class = static::hintArrayType($setter);
Expand All @@ -137,7 +137,7 @@ function ($item) use ($setter) {
} elseif (\Recurly\STRICT_MODE) {
// @codeCoverageIgnoreStart
$klass_name = static::class;
trigger_error("$klass_name encountered json attribute $key but it's unknown to it's schema", E_USER_ERROR); // phpcs:ignore Generic.Files.LineLength.TooLong
trigger_error("$klass_name encountered json attribute $key but it's unknown to it's schema", E_USER_ERROR);
// @codeCoverageIgnoreEnd
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ protected static function setterParamClass(string $method)
*
* @return \Recurly\Resources\BinaryFile An instance of a Recurly BinaryFile
*/
public static function fromBinary(string $data, \Recurly\Response $response): \Recurly\Resources\BinaryFile // phpcs:ignore Generic.Files.LineLength.TooLong
public static function fromBinary(string $data, \Recurly\Response $response): \Recurly\Resources\BinaryFile
{
$klass = new \Recurly\Resources\BinaryFile();
$klass->setData($data);
Expand All @@ -191,10 +191,9 @@ protected static function resourceClass(string $type): string

$klass = static::titleize($type, "\\Recurly\\Resources\\");
if (!class_exists($klass)) {
// phpcs:ignore Generic.Files.LineLength.TooLong
// @codeCoverageIgnoreStart
if (\Recurly\STRICT_MODE) {
trigger_error("Could not find the Recurly class for key {$type}", E_USER_ERROR); // phpcs:ignore Generic.Files.LineLength.TooLong
trigger_error("Could not find the Recurly class for key {$type}", E_USER_ERROR);
}
// @codeCoverageIgnoreEnd
}
Expand Down Expand Up @@ -234,7 +233,7 @@ function ($carry, $property) {
if ($private) {
$property->setAccessible(true);
}
$display_name = $private ? substr($property->name, 1) : $property->name; // phpcs:ignore Generic.Files.LineLength.TooLong
$display_name = $private ? substr($property->name, 1) : $property->name;
$carry[$display_name] = $property->getValue($this);
if ($private) {
$property->setAccessible(false);
Expand Down
2 changes: 1 addition & 1 deletion lib/recurly/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Request
* @param array $body The request body
* @param array $params Query string parameters
*/
public function __construct(string $method, string $path, ?array $body, ?array $params) // phpcs:ignore Generic.Files.LineLength.TooLong
public function __construct(string $method, string $path, ?array $body, ?array $params)
{
$this->_method = $method;
$this->_path = $path;
Expand Down

0 comments on commit 6a917cc

Please sign in to comment.