original_string: public static function checkDirectoriesWritable($directoriesToCheck)
      {
          $resultCheck = array();
          foreach ($directoriesToCheck as $directoryToCheck) {
              if (!preg_match('/^' . preg_quote(PIWIK_USER_PATH, '/') . '/', $directoryToCheck)) {
                  $directoryToCheck = PIWIK_USER_PATH . $directoryToCheck;
              }
  
              Filesystem::mkdir($directoryToCheck);
  
              $directory = Filesystem::realpath($directoryToCheck);
              if ($directory !== false) {
                  $resultCheck[$directory] = is_writable($directoryToCheck);
              }
          }
          return $resultCheck;
      }
code: public static function checkDirectoriesWritable($directoriesToCheck)
      {
          $resultCheck = array();
          foreach ($directoriesToCheck as $directoryToCheck) {
              if (!preg_match('/^' . preg_quote(PIWIK_USER_PATH, '/') . '/', $directoryToCheck)) {
                  $directoryToCheck = PIWIK_USER_PATH . $directoryToCheck;
              }
  
              Filesystem::mkdir($directoryToCheck);
  
              $directory = Filesystem::realpath($directoryToCheck);
              if ($directory !== false) {
                  $resultCheck[$directory] = is_writable($directoryToCheck);
              }
          }
          return $resultCheck;
      }
code_tokens: public static function checkDirectoriesWritable ( $ directoriesToCheck ) { $ resultCheck = array ( ) ; foreach ( $ directoriesToCheck as $ directoryToCheck ) { if ( ! preg_match ( '/^' . preg_quote ( PIWIK_USER_PATH , '/' ) . '/' , $ directoryToCheck ) ) { $ directoryToCheck = PIWIK_USER_PATH . $ directoryToCheck ; } Filesystem :: mkdir ( $ directoryToCheck ) ; $ directory = Filesystem :: realpath ( $ directoryToCheck ) ; if ( $ directory !== false ) { $ resultCheck [ $ directory ] = is_writable ( $ directoryToCheck ) ; } } return $ resultCheck ; }
docstring: Checks if directories are writable and create them if they do not exist.
  
  @param array $directoriesToCheck array of directories to check - if not given default Piwik directories that needs write permission are checked
  @return array  directory name => true|false (is writable)
docstring_tokens: Checks if directories are writable and create them if they do not exist .