Turn a few setters/getters into public attributes

There were no type hints etc. going on, and we would have needed
the getters anyway.

See https://github.com/flarum/core/pull/1105#issuecomment-279310998.
This commit is contained in:
Franz Liedke 2017-02-14 22:56:17 +01:00
parent 30076547e5
commit bbcc33b5b5
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
3 changed files with 14 additions and 83 deletions

View File

@ -85,9 +85,9 @@ class DiscussionController extends WebAppController
} }
} }
$view->setTitle($document->data->attributes->title); $view->title = $document->data->attributes->title;
$view->setDocument($document); $view->document = $document;
$view->setContent(app('view')->make('flarum.forum::discussion', compact('document', 'page', 'getResource', 'posts', 'url'))); $view->content = app('view')->make('flarum.forum::discussion', compact('document', 'page', 'getResource', 'posts', 'url'));
return $view; return $view;
} }

View File

@ -67,8 +67,8 @@ class IndexController extends WebAppController
$document = $this->getDocument($request->getAttribute('actor'), $params); $document = $this->getDocument($request->getAttribute('actor'), $params);
$view->setDocument($document); $view->document = $document;
$view->setContent(app('view')->make('flarum.forum::index', compact('document', 'page', 'forum'))); $view->content = app('view')->make('flarum.forum::index', compact('document', 'page', 'forum'));
return $view; return $view;
} }

View File

@ -32,35 +32,35 @@ class WebAppView
* *
* @var null|string * @var null|string
*/ */
protected $title; public $title;
/** /**
* The description of the document, displayed in a <meta> tag. * The description of the document, displayed in a <meta> tag.
* *
* @var null|string * @var null|string
*/ */
protected $description; public $description;
/** /**
* The language of the document, displayed as the value of the attribute `dir` in the <html> tag. * The language of the document, displayed as the value of the attribute `dir` in the <html> tag.
* *
* @var null|string * @var null|string
*/ */
protected $language; public $language;
/** /**
* The text direction of the document, displayed as the value of the attribute `dir` in the <html> tag. * The text direction of the document, displayed as the value of the attribute `dir` in the <html> tag.
* *
* @var null|string * @var null|string
*/ */
protected $direction; public $direction;
/** /**
* The path to the client layout view to display. * The path to the client layout view to display.
* *
* @var string * @var string
*/ */
protected $layout; public $layout;
/** /**
* The SEO content of the page, displayed within the layout in <noscript> * The SEO content of the page, displayed within the layout in <noscript>
@ -68,14 +68,16 @@ class WebAppView
* *
* @var string * @var string
*/ */
protected $content; public $content;
/** /**
* An API response to be preloaded into the page. * An API response to be preloaded into the page.
* *
* This should be a JSON-API document.
*
* @var null|array|object * @var null|array|object
*/ */
protected $document; public $document;
/** /**
* Other variables to preload into the page. * Other variables to preload into the page.
@ -192,66 +194,6 @@ class WebAppView
} }
} }
/**
* The title of the document, to be displayed in the <title> tag.
*
* @param null|string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* The description of the document, displayed in a <meta> tag.
*
* @param null|string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* The language of the document, displayed as the value of the attribute `dir` in the <html> tag.
*
* @param null|string $language
*/
public function setLanguage($language)
{
$this->language = $language;
}
/**
* The language of the document, displayed as the value of the attribute `dir` in the <html> tag.
*
* @param null|string $direction
*/
public function setDirection($direction)
{
$this->direction = $direction;
}
/**
* Set the SEO content of the page, to be displayed in <noscript> tags.
*
* @param null|string $content
*/
public function setContent($content)
{
$this->content = $content;
}
/**
* Set the name of the client layout view to display.
*
* @param string $layout
*/
public function setLayout($layout)
{
$this->layout = $layout;
}
/** /**
* Add a string to be appended to the page's <head>. * Add a string to be appended to the page's <head>.
* *
@ -277,17 +219,6 @@ class WebAppView
$this->foot[] = $string; $this->foot[] = $string;
} }
/**
* Set an API response to be preloaded into the page. This should be a
* JSON-API document.
*
* @param null|array|object $document
*/
public function setDocument($document)
{
$this->document = $document;
}
/** /**
* Set a variable to be preloaded into the app. * Set a variable to be preloaded into the app.
* *