arraySetDotFirstLevel() public static method

If no key is given to the method, the entire array will be replaced.
public static arraySetDotFirstLevel ( array &$array, string $key, mixed $value ) : array
$array array
$key string
$value mixed
return array
 public function testArraySetDotFirstLevel()
 {
     $array = array();
     Tools::arraySetDotFirstLevel($array, 'a.b.c', true);
     $this->assertTrue($array['a']['b.c']);
     Tools::arraySetDotFirstLevel($array, 'a.b.c', true);
     $this->assertNull(@$array['a']['b']['c']);
     Tools::arraySetDotFirstLevel($array, null, true);
     /** @var bool $array */
     $this->assertTrue($array);
 }
 /**
  * @param array $lemmas an array of lemma
  *                      eg: [ 'message.lemma.child' => string(83)
  *                      "/Users/potsky/WTF/laravel-localization-helpers/tests/mock/trans.php" , ... ]
  *
  * @return array a flat array of lemma
  *               eg: array(1) {
  *                        'message' =>
  *                            array(2) {
  *                            'lemma.child' => string(83)
  *                            "/Users/potsky/Work/Private/GitHub/laravel-localization-helpers/tests/mock/trans.php"
  *                        ...
  */
 public function convertLemmaToFlatArray($lemmas)
 {
     $lemmas_structured = array();
     foreach ($lemmas as $key => $value) {
         if (strpos($key, '.') === false) {
             $this->messageBag->writeLine('    <error>' . $key . '</error> in file <comment>' . $this->getShortPath($value) . '</comment> <error>will not be included because it has no family</error>');
         } else {
             Tools::arraySetDotFirstLevel($lemmas_structured, $key, $value);
         }
     }
     return $lemmas_structured;
 }