Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.

Commit a8b67f5

Browse files
committed
The repository was updated to version 1.1.1
1 parent 3d8796d commit a8b67f5

9 files changed

+405
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
phpunit.xml
2+
composer.phar
3+
composer.lock
4+
composer-test.lock
5+
vendor/
6+
build/artifacts/
7+
artifacts/
8+
docs/_build
9+
docs/*.pyc
10+
.git*/
11+
.idea
12+
.DS_STORE

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# CHANGELOG
2+
3+
## 1.1.1 - 2017-03-18
4+
* Some files were excluded from download and comments and readme files were updated.
5+
6+
## 1.1.0 - 2017-01-30
7+
* Compatible with PHP 5.6 or higher.
8+
9+
## 1.0.0 - 2017-01-30
10+
* Compatible only with PHP 7.0 or higher. In the next versions, the library will be modified to make it compatible with PHP 5.6 or higher.
11+
12+
## 1.0.0 - 2017-01-17
13+
* Added `Josantonius\LoadTime\LoadTime` class.
14+
* Added `Josantonius\LoadTime\LoadTime::start()` method.
15+
* Added `Josantonius\LoadTime\LoadTime::end()` method.
16+
17+
## 1.0.0 - 2017-01-17
18+
* Added `Josantonius\LoadTime\Exception\LoadTimeException` class.
19+
* Added `Josantonius\LoadTime\Exception\Exceptions` abstract class.
20+
* Added `Josantonius\LoadTime\Exception\LoadTimeException->__construct()` method.
21+
22+
## 1.0.0 - 2017-01-17
23+
* Added `Josantonius\LoadTime\Tests\LoadTimeTest` class.
24+
* Added `Josantonius\LoadTime\Tests\LoadTimeTest::testLoadTimeScript()` method.

CONDUCT.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

