original_string: private function importDefinitionsFromDirectory(array $overrideData)
      {
          if (!file_exists($this->path)) {
              throw new \Exception('Directory not found: ' . $this->path);
          }
  
          // Grab all yaml files in the schema directory.
          $schemaFiles = preg_grep('~\.(yml)$~', scandir($this->path));
  
          // Read contents of each file and add it to the definitions.
          foreach ($schemaFiles as $fileName) {
              $schemaStructure = explode('.', $this->fromSafeFileName($fileName));
              $dataTypeHandle = $schemaStructure[0];
              $recordName = $schemaStructure[1];
  
              $definition = Data::parseYamlFile($this->path . $fileName);
  
              // Check if there is data in the override file for the current record.
              if (isset($overrideData[$dataTypeHandle][$recordName])) {
                  $definition = array_replace_recursive($definition, $overrideData[$dataTypeHandle][$recordName]);
              }
  
              $definitions[$dataTypeHandle][$recordName] = $definition;
          }
  
          return $definitions;
      }
code: private function importDefinitionsFromDirectory(array $overrideData)
      {
          if (!file_exists($this->path)) {
              throw new \Exception('Directory not found: ' . $this->path);
          }
  
          // Grab all yaml files in the schema directory.
          $schemaFiles = preg_grep('~\.(yml)$~', scandir($this->path));
  
          // Read contents of each file and add it to the definitions.
          foreach ($schemaFiles as $fileName) {
              $schemaStructure = explode('.', $this->fromSafeFileName($fileName));
              $dataTypeHandle = $schemaStructure[0];
              $recordName = $schemaStructure[1];
  
              $definition = Data::parseYamlFile($this->path . $fileName);
  
              // Check if there is data in the override file for the current record.
              if (isset($overrideData[$dataTypeHandle][$recordName])) {
                  $definition = array_replace_recursive($definition, $overrideData[$dataTypeHandle][$recordName]);
              }
  
              $definitions[$dataTypeHandle][$recordName] = $definition;
          }
  
          return $definitions;
      }
code_tokens: private function importDefinitionsFromDirectory ( array $ overrideData ) { if ( ! file_exists ( $ this -> path ) ) { throw new \ Exception ( 'Directory not found: ' . $ this -> path ) ; } // Grab all yaml files in the schema directory. $ schemaFiles = preg_grep ( '~\.(yml)$~' , scandir ( $ this -> path ) ) ; // Read contents of each file and add it to the definitions. foreach ( $ schemaFiles as $ fileName ) { $ schemaStructure = explode ( '.' , $ this -> fromSafeFileName ( $ fileName ) ) ; $ dataTypeHandle = $ schemaStructure [ 0 ] ; $ recordName = $ schemaStructure [ 1 ] ; $ definition = Data :: parseYamlFile ( $ this -> path . $ fileName ) ; // Check if there is data in the override file for the current record. if ( isset ( $ overrideData [ $ dataTypeHandle ] [ $ recordName ] ) ) { $ definition = array_replace_recursive ( $ definition , $ overrideData [ $ dataTypeHandle ] [ $ recordName ] ) ; } $ definitions [ $ dataTypeHandle ] [ $ recordName ] = $ definition ; } return $ definitions ; }
docstring: Import definitions from directory
  
  @param array $overrideData The overridden data
  @throws \Exception
docstring_tokens: Import definitions from directory