metadata, sectioning, and header content tags

This commit is contained in:
Joby 2022-12-01 17:25:35 -07:00
parent abaccd2fc7
commit 0cecf9cc72
23 changed files with 342 additions and 4 deletions

View file

@ -0,0 +1,7 @@
<?php
namespace ByJoby\HTML\ContentCategories;
interface FlowContent
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace ByJoby\HTML\ContentCategories;
interface HeadingContent extends FlowContent
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace ByJoby\HTML\ContentCategories;
interface MetadataContent
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace ByJoby\HTML\ContentCategories;
interface PhrasingContent extends FlowContent
{
}

View file

@ -0,0 +1,7 @@
<?php
namespace ByJoby\HTML\ContentCategories;
interface SectioningContent extends FlowContent
{
}

View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\AbstractTags;
use ByJoby\HTML\ContentCategories\HeadingContent;
use ByJoby\HTML\Tags\AbstractContainerTag;
abstract class AbstractHeaderTag extends AbstractContainerTag implements HeadingContent
{
}

View file

@ -0,0 +1,12 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\SectioningContent;
use ByJoby\HTML\DisplayTypes\DisplayBlock;
use ByJoby\HTML\Tags\AbstractContainerTag;
class ArticleTag extends AbstractContainerTag implements DisplayBlock, SectioningContent
{
const TAG = 'article';
}

View file

@ -0,0 +1,12 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\SectioningContent;
use ByJoby\HTML\DisplayTypes\DisplayBlock;
use ByJoby\HTML\Tags\AbstractContainerTag;
class AsideTag extends AbstractContainerTag implements DisplayBlock, SectioningContent
{
const TAG = 'aside';
}

View file

