Skip to content

Removes $resources and $markup class properties #52

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

Merged
merged 1 commit into from
Mar 20, 2023
Merged
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
32 changes: 1 addition & 31 deletions src/ConvertKit_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,6 @@ class ConvertKit_API
*/
protected $api_url_base = 'https://api.convertkit.com/';

/**
* API resources
*
* @var array<int|string, array<int|string, mixed|\stdClass>>
*/
protected $resources = [];

/**
* Additional markup
*
* @var array<string, string>
*/
protected $markup = [];

/**
* Debug
*
Expand Down Expand Up @@ -524,11 +510,6 @@ public function get_resources(string $resource)
throw new \InvalidArgumentException();
}

// Return cached resource if it exists.
if (array_key_exists($resource, $this->resources)) {
return $this->resources[$resource];
}

// Assign the resource to the request variable.
$request = $resource;

Expand Down Expand Up @@ -632,10 +613,7 @@ public function get_resources(string $resource)
throw new \InvalidArgumentException('An unsupported resource was specified.');
}//end switch

// Cache resources and return.
$this->resources[$resource] = $_resource;

return $this->resources[$resource];
return $_resource;
}

/**
Expand Down Expand Up @@ -1117,12 +1095,6 @@ public function get_resource(string $url)

$this->create_log(sprintf('Getting resource %s', $url));

// If the resource was already fetched, return the cached version now.
if (isset($this->markup[$url])) {
$this->create_log('Resource already set');
return $this->markup[$url];
}

// Fetch the resource.
$request = new Request(
'GET',
Expand Down Expand Up @@ -1174,8 +1146,6 @@ public function get_resource(string $url)
// LIBXML_HTML_NOIMPLIED to correctly work.
$resource = $this->strip_html_head_body_tags($resource);

// Cache and return.
$this->markup[$url] = $resource;
return $resource;
}

Expand Down