for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Http;
/**
* A WebPage class that requires login to view
*
* This file describes an abstraction for creating a webpage with JQuery, Bootstrap,
* and other framework specific abilities that requires a login
* PHP version 5 and 7
* @author Patrick Boyd / [email protected]
* @copyright Copyright (c) 2017, Austin Artistic Reconstruction
* @license http://www.apache.org/licenses/ Apache 2.0 License
*/
* A webpage abstraction for login required pages
* This class adds a login requirement to FlipPage
class LoginRequiredPage extends WebPage
{
protected function getContent()
if($this->user === false || $this->user === null)
user
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->content['body'] = '
content
<div id="content">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">You must <a href="'.$this->loginUrl.'?return='.$this->currentUrl().'">log in <span class="fa fa-sign-in"></span></a> to access the '.$this->content['pageTitle'].' system!</h1>
loginUrl
</div>
';
}
else if(!isset($this->content['body']))
$this->content['body'] = $this->body;
return $this->twig->render($this->templateName, $this->content);
twig
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: