Skip to content
Closed
Changes from 1 commit
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
29 changes: 29 additions & 0 deletions libraries/src/Plugin/CMSPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,33 @@ public function setApplication(CMSApplicationInterface $application): void
{
$this->application = $application;
}

/**
* Proxy for app variable.
*
* @param string $name The name of the element
*
* @return mixed The value of the element if set, null otherwise
*
* @since __DEPLOY_VERSION__
*
* @deprecated 5.0 Use getApplication() instead of directly accessing the application
*/
public function __get($name)
{
if ($name === 'app')
{
@trigger_error('The app variable should not be used anymore, use getApplication() instead.', E_USER_DEPRECATED);

return $this->getApplication() ?? Factory::getApplication();
}

// Default the variable
if (!isset($this->$name))
{
$this->$name = null;
}

return $this->$name;
}
}