README-ES.md

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# PHP LoadTime library
2+
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/loadtime/v/stable)](https://packagist.org/packages/josantonius/loadtime) [![Total Downloads](https://poser.pugx.org/josantonius/loadtime/downloads)](https://packagist.org/packages/josantonius/loadtime) [![Latest Unstable Version](https://poser.pugx.org/josantonius/loadtime/v/unstable)](https://packagist.org/packages/josantonius/loadtime) [![License](https://poser.pugx.org/josantonius/loadtime/license)](https://packagist.org/packages/josantonius/loadtime)
4+
5+
[English version](README.md)
6+
7+
Calcular tiempo de carga de páginas o scripts.
8+
9+
---
10+
11+
- [Instalación](#instalación)
12+
- [Requisitos](#requisitos)
13+
- [Cómo empezar y ejemplos](#cómo-empezar-y-ejemplos)
14+
- [Métodos disponibles](#métodos-disponibles)
15+
- [Uso](#uso)
16+
- [Tests](#tests)
17+
- [Manejador de excepciones](#manejador-de-excepciones)
18+
- [Contribuir](#contribuir)
19+
- [Repositorio](#repositorio)
20+
- [Licencia](#licencia)
21+
- [Copyright](#copyright)
22+
23+
---
24+
25+
### Instalación
26+
27+
La mejor forma de instalar esta extensión es a través de [composer](http://getcomposer.org/download/).
28+
29+
Para instalar PHP LoadTime library, simplemente escribe:
30+
31+
$ composer require Josantonius/LoadTime
32+
33+
El comando anterior solamente instalará los archivos necesarios, si prefieres descargar todo el código, incluyendo tests, puedes utilizar:
34+
35+
$ composer require Josantonius/LoadTime --prefer-source
36+
37+
También puedes clonar el repositorio completo con Git:
38+
39+
$ git clone https://github.com/Josantonius/PHP-LoadTime.git
40+
41+
### Requisitos
42+
43+
Esta ĺibrería es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores.
44+
45+
### Cómo empezar y ejemplos
46+
47+
Para utilizar esta librería, simplemente:
48+
49+
```php
50+
require __DIR__ . '/vendor/autoload.php';
51+
52+
use Josantonius\LoadTime\LoadTime;
53+
```
54+
### Métodos disponibles
55+
56+
Métodos disponibles en esta librería:
57+
58+
```php
59+
LoadTime::start();
60+
LoadTime::end();
61+
```
62+
### Uso
63+
64+
Ejemplo de uso para esta librería:
65+
66+
```php
67+
<?php
68+
require __DIR__ . '/vendor/autoload.php';
69+
70+
use Josantonius\LoadTime\LoadTime;
71+
72+
LoadTime::start();
73+
74+
for ($i=0; $i < 100000; $i++) {
75+
// print_r($i . ' ');
76+
}
77+
78+
print_r('Script executed in: ' . LoadTime::end() . ' seconds.');
79+
80+
/* Script executed in: 0.0012 seconds. */
81+
```
82+
83+
### Tests
84+
85+
Para utilizar la clase de [pruebas](tests), simplemente:
86+
87+
```php
88+
<?php
89+
$loader = require __DIR__ . '/vendor/autoload.php';
90+
91+
$loader->addPsr4('Josantonius\\LoadTime\\Tests\\', __DIR__ . '/vendor/josantonius/loadtime/tests');
92+
93+
use Josantonius\LoadTime\Tests\LoadTimeTest;
94+
```
95+
Métodos de prueba disponibles en esta librería:
96+
97+
```php
98+
LoadTimeTest::testLoadTimeScript();
99+
```
100+
101+
### Manejador de excepciones
102+
103+
Esta librería utiliza [control de excepciones](src/Exception) que puedes personalizar a tu gusto.
104+
### Contribuir
105+
1. Comprobar si hay incidencias abiertas o abrir una nueva para iniciar una discusión en torno a un fallo o función.
106+
1. Bifurca la rama del repositorio en GitHub para iniciar la operación de ajuste.
107+
1. Escribe una o más pruebas para la nueva característica o expón el error.
108+
1. Haz cambios en el código para implementar la característica o reparar el fallo.
109+
1. Envía pull request para fusionar los cambios y que sean publicados.
110+
111+
Esto está pensado para proyectos grandes y de larga duración.
112+
113+
### Repositorio
114+
115+
Los archivos de este repositorio se crearon y subieron automáticamente con [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
116+
117+
### Licencia
118+
119+
Este proyecto está licenciado bajo **licencia MIT**. Consulta el archivo [LICENSE](LICENSE) para más información.
120+
121+
## Copyright
122+
123+
2017 Josantonius, [josantonius.com](https://josantonius.com/)
124+
125+
Si te ha resultado útil, házmelo saber :wink:
126+
127+
Puedes contactarme en [Twitter](https://twitter.com/Josantonius) o a través de mi [correo electrónico](mailto:[email protected]).

README.md

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# PHP LoadTime library
2+
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/loadtime/v/stable)](https://packagist.org/packages/josantonius/loadtime) [![Total Downloads](https://poser.pugx.org/josantonius/loadtime/downloads)](https://packagist.org/packages/josantonius/loadtime) [![Latest Unstable Version](https://poser.pugx.org/josantonius/loadtime/v/unstable)](https://packagist.org/packages/josantonius/loadtime) [![License](https://poser.pugx.org/josantonius/loadtime/license)](https://packagist.org/packages/josantonius/loadtime)
4+
5+
[Versión en español](README-ES.md)
6+
7+
Calculate load time of pages or scripts.
8+
9+
---
10+
11+
- [Installation](#installation)
12+
- [Requirements](#requirements)
13+
- [Quick Start and Examples](#quick-start-and-examples)
14+
- [Available Methods](#available-methods)
15+
- [Usage](#usage)
16+
- [Tests](#tests)
17+
- [Exception Handler](#exception-handler)
18+
- [Contribute](#contribute)
19+
- [Repository](#repository)
20+
- [Licensing](#licensing)
21+
- [Copyright](#copyright)
22+
---
23+
24+
### Installation
25+
26+
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
27+
28+
To install PHP LoadTime library, simply:
29+
30+
$ composer require Josantonius/LoadTime
31+
32+
The previous command will only install the necessary files, if you prefer to download the entire source, including tests, you can use:
33+
34+
$ composer require Josantonius/LoadTime --prefer-source
35+
36+
Or you can also clone the complete repository with Git:
37+
38+
$ git clone https://github.com/Josantonius/PHP-LoadTime.git
39+
40+
### Requirements
41+
42+
This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.
43+
44+
### Quick Start and Examples
45+
46+
To use this class, simply:
47+
48+
```php
49+
require __DIR__ . '/vendor/autoload.php';
50+
51+
use Josantonius\LoadTime\LoadTime;
52+
```
53+
### Available Methods
54+
55+
Available methods in this library:
56+
57+
```php
58+
LoadTime::start();
59+
LoadTime::end();
60+
```
61+
### Usage
62+
63+
Example of use for this library:
64+
65+
```php
66+
<?php
67+
require __DIR__ . '/vendor/autoload.php';
68+
69+
use Josantonius\LoadTime\LoadTime;
70+
71+
LoadTime::start();
72+
73+
for ($i=0; $i < 100000; $i++) {
74+
// print_r($i . ' ');
75+
}
76+
77+
print_r('Script executed in: ' . LoadTime::end() . ' seconds.');
78+
79+
/* Script executed in: 0.0012 seconds. */
80+
```
81+
82+
### Tests
83+
84+
To use the [test](tests) class, simply:
85+
86+
```php
87+
<?php
88+
$loader = require __DIR__ . '/vendor/autoload.php';
89+
90+
$loader->addPsr4('Josantonius\\LoadTime\\Tests\\', __DIR__ . '/vendor/josantonius/loadtime/tests');
91+
92+
use Josantonius\LoadTime\Tests\LoadTimeTest;
93+
94+
```
95+
Available test methods in this library:
96+
97+
```php
98+
LoadTimeTest::testLoadTimeScript();
99+
```
100+
101+
### Exception Handler
102+
103+
This library uses [exception handler](src/Exception) that you can customize.
104+
### Contribute
105+
1. Check for open issues or open a new issue to start a discussion around a bug or feature.
106+
1. Fork the repository on GitHub to start making your changes.
107+
1. Write one or more tests for the new feature or that expose the bug.
108+
1. Make code changes to implement the feature or fix the bug.
109+
1. Send a pull request to get your changes merged and published.
110+
111+
This is intended for large and long-lived objects.
112+
113+
### Repository
114+
115+
All files in this repository were created and uploaded automatically with [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
116+
117+
### Licensing
118+
119+
This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file for more info.
120+
121+
## Copyright
122+
123+
2017 Josantonius, [josantonius.com](https://josantonius.com/)
124+
125+
If you find it useful, let me know :wink:
126+
127+
You can contact me on [Twitter](https://twitter.com/Josantonius) or through my [email](mailto:[email protected]).

contributors.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Josantonius

src/Exception/LoadTimeException.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Calculate load time of pages or scripts.
4+
*
5+
* @author Josantonius - [email protected]
6+
* @copyright Copyright (c) 2017
7+
* @license https://opensource.org/licenses/MIT - The MIT License (MIT)
8+
* @link https://github.com/Josantonius/PHP-LoadTime
9+
* @since 1.0.0
10+
*/
11+
12+
namespace Josantonius\LoadTime\Exception;
13+
14+
/**
15+
* Exception class for LoadTime library.
16+
*
17+
* You can use an exception and error handler with this library.
18+
*
19+
* @since 1.0.0
20+
*
21+
* @link https://github.com/Josantonius/PHP-ErrorHandler
22+
*/
23+
class LoadTimeException extends \Exception {
24+
25+
/**
26+
* Exception handler.
27+
*
28+
* @since 1.0.0
29+
*
30+
* @param string $msg → message error (Optional)
31+
* @param int $error → error code (Optional)
32+
* @param int $status → HTTP response status code (Optional)
33+
*/
34+
public function __construct($msg = '', $error = 0, $status = 0) {
35+
36+
$this->message = $msg;
37+
$this->code = $error;
38+
$this->statusCode = $status;
39+
}
40+
}

0 commit comments

Comments
 (0)