Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
composer.lock
vendor/
mouf/
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php
matrix:
include:
- php: 7.2
env: PREFER_LOWEST=""
- php: 7.1
env: PREFER_LOWEST=""
# - php: 7.1
# env: PREFER_LOWEST="--prefer-lowest"

before_script:
- composer update $PREFER_LOWEST --no-interaction
- mkdir -p build/logs
script:
- composer cs-check
- composer phpstan
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Bootstrap version | Template version
3.* | 4.0
3.* | 4.1
4.* | 5.0
4.* | 5.1 (uses Service providers instead of Mouf installer)

Bootstrap menu rendererer
-------------------------
Expand Down
36 changes: 20 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,30 @@
"homepage" : "http://twitter.github.com/bootstrap/",
"license" : "MIT",
"require" : {
"mouf/html.utils.weblibrarymanager" : "~3.0",
"mouf/html.utils.weblibrarymanager.component-installer" : "~2.2",
"mouf/html.widgets.messageservice" : "~3.0",
"php" : ">=5.4.0",
"mouf/html.widgets.menu" : "~3.0",
"mouf/html.template.templateinterface" : "~2.1"
"mouf/html.utils.weblibrarymanager" : "~4.0",
"mouf/html.widgets.messageservice" : "~4.0",
"php" : ">=7.1",
"mouf/html.widgets.menu" : "^4",
"mouf/html.template.templateinterface" : "^3"
},
"require-dev": {
"phpstan/phpstan": "^0.10.3",
"thecodingmachine/phpstan-strict-rules": "^0.10.3",
"squizlabs/php_codesniffer": "^3.3.1"
},
"conflict": {
"mouf/mouf": "~2.0.0"
},
"autoload" : {
"psr-0" : {
"Mouf" : "src/"
}
},
"extra" : {
"mouf" : {
"install" : [{
"type" : "class",
"class" : "Mouf\\Html\\Template\\BootstrapTemplateInstaller"
}
],
"logo" : "icons/logo.png"
}
}
"scripts": {
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"phpstan": "phpstan analyse src/Mouf -c phpstan.neon --level=5 --no-progress -vvv"
},
"minimum-stability": "dev",
"prefer-stable": true
}
3 changes: 3 additions & 0 deletions discovery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Interop\\Container\\ServiceProviderInterface": "Mouf\\Html\\Template\\BootstrapTemplateServiceProvider"
}
21 changes: 21 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<ruleset name="Expressive Skeleton coding standard">
<description>Expressive Skeleton coding standard</description>

<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>

<!-- inherit rules from: -->
<rule ref="PSR2"/>

<!-- Paths to check -->
<file>src</file>

<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="300"/>
<property name="absoluteLineLimit" value="500"/>
</properties>
</rule>
</ruleset>
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#parameters:
# ignoreErrors:
# - "#you should not use the \\$_REQUEST superglobal#"
includes:
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
50 changes: 19 additions & 31 deletions src/Mouf/Html/Template/BootstrapTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class BootstrapTemplate extends BaseTemplate
Renderable::toHtml as toHtmlRenderer;
}

const TEMPLATE_ROOT_URL = "vendor/mouf/html.template.bootstrap/";

/**
* The left menu of the template.
*
Expand Down Expand Up @@ -117,23 +115,13 @@ class BootstrapTemplate extends BaseTemplate
*/
protected $containerClass = "container";

/**
* Default constructor
*/
public function __construct()
{
parent::__construct();
//$this->favIconUrl = self::TEMPLATE_ROOT_URL."images/favicon.png";
//$this->logoUrl = self::TEMPLATE_ROOT_URL."images/logo.png";
}

