for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WPEmerge\View;
use Closure;
use WPEmerge\Helpers\Handler;
use WPEmerge\Support\Arr;
/**
* Render view files with php
*/
class View {
* Global variables
*
* @var array
protected $globals = [];
* View composers
protected $composers = [];
* Get global variables
* @return array
public function getGlobals() {
return $this->globals;
}
* Set a global variable
* @param string $key
* @param mixed $value
* @return void
public function setGlobal( $key, $value ) {
$this->globals[ $key ] = $value;
* Set an array of global variables
* @param array $globals
public function setGlobals( $globals ) {
foreach ( $globals as $key => $value ) {
$this->setGlobal( $key, $value );
* Get view composer
* @param string $view
* @return Handler|null
public function getComposer( $view ) {
return Arr::get( $this->composers, $view, null );
* Set view composer
* @param string|Closure $composer
public function setComposer( $view, $composer ) {
$handler = new Handler( $composer );
$this->composers[ $view ] = $handler;
* Get the composed context for a view.
* Passes all arguments to the composer.
* @param mixed $arguments,...
$arguments,...
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
public function compose( $view ) {
$composer = $this->getComposer( $view );
if ( $composer === null ) {
return [];
return call_user_func_array( [$composer, 'execute'], func_get_args() );
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.