code: private static function pop($directory, $partToCheck)
      {
          if ($directory !== null && basename($directory) == $partToCheck) {
              return dirname($directory);
          }
      }
docs: @param string|null $directory
  @param string      $partToCheck
  
  @return string|null