Skip to content

Commit 5b72ad2

Browse files
committed
Updated to 1.1.6 version
1 parent 98a0744 commit 5b72ad2

File tree

1,361 files changed

+189
-118166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,361 files changed

+189
-118166
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/tests export-ignore
22
/resources export-ignore
3-
/src/bootstrap.php export-ignore
4-
/vendor export-ignore
53
.gitattributes export-ignore
64
.gitignore export-ignore
75
_config.yml export-ignore
@@ -11,6 +9,7 @@ phpunit.xml.dist export-ignore
119
CONDUCT.md export-ignore
1210
contributors.txt export-ignore
1311
README.md export-ignore
12+
phpcs.ruleset.xml export-ignore
1413
README-ES.md export-ignore
1514
.editorconfig export-ignore
1615
composer.lock export-ignore

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ composer.phar
33
composer.lock
44
composer-test.lock
55
build/artifacts/
6-
artifacts/
6+
vendor/
77
docs/_build
88
docs/*.pyc
99
.git*/

.travis.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,42 @@ sudo: false
44

55
dist: trusty
66

7+
branches:
8+
only:
9+
- master
10+
711
git:
812
depth: 5
913

1014
php:
1115
- 5.6
1216
- 7.0
1317
- 7.1
18+
- 7.2
1419
- hhvm
1520
- nightly
1621

1722
matrix:
1823
fast_finish: true
24+
include:
25+
- php: 7.1
26+
env: PHPCS=PSR2
27+
1928
allow_failures:
2029
- php: nightly
2130

2231
before_script:
23-
- composer self-update
24-
- composer install
32+
- export PATH="./vendor/bin:$PATH"
33+
- travis_retry composer self-update
34+
- travis_retry composer install --no-interaction --prefer-source --dev
2535

