Skip to content

Commit 58d16dc

Browse files
authored
Merge pull request #52 from ConvertKit/remove-storing-resources-in-class
Removes `$resources` and `$markup` class properties
2 parents 5d9cd93 + b09f535 commit 58d16dc

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

src/ConvertKit_API.php

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,6 @@ class ConvertKit_API
5454
*/
5555
protected $api_url_base = 'https://api.convertkit.com/';
5656

57-
/**
58-
* API resources
59-
*
60-
* @var array<int|string, array<int|string, mixed|\stdClass>>
61-
*/
62-
protected $resources = [];
63-
64-
/**
65-
* Additional markup
66-
*
67-
* @var array<string, string>
68-
*/
69-
protected $markup = [];
70-
7157
/**
7258
* Debug
7359
*
@@ -524,11 +510,6 @@ public function get_resources(string $resource)
524510
throw new \InvalidArgumentException();
525511
}
526512

527-
// Return cached resource if it exists.
528-
if (array_key_exists($resource, $this->resources)) {
529-
return $this->resources[$resource];
530-
}
531-
532513
// Assign the resource to the request variable.
533514
$request = $resource;
534515

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

635-
// Cache resources and return.
636-
$this->resources[$resource] = $_resource;
637-
638-
return $this->resources[$resource];
616+
return $_resource;
639617
}
640618

641619
/**
@@ -1333,12 +1311,6 @@ public function get_resource(string $url)
13331311

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

1336-
// If the resource was already fetched, return the cached version now.
1337-
if (isset($this->markup[$url])) {
1338-
$this->create_log('Resource already set');
1339-
return $this->markup[$url];
1340-
}
1341-
13421314
// Fetch the resource.
13431315
$request = new Request(
13441316
'GET',
@@ -1390,8 +1362,6 @@ public function get_resource(string $url)
13901362
// LIBXML_HTML_NOIMPLIED to correctly work.
13911363
$resource = $this->strip_html_head_body_tags($resource);
13921364

1393-
// Cache and return.
1394-
$this->markup[$url] = $resource;
13951365
return $resource;
13961366
}
13971367

0 commit comments

Comments
 (0)