Add

@param string $line
@return bool
519286
public function add($line)
    {
        $array = preg_split('/\s+/', $line, 2);
        $parts = array_map('trim', explode('/', $array[0]));
        if (count($parts) != 2) {
            return false;
        }
        $unit = strtolower(substr(preg_replace('/[^A-Za-z]/', '', filter_var($parts[1], FILTER_SANITIZE_STRING)), 0, 1));
        $multiplier = isset($this->units[$unit]) ? $this->units[$unit] : 1;

        $rate = (int)abs(filter_var($parts[0], FILTER_SANITIZE_NUMBER_INT));
        $time = $multiplier * (int)abs(filter_var($parts[1], FILTER_SANITIZE_NUMBER_INT));

        $result = [
            'rate' => $time / $rate,
            'ratio' => $this->getRatio($rate, $time),
            'from' => null,
            'to' => null,
        ];
        if (!empty($array[1]) &&
            ($times = $this->draftParseTime($array[1])) !== false
        ) {
            $result = array_merge($result, $times);
        }
        $this->requestRates[] = $result;
        return true;
    }
1248332
def add_line(self, line):
        
        if not self.is_valid_line(line):
            logger.warn(
                "Invalid line for %s section: '%s'",
                self.section_name, line
            )
            return

        self.lines.append(line)
1302715
private function appendLine(?string $line, bool $trim): void
  {
    if ($line===null) return;

    if ($trim) $line = trim($line);

    $this->lines[] = $line;
  }
505853
public function append($line, $newline = true, $indentOffset = 0)
    {
        $line = trim($line);
        if (strlen($line) > 0) {
            parent::append(
                self::COMMENT_LINE_PREFIX . ' ' . $line, $newline, $indentOffset
            );
        } else {
            parent::append(
                self::COMMENT_LINE_PREFIX, $newline, $indentOffset
            );
        }
        return $this;
    }
87253
private function addName(string $line)
    {
        $this->definition[self::PROPERTIES_LABEL]['name'] = trim(str_replace('#', '', $line));
    }
1028686
private function isComment($line)
    {
        // if it's an empty line you might as well skip it
        if (empty($line)) return true;

        $is_comment = false;

        foreach ($this->_comment_character_list as $comment_char) {
            $line = trim($line);
            if (strpos($line, $comment_char) !== false && strpos($line, $comment_char) <= 3) {
                $is_comment = true;
                break;
            }
        }

        return $is_comment;
    }
1229890
public function appendToLine($originalLine, array $lines)
    {
        // Why is this one method different to the rest?
        $originalLine++;

        $this->buffer->insert($this->createLineNumber($originalLine), $lines);
    }
419639
public function parse($line)
    {
        $this->error = false;
        $this->currentTextLineContainer = $this->textLineContainers[$this->config->defaultTextLineContainer];
        $firsttag = clone ($this->currentTextLineContainer->tag);

        $this->str = preg_split($this->currentTextLineContainer->pattern, $line, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
        $this->end = count($this->str);

        if ($this->end > 1) {
            $pos = -1;
            $this->_parse($firsttag, $pos);

            return $firsttag->getContent();
        } else {
            $firsttag->addContentString($line);

            return $firsttag->getContent();
        }
    }
1201876
protected function processLine($line)
    {
        if ($line === '') {
            $this->handleBlankLine();
            return;
        }

        $this->justNewEntry = false;

        $data = $this->parseLine($line);

        if ($data['key'][0] === '#') {
            $this->handleComment($data);
            return;
        }

        $this->handleOtherCases($data, $line);
    }
126287
public function with($line)
    {
        if ($line instanceof Action) {
            $this->action($line->text, $line->url);
        } else if (is_null($this->actionText)) {
            $this->introLines[] = $this->format($line);
        } else {
            $this->outroLines[] = $this->format($line);
        }

        return $this;
    }
1333326
public static function add($thread)
    {
        if (Podium::getInstance()->user->isGuest) {
            return false;
        }
        $sub = new Subscription();
        $sub->thread_id = $thread;
        $sub->user_id = User::loggedId();
        $sub->post_seen = self::POST_SEEN;
        return $sub->save();
    }
1123459
private function indentationModeSwitch(string $line): int
  {
    $mode = 0;

    if (substr($line, 0, 5)=='case ')
    {
      $mode |= self::C_INDENT_INCREMENT_AFTER;
    }

    if (substr($line, 0, 8)=='default:')
    {
      $this->defaultLevel[] = 0;

      $mode |= self::C_INDENT_INCREMENT_AFTER;
    }

    if (substr($line, 0, 6)=='break;')
    {
      $mode |= self::C_INDENT_DECREMENT_AFTER;
    }

    return $mode;
  }
551890
private function writeLine($line)
    {
        $this->text .= str_repeat(' ', $this->indent * 4);
        $this->text .= $line;
        $this->text .= PHP_EOL;
    }
705700
private function doSkip(string $line): bool
    {
        switch (true) {
            case (empty(trim($line))):
                // empty line
                $skip = true;
                break;
            case (1 == preg_match('/(#[\s\w]+)/', $line)):
                if (1 === $this->linecountOverall) {
                    $this->addName($line);
                }
                $skip = true;
                break;
            default:
                $skip = false;
        }

        return $skip;
    }
381462
public function pushListLine($line, $flush = false)
    {
        if (trim($line)) {
            $infos = $this->parseListLine($line);

            if ($infos) {
                if ($this->lineInfo) {
                    $this->lineInfo['text'] = $this->createSpan($this->lineInfo['text']);
                    $this->buffer->addLine($this->lineInfo);
                }
                $this->lineInfo = $infos;
            } else {
                if ($this->listFlow || $line[0] == ' ') {
                    $this->lineInfo['text'][] = $line;
                } else {
                    $flush = true;
                }
            }
            $this->listFlow = true;
        } else {
            $this->listFlow = false;
        }

        if ($flush) {
            if ($this->lineInfo) {
                $this->lineInfo['text'] = $this->createSpan($this->lineInfo['text']);
                $this->buffer->addLine($this->lineInfo);
                $this->lineInfo = null;
            }

            return false;
        }

        return true;
    }
420053
protected function addLine($line)
	{
		$ignoreLen = 0;

		if (!isset($this->table))
		{
			$this->table = [];

			// Make the table start at the first non-space character
			preg_match('/^ */', $line, $m);
			$ignoreLen = strlen($m[0]);
			$line      = substr($line, $ignoreLen);
		}

		// Overwrite the outermost pipes
		$line = preg_replace('/^( *)\\|/', '$1 ', $line);
		$line = preg_replace('/\\|( *)$/', ' $1', $line);

		$this->table['rows'][] = ['line' => $line, 'pos' => $this->pos + $ignoreLen];
	}
834891
public function addLine(string $line): Source
    {
        if (strpos($line, "\n") !== false) {
            throw new MultilineException(
                "New line character is forbidden in addLine method argument"
            );
        }

        $this->lines[] = $line;

        return $this;
    }