Skip to content

Commit

Permalink
[+]: auto-add "phpdoc"
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Moelleken committed Feb 20, 2015
1 parent 8236e53 commit 96ab4d8
Show file tree
Hide file tree
Showing 9 changed files with 1,011 additions and 149 deletions.
121 changes: 120 additions & 1 deletion src/voku/helper/bootup/iconv.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,142 @@
*/

use voku\helper\shim\Iconv;
use voku\helper\shim\Mbstring;

const ICONV_IMPL = 'Patchwork';
const ICONV_VERSION = '1.0';
const ICONV_MIME_DECODE_STRICT = 1;
const ICONV_MIME_DECODE_CONTINUE_ON_ERROR = 2;

/**
* @param $from
* @param $to
* @param $s
*
* @return bool|string
*/
function iconv($from, $to, $s)
{
return Iconv::iconv($from, $to, $s);
}

/**
* @param string $type
*
* @return array|string
*/
function iconv_get_encoding($type = 'all')
{
return Iconv::iconv_get_encoding($type);
}

/**
* @param $type
* @param $charset
*
* @return bool
*/
function iconv_set_encoding($type, $charset)
{
return Iconv::iconv_set_encoding($type, $charset);
}

/**
* @param $name
* @param $value
* @param $pref
*
* @return string
*/
function iconv_mime_encode($name, $value, $pref = INF)
{
return Iconv::iconv_mime_encode($name, $value, $pref);
}

/**
* @param $buffer
* @param $mode
*
* @return bool|string
*/
function ob_iconv_handler($buffer, $mode)
{
return Iconv::ob_iconv_handler($buffer, $mode);
}

/**
* @param $encoded_headers
* @param int $mode
* @param $enc
*
* @return array|bool
*/
function iconv_mime_decode_headers($encoded_headers, $mode = 0, $enc = INF)
{
return Iconv::iconv_mime_decode_headers($encoded_headers, $mode, $enc);
}

if (extension_loaded('mbstring')) {

/**
* @param $s
* @param $enc
*
* @return bool|int
*/
function iconv_strlen($s, $enc = INF)
{
INF === $enc && $enc = Iconv::$internal_encoding;
return mb_strlen($s, $enc);
}

/**
* @param $s
* @param $needle
* @param int $offset
* @param $enc
*
* @return bool|int
*/
function iconv_strpos($s, $needle, $offset = 0, $enc = INF)
{
INF === $enc && $enc = Iconv::$internal_encoding;
return mb_strpos($s, $needle, $offset, $enc);
}

/**
* @param $s
* @param $needle
* @param $enc
*
* @return bool|int
*/
function iconv_strrpos($s, $needle, $enc = INF)
{
INF === $enc && $enc = Iconv::$internal_encoding;
return mb_strrpos($s, $needle, $enc);
}

/**
* @param $s
* @param $start
* @param int $length
* @param $enc
*
* @return string
*/
function iconv_substr($s, $start, $length = 2147483647, $enc = INF)
{
INF === $enc && $enc = Iconv::$internal_encoding;
return mb_substr($s, $start, $length, $enc);
}

/**
* @param $encoded_headers
* @param int $mode
* @param $enc
*
* @return bool|string
*/
function iconv_mime_decode($encoded_headers, $mode = 0, $enc = INF)
{
INF === $enc && $enc = Iconv::$internal_encoding;
Expand All @@ -80,32 +154,77 @@ function iconv_mime_decode($encoded_headers, $mode = 0, $enc = INF)

} else {
if (extension_loaded('xml')) {

/**
* @param $s
* @param $enc
*
* @return bool|int
*/
function iconv_strlen($s, $enc = INF)
{
return Iconv::strlen1($s, $enc);
}

} else {

/**
* @param $s
* @param $enc
*
* @return bool|int
*/
function iconv_strlen($s, $enc = INF)
{
return Iconv::strlen2($s, $enc);
}
}

/**
* @param $s
* @param $needle
* @param int $offset
* @param $enc
*
* @return bool|int
*/
function iconv_strpos($s, $needle, $offset = 0, $enc = INF)
{
return Iconv::iconv_strpos($s, $needle, $offset, $enc);
}

/**
* @param $s
* @param $needle
* @param $enc
*
* @return bool|int
*/
function iconv_strrpos($s, $needle, $enc = INF)
{
return Iconv::iconv_strrpos($s, $needle, $enc);
}

/**
* @param $s
* @param $start
* @param int $length
* @param $enc
*
* @return bool|string
*/
function iconv_substr($s, $start, $length = 2147483647, $enc = INF)
{
return Iconv::iconv_substr($s, $start, $length, $enc);
}

/**
* @param $encoded_headers
* @param int $mode
* @param $enc
*
* @return bool|string
*/
function iconv_mime_decode($encoded_headers, $mode = 0, $enc = INF)
{
return Iconv::iconv_mime_decode($encoded_headers, $mode, $enc);
Expand Down
76 changes: 75 additions & 1 deletion src/voku/helper/bootup/intl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,132 @@
const GRAPHEME_EXTR_MAXBYTES = 1;
const GRAPHEME_EXTR_MAXCHARS = 2;

/**
* @param $s
* @param int $form
*
* @return bool
*/
function normalizer_is_normalized($s, $form = s\Normalizer::NFC)
{
return s\Normalizer::isNormalized($s, $form);
}

/**
* @param $s
* @param int $form
*
* @return string
*/
function normalizer_normalize($s, $form = s\Normalizer::NFC)
{
return s\Normalizer::normalize($s, $form);
}

/**
* @param $s
* @param $size
* @param int $type
* @param int $start
* @param int $next
*
* @return string
*/
function grapheme_extract($s, $size, $type = 0, $start = 0, &$next = 0)
{
return s\Intl::grapheme_extract($s, $size, $type, $start, $next);
}

/**
* @param $s
* @param $needle
* @param int $offset
*
* @return bool|int|null
*/
function grapheme_stripos($s, $needle, $offset = 0)
{
return s\Intl::grapheme_stripos($s, $needle, $offset);
}

/**
* @param $s
* @param $needle
* @param bool $before_needle
*
* @return bool|string
*/
function grapheme_stristr($s, $needle, $before_needle = false)
{
return s\Intl::grapheme_stristr($s, $needle, $before_needle);
}

/**
* @param $s
*
* @return null
*/
function grapheme_strlen($s)
{
return s\Intl::grapheme_strlen($s);
}

/**
* @param $s
* @param $needle
* @param int $offset
*
* @return bool|int|null
*/
function grapheme_strpos($s, $needle, $offset = 0)
{
return s\Intl::grapheme_strpos($s, $needle, $offset);
}

/**
* @param $s
* @param $needle
* @param int $offset
*
* @return bool|int|null
*/
function grapheme_strripos($s, $needle, $offset = 0)
{
return s\Intl::grapheme_strripos($s, $needle, $offset);
}

/**
* @param $s
* @param $needle
* @param int $offset
*
* @return bool|int|null
*/
function grapheme_strrpos($s, $needle, $offset = 0)
{
return s\Intl::grapheme_strrpos($s, $needle, $offset);
}

/**
* @param $s
* @param $needle
* @param bool $before_needle
*
* @return bool|string
*/
function grapheme_strstr($s, $needle, $before_needle = false)
{
return s\Intl::grapheme_strstr($s, $needle, $before_needle);
}

/**
* @param $s
* @param $start
* @param int $len
*
* @return bool|string
*/
function grapheme_substr($s, $start, $len = 2147483647)
{
return s\Intl::grapheme_substr($s, $start, $len);
}

0 comments on commit 96ab4d8

Please sign in to comment.