Enclosure::__construct( ?string $link = null, ?string $type = null, ?int $length = null, null $javascript = null, ?string $bitrate = null, SimplePie\Caption[]|null $captions = null, SimplePie\Category[]|null $categories = null, ?int $channels = null, ?\SimplePie\Copyright $copyright = null, SimplePie\Credit[]|null $credits = null, ?string $description = null, ?int $duration = null, ?string $expression = null, ?string $framerate = null, string[]|null $hashes = null, ?string $height = null, string[]|null $keywords = null, ?string $lang = null, ?string $medium = null, ?string $player = null, SimplePie\Rating[]|null $ratings = null, SimplePie\Restriction[]|null $restrictions = null, ?string $samplingrate = null, string[]|null $thumbnails = null, ?string $title = null, ?string $width = null )
- Source
wp-includes/SimplePie/src/Enclosure.php:199
Description
For documentation on all the parameters, see the corresponding properties and their accessors
Compatibility
- WordPress
- core
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$link?stringoptional- Default:
null $type?stringoptional- Default:
null $length?intoptional- Default:
null $javascriptnulloptional- Default:
null $bitrate?stringoptional- Default:
null $captionsSimplePie\Caption[]|nulloptional- Default:
null $categoriesSimplePie\Category[]|nulloptional- Default:
null $channels?intoptional- Default:
null $copyright?\SimplePie\Copyrightoptional- Default:
null $creditsSimplePie\Credit[]|nulloptional- Default:
null $description?stringoptional- Default:
null $duration?intoptional- Default:
null $expression?stringoptional- Default:
null $framerate?stringoptional- Default:
null $hashesstring[]|nulloptional- Default:
null $height?stringoptional- Default:
null $keywordsstring[]|nulloptional- Default:
null $lang?stringoptional- Default:
null $medium?stringoptional- Default:
null $player?stringoptional- Default:
null $ratingsSimplePie\Rating[]|nulloptional- Default:
null $restrictionsSimplePie\Restriction[]|nulloptional- Default:
null $samplingrate?stringoptional- Default:
null $thumbnailsstring[]|nulloptional- Default:
null $title?stringoptional- Default:
null $width?stringoptional- Default:
null
Performance profile
How much work a call to Enclosure::__construct() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 85–126
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 126.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 4 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost Enclosure::__construct() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!function_exists() | 85 | function_exists(), ->get_handler() |
function_exists() | 93–94 | function_exists(), ::SimplePie\\Misc(), ->get_handler() |
function_exists() && ctype_print() | 98–99 | function_exists(), ::SimplePie\\Misc(), ctype_print(), ->get_handler() |
function_exists() && !ctype_print() | 125–126 | function_exists(), ::SimplePie\\Misc(), ctype_print(), idn_to_ascii(), ::SimplePie\\Misc(), ->get_handler() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 126 instructions, 85–126 executed per call, 4 branches. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 3
- \SimplePie\Misc::parse_url()
- \SimplePie\Misc::compress_parse_url()
- \SimplePie\Enclosure::get_handler()
Source code
public function __construct( ?string $link = null, ?string $type = null, ?int $length = null, $javascript = null, ?string $bitrate = null, ?array $captions = null, ?array $categories = null, ?int $channels = null, ?Copyright $copyright = null, ?array $credits = null, ?string $description = null, ?int $duration = null, ?string $expression = null, ?string $framerate = null, ?array $hashes = null, ?string $height = null, ?array $keywords = null, ?string $lang = null, ?string $medium = null, ?string $player = null, ?array $ratings = null, ?array $restrictions = null, ?string $samplingrate = null, ?array $thumbnails = null, ?string $title = null, ?string $width = null ) { $this->bitrate = $bitrate; $this->captions = $captions; $this->categories = $categories; $this->channels = $channels; $this->copyright = $copyright; $this->credits = $credits; $this->description = $description; $this->duration = $duration; $this->expression = $expression; $this->framerate = $framerate; $this->hashes = $hashes; $this->height = $height; $this->keywords = $keywords; $this->lang = $lang; $this->length = $length; $this->link = $link; $this->medium = $medium; $this->player = $player; $this->ratings = $ratings; $this->restrictions = $restrictions; $this->samplingrate = $samplingrate; $this->thumbnails = $thumbnails; $this->title = $title; $this->type = $type; $this->width = $width; if (function_exists('idn_to_ascii')) { $parsed = \SimplePie\Misc::parse_url($link ?? ''); if ($parsed['authority'] !== '' && !ctype_print($parsed['authority'])) { $authority = (string) \idn_to_ascii($parsed['authority'], \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46); $this->link = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $authority, $parsed['path'], $parsed['query'], $parsed['fragment']); } } $this->handler = $this->get_handler(); // Needs to load last }Changelog
26 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$link retyped from untyped to ?string.verified against source$type retyped from untyped to ?string.verified against source$length retyped from untyped to ?int.verified against source$javascript retyped from untyped to null.verified against source$bitrate retyped from untyped to ?string.verified against source$captions retyped from untyped to SimplePie\Caption[]|null.verified against source$categories retyped from untyped to SimplePie\Category[]|null.verified against source$channels retyped from untyped to ?int.verified against source$copyright retyped from untyped to ?\SimplePie\Copyright.verified against source$credits retyped from untyped to SimplePie\Credit[]|null.verified against source$description retyped from untyped to ?string.verified against source$duration retyped from untyped to ?int.verified against source$expression retyped from untyped to ?string.verified against source$framerate retyped from untyped to ?string.verified against source$hashes retyped from untyped to string[]|null.verified against source$height retyped from untyped to ?string.verified against source$keywords retyped from untyped to string[]|null.verified against source$lang retyped from untyped to ?string.verified against source$medium retyped from untyped to ?string.verified against source$player retyped from untyped to ?string.verified against source$ratings retyped from untyped to SimplePie\Rating[]|null.verified against source$restrictions retyped from untyped to SimplePie\Restriction[]|null.verified against source$samplingrate retyped from untyped to ?string.verified against source$thumbnails retyped from untyped to string[]|null.verified against source$title retyped from untyped to ?string.verified against source$width retyped from untyped to ?string.verified against sourceAbout this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/SimplePie/src/Enclosure.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.