/** * extract all but the end of a dot.notation.support string * * @param string $dotNotation * the string to extract from * @param int $start * which part do we want to start from? * @param int $len * how many parts do we want? * @return string * the extracted parts */ public static function fromString($dotNotation, $start, $len) { // robustness! RequireStringy::check($dotNotation, E4xx_UnsupportedType::class); RequireInteger::check($start, E4xx_UnsupportedType::class); RequireInteger::check($len, E4xx_UnsupportedType::class); $parts = explode(".", (string) $dotNotation); $parts = array_slice($parts, (int) $start, (int) $len); return implode(".", $parts); }
/** * @covers ::check * @dataProvider provideNonIntegers * @expectedException GanbaroDigital\Reflection\Exceptions\E4xx_UnsupportedType */ public function testRejectsNonIntegersWhenCalledStatically($item) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change RequireInteger::check($item); }