Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • CacheControlHeader
  • CallableDispatcher
  • ContentDispositionHeader
  • ContentTypeHeader
  • DateHeader
  • Dispatcher
  • File
  • FileList
  • Header
  • HeaderParameter
  • Headers
  • Helpers
  • RedirectResponse
  • Request
  • Response
  • WeightedDispatcher

Interfaces

  • IDispatcher

Exceptions

  • ForceRedirect
  • HTTPError
  • MethodNotSupported
  • NotFound
  • ServiceUnavailable
  • StatusCodeNotValid

Functions

  • dispatch
  • get_dispatcher
  • get_initial_request

Class File

Representation of a POST file.

ICanBoogie\HTTP\File implements ICanBoogie\ToArray uses ICanBoogie\PrototypeTrait
Namespace: ICanBoogie\HTTP
Located at vendor/icanboogie/http/lib/file.php

Methods summary

public static
# from( mixed $properties_or_name )
public static string
# resolve_type( string $pathname, string & $extension = null )

Resolve the MIME type of a file.

Resolve the MIME type of a file.

Parameters

$pathname
string
$pathname Pathname to the file.
$extension
string
$extension The variable passed by reference recieves the extension of the file.

Returns

string
The MIME type of the file, or 'application/octet-stream' if it could not be determined.
protected string
# get_name( )

Returns the name of the file.

Returns the name of the file.

Returns

string
protected string
# get_unsuffixed_name( )

Returns the name of the file, without its extension.

Returns the name of the file, without its extension.

Returns

string
protected string|null
# get_type( )

Returns the type of the file.

Returns the type of the file.

If the ICanBoogie\HTTP\File::$type property was not defined during construct, the type is guessed from the name or the pathname of the file.

Returns

string|null
The MIME type of the file, or null if it cannot be determined.
protected integer|null
# get_size( )

Returns the size of the file.

Returns the size of the file.

If the ICanBoogie\HTTP\File::$size property was not defined during construct, the size is guessed using the pathname of the file. If the pathname is not available the method returns null.

Returns

integer|null
The size of the file or null if it cannot be determined.
protected boolean
# get_is_valid( )

Check if the file is valid.

Check if the file is valid.

A file is considered valid if it has no error code, if it has a size, if it has either a temporary name or a pathname and that the file actually exists.

Returns

boolean
true if the file is valid, false otherwise.
protected string
# get_pathname( )

Return the pathname of the file.

Return the pathname of the file.

Note: If the ICanBoogie\HTTP\File::$pathname property is empty, the ICanBoogie\HTTP\File::$tmp_name property is returned.

Returns

string
protected
# __construct( array $properties )
public array
# to_array( )

Return an array representation of the instance.

Return an array representation of the instance.

The following properties are exported:

  • ICanBoogie\HTTP\File::$name
  • $unsuffixed_name
  • $extension
  • ICanBoogie\HTTP\File::$type
  • ICanBoogie\HTTP\File::$size
  • ICanBoogie\HTTP\File::$pathname
  • ICanBoogie\HTTP\File::$error
  • $error_message

Returns

array

Implementation of

ICanBoogie\ToArray::to_array()
protected string
# get_error( )

Returns the error code.

Returns the error code.

Returns

string
protected ICanBoogie\I18n\FormattedString|ICanBoogie\FormattedString|string|null
# get_error_message( )

Returns the message associated with the error.

Returns the message associated with the error.

Returns

ICanBoogie\I18n\FormattedString|ICanBoogie\FormattedString|string|null
protected string|null
# get_extension( )

Returns the extension of the file, if any.

Returns the extension of the file, if any.

Note: The extension includes the dot e.g. ".zip". The extension if always in lower case.

Returns

string|null
protected boolean
# get_is_uploaded( )

Check if a file is uploaded.

Check if a file is uploaded.

Returns

boolean
true if the file is uploaded, false otherwise.
public boolean
# match( string|array $type )

Check if the file matches a MIME class, a MIME type, or a file extension.

Check if the file matches a MIME class, a MIME type, or a file extension.

Parameters

$type
string|array
$type The type can be a MIME class (e.g. "image"), a MIME type (e.g. "image/png"), or an extensions (e.g. ".zip"). An array can be used to check if a file matches multiple type e.g. [ "image", ".mp3" ], which matches any type of image or files with the ".mp3" extension.

Returns

boolean
true if the file matches (or $type is empty), false otherwise.
public
# move( string $destination, string $overwrite = false )

Move the file.

Move the file.

Parameters

$destination
string
$destination Pathname to the destination file.
$overwrite
string
$overwrite If true the destination file is deleted before the file is move.

Throws

Exception
if the file failed to be moved.

Methods used from ICanBoogie\PrototypeTrait

__call(), __get(), __set(), __sleep(), __wakeup(), get_prototype(), has_method(), has_property(), last_chance_get(), last_chance_set()

Magic methods summary

Properties summary

protected static array $types
#
protected static array $types_alias
#
protected mixed $name
#
protected mixed $type
#
protected mixed $size
#
protected mixed $tmp_name
#
protected mixed $error
#
protected mixed $pathname
#

Magic properties

public read-only string $name
#

Name of the file.

Name of the file.

public read-only string $type
#

MIME type of the file.

MIME type of the file.

public read-only string $size
#

Size of the file.

Size of the file.

public read-only string $error
#

Error code, one of UPLOAD_ERR_*.

Error code, one of UPLOAD_ERR_*.

public read-only string $error_message
#

A formatted message representing the error.

A formatted message representing the error.

public read-only string $pathname
#

Pathname of the file.

Pathname of the file.

public read-only string $extension
#

The extension of the file. If any, the dot is included e.g. ".zip".

The extension of the file. If any, the dot is included e.g. ".zip".

public read-only string $unsuffixed_name
#

The name of the file without its extension.

The name of the file without its extension.

public read-only boolean $is_uploaded
#

true if the file is uploaded, false otherwise.

true if the file is uploaded, false otherwise.

public read-only boolean $is_valid
#

true if the file is valid, false otherwise. See: is_valid().

true if the file is valid, false otherwise. See: is_valid().

Autodoc API documentation generated by ApiGen 2.8.0