Skip to content

Commit c693dff

Browse files
committedApr 4, 2018
Initial commit
0 parents  commit c693dff

File tree

16 files changed

+546
-0
lines changed

16 files changed

+546
-0
lines changed
 

‎.gitattributes

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* text=auto
2+
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.php_cs export-ignore
6+
/.styleci.yml export-ignore
7+
/CODE_OF_CONDUCT.md export-ignore
8+
/CONTRIBUTING.md export-ignore

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.php_cs.cache
2+
composer.lock
3+
composer.phar

‎.php_cs

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->notPath('bootstrap/cache')
5+
->notPath('storage')
6+
->notPath('vendor')
7+
->in(__DIR__)
8+
->name('*.php')
9+
->ignoreDotFiles(true)
10+
->ignoreVCS(true);
11+
12+
$fixers = [
13+
'-psr0',
14+
'-php_closing_tag',
15+
'blankline_after_open_tag',
16+
'-concat_without_spaces',
17+
'double_arrow_multiline_whitespaces',
18+
'duplicate_semicolon',
19+
'empty_return',
20+
'extra_empty_lines',
21+
'include',
22+
'join_function',
23+
'list_commas',
24+
'multiline_array_trailing_comma',
25+
'namespace_no_leading_whitespace',
26+
'newline_after_open_tag',
27+
'no_blank_lines_after_class_opening',
28+
'no_empty_lines_after_phpdocs',
29+
'object_operator',
30+
'operators_spaces',
31+
'phpdoc_indent',
32+
'phpdoc_no_access',
33+
'-phpdoc_no_package',
34+
'phpdoc_scalar',
35+
'phpdoc_short_description',
36+
'phpdoc_to_comment',
37+
'phpdoc_trim',
38+
'phpdoc_type_to_var',
39+
'phpdoc_var_without_name',
40+
'remove_leading_slash_use',
41+
'remove_lines_between_uses',
42+
'return',
43+
'self_accessor',
44+
'single_array_no_trailing_comma',
45+
'single_blank_line_before_namespace',
46+
'single_quote',
47+
'spaces_before_semicolon',
48+
'spaces_cast',
49+
'standardize_not_equal',
50+
'ternary_spaces',
51+
'trim_array_spaces',
52+
'unalign_equals',
53+
'unary_operators_spaces',
54+
'whitespacy_lines',
55+
'multiline_spaces_before_semicolon',
56+
'short_array_syntax',
57+
'short_echo_tag',
58+
];
59+
60+
return Symfony\CS\Config\Config::create()
61+
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
62+
->fixers($fixers)
63+
->finder($finder)
64+
->setUsingCache(true);

‎.styleci.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
preset: laravel
2+
3+
disabled:
4+
- concat_without_spaces
5+
- phpdoc_no_package
6+
- logical_not_operators_with_successor_space
7+
- length_ordered_imports
8+
- simplified_null_return

‎CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to `contracts-weblog` will be documented in this file.
4+
5+
## 1.0.0 - 2018-04-05
6+
7+
- Initial release

‎CODE_OF_CONDUCT.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at open@cybercog.su. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