/**
* Draws the template.
*/
public function toHtml()
{
// Let's register the template renderer in the default renderer.
$this->getDefaultRenderer()->setTemplateRenderer($this->getTemplateRenderer());
$this->getDefaultRenderer()->setTemplateRendererInstanceName($this->getTemplateRendererInstanceName());

header('Content-Type: text/html; charset=utf-8');
//Renderable::toHtml();// __DIR__."/../../../../views/template.php";
Expand All @@ -146,7 +134,7 @@ public function toHtml()
* @Property
* @param HtmlElementInterface $left
*/
public function setLeft(HtmlElementInterface $left)
public function setLeft(HtmlElementInterface $left): void
{
$this->left = $left;
}
Expand All @@ -157,7 +145,7 @@ public function setLeft(HtmlElementInterface $left)
* @Property
* @param HtmlElementInterface $right
*/
public function setRight(HtmlElementInterface $right)
public function setRight(HtmlElementInterface $right): void
{
$this->right = $right;
}
Expand All @@ -168,7 +156,7 @@ public function setRight(HtmlElementInterface $right)
* @Property
* @param HtmlElementInterface $header
*/
public function setHeader(HtmlElementInterface $header)
public function setHeader(HtmlElementInterface $header): void
{
$this->header = $header;
}
Expand All @@ -179,47 +167,47 @@ public function setHeader(HtmlElementInterface $header)
* @Property
* @param HtmlElementInterface $footer
*/
public function setFooter(HtmlElementInterface $footer)
public function setFooter(HtmlElementInterface $footer): void
{
$this->footer = $footer;
}

/**
* The content of the template.
*/
public function getContent()
public function getContent(): ?HtmlElementInterface
{
return $this->content;
}

/**
* The left menu of the template.
*/
public function getLeft()
public function getLeft(): ?HtmlElementInterface
{
return $this->left;
}

/**
* The right menu of the template.
*/
public function getRight()
public function getRight(): ?HtmlElementInterface
{
return $this->right;
}

/**
* The header of the template.
*/
public function getHeader()
public function getHeader(): ?HtmlElementInterface
{
return $this->header;
}

/**
* The footer of the template.
*/
public function getFooter()
public function getFooter(): ?HtmlElementInterface
{
return $this->footer;
}
Expand All @@ -232,7 +220,7 @@ public function getFooter()
* @Property
* @param int $leftColumnSize
*/
public function setLeftColumnSize($leftColumnSize)
public function setLeftColumnSize(int $leftColumnSize): void
{
$this->leftColumnSize = $leftColumnSize;
}
Expand All @@ -245,7 +233,7 @@ public function setLeftColumnSize($leftColumnSize)
* @Property
* @param int $rightColumnSize
*/
public function setRightColumnSize($rightColumnSize)
public function setRightColumnSize(int $rightColumnSize): void
{
$this->rightColumnSize = $rightColumnSize;
}
Expand All @@ -256,7 +244,7 @@ public function setRightColumnSize($rightColumnSize)
* If you are not using the left column, the size of the column is 0.
*
*/
public function getLeftColumnSize()
public function getLeftColumnSize(): int
{
return $this->leftColumnSize;
}
Expand All @@ -267,7 +255,7 @@ public function getLeftColumnSize()
* If you are not using the right column, the size of the column is 0.
*
*/
public function getRightColumnSize()
public function getRightColumnSize(): int
{
return $this->rightColumnSize;
}
Expand All @@ -277,7 +265,7 @@ public function getRightColumnSize()
*
* @param bool $wrapLeftSideBarInWell
*/
public function setWrapLeftSideBarInWell($wrapLeftSideBarInWell)
public function setWrapLeftSideBarInWell(bool $wrapLeftSideBarInWell): void
{
$this->wrapLeftSideBarInWell = $wrapLeftSideBarInWell;
}
Expand All @@ -287,7 +275,7 @@ public function setWrapLeftSideBarInWell($wrapLeftSideBarInWell)
*
* @param bool $wrapRightSideBarInWell
*/
public function setWrapRightSideBarInWell($wrapRightSideBarInWell)
public function setWrapRightSideBarInWell(bool $wrapRightSideBarInWell): void
{
$this->wrapRightSideBarInWell = $wrapRightSideBarInWell;
}
Expand All @@ -296,15 +284,15 @@ public function setWrapRightSideBarInWell($wrapRightSideBarInWell)
* Whether we should or not put the left sidebar in a Bootstrap "well" element.
*
*/
public function getWrapLeftSideBarInWell()
public function getWrapLeftSideBarInWell(): bool
{
return $this->wrapLeftSideBarInWell;
}

/**
* Whether we should or not put the left sidebar in a Bootstrap "well" element.
*/
public function getWrapRightSideBarInWell()
public function getWrapRightSideBarInWell(): bool
{
return $this->wrapRightSideBarInWell;
}
Expand All @@ -313,7 +301,7 @@ public function getWrapRightSideBarInWell()
* The css class applied to the container div.
* @param string $containerClass
*/
public function setContainerClass($containerClass)
public function setContainerClass(string $containerClass): void
{
$this->containerClass = $containerClass;
}
Expand Down
Loading