php

Found 8 quotes in php.

Replaces with spaces the braces

Replaces with spaces the braces in cases where braces in places cause stasis


// Replaces with spaces the braces in cases where braces in places cause stasis 
$str = str_replace(array("\{","\}")," ",$str);

Fresh Data By Asking Propel 2 Times

Yes, why not asking the database two times for a contact? Keeping it fresh!


if(is_object(KontaktPeer::retrieveByPK($request->getParameter('contact_id')))) {
  $this->contact = KontaktPeer::retrieveByPK($request->getParameter('contact_id'));
} else {
  $this->redirect('@contact_index');
}

Controller method that does a lot - eh not.

Function was found in an abstract controller class.



/**
 * @param array $data
 *
 * @return array
 */
protected function viewResponse(array $data = [])
{
    return $data;
}

Converts a time HH:MM:SS into seconds

Converts a time HH:MM:SS in seconds


/**
 * Converts a time HH:MM:SS into seconds
 *
 * @param  string $time
 * @return integer
 */
function convertGermanTimeToSeconds($time) {

  list($hours, $minutes) = explode(':', $time);
  return ((int) $hours * 60 * 60 + (int) $minutes * 60);
}

12 is my lucky number

This isn't the right way to deal with this, but today is my last day!


/*
 * This isn't the right way to deal with this, but today is my last day, Ron
 * just spilled coffee on my desk, and I'm hungry, so this will have to do...
 */

return 12; // 12 is my lucky number

Double check int and null, safety first!

Double check ftw! Check if it's a integer AND if it's not null. Yip!


if(is_int(intval($category)) && null !== $category) {
    $topicFacade=newPage_Helper_Facade();
    $topic=$topicFacade->getTopicById($category);
    $topicUrl=$topic->getUrl();
}

Always returns true

Always returns true


/**
 * Always returns true.
 */
public boolean isAvailable() {
    return false;
}

PHP MySQL Date Convert

Convert german date field into "MySQL Date"


/**
 * Converts Date Field from dd.mm.yyyy to yyyy-mm-dd or yyyy-mm-dd hh:ii:ss
 *
 * @param  string  $date
 * @param  boolean $with_time
 * @return string  mysql-fitting date
 */
function generateMySQLDate($date, $with_time) {

  if($with_time) :

    $buffer = explode(' ', $date);
    $date   = explode('.', $buffer[0]);
    $time   = explode(':', $buffer[1]);
    return $buffer[2].'-'.$buffer[1].'-'.$buffer[0].' '.$time[0].':'.$time[1].':'.$time[2];
  else :

    $buffer = explode('.', $date);
    return $buffer[2].'-'.$buffer[1].'-'.$buffer[0];
  endif;
}