Helper.php

Classes 
author
Vítor Brandão <noisebleed@noiselabs.org>
category
NoiseLabs
copyright
(C) 2011 Vítor Brandão <noisebleed@noiselabs.org>
package
ToolKit
version
0.1.1
Classes
Helper

Description

This file is part of NoiseLabs-PHP-ToolKit

NoiseLabs-PHP-ToolKit is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

NoiseLabs-PHP-ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with NoiseLabs-PHP-ToolKit; if not, see http://www.gnu.org/licenses/.

Copyright (C) 2011 Vítor Brandão noisebleed@noiselabs.org

NoiseLabs\ToolKit\Helper

author
Vítor Brandão <noisebleed@noiselabs.org>
Methods
sanitizeFileName
buildArrayFromObjectsProperty
buildArrayFromObjectsMethod
getPreferredLanguage

Description

Helper holds a collection of static methods, useful for generic purposes

Methods

buildArrayFromObjectsMethod

buildArrayFromObjectsMethod( array $objects,  $method ) : array

Returns an array made from values extracted the array of obects using the given method.

Arguments
$objects
array
The collection of objects holding the target method
$method
Output
array
Details
visibility
public
final
false
static
true
since
0.1.0

buildArrayFromObjectsProperty

buildArrayFromObjectsProperty( array $objects, string $property ) : array

Returns an array made from property values extracted from each object in the array of objects.

Arguments
$objects
array
The collection of objects holding the target property
$property
string
Property name to collect data from
Output
array
Details
visibility
public
final
false
static
true
since
0.1.0

getPreferredLanguage

getPreferredLanguage( array $available_languages = array, string $default_language = en ) : string

An implementation of PECL's http_negotiate_language as posted on http://www.php.net/manual/en/function.http-negotiate-language.php by Anonymous (03-Nov-2008 11:23).

This function negotiates the clients preferred language based on its Accept-Language HTTP header. The qualifier is recognized and languages without qualifier are rated highest. The qualifier will be decreased by 10% for partial matches (i.e. matching primary language).

Arguments
$available_languages
array
Array with language-tag-strings that are available
$default_language
string
The language to pick if none available
Output
string
Returns the negotiated language or the default language
Details
visibility
public
final
false
static
true
since
0.1.0

sanitizeFileName

sanitizeFileName( string $dangerous_filename, string $platform = unix ) : Boolean

Returns a safe filename, for a given platform (OS), by replacing all dangerous characters with an underscore.

Arguments
$dangerous_filename
string
The source filename to be &quot;sanitized&quot;
$platform
string
The target OS
Output
Boolean
string A safe version of the input filename
Details
visibility
public
final
false
static
true
since
0.1.0
Documentation was generated by DocBlox.