Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

update to github template + dependencies #84

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0a6c9e6
update to github template + dependencies
joshbruce Oct 8, 2021
31029f3
Update composer.json
joshbruce Oct 8, 2021
d97427c
Update composer.lock
joshbruce Oct 8, 2021
819d057
anchor, image, page-title, simple-list passing stan checks
joshbruce Oct 8, 2021
6e918ba
Delete WebView.php
joshbruce Oct 8, 2021
7215d5f
Delete WebHead.php
joshbruce Oct 8, 2021
b6fc301
Delete SocialMeta.php
joshbruce Oct 8, 2021
57fb9c1
Delete Pagination.php
joshbruce Oct 8, 2021
f45e765
Delete Accordion.php
joshbruce Oct 8, 2021
21e9a9d
Delete DoubleWrap.php
joshbruce Oct 8, 2021
8912d67
Markdown passing stan
joshbruce Oct 8, 2021
26f0959
move feed to separate project
joshbruce Oct 8, 2021
be9a60f
remove html due to being separate project
joshbruce Oct 8, 2021
95bab00
Delete facades and proxies
joshbruce Oct 8, 2021
ffca936
update folder structure
joshbruce Oct 8, 2021
d925279
flatten hierarchy
joshbruce Oct 8, 2021
cf1ed57
flatten hierarchy - page title tests
joshbruce Oct 9, 2021
ad991c2
anchor tests + stan fixed
joshbruce Oct 9, 2021
f4ea54b
image, anchor pass tests + stan - beginning simple list
joshbruce Oct 9, 2021
3f65eef
apply buildable from XML Builder + update dependencies
joshbruce Oct 9, 2021
1c3a287
Merge branch 'main' into r1.0.0
joshbruce Jan 30, 2022
14bddcb
deprecated: Markdown class, use 8fold/commonmark-fluent-markdown
joshbruce Jan 30, 2022
6b57be8
deprecated: Description list
joshbruce Jan 30, 2022
20775c1
prepared for release
joshbruce Jan 30, 2022
307c8ab
update: Tests to use PHP 8.1
joshbruce Jan 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[*{.js,.json,.scss}]
[*.{ym,yaml,js,json,scss}]
indent_style = space
indent_size = 2
17 changes: 12 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Contributing

