/** * Extracts and returns the line from the query. * * @param Query $query Query * * @return string Line */ public function getLineFromQuery(Query $query) { $argument = $query->getArgument(); if (false === strpos($argument, '@')) { return null; } $arguments = explode(' ', $argument); $line = array_pop($arguments); // hack due to a possible bug in Yealink firmware // we must strip the @ char and the host from uri // otherwise the line would not be recognised by the phone $line = explode('@', $line); $line = $line[0]; return $line; }
public function testArgumentWithSpaces() { $queryString = 'call:number 0160123465789 line2'; $query = new Query($queryString); $this->assertSame('0160123465789 line2', $query->getArgument()); }