From 310d59974fd428303e4a0032a1a790c481973492 Mon Sep 17 00:00:00 2001 From: Awilum Date: Wed, 2 Sep 2020 17:13:34 +0300 Subject: [PATCH] feat(core): Hide access for all core properties #467 --- .../app/Foundation/Entries/Entries.php | 47 ++++++++++++++----- src/flextype/app/Foundation/Plugins.php | 23 +++++++++ src/flextype/app/Support/Parsers/Markdown.php | 2 +- .../app/Support/Parsers/Shortcode.php | 2 +- 4 files changed, 60 insertions(+), 14 deletions(-) diff --git a/src/flextype/app/Foundation/Entries/Entries.php b/src/flextype/app/Foundation/Entries/Entries.php index eedac919..f9d09da5 100755 --- a/src/flextype/app/Foundation/Entries/Entries.php +++ b/src/flextype/app/Foundation/Entries/Entries.php @@ -26,49 +26,49 @@ class Entries * Current entry id * * @var string - * @access public + * @access private */ - public $entry_id = null; + private $entry_id = null; /** * Current entry data array * * @var array - * @access public + * @access private */ - public $entry = []; + private $entry = []; /** * Current entry create data array * * @var array - * @access public + * @access private */ - public $entry_create_data = []; + private $entry_create_data = []; /** * Current entry update data array * * @var array - * @access public + * @access private */ - public $entry_update_data = []; + private $entry_update_data = []; /** * Current entries data * * @var array|bool|int - * @access public + * @access private */ - public $entries; + private $entries; /** * Current entries id * * @var string - * @access public + * @access private */ - public $entries_id = null; + private $entries_id = null; /** * Fetch entry(entries) @@ -388,4 +388,27 @@ class Entries return md5('entry' . $entry_file); } + + /** + * Dynamically access entries properties. + * + * @param string $key Key + * @return mixed + */ + public function __get(string $key) + { + return $this->$key; + } + + /** + * Dynamically set entries properties. + * + * @param string $key Key + * @param mixed $value Value + * @return void + */ + public function __set(string $key, $value): void + { + $this->$key = $value; + } } diff --git a/src/flextype/app/Foundation/Plugins.php b/src/flextype/app/Foundation/Plugins.php index e88685d0..7b4485de 100755 --- a/src/flextype/app/Foundation/Plugins.php +++ b/src/flextype/app/Foundation/Plugins.php @@ -378,4 +378,27 @@ class Plugins include_once PATH['project'] . '/plugins/' . $plugin_name . '/bootstrap.php'; } } + + /** + * Dynamically access entries properties. + * + * @param string $key Key + * @return mixed + */ + public function __get(string $key) + { + return $this->$key; + } + + /** + * Dynamically set entries properties. + * + * @param string $key Key + * @param mixed $value Value + * @return void + */ + public function __set(string $key, $value): void + { + $this->$key = $value; + } } diff --git a/src/flextype/app/Support/Parsers/Markdown.php b/src/flextype/app/Support/Parsers/Markdown.php index f9deb9ad..d09d2a73 100644 --- a/src/flextype/app/Support/Parsers/Markdown.php +++ b/src/flextype/app/Support/Parsers/Markdown.php @@ -16,7 +16,7 @@ class Markdown /** * Markdown */ - protected $markdown; + private $markdown; /** * Constructor diff --git a/src/flextype/app/Support/Parsers/Shortcode.php b/src/flextype/app/Support/Parsers/Shortcode.php index 0a1e6f49..d9937567 100644 --- a/src/flextype/app/Support/Parsers/Shortcode.php +++ b/src/flextype/app/Support/Parsers/Shortcode.php @@ -16,7 +16,7 @@ class Shortcode /** * Shortcode Fasade */ - protected $shortcode; + private $shortcode; /** * Constructor