Commit 4d8e92b4 authored by Mike Rockétt's avatar Mike Rockétt

Chore: Formatting

parent 3e81275d
......@@ -4,4 +4,4 @@
* Add applicable namespaces to the ProcessWire classLoader.
*/
wire('classLoader')->addNamespace('Rockett\Sitemap', __DIR__ . '/src/Sitemap');
wire('classLoader')->addNamespace('Rockett\Traits', __DIR__ . '/src/Traits');
\ No newline at end of file
wire('classLoader')->addNamespace('Rockett\Traits', __DIR__ . '/src/Traits');
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -12,95 +12,96 @@ namespace Rockett\Traits;
trait DebugTrait
{
/**
* Dump vars and die.
*
* @param mixed $mixed The vars to dump
* @return void
*/
protected function dd()
{
$this->dump(func_get_args()) && die;
}
/**
* Dump vars and die.
*
* @param mixed $mixed The vars to dump
* @return void
*/
protected function dd()
{
$this->dump(func_get_args()) && die;
}
/**
* Dump vars.
*
* @param mixed $mixed The vars to dump
* @return void
*/
protected function dump()
{
$this->header();
array_map(
function ($mixed) {
var_dump($mixed);
},
func_get_args()
);
return true;
}
/**
* Dump vars.
*
* @param mixed $mixed The vars to dump
* @return void
*/
protected function dump()
{
$this->header();
array_map(
function ($mixed) {
var_dump($mixed);
},
func_get_args()
);
/**
* Prepare the content-type header
*
* @return void
*/
protected function header()
{
$header = 'Content-Type: text/plain';
if (!$this->headerPrepared($header)) {
header($header);
$this->timestamp = -microtime(true);
}
}
return true;
}
/**
* Determine if a header has been prepared.
*
* @param $header
* @return bool
*/
protected function headerPrepared($header)
{
$header = trim($header, ': ');
/**
* Prepare the content-type header
*
* @return void
*/
protected function header()
{
$header = 'Content-Type: text/plain';
if (!$this->headerPrepared($header)) {
header($header);
$this->timestamp = -microtime(true);
}
}
foreach (headers_list() as $listedHeader) {
if (stripos($listedHeader, $header) !== false) {
return true;
}
}
/**
* Determine if a header has been prepared.
*
* @param $header
* @return bool
*/
protected function headerPrepared($header)
{
$header = trim($header, ': ');
return false;
foreach (headers_list() as $listedHeader) {
if (stripos($listedHeader, $header) !== false) {
return true;
}
}
/**
* Print vars and die.
*
* @param mixed $mixed The vars to print
* @return void
*/
protected function pd()
{
$this->printVars(func_get_args()) && die;
}
return false;
}
/**
* Print vars.
*
* @param mixed $mixed The vars to print
* @return void
*/
protected function printVars()
{
$this->header();
array_map(
function ($mixed) {
print_r($mixed);
},
func_get_args()
);
/**
* Print vars and die.
*
* @param mixed $mixed The vars to print
* @return void
*/
protected function pd()
{
$this->printVars(func_get_args()) && die;
}
return true;
}
/**
* Print vars.
*
* @param mixed $mixed The vars to print
* @return void
*/
protected function printVars()
{
$this->header();
array_map(
function ($mixed) {
print_r($mixed);
},
func_get_args()
);
return true;
}
}
......@@ -13,22 +13,22 @@ namespace Rockett\Traits;
trait FieldsTrait
{
/**
* Given a fieldtype, create, populate, and return an Inputfield
* @param string $fieldNameId
* @param array $meta
* @return Inputfield
*/
protected function buildInputField($fieldNameId, $meta)
{
$field = $this->modules->{"Inputfield{$fieldNameId}"};
foreach ($meta as $metaNames => $metaInfo) {
$metaNames = explode('+', $metaNames);
foreach ($metaNames as $metaName) {
$field->$metaName = $metaInfo;
}
}
return $field;
/**
* Given a fieldtype, create, populate, and return an Inputfield
* @param string $fieldNameId
* @param array $meta
* @return Inputfield
*/
protected function buildInputField($fieldNameId, $meta)
{
$field = $this->modules->{"Inputfield{$fieldNameId}"};
foreach ($meta as $metaNames => $metaInfo) {
$metaNames = explode('+', $metaNames);
foreach ($metaNames as $metaName) {
$field->$metaName = $metaInfo;
}
}
return $field;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment