if ($this->getTestSku()) {
   ...
} elseif ($this->getTestOffset() >= 0 && $this->getTestLimit() > 0) {
   ...
} else {
   Mage::throwException(sprintf("Invalid parameters for test mode: sku %s or offset %s and limit %s", $this->getTestSku(), $this->getTestOffset(), $this->getTestLimit()));
}
By Anonymous, 2018-03-13 13:56:56
in_array($this->market, ["ru"])

There is an old mysterious legend, which says that those conditions are lightening fast which are using in_array($source, ["target"]) instead of just "==". Is says always that probably you never do code refactoring, and keep all shit alive

By Anonymous, 2018-03-12 14:47:24
/**
 * Creates hash of client/customer password
 * @param string $password The actual password
 * @return string MD5 hash of password with salt
 */
public static function hashPassword($password)
{
	return md5($password . $password. 'SOME-SECRET-STRING' . $password);
}
By Anonymous, 2018-02-21 13:22:27
<?
function null($null) {
    return null;   
}
By SH2, 2018-02-20 11:31:33
    $partnerChargesRegular = $row['charges'];
    $partnerChargesIrregular = $row['charges'];
    if (!isset($partnerChargesIrregular) || $partnerChargesIrregular == "") {
      $partnerChargesIrregular = $partnerChargesRegular;
    }

Look. We take A from X and B from X. Then, you make a check, and if it is true you assing A to B. BUT A AND B ARE TAKEN FROM THE SAME X PLACE!!! HOW CAN THEY DIFFER?!?!!!?!?!?!?!!

By My boss, 2018-02-20 10:06:53

$d = explode(".",$request->get("due_date",".."));
foreach ($d as $key => $val) $d[$key]=(int)$val;

if (
	!is_numeric($d[0]) || $d[0]<1 ||$d[0]>31 ||
	!is_numeric($d[1]) || $d[1]<1 ||$d[1]>12 ||
	!is_numeric($d[2]) || $d[2]<2005 ||$d[2]>2100 ) {
    $error["due_date"] = "Missing date.";
}

I think this was the last piece of code the developer wrote .... :D

By elpado, 2018-02-15 14:41:45
<?php 
$k =1;
for($v = 0; $v < $nt; $v++) {         
	$bgClass= 'blueBg';
		if($k > 1 && $k%2 == 0){
			$bgClass= 'whiteBg';
		}
?> 
<tr  class="row_tr <?php echo $bgClass;?>">						
			<td class="row_td td_column_0">&nbsp;</td>					
			<td class="row_td column_1"><?php echo $rows[$v]['nothing'];?></td>
			...
			<td class="row_td td_column_0">&nbsp;</td>
	</tr>

<?php       
	$k++;
	}	
?>
By Unknown, 2018-02-13 14:47:19
private static function derivePrice(...)
  {
	$price = self::derivePriceUnchecked($vars);
    
    if (isset($price)) {
		// CODE HERE
    } 

    if (isset($price)) {
		// CODE HERE
    } 
    
    if (isset($price)) {
		// CODE HERE
    }

    if (isset($price)) {
		// CODE HERE
    }

    if (isset($price)) {
		// CODE HERE
    }

    if (isset($price)) {
		// CODE HERE
    }

    if (isset($price)) {
		// CODE HERE
    }

    if (isset($price)) {
		// CODE HERE
    }

    return $price;
  }
By Anonymous, 2018-02-06 11:38:18
  $guard = ($vars->a_payment) + (0) * $price;
  if ($bless >= $guard) {
    $amount = $bless;
  }

Why not to write just 1 line?! $amount = max($bless, $vars->a_payment);

