for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* SCPO Engine
*
* @package LSX Testimonials
* @author LightSpeed
* @license GPL3
* @link
* @copyright 2018 LightSpeed
*/
* Wraps your price in the currency html
* @param string $value
* @return void
function lsx_currencies_get_price_html( $value = '' ) {
$prefix = '<span class="amount lsx-currencies" ';
$value = preg_replace( '/[^0-9.]+/', '', $value );
$decimals = substr_count( $value, '.' );
if ( false !== $decimals && $decimals > 1 ) {
$decimals--;
$decimals = (int) $decimals;
$value = preg_replace( '/' . preg_quote( '.', '/' ) . '/', '', $value, $decimals );
}
$prefix .= '>';
$suffix = '</span>';
setlocale( LC_MONETARY, 'en_US' );
// Work out the other tags
$currency = '<span class="currency-icon ' . mb_strtolower( lsx_currencies()->base_currency ) . '">' . lsx_currencies()->base_currency . '</span>';
$amount = '<span class="value" data-price-' . lsx_currencies()->base_currency . '="' . trim( str_replace( 'USD', '', money_format( '%i', ltrim( rtrim( $value ) ) ) ) ) . '">' . str_replace( 'USD', '', money_format( '%i', ltrim( rtrim( $value ) ) ) ) . '</span>';
ltrim(rtrim($value))
string
double
$number
money_format()
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$amount = '<span class="value" data-price-' . lsx_currencies()->base_currency . '="' . trim( str_replace( 'USD', '', money_format( '%i', /** @scrutinizer ignore-type */ ltrim( rtrim( $value ) ) ) ) ) . '">' . str_replace( 'USD', '', money_format( '%i', ltrim( rtrim( $value ) ) ) ) . '</span>';
$price_html = '<span class="amount lsx-currencies">' . $currency . $amount . '</span>';
return $price_html;
* A shortcode to wrap a value in your content
* @param array $atts
function lsx_currency_value( $atts ) {
$a = shortcode_atts(
shortcode_atts
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$a = /** @scrutinizer ignore-call */ shortcode_atts(
array(
'value' => '0.00',
),
$atts
);
return lsx_currencies_get_price_html( $a['value'] );
lsx_currencies_get_price_html($a['value'])
null
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
add_shortcode( 'lsx_currency_value', 'lsx_currency_value' );
add_shortcode
/** @scrutinizer ignore-call */