Skip to content

Commit

Permalink
Merge pull request #8 from ARCANEDEV/develop
Browse files Browse the repository at this point in the history
Starting Laravel v8 support
  • Loading branch information
arcanedev-maroc authored Sep 9, 2020
2 parents b0f27a2 + ee4efc6 commit 9d86f73
Show file tree
Hide file tree
Showing 113 changed files with 829 additions and 425 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
php: [7.3, 7.4]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-7.x-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
key: dependencies-laravel-8-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 6
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
20 changes: 16 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"type": "library",
"license": "MIT",
"require": {
"php": "^7.2.5",
"illuminate/support": "^7.0"
"php": "^7.3",
"illuminate/support": "^8.0"
},
"require-dev": {
"ext-dom": "*",
"phpunit/phpunit": "^8.5|^9.0"
"ext-dom": "*",
"phpunit/phpunit": "^9.3"
},
"autoload": {
"psr-4": {
Expand All @@ -31,6 +31,18 @@
"Arcanedev\\Html\\Tests\\": "tests/"
}
},
"scripts": {
"test": "phpunit",
"coverage": "phpunit --coverage-html build/coverage/html"
},
"extra": {
"branch-alias": {
"dev-develop": "5.x-dev"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
33 changes: 14 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-text" target="build/logs/coverage.txt"/>
<log type="coverage-html" target="build/logs/coverage"/>
</logging>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<clover outputFile="build/coverage/clover.xml"/>
<html outputDirectory="build/coverage/html"/>
<text outputFile="build/coverage/coverage.txt" showOnlySummary="true"/>
</report>
</coverage>
</phpunit>
5 changes: 2 additions & 3 deletions src/Contracts/Elements/HtmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
use Arcanedev\Html\Contracts\Renderable;

/**
* Interface HtmlElement
* Interface HtmlElement
*
* @package Arcanedev\Html\Contracts
* @author ARCANEDEV <[email protected]>
* @author ARCANEDEV <[email protected]>
*/
interface HtmlElement extends Renderable
{
Expand Down
5 changes: 2 additions & 3 deletions src/Contracts/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
namespace Arcanedev\Html\Contracts;

/**
* Interface Html
* Interface Html
*
* @package Arcanedev\Html\Contracts
* @author ARCANEDEV <[email protected]>
* @author ARCANEDEV <[email protected]>
*/
interface Html
{
Expand Down
5 changes: 2 additions & 3 deletions src/Contracts/Renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
use Illuminate\Contracts\Support\Htmlable;

/**
* Interface Renderable
* Interface Renderable
*
* @package Arcanedev\Html\Contracts
* @author ARCANEDEV <[email protected]>
* @author ARCANEDEV <[email protected]>
*/
interface Renderable extends Htmlable
{
Expand Down
17 changes: 10 additions & 7 deletions src/Contracts/Selectable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
namespace Arcanedev\Html\Contracts;

/**
* Interface Selectable
* Interface Selectable
*
* @package Arcanedev\Html\Contracts
* @author ARCANEDEV <[email protected]>
* @author ARCANEDEV <[email protected]>
*/
interface Selectable
{
Expand All @@ -18,19 +17,23 @@ interface Selectable
*/

/**
* @return static
* Add the selected attribute.
*
* @param bool $selected
*
* @return $this
*/
public function selected();
public function selected(bool $selected = true);

/**
* @param bool $condition
*
* @return static
* @return $this
*/
public function selectedIf($condition);

/**
* @return static
* @return $this
*/
public function unselected();
}
1 change: 0 additions & 1 deletion src/Elements/A.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/**
* Class A
*
* @package Arcanedev\Html\Elements
* @author ARCANEDEV <[email protected]>
*/
class A extends HtmlElement
Expand Down
36 changes: 11 additions & 25 deletions src/Elements/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@

namespace Arcanedev\Html\Elements;

use Arcanedev\Html\Elements\Concerns\{HasNameAttribute, HasTypeAttribute, HasValueAttribute};

/**
* Class Button
*
* @package Arcanedev\Html\Elements
* @author ARCANEDEV <[email protected]>
*/
class Button extends HtmlElement
{
/* -----------------------------------------------------------------
| Traits
| -----------------------------------------------------------------
*/

use HasNameAttribute,
HasTypeAttribute,
HasValueAttribute;

/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
Expand All @@ -25,18 +35,6 @@ class Button extends HtmlElement
| -----------------------------------------------------------------
*/

/**
* Set the type attribute.
*
* @param string $type
*
* @return static
*/
public function type($type)
{
return $this->attributeIf(in_array($type, ['button', 'submit', 'reset']), 'type', $type);
}

/**
* Set as submit button.
*
Expand All @@ -56,16 +54,4 @@ public function reset()
{
return $this->type('reset');
}

/**
* Set the value attribute.
*
* @param string $value
*
* @return static
*/
public function value($value)
{
return $this->attribute('value', $value);
}
}
1 change: 0 additions & 1 deletion src/Elements/Concerns/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
/**
* Trait HasAttributes
*
* @package Arcanedev\Html\Elements\Concerns
* @author ARCANEDEV <[email protected]>
*/
trait HasAttributes
Expand Down
35 changes: 35 additions & 0 deletions src/Elements/Concerns/HasAutofocusAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Arcanedev\Html\Elements\Concerns;

/**
* Trait HasAutofocusAttribute
*
* @author ARCANEDEV <[email protected]>
*
* @mixin \Arcanedev\Html\Elements\Concerns\HasAttributes
*/
trait HasAutofocusAttribute
{
/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/

/**
* Add the autofocus attribute.
*
* @param bool $autofocus
*
* @return $this
*/
public function autofocus($autofocus = true)
{
return $autofocus
? $this->attribute('autofocus')
: $this->forgetAttribute('autofocus');
}

}
1 change: 0 additions & 1 deletion src/Elements/Concerns/HasChildElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Trait HasChildElements
*
* @package Arcanedev\Html\Elements\Concerns
* @author ARCANEDEV <[email protected]>
*/
trait HasChildElements
Expand Down
2 changes: 0 additions & 2 deletions src/Elements/Concerns/HasConditionalMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* Trait HasConditionalMethods
*
* @package Arcanedev\Html\Elements\Concerns
* @author ARCANEDEV <[email protected]>
*/
trait HasConditionalMethods
Expand Down Expand Up @@ -107,7 +106,6 @@ protected function callConditionalMethod(string $conditions, string $method, arr

case 'IfNotNull':
return $this->ifNotNull($value, $callback);

default:
return $this;
}
Expand Down
34 changes: 34 additions & 0 deletions src/Elements/Concerns/HasDisabledAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace Arcanedev\Html\Elements\Concerns;

/**
* Trait HasDisabledAttribute
*
* @author ARCANEDEV <[email protected]>
*
* @mixin \Arcanedev\Html\Elements\Concerns\HasAttributes
*/
trait HasDisabledAttribute
{
/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/

/**
* Add the disabled attribute.
*
* @param bool $disabled
*
* @return $this
*/
public function disabled($disabled = true)
{
return $disabled
? $this->attribute('disabled', 'disabled')
: $this->forgetAttribute('disabled');
}
}
Loading

0 comments on commit 9d86f73

Please sign in to comment.