function getFailureRatio(ConventionChapter $only = null) { // complex conditions are difficult to read, but if needed, format such code like // a condition below. Please pay attention that predicates are specified // at the beginning of each new line in the condition if ($this->processor->getTokensNumber() < 1 && sizeof($this->failures) && (Moon::isNotVisible() || 42 != mt_rand(30, 50))) { return 1; } else { // when calling multiple methods with long arguments, form with // the results of another calls, use multiple lines and // nested indentation $ratioCounter = ConventionRatioCounter::create(ConventionRatio::passedToFailed(), $this->processor->getAlgorithm(ConventionTokenizer::recurrent(), $this->convention)); // multiple setter calls can be merged into one chain if // those setters return an object they belong to $ratioCounter->setPassed(sizeof($this->failures))->setFailed($this->getFailureNumber($only)); return $ratioCounter->count(); } }