Skip to content

Commit c105d52

Browse files
authored
Merge pull request #208 from EasyPost/fix_quotes
fix: double to single quotes and lint rule
2 parents a1f05dd + 711f61d commit c105d52

File tree

16 files changed

+46
-45
lines changed

16 files changed

+46
-45
lines changed

lib/EasyPost/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function create($params = null, $apiKey = null)
7272
$wrappedParams['verify_strict'] = $verifyStrict;
7373
}
7474

75-
$wrappedParams["address"] = $params;
75+
$wrappedParams['address'] = $params;
7676

7777
return self::createResource(get_class(), $wrappedParams, $apiKey);
7878
}

lib/EasyPost/Batch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static function create_and_buy($params = null, $apiKey = null)
8888
];
8989
}
9090

91-
$encodedParams = str_replace("\\", '', json_encode($params));
91+
$encodedParams = str_replace('\\', '', json_encode($params));
9292

9393
$requestor = new Requestor($apiKey);
9494
$url = self::classUrl(get_class());

lib/EasyPost/Beta/EndShipper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EndShipper extends EasypostResource
3030
public static function create($params = null, $apiKey = null)
3131
{
3232
$wrappedParams = [];
33-
$wrappedParams["address"] = $params;
33+
$wrappedParams['address'] = $params;
3434

3535
return self::createResource(get_class(), $wrappedParams, $apiKey, null, true);
3636
}

lib/EasyPost/Billing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Billing extends EasypostResource
2020
*/
2121
public static function retrieve_payment_methods($params = null, $apiKey = null)
2222
{
23-
$paymentMethods = self::allResources("paymentMethod", $params, $apiKey);
23+
$paymentMethods = self::allResources('paymentMethod', $params, $apiKey);
2424

2525
if ($paymentMethods->id == null) {
2626
throw new Error('Billing has not been setup for this user. Please add a payment method.');

lib/EasyPost/EasypostResource.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static function className($class)
2020
$class = substr($class, strlen('EasyPost'));
2121
}
2222
$class = str_replace('_', '', $class);
23-
$class = substr($class, 0, 1) . preg_replace("/([A-Z])/", "_$1", substr($class, 1)); // Camel -> snake
23+
$class = substr($class, 0, 1) . preg_replace('/([A-Z])/', '_$1', substr($class, 1)); // Camel -> snake
2424
$name = urlencode($class);
2525
$name = strtolower($name);
2626

@@ -36,7 +36,7 @@ public static function className($class)
3636
public static function classUrl($class)
3737
{
3838
$className = self::className($class);
39-
if (substr($className, -1) !== "s" && substr($className, -1) !== "h") {
39+
if (substr($className, -1) !== 's' && substr($className, -1) !== 'h') {
4040
return "/{$className}s";
4141
}
4242

@@ -90,7 +90,7 @@ public function refresh(bool $beta = false)
9090
protected static function validate($params = null, $apiKey = null)
9191
{
9292
if ($params && !is_array($params)) {
93-
throw new Error("You must pass an array as the first argument to EasyPost API method calls.");
93+
throw new Error('You must pass an array as the first argument to EasyPost API method calls.');
9494
}
9595
if ($apiKey && !is_string($apiKey)) {
9696
throw new Error('The second argument to EasyPost API method calls is an optional per-request apiKey, which must be a string.');

lib/EasyPost/Error.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ public function getHttpBody()
7474
*/
7575
public function prettyPrint()
7676
{
77-
print($this->ecode . " (" . $this->getHttpStatus() . "): " .
77+
print($this->ecode . ' (' . $this->getHttpStatus() . '): ' .
7878
$this->getMessage() . "\n");
7979
if (!empty($this->errors)) {
8080
print("Field errors:\n");
8181
foreach ($this->errors as $fieldError) {
8282
foreach ($fieldError as $k => $v) {
83-
print(" " . $k . ": " . $v . "\n");
83+
print(' ' . $k . ': ' . $v . "\n");
8484
}
8585
print("\n");
8686
}

lib/EasyPost/Requestor.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function apiUrl($url = '', $beta = false)
4949
*/
5050
public static function utf8($value)
5151
{
52-
if (is_string($value) && mb_detect_encoding($value, "UTF-8", true) != "UTF-8") {
52+
if (is_string($value) && mb_detect_encoding($value, 'UTF-8', true) != 'UTF-8') {
5353
return utf8_encode($value);
5454
}
5555

@@ -67,15 +67,15 @@ private static function encodeObjects($data)
6767
if (is_null($data)) {
6868
return [];
6969
} elseif ($data instanceof EasypostResource) {
70-
return ["id" => self::utf8($data->id)];
70+
return ['id' => self::utf8($data->id)];
7171
} elseif ($data === true) {
7272
return 'true';
7373
} elseif ($data === false) {
7474
return 'false';
7575
} elseif (is_array($data)) {
7676
$resource = [];
7777
foreach ($data as $k => $v) {
78-
if (!is_null($v) and ($v !== "") and (!is_array($v) or !empty($v))) {
78+
if (!is_null($v) and ($v !== '') and (!is_array($v) or !empty($v))) {
7979
$resource[$k] = self::encodeObjects($v);
8080
}
8181
}
@@ -106,19 +106,19 @@ public static function urlEncode($arr, $prefix = null)
106106
}
107107

108108
if ($prefix && isset($k)) {
109-
$k = $prefix . "[" . $k . "]";
109+
$k = $prefix . '[' . $k . ']';
110110
} elseif ($prefix) {
111-
$k = $prefix . "[]";
111+
$k = $prefix . '[]';
112112
}
113113

114114
if (is_array($v)) {
115115
$r[] = self::urlEncode($v, $k, true);
116116
} else {
117-
$r[] = urlencode($k) . "=" . urlencode($v);
117+
$r[] = urlencode($k) . '=' . urlencode($v);
118118
}
119119
}
120120

121-
return implode("&", $r);
121+
return implode('&', $r);
122122
}
123123

124124
/**

lib/EasyPost/Shipment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public static function get_lowest_smartrate($smartrates, $delivery_days, $delive
297297
}
298298

299299
if ($lowestSmartrate == false) {
300-
throw new Error("No rates found.");
300+
throw new Error('No rates found.');
301301
}
302302

303303
return $lowestSmartrate;

lib/EasyPost/Tracker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function create_list($params = null, $apiKey = null)
8484
$params['trackers'] = (object)$clone;
8585
}
8686

87-
$encodedParams = str_replace("\\", '', json_encode($params));
87+
$encodedParams = str_replace('\\', '', json_encode($params));
8888

8989
$requestor = new Requestor($apiKey);
9090
$url = self::classUrl(get_class());

lib/EasyPost/Util.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ public static function convertToEasyPostObject($response, $apiKey, $parent = nul
138138
} elseif (is_array($response)) {
139139
if (isset($response['object']) && is_string($response['object']) && isset($types[$response['object']])) {
140140
$class = $types[$response['object']];
141-
} elseif (isset($response['id']) && isset($prefixes[substr($response['id'], 0, strpos($response['id'], "_"))])) {
142-
$class = $prefixes[substr($response['id'], 0, strpos($response['id'], "_"))];
141+
} elseif (isset($response['id']) && isset($prefixes[substr($response['id'], 0, strpos($response['id'], '_'))])) {
142+
$class = $prefixes[substr($response['id'], 0, strpos($response['id'], '_'))];
143143
} else {
144144
$class = '\EasyPost\EasyPostObject';
145145
}

0 commit comments

Comments
 (0)