2636
script:
27-
- composer test
37+
- phpunit
38+
- |
39+
if [[ "$PHPCS" ]] ; then
40+
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
41+
fi
42+
phpunit --coverage-clover=coverage.xml
43+
44+
after_success:
45+
- bash <(curl -s https://codecov.io/bash)

README-ES.md

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHP ErrorHandler library
22

3-
[![Latest Stable Version](https://poser.pugx.org/josantonius/errorhandler/v/stable)](https://packagist.org/packages/josantonius/errorhandler) [![Total Downloads](https://poser.pugx.org/josantonius/errorhandler/downloads)](https://packagist.org/packages/josantonius/errorhandler) [![Latest Unstable Version](https://poser.pugx.org/josantonius/errorhandler/v/unstable)](https://packagist.org/packages/josantonius/errorhandler) [![License](https://poser.pugx.org/josantonius/errorhandler/license)](https://packagist.org/packages/josantonius/errorhandler) [![Travis](https://travis-ci.org/Josantonius/PHP-ErrorHandler.svg)](https://travis-ci.org/Josantonius/PHP-ErrorHandler)
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/ErrorHandler/v/stable)](https://packagist.org/packages/josantonius/ErrorHandler) [![Latest Unstable Version](https://poser.pugx.org/josantonius/ErrorHandler/v/unstable)](https://packagist.org/packages/josantonius/ErrorHandler) [![License](https://poser.pugx.org/josantonius/ErrorHandler/license)](LICENSE) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fe730d61628249d280ecfb380a1ee3b8)](https://www.codacy.com/app/Josantonius/PHP-ErrorHandler?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Josantonius/PHP-ErrorHandler&amp;utm_campaign=Badge_Grade) [![Total Downloads](https://poser.pugx.org/josantonius/ErrorHandler/downloads)](https://packagist.org/packages/josantonius/ErrorHandler) [![Travis](https://travis-ci.org/Josantonius/PHP-ErrorHandler.svg)](https://travis-ci.org/Josantonius/PHP-ErrorHandler) [![PSR2](https://img.shields.io/badge/PSR-2-1abc9c.svg)](http://www.php-fig.org/psr/psr-2/) [![PSR4](https://img.shields.io/badge/PSR-4-9b59b6.svg)](http://www.php-fig.org/psr/psr-4/) [![CodeCov](https://codecov.io/gh/Josantonius/PHP-ErrorHandler/branch/master/graph/badge.svg)](https://codecov.io/gh/Josantonius/PHP-ErrorHandler)
44

55
[English version](README.md)
66

@@ -23,27 +23,52 @@ Biblioteca PHP para manejar excepciones y errores.
2323

2424
---
2525

26+
### Requisitos
27+
28+
Esta clase es soportada por versiones de `PHP 5.6` o superiores y es compatible con versiones de `HHVM 3.0` o superiores.
29+
2630
### Instalación
2731

28-
La mejor forma de instalar esta extensión es a través de [composer](http://getcomposer.org/download/).
32+
La mejor forma de instalar esta extensión es a través de [Composer](http://getcomposer.org/download/).
2933

30-
Para instalar PHP ErrorHandler library, simplemente escribe:
34+
Para instalar `PHP ErrorHandler library`, simplemente escribe:
3135

3236
$ composer require Josantonius/ErrorHandler
3337

34-
El comando anterior sólo instalará los archivos necesarios, si prefieres descargar todo el código fuente (incluyendo tests, directorio vendor, excepciones no utilizadas, documentos...) puedes utilizar:
38+
El comando anterior sólo instalará los archivos necesarios, si prefieres **descargar todo el código fuente** puedes utilizar:
3539

3640
$ composer require Josantonius/ErrorHandler --prefer-source
3741

38-
También puedes clonar el repositorio completo con Git:
42+
También puedes **clonar el repositorio** completo con Git:
3943

40-
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
44+
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
4145

42-
### Requisitos
46+
O **instalarlo manualmente**:
47+
48+
[Descargar ErrorHandler.php](https://raw.githubusercontent.com/Josantonius/PHP-ErrorHandler/master/src/ErrorHandler.php):
49+
50+
$ wget https://raw.githubusercontent.com/Josantonius/PHP-ErrorHandler/master/src/ErrorHandler.php
51+
52+
### Métodos disponibles
53+
54+
Métodos disponibles en esta biblioteca:
55+
56+
`Set customs methods to renderizate:`
57+
58+
```php
59+
setCustomMethod($class, $method, $repeat, $default);
60+
```
61+
62+
| Atributo | Descripción | Tipo | Requerido | Predeterminado
63+
| --- | --- | --- | --- | --- |
64+
| $class | Nombre de la clase u objeto. | callable | Yes | |
65+
| $method | Nombre del método. | string | Yes | |
66+
| $repeat | Número de veces que repetir el método en caso de múltiples errores. | int | No | 0 |
67+
| $default | Mostrar vista por defecto. | boolean | No | false |
4368

44-
Esta biblioteca es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores.
69+
**# Return** (void)
4570

46-
### Cómo empezar y ejemplos
71+
### Cómo empezar
4772

4873
Para utilizar esta biblioteca, simplemente:
4974

@@ -52,24 +77,20 @@ require __DIR__ . '/vendor/autoload.php';
5277

5378
use Josantonius\ErrorHandler\ErrorHandler;
5479
```
55-
### Métodos disponibles
5680

57-
Métodos disponibles en esta biblioteca:
81+
Si la instalaste `manualmente`, utiliza:
5882

5983
```php
60-
ErrorHandler::setCustomMethod();
84+
require_once __DIR__ . '/ErrorHandler.php';
85+
86+
use Josantonius\ErrorHandler\ErrorHandler;
6187
```
6288

6389
### Uso
6490

6591
Ejemplo de uso para esta biblioteca:
6692

6793
```php
68-
<?php
69-
require __DIR__ . '/vendor/autoload.php';
70-
71-
use Josantonius\ErrorHandler\ErrorHandler;
72-
7394
/* Se recomienda intanciar la clase en un archivo base como el index.php */
7495

7596
new ErrorHandler;
@@ -90,24 +111,36 @@ new ErrorHandler;
90111
* ];
91112
*
92113
*/
93-
$class = $this;
94114

95-
$method = 'customMethodResponse';
115+
$class = $this;
116+
$method = 'customMethodResponse';
117+
$times = 0;
118+
$default = true;
96119

97-
$times = 0; // Número de veces para repetir este método en caso de errores múltiples
98-
99-
ErrorHandler::SetCustomMethod($class, $method, $times);
120+
ErrorHandler::SetCustomMethod($class, $method, $times, $default);
100121
```
101122

102123
### Tests
103124

104-
Para ejecutar las [pruebas](tests/ErrorHandler/Test) simplemente:
125+
Para ejecutar las [pruebas](tests) necesitarás [Composer](http://getcomposer.org/download/) y seguir los siguientes pasos:
105126

106127
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
107128

108129
$ cd PHP-ErrorHandler
109130

110-
$ phpunit
131+
$ composer install
132+
133+
Ejecutar pruebas unitarias con [PHPUnit](https://phpunit.de/):
134+
135+
$ composer phpunit
136+
137+
Ejecutar pruebas de estándares de código [PSR2](http://www.php-fig.org/psr/psr-2/) con [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer):
138+
139+
$ composer phpcs
140+
141+
Ejecutar todas las pruebas anteriores:
142+
143+
$ composer tests
111144

112145
### Imágenes
113146

README.md

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# PHP ErrorHandler library
22

3-
[![Latest Stable Version](https://poser.pugx.org/josantonius/errorhandler/v/stable)](https://packagist.org/packages/josantonius/errorhandler) [![Total Downloads](https://poser.pugx.org/josantonius/errorhandler/downloads)](https://packagist.org/packages/josantonius/errorhandler) [![Latest Unstable Version](https://poser.pugx.org/josantonius/errorhandler/v/unstable)](https://packagist.org/packages/josantonius/errorhandler) [![License](https://poser.pugx.org/josantonius/errorhandler/license)](https://packagist.org/packages/josantonius/errorhandler) [![Travis](https://travis-ci.org/Josantonius/PHP-ErrorHandler.svg)](https://travis-ci.org/Josantonius/PHP-ErrorHandler)
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/ErrorHandler/v/stable)](https://packagist.org/packages/josantonius/ErrorHandler) [![Latest Unstable Version](https://poser.pugx.org/josantonius/ErrorHandler/v/unstable)](https://packagist.org/packages/josantonius/ErrorHandler) [![License](https://poser.pugx.org/josantonius/ErrorHandler/license)](LICENSE) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fe730d61628249d280ecfb380a1ee3b8)](https://www.codacy.com/app/Josantonius/PHP-ErrorHandler?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Josantonius/PHP-ErrorHandler&amp;utm_campaign=Badge_Grade) [![Total Downloads](https://poser.pugx.org/josantonius/ErrorHandler/downloads)](https://packagist.org/packages/josantonius/ErrorHandler) [![Travis](https://travis-ci.org/Josantonius/PHP-ErrorHandler.svg)](https://travis-ci.org/Josantonius/PHP-ErrorHandler) [![PSR2](https://img.shields.io/badge/PSR-2-1abc9c.svg)](http://www.php-fig.org/psr/psr-2/) [![PSR4](https://img.shields.io/badge/PSR-4-9b59b6.svg)](http://www.php-fig.org/psr/psr-4/) [![CodeCov](https://codecov.io/gh/Josantonius/PHP-ErrorHandler/branch/master/graph/badge.svg)](https://codecov.io/gh/Josantonius/PHP-ErrorHandler)
44

55
[Versión en español](README-ES.md)
66

77
PHP library for handling exceptions and errors.
88

99
---
1010

11-
- [Installation](#installation)
1211
- [Requirements](#requirements)
13-
- [Quick Start and Examples](#quick-start-and-examples)
12+
- [Installation](#installation)
1413
- [Available Methods](#available-methods)
14+
- [Quick Start](#quick-start)
1515
- [Usage](#usage)
1616
- [Tests](#tests)
1717
- [Images](#images)
@@ -23,53 +23,74 @@ PHP library for handling exceptions and errors.
2323

2424
---
2525

26+
### Requirements
27+
28+
This library is supported by `PHP versions 5.6` or higher and is compatible with `HHVM versions 3.0` or higher.
29+
2630
### Installation
2731

28-
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
32+
The preferred way to install this extension is through [Composer](http://getcomposer.org/download/).
2933

30-
To install PHP ErrorHandler library, simply:
34+
To install `PHP ErrorHandler library`, simply:
3135

3236
$ composer require Josantonius/ErrorHandler
3337

34-
The previous command will only install the necessary files, if you prefer to download the entire source code (including tests, vendor folder, exceptions not used, docs...) you can use:
38+
The previous command will only install the necessary files, if you prefer to **download the entire source code** you can use:
3539

3640
$ composer require Josantonius/ErrorHandler --prefer-source
3741

38-
Or you can also clone the complete repository with Git:
42+
You can also **clone the complete repository** with Git:
3943

40-
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
41-
42-
### Requirements
44+
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
45+
46+
Or **install it manually**:
47+
48+
[Download ErrorHandler.php](https://raw.githubusercontent.com/Josantonius/PHP-ErrorHandler/master/src/ErrorHandler.php):
49+
50+
$ wget https://raw.githubusercontent.com/Josantonius/PHP-ErrorHandler/master/src/ErrorHandler.php
51+
52+
### Available Methods
53+
54+
Available methods in this library:
55+
56+
`Set customs methods to renderizate:`
57+
58+
```php
59+
setCustomMethod($class, $method, $repeat, $default);
60+
```
4361

44-
This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.
62+
| Attribute | Description | Type | Required | Default
63+
| --- | --- | --- | --- | --- |
64+
| $class | Class name or class object. | string|object| Yes | |
65+
| $method | Method name. | string| Yes | |
66+
| $repeat | Number of times to repeat method. | int | No | 0 |
67+
| $default | Show default view. | boolean | No | false |
4568

46-
### Quick Start and Examples
69+
**# Return** (void)
4770

48-
To use this class, simply:
71+
### Quick Start
72+
73+
To use this class with `Composer`:
4974

5075
```php
5176
require __DIR__ . '/vendor/autoload.php';
5277

5378
use Josantonius\ErrorHandler\ErrorHandler;
5479
```
55-
### Available Methods
5680

57-
Available methods in this library:
81+
Or If you installed it `manually`, use it:
5882

5983
```php
60-
ErrorHandler::setCustomMethod();
84+
require_once __DIR__ . '/ErrorHandler.php';
85+
86+
use Josantonius\ErrorHandler\ErrorHandler;
6187
```
6288

6389
### Usage
6490

6591
Example of use for this library:
6692

6793
```php
68-
<?php
69-
require __DIR__ . '/vendor/autoload.php';
70-
71-
use Josantonius\ErrorHandler\ErrorHandler;
72-
7394
/**
7495
* It is recommended to instantiate the class in a base file as the index.php */
7596

@@ -91,24 +112,36 @@ new ErrorHandler;
91112
* ];
92113
*
93114
*/
94-
$class = $this;
115+
116+
$class = $this;
117+
$method = 'customMethodResponse';
118+
$times = 0;
119+
$default = true;
95120

96-
$method = 'customMethodResponse';
97-
98-
$times = 0; // Times number to repeat this method in case of multiple errors
99-
100-
ErrorHandler::SetCustomMethod($class, $method, $times);
121+
ErrorHandler::SetCustomMethod($class, $method, $times, $default);
101122
```
102123

103124
### Tests
104125

105-
To run [tests](tests/ErrorHandler/Test) simply:
126+
To run [tests](tests) you just need [Composer](http://getcomposer.org/download/) and to execute the following:
106127

107128
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
108129

109130
$ cd PHP-ErrorHandler
110131

111-
$ phpunit
132+
$ composer install
133+
134+
Run unit tests with [PHPUnit](https://phpunit.de/):
135+
136+
$ composer phpunit
137+
138+
Run [PSR2](http://www.php-fig.org/psr/psr-2/) code standard tests with [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer):
139+
140+
$ composer phpcs
141+
142+
Run all previous tests:
143+
144+
$ composer tests
112145

113146
### Images
114147

@@ -120,7 +153,7 @@ To run [tests](tests/ErrorHandler/Test) simply:
120153
### ☑ TODO
121154

122155
- [x] Create tests
123-
- [ ] Improve documentation
156+
- [x] Improve documentation
124157

125158
### Contribute
126159

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
},
4141
"autoload": {
4242
"psr-4": {
43-
"Josantonius\\ErrorHandler\\": "src/ErrorHandler/"
43+
"Josantonius\\ErrorHandler\\": "src/"
4444
}
4545
},
4646
"autoload-dev": {
4747
"psr-4": {
48-
"Josantonius\\DataType\\": "tests/"
48+
"Josantonius\\ErrorHandler\\": "tests/"
4949
}
5050
},
5151
"extra": {

0 commit comments

Comments
 (0)