/** * split the dot.notation.support path up into two parts - where we are * inserting, and the name of what we are inserting * * @param string $path * the dot.notation.support path that needs splitting * @return array * the two parts of the path */ private static function splitPathInTwo($path) { // find the point where we want to merge $firstPart = FilterDotNotationParts::fromString($path, 0, -1); $finalPart = FilterDotNotationParts::fromString($path, -1, 1); // what do we have? // var_dump("path", $path, "firstPart", $firstPart, "finalPart", $finalPart); // special case - we're already at the end of the path if (strlen($firstPart) === 0) { return [null, $finalPart]; } // general case - we're not at the end of the path return [$firstPart, $finalPart]; }
/** * split the dot.notation.support path up into two parts - where we are * inserting, and the name of what we are inserting * * @param string $path * the dot.notation.support path that needs splitting * @return array * the two parts of the path */ private static function splitPathInTwo($path) { // find the point where we want to merge $firstPart = FilterDotNotationParts::fromString($path, 0, -1); $finalPart = FilterDotNotationParts::fromString($path, -1, 1); return [$firstPart, $finalPart]; }
/** * @covers ::from * @covers ::fromString * @expectedException GanbaroDigital\DataContainers\Exceptions\E4xx_UnsupportedType * @dataProvider provideNonIntegers */ public function testLenMustBeAnInteger($len) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change FilterDotNotationParts::from('dot.notation.support', 0, $len); }