public static function fromSpecification(string $specification) : self
    {
        $microseconds = 0;
        
        // Parse the microsecond component.
        if (false !== ($position = stripos($specification, 'U'))) {
            // Step backwards consuming digits until we hit a duration designator.
            // Note that we always expect at least the duration designator (P), but for loop safety we break if
            // the first character in the specification is reached too.
            
            $microseconds = '';
            
            while ($position > 0) {
                $char = $specification[--$position];
                
                if (!is_numeric($char)) {
                    break;
                }
                
                $microseconds = $char . $microseconds;
            }
            
            // Remove the microsecond designator from the specification.
            $specification = substr($specification, 0, -1 - strlen($microseconds));
        }
        
        // If the specification is just the duration designator it means that only microseconds were specified.
        // In that case we  create an empty interval for convenience.
        if ('P' === $specification || 'PT' === $specification) {
            $specification = 'P0Y';
        }
        
        return new static(new \DateInterval($specification), (int)$microseconds);
    }