Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Filter / StringToUpper.php
blob22f0d29aff61934a8d3d4067346f14554c927f6a
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Filter;
12 use Traversable;
14 class StringToUpper extends AbstractUnicode
16 /**
17 * @var array
19 protected $options = array(
20 'encoding' => null,
23 /**
24 * Constructor
26 * @param string|array|Traversable $encodingOrOptions OPTIONAL
28 public function __construct($encodingOrOptions = null)
30 if ($encodingOrOptions !== null) {
31 if (!static::isOptions($encodingOrOptions)) {
32 $this->setEncoding($encodingOrOptions);
33 } else {
34 $this->setOptions($encodingOrOptions);
39 /**
40 * Defined by Zend\Filter\FilterInterface
42 * Returns the string $value, converting characters to uppercase as necessary
44 * If the value provided is non-scalar, the value will remain unfiltered
45 * and an E_USER_WARNING will be raised indicating it's unfilterable.
47 * @param string $value
48 * @return string|mixed
50 public function filter($value)
52 if (null === $value) {
53 return null;
56 if (!is_scalar($value)) {
57 trigger_error(
58 sprintf(
59 '%s expects parameter to be scalar, "%s" given; cannot filter',
60 __METHOD__,
61 (is_object($value) ? get_class($value) : gettype($value))
63 E_USER_WARNING
65 return $value;
68 if ($this->options['encoding'] !== null) {
69 return mb_strtoupper((string) $value, $this->options['encoding']);
72 return strtoupper((string) $value);