/** * Parse attribute key recursively * * @param array $parsedFields Reference to array of parsed fields * @param StringObject $key Current key to parse */ private function buildFields(&$parsedFields, StringObject $key) { if ($key->contains('.')) { $parts = $key->explode('.', 2)->val(); if (!isset($parsedFields[$parts[0]])) { $parsedFields[$parts[0]] = []; } $this->buildFields($parsedFields[$parts[0]], $this->str($parts[1])); } else { $parsedFields[$key->val()] = ''; } }
public function testContains3() { $s = new StringObject('Marry had a little lamb.'); $result = $s->contains('rry'); $this->assertTrue($result); }