private function checkMemoryLimit()
    {
        if (function_exists('ini_get')) {
            /**
             * Note that this calculation is incorrect for memory limits that
             * exceed the value range of the underlying platform's native
             * integer.
             * In practice, we will get away with it, because it doesn't make
             * sense to configure PHP's memory limit to half the addressable
             * RAM (2 GB on a typical 32-bit system).
             */
            $memoryInBytes = function ($value) {
                    $unit = strtolower(substr($value, -1, 1));
                    $value = (int) $value;
                    switch ($unit) {
                        case 'g':
                            $value *= 1024 * 1024 * 1024;
                            break;
                        case 'm':
                            $value *= 1024 * 1024;
                            break;
                        case 'k':
                            $value *= 1024;
                            break;
                    }

                    return $value;
                };

            $memoryLimit = trim(ini_get('memory_limit'));
            // Increase memory_limit if it is lower than 512M
            if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 512 * 1024 * 1024) {
                trigger_error("Configured memory limit ($memoryLimit) is lower " .
                              "than 512M; composer-wrapper may not work " .
                              "correctly. Consider increasing PHP's " .
                              "memory_limit to at least 512M.",
                              E_USER_NOTICE);
            }
        }

    }
private function checkMemoryLimit()
    {
        if (function_exists('ini_get')) {
            /**
             * Note that this calculation is incorrect for memory limits that
             * exceed the value range of the underlying platform's native
             * integer.
             * In practice, we will get away with it, because it doesn't make
             * sense to configure PHP's memory limit to half the addressable
             * RAM (2 GB on a typical 32-bit system).
             */
            $memoryInBytes = function ($value) {
                    $unit = strtolower(substr($value, -1, 1));
                    $value = (int) $value;
                    switch ($unit) {
                        case 'g':
                            $value *= 1024 * 1024 * 1024;
                            break;
                        case 'm':
                            $value *= 1024 * 1024;
                            break;
                        case 'k':
                            $value *= 1024;
                            break;
                    }

                    return $value;
                };

            $memoryLimit = trim(ini_get('memory_limit'));
            // Increase memory_limit if it is lower than 512M
            if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 512 * 1024 * 1024) {
                trigger_error("Configured memory limit ($memoryLimit) is lower " .
                              "than 512M; composer-wrapper may not work " .
                              "correctly. Consider increasing PHP's " .
                              "memory_limit to at least 512M.",
                              E_USER_NOTICE);
            }
        }

    }
private function checkMemoryLimit ( ) { if ( function_exists ( 'ini_get' ) ) { /**
             * Note that this calculation is incorrect for memory limits that
             * exceed the value range of the underlying platform's native
             * integer.
             * In practice, we will get away with it, because it doesn't make
             * sense to configure PHP's memory limit to half the addressable
             * RAM (2 GB on a typical 32-bit system).
             */ $ memoryInBytes = function ( $ value ) { $ unit = strtolower ( substr ( $ value , - 1 , 1 ) ) ; $ value = ( int ) $ value ; switch ( $ unit ) { case 'g' : $ value *= 1024 * 1024 * 1024 ; break ; case 'm' : $ value *= 1024 * 1024 ; break ; case 'k' : $ value *= 1024 ; break ; } return $ value ; } ; $ memoryLimit = trim ( ini_get ( 'memory_limit' ) ) ; // Increase memory_limit if it is lower than 512M if ( $ memoryLimit != - 1 && $ memoryInBytes ( $ memoryLimit ) < 512 * 1024 * 1024 ) { trigger_error ( "Configured memory limit ($memoryLimit) is lower " . "than 512M; composer-wrapper may not work " . "correctly. Consider increasing PHP's " . "memory_limit to at least 512M." , E_USER_NOTICE ) ; } } }
Check whether the current setup meets the minimum memory requirements
for composer; raise a notice if not.
Check whether the current setup meets the minimum memory requirements for composer ; raise a notice if not .