Skip to content

Commit

Permalink
Fix DocBlock and return type
Browse files Browse the repository at this point in the history
  • Loading branch information
abbadon1334 committed Mar 2, 2020
1 parent 234cf70 commit f99d026
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
40 changes: 14 additions & 26 deletions src/AtkWpApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AtkWpApp extends App
/**
* The html produce by this app.
*
* @var string
* @var AtkWpView
*/
public $wpHtml;

Expand Down Expand Up @@ -67,36 +67,39 @@ public function init()
* AtkWpApp constructor.
*
* @param AtkWp|null $plugin
* @param UI|null $uiPersistance
* @param UI|null $ui_persistence
*/
public function __construct(AtkWp $plugin = null)
public function __construct(AtkWp $plugin = null, ?UI $ui_persistence = null)
{
$this->plugin = $plugin;
if (!isset($uiPersistance)) {
if (!isset($ui_persistence)) {
$this->ui_persistence = new UI();
} else {
$this->ui_persistence = $uiPersistance;
$this->ui_persistence = $ui_persistence;
}
}

/**
* The layout initialisation for each Wp component.
*
* @param $view
* @param AtkWpView $view
* @param $layout
* @param $name
*
* @throws Exception
* @throws \atk4\core\Exception
*
* @return AtkWpView The Wp component being output.
*
* @return \atk4\ui\View The Wp component being output.
*/
public function initWpLayout($view, $layout, $name)
public function initWpLayout(AtkWpView $view, $layout, $name)
{
$this->wpHtml = new AtkWpView(['defaultTemplate' => $layout, 'name' => $name]);
$this->wpHtml->app = $this;
$this->wpHtml->init();

return $this->wpHtml->add($view);
$this->wpHtml->add($view);

return $view;
}

/**
Expand Down Expand Up @@ -142,27 +145,12 @@ public function getDbConnection()
return $this->plugin->getDbConnection();
}

/**
* Will perform a preemptive output and terminate. Do not use this
* directly, instead call it form Callback, jsCallback or similar
* other classes.
*
* @param string $output
*/
public function terminate($output = null)
{
echo $output;
$this->run_called = true; // prevent shutdown function from triggering.
exit;
}

/**
* Return url.
*
* @param array $page
* @param bool $hasRequestUri
* @param bool $needRequestUri
* @param array $extraArgs
* @param bool $needAjax
*
* @return array|null|string
*/
Expand Down
2 changes: 2 additions & 0 deletions src/AtkWpView.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

class AtkWpView extends \atk4\ui\View
{
/** @var AtkWpApp */
public $app;
/**
* Return the plugin running this view.
*
Expand Down

0 comments on commit f99d026

Please sign in to comment.