-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
130 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/* | ||
* Copyright (c) 2024. Wepesi Dev Framework | ||
*/ | ||
|
||
namespace Wepesi\Core\Views\Provider\Contract; | ||
|
||
use Wepesi\Core\MetaData; | ||
|
||
/** | ||
* | ||
*/ | ||
interface ViewsContract | ||
{ | ||
/** | ||
* Setup new folder location for layout template | ||
* @param string $folder_name | ||
* @return mixed | ||
*/ | ||
public function setFolder(string $folder_name); | ||
|
||
/** | ||
* render html content | ||
* @param string $view | ||
* @return mixed | ||
*/ | ||
public function display(string $view); | ||
|
||
/** | ||
* @param string $variable | ||
* @param mixed $value | ||
* @return mixed | ||
*/ | ||
public function assign(string $variable, $value); | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getAssignData(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/* | ||
* Copyright (c) 2024. Wepesi Dev Framework | ||
*/ | ||
|
||
namespace Wepesi\Core\Views\Provider; | ||
|
||
use Wepesi\Core\Escape; | ||
|
||
class ViewBuilderProvider implements Contract\ViewsContract | ||
{ | ||
protected array $data = []; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected string $folder_name = ''; | ||
|
||
/** | ||
* @param string $folder_name | ||
* @return void | ||
*/ | ||
public function setFolder(string $folder_name) | ||
{ | ||
$this->folder_name = Escape::addSlashes($folder_name); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function display(string $view) | ||
{ | ||
// TODO: Implement display() method. | ||
} | ||
|
||
/** | ||
* assign variables data to be displayed on file_page | ||
* | ||
* @param string $variable | ||
* @param $value | ||
*/ | ||
public function assign(string $variable, $value) | ||
{ | ||
$this->data[$variable] = $value; | ||
} | ||
|
||
/** | ||
* List all data assigned before being displayed | ||
* @return array | ||
*/ | ||
public function getAssignData(): array | ||
{ | ||
return $this->data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters