Return array of mpft names for bitfield
Return array like array(0 => 'mpftMpL', 2 => 'mpftMpP')

@param int $bitfield

@return array
328306
protected function getMpftMap($bitfield) {
		$result = array();

		// loop until last '1' bit
		$bit = 0;
		while((1 << $bit) <= $bitfield){
			if($bitfield & (1 << $bit)){
				$result[$bit] = $this->getMpftName($bit);
			}
			$bit++;
		}
		return $result;
	}
353001
private function getAddressesFromFieldInPart($field, Part $part)
    {
        $addresses = [];

        $headers = $part->getHeaders();
        if (empty($headers)) {
            return $addresses;
        }

        if (!$headers->has($field)) {
            return $addresses;
        }

        /** @var AbstractAddressList $addressList */
        $addressList = null;

        try {
            $addressList = $part->getHeader($field);
        } catch (InvalidArgumentException $e) {
            return $addresses;
        }

        if (!$addressList instanceof AbstractAddressList) {
            return $addresses;
        }

        foreach ($addressList->getAddressList() as $address) {
            $addresses[] = strtolower($address->getEmail());
        }

        return $addresses;
    }
1353793
public static function getBindFieldName(string $field): string
    {
        $field = str_replace('.', '_', $field);
        $field = str_replace('(', '', $field);
        $field = str_replace(')', '', $field);
	    $field = str_replace('*', '', $field);

	    return strtolower($field) . static::getKeyIndex();
    }
1234393
public function readBitStream($bits)
    {
        $this->readByteIfNeeded();

        $result = '';
        for ($i = 0; $i < $bits; $i++) {
            $mask = pow(2, $this->currentBitPosition);
            $result = ((($this->currentByte & $mask) === $mask) ? '1' : '0').$result;

            $this->currentBitPosition++;
            if (($i + 1) < $bits) {
                $this->readByteIfNeeded();
            }
        }

        return $result;
    }
81091
public function lists($field) {
        $result = $this->field($field)->get();
        $data   = [];
        if (!empty($result)) {
            $field = explode(',', $field);
            switch (count($field)) {
            case 1:
                foreach ($result as $row) {
                    $data[] = $row[$field[0]];
                }
                break;
            case 2:
                foreach ($result as $v) {
                    $data[$v[$field[0]]] = $v[$field[1]];
                }
                break;
            default:
                foreach ($result as $v) {
                    $data[$v[$field[0]]] = $v;
                }
                break;
            }

            return $data;
        }

        return [];
    }
1273537
protected function splitRelationField($field)
    {
        $parts = explode(':', $field);
        $partsCount = count($parts);

        return [implode('.', array_slice($parts, 0, $partsCount - 1)), $parts[$partsCount - 1]];
    }
772120
public function getFieldNames()
    {
        $names = [];

        for ($i = 0; $i < $this->countFields(); $i++) {
            $names[] = $this->getFieldName($i);
        }

        return $names;
    }
843119
public function field()
    {
        $field = $this->getConfig('field');
        if (!$this->getConfig('aliasField')) {
            return $field;
        }

        $repository = $this->manager()->getRepository();
        if (!method_exists($repository, 'aliasField')) {
            return $field;
        }

        if (is_string($field)) {
            return $repository->aliasField($field);
        }

        $return = [];
        foreach ($field as $fld) {
            $return[] = $repository->aliasField($fld);
        }

        return $return;
    }
535108
private function parseSegments($field)
    {
        $segments = explode(':', $field);

        $name = array_shift($segments);
        $type = array_shift($segments);
        $arguments = [];
        $options = $this->parseOptions($segments);

        // Do we have arguments being used here?
        // Like: string(100)
        if (preg_match('/(.+?)\(([^)]+)\)/', $type, $matches)) {
            $type = $matches[1];
            $arguments = explode(',', $matches[2]);
        }

        return compact('name', 'type', 'arguments', 'options');
    }
