Skip to content

Commit

Permalink
PHP CS Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
sweikert committed Mar 16, 2022
1 parent 38cb929 commit 3542977
Show file tree
Hide file tree
Showing 79 changed files with 573 additions and 544 deletions.
2 changes: 1 addition & 1 deletion examples/addresses/create_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
]);

echo "<p>Address created: {$address->id}</p>";
echo "<p>Address created: $address->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
4 changes: 2 additions & 2 deletions examples/addresses/get_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

$address = $oro->addresses->get(3);

echo "<b>{$address->type} {$address->id}</b><br>";
echo "<b>$address->type $address->id</b><br>";
foreach ($address->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}


Expand Down
4 changes: 2 additions & 2 deletions examples/addresses/page_addresses.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
echo '<ul>';
foreach ($addresses as $address) {
echo '<li>';
echo "<b>{$address->type} {$address->id}</b><br>";
echo "<b>$address->type $address->id</b><br>";
foreach ($address->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
echo "</li>";
}
Expand Down
2 changes: 1 addition & 1 deletion examples/addresses/update_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
]);

echo "<p>Address updated: {$res->id}</p>";
echo "<p>Address updated: $res->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
4 changes: 2 additions & 2 deletions examples/addresstypes/get_addresstype.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

$addresstype = $oro->addresstypes->get('billing');

echo "<b>{$addresstype->type} {$addresstype->id}</b><br>";
echo "<b>$addresstype->type $addresstype->id</b><br>";
foreach ($addresstype->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}

} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
4 changes: 2 additions & 2 deletions examples/addresstypes/page_addresstypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
echo '<ul>';
foreach ($addresstypes as $addresstype) {
echo '<li>';
echo "<b>{$addresstype->type} {$addresstype->id}</b><br>";
echo "<b>$addresstype->type $addresstype->id</b><br>";
foreach ($addresstype->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
echo "</li>";
}
Expand Down
4 changes: 2 additions & 2 deletions examples/asyncoperations/get_operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

$operation = $oro->asyncoperations->get(12);

echo "<b>{$operation->type} {$operation->id}</b><br>";
echo "<b>$operation->type $operation->id</b><br>";
foreach ($operation->attributes as $key => $val) {
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
10 changes: 5 additions & 5 deletions examples/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

function database_read($orderId)
{
$orderId = intval($orderId);
$database = dirname(__FILE__) . "/database/order-{$orderId}.txt";
$orderId = (int)$orderId;
$database = __DIR__ . "/database/order-$orderId.txt";

$status = @file_get_contents($database);

return $status ? $status : "unknown order";
return $status ?: "unknown order";
}

function database_write($orderId, $status)
{
$orderId = intval($orderId);
$database = dirname(__FILE__) . "/database/order-{$orderId}.txt";
$orderId = (int)$orderId;
$database = __DIR__ . "/database/order-$orderId.txt";

file_put_contents($database, $status);
}
2 changes: 1 addition & 1 deletion examples/productprices/create_productprice.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
],
]);

echo "<p>Productprice created: {$productprice->id}</p>";
echo "<p>Productprice created: $productprice->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
4 changes: 2 additions & 2 deletions examples/productprices/get_productprice.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

$productprice = $oro->productprices->get('05d75108-4f05-489c-95d5-f80d120673f4-1');

echo "<b>{$productprice->type} {$productprice->id}</b><br>";
echo "<b>$productprice->type $productprice->id</b><br>";
foreach ($productprice->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}

} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
4 changes: 2 additions & 2 deletions examples/productprices/page_productprices.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
echo '<ul>';
foreach ($productprices as $productprice) {
echo '<li>';
echo "<b>{$productprice->type} {$productprice->id}</b><br>";
echo "<b>$productprice->type $productprice->id</b><br>";
foreach ($productprice->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
echo "</li>";
}
Expand Down
2 changes: 1 addition & 1 deletion examples/productprices/update_productprice.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
]);

echo "<p>Productprice updated: {$res->id}</p>";
echo "<p>Productprice updated: $res->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
5 changes: 2 additions & 3 deletions examples/products/create_product.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'data' => [
'type' => 'products',
'attributes' => [
'sku' => 'test-api-' . strtotime('now'),
'sku' => 'test-api-' . time(),
'status' => 'enabled',
'variantFields' => [],
'productType' => 'simple',
Expand Down Expand Up @@ -87,8 +87,7 @@
],
]);

echo "<p>Product created: {$product->id}</p>";

