This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'zf2/master' into feature/doc
- Loading branch information
Showing
123 changed files
with
1,861 additions
and
4,955 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Filter | ||
*/ | ||
|
||
namespace Zend\Filter; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Filter | ||
*/ | ||
abstract class AbstractUnicode extends AbstractFilter | ||
{ | ||
/** | ||
* Set the input encoding for the given string | ||
* | ||
* @param string|null $encoding | ||
* @return StringToLower | ||
* @throws Exception\InvalidArgumentException | ||
* @throws Exception\ExtensionNotLoadedException | ||
*/ | ||
public function setEncoding($encoding = null) | ||
{ | ||
if ($encoding !== null) { | ||
if (!function_exists('mb_strtolower')) { | ||
throw new Exception\ExtensionNotLoadedException(sprintf( | ||
'%s requires mbstring extension to be loaded', | ||
get_class($this) | ||
)); | ||
} | ||
|
||
$encoding = strtolower($encoding); | ||
$mbEncodings = array_map('strtolower', mb_list_encodings()); | ||
if (!in_array($encoding, $mbEncodings)) { | ||
throw new Exception\InvalidArgumentException(sprintf( | ||
"Encoding '%s' is not supported by mbstring extension", | ||
$encoding | ||
)); | ||
} | ||
} | ||
|
||
$this->options['encoding'] = $encoding; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Returns the set encoding | ||
* | ||
* @return string | ||
*/ | ||
public function getEncoding() | ||
{ | ||
if ($this->options['encoding'] === null && function_exists('mb_internal_encoding')) { | ||
$this->options['encoding'] = mb_internal_encoding(); | ||
} | ||
|
||
return $this->options['encoding']; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.