Contributions are **welcome** and will be **credited**. We accept contributions via Pull Requests on [GitHub](https://github.com/8fold/php-markup).
Contributions are **welcome** and will be **credited**. We accept contributions via Pull Requests on [GitHub](https://github.com/8fold/php-shoop).

## Goals
## Priorities

- Readability over speed over cleverness.
- Fail gracefully not by blowing things up.
We leverage GitHub's labeling system to inform prioritization of issues. The higher the number, the higher priority.

### Overall
Security is always the highest priority within the applicable scope of the product. Therefore, some packages are low-level and intended for developers and give the flexibility to them to surround the package with a security layer.

## Overall goals (philosophy and values)

There are a lot of philosphical things tied in to the way we strive to do software development. Some you are most likely familiar with, others maybe not so much.

Expand All @@ -27,6 +28,8 @@ There are a lot of philosphical things tied in to the way we strive to do softwa

**Solutions over scapegoats:** There are times when these principles will not be followed or someone will make a mistake. Berating the offender doesn't get any of us any closer to improving the execution of these principles.

**The Community Principle:** If you create or acquire it you help maintain it; time, food, money, and so on.

## Code promotion

Capabilities should be implemented at a low, concrete level before being promoted to higher-levels and made more abstract.
Expand All @@ -38,3 +41,7 @@ If the language being used allows access levels on variable, constants, methods,
This reduces the size of the public API, which makes the class easier to consume by developers.

Further, it is preferred that class properties remain private, always. This means pre- and post-processing for setting and getting properties can be added without being a breaking change to developers.

## Releasing

Major - fix bugs -> Patch - optimize -> Minor - fix bugs -> Patch - new feature -> Minor - interface changes -> Major
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/Deprecation_notice_or_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Deprecation Notice or Request
about: Notify or request a feature be deprecated
---

**What feature should be deprecated?**

**Why should the feature be deprecated?**

**What alternative means delivers similar or same results?**
6 changes: 1 addition & 5 deletions .github/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Josh Bruce
Copyright (c) 2021 8fold

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,7 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## Notice

This software makes use of software developed by others. Those software applications are not subject to this license, nor is this software subject to those licenses. See the individual modules for further details.
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/deprecation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Deprecation Notice or Request
about: Notify or request a feature be deprecated
---

**What feature should be deprecated?**

**Why should the feature be deprecated?**

**What alternative means delivers similar or same results?**

## List of issues fixed

[Please use GitHub notation to automatically close the issues: Fixes #{issue number}]
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE/issue.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Security Policy

The only completely secure system is the one that doesn't exist in the first place. Having said that, we take the security of Marked very seriously.
The only completely secure system is the one that doesn't exist in the first place. Having said that, we take security seriously.

## Reporting a Vulnerability

Expand Down
30 changes: 30 additions & 0 deletions .github/coding-standards-and-styles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Coding Standards and Styles

Coding standards help multiple developers work in the same codebase and not have to answer certain questions because they are already answered by the standards. Further, whenever possible, if the language being discussed has community accepted standards or a governing body, those standards should be used. Finally, minimal exceptions can be made with just cause so long as those changes minimize cognitive load across the majority of developers working in the various codebases.

For example, the [w3c](https://www.w3.org/) is the generally accepted governing body for HTML and CSS; therefore, when it comes to answering questions or disputes related to HTML or CSS, that's where one should go. ECMAScript is the generally accepted standard for JavaScript. And, the PHP Framework Interop Group \([PHP-Fig](https://www.php-fig.org)\) is the same for PHP.

Therefore, if I, as a developer, go from the 8fold Component, to Laravel, to AMOS, there are certain conventions I should be able to reasonably expect.

## PHP

Standards come in the form of PHP Standards Recommendations \([PSRs](https://www.php-fig.org/psr/)\) proposals are made, debated, modified, and potentially accepted. As the PHP-FIG discusses proposals that could impact all PHP developers, the PSRs are generally not accepted lightly.

If no commentary is added for a specific PSR or section of a PSR, it is safe to assume following the full specification is desired. Modifications and extensions will be indicated by _italics_.

* [**PSR-1**](https://www.php-fig.org/psr/psr-1/)**:**
* PSR-1 is the base recommendation and is required by both of the following recommendations.
* [**PSR-2**](https://www.php-fig.org/psr/psr-2/)**:**
* As visibility is required and the following are not, `abstract`, `final`, _and_ `static` must precede visibility. If `static` is present, it must come directly before the visibility. _These modifications front-load the answering of the following questions in turn: Do I need to implement it? Can I override it? Is it a class function or instance method? From where can I see it, if at all?
* Opening braces for control structures MUST go on the same line, and closing braces MUST go on the next line after the body. _The body of a control structure SHOULD be followed by a blank line to distinguish between discreet thoughts. The body MAY be preceded by a blank line to reduce visual complexity and minimize blurring the lines._
* [**PSR-12**](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md)**:** This PSR is under review. With that said, it is the primary recommendation followed. Specifically-multi line control structures.
* 2.5: _Unless a library we use needs something else. At which point we should notify the library authors._
* 4.4: _See modifications from PSR-2._
* 4.5: _Any method returning a value MUST declare a return type. Methods SHOULD NOT return null (void is exception), favoring an empty value of the correct type. Wildcard arguments that can be of_ any _type SHOULD be avoided, and arguments SHOULD have a type specified._
* 5.1: _See modifications from PSR-2 regarding ordering._
* 5.2: _See modifications from PSR-2 regarding control structures._
* 5.6: _See modifications from PSR-2 regarding control structures._
* 6: _Ternary operators SHOULD NOT be used unless simple in form and MUST NOT be more than one unless as an artifact of a library being used. Unary operators SHOULD be avoided to clearly express the intent and reduce possible ordering problems \(ex. x-- may not be the same as --x; whereas x-y and y-x is clearly understood\)._
* **Other**
* Variables SHOULD NOT be nullable. Instead of null, use an empty variation of the same type. This reduces boilerplate null-checking code.

31 changes: 0 additions & 31 deletions .github/workflows/php.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/php8.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/php81.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PHP 8.0

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/setup-php@2.15.0
with:
php-version: '8.1'

- name: Validate composer.json and composer.lock
run: composer validate

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

- name: Run style check
run: composer run style

- name: Run static analyzer
run: composer run stan

- name: Run tests
run: composer run test
12 changes: 3 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "8fold/php-markup",
"description": "8fold Markup seeks to make writing semi-structured data easier while allowing for more dynamism.",
"description": "8fold Markup makes writing semi-structured data easier while allowing for more dynamism.",
"type": "library",
"license": "MIT",
"authors": [
Expand All @@ -25,8 +25,7 @@
},
"autoload-dev": {
"psr-4": {
"Eightfold\\Markup\\Tests\\": "./tests/",
"Eightfold\\Foldable\\Tests\\": "./vendor/8fold/php-foldable/tests/"
"Eightfold\\Markup\\Tests\\": "./tests/"
}
},
"config": {
Expand All @@ -41,13 +40,8 @@
"@stan",
"@test"
],
"deploy": [
"@production",
"@optimize-autoload"
],
"style": "./vendor/bin/phpcs --standard=phpcs.xml",
"stan": "./vendor/bin/phpstan analyze",
"test": "./vendor/bin/phpunit",
"optimize-autoload": "composer dumpautoload --no-dev --classmap-authoritative"
"test": "./vendor/bin/phpunit"
}
}
5 changes: 1 addition & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<ruleset name="8fold PSR12">
<description>PHP-FIG PSR-12 standards with modifications to: control structure (empty space before closing brace).</description>

<file>src</file>

<arg name="colors" />
Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ parameters:
- src
ignoreErrors:
- '#Call to an undefined static method Eightfold\\HTMLBuilder\\Element::(.*)#'
- '#Call to an undefined static method Eightfold\\XMLBuilder\\Element::(.*)#'
- '#Call to an undefined static method Eightfold\\XMLBuilder\\Document::(.*)#'
35 changes: 17 additions & 18 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="base">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>

<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="base">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>
</phpunit>
50 changes: 50 additions & 0 deletions src/Anchor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Eightfold\Markup;

use Eightfold\XMLBuilder\Contracts\Buildable;

use Eightfold\HTMLBuilder\Element as HtmlElement;

class Anchor implements Buildable
{
private string $content = '';

private string $href = '';

/**
* @var array<string>
*/
private array $properties = [];

public static function create(string $content, string $href): Anchor
{
return new Anchor($content, $href);
}

public function __construct(string $content, string $href)
{
$this->content = $content;

$this->href = $href;
}

public function props(string ...$properties): Anchor
{
$this->properties = $properties;

return $this;
}

public function build(): string
{
return HtmlElement::a($this->content)
->props('href ' . $this->href, ...$this->properties)
->build();
}

public function __toString(): string
{
return $this->build();
}
}
Loading