echo "<p>Product created: $product->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
5 changes: 2 additions & 3 deletions examples/products/get_product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
try {
require "../initialize.php";

$product = $oro->products->get(116);
$product = $oro->products->get(1);

echo '<b>' . $product->type . ' ' . $product->id . '</b><br>';
foreach ($product->attributes as $key => $val) {
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}

} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
2 changes: 1 addition & 1 deletion examples/products/get_product_names.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

foreach ($names as $name) {
foreach ($name->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
7 changes: 3 additions & 4 deletions examples/products/page_products.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
echo "</li>";
Expand All @@ -29,14 +29,13 @@
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
echo "</li>";
echo "</li>";
}

echo '</ul>';

} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
2 changes: 1 addition & 1 deletion examples/products/update_product.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
]);

echo "<p>Product updated: {$res->id}</p>";
echo "<p>Product updated: $res->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
2 changes: 1 addition & 1 deletion examples/userroles/create_userrole.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
]);

echo "<p>Userrole created: {$userrole->id}</p>";
echo "<p>Userrole created: $userrole->id</p>";

} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
Expand Down
2 changes: 1 addition & 1 deletion examples/userroles/get_userrole.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
2 changes: 1 addition & 1 deletion examples/userroles/page_userroles.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
echo "</li>";
Expand Down
2 changes: 1 addition & 1 deletion examples/userroles/update_userrole.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
]);

echo "<p>Userrole updated: {$res->id}</p>";
echo "<p>Userrole updated: $res->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
2 changes: 1 addition & 1 deletion examples/users/create_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
]);

echo "<p>User created: {$user->id}</p>";
echo "<p>User created: $user->id</p>";

} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
Expand Down
2 changes: 1 addition & 1 deletion examples/users/get_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
2 changes: 1 addition & 1 deletion examples/users/get_user_roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

foreach ($roles as $role) {
foreach ($role->attributes as $key => $val) {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
Expand Down
2 changes: 1 addition & 1 deletion examples/users/page_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if (is_array($val)) {
echo $key . ': ' . implode(', ', $val) . '<br>';
} else {
echo "{$key}: {$val}<br>";
echo "$key: $val<br>";
}
}
echo "</li>";
Expand Down
2 changes: 1 addition & 1 deletion examples/users/update_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
]);

echo "<p>Userrole updated: {$res->id}</p>";
echo "<p>Userrole updated: $res->id</p>";
} catch (\Digitalprint\Oro\Api\Exceptions\ApiException $e) {
echo "API call failed: " . $e->getMessage();
}
28 changes: 15 additions & 13 deletions src/Endpoints/AddressEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use Digitalprint\Oro\Api\Exceptions\ApiException;
use Digitalprint\Oro\Api\Resources\Address;
use Digitalprint\Oro\Api\Resources\AddressCollection;
use Digitalprint\Oro\Api\Resources\BaseCollection;
use Digitalprint\Oro\Api\Resources\BaseResource;
use JsonException;
use stdClass;

class AddressEndpoint extends CollectionEndpointAbstract
Expand All @@ -19,9 +18,9 @@ class AddressEndpoint extends CollectionEndpointAbstract
/**
* Get the object that is used by this API. Every API uses one type of object.
*
* @return BaseResource
* @return Address
*/
protected function getResourceObject(): BaseResource
protected function getResourceObject(): Address
{
return new Address($this->client);
}
Expand All @@ -31,19 +30,21 @@ protected function getResourceObject(): BaseResource
*
* @param stdClass $links
*
* @return BaseCollection
* @return AddressCollection
*/
protected function getResourceCollectionObject(stdClass $links): BaseCollection
protected function getResourceCollectionObject(stdClass $links): AddressCollection
{
return new AddressCollection($this->client, $links);
}


/**
* @param array|null $data
* @return BaseResource
* @return Address
* @throws ApiException
* @throws JsonException
*/
public function create(array $data = null): BaseResource
public function create(array $data = null): Address
{
return $this->rest_create($data);
}
Expand Down Expand Up @@ -74,20 +75,21 @@ public function page(string $number = null, string $size = null, array $filter =

/**
* @param array $data
* @return BaseResource|null
* @return Address
* @throws ApiException
* @throws JsonException
*/
public function update(array $data = []): ?BaseResource
public function update(array $data = []): Address
{
return $this->rest_update($data);
return $this->rest_update($data);
}

/**
* @param array $filter
* @return BaseResource|null
* @return Address|null
* @throws ApiException
*/
public function delete(array $filter = []): ?BaseResource
public function delete(array $filter = []): ?Address
{
return $this->rest_delete($filter);
}
Expand Down
Loading

0 comments on commit 3542977

Please sign in to comment.