@param $duration

@throws MediaItemException
768282
protected function setContentDuration($duration)
    {
        if (null !== $duration) {
            $this->writeAttribute(
                $duration,
                'content',
                'duration',
                $this->validator,
                'validateDuration',
                $this->exception,
                'Provided duration is not a valid value.'
            );
        }
    }
34475
public function setDuration($duration)
    {
        if ($duration < 0 || $duration > 28800) {
            throw new Exception\GoogleVideoUrlException(
                sprintf(
                    'The parameter %s must be a valid duration.see http://support.google.com/webmasters/bin/answer.py?hl=en&answer=80472#4',
                    $duration
                )
            );
        }

        $this->duration = $duration;

        return $this;
    }
1204262
function _format_duration( $duration ) {
    if( !isset( $duration['week'] ) &&
        !isset( $duration['day'] )  &&
        !isset( $duration['hour'] ) &&
        !isset( $duration['min'] )  &&
        !isset( $duration['sec'] ))
      return;
    $output = 'P';
    if( isset( $duration['week'] ) && ( 0 < $duration['week'] ))
      $output       .= $duration['week'].'W';
    else {
      if( isset($duration['day'] ) && ( 0 < $duration['day'] ))
        $output     .= $duration['day'].'D';
      if(( isset( $duration['hour']) && ( 0 < $duration['hour'] )) ||
         ( isset( $duration['min'])  && ( 0 < $duration['min'] ))  ||
         ( isset( $duration['sec'])  && ( 0 < $duration['sec'] ))) {
        $output     .= 'T';
        if( 0 < $duration['hour'] ) {
          $output   .= $duration['hour'].'H';
          if( 0 < $duration['min'] ) {
            $output .= $duration['min'].'M';
            if( 0 < $duration['sec'] )
              $output .= $duration['sec'].'S';
          }
          elseif( 0 < $duration['sec'] )
            $output .= '0M'.$duration['sec'].'S';
        }
        elseif( 0 < $duration['min'] ) {
          $output   .= '0H'.$duration['min'].'M';
          if( 0 < $duration['sec'] )
            $output .= $duration['sec'].'S';
        }
        elseif( 0 < $duration['sec'] )
          $output   .= '0H0M'.$duration['sec'].'S';
      }
    }
    return $output;
  }
390465
public static function createFromDateString($duration): self
    {
        $duration = parent::createFromDateString($duration);
        if (false === $duration) {
            return $duration;
        }

        $new = new self('PT0S');
        foreach ($duration as $name => $value) {
            $new->$name = $value;
        }

        return $new;
    }
798964
public function plusDuration(Duration $duration) : LocalTime
    {
        return $this
            ->plusSeconds($duration->getSeconds())
            ->plusNanos($duration->getNanos());
    }
1363747
public function humanize($duration = null)
    {
        if (null !== $duration) {
            $this->parse($duration);
        }

        if ($this->seconds > 0 || ($this->seconds === 0.0 && $this->minutes === 0 && $this->hours === 0 && $this->days === 0)) {
            $this->output .= $this->seconds . 's';
        }

        if ($this->minutes > 0) {
            $this->output = $this->minutes . 'm ' . $this->output;
        }

        if ($this->hours > 0) {
            $this->output = $this->hours . 'h ' . $this->output;
        }

        if ($this->days > 0) {
            $this->output = $this->days . 'd ' . $this->output;
        }

        return trim($this->output());
    }
1024205
public static function fromLengthAndDuration(Length $length, Duration $duration)
	{
		$meters = $length->convertTo(UnitLength::meters());
		$seconds = $duration->convertTo(UnitDuration::seconds());

		$speed = $meters->value() / $seconds->value();

		return new static($speed, UnitSpeed::metersPerSecond());
	}
1078774
@NonNull
    public IconicsAnimationProcessor duration(long duration, @NonNull TimeUnit timeUnit) {
        mDuration = timeUnit.toMillis(duration);
        return this;
    }
662283
public static String durationToFormattedString(final Duration duration) {
        if (duration == null) {
            return null;
        }

        return LocalTime.ofNanoOfDay(duration.toNanos()).format(DateTimeFormatter.ofPattern(DURATION_FORMAT));
    }
1362676
public static void setHoverDelay(Duration duration) {
        BEHAVIOR.setHoverDelay(duration == null ? Duration.millis(650) : duration);
    }
160357
protected function getMinutes( $duration )
	{
		if ( $duration instanceof DateTime )
		{
			$fromNow = Carbon::now()->diffInMinutes( Carbon::instance( $duration ), false );

			return $fromNow > 0 ? $fromNow : null;
		}

		return is_string( $duration ) ? (int) $duration : $duration;
	}
1364244
public void setDuration(int index, Duration value)
   {
      set(selectField(ResourceFieldLists.CUSTOM_DURATION, index), value);
   }
911725
protected function validateMaxDuration($duration, Constraint $constraint)
    {
        if ($constraint->maxDuration) {
            if (!ctype_digit((string) $constraint->maxDuration)) {
                throw new ConstraintDefinitionException(
                    sprintf(
                        '"%s" is not a valid maximum duration',
                        $constraint->maxDuration
                    )
                );
            }

            if ($duration > $constraint->maxDuration) {
                $this->context->addViolation(
                    $constraint->maxDurationMessage,
                    array(
                        '{{ duration }}' => $duration,
                        '{{ max_duration }}' => $constraint->maxDuration
                    )
                );

                return true;
            }
        }
    }
694858
protected function validateMinDuration($duration, Constraint $constraint)
    {
        if ($constraint->minDuration) {
            if (!ctype_digit((string) $constraint->minDuration)) {
                throw new ConstraintDefinitionException(
                    sprintf(
                        '"%s" is not a valid minimum duration',
                        $constraint->minDuration
                    )
                );
            }

            if ($duration < $constraint->minDuration) {
                $this->context->addViolation(
                    $constraint->minDurationMessage,
                    array(
                        '{{ duration }}' => $duration,
                        '{{ min_duration }}' => $constraint->minDuration
                    )
                );

                return true;
            }
        }
    }
254691
public function setDuration($duration)
    {
        self::writeFullTag(
            $duration,
            'duration',
            true,
            'video:duration',
            $this->validator,
            'validateDuration',
            $this->exception,
            'Provided duration value is not a valid.'
        );

        return $this;
    }
64923
protected function setDuration($duration)
	{
		if (is_numeric($duration) && $duration >= 0)
		{
			$duration = new TimeInterval($duration);
		}
		
		if ( ! $duration instanceof TimeInterval)
		{
			throw new \InvalidArgumentException('The duration value must be a positive number value.');
		}
		
		$this->duration = $duration;
		
		return $this;
	}
12508
protected function debugLog($query, $duration, $info)
    {
        if ($this->debugCallback) {
            call_user_func($this->debugCallback, $query, $duration, $info);
        }
    }