@ -2,9 +2,10 @@
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\MetadataContent;
use ByJoby\HTML\Tags\AbstractTag;
class BaseTag extends AbstractTag
class BaseTag extends AbstractTag implements MetadataContent
{
const TAG = 'base';

10
src/Html5/Tags/H1Tag.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\Html5\AbstractTags\AbstractHeaderTag;
class H1Tag extends AbstractHeaderTag
{
const TAG = 'h1';
}

10
src/Html5/Tags/H2Tag.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\Html5\AbstractTags\AbstractHeaderTag;
class H2Tag extends AbstractHeaderTag
{
const TAG = 'h1';
}

10
src/Html5/Tags/H3Tag.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\Html5\AbstractTags\AbstractHeaderTag;
class H3Tag extends AbstractHeaderTag
{
const TAG = 'h3';
}

10
src/Html5/Tags/H4Tag.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\Html5\AbstractTags\AbstractHeaderTag;
class H4Tag extends AbstractHeaderTag
{
const TAG = 'h4';
}

10
src/Html5/Tags/H5Tag.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\Html5\AbstractTags\AbstractHeaderTag;
class H5Tag extends AbstractHeaderTag
{
const TAG = 'h5';
}

10
src/Html5/Tags/H6Tag.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\Html5\AbstractTags\AbstractHeaderTag;
class H6Tag extends AbstractHeaderTag
{
const TAG = 'h6';
}

View file

@ -0,0 +1,12 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\HeadingContent;
use ByJoby\HTML\DisplayTypes\DisplayBlock;
use ByJoby\HTML\Tags\AbstractContainerTag;
class HgroupTag extends AbstractContainerTag implements DisplayBlock, HeadingContent
{
const TAG = 'hgroup';
}

View file

@ -2,9 +2,10 @@
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\MetadataContent;
use ByJoby\HTML\Tags\AbstractTag;
class LinkTag extends AbstractTag
class LinkTag extends AbstractTag implements MetadataContent
{
const TAG = 'link';

View file

@ -2,9 +2,10 @@
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\MetadataContent;
use ByJoby\HTML\Tags\AbstractTag;
class MetaTag extends AbstractTag
class MetaTag extends AbstractTag implements MetadataContent
{
const TAG = 'meta';

12
src/Html5/Tags/NavTag.php Normal file
View file

@ -0,0 +1,12 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\SectioningContent;
use ByJoby\HTML\DisplayTypes\DisplayBlock;
use ByJoby\HTML\Tags\AbstractContainerTag;
class NavTag extends AbstractContainerTag implements DisplayBlock, SectioningContent
{
const TAG = 'nav';
}

View file

@ -0,0 +1,13 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\MetadataContent;
use ByJoby\HTML\ContentCategories\PhrasingContent;
use ByJoby\HTML\DisplayTypes\DisplayContents;
use ByJoby\HTML\Tags\AbstractContentTag;
class NoscriptTag extends AbstractContentTag implements MetadataContent, PhrasingContent, DisplayContents
{
const TAG = 'noscript';
}

View file

@ -0,0 +1,156 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\MetadataContent;
use ByJoby\HTML\ContentCategories\PhrasingContent;
use ByJoby\HTML\DisplayTypes\DisplayNone;
use ByJoby\HTML\Tags\AbstractContentTag;
class ScriptTag extends AbstractContentTag implements MetadataContent, PhrasingContent, DisplayNone
{
const TAG = 'noscript';
public function setAsync(bool $async): static
{
if ($async) $this->attributes()['async'] = null;
else unset($this->attributes()['async']);
return $this;
}
public function async(): bool
{
return isset($this->attributes()['async']);
}
public function setDefer(bool $defer): static
{
if ($defer) $this->attributes()['defer'] = null;
else unset($this->attributes()['defer']);
return $this;
}
public function defer(): bool
{
return isset($this->attributes()['defer']);
}
public function crossorigin(): null|string
{
return $this->attributes()['crossorigin'];
}
public function setCrossorigin(null|string $crossorigin): static
{
$this->attributes()['crossorigin'] = $crossorigin;
return $this;
}
public function unsetCrossorigin(): static
{
unset($this->attributes()['crossorigin']);
return $this;
}
public function integrity(): null|string
{
return $this->attributes()['integrity'];
}
public function setIntegrity(null|string $integrity): static
{
$this->attributes()['integrity'] = $integrity;
return $this;
}
public function unsetIntegrity(): static
{
unset($this->attributes()['integrity']);
return $this;
}
public function nomodule(): null|string
{
return $this->attributes()['nomodule'];
}
public function setNomodule(null|string $nomodule): static
{
$this->attributes()['nomodule'] = $nomodule;
return $this;
}
public function unsetNomodule(): static
{
unset($this->attributes()['nomodule']);
return $this;
}
public function nonce(): null|string
{
return $this->attributes()['nonce'];
}
public function setNonce(null|string $nonce): static
{
$this->attributes()['nonce'] = $nonce;
return $this;
}
public function unsetNonce(): static
{
unset($this->attributes()['nonce']);
return $this;
}
public function referrerpolicy(): null|string
{
return $this->attributes()['referrerpolicy'];
}
public function setReferrerpolicy(null|string $referrerpolicy): static
{
$this->attributes()['referrerpolicy'] = $referrerpolicy;
return $this;
}
public function unsetReferrerpolicy(): static
{
unset($this->attributes()['referrerpolicy']);
return $this;
}
public function src(): null|string
{
return $this->attributes()['src'];
}
public function setSrc(null|string $src): static
{
$this->attributes()['src'] = $src;
return $this;
}
public function unsetSrc(): static
{
unset($this->attributes()['src']);
return $this;
}
public function type(): null|string
{
return $this->attributes()['type'];
}
public function setType(null|string $type): static
{
$this->attributes()['type'] = $type;
return $this;
}
public function unsetType(): static
{
unset($this->attributes()['type']);
return $this;
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\SectioningContent;
use ByJoby\HTML\DisplayTypes\DisplayBlock;
use ByJoby\HTML\Tags\AbstractContainerTag;
class SectionTag extends AbstractContainerTag implements DisplayBlock, SectioningContent
{
const TAG = 'section';
}

View file

@ -2,9 +2,10 @@
namespace ByJoby\HTML\Html5\Tags;
use ByJoby\HTML\ContentCategories\MetadataContent;
use ByJoby\HTML\Tags\AbstractContentTag;
class StyleTag extends AbstractContentTag
class StyleTag extends AbstractContentTag implements MetadataContent
{
const TAG = 'style';