Skip to content

Commit

Permalink
Merge branch 'release/0.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
olinox14 committed Mar 29, 2024
2 parents 04555b2 + c843851 commit 390cdb0
Show file tree
Hide file tree
Showing 5 changed files with 623 additions and 281 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:

jobs:
test:
name: Unit tests

runs-on: ubuntu-latest

strategy:
Expand All @@ -21,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
Expand All @@ -39,3 +41,29 @@ jobs:
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./vendor/php-coveralls/php-coveralls/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v

phpstan:
name: Code quality

runs-on: ubuntu-latest

strategy:
matrix:
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Validate
run: composer validate

- name: Install
run: composer install --prefer-dist --no-progress

- name: Run PHPStan
run: vendor/bin/phpstan analyse --memory-limit=-1
41 changes: 23 additions & 18 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,32 @@

> This library is still under development, DO NOT USE IN PRODUCTION. Contributions, however, are welcome.
An intuitive and object-oriented file and path operations, inspired by the path.py python library.
An intuitive and object-oriented library for file and path operations, inspired by the path.py python library.

<?php

use Path\Path;

// Get the parent directory of the current script file
$dir = (new Path(__file__))->parent();

// Display the liste of the subdirectories of this directory
var_dump(
$dir->dirs()
);

// Get the path of the working directory
$path = new Path('.');

// Iterate over the files in this directory and change the permissions of these files to 755
foreach($path->files() as $file) {
$file->chmod(755);
}

// Create a new path by adding a file's name to the previous path
$newPath = $path->append('readme.md');

var_dump($newPath->absPath());

// Display the absolute path of this file
var_dump($newPath->absPath());

## Requirement
Expand All @@ -51,7 +55,7 @@ Instantiate with some path :
$path = new Path('/foo/bar/file.ext');
$path = new Path(__file__);

And use it as you like. For example, if you want to rename all the html files in the directory where
And use it as needed. For example, if you want to rename all the html files in the directory where
your current script lies into .md files :

$path = new Path(__file__);
Expand Down Expand Up @@ -104,7 +108,7 @@ Run the unit tests :

#### Next runs

If you've already built your container, start it and run the unit tests with :
If you've already built your container, start it and run unit tests with :

docker start path
docker exec -it path bash
Expand Down Expand Up @@ -140,7 +144,7 @@ To install and run [phpdoc](https://docs.phpdoc.org/3.0/) :
# On Windows
docker run --rm -v "%cd%:/data" "phpdoc/phpdoc:3"

If you're on linux, you could create an alias with :
If you're on Linux, you could create an alias with :

alias phpdoc="docker run --rm -v $(pwd):/data phpdoc/phpdoc:3"

Expand All @@ -165,18 +169,19 @@ Path-php is under the [MIT](http://opensource.org/licenses/MIT) licence.

0.1.3

* [] add quality tools to CI
* [] add 'ignore' and 'errorOnExistingDestination' to the copyTree method
* [] implement the 'getOwner' method
* [] implement the 'chgrp' method
* [] fix the 'chroot' method
* [] complete the 'sameFile' documentation
* [] review the 'rmdir' error management
* [x] implement the 'getOwner' method
* [x] implement the 'chgrp' method
* [x] complete the 'sameFile' documentation
* [x] remove the 'access' method and add 'isReadable', 'isWritable', 'isExecutable' methods
* [x] review the 'rmdir' error management
* [x] fix the 'chroot' method
* [x] add quality tools to CI

0.2 :

* [] multi os compat (windows)
* [] handle protocols (ftp, sftp, file, smb, http, ...etc)
* [] handle unc paths (windows)
* [] improve error management and tracebacks

* [ ] multi os compat (windows)
* [ ] handle protocols (ftp, sftp, file, smb, http, ...etc)
* [ ] handle unc paths (windows)
* [ ] improve error management and tracebacks
* [ ] study the interest of implementing a 'mergeTree' method
* [ ] add 'ignore' and 'errorOnExistingDestination' to the copyTree method
10 changes: 10 additions & 0 deletions src/BuiltinProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ public function chgrp(string $filename, int|string $group): bool
return chgrp($filename, $group);
}

public function fileowner(string $filename): false|int
{
return fileowner($filename);
}

public function posix_getpwuid(int $id): false|array
{
return posix_getpwuid($id);
}

public function chroot(string $directory): bool
{
return chroot($directory);
Expand Down
Loading

0 comments on commit 390cdb0

Please sign in to comment.