698541
public function getTopLeftOnBit() : ?array
    {
        $bitsOffset = 0;

        while ($bitsOffset < count($this->bits) && 0 === $this->bits[$bitsOffset]) {
            ++$bitsOffset;
        }

        if (count($this->bits) === $bitsOffset) {
            return null;
        }

        $x = intdiv($bitsOffset, $this->rowSize);
        $y = ($bitsOffset % $this->rowSize) << 5;

        $bits = $this->bits[$bitsOffset];
        $bit = 0;

        while (0 === ($bits << (31 - $bit))) {
            ++$bit;
        }

        $x += $bit;

        return [$x, $y];
    }
1135696
def to_bitfields(lens,byte_endianness=:little_endian, bits_little_endian=false)
    fields = []
    i = to_i(byte_endianness,bits_little_endian)
    for len in lens
      mask = (1<<len)-1
      fields << (i&mask)
      i >>= len
    end
    fields
  end
868459
public function fetchAllOf(string $field): array
    {
        $array = [];
        foreach ($this->fetchAllGenerator() as $record) {
            $array[] = $record[$field] ?? null;
        }

        return $array;
    }
1337081
public BitFieldArgs get(BitFieldType bitFieldType, int offset) {
        return addSubCommand(new Get(bitFieldType, false, offset));
    }
550246
private function mapToRelationshipAndAttribute(string $field): array
    {
        $rootSchema = $this->getRootSchema();
        if ($rootSchema->hasAttributeMapping($field) === true) {
            $relationship = null;
            $schema       = $rootSchema;
            $attribute    = new Attribute($field, $schema);

            return [$relationship, $attribute];
        } elseif ($rootSchema->hasRelationshipMapping($field) === true) {
            $fromSchema   = $rootSchema;
            $toSchema     = $this->getJsonSchemas()->getRelationshipSchema(get_class($fromSchema), $field);
            $relationship = new Relationship($field, $fromSchema, $toSchema);
            $attribute    = new Attribute($toSchema::RESOURCE_ID, $toSchema);

            return [$relationship, $attribute];
        } elseif (count($mightBeRelAndAttr = explode('.', $field, 2)) === 2) {
            // Last chance. It could be a dot ('.') separated relationship with an attribute.

            $mightBeRel  = $mightBeRelAndAttr[0];
            $mightBeAttr = $mightBeRelAndAttr[1];

            $fromSchema = $rootSchema;
            if ($fromSchema->hasRelationshipMapping($mightBeRel)) {
                $toSchema = $this->getJsonSchemas()->getRelationshipSchema(get_class($fromSchema), $mightBeRel);
                if ($toSchema::hasAttributeMapping($mightBeAttr) === true) {
                    $relationship = new Relationship($mightBeRel, $fromSchema, $toSchema);
                    $attribute    = new Attribute($mightBeAttr, $toSchema);

                    return [$relationship, $attribute];
                }
            }
        }

        $error = $this->createQueryError($field, static::MSG_ERR_INVALID_FIELD);
        throw new InvalidQueryParametersException($error);
    }
1006989
private function getSetterName($field)
    {
        $parts = explode('_', $field);
        array_map('ucfirst', $parts);
        $name = 'set' . implode('', $parts);

        return $name;
    }
1189356
private function versionFromBits($bits)
    {
        $version = [];
        foreach (range(0, ($bits - 1)) as $bit) {
            $version[$bit] = $this->getVersionBits()[$bit];
        }
        return $version;
    }
568351
public function getFileFieldNames()
    {
        $results = [];
        if (!isset($this->data['fields'])
            || empty($this->data['fields'])
        ) {
            return $results;
        }

        $table = $this->data['name'];
        foreach ($this->data['fields'] as $field) {
            $name = $table . '_' . $field['name'];

            if (in_array(
                $field['field']['type'],
                [
                        'file',
                        'image',
                        'filelist',
                        'imagelist'
                    ]
            )
            ) {
                $results[] = $name;
            }
        }

        return $results;
    }