LESS embeddable(): Use lessc::toBool
authorOri Livneh <ori@wikimedia.org>
Fri, 4 Oct 2013 00:50:45 +0000 (17:50 -0700)
committerOri Livneh <ori@wikimedia.org>
Fri, 4 Oct 2013 00:53:36 +0000 (17:53 -0700)
With Ib6bc76736 in place, we have access to lessphp's custom function helpers,
which provide some nice encapsulation for interpreter internals like boolean
nodes. This patch makes embeddable() call $less->toBool() rather than construct
its own AST nodes.

Change-Id: I0a015564dff19f5ced764af182558eb351e3d816

includes/resourceloader/ResourceLoaderLESSFunctions.php

index 08d574c..c7570f6 100644 (file)
@@ -39,11 +39,10 @@ class ResourceLoaderLESSFunctions {
                $base = pathinfo( $less->parser->sourceName, PATHINFO_DIRNAME );
                $url = $frame[2][0];
                $file = realpath( $base . '/' . $url );
-               $embeddable = ( $file
+               return $less->toBool( $file
                        && strpos( $url, '//' ) === false
                        && filesize( $file ) < CSSMin::EMBED_SIZE_LIMIT
-                       && CSSMin::getMimeType( $file ) !== false ) ? 'true' : 'false';
-               return array( 'keyword', $embeddable );
+                       && CSSMin::getMimeType( $file ) !== false );
        }
 
        /**