Skip to content

Commit

Permalink
Merge pull request LibreBooking#49 from apfelchips/develop
Browse files Browse the repository at this point in the history
php-cs-fixer & doc updates & composer integration
  • Loading branch information
effgarces authored May 23, 2021
2 parents ed7cc4f + 12fa94f commit ca29e78
Show file tree
Hide file tree
Showing 12 changed files with 10,698 additions and 10,750 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@
/Web/uploads/tos/*
!/Web/uploads/tos/index.html


/Web/test-embed.html

/.phpunit.result.cache
# /.phpunit.xml.dist is tracked
/.phpunit.xml
# /phpunit.xml.dist is tracked
/phpunit.xml

# /.php-cs-fixer.dist.php is tracked
.php-cs-fixer.php

/.phpdoc
# /.phpunit.dist.xml is tracked
/.phpdoc.xml
# /phpdoc.dist.xml is tracked
/phpdoc.xml

# Editor Cache Files
.idea
Expand Down
27 changes: 27 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

define('PHP_CS_FIXER_CACHE_FILE', __DIR__ . '/var/cache/.php-cs-fixer.cache');

try {
mkdir(dirname(PHP_CS_FIXER_CACHE_FILE), 0755, true);
} catch (exception $e) {}

// doc: https://github.com/FriendsOfPhp/PHP-CS-Fixer#usage
// https://symfony.com/doc/current/components/finder.html
$finder = new PhpCsFixer\Finder();

$finder->exclude(['.git', 'tpl_c', 'build', '.phpdoc', 'var', 'tools', 'vendor'])
->notPath(['lib/external'])
->in(__DIR__);

$config = new PhpCsFixer\Config();

// rules: https://cs.symfony.com/doc/rules/index.html
return $config
->setCacheFile(PHP_CS_FIXER_CACHE_FILE)
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true, // https://www.php-fig.org/psr/psr-12/
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder);
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"imperez.smarty",
"felixfbecker.php-intellisense",
"felixfbecker.php-debug",
"tombonnike.vscode-status-bar-format-toggle"
"tombonnike.vscode-status-bar-format-toggle",
"howardzuo.vscode-favorites",
"aaron-bond.better-comments",
"vikyd.vscode-fold-level",
"pomber.git-file-history"
]
}
3 changes: 0 additions & 3 deletions build.bat

This file was deleted.

1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<exclude name="build/**" />
<exclude name="build.xml" />
<exclude name="**/phing-tasks/**" />
<exclude name=".php-cs-fixer*" />
<!-- documentation -->
<exclude name="**/doc/**" />
<exclude name="**/docs/**" />
Expand Down
21 changes: 15 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
{
"description": "Booked Scheduler",
"autoload":
{

},
"require-dev":
{
"autoload": {},
"require-dev": {
"kint-php/kint": "^3.3",
"kint-php/kint-smarty": "^1.0"
},
"require" : {
"php" : ">=7.3"
},
"scripts": {
"install-tools":"phive install --copy --trust-gpg-keys 4AA394086372C20A,2420BAE0A3BE25C6,6DA3ACC4991FFAE5,E82B2FB314E9906E phing phpunit phpdocumentor php-cs-fixer",
"build":"./tools/phing",
"fix": "./tools/php-cs-fixer fix -v",
"lint": "./tools/php-cs-fixer fix -vv --dry-run",
"test": [
"./tools/phpunit",
"@lint"
]
}
}
2 changes: 2 additions & 0 deletions doc/API.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Booked Scheduler API Documentation

A dynamically generated API documentation Page can be found by opening `<booked-url>/Web/Services/index.php` (API has to be enabled in config)

__Pass the following headers for all secure service calls: `X-Booked-SessionToken` and `X-Booked-UserId`__

- [Accessories](#Accessories)
Expand Down
Binary file modified doc/BookedScheduler.mwb
Binary file not shown.
21,357 changes: 10,627 additions & 10,730 deletions doc/ERD.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Logically related code should be grouped in a directory with a "namespace.php" f
This simply makes it easier to include necessary file dependencies.

## API
Booked Scheduler has a REST-API
[API-Documentation](./API.md)

## User interface
Expand All @@ -37,10 +38,13 @@ Page templates are located in `/tpl` and, by default, are cached to `/tpl_c`
[Fugue Icons](https://p.yusukekamiyamane.com/) are used as the default iconset and when needed saved to `/Web/img/<icon-name>.png`

## Tools
you can easily install the following php tools needed for development with [phive](https://github.com/phar-io/phive#getting-phive) by going to the root of the project and executing `phive install <toolname>` all the tools will then be available inside the `/tools` directory.
you can easily install these useful php tools needed for development with [phive](https://github.com/phar-io/phive#getting-phive) and [composer](https://getcomposer.org/download/)
For phive to work properly you also need to install [gnupgp](https://www.gnupg.org/download/index.html#binary)

Simply run `composer install-tools` in the root of the project and all tools will be available inside the `/tools` directory.

### [Phing](https://www.phing.info/#docs)
Builds a distributable relase inside `/build` configured via `/build.xml`.
`composer build` Builds / Packages a distributable relase inside `/build` configured via `/build.xml`.

### [PHPUnit](https://phpunit.readthedocs.io/en/latest/writing-tests-for-phpunit.html)
All classes should have good unit test coverage. The level of coverage is up to the developer and should be done when the code is sufficiently complex.
Expand All @@ -51,6 +55,10 @@ Generates automatic documentation based on code comments.
You can customize the output by copying `/phpdoc.dist.xml` to `/phpdoc.xml` which now takes precedence and isn't tracked with git.
The documentation will be generated in `/.phpdoc/build`.

### [PHP-CS-Fixer](https://github.com/FriendsOfPhp/PHP-CS-Fixer#usage)
`compser lint` and `composer fix`
lints (just warnings) and fixes (changes files) code formating to [PSR-12]

## Application Structure

/config Application configuration
Expand Down
5 changes: 3 additions & 2 deletions lang/de_de/AccountActivation.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Sehr geehrte/r {$FirstName} {$LastName},<br/>
<br />
<br/>
Vielen Dank für Ihre Registrierung.
Durch einen Klick auf diesen <h3>Link <a href="{$ActivationUrl}"></h3>aktivieren Sie Ihr Konto</a>.
Durch einen Klick auf diesen Link: <h3><a href="{$ActivationUrl}">aktivieren Sie Ihr Konto</a></h3><br/>
oder geben Sie <em>{$ActivationUrl}</em> in Ihren Browser ein.
1 change: 1 addition & 0 deletions phpdoc.dist.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- doc: https://docs.phpdoc.org/latest/guide/references/configuration.html -->
<!-- annotations: https://manual.phpdoc.org/HTMLframesConverter/default/ -->
<phpdocumentor
configVersion="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down

0 comments on commit ca29e78

Please sign in to comment.