‎CONTRIBUTING.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contributing to Weblog Contracts
2+
3+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
4+
5+
## Workflow
6+
7+
- Fork the project.
8+
- Make your bug fix or feature addition.
9+
- Add tests for it. This is important so we don't break it in a future version unintentionally.
10+
- Send a pull request. Bonus points for topic branches.
11+
12+
Please make sure that you have [set up your user name and email address](http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git.
13+
14+
Pull requests for bug fixes must be based on the current stable branch.
15+
16+
We are trying to keep backwards compatibility breaks in Weblog Contracts to an absolute minimum. Please take this into account when proposing changes.
17+
18+
Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us if you feel that we forgot to respond.
19+
20+
## Coding Guidelines
21+
22+
This project comes with a configuration file for php-cs-fixer (.php_cs) that you can use to (re)format your sourcecode for compliance with this project's coding guidelines:
23+
24+
```sh
25+
$ vendor/bin/php-cs-fixer fix
26+
```
27+
28+
## Reporting issues
29+
30+
- [General problems](https://github.com/cybercog/contracts-weblog/issues)

‎LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018, Anton Komarev <a.komarev@cybercog.su>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Weblog Contracts
2+
3+
![cog-contracts-weblog](https://user-images.githubusercontent.com/1849174/38336794-bd7bd996-386b-11e8-861d-d837d126bd50.png)
4+
5+
<p align="center">
6+
<a href="https://github.com/cybercog/contracts-weblog/releases"><img src="https://img.shields.io/github/release/cybercog/contracts-weblog.svg?style=flat-square" alt="Releases"></a>
7+
<a href="https://styleci.io/repos/128128714"><img src="https://styleci.io/repos/128128714/shield" alt="StyleCI"></a>
8+
<a href="https://scrutinizer-ci.com/g/cybercog/contracts-weblog/?branch=master"><img src="https://img.shields.io/scrutinizer/g/cybercog/contracts-weblog.svg?style=flat-square" alt="Code Quality"></a>
9+
<a href="https://github.com/cybercog/contracts-weblog/blob/master/LICENSE"><img src="https://img.shields.io/github/license/cybercog/contracts-weblog.svg?style=flat-square" alt="License"></a>
10+
</p>
11+
12+
## Introduction
13+
14+
Weblog Contracts provides set of contracts for the Framework Interoperable Blog Package development.
15+
16+
## Contents
17+
18+
- [Features](#features)
19+
- [Installation](#installation)
20+
- [Usage](#usage)
21+
- [Changelog](#changelog)
22+
- [Contributing](#contributing)
23+
- [Security](#security)
24+
- [Contributors](#contributors)
25+
- [Alternatives](#alternatives)
26+
- [License](#license)
27+
- [About CyberCog](#about-cybercog)
28+
29+
## Features
30+
31+
- Strongly Typed.
32+
- Framework Agnostic.
33+
- Single-author Blogs.
34+
- Multi-author Blogs (MABs).
35+
- Following PHP Standard Recommendations:
36+
- [PSR-1 (Basic Coding Standard)](http://www.php-fig.org/psr/psr-1/).
37+
- [PSR-2 (Coding Style Guide)](http://www.php-fig.org/psr/psr-2/).
38+
- [PSR-4 (Autoloading Standard)](http://www.php-fig.org/psr/psr-4/).
39+
40+
## Installation
41+
42+
First, pull in the package through Composer.
43+
44+
```sh
45+
$ composer require cybercog/contracts-weblog
46+
```
47+
48+
## Usage
49+
50+
> TODO: Write usage instructions
51+
52+
## Changelog
53+
54+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
55+
56+
## Contributing
57+
58+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
59+
60+
## Security
61+
62+
If you discover any security related issues, please email open@cybercog.su instead of using the issue tracker.
63+
64+
## Contributors
65+
66+
| <a href="https://github.com/a-komarev">![@a-komarev](https://avatars.githubusercontent.com/u/1849174?s=110)<br />Anton Komarev</a> |
67+
| :---: |
68+
69+
[Weblog Contracts contributors list](../../contributors)
70+
71+
## Alternatives
72+
73+
*Feel free to add more alternatives as Pull Request.*
74+
75+
## License
76+
77+
- `Weblog Contracts` package is open-sourced software licensed under the [MIT license](LICENSE) by Anton Komarev.
78+
- `Internet Marketing` image licensed under [Creative Commons 3.0](https://creativecommons.org/licenses/by/3.0/us/) by Gan Khoon Lay.
79+
80+
## About CyberCog
81+
82+
[CyberCog](http://www.cybercog.ru) is a Social Unity of enthusiasts. Research best solutions in product & software development is our passion.
83+
84+
- [Follow us on Twitter](https://twitter.com/cybercog)
85+
- [Read our articles on Medium](https://medium.com/cybercog)
86+
87+
<a href="http://cybercog.ru"><img src="https://cloud.githubusercontent.com/assets/1849174/18418932/e9edb390-7860-11e6-8a43-aa3fad524664.png" alt="CyberCog"></a>

‎composer.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "cybercog/contracts-weblog",
3+
"description": "Сontracts for the framework interoperable Weblog development.",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": [
7+
"cybercog",
8+
"cog",
9+
"contract",
10+
"blog",
11+
"weblog",
12+
"journal",
13+
"post",
14+
"article",
15+
"story",
16+
"publication",
17+
"blogging",
18+
"blogger",
19+
"feed"
20+
],
21+
"authors": [
22+
{
23+
"name": "Anton Komarev",
24+
"email": "a.komarev@cybercog.su",
25+
"homepage": "https://ell.folio.su",
26+
"role": "Developer"
27+
}
28+
],
29+
"homepage": "https://github.com/cybercog/contracts-weblog",
30+
"support": {
31+
"email": "open@cybercog.su",
32+
"issues": "https://github.com/cybercog/contracts-weblog/issues",
33+
"wiki": "https://github.com/cybercog/contracts-weblog/wiki",
34+
"source": "https://github.com/cybercog/contracts-weblog",
35+
"docs": "https://github.com/cybercog/contracts-weblog/wiki"
36+
},
37+
"require": {
38+
"php": "^7.1.3"
39+
},
40+
"autoload": {
41+
"psr-4": {
42+
"Cog\\Contracts\\Weblog\\": "src/"
43+
}
44+
},
45+
"config": {
46+
"sort-packages": true
47+
},
48+
"minimum-stability": "dev",
49+
"prefer-stable" : true
50+
}

‎src/Author/Entities/Author.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Weblog Contracts.
5+
*
6+
* (c) Anton Komarev <a.komarev@cybercog.su>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Cog\Contracts\Weblog\Author\Entities;
15+
16+
interface Author
17+
{
18+
public function authorable(): Authorable;
19+
20+
public function posts(): iterable;
21+
22+
public function id(): string;
23+
}

‎src/Author/Entities/Authorable.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Weblog Contracts.
5+
*
6+
* (c) Anton Komarev <a.komarev@cybercog.su>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Cog\Contracts\Weblog\Author\Entities;
15+
16+
interface Authorable
17+
{
18+
public function blogAuthor(): Author;
19+
}

‎src/Blog/Entities/Blog.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Weblog Contracts.
5+
*
6+
* (c) Anton Komarev <a.komarev@cybercog.su>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Cog\Contracts\Weblog\Blog\Entities;
15+
16+
use Cog\Contracts\Weblog\Author\Entities\Author;
17+
use DateTimeInterface as DateTime;
18+
19+
interface Blog
20+
{
21+
public function posts(): iterable;
22+
23+
public function owner(): Author;
24+
25+
public function editors(): iterable;
26+
27+
public function writers(): iterable;
28+
29+
public function id(): string;
30+
31+
public function slug(): string;
32+
33+
public function name(): string;
34+
35+
public function description(): ?string;
36+
37+
public function createdAt(): DateTime;
38+
39+
public function updatedAt(): ?DateTime;
40+
}

‎src/Category/Entities/Category.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Weblog Contracts.
5+
*
6+
* (c) Anton Komarev <a.komarev@cybercog.su>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Cog\Contracts\Weblog\Category\Entities;
15+
16+
use DateTimeInterface as DateTime;
17+
18+
interface Category
19+
{
20+
public function posts(): iterable;
21+
22+
public function id(): string;
23+
24+
public function slug(): string;
25+
26+
public function name(): string;
27+
28+
public function createdAt(): DateTime;
29+
30+
public function updatedAt(): ?DateTime;
31+
}

‎src/Comment/Entities/Comment.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Weblog Contracts.
5+
*
6+
* (c) Anton Komarev <a.komarev@cybercog.su>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Cog\Contracts\Weblog\Comment\Entities;
15+
16+
use Cog\Contracts\Weblog\Author\Entities\Author;
17+
use Cog\Contracts\Weblog\Post\Entities\Post;
18+
use DateTimeInterface as DateTime;
19+
20+
interface Comment
21+
{
22+
public function post(): Post;
23+
24+
public function author(): Author;
25+
26+
public function id(): string;
27+
28+
public function content(): string;
29+
30+
public function createdAt(): DateTime;
31+
32+
public function updatedAt(): ?DateTime;
33+
}

‎src/Post/Entities/Post.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Weblog Contracts.
5+
*
6+
* (c) Anton Komarev <a.komarev@cybercog.su>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Cog\Contracts\Weblog\Post\Entities;
15+
16+
use Cog\Contracts\Weblog\Author\Entities\Author;
17+
use Cog\Contracts\Weblog\Blog\Entities\Blog;
18+
use Cog\Contracts\Weblog\Category\Entities\Category;
19+
use DateTimeInterface as DateTime;
20+
21+
interface Post
22+
{
23+
public function blog(): Blog;
24+
25+
public function category(): ?Category;
26+
27+
public function author(): Author;
28+
29+
public function comments(): iterable;
30+
31+
public function id(): string;
32+
33+
public function slug(): string;
34+
35+
public function title(): string;
36+
37+
public function subtitle(): ?string;
38+
39+
public function excerpt(): ?string;
40+
41+
public function content(): ?string;
42+
43+
public function createdAt(): DateTime;
44+
45+
public function updatedAt(): ?DateTime;
46+
47+
public function publishedAt(): ?DateTime;
48+
}

0 commit comments

Comments
 (0)
Please sign in to comment.