Skip to content

Commit

Permalink
Tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 5, 2016
1 parent 99180ec commit 0e573e8
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 45 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.coveralls.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
phpunit.xml export-ignore
tests/ export-ignore
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
sudo: false

cache:
directories:
- $COMPOSER_CACHE_DIR
- $HOME/.composer/cache

language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

before_script:
- travis_retry composer self-update
- composer require satooshi/php-coveralls --prefer-source
- if [[ $TRAVIS_PHP_VERSION != "5.5" ]]; then composer install --prefer-dist; fi
- if [[ $TRAVIS_PHP_VERSION = "5.5" ]]; then composer require satooshi/php-coveralls --prefer-dist; fi

script:
- mkdir -p build/logs
- phpunit --coverage-clover build/logs/clover.xml

after_success:
- sh -c 'if [ "$TRAVIS_PHP_VERSION" = "5.5" ]; then php vendor/bin/coveralls -v; fi;'
- if [[ "$TRAVIS_PHP_VERSION" = "5.5" ]]; then php vendor/bin/coveralls -v; fi
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The ICanBoogie/View package is free software.
It is released under the terms of the following BSD License.

Copyright (c) 2014-2015 by Olivier Laviale
Copyright (c) 2014-2016 by Olivier Laviale
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# customization

PACKAGE_NAME = ICanBoogie/View
PACKAGE_VERSION = 0.5.0
PACKAGE_VERSION = 0.8.0

# do not edit the following lines

usage:
@echo "test: Runs the test suite.\ndoc: Creates the documentation.\nclean: Removes the documentation, the dependencies and the Composer files."

vendor:
@composer install
@composer install --prefer-dist

update:
@composer update
@composer update --prefer-dist

autoload: vendor
@composer dump-autoload
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ use ICanBoogie\Render;
use ICanBoogie\Routing\Controller;
use ICanBoogie\View\View;

use function ICanBoogie\Render\get_renderer;

Prototype::configure([

Controller::class => [

'lazy_get_view' => function(Controller $controller) {

$view = new View($controller, get_renderer());
$view = new View($controller, \ICanBoogie\Render\get_renderer());

new View\AlterEvent($view);

Expand Down Expand Up @@ -139,7 +137,7 @@ $app->events->attach(function(View\AlterEvent $event, View $view) use ($app) {

// adding a template path
$view->template_resolver->add_path($app->modules[$module_id]->path . 'templates');

// adding a variable
$view['log'] = $app->log->messages;

Expand Down Expand Up @@ -168,7 +166,8 @@ The template used to present the content of the view is resolved as follows:
- From the `template` property of the view.
- From the `template` property of the route.
- From the `template` property of the controller.
- From the name and action of the controller, if the controller has an `action` property e.g. "articles/show".
- From the name and action of the controller, if the controller has an `action` property e.g.
"articles/show".

The layout used to decorate the template is resolved as follows:

Expand All @@ -181,8 +180,8 @@ The layout used to decorate the template is resolved as follows:
- "default" otherwise.

Because the `template` and `layout` properties are lazily created, you can define them instead of
letting [View][] find the right template names. The following example demonstrates how to _cancel_ the
template and define "admin" as layout:
letting [View][] find the right template names. The following example demonstrates how to _cancel_
the template and define "admin" as layout:

```php
<?php
Expand Down Expand Up @@ -235,14 +234,14 @@ $app->events->attach(function(View\BeforeRenderEvent $event, View $view) use ($s

$hash = hash('sha256', json_encode($view));
$result = $storage->retrieve($hash);

if ($result !== null)
{
$event->result = $result;

return;
}

$event->result = $result = $target->render(); $storage->store($key, $result);
$event->stop();

Expand All @@ -267,7 +266,7 @@ The following example demonstrates how the response is altered to suit the JSON

// templates/json.php

echo json_encode($content)
echo json_encode($content);
```


Expand Down
25 changes: 25 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<testsuites>
<testsuite name="icanboogie/view">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./lib</directory>
</whitelist>
</filter>
</phpunit>
25 changes: 0 additions & 25 deletions phpunit.xml.dist

This file was deleted.

0 comments on commit 0e573e8

Please sign in to comment.