diff --git a/README.md b/README.md index d4be649..2cc74e9 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,14 @@ [Gitea](https://gitea.io) client library, in [PHP](https://secure.php.net). -## Resources -- [Documentation](https://github.com/sab-international/gitea.php/wiki) -- [API reference](https://sab-international.github.io/gitea.php) +## Documentation +- [User guide](https://dev.sabcomputer.com/gitea.php) +- [API reference](https://dev.sabcomputer.com/gitea.php/api) + +## Development +- [Git repository](https://github.com/sab-international/gitea.php) - [Packagist package](https://packagist.org/packages/sab-international/gitea) -- [GitHub repository](https://github.com/sab-international/gitea.php) +- [Submit an issue](https://github.com/sab-international/gitea.php/issues) ## License -[Gitea for PHP](https://github.com/sab-international/gitea.php) is distributed under the MIT License. +[Gitea for PHP](https://dev.sabcomputer.com/gitea.php) is distributed under the MIT License. diff --git a/RoboFile.php b/RoboFile.php index 58c088d..64faf19 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -38,7 +38,12 @@ class RoboFile extends Tasks { * Builds the documentation. */ function doc(): void { - $this->_exec('phpdoc'); + $this->taskFilesystemStack() + ->copy('CHANGELOG.md', 'doc/about/changelog.md') + ->copy('LICENSE.md', 'doc/about/license.md') + ->run(); + + $this->_exec('mkdocs build'); } /** diff --git a/doc/about/see_also.md b/doc/about/see_also.md new file mode 100644 index 0000000..ef3a20f --- /dev/null +++ b/doc/about/see_also.md @@ -0,0 +1,15 @@ +# See also + +## Development +- [API reference](https://dev.sabcomputer.com/gitea.php/api) +- [Packagist package](https://packagist.org/packages/sab-international/gitea) +- [Submit an issue](https://github.com/sab-international/gitea.php/issues) + +## Testing +- [Continuous integration](https://travis-ci.com/sab-international/gitea.php) +- [Code coverage](https://coveralls.io/github/sab-international/gitea.php/) + +## Other implementations +- Dart: [Gitea for Dart](https://dev.belin.io/gitea.dart) +- JavaScript: [Gitea for JS](https://dev.belin.io/gitea.js) +- Yii Framework: [Gitea for Yii](https://dev.sabcomputer.com/yii2-gitea) diff --git a/doc/img/gitea.png b/doc/img/gitea.png new file mode 100644 index 0000000..154e5c8 Binary files /dev/null and b/doc/img/gitea.png differ diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 0000000..574baae --- /dev/null +++ b/doc/index.md @@ -0,0 +1,15 @@ +# Gitea for PHP + +## Yet another implementation of enumerated types +This implementation, based on [traits](https://secure.php.net/manual/en/language.oop5.traits.php), does not try to reproduce the semantics of traditional enumerations, like the ones found in C# or Java languages. + +Unlike other [PHP](https://secure.php.net) implementations, like the [SplEnum](https://secure.php.net/manual/en/class.splgitea.php) class, it does not rely on object instances. Instead, it just gives a set of static methods to ease working with the `public` constants of a class representing an enumerated type. + +## Quick start +Install the latest version of **Enums for PHP** with [Composer](https://getcomposer.org): + +```shell +composer require sab-international/gitea +``` + +For detailed instructions, see the [installation guide](installation.md). diff --git a/doc/installation.md b/doc/installation.md new file mode 100644 index 0000000..1b9ad99 --- /dev/null +++ b/doc/installation.md @@ -0,0 +1,39 @@ +# Installation + +## Requirements +Before installing **Enums for PHP**, you need to make sure you have [PHP](https://secure.php.net) +and [Composer](https://getcomposer.org), the PHP package manager, up and running. + +!!! warning + Enums for PHP requires PHP >= **7.2.0**. + +You can verify if you're already good to go with the following commands: + +```shell +php --version +# PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS ) + +composer --version +# Composer version 1.7.2 2018-08-16 16:57:12 +``` + +!!! info + If you plan to play with the package sources, you will also need + [Robo](https://robo.li) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material). + +## Installing with Composer package manager + +### 1. Install it +From a command prompt, run: + +```shell +composer require sab-international/gitea +``` + +### 2. Import it +Now in your [PHP](https://secure.php.net) code, you can use: + +```php + 0, "MONDAY" => 1, "TUESDAY" => 2, "WEDNESDAY" => 3, "THURSDAY" => 4, "FRIDAY" => 5, "SATURDAY" => 6] + +DayOfWeek::getNames(); +// ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"] + +DayOfWeek::getValues(); +// [0, 1, 2, 3, 4, 5, 6] +``` diff --git a/lib/models/Repository.php b/lib/models/Repository.php index 6ca8d83..9210f2f 100644 --- a/lib/models/Repository.php +++ b/lib/models/Repository.php @@ -244,7 +244,7 @@ class Repository implements \JsonSerializable { */ function getName(): string { if (mb_strlen($this->name)) return $this->name; - return mb_strlen($fullName = $this->getFullName()) ? explode('/', $fullName, 2)[0] : ''; + return mb_strlen($fullName = $this->getFullName()) ? explode('/', $fullName)[1] : ''; } /** diff --git a/lib/models/ServerVersion.php b/lib/models/ServerVersion.php index 6760dd8..18b7c45 100644 --- a/lib/models/ServerVersion.php +++ b/lib/models/ServerVersion.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace Gitea\Models; /** - * Warps the version of the Gitea server. + * Wraps the version of the Gitea server. */ class ServerVersion implements \JsonSerializable { diff --git a/lib/models/StatusState.php b/lib/models/StatusState.php index bc77d48..e68f793 100644 --- a/lib/models/StatusState.php +++ b/lib/models/StatusState.php @@ -21,7 +21,7 @@ final class StatusState { const FAILURE = 'failure'; /** - * @var string The status is a pending. + * @var string The status is pending. */ const PENDING = 'pending'; diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..92609d2 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,43 @@ +site_name: SAB Rich Text Editor +site_description: A customized build of CKEditor, a rich text editor. +site_author: SAB International - contact@sabcomputer.com +site_url: https://dev.sabcomputer.com/gitea.php + +docs_dir: doc +site_dir: web + +repo_name: GitHub +repo_url: https://github.com/sab-international/gitea.php +edit_uri: edit/master/doc/ + +copyright: Copyright © 2018 SAB International +google_analytics: +- !!python/object/apply:os.getenv [GOOGLE_ANALYTICS_ID] +- auto + +extra: + social: + - {type: globe, link: 'http://www.sabcomputer.com'} + - {type: github, link: 'https://github.com/sab-international'} + - {type: facebook, link: 'https://www.facebook.com/sabinternational34'} + - {type: twitter, link: 'https://twitter.com/SABDistribution'} + - {type: linkedin, link: 'https://linkedin.com/company/sab-international-sarl'} + +markdown_extensions: +- admonition +- codehilite +- meta + +nav: +- Overview: index.md +- Installation: installation.md +- Usage: usage.md +- About: + - Changelog: about/changelog.md + - License: about/license.md + - See also: about/see_also.md + +theme: + name: material + favicon: img/favicon.ico + palette: {primary: deep purple, accent: deep purple}