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

Commit

Permalink
dom.children() and ApiGen docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyBogdanov committed Jan 5, 2018
1 parent 9de012a commit 9b0d760
Show file tree
Hide file tree
Showing 39 changed files with 9,126 additions and 834 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# SDom

[![Latest Stable Version](https://poser.pugx.org/tonybogdanov/sdom/v/stable)](https://packagist.org/packages/tonybogdanov/sdom)
[![Latest Stable Version](https://poser.pugx.org/tonybogdanov/sdom/v/stable?format=flat)](https://packagist.org/packages/tonybogdanov/sdom)
[![Latest Unstable Version](https://poser.pugx.org/tonybogdanov/sdom/v/unstable?format=flat)](https://packagist.org/packages/tonybogdanov/sdom)
[![Build Status](https://travis-ci.org/TonyBogdanov/sdom.svg?branch=master)](https://travis-ci.org/TonyBogdanov/sdom)
[![Coverage Status](https://coveralls.io/repos/github/TonyBogdanov/sdom/badge.svg?branch=master)](https://coveralls.io/github/TonyBogdanov/sdom?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/TonyBogdanov/sdom/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/TonyBogdanov/sdom/?branch=master)
[![License](https://poser.pugx.org/tonybogdanov/sdom/license)](https://packagist.org/packages/tonybogdanov/sdom)
[![License](https://poser.pugx.org/tonybogdanov/sdom/license?format=flat)](https://packagist.org/packages/tonybogdanov/sdom)
[![Buy Me a Coffee](http://static.tonybogdanov.com/github/coffee.svg)](http://ko-fi.co/1236KUKJNC96B)

Simple jQuery-like DOM representation in PHP.
Expand All @@ -15,4 +16,7 @@ Simple jQuery-like DOM representation in PHP.

## Usage

See `classes/Dom.php`.
See `classes/Dom.php`.

## API Docs

6 changes: 6 additions & 0 deletions apigen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
visibilityLevels: [public, protected]
annotationGroups: [todo, deprecated]
title: "SDom Docs"
baseUrl: "https://tonybogdanov.github.io/sdom"
overwrite: true
6 changes: 6 additions & 0 deletions bin/generate-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

dir=$(dirname "$0")
bin="$dir/../vendor/bin/apigen"

$bin generate "$dir/../classes" --destination "$dir/../docs"
22 changes: 22 additions & 0 deletions classes/Dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,26 @@ public function last(): Dom
{
return $this->eq(count($this) - 1);
}

/**
* Get a new Dom collection with the immediate child nodes of each of the Element nodes in the collection.
*
* @return Dom
*/
public function children(): Dom
{
$dom = new Dom();

/** @var NodeInterface $node */
foreach ($this->get() as $node) {
if ($node instanceof Element) {
/** @var NodeInterface $child */
foreach ($node as $child) {
$dom->add($child);
}
}
}

return $dom;
}
}
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
"description": "Simple jQuery-like DOM representation in PHP",
"type": "library",
"require": {
"kevintweber/html-tokenizer": "^0.4.0",
"symfony/css-selector": "^4.0"
"kevintweber/html-tokenizer": "0.4"
},
"require-dev": {
"phpunit/phpunit": "6.5.5",
"php-coveralls/php-coveralls": "2.0.0",
"apigen/apigen": "dev-master",
"roave/better-reflection": "dev-master#c87d856"
},
"minimum-stability": "dev",
"license": "MIT",
"authors": [
{
Expand All @@ -17,9 +23,5 @@
"psr-4": {
"SDom\\": "classes/"
}
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"php-coveralls/php-coveralls": "^2.0"
}
}
Loading

0 comments on commit 9b0d760

Please sign in to comment.