wppaste
WordPress

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
Constructor, used to input the data

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

$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
$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

Touches nothing outside its own arguments.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
85–126

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 126.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

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.

WhenInstructionsCalls it makes
!function_exists()85function_exists(), ->get_handler()
function_exists()93–94function_exists(), ::SimplePie\\Misc(), ->get_handler()
function_exists() && ctype_print()98–99function_exists(), ::SimplePie\\Misc(), ctype_print(), ->get_handler()
function_exists() && !ctype_print()125–126function_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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

6.9.7
Parameter $link retyped from untyped to ?string.verified against source
6.9.7
Parameter $type retyped from untyped to ?string.verified against source
6.9.7
Parameter $length retyped from untyped to ?int.verified against source
6.9.7
Parameter $javascript retyped from untyped to null.verified against source
6.9.7
Parameter $bitrate retyped from untyped to ?string.verified against source
6.9.7
Parameter $captions retyped from untyped to SimplePie\Caption[]|null.verified against source
6.9.7
Parameter $categories retyped from untyped to SimplePie\Category[]|null.verified against source
6.9.7
Parameter $channels retyped from untyped to ?int.verified against source
6.9.7
Parameter $copyright retyped from untyped to ?\SimplePie\Copyright.verified against source
6.9.7
Parameter $credits retyped from untyped to SimplePie\Credit[]|null.verified against source
6.9.7
Parameter $description retyped from untyped to ?string.verified against source
6.9.7
Parameter $duration retyped from untyped to ?int.verified against source
6.9.7
Parameter $expression retyped from untyped to ?string.verified against source
6.9.7
Parameter $framerate retyped from untyped to ?string.verified against source
6.9.7
Parameter $hashes retyped from untyped to string[]|null.verified against source
6.9.7
Parameter $height retyped from untyped to ?string.verified against source
6.9.7
Parameter $keywords retyped from untyped to string[]|null.verified against source
6.9.7
Parameter $lang retyped from untyped to ?string.verified against source
6.9.7
Parameter $medium retyped from untyped to ?string.verified against source
6.9.7
Parameter $player retyped from untyped to ?string.verified against source
6.9.7
Parameter $ratings retyped from untyped to SimplePie\Rating[]|null.verified against source
6.9.7
Parameter $restrictions retyped from untyped to SimplePie\Restriction[]|null.verified against source
6.9.7
Parameter $samplingrate retyped from untyped to ?string.verified against source
6.9.7
Parameter $thumbnails retyped from untyped to string[]|null.verified against source
6.9.7
Parameter $title retyped from untyped to ?string.verified against source
6.9.7
Parameter $width retyped from untyped to ?string.verified against source

About 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.