Split some lines, use ===, avoid unnecessary operation

This commit is contained in:
kondou 2013-09-11 12:12:40 +02:00
parent c6ca9c1e9d
commit 83d3df4111
1 changed files with 7 additions and 5 deletions

View File

@ -19,9 +19,7 @@ $files = array();
if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) { if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $i ) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"] ); $i["date"] = OCP\Util::formatDate($i["mtime"] );
$i['mimetype_icon'] = ($i['type'] == 'dir') $i['mimetype_icon'] = \mimetype_icon('dir');
? \mimetype_icon('dir')
: \mimetype_icon($i['mimetype']);
$files[] = $i; $files[] = $i;
} }
} }
@ -30,14 +28,18 @@ if (is_array($mimetypes) && count($mimetypes)) {
foreach ($mimetypes as $mimetype) { foreach ($mimetypes as $mimetype) {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"]); $i["date"] = OCP\Util::formatDate($i["mtime"]);
$i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']); $i['mimetype_icon'] = $i['type'] === 'dir' ?
\mimetype_icon('dir') :
\mimetype_icon($i['mimetype']);
$files[] = $i; $files[] = $i;
} }
} }
} else { } else {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"]); $i["date"] = OCP\Util::formatDate($i["mtime"]);
$i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']); $i['mimetype_icon'] = $i['type'] === 'dir' ?
\mimetype_icon('dir') :
\mimetype_icon($i['mimetype']);
$files[] = $i; $files[] = $i;
} }
} }