-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
4,179 additions
and
2,716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
language: php | ||
php: | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
- 8.0snapshot | ||
- 8.0 | ||
|
||
before_install: | ||
- sudo apt-get -qq update | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning] (http://semver.org/). | ||
For change log format, use [Keep a Changelog] (http://keepachangelog.com/). | ||
|
||
All notable changes to this project will be documented in this file. This project adheres | ||
to [Semantic Versioning] (http://semver.org/). For change log format, | ||
use [Keep a Changelog] (http://keepachangelog.com/). | ||
|
||
## [2.0.0-alpha1] - 2021-03-22 | ||
|
||
### Added | ||
|
||
- `HtmlSelector` class to init and manage relations | ||
- `XpathSolver` class to solve a selector to xpath | ||
- Extensions to add pseudo classes | ||
|
||
### Changed | ||
|
||
- Refactoring | ||
|
||
## [1.0.0] - 2020-11-05 | ||
|
||
First version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="./tests/bootstrap.php" colors="true"> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="./tests/bootstrap.php" | ||
colors="true" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Berlioz HTML Selector test suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<?php | ||
/* | ||
* This file is part of Berlioz framework. | ||
* | ||
* @license https://opensource.org/licenses/MIT MIT License | ||
* @copyright 2021 Ronan GIRON | ||
* @author Ronan GIRON <https://github.com/ElGigi> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code, to the root. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Berlioz\HtmlSelector\CssSelector; | ||
|
||
/** | ||
* Class CssSelector. | ||
*/ | ||
class CssSelector | ||
{ | ||
protected ?NextCssSelector $next = null; | ||
|
||
public function __construct( | ||
protected string $selector, | ||
protected ?string $type = null, | ||
protected ?string $id = null, | ||
protected array $classes = [], | ||
protected array $attributes = [], | ||
protected array $pseudoClasses = [], | ||
) { | ||
} | ||
|
||
/** | ||
* __toString() PHP magic method. | ||
* | ||
* @return string | ||
*/ | ||
public function __toString(): string | ||
{ | ||
return $this->selector; | ||
} | ||
|
||
/** | ||
* Get type. | ||
* | ||
* @return string|null | ||
*/ | ||
public function getType(): ?string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* Get id. | ||
* | ||
* @return string|null | ||
*/ | ||
public function getId(): ?string | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* Get classes. | ||
* | ||
* @return array | ||
*/ | ||
public function getClasses(): array | ||
{ | ||
return $this->classes; | ||
} | ||
|
||
/** | ||
* Get attributes. | ||
* | ||
* @return array | ||
*/ | ||
public function getAttributes(): array | ||
{ | ||
return $this->attributes; | ||
} | ||
|
||
/** | ||
* Get pseudo classes. | ||
* | ||
* @return array | ||
*/ | ||
public function getPseudoClasses(): array | ||
{ | ||
return $this->pseudoClasses; | ||
} | ||
|
||
/** | ||
* Get next. | ||
* | ||
* @return NextCssSelector|null | ||
*/ | ||
public function getNext(): ?NextCssSelector | ||
{ | ||
return $this->next; | ||
} | ||
|
||
/** | ||
* Set next. | ||
* | ||
* @param NextCssSelector|null $next | ||
*/ | ||
public function setNext(?NextCssSelector $next): void | ||
{ | ||
$this->next = $next; | ||
} | ||
} |
Oops, something went wrong.