By Anonymous, 2018-02-05 17:27:25
if (isset(self::$proposals[$view])) {
      $best_proposals = [];
      $all_sources = [];
      foreach (self::$proposals[$view] as $proposal_source => $proposal) {
        if (!isset($this->backend_branch) || substr($this->backend_branch, 0, 11) != "adjust-for:" || substr($this->backend_branch, 11) == $proposal_source) {
          if ($proposal['orig_base'] == $curr_base || $relax_checking) {
            $age = time() - $proposal['updated_at'];
            if ($age < self::MAX_AGE) {
              foreach ($proposal['proposals'] as $proposal_label => $proposal_price) {
                if (!in_array($proposal_label, [self::SK_LABEL_AVIASALES, self::SK_LABEL_SKYSCANNER, self::SK_LABEL_YANDEX, self::SK_LABEL_MOMONDO])) {
                  $proposal_key = $proposal_label;
                  if (!isset($best_proposals[$proposal_key]) || $best_proposals[$proposal_key]['price'] > $proposal_price) {
                    $best_proposals[$proposal_key] = [
                      'price' => $proposal_price,
                      'name' => $proposal_price . "@" . implode("~", array_map(function ($part) {
                          return preg_replace('/[~|=#@ ]/', '_', $part);
                        }, [
                          'label' => $proposal_label,
                          'source' => $proposal_source,
                        ])),
                      'age' => $age,
                    ];
                    $all_sources[$proposal_source] = null;
                  }
                }
              }
            }
          }
        }
      }
By Anonymous, 2018-01-24 12:49:44
if ( $ordinal_competitors > 0 ) {
	foreach( $ordinal_bests as $label => $tuple ) {
		unset( $waste[ $tuple['id']->{ '$id' } ] );
		$essential[ $search_str ][ $tuple['stamp'] ][ $tuple['source'] ]['updated_at'] = $tuple['updated'];
		$essential[ $search_str ][ $tuple['stamp'] ][ $tuple['source'] ]['proposals'][ $label ] = $tuple['price'];
		$final_count ++;
	}
}
  • So, you've called the variable "tuple"
  • Yes
  • What is tuple?
  • Eeeemmm...
  • You don't know. Me too, but my experience said that tuple is a collection, of N-arity where you can't ask by key and give exception, what data structure is placed here?
  • F..ing.. ph.. arr...
  • I can't hear you girl!
  • Fucking php array
  • So why did you call fucking php array a tuple?
  • I do not know...
  • Go f...ck yourself
By Anonymous, 2018-01-22 10:32:32
$config = Config::getConfig('common');
$contract_carriers = $config[$market . "_" . $clearing . '_contract_carriers']; // f**ing php array
$interline_carriers = $config[$market . "_" . $clearing . '_interline_carriers']; // another f**ing array
// $marketing_carriers - is also array

$sets = [];
foreach ($marketing_carriers as $mc) {
  $sets[] = array_unique(array_intersect(
    array_merge(
      [$mc],
      array_intersect(
        isset(self::$interlines[$mc]) ? self::$interlines[$mc] : [],
        array_merge(
          $marketing_carriers,
          $interline_carriers
        )
      )
    ),
    $contract_carriers
  ));
}
By Anonymous, 2018-01-16 10:56:13
if ($customerId > 0) {
    $customerId = $customerId;
} else {
    $customerId = $this->customerSession->getId();
}
By Anonymous, 2018-01-10 16:42:14
    foreach ($desired_components as $name => $junk) {
      list($component_value, $component_comments) = self::unpackPair($desired_components[$name]);
      $desired_components[$name] = self::packPair(round($component_value, 2), $component_comments);
    }
By Anonymous, 2018-01-10 09:01:18
$url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22https%3A%2F%2Fwww.google.com%2Ffinance%3Fq%3D' . $stock_identifier . '%26fstype%3Dii%26ei%3DCFrdWImFNdiGe_atlegC%22%20and%20compat%3D%22html5%22%20and%20xpath%3D' . "'%2F%2Ftable%5Bcontains(%40class%2C%22gf-table%20rgt%22)%5D'" . '&format=json&diagnostics=true&callback=';

$json = json_decode($this->getJsonFromYql($url), true);
$json = $json["query"]["results"]["table"];

//If the value is red, that means there is an additional span class which needs to be checked through. 

$response["revanueValue"] = empty($json["1"]["tbody"]["tr"]["0"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["0"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["0"]["td"]["1"]["content"];
$response["costofRevanue"] = $json["1"]["tbody"]["tr"]["3"]["td"]["1"]["content"];
$response["operatingIncome"] = empty($json["1"]["tbody"]["tr"]["12"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["12"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["12"]["td"]["1"]["content"];
$response["netIncome"] = empty($json["1"]["tbody"]["tr"]["24"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["24"]["td"]["1"]["span"]["content"] : $json["0"]["tbody"]["tr"]["24"]["td"]["1"]["content"];
$response["dividendsPerShare"] = $json["1"]["tbody"]["tr"]["35"]["td"]["1"]["content"];
$response["dilutedNormalizedEps"] = empty($json["1"]["tbody"]["tr"]["48"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["48"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["48"]["td"]["1"]["content"];
$response["minorityInterest"] = $json["1"]["tbody"]["tr"]["18"]["td"]["1"]["content"];

Website --> Json --> PHP Parsing Beautiful.

By Great PHP User, 2018-01-01 01:58:30