Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS/QA: fix structure order within classes #531

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public function __construct($name, $value, $attributes = array(), $flags = array
$this->normalize();
}

/**
* Get the cookie value
*
* Attributes and other data can be accessed via methods.
*/
public function __toString() {
return $this->value;
}

/**
* Check if a cookie is expired.
*
Expand Down Expand Up @@ -349,15 +358,6 @@ public function format_for_set_cookie() {
return $header_value;
}

/**
* Get the cookie value
*
* Attributes and other data can be accessed via methods.
*/
public function __toString() {
return $this->value;
}

/**
* Parse a cookie string into a cookie object
*
Expand Down
12 changes: 6 additions & 6 deletions src/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ class Requests {
const VERSION = '1.8.1';

/**
* Registered transport classes
* Selected transport name
*
* Use {@see get_transport()} instead
*
* @var array
*/
protected static $transports = array();
public static $transport = array();

/**
* Selected transport name
*
* Use {@see get_transport()} instead
* Registered transport classes
*
* @var array
*/
public static $transport = array();
protected static $transports = array();

/**
* Default certificate path.
Expand Down
15 changes: 8 additions & 7 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
* @package Requests
*/
class Response {
/**
* Constructor
*/
public function __construct() {
$this->headers = new Headers();
$this->cookies = new Jar();
}

/**
* Response body
Expand Down Expand Up @@ -98,6 +91,14 @@ public function __construct() {
*/
public $cookies = array();

/**
* Constructor
*/
public function __construct() {
$this->headers = new Headers();
$this->cookies = new Jar();
}

/**
* Is the response a redirect?
*
Expand Down
25 changes: 13 additions & 12 deletions src/Utility/FilteredIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ public function __construct($data, $callback) {
$this->callback = $callback;
}

/**
* @inheritdoc
*
* @phpcs:disable PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound
*/
#[ReturnTypeWillChange]
public function __unserialize($serialized) {}
// phpcs:enable

public function __wakeup() {
unset($this->callback);
}

/**
* Get the current item's value after filtering
*
Expand All @@ -58,16 +71,4 @@ public function current() {
*/
#[ReturnTypeWillChange]
public function unserialize($serialized) {}

/**
* @inheritdoc
*
* @phpcs:disable PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound
*/
#[ReturnTypeWillChange]
public function __unserialize($serialized) {}

public function __wakeup() {
unset($this->callback);
}
}
4 changes: 3 additions & 1 deletion tests/Transport/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use WpOrg\Requests\Tests\TestCase;

abstract class BaseTestCase extends TestCase {

protected $skip_https = false;

public function set_up() {
$callback = array($this->transport, 'test');
$supported = call_user_func($callback);
Expand All @@ -27,7 +30,6 @@ public function set_up() {
$this->skip_https = true;
}
}
protected $skip_https = false;

protected function getOptions($other = array()) {
$options = array(
Expand Down