/**
* From parameters, construct a 'scale' array
- * @param {Array} $params
- * @return {null|Array} key-val array of 'width' and 'height', or null
+ * @param $params Array:
+ * @return Array or Null: key-val array of 'width' and 'height', or null
*/
public function getScale( $params ) {
$p = $this->getModulePrefix();
* This method returns the file object, which also has a 'sessionKey' property which can be passed through a form or
* API request to find this stashed file again.
*
- * @param {String}: $key (optional) the session key used to find the file info again. If not supplied, a key will be autogenerated.
- * @return {File}: stashed file
+ * @param $key String: (optional) the session key used to find the file info again. If not supplied, a key will be autogenerated.
+ * @return File: stashed file
*/
public function stashSessionFile( $key = null ) {
$stash = new UploadStash();
/**
* Stash a file in a temporary directory, returning a key which can be used to find the file again. See stashSessionFile().
*
- * @param {String}: $key (optional) the session key used to find the file info again. If not supplied, a key will be autogenerated.
- * @return {String}: session key
+ * @param $key String: (optional) the session key used to find the file info again. If not supplied, a key will be autogenerated.
+ * @return String: session key
*/
public function stashSession( $key = null ) {
return $this->stashSessionFile( $key )->getSessionKey();
* 'metadata' was requested. Oddly, we have to pass the "result" object down just so it can do that
* with the appropriate format, presumably.
*
- * @param {ApiResult}
- * @return {Array} image info
+ * @param $result ApiResult:
+ * @return Array: image info
*/
public function getImageInfo( $result ) {
$file = $this->getLocalFile();
/**
* Helper function -- remove files and associated articles by Title
- * @param {Title} title to be removed
+ * @param $title Title: title to be removed
*/
public function deleteFileByTitle( $title ) {
if ( $title->exists() ) {
/**
* Helper function -- remove files and associated articles with a particular filename
- * @param {String} filename to be removed
+ * @param $fileName String: filename to be removed
*/
public function deleteFileByFileName( $fileName ) {
return $this->deleteFileByTitle( Title::newFromText( $fileName, NS_FILE ) );
/**
* Helper function -- given a file on the filesystem, find matching content in the db (and associated articles) and remove them.
- * @param {String} path to file on the filesystem
+ * @param $filePath String: path to file on the filesystem
*/
public function deleteFileByContent( $filePath ) {
$hash = File::sha1Base36( $filePath );
/**
* Fake an upload by dumping the file into temp space, and adding info to $_FILES.
* (This is what PHP would normally do).
- * @param {String}: fieldname - name this would have in the upload form
- * @param {String}: fileName - name to title this
- * @param {String}: mime type
- * @param {String}: filePath - path where to find file contents
+ * @param $fieldName String: name this would have in the upload form
+ * @param $fileName String: name to title this
+ * @param $type String: mime type
+ * @param $filePath String: path where to find file contents
*/
function fakeUploadFile( $fieldName, $fileName, $type, $filePath ) {
$tmpName = tempnam( wfTempDir(), "" );
/**
* Writes random images with random filenames to disk in the directory you specify, or current working directory
*
- * @param {Integer} number of filenames to write
- * @param {String} format, optional, must be understood by ImageMagick, such as 'jpg' or 'gif'
- * @param {String} directory, optional (will default to current working directory)
- * @return {Array} filenames we just wrote
+ * @param $number Integer: number of filenames to write
+ * @param $format String: optional, must be understood by ImageMagick, such as 'jpg' or 'gif'
+ * @param $dir String: directory, optional (will default to current working directory)
+ * @return Array: filenames we just wrote
*/
function writeImages( $number, $format = 'jpg', $dir = null ) {
$filenames = $this->getRandomFilenames( $number, $format, $dir );
* Return a number of randomly-generated filenames
* Each filename uses two words randomly drawn from the dictionary, like elephantine_spatula.jpg
*
- * @param {Integer} number of filenames to generate
- * @param {String} extension, optional, defaults to 'jpg'
- * @param {String} directory, optional, defaults to current working directory
- * @return {Array} of filenames
+ * @param $number Integer: of filenames to generate
+ * @param $extension String: optional, defaults to 'jpg'
+ * @param $dir String: optional, defaults to current working directory
+ * @return Array: of filenames
*/
private function getRandomFilenames( $number, $extension = 'jpg', $dir = null ) {
if ( is_null( $dir ) ) {
/**
* Get an array of random pairs of random words, like array( array( 'foo', 'bar' ), array( 'quux', 'baz' ) );
*
- * @param {Integer} number of pairs
- * @return {Array} of two-element arrays
+ * @param $number Integer: number of pairs
+ * @return Array: of two-element arrays
*/
private function getRandomWordPairs( $number ) {
$lines = $this->getRandomLines( $number * 2 );
*
* Will throw exception if the file could not be read or if it had fewer lines than requested.
*
- * @param {Integer} number of lines desired
- * @string {String} path to file
- * @return {Array} of exactly n elements, drawn randomly from lines the file
+ * @param $number_desired Integer: number of lines desired
+ * @return Array: of exactly n elements, drawn randomly from lines the file
*/
private function getRandomLines( $number_desired ) {
$filepath = $this->dictionaryFile;