Skip to content

Commit 39f6fbb

Browse files
committed
Set the file as a property
1 parent 8401d6c commit 39f6fbb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Updaters/Plugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ protected function add_listeners(): void {
203203
* @return string
204204
*/
205205
protected function get_slug(): string {
206-
if ( empty( $this->args['file'] ) ) {
206+
if ( empty( $this->file ) ) {
207207
return '';
208208
}
209209

210-
return basename( dirname( $this->args['file'] ) );
210+
return basename( dirname( $this->file ) );
211211
}
212212

213213
/**
@@ -217,11 +217,11 @@ protected function get_slug(): string {
217217
* @return string
218218
*/
219219
protected function get_name(): string {
220-
if ( empty( $this->args['file'] ) ) {
220+
if ( empty( $this->file ) ) {
221221
return '';
222222
}
223223

224-
return plugin_basename( $this->args['file'] );
224+
return plugin_basename( $this->file );
225225
}
226226

227227
/**

src/Updaters/Updater.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ abstract class Updater {
3333
*/
3434
protected $args = array();
3535

36+
/**
37+
* The file for the updater.
38+
*
39+
* @var string
40+
*/
41+
protected $file = '';
42+
3643
/**
3744
* The class constructor.
3845
*
@@ -42,6 +49,7 @@ abstract class Updater {
4249
*/
4350
public function __construct( $api_url, $args = array() ) {
4451
$this->api_url = $api_url;
52+
$this->file = $args['file'];
4553
$defaults = $this->get_api_request_defaults();
4654
$this->args = array_merge( $defaults, array_intersect_key( $args, $defaults ) );
4755
$this->add_listeners();

0 commit comments

Comments
 (0)