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

Commit 0e57af9

Browse files
committed
The repository was updated to version 1.1.1
1 parent 417d0b4 commit 0e57af9

File tree

10 files changed

+392
-0
lines changed

10 files changed

+392
-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

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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\File\File` class.
14+
* Added `Josantonius\File\File::searchString()` method.
15+
16+
## 1.0.0 - 2017-01-17
17+
* Added `Josantonius\File\Exception\FileException` class.
18+
* Added `Josantonius\File\Exception\Exceptions` abstract class.
19+
* Added `Josantonius\File\Exception\FileException->__construct()` method.
20+
21+
## 1.0.0 - 2017-01-17
22+
* Added `Josantonius\File\Tests\FileTest` class.
23+
* Added `Josantonius\File\Tests\FileTest::testSearchString()` 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

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# PHP File library
2+
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/file/v/stable)](https://packagist.org/packages/josantonius/file) [![Total Downloads](https://poser.pugx.org/josantonius/file/downloads)](https://packagist.org/packages/josantonius/file) [![Latest Unstable Version](https://poser.pugx.org/josantonius/file/v/unstable)](https://packagist.org/packages/josantonius/file) [![License](https://poser.pugx.org/josantonius/file/license)](https://packagist.org/packages/josantonius/file)
4+
5+
[English version](README.md)
6+
7+
Librería PHP para manejo de archivos.
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 File library, simplemente escribe:
30+
31+
$ composer require Josantonius/File
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/File --prefer-source
36+
37+
También puedes clonar el repositorio completo con Git:
38+
39+
$ git clone https://github.com/Josantonius/File.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\File\File;
53+
```
54+
### Métodos disponibles
55+
56+
Métodos disponibles en esta librería:
57+
58+
```php
59+
File::searchString();
60+
```
61+
### Uso
62+
63+
Ejemplo de uso para esta librería:
64+
65+
```php
66+
<?php
67+
require __DIR__ . '/vendor/autoload.php';
68+
69+
use Josantonius\File\File;
70+
71+
$search = 'Morbi';
72+
73+
$filepath = getcwd() . '/' . 'resources/file.txt';
74+
75+
File::searchString($search, $filepath); /* bool(true) */
76+
```
77+
78+
### Tests
79+
80+
Para utilizar la clase de [pruebas](tests), simplemente:
81+
82+
```php
83+
<?php
84+
$loader = require __DIR__ . '/vendor/autoload.php';
85+
86+
$loader->addPsr4('Josantonius\\File\\Tests\\', __DIR__ . '/vendor/josantonius/file/tests');
87+
88+
use Josantonius\File\Tests\FileTest;
89+
```
90+
Métodos de prueba disponibles en esta librería:
91+
92+
```php
93+
FileTest::testSearchString();
94+
```
95+
96+
### Manejador de excepciones
97+
98+
Esta librería utiliza [control de excepciones](src/Exception) que puedes personalizar a tu gusto.
99+
### Contribuir
100+
1. Comprobar si hay incidencias abiertas o abrir una nueva para iniciar una discusión en torno a un fallo o función.
101+
1. Bifurca la rama del repositorio en GitHub para iniciar la operación de ajuste.
102+
1. Escribe una o más pruebas para la nueva característica o expón el error.
103+
1. Haz cambios en el código para implementar la característica o reparar el fallo.
104+
1. Envía pull request para fusionar los cambios y que sean publicados.
105+
106+
Esto está pensado para proyectos grandes y de larga duración.
107+
108+
### Repositorio
109+
110+
Los archivos de este repositorio se crearon y subieron automáticamente con [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
111+
112+
### Licencia
113+
114+
Este proyecto está licenciado bajo **licencia MIT**. Consulta el archivo [LICENSE](LICENSE) para más información.
115+
116+
## Copyright
117+
118+
2017 Josantonius, [josantonius.com](https://josantonius.com/)
119+
120+
Si te ha resultado útil, házmelo saber :wink:
121+
122+
Puedes contactarme en [Twitter](https://twitter.com/Josantonius) o a través de mi [correo electrónico](mailto:[email protected]).

README.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# PHP File library
2+
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/file/v/stable)](https://packagist.org/packages/josantonius/file) [![Total Downloads](https://poser.pugx.org/josantonius/file/downloads)](https://packagist.org/packages/josantonius/file) [![Latest Unstable Version](https://poser.pugx.org/josantonius/file/v/unstable)](https://packagist.org/packages/josantonius/file) [![License](https://poser.pugx.org/josantonius/file/license)](https://packagist.org/packages/josantonius/file)
4+
5+
[Versión en español](README-ES.md)
6+
7+
PHP library for file management.
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+
25+
### Installation
26+
27+
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
28+
29+
To install PHP File library, simply:
30+
31+
$ composer require Josantonius/File
32+
33+
The previous command will only install the necessary files, if you prefer to download the entire source, including tests, you can use:
34+
35+
$ composer require Josantonius/File --prefer-source
36+
37+
Or you can also clone the complete repository with Git:
38+
39+
$ git clone https://github.com/Josantonius/PHP-File.git
40+
41+
### Requirements
42+
43+
This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.
44+
45+
### Quick Start and Examples
46+
47+
To use this class, simply:
48+
49+
```php
50+
require __DIR__ . '/vendor/autoload.php';
51+
52+
use Josantonius\File\File;
53+
```
54+
### Available Methods
55+
56+
Available methods in this library:
57+
58+
```php
59+
File::searchString();
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\File\File;
70+
71+
$search = 'Morbi';
72+
73+
$filepath = getcwd() . '/' . 'resources/file.txt';
74+
75+
File::searchString($search, $filepath); /* bool(true) */
76+
```
77+
78+
### Tests
79+
80+
To use the [test](tests) class, simply:
81+
82+
```php
83+
<?php
84+
$loader = require __DIR__ . '/vendor/autoload.php';
85+
86+
$loader->addPsr4('Josantonius\\File\\Tests\\', __DIR__ . '/vendor/josantonius/file/tests');
87+
88+
use Josantonius\File\Tests\FileTest;
89+
90+
```
91+
Available test methods in this library:
92+
93+
```php
94+
FileTest::testSearchString();
95+
```
96+
97+
### Exception Handler
98+
99+
This library uses [exception handler](src/Exception) that you can customize.
100+
### Contribute
101+
1. Check for open issues or open a new issue to start a discussion around a bug or feature.
102+
1. Fork the repository on GitHub to start making your changes.
103+
1. Write one or more tests for the new feature or that expose the bug.
104+
1. Make code changes to implement the feature or fix the bug.
105+
1. Send a pull request to get your changes merged and published.
106+
107+
This is intended for large and long-lived objects.
108+
109+
### Repository
110+
111+
All files in this repository were created and uploaded automatically with [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
112+
113+
### Licensing
114+
115+
This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file for more info.
116+
117+
## Copyright
118+
119+
2017 Josantonius, [josantonius.com](https://josantonius.com/)
120+
121+
If you find it useful, let me know :wink:
122+
123+
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/FileException.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* PHP library for file management.
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-File
9+
* @since 1.0.0
10+
*/
11+
12+
namespace Josantonius\File\Exception;
13+
14+
/**
15+
* Exception class for File 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 FileException 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)