Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/console/Helper/Helper.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
21 abstract class Helper implements HelperInterface | 21 abstract class Helper implements HelperInterface |
22 { | 22 { |
23 protected $helperSet = null; | 23 protected $helperSet = null; |
24 | 24 |
25 /** | 25 /** |
26 * Sets the helper set associated with this helper. | 26 * {@inheritdoc} |
27 * | |
28 * @param HelperSet $helperSet A HelperSet instance | |
29 */ | 27 */ |
30 public function setHelperSet(HelperSet $helperSet = null) | 28 public function setHelperSet(HelperSet $helperSet = null) |
31 { | 29 { |
32 $this->helperSet = $helperSet; | 30 $this->helperSet = $helperSet; |
33 } | 31 } |
34 | 32 |
35 /** | 33 /** |
36 * Gets the helper set associated with this helper. | 34 * {@inheritdoc} |
37 * | |
38 * @return HelperSet|null | |
39 */ | 35 */ |
40 public function getHelperSet() | 36 public function getHelperSet() |
41 { | 37 { |
42 return $this->helperSet; | 38 return $this->helperSet; |
43 } | 39 } |
54 if (false === $encoding = mb_detect_encoding($string, null, true)) { | 50 if (false === $encoding = mb_detect_encoding($string, null, true)) { |
55 return strlen($string); | 51 return strlen($string); |
56 } | 52 } |
57 | 53 |
58 return mb_strwidth($string, $encoding); | 54 return mb_strwidth($string, $encoding); |
55 } | |
56 | |
57 /** | |
58 * Returns the subset of a string, using mb_substr if it is available. | |
59 * | |
60 * @param string $string String to subset | |
61 * @param int $from Start offset | |
62 * @param int|null $length Length to read | |
63 * | |
64 * @return string The string subset | |
65 */ | |
66 public static function substr($string, $from, $length = null) | |
67 { | |
68 if (false === $encoding = mb_detect_encoding($string, null, true)) { | |
69 return substr($string, $from, $length); | |
70 } | |
71 | |
72 return mb_substr($string, $from, $length, $encoding); | |
59 } | 73 } |
60 | 74 |
61 public static function formatTime($secs) | 75 public static function formatTime($secs) |
62 { | 76 { |
63 static $timeFormats = array( | 77 static $timeFormats = array( |