PHP Classes

File: src/Interfaces/ArgumentsInterface.php

Recommend this page to a friend!
  Classes of Rodolfo Berrios Arce   Parameter   src/Interfaces/ArgumentsInterface.php   Download  
File: src/Interfaces/ArgumentsInterface.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Parameter
Validate function parameters with PHP attributes
Author: By
Last change:
Date: 1 month ago
Size: 1,733 bytes
 

Contents

Class file image Download
<?php

/*
 * This file is part of Chevere.
 *
 * (c) Rodolfo Berrios <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace
Chevere\Parameter\Interfaces;

/**
 * Describes the component in charge of defining a set of parameters with arguments.
 */
interface ArgumentsInterface extends ParametersAccessInterface
{
   
/**
     * Provides access to the arguments as array.
     * @phpstan-ignore-next-line
     */
   
public function toArray(): array;

   
/**
     * Provides access to the arguments as array, filling non-provided optional arguments.
     * @phpstan-ignore-next-line
     */
   
public function toArrayFill(mixed $fill): array;

   
/**
     * Return an instance with the specified argument.
     *
     * This method MUST retain the state of the current instance, and return
     * an instance that contains the specified argument.
     */
   
public function withPut(string $name, mixed $value): self;

   
/**
     * Indicates whether the instance has an argument for the parameter `$name`.
     */
   
public function has(string ...$name): bool;

   
/**
     * Provides access to the argument value for the parameter `$name`.
     * @return mixed Value OR null (when `$name` is an optional parameter with no value)
     */
   
public function get(string $name): mixed;

   
/**
     * Provides access to the required argument for the parameter `$name`.
     */
   
public function required(string $name): CastInterface;

   
/**
     * Provides access to the optional argument for the parameter `$name`.
     */
   
public function optional(string $name): ?CastInterface;
}