original_string: public function mkdir(string $dir, array $options = []): SystemService
      {
          $options = array_replace(
              [
                  'mode'          => 0777,
                  'recursive'     => true,
                  'context'       => null
              ],
              $options
          );
  
          if (file_exists($dir)) {
              if (!is_dir($dir)) {
                  throw NotADirectoryException::create(
                      'Can\'t create directory "'.$dir.'" because it exists and it\'s not a directory.'
                  );
              }
  
              return $this;
          }
  
          $args = [
              $dir,
              $options['mode'],
              $options['recursive']
          ];
  
          if ($options['context'] !== null) {
              $args[] = $options['context'];
          }
  
          if (!@mkdir(...$args)) {
              $lastError = $this->getLastPhpError();
  
              throw IOException::create(
                  'Couldn\'t create directory "'.$dir.'". PHP Error: '.print_r($lastError, true)
              );
          }
  
          return $this;
      }
code: public function mkdir(string $dir, array $options = []): SystemService
      {
          $options = array_replace(
              [
                  'mode'          => 0777,
                  'recursive'     => true,
                  'context'       => null
              ],
              $options
          );
  
          if (file_exists($dir)) {
              if (!is_dir($dir)) {
                  throw NotADirectoryException::create(
                      'Can\'t create directory "'.$dir.'" because it exists and it\'s not a directory.'
                  );
              }
  
              return $this;
          }
  
          $args = [
              $dir,
              $options['mode'],
              $options['recursive']
          ];
  
          if ($options['context'] !== null) {
              $args[] = $options['context'];
          }
  
          if (!@mkdir(...$args)) {
              $lastError = $this->getLastPhpError();
  
              throw IOException::create(
                  'Couldn\'t create directory "'.$dir.'". PHP Error: '.print_r($lastError, true)
              );
          }
  
          return $this;
      }
code_tokens: public function mkdir ( string $ dir , array $ options = [ ] ) : SystemService { $ options = array_replace ( [ 'mode' => 0777 , 'recursive' => true , 'context' => null ] , $ options ) ; if ( file_exists ( $ dir ) ) { if ( ! is_dir ( $ dir ) ) { throw NotADirectoryException :: create ( 'Can\'t create directory "' . $ dir . '" because it exists and it\'s not a directory.' ) ; } return $ this ; } $ args = [ $ dir , $ options [ 'mode' ] , $ options [ 'recursive' ] ] ; if ( $ options [ 'context' ] !== null ) { $ args [ ] = $ options [ 'context' ] ; } if ( ! @ mkdir ( ... $ args ) ) { $ lastError = $ this -> getLastPhpError ( ) ; throw IOException :: create ( 'Couldn\'t create directory "' . $ dir . '". PHP Error: ' . print_r ( $ lastError , true ) ) ; } return $ this ; }
docstring: Creates a directory. If it already exists, it doesn't throw an exception.
  
  Options:
  
  - mode:      Default 0777
  - recursive: Create missing directories recursively.
  - context:   Stream context.
  
  @param string $dir     - Directory.
  @param array  $options - Options.
  
  @throws IOException
  
  @return SystemService
docstring_tokens: Creates a directory . If it already exists it doesn t throw an exception .