composer.phar 2.6 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917121918121919121920121921121922121923121924121925121926121927121928121929121930121931121932121933121934121935121936121937121938121939121940121941121942121943121944121945121946121947121948121949121950121951121952121953121954121955121956121957121958121959121960121961121962121963121964121965121966121967121968121969121970121971121972121973121974121975121976121977121978121979121980121981121982121983121984121985121986121987121988121989121990121991121992121993121994121995121996121997121998121999122000122001122002122003122004122005122006122007122008122009122010122011122012122013122014122015122016122017122018122019122020122021122022122023122024122025122026122027122028122029122030122031122032122033122034122035122036122037122038122039122040122041122042122043122044122045122046122047122048122049122050122051122052122053122054122055122056122057122058122059122060122061122062122063122064122065122066122067122068122069122070122071122072122073122074122075122076122077122078122079122080122081122082122083122084122085122086122087122088122089122090122091122092122093122094122095122096122097122098122099122100122101122102122103122104122105122106122107122108122109122110122111122112122113122114122115122116122117122118122119122120122121122122122123122124122125122126122127122128122129122130122131122132122133122134122135122136122137122138122139122140122141122142122143122144122145122146122147122148122149122150122151122152122153122154122155122156122157122158122159122160122161122162122163122164122165122166122167122168122169122170122171122172122173122174122175122176122177122178122179122180122181122182122183122184122185122186122187122188122189122190122191122192122193122194122195122196122197122198122199122200122201122202122203122204122205122206122207122208122209122210122211122212122213122214122215122216122217122218122219122220122221122222122223122224122225122226122227122228122229122230122231122232122233122234122235122236122237122238122239122240122241122242122243122244122245122246122247122248122249122250122251122252122253122254122255122256122257122258122259122260122261122262122263122264122265122266122267122268122269122270122271122272122273122274122275122276122277122278122279122280122281122282122283122284122285122286122287122288122289122290122291122292122293122294122295122296122297122298122299122300122301122302122303122304122305122306122307122308122309122310122311122312122313122314122315122316122317122318122319122320122321122322122323122324122325122326122327122328122329122330122331122332122333122334122335122336122337122338122339122340122341122342122343122344122345122346122347122348122349122350122351122352122353122354122355122356122357122358122359122360122361122362122363122364122365122366122367122368122369122370122371122372122373122374122375122376122377122378122379122380122381122382122383122384122385122386122387122388122389122390122391122392122393122394122395122396122397122398122399122400122401122402122403122404122405122406122407122408122409122410122411122412122413122414122415122416122417122418122419122420122421122422122423122424122425122426122427122428122429122430122431122432122433122434122435122436122437122438122439122440122441122442122443122444122445122446122447122448122449122450122451122452122453122454122455122456122457122458122459122460122461122462122463122464122465122466122467122468122469122470122471122472122473122474122475122476122477122478122479122480122481122482122483122484122485122486122487122488122489122490122491122492122493122494122495122496122497122498122499122500122501122502122503122504122505122506122507122508122509122510122511122512122513122514122515122516122517122518122519122520122521122522122523122524122525122526122527122528122529122530122531122532122533122534122535122536122537122538122539122540122541122542122543122544122545122546122547122548122549122550122551122552122553122554122555122556122557122558122559122560122561122562122563122564122565122566122567122568122569122570122571122572122573122574122575122576122577122578122579122580122581122582122583122584122585122586122587122588122589122590122591122592122593122594122595122596122597122598122599122600122601122602122603122604122605122606122607122608122609122610122611122612122613122614122615122616122617122618122619122620122621122622122623122624122625122626122627122628122629122630122631122632122633122634122635122636122637122638122639122640122641122642122643122644122645122646122647122648122649122650122651122652122653122654122655122656122657122658122659122660122661122662122663122664122665122666122667122668122669122670122671122672122673122674122675122676122677122678122679122680122681122682122683122684122685122686122687122688122689122690122691122692122693122694122695122696122697122698122699122700122701122702122703122704122705122706122707122708122709122710122711122712122713122714122715122716122717122718122719122720122721122722122723122724122725122726122727122728122729122730122731122732122733122734122735122736122737122738122739122740122741122742122743122744122745122746122747122748122749122750122751122752122753122754122755122756122757122758122759122760122761122762122763122764122765122766122767122768122769122770122771122772122773122774122775122776122777122778122779122780122781122782122783122784122785122786122787122788122789122790122791122792122793122794122795122796122797122798122799122800122801122802122803122804122805122806122807122808122809122810122811122812122813122814122815122816122817122818122819122820122821122822122823122824122825122826122827122828122829122830122831122832122833122834122835122836122837122838122839122840122841122842122843122844122845122846122847122848122849122850122851122852122853122854122855122856122857122858122859122860122861122862122863122864122865122866122867122868122869122870122871122872122873122874122875122876122877122878122879122880122881122882122883122884122885122886122887122888122889122890122891122892122893122894122895122896122897122898122899122900122901122902122903122904122905122906122907122908122909122910122911122912122913122914122915122916122917122918122919122920122921122922122923122924122925122926122927122928122929122930122931122932122933122934122935122936122937122938122939122940122941122942122943122944122945122946122947122948122949122950122951122952122953122954122955122956122957122958122959122960122961122962122963122964122965122966122967122968122969122970122971122972122973122974122975122976122977122978122979122980122981122982122983122984122985122986122987122988122989122990122991122992122993122994122995122996122997122998122999123000123001123002123003123004123005123006123007123008123009123010123011123012123013123014123015123016123017123018123019123020123021123022123023123024123025123026123027123028123029123030123031123032123033123034123035123036123037123038123039123040123041123042123043123044123045123046123047123048123049123050123051123052123053123054123055123056123057123058123059123060123061123062123063123064123065123066123067123068123069123070123071123072123073123074123075123076123077123078123079123080123081123082123083123084123085123086123087123088123089123090123091123092123093123094123095123096123097123098123099123100123101123102123103123104123105123106123107123108123109123110123111123112123113123114123115123116123117123118123119123120123121123122123123123124123125123126123127123128123129123130123131123132123133123134123135123136123137123138123139123140123141123142123143123144123145123146123147123148123149123150123151123152123153123154123155123156123157123158123159123160123161123162123163123164123165123166123167123168123169123170123171123172123173123174123175123176123177123178123179123180123181123182123183123184123185123186123187123188123189123190123191123192123193123194123195123196123197123198123199123200123201123202123203123204123205123206123207123208123209123210123211123212123213123214123215123216123217123218123219123220123221123222123223123224123225123226123227123228123229123230123231123232123233123234123235123236123237123238123239123240123241123242123243123244123245123246123247123248123249123250123251123252123253123254123255123256123257123258123259123260123261123262123263123264123265123266123267123268123269123270123271123272123273123274123275123276123277123278123279123280123281123282123283123284123285123286123287123288123289123290123291123292123293123294123295123296123297123298123299123300123301123302123303123304123305123306123307123308123309123310123311123312123313123314123315123316123317123318123319123320123321123322123323123324123325123326123327123328123329123330123331123332123333123334123335123336123337123338123339123340123341123342123343123344123345123346123347123348123349123350123351123352123353123354123355123356123357123358123359123360123361123362123363123364123365123366123367123368123369123370123371123372123373123374123375123376123377123378123379123380123381123382123383123384123385123386123387123388123389123390123391123392123393123394123395123396123397123398123399123400123401123402123403123404123405123406123407123408123409123410123411123412123413123414123415123416123417123418123419123420123421123422123423123424123425123426123427123428123429123430123431123432123433123434123435123436123437123438123439123440123441123442123443123444123445123446123447123448123449123450123451123452123453123454123455123456123457123458123459123460123461123462123463123464123465123466123467123468123469123470123471123472123473123474123475123476123477123478123479123480123481123482123483123484123485123486123487123488123489123490123491123492123493123494123495123496123497123498123499123500123501123502123503123504123505123506123507123508123509123510123511123512123513123514123515123516123517123518123519123520123521123522123523123524123525123526123527123528123529123530123531123532123533123534123535123536123537123538123539123540123541123542123543123544123545123546123547123548123549123550123551123552123553123554123555123556123557123558123559123560123561123562123563123564123565123566123567123568123569123570123571123572123573123574123575123576123577123578123579123580123581123582123583123584123585123586123587123588123589123590123591123592123593123594123595123596123597123598123599123600123601123602123603123604123605123606123607123608123609123610123611123612123613123614123615123616123617123618123619123620123621123622123623123624123625123626123627123628123629123630123631123632123633123634123635123636123637123638123639123640123641123642123643123644123645123646123647123648123649123650123651123652123653123654123655123656123657123658123659123660123661123662123663123664123665123666123667123668123669123670123671123672123673123674123675123676123677123678123679123680123681123682123683123684123685123686123687123688123689123690123691123692123693123694123695123696123697123698123699123700123701123702123703123704123705123706123707123708123709123710123711123712123713123714123715123716123717123718123719123720123721123722123723123724123725123726123727123728123729123730123731123732123733123734123735123736123737123738123739123740123741123742123743123744123745123746123747123748123749123750123751123752123753123754123755123756123757123758123759123760123761123762123763123764123765123766123767123768123769123770123771123772123773123774123775123776123777123778123779123780123781123782123783123784123785123786123787123788123789123790123791123792123793123794123795123796123797123798123799123800123801123802123803123804123805123806123807123808123809123810123811123812123813123814123815123816123817123818123819123820123821123822123823123824123825123826123827123828123829123830123831123832123833123834123835123836123837123838123839123840123841123842123843123844123845123846123847123848123849123850123851123852123853123854123855123856123857123858123859123860123861123862123863123864123865123866123867123868123869123870123871123872123873123874123875123876123877123878123879123880123881123882123883123884123885123886123887123888123889123890123891123892123893123894123895123896123897123898123899123900123901123902123903123904123905123906123907123908123909123910123911123912123913123914123915123916123917123918123919123920123921123922123923123924123925123926123927123928123929123930123931123932123933123934123935123936123937123938123939123940123941123942123943123944123945123946123947123948123949123950123951123952123953123954123955123956123957123958123959123960123961123962123963123964123965123966123967123968123969123970123971123972123973123974123975123976123977123978123979123980123981123982123983123984123985123986123987123988123989123990123991123992123993123994123995123996123997123998123999124000124001124002124003124004124005124006124007124008124009124010124011124012124013124014124015124016124017124018124019124020124021124022124023124024124025124026124027124028124029124030124031124032124033124034124035124036124037124038124039124040124041124042124043124044124045124046124047124048124049124050124051124052124053124054124055124056124057124058124059124060124061124062124063124064124065124066124067124068124069124070124071124072124073124074124075124076124077124078124079124080124081124082124083124084124085124086124087124088124089124090124091124092124093124094124095124096124097124098124099124100124101124102124103124104124105124106124107124108124109124110124111124112124113124114124115124116124117124118124119124120124121124122124123124124124125124126124127124128124129124130124131124132124133124134124135124136124137124138124139124140124141124142124143124144124145124146124147124148124149124150124151124152124153124154124155124156124157124158124159124160124161124162124163124164124165124166124167124168124169124170124171124172124173124174124175124176124177124178124179124180124181124182124183124184124185124186124187124188124189124190124191124192124193124194124195124196124197124198124199124200124201124202124203124204124205124206124207124208124209124210124211124212124213124214124215124216124217124218124219124220124221124222124223124224124225124226124227124228124229124230124231124232124233124234124235124236124237124238124239124240124241124242124243124244124245124246124247124248124249124250124251124252124253124254124255124256124257124258124259124260124261124262124263124264124265124266124267124268124269124270124271124272124273124274124275124276124277124278124279124280124281124282124283124284124285124286124287124288124289124290124291124292124293124294124295124296124297124298124299124300124301124302124303124304124305124306124307124308124309124310124311124312124313124314124315124316124317124318124319124320124321124322124323124324124325124326124327124328124329124330124331124332124333124334124335124336124337124338124339124340124341124342124343124344124345124346124347124348124349124350124351124352124353124354124355124356124357124358124359124360124361124362124363124364124365124366124367124368124369124370124371124372124373124374124375124376124377124378124379124380124381124382124383124384124385124386124387124388124389124390124391124392124393124394124395124396124397124398124399124400124401124402124403124404124405124406124407124408124409124410124411124412124413124414124415124416124417124418124419124420124421124422124423124424124425124426124427124428124429124430124431124432124433124434124435124436124437124438124439124440124441124442124443124444124445124446124447124448124449124450124451124452124453124454124455124456124457124458124459124460124461124462124463124464124465124466124467124468124469124470124471124472124473124474124475124476124477124478124479124480124481124482124483124484124485124486124487124488124489124490124491124492124493124494124495124496124497124498124499124500124501124502124503124504124505124506124507124508124509124510124511124512124513124514124515124516124517124518124519124520124521124522124523124524124525124526124527124528124529124530124531124532124533124534124535124536124537124538124539124540124541124542124543124544124545124546124547124548124549124550124551124552124553124554124555124556124557124558124559124560124561124562124563124564124565124566124567124568124569124570124571124572124573124574124575124576124577124578124579124580124581124582124583124584124585124586124587124588124589124590124591124592124593124594124595124596124597124598124599124600124601124602124603124604124605124606124607124608124609124610124611124612124613124614124615124616124617124618124619124620124621124622124623124624124625124626124627124628124629124630124631124632124633124634124635124636124637124638124639124640124641124642124643124644124645124646124647124648124649124650124651124652124653124654124655124656124657124658124659124660124661124662124663124664124665124666124667124668124669124670124671124672124673124674124675124676124677124678124679124680124681124682124683124684124685124686124687124688124689124690124691124692124693124694124695124696124697124698124699124700124701124702124703124704124705124706124707124708124709124710124711124712124713124714124715124716124717124718124719124720124721124722124723124724124725124726124727124728124729124730124731124732124733124734124735124736124737124738124739124740124741124742124743124744124745124746124747124748124749124750124751124752124753124754124755124756124757124758124759124760124761124762124763124764124765124766124767124768124769124770124771124772124773124774124775124776124777124778124779124780124781124782124783124784124785124786124787124788124789124790124791124792124793124794124795124796124797124798124799124800124801124802124803124804124805124806124807124808124809124810124811124812124813124814124815124816124817124818124819124820124821124822124823124824124825124826124827124828124829124830124831124832124833124834124835124836124837124838124839124840124841124842124843124844124845124846124847124848124849124850124851124852124853124854124855124856124857124858124859124860124861124862124863124864124865124866124867124868124869124870124871124872124873124874124875124876124877124878124879124880124881124882124883124884124885124886124887124888124889124890124891124892124893124894124895124896124897124898124899124900124901124902124903124904124905124906124907124908124909124910124911124912124913124914124915124916124917124918124919124920124921124922124923124924124925124926124927124928124929124930124931124932124933124934124935124936124937124938124939124940124941124942124943124944124945124946124947124948124949124950124951124952124953124954124955124956124957124958124959124960124961124962124963124964124965124966124967124968124969124970124971124972124973124974124975124976124977124978124979124980124981124982124983124984124985124986124987124988124989124990124991124992124993124994124995124996124997124998124999125000125001125002125003125004125005125006125007125008125009125010125011125012125013125014125015125016125017125018125019125020125021125022125023125024125025125026125027125028125029125030125031125032125033125034125035125036125037125038125039125040125041125042125043125044125045125046125047125048125049125050125051125052125053125054125055125056125057125058125059125060125061125062125063125064125065125066125067125068125069125070125071125072125073125074125075125076125077125078125079125080125081125082125083125084125085125086125087125088125089125090125091125092125093125094125095125096125097125098125099125100125101125102125103125104125105125106125107125108125109125110125111125112125113125114125115125116125117125118125119125120125121125122125123125124125125125126125127125128125129125130125131125132125133125134125135125136125137125138125139125140125141125142125143125144125145125146125147125148125149125150125151125152125153125154125155125156125157125158125159125160125161125162125163125164125165125166125167125168125169125170125171125172125173125174125175125176125177125178125179125180125181125182125183125184125185125186125187125188125189125190125191125192125193125194125195125196125197125198125199125200125201125202125203125204125205125206125207125208125209125210125211125212125213125214125215125216125217125218125219125220125221125222125223125224125225125226125227125228125229125230125231125232125233125234125235125236125237125238125239125240125241125242125243125244125245125246125247125248125249125250125251125252125253125254125255125256125257125258125259125260125261125262125263125264125265125266125267125268125269125270125271125272125273125274125275125276125277125278125279125280125281125282125283125284125285125286125287125288125289125290125291125292125293125294125295125296125297125298125299125300125301125302125303125304125305125306125307125308125309125310125311125312125313125314125315125316125317125318125319125320125321125322125323125324125325125326125327125328125329125330125331125332125333125334125335125336125337125338125339125340125341125342125343125344125345125346125347125348125349125350125351125352125353125354125355125356125357125358125359125360125361125362125363125364125365125366125367125368125369125370125371125372125373125374125375125376125377125378125379125380125381125382125383125384125385125386125387125388125389125390125391125392125393125394125395125396125397125398125399125400125401125402125403125404125405125406125407125408125409125410125411125412125413125414125415125416125417125418125419125420125421125422125423125424125425125426125427125428125429125430125431125432125433125434125435125436125437125438125439125440125441125442125443125444125445125446125447125448125449125450125451125452125453125454125455125456125457125458125459125460125461125462125463125464125465125466125467125468125469125470125471125472125473125474125475125476125477125478125479125480125481125482125483125484125485125486125487125488125489125490125491125492125493125494125495125496125497125498125499125500125501125502125503125504125505125506125507125508125509125510125511125512125513125514125515125516125517125518125519125520125521125522125523125524125525125526125527125528125529125530125531125532125533125534125535125536125537125538125539125540125541125542125543125544125545125546125547125548125549125550125551125552125553125554125555125556125557125558125559125560125561125562125563125564125565125566125567125568125569125570125571125572125573125574125575125576125577125578125579125580125581125582125583125584125585125586125587125588125589125590125591125592125593125594125595125596125597125598125599125600125601125602125603125604125605125606125607125608125609125610125611125612125613125614125615125616125617125618125619125620125621125622125623125624125625125626125627125628125629125630125631125632125633125634125635125636125637125638125639125640125641125642125643125644125645125646125647125648125649125650125651125652125653125654125655125656125657125658125659125660125661125662125663125664125665125666125667125668125669125670125671125672125673125674125675125676125677125678125679125680125681125682125683125684125685125686125687125688125689125690125691125692125693125694125695125696125697125698125699125700125701125702125703125704125705125706125707125708125709125710125711125712125713125714125715125716125717125718125719125720125721125722125723125724125725125726125727125728125729125730125731125732125733125734125735125736125737125738125739125740125741125742125743125744125745125746125747125748125749125750125751125752125753125754125755125756125757125758125759125760125761125762125763125764125765125766125767125768125769125770125771125772125773125774125775125776125777125778125779125780125781125782125783125784125785125786125787125788125789125790125791125792125793125794125795125796125797125798125799125800125801125802125803125804125805125806125807125808125809125810125811125812125813125814125815125816125817125818125819125820125821125822125823125824125825125826125827125828125829125830125831125832125833125834125835125836125837125838125839125840125841125842125843125844125845125846125847125848125849125850125851125852125853125854125855125856125857125858125859125860125861125862125863125864125865125866125867125868125869125870125871125872125873125874125875125876125877125878125879125880125881125882125883125884125885125886125887125888125889125890125891125892125893125894125895125896125897125898125899125900125901125902125903125904125905125906125907125908125909125910125911125912125913125914125915125916125917125918125919125920125921125922125923125924125925125926125927125928125929125930125931125932125933125934125935125936125937125938125939125940125941125942125943125944125945125946125947125948125949125950125951125952125953125954125955125956125957125958125959125960125961125962125963125964125965125966125967125968125969125970125971125972125973125974125975125976125977125978125979125980125981125982125983125984125985125986125987125988125989125990125991125992125993125994125995125996125997125998125999126000126001126002126003126004126005126006126007126008126009126010126011126012126013126014126015126016126017126018126019126020126021126022126023126024126025126026126027126028126029126030126031126032126033126034126035126036126037126038126039126040126041126042126043126044126045126046126047126048126049126050126051126052126053126054126055126056126057126058126059126060126061126062126063126064126065126066126067126068126069126070126071126072126073126074126075126076126077126078126079126080126081126082126083126084126085126086126087126088126089126090126091126092126093126094126095126096126097126098126099126100126101126102126103126104126105126106126107126108126109126110126111126112126113126114126115126116126117126118126119126120126121126122126123126124126125126126126127126128126129126130126131126132126133126134126135126136126137126138126139126140126141126142126143126144126145126146126147126148126149126150126151126152126153126154126155126156126157126158126159126160126161126162126163126164126165126166126167126168126169126170126171126172126173126174126175126176126177126178126179126180126181126182126183126184126185126186126187126188126189126190126191126192126193126194126195126196126197126198126199126200126201126202126203126204126205126206126207126208126209126210126211126212126213126214126215126216126217126218126219126220126221126222126223126224126225126226126227126228126229126230126231126232126233126234126235126236126237126238126239126240126241126242126243126244126245126246126247126248126249126250126251126252126253126254126255126256126257126258126259126260126261126262126263126264126265126266126267126268126269126270126271126272126273126274126275126276126277126278126279126280126281126282126283126284126285126286126287126288126289126290126291126292126293126294126295126296126297126298126299126300126301126302126303126304126305126306126307126308126309126310126311126312126313126314126315126316126317126318126319126320126321126322126323126324126325126326126327126328126329126330126331126332126333126334126335126336126337126338126339126340126341126342126343126344126345126346126347126348126349126350126351126352126353126354126355126356126357126358126359126360126361126362126363126364126365126366126367126368126369126370126371126372126373126374126375126376126377126378126379126380126381126382126383126384126385126386126387126388126389126390126391126392126393126394126395126396126397126398126399126400126401126402126403126404126405126406126407126408126409126410126411126412126413126414126415126416126417126418126419126420126421126422126423126424126425126426126427126428126429126430126431126432126433126434126435126436126437126438126439126440126441126442126443126444126445126446126447126448126449126450126451126452126453126454126455126456126457126458126459126460126461126462126463126464126465126466126467126468126469126470126471126472126473126474126475126476126477126478126479126480126481126482126483126484126485126486126487126488126489126490126491126492126493126494126495126496126497126498126499126500126501126502126503126504126505126506126507126508126509126510126511126512126513126514126515126516126517126518126519126520126521126522126523126524126525126526126527126528126529126530126531126532126533126534126535126536126537126538126539126540126541126542126543126544126545126546126547126548126549126550126551126552126553126554126555126556126557126558126559126560126561126562126563126564126565126566126567126568126569126570126571126572126573126574126575126576126577126578126579126580126581126582126583126584126585126586126587126588126589126590126591126592126593126594126595126596126597126598126599126600126601126602126603126604126605126606126607126608126609126610126611126612126613126614126615126616126617126618126619126620126621126622126623126624126625126626126627126628126629126630126631126632126633126634126635126636126637126638126639126640126641126642126643126644126645126646126647126648126649126650126651126652126653126654126655126656126657126658126659126660126661126662126663126664126665126666126667126668126669126670126671126672126673126674126675126676126677126678126679126680126681126682126683126684126685126686126687126688126689126690126691126692126693126694126695126696126697126698126699126700126701126702126703126704126705126706126707126708126709126710126711126712126713126714126715126716126717126718126719126720126721126722126723126724126725126726126727126728126729126730126731126732126733126734126735126736126737126738126739126740126741126742126743126744126745126746126747126748126749126750126751126752126753126754126755126756126757126758126759126760126761126762126763126764126765126766126767126768126769126770126771126772126773126774126775126776126777126778126779126780126781126782126783126784126785126786126787126788126789126790126791126792126793126794126795126796126797126798126799126800126801126802126803126804126805126806126807126808126809126810126811126812126813126814126815126816126817126818126819126820126821126822126823126824126825126826126827126828126829126830126831126832126833126834126835126836126837126838126839126840126841126842126843126844126845126846126847126848126849126850126851126852126853126854126855126856126857126858126859126860126861126862126863126864126865126866126867126868126869126870126871126872126873126874126875126876126877126878126879126880126881126882126883126884126885126886126887126888126889126890126891126892126893126894126895126896126897126898126899126900126901126902126903126904126905126906126907126908126909126910126911126912126913126914126915126916126917126918126919126920126921126922126923126924126925126926126927126928126929126930126931126932126933126934126935126936126937126938126939126940126941126942126943126944126945126946126947126948126949126950126951126952126953126954126955126956126957126958126959126960126961126962126963126964126965126966126967126968126969126970126971126972126973126974126975126976126977126978126979126980126981126982126983126984126985126986126987126988126989126990126991126992126993126994126995126996126997126998126999127000127001127002127003127004127005127006127007127008127009127010127011127012127013127014127015127016127017127018127019127020127021127022127023127024127025127026127027127028127029127030127031127032127033127034127035127036127037127038127039127040127041127042127043127044127045127046127047127048127049127050127051127052127053127054127055127056127057127058127059127060127061127062127063127064127065127066127067127068127069127070127071127072127073127074127075127076127077127078127079127080127081127082127083127084127085127086127087127088127089127090127091127092127093127094127095127096127097127098127099127100127101127102127103127104127105127106127107127108127109127110127111127112127113127114127115127116127117127118127119127120127121127122127123127124127125127126127127127128127129127130127131127132127133127134127135127136127137127138127139127140127141127142127143127144127145127146127147127148127149127150127151127152127153127154127155127156127157127158127159127160127161127162127163127164127165127166127167127168127169127170127171127172127173127174127175127176127177127178127179127180127181127182127183127184127185127186127187127188127189127190127191127192127193127194127195127196127197127198127199127200127201127202127203127204127205127206127207127208127209127210127211127212127213127214127215127216127217127218127219127220127221127222127223127224127225127226127227127228127229127230127231127232127233127234127235127236127237127238127239127240127241127242127243127244127245127246127247127248127249127250127251127252127253127254127255127256127257127258127259127260127261127262127263127264127265127266127267127268127269127270127271127272127273127274127275127276127277127278127279127280127281127282127283127284127285127286127287127288127289127290127291127292127293127294127295127296127297127298127299127300127301127302127303127304127305127306127307127308127309127310127311127312127313127314127315127316127317127318127319127320127321127322127323127324127325127326127327127328127329127330127331127332127333127334127335127336127337127338127339127340127341127342127343127344127345127346127347127348127349127350127351127352127353127354127355127356127357127358127359127360127361127362127363127364127365127366127367127368127369127370127371127372127373127374127375127376127377127378127379127380127381127382127383127384127385127386127387127388127389127390127391127392127393127394127395127396127397127398127399127400127401127402127403127404127405127406127407127408127409127410127411127412127413127414127415127416127417127418127419127420127421127422127423127424127425127426127427127428127429127430127431127432127433127434127435127436127437127438127439127440127441127442127443127444127445127446127447127448127449127450127451127452127453127454127455127456127457127458127459127460127461127462127463127464127465127466
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. if (!class_exists('Phar')) {
  22. echo 'PHP\'s phar extension is missing. Composer requires it to run. Enable the extension or recompile php without --disable-phar then try again.' . PHP_EOL;
  23. exit(1);
  24. }
  25. Phar::mapPhar('composer.phar');
  26. require 'phar://composer.phar/bin/composer';
  27. __HALT_COMPILER(); ?>
  28. ´¸��l������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.php³‚��“8Ob³‚��ïÝÙç¤������+���src/Composer/Autoload/ClassMapGenerator.php��“8Ob��Â’T¤������(���src/Composer/Autoload/PhpFileCleaner.php ��“8Ob ��)í2„¤���������src/Composer/Cache.php=��“8Ob=��Ô-¼é¤������%���src/Composer/Command/AboutCommand.php[��“8Ob[��mt5¤������'���src/Composer/Command/ArchiveCommand.phpÝ��“8ObÝ��ü•7 ¤������$���src/Composer/Command/BaseCommand.phpÙ ��“8ObÙ ��V2´¤������.���src/Composer/Command/BaseDependencyCommand.php*��“8Ob*��ŸÊ’5¤������1���src/Composer/Command/CheckPlatformReqsCommand.phpõ��“8Obõ��bþ“¿¤������*���src/Composer/Command/ClearCacheCommand.php��“8Ob��Ï1Z‚¤������&���src/Composer/Command/ConfigCommand.php#`��“8Ob#`��wÉZ�¤������-���src/Composer/Command/CreateProjectCommand.phpƒF��“8ObƒF��äaϤ������'���src/Composer/Command/DependsCommand.php±��“8Ob±��|@}¤������(���src/Composer/Command/DiagnoseCommand.phpfM��“8ObfM��¼—oc¤������,���src/Composer/Command/DumpAutoloadCommand.phpß��“8Obß��Uá&}¤������$���src/Composer/Command/ExecCommand.php ��“8Ob ��3*˜Â¤������$���src/Composer/Command/FundCommand.phpÞ��“8ObÞ��  •¤������&���src/Composer/Command/GlobalCommand.php·
  29. ��“8Ob·
  30. ��¨èŸ¤������$���src/Composer/Command/HomeCommand.php>��“8Ob>��ü‚­Ý¤������$���src/Composer/Command/InitCommand.php=B��“8Ob=B��­Žù¤������'���src/Composer/Command/InstallCommand.phpÜ��“8ObÜ��> õ´¤������(���src/Composer/Command/LicensesCommand.phpe��“8Obe��²?Ÿ¤������(���src/Composer/Command/OutdatedCommand.php¹��“8Ob¹��»Ô4¤������.���src/Composer/Command/PackageDiscoveryTrait.phpÌ7��“8ObÌ7���ÔÔF¤������)���src/Composer/Command/ProhibitsCommand.php[��“8Ob[��áFϤ������)���src/Composer/Command/ReinstallCommand.php'��“8Ob'��@{õ¤������&���src/Composer/Command/RemoveCommand.phpñ*��“8Obñ*��÷Ø›÷¤������'���src/Composer/Command/RequireCommand.phpgB��“8ObgB��³y¤������)���src/Composer/Command/RunScriptCommand.phpÊ��“8ObÊ��¡Êîë¤������+���src/Composer/Command/ScriptAliasCommand.phpÖ��“8ObÖ��ƒ&ïݤ������&���src/Composer/Command/SearchCommand.php€��“8Ob€��bÇÕŒ¤������*���src/Composer/Command/SelfUpdateCommand.phpYK��“8ObYK��Kž÷Ƥ������$���src/Composer/Command/ShowCommand.phpÓš��“8ObÓš��‡[傤������&���src/Composer/Command/StatusCommand.phpx��“8Obx�� d³¤������(���src/Composer/Command/SuggestsCommand.phpÀ ��“8ObÀ ��‰f€¤¤������&���src/Composer/Command/UpdateCommand.php"4��“8Ob"4��>X¬¤������(���src/Composer/Command/ValidateCommand.phpü��“8Obü��Q?h.¤���������src/Composer/Composer.php ��“8Ob ��F?¤É¤���������src/Composer/Config.phpÄ1��“8ObÄ1��ƒFs¤������-���src/Composer/Config/ConfigSourceInterface.phpÒ��“8ObÒ��ß3¤������(���src/Composer/Config/JsonConfigSource.php•��“8Ob•��̃ ¤������$���src/Composer/Console/Application.phpG��“8ObG��2o ¤������*���src/Composer/Console/GithubActionError.php��“8Ob��
  31. –ؤ������,���src/Composer/Console/HtmlOutputFormatter.php2��“8Ob2��˜¦y½¤������-���src/Composer/DependencyResolver/Decisions.phpè��“8Obè��ŸE]¤������1���src/Composer/DependencyResolver/DefaultPolicy.php°��“8Ob°��Úœ]¤������/���src/Composer/DependencyResolver/GenericRule.phpš��“8Obš��¡?·î¤������8���src/Composer/DependencyResolver/LocalRepoTransaction.php½��“8Ob½��ßšHš¤������3���src/Composer/DependencyResolver/LockTransaction.phpi ��“8Obi ��û ¥¤������5���src/Composer/DependencyResolver/MultiConflictRule.php/��“8Ob/��bqi¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.php��“8Ob��`:{c¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php��“8Ob��w —[¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php��“8Ob��j^Yb¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpø���“8Obø���÷Wý¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.phpJ��“8ObJ��uŸŠ¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpí��“8Obí��îH¸ý¤������=���src/Composer/DependencyResolver/Operation/UpdateOperation.php§��“8Ob§��‹•Åy¤������3���src/Composer/DependencyResolver/PolicyInterface.php¢��“8Ob¢��5­c¤������(���src/Composer/DependencyResolver/Pool.phpó��“8Obó��ÓÆtá¤������/���src/Composer/DependencyResolver/PoolBuilder.php�A��“8Ob�A��UŸÐ¤������1���src/Composer/DependencyResolver/PoolOptimizer.phpf*��“8Obf*��éñEi¤������+���src/Composer/DependencyResolver/Problem.phpªJ��“8ObªJ��ør$…¤������+���src/Composer/DependencyResolver/Request.phpé��“8Obé���íl‡¤������(���src/Composer/DependencyResolver/Rule.phpÖ0��“8ObÖ0��Ø"§ä¤������1���src/Composer/DependencyResolver/Rule2Literals.php��“8Ob��‘þ‰¤������+���src/Composer/DependencyResolver/RuleSet.phpä ��“8Obä ��ÎŽ æ¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php{��“8Ob{��íŽ(«¤������3���src/Composer/DependencyResolver/RuleSetIterator.phpM��“8ObM��rá2g¤������2���src/Composer/DependencyResolver/RuleWatchChain.php~��“8Ob~��d,“r¤������2���src/Composer/DependencyResolver/RuleWatchGraph.php• ��“8Ob• ��(R¤������1���src/Composer/DependencyResolver/RuleWatchNode.phpx��“8Obx���þ~*¤������*���src/Composer/DependencyResolver/Solver.php:��“8Ob:��}€ÒH¤������6���src/Composer/DependencyResolver/SolverBugException.php¼��“8Ob¼��ô––z¤������;���src/Composer/DependencyResolver/SolverProblemsException.php…��“8Ob…��…®¤������/���src/Composer/DependencyResolver/Transaction.phpk��“8Obk��/EuƤ������-���src/Composer/Downloader/ArchiveDownloader.php½��“8Ob½��'\iE¤������1���src/Composer/Downloader/ChangeReportInterface.phpõ���“8Obõ���­ÃÂB¤������+���src/Composer/Downloader/DownloadManager.php­��“8Ob­���•OQ¤������/���src/Composer/Downloader/DownloaderInterface.phpÐ��“8ObÐ��9ꑤ������3���src/Composer/Downloader/DvcsDownloaderInterface.phpú���“8Obú���à%'¤������*���src/Composer/Downloader/FileDownloader.php0��“8Ob0��N †¤������/���src/Composer/Downloader/FilesystemException.php3��“8Ob3��«a ܤ������,���src/Composer/Downloader/FossilDownloader.phph ��“8Obh ��OE³j¤������)���src/Composer/Downloader/GitDownloader.php„D��“8Ob„D��Êô������*���src/Composer/Downloader/GzipDownloader.php·��“8Ob·��Fë ¤������(���src/Composer/Downloader/HgDownloader.php0 ��“8Ob0 ��Ÿ$Lë¤������8���src/Composer/Downloader/MaxFileSizeExceededException.phpŒ���“8ObŒ���ÚºÔ¤������*���src/Composer/Downloader/PathDownloader.php|��“8Ob|��ÙŠ£ñ¤������.���src/Composer/Downloader/PerforceDownloader.php˜ ��“8Ob˜ ��©cñ¤������*���src/Composer/Downloader/PharDownloader.phpª��“8Obª��XÈȤ������)���src/Composer/Downloader/RarDownloader.php›��“8Ob›��GU¤������)���src/Composer/Downloader/SvnDownloader.phpu��“8Obu��Yš,Ѥ������)���src/Composer/Downloader/TarDownloader.php¨��“8Ob¨��×rß‚¤������.���src/Composer/Downloader/TransportException.phpƒ��“8Obƒ��omšÆ¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpý���“8Obý���ä6¤¤������)���src/Composer/Downloader/VcsDownloader.php5��“8Ob5��ñtP¤������(���src/Composer/Downloader/XzDownloader.php­��“8Ob­��&Ør‚¤������)���src/Composer/Downloader/ZipDownloader.phpu ��“8Obu ��Z#›Ô¤������&���src/Composer/EventDispatcher/Event.phpä��“8Obä��³ Qé¤������0���src/Composer/EventDispatcher/EventDispatcher.phpa6��“8Oba6��å´þ¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.phpÂ���“8ObÂ���}=é¤������9���src/Composer/EventDispatcher/ScriptExecutionException.php����“8Ob����ɱ'¤������9���src/Composer/Exception/IrrecoverableDownloadException.php����“8Ob����0Þ4 ¤������)���src/Composer/Exception/NoSslException.php����“8Ob����ØU¦Ò¤���������src/Composer/Factory.phpèL��“8ObèL��E8ž¤������T���src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.phpW��“8ObW��q¡‘&¤������U���src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php%��“8Ob%��U؆«¤������X���src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.php��“8Ob��ÆX ¤������R���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.php��“8Ob��l³†—¤������T���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.phpÃ���“8ObÃ���òsc¤���������src/Composer/IO/BaseIO.php;��“8Ob;��¥Ë›C¤���������src/Composer/IO/BufferIO.php?��“8Ob?��¤õ™¤���������src/Composer/IO/ConsoleIO.phpŒ��“8ObŒ��öÖ ¤���������src/Composer/IO/IOInterface.phpÐ��“8ObÐ��’Üm[¤���������src/Composer/IO/NullIO.phpO��“8ObO��bˆ¨s¤���������src/Composer/Installer.php¤��“8Ob¤��Xï¤������*���src/Composer/Installer/BinaryInstaller.phpÿ(��“8Obÿ(��×C±¤������2���src/Composer/Installer/BinaryPresenceInterface.phpæ���“8Obæ���®3—Œ¤������.���src/Composer/Installer/InstallationManager.php17��“8Ob17��Ånݹ¤������)���src/Composer/Installer/InstallerEvent.php@��“8Ob@��³¤¤������*���src/Composer/Installer/InstallerEvents.php¥���“8Ob¥���>•íǤ������-���src/Composer/Installer/InstallerInterface.phpw��“8Obw��{Üaè¤������+���src/Composer/Installer/LibraryInstaller.phpŒ��“8ObŒ��É‘·—¤������/���src/Composer/Installer/MetapackageInstaller.phpÏ��“8ObÏ���)ˆ�¤������(���src/Composer/Installer/NoopInstaller.php^��“8Ob^��T¥N­¤������'���src/Composer/Installer/PackageEvent.php��“8Ob��ß齤������(���src/Composer/Installer/PackageEvents.phpû��“8Obû��ò«K¤������*���src/Composer/Installer/PluginInstaller.phpš ��“8Obš ��)í�̤������+���src/Composer/Installer/ProjectInstaller.php= ��“8Ob= ��ÆÀçâ¤������4���src/Composer/Installer/SuggestedPackagesReporter.phpÉ��“8ObÉ��‘µUŤ���������src/Composer/Json/JsonFile.php`��“8Ob`��Òk¶Ÿ¤������#���src/Composer/Json/JsonFormatter.php ��“8Ob ��& {B¤������%���src/Composer/Json/JsonManipulator.phpˆ4��“8Obˆ4��Á>f�¤������-���src/Composer/Json/JsonValidationException.phpœ��“8Obœ��“¬J¤������%���src/Composer/Package/AliasPackage.phpw��“8Obw��I$aü¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php;��“8Ob;��Z³¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpM��“8ObM��¹Ôæ¤������0���src/Composer/Package/Archiver/ArchiveManager.phpq��“8Obq��®]õO¤������3���src/Composer/Package/Archiver/ArchiverInterface.phpX��“8ObX��Îç£9¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php%��“8Ob%���³…ó¤������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php?��“8Ob?��?�`^¤������2���src/Composer/Package/Archiver/GitExcludeFilter.php)��“8Ob)��ÓC¤������.���src/Composer/Package/Archiver/PharArchiver.phpÕ��“8ObÕ��ä”” ¤������-���src/Composer/Package/Archiver/ZipArchiver.php��“8Ob��‚‡gã¤������$���src/Composer/Package/BasePackage.php¡��“8Ob¡��¬\Ã(¤������*���src/Composer/Package/Comparer/Comparer.phpÌ ��“8ObÌ ��Dˤ������-���src/Composer/Package/CompleteAliasPackage.phpq
  32. ��“8Obq
  33. ��ú #·¤������(���src/Composer/Package/CompletePackage.php-
  34. ��“8Ob-
  35. ��Z9Ú´¤������1���src/Composer/Package/CompletePackageInterface.php³��“8Ob³��¦YK…¤������+���src/Composer/Package/Dumper/ArrayDumper.phpU ��“8ObU ��PR?¤���������src/Composer/Package/Link.php��“8Ob�� )\.¤������+���src/Composer/Package/Loader/ArrayLoader.phpi-��“8Obi-��÷YÂѤ������7���src/Composer/Package/Loader/InvalidPackageException.php„��“8Ob„��èMü•¤������*���src/Composer/Package/Loader/JsonLoader.php“��“8Ob“��褢4¤������/���src/Composer/Package/Loader/LoaderInterface.phpž��“8Obž��FB¤¤������1���src/Composer/Package/Loader/RootPackageLoader.php��“8Ob��Äæ?¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.php6N��“8Ob6N��“ D@¤���������src/Composer/Package/Locker.php%��“8Ob%��ÿp~´¤������ ���src/Composer/Package/Package.phpÉ$��“8ObÉ$��tŠf¤������)���src/Composer/Package/PackageInterface.phpü ��“8Obü ��jŸIT¤������)���src/Composer/Package/RootAliasPackage.phpÛ ��“8ObÛ �� ÞfV¤������$���src/Composer/Package/RootPackage.php½��“8Ob½��¶Ò™·¤������-���src/Composer/Package/RootPackageInterface.php£��“8Ob£��€¢R@¤������0���src/Composer/Package/Version/StabilityFilter.php��“8Ob��µêrú¤������/���src/Composer/Package/Version/VersionGuesser.phpì'��“8Obì'��rO.U¤������.���src/Composer/Package/Version/VersionParser.php��“8Ob��@kh¤������0���src/Composer/Package/Version/VersionSelector.phpÈ��“8ObÈ��Íþ¶¤������ ���src/Composer/PartialComposer.php"��“8Ob"��Î 3«¤������&���src/Composer/Platform/HhvmDetector.php1��“8Ob1��ÔT1}¤������!���src/Composer/Platform/Runtime.php!��“8Ob!��Nô¤������!���src/Composer/Platform/Version.phpl��“8Obl��1EÅÀ¤������-���src/Composer/Plugin/Capability/Capability.phpp���“8Obp���š#c;¤������2���src/Composer/Plugin/Capability/CommandProvider.php°���“8Ob°���FüÙ¤¤���������src/Composer/Plugin/Capable.php˜���“8Ob˜���û°hª¤������$���src/Composer/Plugin/CommandEvent.phpQ��“8ObQ��ou>r¤������$���src/Composer/Plugin/PluginEvents.php¨��“8Ob¨��\K“Ö¤������'���src/Composer/Plugin/PluginInterface.php´��“8Ob´��†ˆ%â¤������%���src/Composer/Plugin/PluginManager.phpòJ��“8ObòJ��>,ݱ¤������-���src/Composer/Plugin/PostFileDownloadEvent.phpÇ��“8ObÇ��f›Ìì¤������*���src/Composer/Plugin/PreCommandRunEvent.php4��“8Ob4��‰\}G¤������,���src/Composer/Plugin/PreFileDownloadEvent.php´��“8Ob´��D&%ù¤������*���src/Composer/Plugin/PrePoolCreateEvent.php¸��“8Ob¸��.êö‹¤������4���src/Composer/Question/StrictConfirmationQuestion.php‹��“8Ob‹��Õz g¤������+���src/Composer/Repository/ArrayRepository.php|��“8Ob|��Š9îĤ������.���src/Composer/Repository/ArtifactRepository.phpQ ��“8ObQ ��íͤ������.���src/Composer/Repository/ComposerRepository.php‡���“8Ob‡���Á˃S¤������/���src/Composer/Repository/CompositeRepository.phpA ��“8ObA ��ˆÜ�ÿ¤������;���src/Composer/Repository/ConfigurableRepositoryInterface.php¡���“8Ob¡���ce*2¤������0���src/Composer/Repository/FilesystemRepository.php ��“8Ob ��œ‡~º¤������,���src/Composer/Repository/FilterRepository.php��“8Ob��n:W¤������4���src/Composer/Repository/InstalledArrayRepository.phpX��“8ObX��¼,[¤������9���src/Composer/Repository/InstalledFilesystemRepository.phpJ��“8ObJ��'kCè¤������/���src/Composer/Repository/InstalledRepository.php”��“8Ob”��y4;�¤������8���src/Composer/Repository/InstalledRepositoryInterface.phpà���“8Obà���¾²ÿg¤������6���src/Composer/Repository/InvalidRepositoryException.php‡���“8Ob‡��� W<_¤������/���src/Composer/Repository/LockArrayRepository.phpÅ���“8ObÅ���8Ì«q¤������-���src/Composer/Repository/PackageRepository.php��“8Ob��v2¨û¤������*���src/Composer/Repository/PathRepository.phpk��“8Obk��DZÎ#¤������*���src/Composer/Repository/PearRepository.php��“8Ob��QuÏj¤������.���src/Composer/Repository/PlatformRepository.php
  36. T��“8Ob
  37. T��Œf"Š¤������-���src/Composer/Repository/RepositoryFactory.phpV��“8ObV��@MC¤������/���src/Composer/Repository/RepositoryInterface.php©��“8Ob©��êý�ɤ������-���src/Composer/Repository/RepositoryManager.php» ��“8Ob» ��(Ïò¤¤������7���src/Composer/Repository/RepositorySecurityException.phpˆ���“8Obˆ���qœ×t¤������)���src/Composer/Repository/RepositorySet.phpÕ��“8ObÕ��ÕýÀÖ¤������1���src/Composer/Repository/RootPackageRepository.phpa��“8Oba��|‚¹¤������,���src/Composer/Repository/Vcs/FossilDriver.phpk��“8Obk��~±Ì°¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.php�(��“8Ob�(��\Pã¤������)���src/Composer/Repository/Vcs/GitDriver.php?��“8Ob?��¹“¤&¤������,���src/Composer/Repository/Vcs/GitHubDriver.php7��“8Ob7��”t†-¤������,���src/Composer/Repository/Vcs/GitLabDriver.phpl1��“8Obl1��81~Ô¤������(���src/Composer/Repository/Vcs/HgDriver.phpù��“8Obù���
  38. ´½¤������.���src/Composer/Repository/Vcs/PerforceDriver.php' ��“8Ob' ��Ë××l¤������)���src/Composer/Repository/Vcs/SvnDriver.php��“8Ob��”OX¤������)���src/Composer/Repository/Vcs/VcsDriver.php% ��“8Ob% ��þꧤ������2���src/Composer/Repository/Vcs/VcsDriverInterface.php¾��“8Ob¾��TT¤������)���src/Composer/Repository/VcsRepository.phpX4��“8ObX4��÷œ¦¤������1���src/Composer/Repository/VersionCacheInterface.php»���“8Ob»���F̘m¤������3���src/Composer/Repository/WritableArrayRepository.phpö��“8Obö��tÌh¤������7���src/Composer/Repository/WritableRepositoryInterface.phpw��“8Obw��Õ~¼0¤���������src/Composer/Script/Event.phpù��“8Obù��0¾ë¤������$���src/Composer/Script/ScriptEvents.phpI��“8ObI��¤£D4¤������ ���src/Composer/SelfUpdate/Keys.phpã��“8Obã��ø È…¤������$���src/Composer/SelfUpdate/Versions.phpû��“8Obû��#]dw¤������ ���src/Composer/Util/AuthHelper.phpy!��“8Oby!��.–|—¤���������src/Composer/Util/Bitbucket.phpí��“8Obí��išÑ¤������$���src/Composer/Util/ComposerMirror.php ��“8Ob ��¿|Eû¤������%���src/Composer/Util/ConfigValidator.php›��“8Ob›��å³ë¤������"���src/Composer/Util/ErrorHandler.php��“8Ob��á0§2¤������ ���src/Composer/Util/Filesystem.php¸=��“8Ob¸=��ŠtÏ…¤���������src/Composer/Util/Git.php"5��“8Ob"5�� õ¤���������src/Composer/Util/GitHub.phpM��“8ObM��*ëÁ¤���������src/Composer/Util/GitLab.phpò��“8Obò��<ÄÍa¤���������src/Composer/Util/Hg.phpm��“8Obm��5� ÷¤������)���src/Composer/Util/Http/CurlDownloader.php˜H��“8Ob˜H��*‹E¤������'���src/Composer/Util/Http/CurlResponse.phpˆ��“8Obˆ��böÙ¤������&���src/Composer/Util/Http/ProxyHelper.php¼
  39. ��“8Ob¼
  40. ���\úc¤������'���src/Composer/Util/Http/ProxyManager.php¢
  41. ��“8Ob¢
  42. ��”šä������'���src/Composer/Util/Http/RequestProxy.phpi��“8Obi��Ûjbí¤������#���src/Composer/Util/Http/Response.phpî��“8Obî��v]k¤������$���src/Composer/Util/HttpDownloader.php&(��“8Ob&(��sû@¤���������src/Composer/Util/IniHelper.php���“8Ob���LCø¤���������src/Composer/Util/Loop.php ��“8Ob ��C^¶ç¤������&���src/Composer/Util/MetadataMinifier.phpC��“8ObC��d ˜¤������$���src/Composer/Util/NoProxyPattern.php—��“8Ob—��éTH¤������!���src/Composer/Util/PackageInfo.php„��“8Ob„��Ïú’¤������#���src/Composer/Util/PackageSorter.phps��“8Obs��*Õ4í¤���������src/Composer/Util/Perforce.php¼4��“8Ob¼4��·+j1¤���������src/Composer/Util/Platform.php©��“8Ob©��þÎy‚¤������%���src/Composer/Util/ProcessExecutor.php{��“8Ob{��ÄyV ¤������&���src/Composer/Util/RemoteFilesystem.phpA��“8ObA��ÍV™Ï¤���������src/Composer/Util/Silencer.php��“8Ob��éˆ3¤������*���src/Composer/Util/StreamContextFactory.php ��“8Ob ��Lš1D¤���������src/Composer/Util/Svn.php��“8Ob��½`7¤������ ���src/Composer/Util/SyncHelper.phpg��“8Obg��=b.¤���������src/Composer/Util/Tar.php“��“8Ob“��¡ Š¤���������src/Composer/Util/TlsHelper.phpl ��“8Obl ���öc¤���������src/Composer/Util/Url.php• ��“8Ob• ��”fÊ/¤���������src/Composer/Util/Zip.php��“8Ob��ëp–¤���������src/bootstrap.php
  43. ��“8Ob
  44. ��ÑÄ-Ȥ������%���src/Composer/Autoload/ClassLoader.phpÄ>��“8ObÄ>��Æ5Ky¤������"���src/Composer/InstalledVersions.phpœ:��“8Obœ:��º¦&l¤������#���res/composer-repository-schema.jsonñ��“8Obñ��|0à„¤���������res/composer-schema.json4¶��“8Ob4¶��¹¤cݤ���������vendor/autoload.phps��“8Obs��ÒÐa±¤���������vendor/composer/ClassLoader.php\��“8Ob\��ÜZuœ¤������%���vendor/composer/InstalledVersions.phpk��“8Obk��ü‚Ðj¤������%���vendor/composer/autoload_classmap.php(��“8Ob(��A«…i¤������"���vendor/composer/autoload_files.php¶��“8Ob¶��h³¥-¤������'���vendor/composer/autoload_namespaces.phpZ���“8ObZ���ë¦á–¤������!���vendor/composer/autoload_psr4.php¿��“8Ob¿��qÆËû¤������!���vendor/composer/autoload_real.phpÙ��“8ObÙ��@Ç<å¤������#���vendor/composer/autoload_static.php|��“8Ob|��;àߤ������!���vendor/composer/ca-bundle/LICENSE��“8Ob��G _¤������(���vendor/composer/ca-bundle/res/cacert.pemÁ,�“8ObÁ,�½_~Ž¤������*���vendor/composer/ca-bundle/src/CaBundle.php•$��“8Ob•$��ÛnÓ¤���������vendor/composer/installed.php<��“8Ob<��‡Ì澤������)���vendor/composer/metadata-minifier/LICENSE��“8Ob��½£ëǤ������:���vendor/composer/metadata-minifier/src/MetadataMinifier.phpÐ��“8ObÐ��Â0&À¤���������vendor/composer/pcre/LICENSE��“8Ob��½£ëǤ������+���vendor/composer/pcre/src/MatchAllResult.php��“8Ob��8aÇ”¤������6���vendor/composer/pcre/src/MatchAllWithOffsetsResult.php&��“8Ob&��‹ |¤������(���vendor/composer/pcre/src/MatchResult.phpë���“8Obë���…‘¤������3���vendor/composer/pcre/src/MatchWithOffsetsResult.phpø���“8Obø���<»Ó¤������*���vendor/composer/pcre/src/PcreException.phpI��“8ObI��Ìà
  45. 7¤������!���vendor/composer/pcre/src/Preg.phpƒ��“8Obƒ��%¤������"���vendor/composer/pcre/src/Regex.phpã ��“8Obã ��@�gº¤������*���vendor/composer/pcre/src/ReplaceResult.php ��“8Ob ��Ön0¿¤���������vendor/composer/semver/LICENSE��“8Ob��ÇSRm¤������)���vendor/composer/semver/src/Comparator.php��“8Ob��^_E“¤������/���vendor/composer/semver/src/CompilingMatcher.phpc��“8Obc��„€¦¤������/���vendor/composer/semver/src/Constraint/Bound.phpw��“8Obw��W4]W¤������4���vendor/composer/semver/src/Constraint/Constraint.phpø��“8Obø��’‹ˆ½¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.php¡��“8Ob¡��Ž5´y¤������<���vendor/composer/semver/src/Constraint/MatchAllConstraint.php¯��“8Ob¯��²Eú¤������=���vendor/composer/semver/src/Constraint/MatchNoneConstraint.phpÉ��“8ObÉ��֯خ¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.phpŠ��“8ObŠ��ÍÕĤ������'���vendor/composer/semver/src/Interval.phpæ��“8Obæ��=[i¤������(���vendor/composer/semver/src/Intervals.php¤+��“8Ob¤+��@1º«¤������%���vendor/composer/semver/src/Semver.phpù��“8Obù��á-i¤������,���vendor/composer/semver/src/VersionParser.phpÐ,��“8ObÐ,��ŽS«r¤������%���vendor/composer/spdx-licenses/LICENSE��“8Ob��ÇSRm¤������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json¸ ��“8Ob¸ ��Â4DC¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.json¾��“8Ob¾��eÇõ̤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.php{��“8Ob{��ž “¤������&���vendor/composer/xdebug-handler/LICENSE+��“8Ob+��Öã@T¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php‰��“8Ob‰��gÔ�v¤������.���vendor/composer/xdebug-handler/src/Process.phpÖ��“8ObÖ��o7¾¤������-���vendor/composer/xdebug-handler/src/Status.phpº ��“8Obº ��xf17¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.phpr)��“8Obr)��8Õc6¤������(���vendor/justinrainbow/json-schema/LICENSE"��“8Ob"�� |»™¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��“8Ob¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.phpƒ
  46. ��“8Obƒ
  47. ��ž¸=š¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.phpÁ ��“8ObÁ ��–PFF¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��“8Ob¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php\��“8Ob\��_}ý¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpà ��“8Obà ��ë’_”¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.phps��“8Obs��d Þ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpƒ ��“8Obƒ ��e� ¨¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php·��“8Ob·��%l¬ö¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php& ��“8Ob& ��78÷¬¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpz��“8Obz��ùfÅ~¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��“8Oba�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��“8Ob—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��“8Ob‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php��“8Ob��ª%}¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"��“8Ob,"��‰-¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��“8Obè��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���“8ObI���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���“8Ob•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���“8Obl���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���“8Obl���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���“8Obu���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���“8Obw���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��“8ObÞ��\¸
  48. ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���“8Obo���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���“8Ob…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���“8Ob€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���“8Obj���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���“8Obf���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��“8Obþ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��“8Ob ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php“ ��“8Ob“ ��&zß^¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��“8Ob��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���“8Obá���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php£��“8Ob£��Ç’ô¦¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php ��“8Ob ��£Á¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��“8Ob,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���“8Ob®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��“8Ob ��æP¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php@��“8Ob@��5Î3¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���“8Obƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���“8Ob…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phps��“8Obs��ßÁ‘#¤���������vendor/psr/container/LICENSE{��“8Ob{��ÕÓ�e¤������8���vendor/psr/container/src/ContainerExceptionInterface.phpN���“8ObN���üLƒ¤������/���vendor/psr/container/src/ContainerInterface.php·���“8Ob·���Šã¼¤������7���vendor/psr/container/src/NotFoundExceptionInterface.phpq���“8Obq���Rúõ¤���������vendor/psr/log/LICENSE?��“8Ob?��„ù ¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��“8Ob;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���“8Ob`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���“8Obû���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���“8Ob|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���“8Ob§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��“8ObÈ��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��“8Obk��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.phpŸ���“8ObŸ����Xóª¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���“8Obp���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��“8Ob ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��“8Ob<��þ(åI¤���������vendor/react/promise/LICENSEi��“8Obi��3}‹¤������8���vendor/react/promise/src/CancellablePromiseInterface.php‡���“8Ob‡���'¥î¤������.���vendor/react/promise/src/CancellationQueue.php9��“8Ob9��\Úo|¤������%���vendor/react/promise/src/Deferred.phpî��“8Obî��E¤)¤������6���vendor/react/promise/src/Exception/LengthException.php^���“8Ob^���?q¤������5���vendor/react/promise/src/ExtendedPromiseInterface.phpÀ��“8ObÀ��2U·û¤������-���vendor/react/promise/src/FulfilledPromise.php•��“8Ob•��­2²–¤������(���vendor/react/promise/src/LazyPromise.php(��“8Ob(��>!‘k¤������$���vendor/react/promise/src/Promise.phpÁ��“8ObÁ��
  49. ncï¤������-���vendor/react/promise/src/PromiseInterface.phpÏ���“8ObÏ���AŒƒ¤������.���vendor/react/promise/src/PromisorInterface.phpa���“8Oba���¬É™–¤������,���vendor/react/promise/src/RejectedPromise.php¢��“8Ob¢��·‹R¤������8���vendor/react/promise/src/UnhandledRejectionException.phpù��“8Obù��sPç¤������&���vendor/react/promise/src/functions.php9��“8Ob9��™ÏŸ„¤������.���vendor/react/promise/src/functions_include.php]���“8Ob]���QÑ<¡¤���������vendor/seld/jsonlint/LICENSE$��“8Ob$��4:‡~¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php}��“8Ob}��Û…Dê¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.phpÝ4��“8ObÝ4��ñ€—¾¤������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php¾��“8Ob¾��A`¬;¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php(��“8Ob(��>Ûv}¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���“8Ob>���ÿqŸŸ¤���������vendor/seld/phar-utils/LICENSE$��“8Ob$��š,M§¤������%���vendor/seld/phar-utils/src/Linter.phpi��“8Obi�� �Þ¤������)���vendor/seld/phar-utils/src/Timestamps.phpÈ ��“8ObÈ ��ÿ4©¤������&���vendor/symfony/console/Application.phpÍo��“8ObÍo��8ؤ������.���vendor/symfony/console/Attribute/AsCommand.phpÔ��“8ObÔ��½3Üþ¤������2���vendor/symfony/console/CI/GithubActionReporter.phpé��“8Obé��’ 5¤������ ���vendor/symfony/console/Color.phph��“8Obh��Gbç—¤������*���vendor/symfony/console/Command/Command.phpF'��“8ObF'��û¹þ¤������2���vendor/symfony/console/Command/CompleteCommand.php��“8Ob��ÍcTߤ������8���vendor/symfony/console/Command/DumpCompletionCommand.phpŸ��“8ObŸ��?¡Z7¤������.���vendor/symfony/console/Command/HelpCommand.php ��“8Ob ��}—¥¤������.���vendor/symfony/console/Command/LazyCommand.php˜��“8Ob˜��ä~¤������.���vendor/symfony/console/Command/ListCommand.php1 ��“8Ob1 ��$D»|¤������0���vendor/symfony/console/Command/LockableTrait.php��“8Ob��.ºV¤������=���vendor/symfony/console/Command/SignalableCommandInterface.phpÓ���“8ObÓ���»B`¾¤������?���vendor/symfony/console/CommandLoader/CommandLoaderInterface.phpQ��“8ObQ��›žH¤������?���vendor/symfony/console/CommandLoader/ContainerCommandLoader.phpU��“8ObU��Ë_ü¤������=���vendor/symfony/console/CommandLoader/FactoryCommandLoader.php¯��“8Ob¯��d¼"z¤������5���vendor/symfony/console/Completion/CompletionInput.php��“8Ob��”$„k¤������;���vendor/symfony/console/Completion/CompletionSuggestions.phpÂ��“8ObÂ��A¡¤������A���vendor/symfony/console/Completion/Output/BashCompletionOutput.php��“8Ob��ÍE¦Ú¤������F���vendor/symfony/console/Completion/Output/CompletionOutputInterface.phpF��“8ObF��Ô2nM¤������0���vendor/symfony/console/Completion/Suggestion.php3��“8Ob3��̆ ¤������(���vendor/symfony/console/ConsoleEvents.phpÕ��“8ObÕ���gw]¤������!���vendor/symfony/console/Cursor.php� ��“8Ob� ��Æ«§Ž¤������D���vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php*��“8Ob*��»¾­¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÊ ��“8ObÊ ��ïgöª¤������0���vendor/symfony/console/Descriptor/Descriptor.php}��“8Ob}��±ê3^¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.php÷���“8Ob÷���µå@à¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpë��“8Obë��1%è�¤������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.phpQ��“8ObQ��t ˆv¤������4���vendor/symfony/console/Descriptor/TextDescriptor.phpç"��“8Obç"��ȸÌˤ������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��“8Ob��‡¶¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.phpÆ��“8ObÆ�� ¼O~¤������2���vendor/symfony/console/Event/ConsoleErrorEvent.phpü��“8Obü��À©–²¤������-���vendor/symfony/console/Event/ConsoleEvent.phpÆ��“8ObÆ��ÅoÛÙ¤������3���vendor/symfony/console/Event/ConsoleSignalEvent.phpG��“8ObG��Žû ¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.php~��“8Ob~��hr½Ö¤������6���vendor/symfony/console/EventListener/ErrorListener.php&��“8Ob&��Xö뮤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÚ��“8ObÚ��ˆwêí¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpy���“8Oby���Ù9[&¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���“8Ob¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���“8Ob¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���“8Ob’���ÍO\e¤������:���vendor/symfony/console/Exception/MissingInputException.phpœ���“8Obœ���æS
  50. þ¤������?���vendor/symfony/console/Exception/NamespaceNotFoundException.php‹���“8Ob‹���‚ón©¤������5���vendor/symfony/console/Exception/RuntimeException.php–���“8Ob–���Ùí,6¤������8���vendor/symfony/console/Formatter/NullOutputFormatter.php���“8Ob���!& u¤������=���vendor/symfony/console/Formatter/NullOutputFormatterStyle.php ��“8Ob ��dÿ7¤������4���vendor/symfony/console/Formatter/OutputFormatter.php���“8Ob���¹ØB“¤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.php£��“8Ob£��Y §ß¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpH��“8ObH��‘õ2b¤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php���“8Ob���ÌZä������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpƒ��“8Obƒ��F—x±¤������F���vendor/symfony/console/Formatter/WrappableOutputFormatterInterface.phpÖ���“8ObÖ���¡Z·¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.php¸��“8Ob¸��¤ð6 ¤������2���vendor/symfony/console/Helper/DescriptorHelper.phpÀ��“8ObÀ��¦gÌ„¤������(���vendor/symfony/console/Helper/Dumper.php��“8Ob��þÒܽ¤������1���vendor/symfony/console/Helper/FormatterHelper.phpi��“8Obi��¤¶€w¤������(���vendor/symfony/console/Helper/Helper.php9 ��“8Ob9 ��;Sä¤������1���vendor/symfony/console/Helper/HelperInterface.phpå���“8Obå���Š ¤������+���vendor/symfony/console/Helper/HelperSet.phpG��“8ObG��›ÝË�¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��“8Obc��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.phpW ��“8ObW ��eÂÑ ¤������-���vendor/symfony/console/Helper/ProgressBar.phpg/��“8Obg/��w1´¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpÀ��“8ObÀ��‘=ÞÖ¤������0���vendor/symfony/console/Helper/QuestionHelper.phpÝ-��“8ObÝ-��-Ä0¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php ��“8Ob ��à�dÿ¤������'���vendor/symfony/console/Helper/Table.php~H��“8Ob~H��cæu¥¤������+���vendor/symfony/console/Helper/TableCell.phpA��“8ObA��èÓ ¤������0���vendor/symfony/console/Helper/TableCellStyle.phpî��“8Obî��Ñ�¹_¤������+���vendor/symfony/console/Helper/TableRows.php)��“8Ob)��WŠ3z¤������0���vendor/symfony/console/Helper/TableSeparator.phpÅ���“8ObÅ���¼õËü¤������,���vendor/symfony/console/Helper/TableStyle.phpˆ��“8Obˆ��¥Ö¤������*���vendor/symfony/console/Input/ArgvInput.php)��“8Ob)��Àd£ï¤������+���vendor/symfony/console/Input/ArrayInput.php ��“8Ob �� $©¤������&���vendor/symfony/console/Input/Input.php£ ��“8Ob£ ��ë1¤������.���vendor/symfony/console/Input/InputArgument.php!��“8Ob!��‚y‚¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���“8Ob˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php#��“8Ob#�� Œ!3¤������/���vendor/symfony/console/Input/InputInterface.phpü��“8Obü��G¶ô¨¤������,���vendor/symfony/console/Input/InputOption.phpç ��“8Obç ��¾ùB@¤������9���vendor/symfony/console/Input/StreamableInputInterface.phpÎ���“8ObÎ���ÖÕB›¤������,���vendor/symfony/console/Input/StringInput.php?��“8Ob?��±’ˤ���������vendor/symfony/console/LICENSE+��“8Ob+��‡´Ì¤������/���vendor/symfony/console/Logger/ConsoleLogger.php ��“8Ob ��ãÐ=ɤ������0���vendor/symfony/console/Output/BufferedOutput.phpl��“8Obl��y:¸¤������/���vendor/symfony/console/Output/ConsoleOutput.php� ��“8Ob� ��Âܤ������8���vendor/symfony/console/Output/ConsoleOutputInterface.php��“8Ob��‰ê÷´¤������6���vendor/symfony/console/Output/ConsoleSectionOutput.php“ ��“8Ob“ ��OÖ0ɤ������,���vendor/symfony/console/Output/NullOutput.phpB��“8ObB��%#RƤ������(���vendor/symfony/console/Output/Output.phpÇ ��“8ObÇ �� C,°¤������1���vendor/symfony/console/Output/OutputInterface.phpí��“8Obí��ðŽ¾¤������.���vendor/symfony/console/Output/StreamOutput.php§��“8Ob§��1Xòƒ¤������5���vendor/symfony/console/Output/TrimmedBufferOutput.phpÚ��“8ObÚ��Å±í ¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpÝ
  51. ��“8ObÝ
  52. �� c䦤������8���vendor/symfony/console/Question/ConfirmationQuestion.php��“8Ob��îyÅ„¤������,���vendor/symfony/console/Question/Question.php ��“8Ob ��µ�µT¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��“8Ob�$��•�¥v¤������8���vendor/symfony/console/SignalRegistry/SignalRegistry.php ��“8Ob ��ëÄÅx¤������3���vendor/symfony/console/SingleCommandApplication.php5��“8Ob5��Â⢤������,���vendor/symfony/console/Style/OutputStyle.phpt��“8Obt��O;Ƥ������/���vendor/symfony/console/Style/StyleInterface.php ��“8Ob ��Ý¡ˆ¤������-���vendor/symfony/console/Style/SymfonyStyle.php-'��“8Ob-'���½À¿¤������#���vendor/symfony/console/Terminal.phpÃ
  53. ��“8ObÃ
  54. ��gÂ}ؤ������3���vendor/symfony/console/Tester/ApplicationTester.php×��“8Ob×��L!¤������9���vendor/symfony/console/Tester/CommandCompletionTester.phpÚ��“8ObÚ��Ê›;°¤������/���vendor/symfony/console/Tester/CommandTester.phpÙ��“8ObÙ��D¶¤������@���vendor/symfony/console/Tester/Constraint/CommandIsSuccessful.phpÖ��“8ObÖ��ƃ‚¤������-���vendor/symfony/console/Tester/TesterTrait.php¬ ��“8Ob¬ ��2'L²¤������,���vendor/symfony/deprecation-contracts/LICENSE+��“8Ob+��7Åâ¤������1���vendor/symfony/deprecation-contracts/function.php=��“8Ob=��žÁ´ ¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.php|���“8Ob|����éD¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.phpÎ��“8ObÎ��&�ò—¤������3���vendor/symfony/filesystem/Exception/IOException.php™��“8Ob™��¯à\Τ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���“8Ob¦���jÙwM¤������@���vendor/symfony/filesystem/Exception/InvalidArgumentException.php©���“8Ob©����!Ǥ������8���vendor/symfony/filesystem/Exception/RuntimeException.php™���“8Ob™���ÝUUH¤������(���vendor/symfony/filesystem/Filesystem.phpf?��“8Obf?��¦œ«è¤������!���vendor/symfony/filesystem/LICENSE+��“8Ob+��‡´Ì¤������"���vendor/symfony/filesystem/Path.php˜'��“8Ob˜'��ê]^Ƥ������/���vendor/symfony/finder/Comparator/Comparator.php3��“8Ob3��¿Èh¤������3���vendor/symfony/finder/Comparator/DateComparator.php��“8Ob��Ï%úe¤������5���vendor/symfony/finder/Comparator/NumberComparator.phpz��“8Obz��+¼�h¤������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���“8Ob„���½¾sœ¤������>���vendor/symfony/finder/Exception/DirectoryNotFoundException.php‰���“8Ob‰���a)ÿ¤������ ���vendor/symfony/finder/Finder.phpÖ'��“8ObÖ'��Ž?ä¤������#���vendor/symfony/finder/Gitignore.php³��“8Ob³��s 4¤���������vendor/symfony/finder/Glob.phpÇ��“8ObÇ��Db‡³¤������7���vendor/symfony/finder/Iterator/CustomFilterIterator.phpc��“8Obc��7ð™¤������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.php���“8Ob���Pšs¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php��“8Ob��§Ž¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php/��“8Ob/��ÙnÃ<¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpˆ��“8Obˆ��^¶"û¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.phpW��“8ObW��ÂÅÙ¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.php”��“8Ob”��=™Üô¤������/���vendor/symfony/finder/Iterator/LazyIterator.phpQ��“8ObQ��n]¿¼¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php��“8Ob��c£TÙ¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpò��“8Obò��g"_¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php¹ ��“8Ob¹ ��¨•v2¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php|��“8Ob|��3ÙŸ¤������3���vendor/symfony/finder/Iterator/SortableIterator.php(
  55. ��“8Ob(
  56. ��Ó⮤������;���vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.phpw
  57. ��“8Obw
  58. ��ŵ3¤���������vendor/symfony/finder/LICENSE+��“8Ob+��‡´Ì¤������%���vendor/symfony/finder/SplFileInfo.php½��“8Ob½��y¤������'���vendor/symfony/polyfill-ctype/Ctype.php‡
  59. ��“8Ob‡
  60. ��~¶d¸¤������%���vendor/symfony/polyfill-ctype/LICENSE+��“8Ob+��…»E:¤������+���vendor/symfony/polyfill-ctype/bootstrap.php2��“8Ob2��Èa­8¤������-���vendor/symfony/polyfill-ctype/bootstrap80.phph��“8Obh��K¿y¸¤������2���vendor/symfony/polyfill-intl-grapheme/Grapheme.phpÙ��“8ObÙ��Ì»9§¤������-���vendor/symfony/polyfill-intl-grapheme/LICENSE+��“8Ob+��øÛ{¤������3���vendor/symfony/polyfill-intl-grapheme/bootstrap.phpÏ��“8ObÏ��ý9À|¤������5���vendor/symfony/polyfill-intl-grapheme/bootstrap80.phpY ��“8ObY ��¨! ¤������/���vendor/symfony/polyfill-intl-normalizer/LICENSE+��“8Ob+��øÛ{¤������6���vendor/symfony/polyfill-intl-normalizer/Normalizer.phpõ��“8Obõ��b©"q¤������F���vendor/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php.��“8Ob.��Qs$—¤������R���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalComposition.php‰=��“8Ob‰=��*ïo?¤������T���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalDecomposition.phpaˆ��“8Obaˆ��çR½}¤������L���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/combiningClass.phpt.��“8Obt.�� q�ܤ������X���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/compatibilityDecomposition.php™è��“8Ob™è��o”e)¤������5���vendor/symfony/polyfill-intl-normalizer/bootstrap.phpë��“8Obë��Pú£D¤������7���vendor/symfony/polyfill-intl-normalizer/bootstrap80.phpé��“8Obé��=år´¤������(���vendor/symfony/polyfill-mbstring/LICENSE+��“8Ob+��øÛ{¤������-���vendor/symfony/polyfill-mbstring/Mbstring.phpvJ��“8ObvJ��ÊG¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.phpùT��“8ObùT��•±+¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��“8Obã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php8[��“8Ob8[��+RØ*¤������.���vendor/symfony/polyfill-mbstring/bootstrap.php»��“8Ob»��NZ^¤������0���vendor/symfony/polyfill-mbstring/bootstrap80.phpÊ ��“8ObÊ ��D› פ������%���vendor/symfony/polyfill-php73/LICENSE+��“8Ob+��…»E:¤������'���vendor/symfony/polyfill-php73/Php73.phpn��“8Obn��Cs¥l¤������?���vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php[���“8Ob[���M²Ü¤������+���vendor/symfony/polyfill-php73/bootstrap.phpù��“8Obù��AY8Ƥ������%���vendor/symfony/polyfill-php80/LICENSE&��“8Ob&��þz)¤������'���vendor/symfony/polyfill-php80/Php80.php¡ ��“8Ob¡ ��[Âk ¤������*���vendor/symfony/polyfill-php80/PhpToken.php��“8Ob��M£�I¤������;���vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php¾��“8Ob¾��¿ÜФ������:���vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php…���“8Ob…���}ÈGG¤������<���vendor/symfony/polyfill-php80/Resources/stubs/Stringable.phpb���“8Obb���ÃÑ›<¤������E���vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.phpT���“8ObT���ŠÓOõ¤������<���vendor/symfony/polyfill-php80/Resources/stubs/ValueError.phpK���“8ObK���Š²ì¤������+���vendor/symfony/polyfill-php80/bootstrap.phpú��“8Obú��×îå¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpy���“8Oby���qVXJ¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���“8Ob¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���“8Ob”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��“8Obx��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessSignaledException.php��“8Ob��Yשâ¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php1��“8Ob1��‚'Z¤������5���vendor/symfony/process/Exception/RuntimeException.php˜���“8Ob˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.php·��“8Ob·��T8© ¤������&���vendor/symfony/process/InputStream.php/��“8Ob/��¦¹e‡¤���������vendor/symfony/process/LICENSE+��“8Ob+��‡´Ì¤������.���vendor/symfony/process/PhpExecutableFinder.phpC��“8ObC��®“P¤������%���vendor/symfony/process/PhpProcess.phpò��“8Obò��’sÿ¤������.���vendor/symfony/process/Pipes/AbstractPipes.php ��“8Ob ��›“Ä6¤������/���vendor/symfony/process/Pipes/PipesInterface.php™��“8Ob™��fQÚ ¤������*���vendor/symfony/process/Pipes/UnixPipes.php€��“8Ob€��¾”Vv¤������-���vendor/symfony/process/Pipes/WindowsPipes.php, ��“8Ob, ��xQjä������"���vendor/symfony/process/Process.phpðe��“8Obðe��ÂA€d¤������'���vendor/symfony/process/ProcessUtils.php��“8Ob��‹g>^¤������7���vendor/symfony/service-contracts/Attribute/Required.php¨���“8Ob¨���xj네������@���vendor/symfony/service-contracts/Attribute/SubscribedService.php
  61. ��“8Ob
  62. ��1I®T¤������(���vendor/symfony/service-contracts/LICENSE+��“8Ob+��ËÉyó¤������3���vendor/symfony/service-contracts/ResetInterface.phpy���“8Oby���°·jå¤������8���vendor/symfony/service-contracts/ServiceLocatorTrait.phpã ��“8Obã ��"�5é¤������=���vendor/symfony/service-contracts/ServiceProviderInterface.phpÞ���“8ObÞ���úRèk¤������?���vendor/symfony/service-contracts/ServiceSubscriberInterface.php³���“8Ob³���—öd ¤������;���vendor/symfony/service-contracts/ServiceSubscriberTrait.phpa
  63. ��“8Oba
  64. ��Ž¸-[¤������<���vendor/symfony/service-contracts/Test/ServiceLocatorTest.php˜��“8Ob˜��W7|G¤������(���vendor/symfony/string/AbstractString.phpŒ3��“8ObŒ3��5>‹Ž¤������/���vendor/symfony/string/AbstractUnicodeString.php§R��“8Ob§R��î>L¤������$���vendor/symfony/string/ByteString.php‹+��“8Ob‹+��Áü›¤������)���vendor/symfony/string/CodePointString.phpñ��“8Obñ��Ÿ;3ˤ������6���vendor/symfony/string/Exception/ExceptionInterface.phps���“8Obs���qHV‘¤������<���vendor/symfony/string/Exception/InvalidArgumentException.php¢���“8Ob¢���¥A¤������4���vendor/symfony/string/Exception/RuntimeException.php’���“8Ob’���u‘g¤������4���vendor/symfony/string/Inflector/EnglishInflector.phpù��“8Obù��…3§d¤������3���vendor/symfony/string/Inflector/FrenchInflector.phpƒ
  65. ��“8Obƒ
  66. ��ˆõÄw¤������6���vendor/symfony/string/Inflector/InflectorInterface.php×���“8Ob×���hD£¤���������vendor/symfony/string/LICENSE+��“8Ob+��½ý®¤������$���vendor/symfony/string/LazyString.php ��“8Ob ��‹ü`£¤������<���vendor/symfony/string/Resources/data/wcswidth_table_wide.php^��“8Ob^��%¯o)¤������<���vendor/symfony/string/Resources/data/wcswidth_table_zero.php?��“8Ob?��&^¿}¤������-���vendor/symfony/string/Resources/functions.php��“8Ob��cÚª"¤������.���vendor/symfony/string/Slugger/AsciiSlugger.phpê��“8Obê��×Ú3¤������2���vendor/symfony/string/Slugger/SluggerInterface.php��“8Ob��÷¯Q¤������'���vendor/symfony/string/UnicodeString.phpè%��“8Obè%��Ùó פ������ ���bin/composerd ��“8Obd �� qÙ¤���������LICENSE.��“8Ob.�� Õ¤������<?php declare(strict_types=1);
  67. namespace Composer\Autoload;
  68. use Composer\Config;
  69. use Composer\EventDispatcher\EventDispatcher;
  70. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  71. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  72. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  73. use Composer\Installer\InstallationManager;
  74. use Composer\IO\IOInterface;
  75. use Composer\Package\AliasPackage;
  76. use Composer\Package\PackageInterface;
  77. use Composer\Package\RootPackageInterface;
  78. use Composer\Pcre\Preg;
  79. use Composer\Repository\InstalledRepositoryInterface;
  80. use Composer\Semver\Constraint\Bound;
  81. use Composer\Util\Filesystem;
  82. use Composer\Util\Platform;
  83. use Composer\Script\ScriptEvents;
  84. use Composer\Util\PackageSorter;
  85. use Composer\Json\JsonFile;
  86. class AutoloadGenerator
  87. {
  88. private $eventDispatcher;
  89. private $io;
  90. private $devMode = null;
  91. private $classMapAuthoritative = false;
  92. private $apcu = false;
  93. private $apcuPrefix;
  94. private $runScripts = false;
  95. private $platformRequirementFilter;
  96. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  97. {
  98. $this->eventDispatcher = $eventDispatcher;
  99. $this->io = $io;
  100. $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  101. }
  102. public function setDevMode(bool $devMode = true)
  103. {
  104. $this->devMode = $devMode;
  105. }
  106. public function setClassMapAuthoritative(bool $classMapAuthoritative)
  107. {
  108. $this->classMapAuthoritative = $classMapAuthoritative;
  109. }
  110. public function setApcu(bool $apcu, ?string $apcuPrefix = null)
  111. {
  112. $this->apcu = $apcu;
  113. $this->apcuPrefix = $apcuPrefix !== null ? $apcuPrefix : $apcuPrefix;
  114. }
  115. public function setRunScripts(bool $runScripts = true)
  116. {
  117. $this->runScripts = $runScripts;
  118. }
  119. public function setIgnorePlatformRequirements($ignorePlatformReqs)
  120. {
  121. trigger_error('AutoloadGenerator::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
  122. $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
  123. }
  124. public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter)
  125. {
  126. $this->platformRequirementFilter = $platformRequirementFilter;
  127. }
  128. public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, string $suffix = '')
  129. {
  130. if ($this->classMapAuthoritative) {
  131. $scanPsrPackages = true;
  132. }
  133. if (null === $this->devMode) {
  134. $this->devMode = false;
  135. $installedJson = new JsonFile($config->get('vendor-dir').'/composer/installed.json');
  136. if ($installedJson->exists()) {
  137. $installedJson = $installedJson->read();
  138. if (isset($installedJson['dev'])) {
  139. $this->devMode = $installedJson['dev'];
  140. }
  141. }
  142. }
  143. if ($this->runScripts) {
  144. if (!isset($_SERVER['COMPOSER_DEV_MODE'])) {
  145. Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
  146. }
  147. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  148. 'optimize' => $scanPsrPackages,
  149. ));
  150. }
  151. $filesystem = new Filesystem();
  152. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  153. $basePath = $filesystem->normalizePath(realpath(realpath(Platform::getCwd())));
  154. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  155. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  156. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  157. $targetDir = $vendorPath.'/'.$targetDir;
  158. $filesystem->ensureDirectoryExists($targetDir);
  159. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  160. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  161. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  162. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  163. $namespacesFile = <<<EOF
  164. <?php
  165. // autoload_namespaces.php @generated by Composer
  166. \$vendorDir = $vendorPathCode;
  167. \$baseDir = $appBaseDirCode;
  168. return array(
  169. EOF;
  170. $psr4File = <<<EOF
  171. <?php
  172. // autoload_psr4.php @generated by Composer
  173. \$vendorDir = $vendorPathCode;
  174. \$baseDir = $appBaseDirCode;
  175. return array(
  176. EOF;
  177. $devPackageNames = $localRepo->getDevPackageNames();
  178. $packageMap = $this->buildPackageMap($installationManager, $rootPackage, $localRepo->getCanonicalPackages());
  179. if ($this->devMode) {
  180. $filteredDevPackages = false;
  181. } else {
  182. $filteredDevPackages = $devPackageNames ?: true;
  183. }
  184. $autoloads = $this->parseAutoloads($packageMap, $rootPackage, $filteredDevPackages);
  185. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  186. $exportedPaths = array();
  187. foreach ($paths as $path) {
  188. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  189. }
  190. $exportedPrefix = var_export($namespace, true);
  191. $namespacesFile .= " $exportedPrefix => ";
  192. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  193. }
  194. $namespacesFile .= ");\n";
  195. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  196. $exportedPaths = array();
  197. foreach ($paths as $path) {
  198. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  199. }
  200. $exportedPrefix = var_export($namespace, true);
  201. $psr4File .= " $exportedPrefix => ";
  202. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  203. }
  204. $psr4File .= ");\n";
  205. $classmapFile = <<<EOF
  206. <?php
  207. // autoload_classmap.php @generated by Composer
  208. \$vendorDir = $vendorPathCode;
  209. \$baseDir = $appBaseDirCode;
  210. return array(
  211. EOF;
  212. $targetDirLoader = null;
  213. $mainAutoload = $rootPackage->getAutoload();
  214. if ($rootPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  215. $levels = substr_count($filesystem->normalizePath($rootPackage->getTargetDir()), '/') + 1;
  216. $prefixes = implode(', ', array_map(function ($prefix): string {
  217. return var_export($prefix, true);
  218. }, array_keys($mainAutoload['psr-0'])));
  219. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  220. $targetDirLoader = <<<EOF
  221. public static function autoload(\$class)
  222. {
  223. \$dir = $baseDirFromTargetDirCode . '/';
  224. \$prefixes = array($prefixes);
  225. foreach (\$prefixes as \$prefix) {
  226. if (0 !== strpos(\$class, \$prefix)) {
  227. continue;
  228. }
  229. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  230. if (!\$path = stream_resolve_include_path(\$path)) {
  231. return false;
  232. }
  233. require \$path;
  234. return true;
  235. }
  236. }
  237. EOF;
  238. }
  239. $excluded = null;
  240. if (!empty($autoloads['exclude-from-classmap'])) {
  241. $excluded = $autoloads['exclude-from-classmap'];
  242. }
  243. $classMap = array();
  244. $ambiguousClasses = array();
  245. $scannedFiles = array();
  246. foreach ($autoloads['classmap'] as $dir) {
  247. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, null, null, $classMap, $ambiguousClasses, $scannedFiles);
  248. }
  249. if ($scanPsrPackages) {
  250. $namespacesToScan = array();
  251. foreach (array('psr-4', 'psr-0') as $psrType) {
  252. foreach ($autoloads[$psrType] as $namespace => $paths) {
  253. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  254. }
  255. }
  256. krsort($namespacesToScan);
  257. foreach ($namespacesToScan as $namespace => $groups) {
  258. foreach ($groups as $group) {
  259. foreach ($group['paths'] as $dir) {
  260. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  261. if (!is_dir($dir)) {
  262. continue;
  263. }
  264. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
  265. }
  266. }
  267. }
  268. }
  269. foreach ($ambiguousClasses as $className => $ambiguousPaths) {
  270. $cleanPath = str_replace(array('$vendorDir . \'', '$baseDir . \'', "',\n"), array($vendorPath, $basePath, ''), $classMap[$className]);
  271. $this->io->writeError(
  272. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  273. ' was found '. (count($ambiguousPaths) + 1) .'x: in "'.$cleanPath.'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
  274. );
  275. }
  276. $classMap['Composer\\InstalledVersions'] = "\$vendorDir . '/composer/InstalledVersions.php',\n";
  277. ksort($classMap);
  278. foreach ($classMap as $class => $code) {
  279. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  280. }
  281. $classmapFile .= ");\n";
  282. if (!$suffix) {
  283. if (!$config->get('autoloader-suffix') && Filesystem::isReadable($vendorPath.'/autoload.php')) {
  284. $content = file_get_contents($vendorPath.'/autoload.php');
  285. if (Preg::isMatch('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  286. $suffix = $match[1];
  287. }
  288. }
  289. if (!$suffix) {
  290. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  291. }
  292. }
  293. $filesystem->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  294. $filesystem->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  295. $filesystem->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  296. $includePathFilePath = $targetDir.'/include_paths.php';
  297. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
  298. $filesystem->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  299. } elseif (file_exists($includePathFilePath)) {
  300. unlink($includePathFilePath);
  301. }
  302. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  303. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
  304. $filesystem->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  305. } elseif (file_exists($includeFilesFilePath)) {
  306. unlink($includeFilesFilePath);
  307. }
  308. $filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));
  309. $checkPlatform = $config->get('platform-check') && !($this->platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter);
  310. $platformCheckContent = null;
  311. if ($checkPlatform) {
  312. $platformCheckContent = $this->getPlatformCheck($packageMap, $config->get('platform-check'), $devPackageNames);
  313. if (null === $platformCheckContent) {
  314. $checkPlatform = false;
  315. }
  316. }
  317. if ($checkPlatform) {
  318. $filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);
  319. } elseif (file_exists($targetDir.'/platform_check.php')) {
  320. unlink($targetDir.'/platform_check.php');
  321. }
  322. $filesystem->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  323. $filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
  324. $filesystem->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  325. $filesystem->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  326. if ($this->runScripts) {
  327. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  328. 'optimize' => (bool) $scanPsrPackages,
  329. ));
  330. }
  331. return count($classMap);
  332. }
  333. private function addClassMapCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $dir, ?array $excluded, ?string $namespaceFilter, ?string $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles): array
  334. {
  335. foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
  336. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  337. if (!isset($classMap[$class])) {
  338. $classMap[$class] = $pathCode;
  339. } elseif ($this->io && $classMap[$class] !== $pathCode && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  340. $ambiguousClasses[$class][] = $path;
  341. }
  342. }
  343. return $classMap;
  344. }
  345. private function generateClassMap(string $dir, ?array $excluded, ?string $namespaceFilter, ?string $autoloadType, bool $showAmbiguousWarning, array &$scannedFiles): array
  346. {
  347. if ($excluded) {
  348. if (file_exists($dir)) {
  349. $dirMatch = preg_quote(strtr(realpath($dir), '\\', '/'));
  350. foreach ($excluded as $index => $pattern) {
  351. $pattern = Preg::replace('{^(([^.+*?\[^\]$(){}=!<>|:\\\\#-]+|\\\\[.+*?\[^\]$(){}=!<>|:#-])*).*}', '$1', $pattern);
  352. if (0 !== strpos($pattern, $dirMatch) && 0 !== strpos($dirMatch, $pattern)) {
  353. unset($excluded[$index]);
  354. }
  355. }
  356. }
  357. $excluded = $excluded ? '{(' . implode('|', $excluded) . ')}' : null;
  358. }
  359. return ClassMapGenerator::createMap($dir, $excluded, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
  360. }
  361. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $rootPackage, array $packages)
  362. {
  363. $packageMap = array(array($rootPackage, ''));
  364. foreach ($packages as $package) {
  365. if ($package instanceof AliasPackage) {
  366. continue;
  367. }
  368. $this->validatePackage($package);
  369. $packageMap[] = array(
  370. $package,
  371. $installationManager->getInstallPath($package),
  372. );
  373. }
  374. return $packageMap;
  375. }
  376. protected function validatePackage(PackageInterface $package)
  377. {
  378. $autoload = $package->getAutoload();
  379. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  380. $name = $package->getName();
  381. $package->getTargetDir();
  382. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  383. }
  384. if (!empty($autoload['psr-4'])) {
  385. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  386. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  387. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  388. }
  389. }
  390. }
  391. }
  392. public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)
  393. {
  394. $rootPackageMap = array_shift($packageMap);
  395. if (is_array($filteredDevPackages)) {
  396. $packageMap = array_filter($packageMap, function ($item) use ($filteredDevPackages): bool {
  397. return !in_array($item[0]->getName(), $filteredDevPackages, true);
  398. });
  399. } elseif ($filteredDevPackages) {
  400. $packageMap = $this->filterPackageMap($packageMap, $rootPackage);
  401. }
  402. $sortedPackageMap = $this->sortPackageMap($packageMap);
  403. $sortedPackageMap[] = $rootPackageMap;
  404. array_unshift($packageMap, $rootPackageMap);
  405. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $rootPackage);
  406. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $rootPackage);
  407. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $rootPackage);
  408. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $rootPackage);
  409. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $rootPackage);
  410. krsort($psr0);
  411. krsort($psr4);
  412. return array(
  413. 'psr-0' => $psr0,
  414. 'psr-4' => $psr4,
  415. 'classmap' => $classmap,
  416. 'files' => $files,
  417. 'exclude-from-classmap' => $exclude,
  418. );
  419. }
  420. public function createLoader(array $autoloads, ?string $vendorDir = null)
  421. {
  422. $loader = new ClassLoader($vendorDir);
  423. if (isset($autoloads['psr-0'])) {
  424. foreach ($autoloads['psr-0'] as $namespace => $path) {
  425. $loader->add($namespace, $path);
  426. }
  427. }
  428. if (isset($autoloads['psr-4'])) {
  429. foreach ($autoloads['psr-4'] as $namespace => $path) {
  430. $loader->addPsr4($namespace, $path);
  431. }
  432. }
  433. if (isset($autoloads['classmap'])) {
  434. $excluded = null;
  435. if (!empty($autoloads['exclude-from-classmap'])) {
  436. $excluded = $autoloads['exclude-from-classmap'];
  437. }
  438. $scannedFiles = array();
  439. foreach ($autoloads['classmap'] as $dir) {
  440. try {
  441. $loader->addClassMap($this->generateClassMap($dir, $excluded, null, null, false, $scannedFiles));
  442. } catch (\RuntimeException $e) {
  443. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  444. }
  445. }
  446. }
  447. return $loader;
  448. }
  449. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
  450. {
  451. $includePaths = array();
  452. foreach ($packageMap as $item) {
  453. list($package, $installPath) = $item;
  454. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  455. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  456. }
  457. foreach ($package->getIncludePaths() as $includePath) {
  458. $includePath = trim($includePath, '/');
  459. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  460. }
  461. }
  462. if (!$includePaths) {
  463. return null;
  464. }
  465. $includePathsCode = '';
  466. foreach ($includePaths as $path) {
  467. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  468. }
  469. return <<<EOF
  470. <?php
  471. // include_paths.php @generated by Composer
  472. \$vendorDir = $vendorPathCode;
  473. \$baseDir = $appBaseDirCode;
  474. return array(
  475. $includePathsCode);
  476. EOF;
  477. }
  478. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
  479. {
  480. $filesCode = '';
  481. foreach ($files as $fileIdentifier => $functionFile) {
  482. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  483. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  484. }
  485. if (!$filesCode) {
  486. return null;
  487. }
  488. return <<<EOF
  489. <?php
  490. // autoload_files.php @generated by Composer
  491. \$vendorDir = $vendorPathCode;
  492. \$baseDir = $appBaseDirCode;
  493. return array(
  494. $filesCode);
  495. EOF;
  496. }
  497. protected function getPathCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $path)
  498. {
  499. if (!$filesystem->isAbsolutePath($path)) {
  500. $path = $basePath . '/' . $path;
  501. }
  502. $path = $filesystem->normalizePath($path);
  503. $baseDir = '';
  504. if (strpos($path.'/', $vendorPath.'/') === 0) {
  505. $path = (string) substr($path, strlen($vendorPath));
  506. $baseDir = '$vendorDir . ';
  507. } else {
  508. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  509. if (!$filesystem->isAbsolutePath($path)) {
  510. $baseDir = '$baseDir . ';
  511. $path = '/' . $path;
  512. }
  513. }
  514. if (strpos($path, '.phar') !== false) {
  515. $baseDir = "'phar://' . " . $baseDir;
  516. }
  517. return $baseDir . var_export($path, true);
  518. }
  519. protected function getPlatformCheck(array $packageMap, $checkPlatform, array $devPackageNames)
  520. {
  521. $lowestPhpVersion = Bound::zero();
  522. $requiredExtensions = array();
  523. $extensionProviders = array();
  524. foreach ($packageMap as $item) {
  525. $package = $item[0];
  526. foreach (array_merge($package->getReplaces(), $package->getProvides()) as $link) {
  527. if (Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
  528. $extensionProviders[$match[1]][] = $link->getConstraint();
  529. }
  530. }
  531. }
  532. foreach ($packageMap as $item) {
  533. $package = $item[0];
  534. if (in_array($package->getName(), $devPackageNames, true)) {
  535. continue;
  536. }
  537. foreach ($package->getRequires() as $link) {
  538. if ($this->platformRequirementFilter->isIgnored($link->getTarget())) {
  539. continue;
  540. }
  541. if ('php' === $link->getTarget()) {
  542. $constraint = $link->getConstraint();
  543. if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
  544. $lowestPhpVersion = $constraint->getLowerBound();
  545. }
  546. }
  547. if ($checkPlatform === true && Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
  548. if (isset($extensionProviders[$match[1]])) {
  549. foreach ($extensionProviders[$match[1]] as $provided) {
  550. if ($provided->matches($link->getConstraint())) {
  551. continue 2;
  552. }
  553. }
  554. }
  555. if ($match[1] === 'zend-opcache') {
  556. $match[1] = 'zend opcache';
  557. }
  558. $extension = var_export($match[1], true);
  559. if ($match[1] === 'pcntl' || $match[1] === 'readline') {
  560. $requiredExtensions[$extension] = "PHP_SAPI !== 'cli' || extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
  561. } else {
  562. $requiredExtensions[$extension] = "extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
  563. }
  564. }
  565. }
  566. }
  567. ksort($requiredExtensions);
  568. $formatToPhpVersionId = function (Bound $bound): int {
  569. if ($bound->isZero()) {
  570. return 0;
  571. }
  572. if ($bound->isPositiveInfinity()) {
  573. return 99999;
  574. }
  575. $version = str_replace('-', '.', $bound->getVersion());
  576. $chunks = array_map('intval', explode('.', $version));
  577. return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2];
  578. };
  579. $formatToHumanReadable = function (Bound $bound) {
  580. if ($bound->isZero()) {
  581. return 0;
  582. }
  583. if ($bound->isPositiveInfinity()) {
  584. return 99999;
  585. }
  586. $version = str_replace('-', '.', $bound->getVersion());
  587. $chunks = explode('.', $version);
  588. $chunks = array_slice($chunks, 0, 3);
  589. return implode('.', $chunks);
  590. };
  591. $requiredPhp = '';
  592. $requiredPhpError = '';
  593. if (!$lowestPhpVersion->isZero()) {
  594. $operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
  595. $requiredPhp = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
  596. $requiredPhpError = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
  597. }
  598. if ($requiredPhp) {
  599. $requiredPhp = <<<PHP_CHECK
  600. if (!($requiredPhp)) {
  601. \$issues[] = 'Your Composer dependencies require a PHP version $requiredPhpError. You are running ' . PHP_VERSION . '.';
  602. }
  603. PHP_CHECK;
  604. }
  605. $requiredExtensions = implode('', $requiredExtensions);
  606. if ('' !== $requiredExtensions) {
  607. $requiredExtensions = <<<EXT_CHECKS
  608. \$missingExtensions = array();
  609. $requiredExtensions
  610. if (\$missingExtensions) {
  611. \$issues[] = 'Your Composer dependencies require the following PHP extensions to be installed: ' . implode(', ', \$missingExtensions) . '.';
  612. }
  613. EXT_CHECKS;
  614. }
  615. if (!$requiredPhp && !$requiredExtensions) {
  616. return null;
  617. }
  618. return <<<PLATFORM_CHECK
  619. <?php
  620. // platform_check.php @generated by Composer
  621. \$issues = array();
  622. ${requiredPhp}${requiredExtensions}
  623. if (\$issues) {
  624. if (!headers_sent()) {
  625. header('HTTP/1.1 500 Internal Server Error');
  626. }
  627. if (!ini_get('display_errors')) {
  628. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  629. fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, \$issues) . PHP_EOL.PHP_EOL);
  630. } elseif (!headers_sent()) {
  631. echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, \$issues)) . PHP_EOL.PHP_EOL;
  632. }
  633. }
  634. trigger_error(
  635. 'Composer detected issues in your platform: ' . implode(' ', \$issues),
  636. E_USER_ERROR
  637. );
  638. }
  639. PLATFORM_CHECK;
  640. }
  641. protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix)
  642. {
  643. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  644. if ("'" === $lastChar || '"' === $lastChar) {
  645. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  646. } else {
  647. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  648. }
  649. return <<<AUTOLOAD
  650. <?php
  651. // autoload.php @generated by Composer
  652. if (PHP_VERSION_ID < 50600) {
  653. echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  654. exit(1);
  655. }
  656. require_once $vendorPathToTargetDirCode;
  657. return ComposerAutoloaderInit$suffix::getLoader();
  658. AUTOLOAD;
  659. }
  660. protected function getAutoloadRealFile(bool $useClassMap, bool $useIncludePath, ?string $targetDirLoader, bool $useIncludeFiles, string $vendorPathCode, string $appBaseDirCode, string $suffix, bool $useGlobalIncludePath, string $prependAutoloader, bool $checkPlatform)
  661. {
  662. $file = <<<HEADER
  663. <?php
  664. // autoload_real.php @generated by Composer
  665. class ComposerAutoloaderInit$suffix
  666. {
  667. private static \$loader;
  668. public static function loadClassLoader(\$class)
  669. {
  670. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  671. require __DIR__ . '/ClassLoader.php';
  672. }
  673. }
  674. /**
  675. * @return \Composer\Autoload\ClassLoader
  676. */
  677. public static function getLoader()
  678. {
  679. if (null !== self::\$loader) {
  680. return self::\$loader;
  681. }
  682. HEADER;
  683. if ($checkPlatform) {
  684. $file .= <<<'PLATFORM_CHECK'
  685. require __DIR__ . '/platform_check.php';
  686. PLATFORM_CHECK;
  687. }
  688. $file .= <<<CLASSLOADER_INIT
  689. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  690. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(__DIR__));
  691. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  692. CLASSLOADER_INIT;
  693. if ($useIncludePath) {
  694. $file .= <<<'INCLUDE_PATH'
  695. $includePaths = require __DIR__ . '/include_paths.php';
  696. $includePaths[] = get_include_path();
  697. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  698. INCLUDE_PATH;
  699. }
  700. $file .= <<<STATIC_INIT
  701. require __DIR__ . '/autoload_static.php';
  702. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  703. STATIC_INIT;
  704. if ($this->classMapAuthoritative) {
  705. $file .= <<<'CLASSMAPAUTHORITATIVE'
  706. $loader->setClassMapAuthoritative(true);
  707. CLASSMAPAUTHORITATIVE;
  708. }
  709. if ($this->apcu) {
  710. $apcuPrefix = var_export(($this->apcuPrefix !== null ? $this->apcuPrefix : substr(base64_encode(md5(uniqid('', true), true)), 0, -3)), true);
  711. $file .= <<<APCU
  712. \$loader->setApcuPrefix($apcuPrefix);
  713. APCU;
  714. }
  715. if ($useGlobalIncludePath) {
  716. $file .= <<<'INCLUDEPATH'
  717. $loader->setUseIncludePath(true);
  718. INCLUDEPATH;
  719. }
  720. if ($targetDirLoader) {
  721. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  722. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  723. REGISTER_TARGET_DIR_AUTOLOAD;
  724. }
  725. $file .= <<<REGISTER_LOADER
  726. \$loader->register($prependAutoloader);
  727. REGISTER_LOADER;
  728. if ($useIncludeFiles) {
  729. $file .= <<<INCLUDE_FILES
  730. \$includeFiles = \Composer\Autoload\ComposerStaticInit$suffix::\$files;
  731. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  732. composerRequire$suffix(\$fileIdentifier, \$file);
  733. }
  734. INCLUDE_FILES;
  735. }
  736. $file .= <<<METHOD_FOOTER
  737. return \$loader;
  738. }
  739. METHOD_FOOTER;
  740. $file .= $targetDirLoader;
  741. if ($useIncludeFiles) {
  742. return $file . <<<FOOTER
  743. }
  744. /**
  745. * @param string \$fileIdentifier
  746. * @param string \$file
  747. * @return void
  748. */
  749. function composerRequire$suffix(\$fileIdentifier, \$file)
  750. {
  751. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  752. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  753. require \$file;
  754. }
  755. }
  756. FOOTER;
  757. }
  758. return $file . <<<FOOTER
  759. }
  760. FOOTER;
  761. }
  762. protected function getStaticFile(string $suffix, string $targetDir, string $vendorPath, string $basePath)
  763. {
  764. $file = <<<HEADER
  765. <?php
  766. // autoload_static.php @generated by Composer
  767. namespace Composer\Autoload;
  768. class ComposerStaticInit$suffix
  769. {
  770. HEADER;
  771. $loader = new ClassLoader();
  772. $map = require $targetDir . '/autoload_namespaces.php';
  773. foreach ($map as $namespace => $path) {
  774. $loader->set($namespace, $path);
  775. }
  776. $map = require $targetDir . '/autoload_psr4.php';
  777. foreach ($map as $namespace => $path) {
  778. $loader->setPsr4($namespace, $path);
  779. }
  780. $classMap = require $targetDir . '/autoload_classmap.php';
  781. if ($classMap) {
  782. $loader->addClassMap($classMap);
  783. }
  784. $filesystem = new Filesystem();
  785. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  786. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  787. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  788. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  789. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  790. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  791. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  792. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  793. $initializer = '';
  794. $prefix = "\0Composer\Autoload\ClassLoader\0";
  795. $prefixLen = strlen($prefix);
  796. if (file_exists($targetDir . '/autoload_files.php')) {
  797. $maps = array('files' => require $targetDir . '/autoload_files.php');
  798. } else {
  799. $maps = array();
  800. }
  801. foreach ((array) $loader as $prop => $value) {
  802. if ($value && 0 === strpos($prop, $prefix)) {
  803. $maps[substr($prop, $prefixLen)] = $value;
  804. }
  805. }
  806. foreach ($maps as $prop => $value) {
  807. $value = strtr(
  808. var_export($value, true),
  809. array(
  810. $absoluteVendorPathCode => $vendorPathCode,
  811. $absoluteVendorPharPathCode => $vendorPharPathCode,
  812. $absoluteAppBaseDirCode => $appBaseDirCode,
  813. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  814. )
  815. );
  816. $value = ltrim(Preg::replace('/^ */m', ' $0$0', $value));
  817. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  818. if ('files' !== $prop) {
  819. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  820. }
  821. }
  822. return $file . <<<INITIALIZER
  823. public static function getInitializer(ClassLoader \$loader)
  824. {
  825. return \Closure::bind(function () use (\$loader) {
  826. $initializer
  827. }, null, ClassLoader::class);
  828. }
  829. }
  830. INITIALIZER;
  831. }
  832. protected function parseAutoloadsType(array $packageMap, string $type, RootPackageInterface $rootPackage)
  833. {
  834. $autoloads = array();
  835. foreach ($packageMap as $item) {
  836. list($package, $installPath) = $item;
  837. $autoload = $package->getAutoload();
  838. if ($this->devMode && $package === $rootPackage) {
  839. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  840. }
  841. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  842. continue;
  843. }
  844. if (null !== $package->getTargetDir() && $package !== $rootPackage) {
  845. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  846. }
  847. foreach ($autoload[$type] as $namespace => $paths) {
  848. foreach ((array) $paths as $path) {
  849. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !Filesystem::isReadable($installPath.'/'.$path)) {
  850. if ($package === $rootPackage) {
  851. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  852. $path = ltrim(Preg::replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  853. } else {
  854. $path = $package->getTargetDir() . '/' . $path;
  855. }
  856. }
  857. if ($type === 'exclude-from-classmap') {
  858. $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  859. $path = strtr($path, array('\\*\\*' => '.+?', '\\*' => '[^/]+?'));
  860. $updir = null;
  861. $path = Preg::replaceCallback(
  862. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  863. function ($matches) use (&$updir): string {
  864. if (isset($matches[1])) {
  865. $updir = str_replace('\\.', '.', $matches[1]);
  866. }
  867. return '';
  868. },
  869. $path
  870. );
  871. if (empty($installPath)) {
  872. $installPath = strtr(Platform::getCwd(), '\\', '/');
  873. }
  874. $resolvedPath = realpath($installPath . '/' . $updir);
  875. if (false === $resolvedPath) {
  876. continue;
  877. }
  878. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  879. continue;
  880. }
  881. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  882. if ($type === 'files') {
  883. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  884. continue;
  885. }
  886. if ($type === 'classmap') {
  887. $autoloads[] = $relativePath;
  888. continue;
  889. }
  890. $autoloads[$namespace][] = $relativePath;
  891. }
  892. }
  893. }
  894. return $autoloads;
  895. }
  896. protected function getFileIdentifier(PackageInterface $package, string $path)
  897. {
  898. return md5($package->getName() . ':' . $path);
  899. }
  900. protected function filterPackageMap(array $packageMap, RootPackageInterface $rootPackage)
  901. {
  902. $packages = array();
  903. $include = array();
  904. $replacedBy = array();
  905. foreach ($packageMap as $item) {
  906. $package = $item[0];
  907. $name = $package->getName();
  908. $packages[$name] = $package;
  909. foreach ($package->getReplaces() as $replace) {
  910. $replacedBy[$replace->getTarget()] = $name;
  911. }
  912. }
  913. $add = function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy): void {
  914. foreach ($package->getRequires() as $link) {
  915. $target = $link->getTarget();
  916. if (isset($replacedBy[$target])) {
  917. $target = $replacedBy[$target];
  918. }
  919. if (!isset($include[$target])) {
  920. $include[$target] = true;
  921. if (isset($packages[$target])) {
  922. $add($packages[$target]);
  923. }
  924. }
  925. }
  926. };
  927. $add($rootPackage);
  928. return array_filter(
  929. $packageMap,
  930. function ($item) use ($include): bool {
  931. $package = $item[0];
  932. foreach ($package->getNames() as $name) {
  933. if (isset($include[$name])) {
  934. return true;
  935. }
  936. }
  937. return false;
  938. }
  939. );
  940. }
  941. protected function sortPackageMap(array $packageMap)
  942. {
  943. $packages = array();
  944. $paths = array();
  945. foreach ($packageMap as $item) {
  946. list($package, $path) = $item;
  947. $name = $package->getName();
  948. $packages[$name] = $package;
  949. $paths[$name] = $path;
  950. }
  951. $sortedPackages = PackageSorter::sortPackages($packages);
  952. $sortedPackageMap = array();
  953. foreach ($sortedPackages as $package) {
  954. $name = $package->getName();
  955. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  956. }
  957. return $sortedPackageMap;
  958. }
  959. }
  960. function composerRequire(string $fileIdentifier, string $file): void
  961. {
  962. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  963. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  964. require $file;
  965. }
  966. }
  967. <?php declare(strict_types=1);
  968. namespace Composer\Autoload;
  969. use Composer\Pcre\Preg;
  970. use Composer\Util\Platform;
  971. use Symfony\Component\Finder\Finder;
  972. use Composer\IO\IOInterface;
  973. use Composer\Util\Filesystem;
  974. class ClassMapGenerator
  975. {
  976. public static function dump(iterable $dirs, string $file): void
  977. {
  978. $maps = array();
  979. foreach ($dirs as $dir) {
  980. $maps = array_merge($maps, static::createMap($dir));
  981. }
  982. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  983. }
  984. public static function createMap($path, string $excluded = null, IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = array()): array
  985. {
  986. $basePath = $path;
  987. if (is_string($path)) {
  988. if (is_file($path)) {
  989. $path = array(new \SplFileInfo($path));
  990. } elseif (is_dir($path) || strpos($path, '*') !== false) {
  991. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  992. } else {
  993. throw new \RuntimeException(
  994. 'Could not scan for classes inside "'.$path.
  995. '" which does not appear to be a file nor a folder'
  996. );
  997. }
  998. } elseif (null !== $autoloadType) {
  999. throw new \RuntimeException('Path must be a string when specifying an autoload type');
  1000. }
  1001. $map = array();
  1002. $filesystem = new Filesystem();
  1003. $cwd = realpath(Platform::getCwd());
  1004. foreach ($path as $file) {
  1005. $filePath = $file->getPathname();
  1006. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  1007. continue;
  1008. }
  1009. if (!$filesystem->isAbsolutePath($filePath)) {
  1010. $filePath = $cwd . '/' . $filePath;
  1011. $filePath = $filesystem->normalizePath($filePath);
  1012. } else {
  1013. $filePath = Preg::replace('{[\\\\/]{2,}}', '/', $filePath);
  1014. }
  1015. $realPath = realpath($filePath);
  1016. if (isset($scannedFiles[$realPath])) {
  1017. continue;
  1018. }
  1019. if ($excluded && Preg::isMatch($excluded, strtr($realPath, '\\', '/'))) {
  1020. continue;
  1021. }
  1022. if ($excluded && Preg::isMatch($excluded, strtr($filePath, '\\', '/'))) {
  1023. continue;
  1024. }
  1025. $classes = self::findClasses($filePath);
  1026. if (null !== $autoloadType) {
  1027. $classes = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);
  1028. if ($classes) {
  1029. $scannedFiles[$realPath] = true;
  1030. }
  1031. } else {
  1032. $scannedFiles[$realPath] = true;
  1033. }
  1034. foreach ($classes as $class) {
  1035. if (null === $autoloadType && null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
  1036. continue;
  1037. }
  1038. if (!isset($map[$class])) {
  1039. $map[$class] = $filePath;
  1040. } elseif ($io && $map[$class] !== $filePath && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  1041. $io->writeError(
  1042. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  1043. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  1044. );
  1045. }
  1046. }
  1047. }
  1048. return $map;
  1049. }
  1050. private static function filterByNamespace(array $classes, string $filePath, string $baseNamespace, string $namespaceType, string $basePath, ?IOInterface $io): array
  1051. {
  1052. $validClasses = array();
  1053. $rejectedClasses = array();
  1054. $realSubPath = substr($filePath, strlen($basePath) + 1);
  1055. $dotPosition = strrpos($realSubPath, '.');
  1056. $realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);
  1057. foreach ($classes as $class) {
  1058. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  1059. continue;
  1060. }
  1061. if ('psr-0' === $namespaceType) {
  1062. $namespaceLength = strrpos($class, '\\');
  1063. if (false !== $namespaceLength) {
  1064. $namespace = substr($class, 0, $namespaceLength + 1);
  1065. $className = substr($class, $namespaceLength + 1);
  1066. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  1067. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  1068. } else {
  1069. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  1070. }
  1071. } elseif ('psr-4' === $namespaceType) {
  1072. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  1073. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  1074. } else {
  1075. throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
  1076. }
  1077. if ($subPath === $realSubPath) {
  1078. $validClasses[] = $class;
  1079. } else {
  1080. $rejectedClasses[] = $class;
  1081. }
  1082. }
  1083. if (empty($validClasses)) {
  1084. foreach ($rejectedClasses as $class) {
  1085. if ($io) {
  1086. $io->writeError("<warning>Class $class located in ".Preg::replace('{^'.preg_quote(Platform::getCwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping.</warning>");
  1087. }
  1088. }
  1089. return array();
  1090. }
  1091. return $validClasses;
  1092. }
  1093. private static function findClasses(string $path): array
  1094. {
  1095. $extraTypes = self::getExtraTypes();
  1096. $contents = @php_strip_whitespace($path);
  1097. if (!$contents) {
  1098. if (!file_exists($path)) {
  1099. $message = 'File at "%s" does not exist, check your classmap definitions';
  1100. } elseif (!Filesystem::isReadable($path)) {
  1101. $message = 'File at "%s" is not readable, check its permissions';
  1102. } elseif ('' === trim((string) file_get_contents($path))) {
  1103. return array();
  1104. } else {
  1105. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  1106. }
  1107. $error = error_get_last();
  1108. if (isset($error['message'])) {
  1109. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  1110. }
  1111. throw new \RuntimeException(sprintf($message, $path));
  1112. }
  1113. Preg::matchAll('{\b(?:class|interface|trait'.$extraTypes.')\s}i', $contents, $matches);
  1114. if (!$matches) {
  1115. return array();
  1116. }
  1117. $p = new PhpFileCleaner($contents, count($matches[0]));
  1118. $contents = $p->clean();
  1119. unset($p);
  1120. Preg::matchAll('{
  1121. (?:
  1122. \b(?<![\$:>])(?P<type>class|interface|trait'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  1123. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  1124. )
  1125. }ix', $contents, $matches);
  1126. $classes = array();
  1127. $namespace = '';
  1128. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  1129. if (!empty($matches['ns'][$i])) {
  1130. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', (string) $matches['nsname'][$i]) . '\\';
  1131. } else {
  1132. $name = $matches['name'][$i];
  1133. if ($name === 'extends' || $name === 'implements') {
  1134. continue;
  1135. }
  1136. if ($name[0] === ':') {
  1137. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  1138. } elseif (strtolower($matches['type'][$i]) === 'enum') {
  1139. $colonPos = strrpos($name, ':');
  1140. if (false !== $colonPos) {
  1141. $name = substr($name, 0, $colonPos);
  1142. }
  1143. }
  1144. $classes[] = ltrim($namespace . $name, '\\');
  1145. }
  1146. }
  1147. return $classes;
  1148. }
  1149. private static function getExtraTypes(): string
  1150. {
  1151. static $extraTypes = null;
  1152. if (null === $extraTypes) {
  1153. $extraTypes = '';
  1154. if (PHP_VERSION_ID >= 80100 || (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>='))) {
  1155. $extraTypes .= '|enum';
  1156. }
  1157. PhpFileCleaner::setTypeConfig(array_merge(['class', 'interface', 'trait'], array_filter(explode('|', $extraTypes))));
  1158. }
  1159. return $extraTypes;
  1160. }
  1161. }
  1162. <?php declare(strict_types=1);
  1163. namespace Composer\Autoload;
  1164. use Composer\Pcre\Preg;
  1165. class PhpFileCleaner
  1166. {
  1167. private static $typeConfig;
  1168. private static $restPattern;
  1169. private $contents;
  1170. private $len;
  1171. private $maxMatches;
  1172. private $index = 0;
  1173. public static function setTypeConfig(array $types): void
  1174. {
  1175. foreach ($types as $type) {
  1176. self::$typeConfig[$type[0]] = array(
  1177. 'name' => $type,
  1178. 'length' => \strlen($type),
  1179. 'pattern' => '{.\b(?<![\$:>])'.$type.'\s++[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+}Ais',
  1180. );
  1181. }
  1182. self::$restPattern = '{[^?"\'</'.implode('', array_keys(self::$typeConfig)).']+}A';
  1183. }
  1184. public function __construct(string $contents, int $maxMatches)
  1185. {
  1186. $this->contents = $contents;
  1187. $this->len = \strlen($this->contents);
  1188. $this->maxMatches = $maxMatches;
  1189. }
  1190. public function clean(): string
  1191. {
  1192. $clean = '';
  1193. while ($this->index < $this->len) {
  1194. $this->skipToPhp();
  1195. $clean .= '<?';
  1196. while ($this->index < $this->len) {
  1197. $char = $this->contents[$this->index];
  1198. if ($char === '?' && $this->peek('>')) {
  1199. $clean .= '?>';
  1200. $this->index += 2;
  1201. continue 2;
  1202. }
  1203. if ($char === '"') {
  1204. $this->skipString('"');
  1205. $clean .= 'null';
  1206. continue;
  1207. }
  1208. if ($char === "'") {
  1209. $this->skipString("'");
  1210. $clean .= 'null';
  1211. continue;
  1212. }
  1213. if ($char === "<" && $this->peek('<') && $this->match('{<<<[ \t]*+([\'"]?)([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*+)\\1(?:\r\n|\n|\r)}A', $match)) {
  1214. $this->index += \strlen($match[0]);
  1215. $this->skipHeredoc($match[2]);
  1216. $clean .= 'null';
  1217. continue;
  1218. }
  1219. if ($char === '/') {
  1220. if ($this->peek('/')) {
  1221. $this->skipToNewline();
  1222. continue;
  1223. }
  1224. if ($this->peek('*')) {
  1225. $this->skipComment();
  1226. continue;
  1227. }
  1228. }
  1229. if ($this->maxMatches === 1 && isset(self::$typeConfig[$char])) {
  1230. $type = self::$typeConfig[$char];
  1231. if (
  1232. \substr($this->contents, $this->index, $type['length']) === $type['name']
  1233. && Preg::isMatch($type['pattern'], $this->contents, $match, 0, $this->index - 1)
  1234. ) {
  1235. $clean .= $match[0];
  1236. return $clean;
  1237. }
  1238. }
  1239. $this->index += 1;
  1240. if ($this->match(self::$restPattern, $match)) {
  1241. $clean .= $char . $match[0];
  1242. $this->index += \strlen($match[0]);
  1243. } else {
  1244. $clean .= $char;
  1245. }
  1246. }
  1247. }
  1248. return $clean;
  1249. }
  1250. private function skipToPhp(): void
  1251. {
  1252. while ($this->index < $this->len) {
  1253. if ($this->contents[$this->index] === '<' && $this->peek('?')) {
  1254. $this->index += 2;
  1255. break;
  1256. }
  1257. $this->index += 1;
  1258. }
  1259. }
  1260. private function skipString(string $delimiter): void
  1261. {
  1262. $this->index += 1;
  1263. while ($this->index < $this->len) {
  1264. if ($this->contents[$this->index] === '\\' && ($this->peek('\\') || $this->peek($delimiter))) {
  1265. $this->index += 2;
  1266. continue;
  1267. }
  1268. if ($this->contents[$this->index] === $delimiter) {
  1269. $this->index += 1;
  1270. break;
  1271. }
  1272. $this->index += 1;
  1273. }
  1274. }
  1275. private function skipComment(): void
  1276. {
  1277. $this->index += 2;
  1278. while ($this->index < $this->len) {
  1279. if ($this->contents[$this->index] === '*' && $this->peek('/')) {
  1280. $this->index += 2;
  1281. break;
  1282. }
  1283. $this->index += 1;
  1284. }
  1285. }
  1286. private function skipToNewline(): void
  1287. {
  1288. while ($this->index < $this->len) {
  1289. if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") {
  1290. return;
  1291. }
  1292. $this->index += 1;
  1293. }
  1294. }
  1295. private function skipHeredoc(string $delimiter): void
  1296. {
  1297. $firstDelimiterChar = $delimiter[0];
  1298. $delimiterLength = \strlen($delimiter);
  1299. $delimiterPattern = '{'.preg_quote($delimiter).'(?![a-zA-Z0-9_\x80-\xff])}A';
  1300. while ($this->index < $this->len) {
  1301. switch ($this->contents[$this->index]) {
  1302. case "\t":
  1303. case " ":
  1304. $this->index += 1;
  1305. continue 2;
  1306. case $firstDelimiterChar:
  1307. if (
  1308. \substr($this->contents, $this->index, $delimiterLength) === $delimiter
  1309. && $this->match($delimiterPattern)
  1310. ) {
  1311. $this->index += $delimiterLength;
  1312. return;
  1313. }
  1314. break;
  1315. }
  1316. while ($this->index < $this->len) {
  1317. $this->skipToNewline();
  1318. while ($this->index < $this->len && ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n")) {
  1319. $this->index += 1;
  1320. }
  1321. break;
  1322. }
  1323. }
  1324. }
  1325. private function peek(string $char): bool
  1326. {
  1327. return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
  1328. }
  1329. private function match($regex, array &$match = null): bool
  1330. {
  1331. return Preg::isMatch($regex, $this->contents, $match, 0, $this->index);
  1332. }
  1333. }
  1334. <?php declare(strict_types=1);
  1335. namespace Composer;
  1336. use Composer\IO\IOInterface;
  1337. use Composer\Pcre\Preg;
  1338. use Composer\Util\Filesystem;
  1339. use Composer\Util\Platform;
  1340. use Composer\Util\Silencer;
  1341. use Symfony\Component\Finder\Finder;
  1342. class Cache
  1343. {
  1344. private static $cacheCollected = null;
  1345. private $io;
  1346. private $root;
  1347. private $enabled = null;
  1348. private $allowlist;
  1349. private $filesystem;
  1350. private $readOnly;
  1351. public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9.', Filesystem $filesystem = null, bool $readOnly = false)
  1352. {
  1353. $this->io = $io;
  1354. $this->root = rtrim($cacheDir, '/\\') . '/';
  1355. $this->allowlist = $allowlist;
  1356. $this->filesystem = $filesystem ?: new Filesystem();
  1357. $this->readOnly = (bool) $readOnly;
  1358. if (!self::isUsable($cacheDir)) {
  1359. $this->enabled = false;
  1360. }
  1361. }
  1362. public function setReadOnly(bool $readOnly)
  1363. {
  1364. $this->readOnly = (bool) $readOnly;
  1365. }
  1366. public function isReadOnly()
  1367. {
  1368. return $this->readOnly;
  1369. }
  1370. public static function isUsable(string $path)
  1371. {
  1372. return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1373. }
  1374. public function isEnabled()
  1375. {
  1376. if ($this->enabled === null) {
  1377. $this->enabled = true;
  1378. if (
  1379. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1380. || !is_writable($this->root)
  1381. ) {
  1382. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  1383. $this->enabled = false;
  1384. }
  1385. }
  1386. return $this->enabled;
  1387. }
  1388. public function getRoot()
  1389. {
  1390. return $this->root;
  1391. }
  1392. public function read(string $file)
  1393. {
  1394. if ($this->isEnabled()) {
  1395. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1396. if (file_exists($this->root . $file)) {
  1397. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1398. return file_get_contents($this->root . $file);
  1399. }
  1400. }
  1401. return false;
  1402. }
  1403. public function write(string $file, string $contents)
  1404. {
  1405. if ($this->isEnabled() && !$this->readOnly) {
  1406. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1407. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1408. $tempFileName = $this->root . $file . uniqid('.', true) . '.tmp';
  1409. try {
  1410. return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);
  1411. } catch (\ErrorException $e) {
  1412. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1413. if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1414. unlink($tempFileName);
  1415. $message = sprintf(
  1416. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1417. $tempFileName,
  1418. $m[1],
  1419. $m[2],
  1420. @disk_free_space(dirname($tempFileName))
  1421. );
  1422. $this->io->writeError($message);
  1423. return false;
  1424. }
  1425. throw $e;
  1426. }
  1427. }
  1428. return false;
  1429. }
  1430. public function copyFrom(string $file, string $source)
  1431. {
  1432. if ($this->isEnabled() && !$this->readOnly) {
  1433. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1434. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1435. if (!file_exists($source)) {
  1436. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1437. } elseif ($this->io->isDebug()) {
  1438. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1439. }
  1440. return copy($source, $this->root . $file);
  1441. }
  1442. return false;
  1443. }
  1444. public function copyTo(string $file, string $target)
  1445. {
  1446. if ($this->isEnabled()) {
  1447. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1448. if (file_exists($this->root . $file)) {
  1449. try {
  1450. touch($this->root . $file, (int) filemtime($this->root . $file), time());
  1451. } catch (\ErrorException $e) {
  1452. Silencer::call('touch', $this->root . $file);
  1453. }
  1454. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1455. return copy($this->root . $file, $target);
  1456. }
  1457. }
  1458. return false;
  1459. }
  1460. public function gcIsNecessary()
  1461. {
  1462. if (self::$cacheCollected) {
  1463. return false;
  1464. }
  1465. self::$cacheCollected = true;
  1466. if (Platform::getEnv('COMPOSER_TEST_SUITE')) {
  1467. return false;
  1468. }
  1469. return !random_int(0, 50);
  1470. }
  1471. public function remove(string $file)
  1472. {
  1473. if ($this->isEnabled()) {
  1474. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1475. if (file_exists($this->root . $file)) {
  1476. return $this->filesystem->unlink($this->root . $file);
  1477. }
  1478. }
  1479. return false;
  1480. }
  1481. public function clear()
  1482. {
  1483. if ($this->isEnabled()) {
  1484. $this->filesystem->emptyDirectory($this->root);
  1485. return true;
  1486. }
  1487. return false;
  1488. }
  1489. public function getAge(string $file)
  1490. {
  1491. if ($this->isEnabled()) {
  1492. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1493. if (file_exists($this->root . $file) && ($mtime = filemtime($this->root . $file)) !== false) {
  1494. return abs(time() - $mtime);
  1495. }
  1496. }
  1497. return false;
  1498. }
  1499. public function gc(int $ttl, int $maxSize)
  1500. {
  1501. if ($this->isEnabled()) {
  1502. $expire = new \DateTime();
  1503. $expire->modify('-'.$ttl.' seconds');
  1504. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1505. foreach ($finder as $file) {
  1506. $this->filesystem->unlink($file->getPathname());
  1507. }
  1508. $totalSize = $this->filesystem->size($this->root);
  1509. if ($totalSize > $maxSize) {
  1510. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1511. while ($totalSize > $maxSize && $iterator->valid()) {
  1512. $filepath = $iterator->current()->getPathname();
  1513. $totalSize -= $this->filesystem->size($filepath);
  1514. $this->filesystem->unlink($filepath);
  1515. $iterator->next();
  1516. }
  1517. }
  1518. self::$cacheCollected = true;
  1519. return true;
  1520. }
  1521. return false;
  1522. }
  1523. public function sha1(string $file)
  1524. {
  1525. if ($this->isEnabled()) {
  1526. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1527. if (file_exists($this->root . $file)) {
  1528. return sha1_file($this->root . $file);
  1529. }
  1530. }
  1531. return false;
  1532. }
  1533. public function sha256(string $file)
  1534. {
  1535. if ($this->isEnabled()) {
  1536. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1537. if (file_exists($this->root . $file)) {
  1538. return hash_file('sha256', $this->root . $file);
  1539. }
  1540. }
  1541. return false;
  1542. }
  1543. protected function getFinder()
  1544. {
  1545. return Finder::create()->in($this->root)->files();
  1546. }
  1547. }
  1548. <?php declare(strict_types=1);
  1549. namespace Composer\Command;
  1550. use Composer\Composer;
  1551. use Symfony\Component\Console\Input\InputInterface;
  1552. use Symfony\Component\Console\Output\OutputInterface;
  1553. class AboutCommand extends BaseCommand
  1554. {
  1555. protected function configure(): void
  1556. {
  1557. $this
  1558. ->setName('about')
  1559. ->setDescription('Shows a short information about Composer.')
  1560. ->setHelp(
  1561. <<<EOT
  1562. <info>php composer.phar about</info>
  1563. EOT
  1564. )
  1565. ;
  1566. }
  1567. protected function execute(InputInterface $input, OutputInterface $output): int
  1568. {
  1569. $composerVersion = Composer::getVersion();
  1570. $this->getIO()->write(
  1571. <<<EOT
  1572. <info>Composer - Dependency Manager for PHP - version $composerVersion</info>
  1573. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1574. See https://getcomposer.org/ for more information.</comment>
  1575. EOT
  1576. );
  1577. return 0;
  1578. }
  1579. }
  1580. <?php declare(strict_types=1);
  1581. namespace Composer\Command;
  1582. use Composer\Factory;
  1583. use Composer\IO\IOInterface;
  1584. use Composer\Config;
  1585. use Composer\Composer;
  1586. use Composer\Package\BasePackage;
  1587. use Composer\Package\CompletePackageInterface;
  1588. use Composer\Repository\CompositeRepository;
  1589. use Composer\Repository\RepositoryFactory;
  1590. use Composer\Script\ScriptEvents;
  1591. use Composer\Plugin\CommandEvent;
  1592. use Composer\Plugin\PluginEvents;
  1593. use Composer\Util\Filesystem;
  1594. use Composer\Util\Loop;
  1595. use Composer\Util\Platform;
  1596. use Composer\Util\ProcessExecutor;
  1597. use Symfony\Component\Console\Input\InputArgument;
  1598. use Symfony\Component\Console\Input\InputInterface;
  1599. use Symfony\Component\Console\Input\InputOption;
  1600. use Symfony\Component\Console\Output\OutputInterface;
  1601. class ArchiveCommand extends BaseCommand
  1602. {
  1603. protected function configure(): void
  1604. {
  1605. $this
  1606. ->setName('archive')
  1607. ->setDescription('Creates an archive of this composer package.')
  1608. ->setDefinition(array(
  1609. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1610. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1611. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar, tar.gz, tar.bz2 or zip (default tar)'),
  1612. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1613. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1614. .' Note that the format will be appended.'),
  1615. new InputOption('ignore-filters', null, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1616. ))
  1617. ->setHelp(
  1618. <<<EOT
  1619. The <info>archive</info> command creates an archive of the specified format
  1620. containing the files and directories of the Composer project or the specified
  1621. package in the specified version and writes it to the specified directory.
  1622. <info>php composer.phar archive [--format=zip] [--dir=/foo] [--file=filename] [package [version]]</info>
  1623. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1624. EOT
  1625. )
  1626. ;
  1627. }
  1628. protected function execute(InputInterface $input, OutputInterface $output): int
  1629. {
  1630. $composer = $this->tryComposer();
  1631. $config = null;
  1632. if ($composer) {
  1633. $config = $composer->getConfig();
  1634. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1635. $eventDispatcher = $composer->getEventDispatcher();
  1636. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1637. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1638. }
  1639. if (!$config) {
  1640. $config = Factory::createConfig();
  1641. }
  1642. $format = $input->getOption('format') ?? $config->get('archive-format');
  1643. $dir = $input->getOption('dir') ?? $config->get('archive-dir');
  1644. $returnCode = $this->archive(
  1645. $this->getIO(),
  1646. $config,
  1647. $input->getArgument('package'),
  1648. $input->getArgument('version'),
  1649. $format,
  1650. $dir,
  1651. $input->getOption('file'),
  1652. $input->getOption('ignore-filters'),
  1653. $composer
  1654. );
  1655. if (0 === $returnCode && $composer) {
  1656. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1657. }
  1658. return $returnCode;
  1659. }
  1660. protected function archive(IOInterface $io, Config $config, ?string $packageName, ?string $version, string $format, string $dest, ?string $fileName, bool $ignoreFilters, ?Composer $composer): int
  1661. {
  1662. if ($composer) {
  1663. $archiveManager = $composer->getArchiveManager();
  1664. } else {
  1665. $factory = new Factory;
  1666. $process = new ProcessExecutor();
  1667. $httpDownloader = Factory::createHttpDownloader($io, $config);
  1668. $downloadManager = $factory->createDownloadManager($io, $config, $httpDownloader, $process);
  1669. $archiveManager = $factory->createArchiveManager($config, $downloadManager, new Loop($httpDownloader, $process));
  1670. }
  1671. if ($packageName) {
  1672. $package = $this->selectPackage($io, $packageName, $version);
  1673. if (!$package) {
  1674. return 1;
  1675. }
  1676. } else {
  1677. $package = $this->requireComposer()->getPackage();
  1678. }
  1679. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1680. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1681. $fs = new Filesystem;
  1682. $shortPath = $fs->findShortestPath(Platform::getCwd(), $packagePath, true);
  1683. $io->writeError('Created: ', false);
  1684. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1685. return 0;
  1686. }
  1687. protected function selectPackage(IOInterface $io, string $packageName, ?string $version = null)
  1688. {
  1689. $io->writeError('<info>Searching for the specified package.</info>');
  1690. if ($composer = $this->tryComposer()) {
  1691. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1692. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1693. } else {
  1694. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1695. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1696. $repo = new CompositeRepository($defaultRepos);
  1697. }
  1698. $packages = $repo->findPackages($packageName, $version);
  1699. if (count($packages) > 1) {
  1700. $package = reset($packages);
  1701. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1702. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p): string {
  1703. return $p->getPrettyString();
  1704. }, $packages)).'.');
  1705. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1706. } elseif ($packages) {
  1707. $package = reset($packages);
  1708. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1709. } else {
  1710. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1711. return false;
  1712. }
  1713. if (!$package instanceof CompletePackageInterface) {
  1714. throw new \LogicException('Expected a CompletePackageInterface instance but found '.get_class($package));
  1715. }
  1716. return $package;
  1717. }
  1718. }
  1719. <?php declare(strict_types=1);
  1720. namespace Composer\Command;
  1721. use Composer\Composer;
  1722. use Composer\Config;
  1723. use Composer\Console\Application;
  1724. use Composer\Factory;
  1725. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  1726. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  1727. use Composer\IO\IOInterface;
  1728. use Composer\IO\NullIO;
  1729. use Composer\Plugin\PreCommandRunEvent;
  1730. use Composer\Package\Version\VersionParser;
  1731. use Composer\Plugin\PluginEvents;
  1732. use Composer\Util\Platform;
  1733. use Symfony\Component\Console\Helper\Table;
  1734. use Symfony\Component\Console\Helper\TableSeparator;
  1735. use Symfony\Component\Console\Input\InputInterface;
  1736. use Symfony\Component\Console\Output\OutputInterface;
  1737. use Symfony\Component\Console\Command\Command;
  1738. use Symfony\Component\Console\Terminal;
  1739. abstract class BaseCommand extends Command
  1740. {
  1741. private $composer;
  1742. private $io;
  1743. public function getApplication(): Application
  1744. {
  1745. $application = parent::getApplication();
  1746. if (!$application instanceof Application) {
  1747. throw new \RuntimeException('Composer commands can only work with an '.Application::class.' instance set');
  1748. }
  1749. return $application;
  1750. }
  1751. public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null)
  1752. {
  1753. if ($required) {
  1754. return $this->requireComposer($disablePlugins, $disableScripts);
  1755. }
  1756. return $this->tryComposer($disablePlugins, $disableScripts);
  1757. }
  1758. public function requireComposer(bool $disablePlugins = null, bool $disableScripts = null): Composer
  1759. {
  1760. if (null === $this->composer) {
  1761. $application = parent::getApplication();
  1762. if ($application instanceof Application) {
  1763. $this->composer = $application->getComposer(true, $disablePlugins, $disableScripts);
  1764. assert($this->composer instanceof Composer);
  1765. } else {
  1766. throw new \RuntimeException(
  1767. 'Could not create a Composer\Composer instance, you must inject '.
  1768. 'one if this command is not used with a Composer\Console\Application instance'
  1769. );
  1770. }
  1771. }
  1772. return $this->composer;
  1773. }
  1774. public function tryComposer(bool $disablePlugins = null, bool $disableScripts = null): ?Composer
  1775. {
  1776. if (null === $this->composer) {
  1777. $application = parent::getApplication();
  1778. if ($application instanceof Application) {
  1779. $this->composer = $application->getComposer(false, $disablePlugins, $disableScripts);
  1780. }
  1781. }
  1782. return $this->composer;
  1783. }
  1784. public function setComposer(Composer $composer)
  1785. {
  1786. $this->composer = $composer;
  1787. }
  1788. public function resetComposer()
  1789. {
  1790. $this->composer = null;
  1791. $this->getApplication()->resetComposer();
  1792. }
  1793. public function isProxyCommand()
  1794. {
  1795. return false;
  1796. }
  1797. public function getIO()
  1798. {
  1799. if (null === $this->io) {
  1800. $application = parent::getApplication();
  1801. if ($application instanceof Application) {
  1802. $this->io = $application->getIO();
  1803. } else {
  1804. $this->io = new NullIO();
  1805. }
  1806. }
  1807. return $this->io;
  1808. }
  1809. public function setIO(IOInterface $io)
  1810. {
  1811. $this->io = $io;
  1812. }
  1813. protected function initialize(InputInterface $input, OutputInterface $output)
  1814. {
  1815. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1816. $disableScripts = $input->hasParameterOption('--no-scripts');
  1817. if ($this instanceof SelfUpdateCommand) {
  1818. $disablePlugins = true;
  1819. $disableScripts = true;
  1820. }
  1821. $composer = $this->tryComposer($disablePlugins, $disableScripts);
  1822. $io = $this->getIO();
  1823. if (null === $composer) {
  1824. $composer = Factory::createGlobal($this->getIO(), $disablePlugins, $disableScripts);
  1825. }
  1826. if ($composer) {
  1827. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1828. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1829. }
  1830. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1831. $input->setOption('no-progress', true);
  1832. }
  1833. if (true === $input->hasOption('no-dev')) {
  1834. if (!$input->getOption('no-dev') && true == Platform::getEnv('COMPOSER_NO_DEV')) {
  1835. $input->setOption('no-dev', true);
  1836. }
  1837. }
  1838. if (true === $input->hasOption('ignore-platform-reqs')) {
  1839. if (!$input->getOption('ignore-platform-reqs') && true == Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQS')) {
  1840. $input->setOption('ignore-platform-reqs', true);
  1841. $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQS is set. You may experience unexpected errors.</warning>');
  1842. }
  1843. }
  1844. if (true === $input->hasOption('ignore-platform-req') && (!$input->hasOption('ignore-platform-reqs') || !$input->getOption('ignore-platform-reqs'))) {
  1845. $ignorePlatformReqEnv = Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQ');
  1846. if (0 === count($input->getOption('ignore-platform-req')) && is_string($ignorePlatformReqEnv) && '' !== $ignorePlatformReqEnv) {
  1847. $input->setOption('ignore-platform-req', explode(',', $ignorePlatformReqEnv));
  1848. $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQ is set to ignore '.$ignorePlatformReqEnv.'. You may experience unexpected errors.</warning>');
  1849. }
  1850. }
  1851. parent::initialize($input, $output);
  1852. }
  1853. protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false)
  1854. {
  1855. $preferSource = false;
  1856. $preferDist = false;
  1857. switch ($config->get('preferred-install')) {
  1858. case 'source':
  1859. $preferSource = true;
  1860. break;
  1861. case 'dist':
  1862. $preferDist = true;
  1863. break;
  1864. case 'auto':
  1865. default:
  1866. break;
  1867. }
  1868. if (!$input->hasOption('prefer-dist') || !$input->hasOption('prefer-source')) {
  1869. return [$preferSource, $preferDist];
  1870. }
  1871. if ($input->hasOption('prefer-install') && is_string($input->getOption('prefer-install'))) {
  1872. if ($input->getOption('prefer-source')) {
  1873. throw new \InvalidArgumentException('--prefer-source can not be used together with --prefer-install');
  1874. }
  1875. if ($input->getOption('prefer-dist')) {
  1876. throw new \InvalidArgumentException('--prefer-dist can not be used together with --prefer-install');
  1877. }
  1878. switch ($input->getOption('prefer-install')) {
  1879. case 'dist':
  1880. $input->setOption('prefer-dist', true);
  1881. break;
  1882. case 'source':
  1883. $input->setOption('prefer-source', true);
  1884. break;
  1885. case 'auto':
  1886. $preferDist = false;
  1887. $preferSource = false;
  1888. break;
  1889. default:
  1890. throw new \UnexpectedValueException('--prefer-install accepts one of "dist", "source" or "auto", got '.$input->getOption('prefer-install'));
  1891. }
  1892. }
  1893. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1894. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1895. $preferDist = $input->getOption('prefer-dist');
  1896. }
  1897. return array($preferSource, $preferDist);
  1898. }
  1899. protected function getPlatformRequirementFilter(InputInterface $input): PlatformRequirementFilterInterface
  1900. {
  1901. if (!$input->hasOption('ignore-platform-reqs') || !$input->hasOption('ignore-platform-req')) {
  1902. throw new \LogicException('Calling getPlatformRequirementFilter from a command which does not define the --ignore-platform-req[s] flags is not permitted.');
  1903. }
  1904. if (true === $input->getOption('ignore-platform-reqs')) {
  1905. return PlatformRequirementFilterFactory::ignoreAll();
  1906. }
  1907. $ignores = $input->getOption('ignore-platform-req');
  1908. if (count($ignores) > 0) {
  1909. return PlatformRequirementFilterFactory::fromBoolOrList($ignores);
  1910. }
  1911. return PlatformRequirementFilterFactory::ignoreNothing();
  1912. }
  1913. protected function formatRequirements(array $requirements)
  1914. {
  1915. $requires = array();
  1916. $requirements = $this->normalizeRequirements($requirements);
  1917. foreach ($requirements as $requirement) {
  1918. if (!isset($requirement['version'])) {
  1919. throw new \UnexpectedValueException('Option '.$requirement['name'] .' is missing a version constraint, use e.g. '.$requirement['name'].':^1.0');
  1920. }
  1921. $requires[$requirement['name']] = $requirement['version'];
  1922. }
  1923. return $requires;
  1924. }
  1925. protected function normalizeRequirements(array $requirements)
  1926. {
  1927. $parser = new VersionParser();
  1928. return $parser->parseNameVersionPairs($requirements);
  1929. }
  1930. protected function renderTable(array $table, OutputInterface $output)
  1931. {
  1932. $renderer = new Table($output);
  1933. $renderer->setStyle('compact');
  1934. $rendererStyle = $renderer->getStyle();
  1935. $rendererStyle->setVerticalBorderChars('');
  1936. $rendererStyle->setCellRowContentFormat('%s ');
  1937. $renderer->setRows($table)->render();
  1938. }
  1939. protected function getTerminalWidth()
  1940. {
  1941. $terminal = new Terminal();
  1942. $width = $terminal->getWidth();
  1943. if (Platform::isWindows()) {
  1944. $width--;
  1945. } else {
  1946. $width = max(80, $width);
  1947. }
  1948. return $width;
  1949. }
  1950. }
  1951. <?php declare(strict_types=1);
  1952. namespace Composer\Command;
  1953. use Composer\Package\Link;
  1954. use Composer\Package\PackageInterface;
  1955. use Composer\Package\CompletePackageInterface;
  1956. use Composer\Package\RootPackage;
  1957. use Composer\Repository\InstalledArrayRepository;
  1958. use Composer\Repository\CompositeRepository;
  1959. use Composer\Repository\RootPackageRepository;
  1960. use Composer\Repository\InstalledRepository;
  1961. use Composer\Repository\PlatformRepository;
  1962. use Composer\Repository\RepositoryFactory;
  1963. use Composer\Plugin\CommandEvent;
  1964. use Composer\Plugin\PluginEvents;
  1965. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1966. use Composer\Package\Version\VersionParser;
  1967. use Symfony\Component\Console\Input\InputInterface;
  1968. use Symfony\Component\Console\Output\OutputInterface;
  1969. abstract class BaseDependencyCommand extends BaseCommand
  1970. {
  1971. protected const ARGUMENT_PACKAGE = 'package';
  1972. protected const ARGUMENT_CONSTRAINT = 'version';
  1973. protected const OPTION_RECURSIVE = 'recursive';
  1974. protected const OPTION_TREE = 'tree';
  1975. protected $colors;
  1976. protected function doExecute(InputInterface $input, OutputInterface $output, bool $inverted = false): int
  1977. {
  1978. $composer = $this->requireComposer();
  1979. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1980. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1981. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1982. $installedRepo = new InstalledRepository(array(
  1983. new RootPackageRepository($composer->getPackage()),
  1984. $composer->getRepositoryManager()->getLocalRepository(),
  1985. new PlatformRepository(array(), $platformOverrides),
  1986. ));
  1987. list($needle, $textConstraint) = array_pad(
  1988. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1989. 2,
  1990. $input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*'
  1991. );
  1992. $packages = $installedRepo->findPackagesWithReplacersAndProviders($needle);
  1993. if (empty($packages)) {
  1994. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1995. }
  1996. if (!$installedRepo->findPackage($needle, $textConstraint)) {
  1997. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1998. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1999. $installedRepo->addRepository(new InstalledArrayRepository(array(clone $match)));
  2000. }
  2001. }
  2002. $needles = array($needle);
  2003. if ($inverted) {
  2004. foreach ($packages as $package) {
  2005. $needles = array_merge($needles, array_map(function (Link $link): string {
  2006. return $link->getTarget();
  2007. }, $package->getReplaces()));
  2008. }
  2009. }
  2010. if ('*' !== $textConstraint) {
  2011. $versionParser = new VersionParser();
  2012. $constraint = $versionParser->parseConstraints($textConstraint);
  2013. } else {
  2014. $constraint = null;
  2015. }
  2016. $renderTree = $input->getOption(self::OPTION_TREE);
  2017. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  2018. $results = $installedRepo->getDependents($needles, $constraint, $inverted, $recursive);
  2019. if (empty($results)) {
  2020. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  2021. $this->getIO()->writeError(sprintf(
  2022. '<info>There is no installed package depending on "%s"%s</info>',
  2023. $needle,
  2024. $extra
  2025. ));
  2026. } elseif ($renderTree) {
  2027. $this->initStyles($output);
  2028. $root = $packages[0];
  2029. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root instanceof CompletePackageInterface ? $root->getDescription() : ''));
  2030. $this->printTree($results);
  2031. } else {
  2032. $this->printTable($output, $results);
  2033. }
  2034. return 0;
  2035. }
  2036. protected function printTable(OutputInterface $output, $results): void
  2037. {
  2038. $table = array();
  2039. $doubles = array();
  2040. do {
  2041. $queue = array();
  2042. $rows = array();
  2043. foreach ($results as $result) {
  2044. list($package, $link, $children) = $result;
  2045. $unique = (string) $link;
  2046. if (isset($doubles[$unique])) {
  2047. continue;
  2048. }
  2049. $doubles[$unique] = true;
  2050. $version = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '-' : $package->getPrettyVersion();
  2051. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  2052. if ($children) {
  2053. $queue = array_merge($queue, $children);
  2054. }
  2055. }
  2056. $results = $queue;
  2057. $table = array_merge($rows, $table);
  2058. } while (!empty($results));
  2059. $this->renderTable($table, $output);
  2060. }
  2061. protected function initStyles(OutputInterface $output): void
  2062. {
  2063. $this->colors = array(
  2064. 'green',
  2065. 'yellow',
  2066. 'cyan',
  2067. 'magenta',
  2068. 'blue',
  2069. );
  2070. foreach ($this->colors as $color) {
  2071. $style = new OutputFormatterStyle($color);
  2072. $output->getFormatter()->setStyle($color, $style);
  2073. }
  2074. }
  2075. protected function printTree(array $results, string $prefix = '', int $level = 1): void
  2076. {
  2077. $count = count($results);
  2078. $idx = 0;
  2079. foreach ($results as $result) {
  2080. list($package, $link, $children) = $result;
  2081. $color = $this->colors[$level % count($this->colors)];
  2082. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  2083. $isLast = (++$idx == $count);
  2084. $versionText = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '' : $package->getPrettyVersion();
  2085. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  2086. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  2087. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  2088. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  2089. if ($children) {
  2090. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  2091. }
  2092. }
  2093. }
  2094. private function writeTreeLine(string $line): void
  2095. {
  2096. $io = $this->getIO();
  2097. if (!$io->isDecorated()) {
  2098. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  2099. }
  2100. $io->write($line);
  2101. }
  2102. }
  2103. <?php declare(strict_types=1);
  2104. namespace Composer\Command;
  2105. use Composer\Package\Link;
  2106. use Composer\Semver\Constraint\Constraint;
  2107. use Symfony\Component\Console\Input\InputInterface;
  2108. use Symfony\Component\Console\Input\InputOption;
  2109. use Symfony\Component\Console\Output\OutputInterface;
  2110. use Composer\Repository\PlatformRepository;
  2111. use Composer\Repository\RootPackageRepository;
  2112. use Composer\Repository\InstalledRepository;
  2113. class CheckPlatformReqsCommand extends BaseCommand
  2114. {
  2115. protected function configure(): void
  2116. {
  2117. $this->setName('check-platform-reqs')
  2118. ->setDescription('Check that platform requirements are satisfied.')
  2119. ->setDefinition(array(
  2120. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  2121. new InputOption('lock', null, InputOption::VALUE_NONE, 'Checks requirements only from the lock file, not from installed packages.'),
  2122. ))
  2123. ->setHelp(
  2124. <<<EOT
  2125. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  2126. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  2127. <info>php composer.phar check-platform-reqs</info>
  2128. EOT
  2129. );
  2130. }
  2131. protected function execute(InputInterface $input, OutputInterface $output): int
  2132. {
  2133. $composer = $this->requireComposer();
  2134. $requires = array();
  2135. $removePackages = array();
  2136. if ($input->getOption('lock')) {
  2137. $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements using the lock file</info>');
  2138. $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
  2139. } else {
  2140. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  2141. if (!$installedRepo->getPackages()) {
  2142. $this->getIO()->writeError('<warning>No vendor dir present, checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements from the lock file</warning>');
  2143. $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
  2144. } else {
  2145. if ($input->getOption('no-dev')) {
  2146. $removePackages = $installedRepo->getDevPackageNames();
  2147. }
  2148. $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements for packages in the vendor dir</info>');
  2149. }
  2150. }
  2151. if (!$input->getOption('no-dev')) {
  2152. $requires += $composer->getPackage()->getDevRequires();
  2153. }
  2154. foreach ($requires as $require => $link) {
  2155. $requires[$require] = array($link);
  2156. }
  2157. $installedRepo = new InstalledRepository(array($installedRepo, new RootPackageRepository($composer->getPackage())));
  2158. foreach ($installedRepo->getPackages() as $package) {
  2159. if (in_array($package->getName(), $removePackages, true)) {
  2160. continue;
  2161. }
  2162. foreach ($package->getRequires() as $require => $link) {
  2163. $requires[$require][] = $link;
  2164. }
  2165. }
  2166. ksort($requires);
  2167. $installedRepo->addRepository(new PlatformRepository(array(), array()));
  2168. $results = array();
  2169. $exitCode = 0;
  2170. foreach ($requires as $require => $links) {
  2171. if (PlatformRepository::isPlatformPackage($require)) {
  2172. $candidates = $installedRepo->findPackagesWithReplacersAndProviders($require);
  2173. if ($candidates) {
  2174. $reqResults = array();
  2175. foreach ($candidates as $candidate) {
  2176. $candidateConstraint = null;
  2177. if ($candidate->getName() === $require) {
  2178. $candidateConstraint = new Constraint('=', $candidate->getVersion());
  2179. $candidateConstraint->setPrettyString($candidate->getPrettyVersion());
  2180. } else {
  2181. foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
  2182. if ($link->getTarget() === $require) {
  2183. $candidateConstraint = $link->getConstraint();
  2184. break;
  2185. }
  2186. }
  2187. }
  2188. if (!$candidateConstraint) {
  2189. continue;
  2190. }
  2191. foreach ($links as $link) {
  2192. if (!$link->getConstraint()->matches($candidateConstraint)) {
  2193. $reqResults[] = array(
  2194. $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
  2195. $candidateConstraint->getPrettyString(),
  2196. $link,
  2197. '<error>failed</error>'.($candidate->getName() === $require ? '' : ' <comment>provided by '.$candidate->getPrettyName().'</comment>'),
  2198. );
  2199. continue 2;
  2200. }
  2201. }
  2202. $results[] = array(
  2203. $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
  2204. $candidateConstraint->getPrettyString(),
  2205. null,
  2206. '<info>success</info>'.($candidate->getName() === $require ? '' : ' <comment>provided by '.$candidate->getPrettyName().'</comment>'),
  2207. );
  2208. continue 2;
  2209. }
  2210. $results = array_merge($results, $reqResults);
  2211. $exitCode = max($exitCode, 1);
  2212. continue;
  2213. }
  2214. $results[] = array(
  2215. $require,
  2216. 'n/a',
  2217. $links[0],
  2218. '<error>missing</error>',
  2219. );
  2220. $exitCode = max($exitCode, 2);
  2221. }
  2222. }
  2223. $this->printTable($output, $results);
  2224. return $exitCode;
  2225. }
  2226. protected function printTable(OutputInterface $output, array $results): void
  2227. {
  2228. $rows = array();
  2229. foreach ($results as $result) {
  2230. list($platformPackage, $version, $link, $status) = $result;
  2231. $rows[] = array(
  2232. $platformPackage,
  2233. $version,
  2234. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  2235. $status,
  2236. );
  2237. }
  2238. $this->renderTable($rows, $output);
  2239. }
  2240. }
  2241. <?php declare(strict_types=1);
  2242. namespace Composer\Command;
  2243. use Composer\Cache;
  2244. use Composer\Factory;
  2245. use Symfony\Component\Console\Input\InputInterface;
  2246. use Symfony\Component\Console\Output\OutputInterface;
  2247. class ClearCacheCommand extends BaseCommand
  2248. {
  2249. protected function configure(): void
  2250. {
  2251. $this
  2252. ->setName('clear-cache')
  2253. ->setAliases(array('clearcache', 'cc'))
  2254. ->setDescription('Clears composer\'s internal package cache.')
  2255. ->setHelp(
  2256. <<<EOT
  2257. The <info>clear-cache</info> deletes all cached packages from composer's
  2258. cache directory.
  2259. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  2260. EOT
  2261. )
  2262. ;
  2263. }
  2264. protected function execute(InputInterface $input, OutputInterface $output): int
  2265. {
  2266. $config = Factory::createConfig();
  2267. $io = $this->getIO();
  2268. $cachePaths = array(
  2269. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  2270. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  2271. 'cache-files-dir' => $config->get('cache-files-dir'),
  2272. 'cache-dir' => $config->get('cache-dir'),
  2273. );
  2274. foreach ($cachePaths as $key => $cachePath) {
  2275. $cachePath = realpath($cachePath);
  2276. if (!$cachePath) {
  2277. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  2278. continue;
  2279. }
  2280. $cache = new Cache($io, $cachePath);
  2281. $cache->setReadOnly($config->get('cache-read-only'));
  2282. if (!$cache->isEnabled()) {
  2283. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  2284. continue;
  2285. }
  2286. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  2287. $cache->clear();
  2288. }
  2289. $io->writeError('<info>All caches cleared.</info>');
  2290. return 0;
  2291. }
  2292. }
  2293. <?php declare(strict_types=1);
  2294. namespace Composer\Command;
  2295. use Composer\Pcre\Preg;
  2296. use Composer\Util\Filesystem;
  2297. use Composer\Util\Platform;
  2298. use Composer\Util\Silencer;
  2299. use Symfony\Component\Console\Input\InputInterface;
  2300. use Symfony\Component\Console\Input\InputArgument;
  2301. use Symfony\Component\Console\Input\InputOption;
  2302. use Symfony\Component\Console\Output\OutputInterface;
  2303. use Composer\Config;
  2304. use Composer\Config\JsonConfigSource;
  2305. use Composer\Factory;
  2306. use Composer\IO\IOInterface;
  2307. use Composer\Json\JsonFile;
  2308. use Composer\Semver\VersionParser;
  2309. use Composer\Package\BasePackage;
  2310. class ConfigCommand extends BaseCommand
  2311. {
  2312. protected $config;
  2313. protected $configFile;
  2314. protected $configSource;
  2315. protected $authConfigFile;
  2316. protected $authConfigSource;
  2317. protected function configure(): void
  2318. {
  2319. $this
  2320. ->setName('config')
  2321. ->setDescription('Sets config options.')
  2322. ->setDefinition(array(
  2323. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  2324. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  2325. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  2326. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  2327. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  2328. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  2329. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  2330. new InputOption('json', 'j', InputOption::VALUE_NONE, 'JSON decode the setting value, to be used with extra.* keys'),
  2331. new InputOption('merge', 'm', InputOption::VALUE_NONE, 'Merge the setting value with the current value, to be used with extra.* keys in combination with --json'),
  2332. new InputOption('append', null, InputOption::VALUE_NONE, 'When adding a repository, append it (lowest priority) to the existing ones instead of prepending it (highest priority)'),
  2333. new InputOption('source', null, InputOption::VALUE_NONE, 'Display where the config value is loaded from'),
  2334. new InputArgument('setting-key', null, 'Setting key'),
  2335. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  2336. ))
  2337. ->setHelp(
  2338. <<<EOT
  2339. This command allows you to edit composer config settings and repositories
  2340. in either the local composer.json file or the global config.json file.
  2341. Additionally it lets you edit most properties in the local composer.json.
  2342. To set a config setting:
  2343. <comment>%command.full_name% bin-dir bin/</comment>
  2344. To read a config setting:
  2345. <comment>%command.full_name% bin-dir</comment>
  2346. Outputs: <info>bin</info>
  2347. To edit the global config.json file:
  2348. <comment>%command.full_name% --global</comment>
  2349. To add a repository:
  2350. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  2351. To remove a repository (repo is a short alias for repositories):
  2352. <comment>%command.full_name% --unset repo.foo</comment>
  2353. To disable packagist:
  2354. <comment>%command.full_name% repo.packagist false</comment>
  2355. You can alter repositories in the global config.json file by passing in the
  2356. <info>--global</info> option.
  2357. To add or edit suggested packages you can use:
  2358. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  2359. To add or edit extra properties you can use:
  2360. <comment>%command.full_name% extra.property value</comment>
  2361. Or to add a complex value you can use json with:
  2362. <comment>%command.full_name% extra.property --json '{"foo":true, "bar": []}'</comment>
  2363. To edit the file in an external editor:
  2364. <comment>%command.full_name% --editor</comment>
  2365. To choose your editor you can set the "EDITOR" env variable.
  2366. To get a list of configuration values in the file:
  2367. <comment>%command.full_name% --list</comment>
  2368. You can always pass more than one option. As an example, if you want to edit the
  2369. global config.json file.
  2370. <comment>%command.full_name% --editor --global</comment>
  2371. Read more at https://getcomposer.org/doc/03-cli.md#config
  2372. EOT
  2373. )
  2374. ;
  2375. }
  2376. protected function initialize(InputInterface $input, OutputInterface $output): void
  2377. {
  2378. parent::initialize($input, $output);
  2379. if ($input->getOption('global') && null !== $input->getOption('file')) {
  2380. throw new \RuntimeException('--file and --global can not be combined');
  2381. }
  2382. $io = $this->getIO();
  2383. $this->config = Factory::createConfig($io);
  2384. $configFile = $input->getOption('global')
  2385. ? ($this->config->get('home') . '/config.json')
  2386. : ($input->getOption('file') ?: Factory::getComposerFile());
  2387. if (
  2388. ($configFile === 'composer.json' || $configFile === './composer.json')
  2389. && !file_exists($configFile)
  2390. && realpath(Platform::getCwd()) === realpath($this->config->get('home'))
  2391. ) {
  2392. file_put_contents($configFile, "{\n}\n");
  2393. }
  2394. $this->configFile = new JsonFile($configFile, null, $io);
  2395. $this->configSource = new JsonConfigSource($this->configFile);
  2396. $authConfigFile = $input->getOption('global')
  2397. ? ($this->config->get('home') . '/auth.json')
  2398. : dirname($configFile) . '/auth.json';
  2399. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  2400. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  2401. if ($input->getOption('global') && !$this->configFile->exists()) {
  2402. touch($this->configFile->getPath());
  2403. $this->configFile->write(array('config' => new \ArrayObject));
  2404. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  2405. }
  2406. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  2407. touch($this->authConfigFile->getPath());
  2408. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject));
  2409. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  2410. }
  2411. if (!$this->configFile->exists()) {
  2412. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  2413. }
  2414. }
  2415. protected function execute(InputInterface $input, OutputInterface $output): int
  2416. {
  2417. if (true === $input->getOption('editor')) {
  2418. $editor = escapeshellcmd(Platform::getEnv('EDITOR'));
  2419. if (!$editor) {
  2420. if (Platform::isWindows()) {
  2421. $editor = 'notepad';
  2422. } else {
  2423. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  2424. if (exec('which '.$candidate)) {
  2425. $editor = $candidate;
  2426. break;
  2427. }
  2428. }
  2429. }
  2430. }
  2431. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  2432. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  2433. return 0;
  2434. }
  2435. if (false === $input->getOption('global')) {
  2436. $this->config->merge($this->configFile->read(), $this->configFile->getPath());
  2437. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()), $this->authConfigFile->getPath());
  2438. }
  2439. if (true === $input->getOption('list')) {
  2440. $this->listConfiguration($this->config->all(), $this->config->raw(), $output, null, $input->getOption('source'));
  2441. return 0;
  2442. }
  2443. $settingKey = $input->getArgument('setting-key');
  2444. if (!is_string($settingKey)) {
  2445. return 0;
  2446. }
  2447. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  2448. throw new \RuntimeException('You can not combine a setting value with --unset');
  2449. }
  2450. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  2451. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  2452. $rawData = $this->configFile->read();
  2453. $data = $this->config->all();
  2454. if (Preg::isMatch('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  2455. if (!isset($matches[1]) || $matches[1] === '') {
  2456. $value = $data['repositories'] ?? array();
  2457. } else {
  2458. if (!isset($data['repositories'][$matches[1]])) {
  2459. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  2460. }
  2461. $value = $data['repositories'][$matches[1]];
  2462. }
  2463. } elseif (strpos($settingKey, '.')) {
  2464. $bits = explode('.', $settingKey);
  2465. if ($bits[0] === 'extra') {
  2466. $data = $rawData;
  2467. } else {
  2468. $data = $data['config'];
  2469. }
  2470. $match = false;
  2471. foreach ($bits as $bit) {
  2472. $key = isset($key) ? $key.'.'.$bit : $bit;
  2473. $match = false;
  2474. if (isset($data[$key])) {
  2475. $match = true;
  2476. $data = $data[$key];
  2477. unset($key);
  2478. }
  2479. }
  2480. if (!$match) {
  2481. throw new \RuntimeException($settingKey.' is not defined.');
  2482. }
  2483. $value = $data;
  2484. } elseif (isset($data['config'][$settingKey])) {
  2485. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  2486. } elseif (isset($rawData[$settingKey]) && in_array($settingKey, $properties, true)) {
  2487. $value = $rawData[$settingKey];
  2488. } else {
  2489. throw new \RuntimeException($settingKey.' is not defined');
  2490. }
  2491. if (is_array($value)) {
  2492. $value = json_encode($value);
  2493. }
  2494. $sourceOfConfigValue = '';
  2495. if ($input->getOption('source')) {
  2496. $sourceOfConfigValue = ' (' . $this->config->getSourceOfValue($settingKey) . ')';
  2497. }
  2498. $this->getIO()->write($value . $sourceOfConfigValue, true, IOInterface::QUIET);
  2499. return 0;
  2500. }
  2501. $values = $input->getArgument('setting-value');
  2502. $booleanValidator = function ($val): bool {
  2503. return in_array($val, array('true', 'false', '1', '0'), true);
  2504. };
  2505. $booleanNormalizer = function ($val): bool {
  2506. return $val !== 'false' && (bool) $val;
  2507. };
  2508. $uniqueConfigValues = array(
  2509. 'process-timeout' => array('is_numeric', 'intval'),
  2510. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  2511. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  2512. 'preferred-install' => array(
  2513. function ($val): bool {
  2514. return in_array($val, array('auto', 'source', 'dist'), true);
  2515. },
  2516. function ($val) {
  2517. return $val;
  2518. },
  2519. ),
  2520. 'gitlab-protocol' => array(
  2521. function ($val): bool {
  2522. return in_array($val, array('git', 'http', 'https'), true);
  2523. },
  2524. function ($val) {
  2525. return $val;
  2526. },
  2527. ),
  2528. 'store-auths' => array(
  2529. function ($val): bool {
  2530. return in_array($val, array('true', 'false', 'prompt'), true);
  2531. },
  2532. function ($val) {
  2533. if ('prompt' === $val) {
  2534. return 'prompt';
  2535. }
  2536. return $val !== 'false' && (bool) $val;
  2537. },
  2538. ),
  2539. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  2540. 'vendor-dir' => array('is_string', function ($val) {
  2541. return $val;
  2542. }),
  2543. 'bin-dir' => array('is_string', function ($val) {
  2544. return $val;
  2545. }),
  2546. 'archive-dir' => array('is_string', function ($val) {
  2547. return $val;
  2548. }),
  2549. 'archive-format' => array('is_string', function ($val) {
  2550. return $val;
  2551. }),
  2552. 'data-dir' => array('is_string', function ($val) {
  2553. return $val;
  2554. }),
  2555. 'cache-dir' => array('is_string', function ($val) {
  2556. return $val;
  2557. }),
  2558. 'cache-files-dir' => array('is_string', function ($val) {
  2559. return $val;
  2560. }),
  2561. 'cache-repo-dir' => array('is_string', function ($val) {
  2562. return $val;
  2563. }),
  2564. 'cache-vcs-dir' => array('is_string', function ($val) {
  2565. return $val;
  2566. }),
  2567. 'cache-ttl' => array('is_numeric', 'intval'),
  2568. 'cache-files-ttl' => array('is_numeric', 'intval'),
  2569. 'cache-files-maxsize' => array(
  2570. function ($val): bool {
  2571. return Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val);
  2572. },
  2573. function ($val) {
  2574. return $val;
  2575. },
  2576. ),
  2577. 'bin-compat' => array(
  2578. function ($val): bool {
  2579. return in_array($val, array('auto', 'full', 'symlink'));
  2580. },
  2581. function ($val) {
  2582. return $val;
  2583. },
  2584. ),
  2585. 'discard-changes' => array(
  2586. function ($val): bool {
  2587. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  2588. },
  2589. function ($val) {
  2590. if ('stash' === $val) {
  2591. return 'stash';
  2592. }
  2593. return $val !== 'false' && (bool) $val;
  2594. },
  2595. ),
  2596. 'autoloader-suffix' => array('is_string', function ($val) {
  2597. return $val === 'null' ? null : $val;
  2598. }),
  2599. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  2600. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  2601. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  2602. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  2603. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  2604. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  2605. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  2606. 'cafile' => array(
  2607. function ($val): bool {
  2608. return file_exists($val) && Filesystem::isReadable($val);
  2609. },
  2610. function ($val) {
  2611. return $val === 'null' ? null : $val;
  2612. },
  2613. ),
  2614. 'capath' => array(
  2615. function ($val): bool {
  2616. return is_dir($val) && Filesystem::isReadable($val);
  2617. },
  2618. function ($val) {
  2619. return $val === 'null' ? null : $val;
  2620. },
  2621. ),
  2622. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2623. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2624. 'lock' => array($booleanValidator, $booleanNormalizer),
  2625. 'allow-plugins' => array($booleanValidator, $booleanNormalizer),
  2626. 'platform-check' => array(
  2627. function ($val): bool {
  2628. return in_array($val, array('php-only', 'true', 'false', '1', '0'), true);
  2629. },
  2630. function ($val) {
  2631. if ('php-only' === $val) {
  2632. return 'php-only';
  2633. }
  2634. return $val !== 'false' && (bool) $val;
  2635. },
  2636. ),
  2637. 'use-parent-dir' => array(
  2638. function ($val): bool {
  2639. return in_array($val, array('true', 'false', 'prompt'), true);
  2640. },
  2641. function ($val) {
  2642. if ('prompt' === $val) {
  2643. return 'prompt';
  2644. }
  2645. return $val !== 'false' && (bool) $val;
  2646. },
  2647. ),
  2648. );
  2649. $multiConfigValues = array(
  2650. 'github-protocols' => array(
  2651. function ($vals) {
  2652. if (!is_array($vals)) {
  2653. return 'array expected';
  2654. }
  2655. foreach ($vals as $val) {
  2656. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2657. return 'valid protocols include: git, https, ssh';
  2658. }
  2659. }
  2660. return true;
  2661. },
  2662. function ($vals) {
  2663. return $vals;
  2664. },
  2665. ),
  2666. 'github-domains' => array(
  2667. function ($vals) {
  2668. if (!is_array($vals)) {
  2669. return 'array expected';
  2670. }
  2671. return true;
  2672. },
  2673. function ($vals) {
  2674. return $vals;
  2675. },
  2676. ),
  2677. 'gitlab-domains' => array(
  2678. function ($vals) {
  2679. if (!is_array($vals)) {
  2680. return 'array expected';
  2681. }
  2682. return true;
  2683. },
  2684. function ($vals) {
  2685. return $vals;
  2686. },
  2687. ),
  2688. );
  2689. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2690. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2691. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2692. }
  2693. $this->configSource->removeConfigSetting($settingKey);
  2694. return 0;
  2695. }
  2696. if (isset($uniqueConfigValues[$settingKey])) {
  2697. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2698. return 0;
  2699. }
  2700. if (isset($multiConfigValues[$settingKey])) {
  2701. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2702. return 0;
  2703. }
  2704. if (Preg::isMatch('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  2705. if ($input->getOption('unset')) {
  2706. $this->configSource->removeConfigSetting($settingKey);
  2707. return 0;
  2708. }
  2709. list($validator) = $uniqueConfigValues['preferred-install'];
  2710. if (!$validator($values[0])) {
  2711. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  2712. }
  2713. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2714. return 0;
  2715. }
  2716. if (Preg::isMatch('{^allow-plugins\.([a-zA-Z0-9/*-]+)}', $settingKey, $matches)) {
  2717. if ($input->getOption('unset')) {
  2718. $this->configSource->removeConfigSetting($settingKey);
  2719. return 0;
  2720. }
  2721. if (true !== $booleanValidator($values[0])) {
  2722. throw new \RuntimeException(sprintf(
  2723. '"%s" is an invalid value',
  2724. $values[0]
  2725. ));
  2726. }
  2727. $normalizedValue = $booleanNormalizer($values[0]);
  2728. $this->configSource->addConfigSetting($settingKey, $normalizedValue);
  2729. return 0;
  2730. }
  2731. $uniqueProps = array(
  2732. 'name' => array('is_string', function ($val) {
  2733. return $val;
  2734. }),
  2735. 'type' => array('is_string', function ($val) {
  2736. return $val;
  2737. }),
  2738. 'description' => array('is_string', function ($val) {
  2739. return $val;
  2740. }),
  2741. 'homepage' => array('is_string', function ($val) {
  2742. return $val;
  2743. }),
  2744. 'version' => array('is_string', function ($val) {
  2745. return $val;
  2746. }),
  2747. 'minimum-stability' => array(
  2748. function ($val): bool {
  2749. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2750. },
  2751. function ($val): string {
  2752. return VersionParser::normalizeStability($val);
  2753. },
  2754. ),
  2755. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2756. );
  2757. $multiProps = array(
  2758. 'keywords' => array(
  2759. function ($vals) {
  2760. if (!is_array($vals)) {
  2761. return 'array expected';
  2762. }
  2763. return true;
  2764. },
  2765. function ($vals) {
  2766. return $vals;
  2767. },
  2768. ),
  2769. 'license' => array(
  2770. function ($vals) {
  2771. if (!is_array($vals)) {
  2772. return 'array expected';
  2773. }
  2774. return true;
  2775. },
  2776. function ($vals) {
  2777. return $vals;
  2778. },
  2779. ),
  2780. );
  2781. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
  2782. throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2783. }
  2784. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2785. $this->configSource->removeProperty($settingKey);
  2786. return 0;
  2787. }
  2788. if (isset($uniqueProps[$settingKey])) {
  2789. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2790. return 0;
  2791. }
  2792. if (isset($multiProps[$settingKey])) {
  2793. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2794. return 0;
  2795. }
  2796. if (Preg::isMatch('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2797. if ($input->getOption('unset')) {
  2798. $this->configSource->removeRepository($matches[1]);
  2799. return 0;
  2800. }
  2801. if (2 === count($values)) {
  2802. $this->configSource->addRepository($matches[1], array(
  2803. 'type' => $values[0],
  2804. 'url' => $values[1],
  2805. ), $input->getOption('append'));
  2806. return 0;
  2807. }
  2808. if (1 === count($values)) {
  2809. $value = strtolower($values[0]);
  2810. if (true === $booleanValidator($value)) {
  2811. if (false === $booleanNormalizer($value)) {
  2812. $this->configSource->addRepository($matches[1], false, $input->getOption('append'));
  2813. return 0;
  2814. }
  2815. } else {
  2816. $value = JsonFile::parseJson($values[0]);
  2817. $this->configSource->addRepository($matches[1], $value, $input->getOption('append'));
  2818. return 0;
  2819. }
  2820. }
  2821. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2822. }
  2823. if (Preg::isMatch('/^extra\.(.+)/', $settingKey, $matches)) {
  2824. if ($input->getOption('unset')) {
  2825. $this->configSource->removeProperty($settingKey);
  2826. return 0;
  2827. }
  2828. $value = $values[0];
  2829. if ($input->getOption('json')) {
  2830. $value = JsonFile::parseJson($value);
  2831. if ($input->getOption('merge')) {
  2832. $currentValue = $this->configFile->read();
  2833. $bits = explode('.', $settingKey);
  2834. foreach ($bits as $bit) {
  2835. $currentValue = $currentValue[$bit] ?? null;
  2836. }
  2837. if (is_array($currentValue)) {
  2838. $value = array_merge($currentValue, $value);
  2839. }
  2840. }
  2841. }
  2842. $this->configSource->addProperty($settingKey, $value);
  2843. return 0;
  2844. }
  2845. if (Preg::isMatch('/^suggest\.(.+)/', $settingKey, $matches)) {
  2846. if ($input->getOption('unset')) {
  2847. $this->configSource->removeProperty($settingKey);
  2848. return 0;
  2849. }
  2850. $this->configSource->addProperty($settingKey, implode(' ', $values));
  2851. return 0;
  2852. }
  2853. if (in_array($settingKey, array('suggest', 'extra'), true) && $input->getOption('unset')) {
  2854. $this->configSource->removeProperty($settingKey);
  2855. return 0;
  2856. }
  2857. if (Preg::isMatch('/^platform\.(.+)/', $settingKey, $matches)) {
  2858. if ($input->getOption('unset')) {
  2859. $this->configSource->removeConfigSetting($settingKey);
  2860. return 0;
  2861. }
  2862. $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]);
  2863. return 0;
  2864. }
  2865. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2866. $this->configSource->removeConfigSetting($settingKey);
  2867. return 0;
  2868. }
  2869. if (Preg::isMatch('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  2870. if ($input->getOption('unset')) {
  2871. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2872. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2873. return 0;
  2874. }
  2875. if ($matches[1] === 'bitbucket-oauth') {
  2876. if (2 !== count($values)) {
  2877. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2878. }
  2879. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2880. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2881. } elseif ($matches[1] === 'gitlab-token' && 2 === count($values)) {
  2882. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2883. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'token' => $values[1]));
  2884. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'), true)) {
  2885. if (1 !== count($values)) {
  2886. throw new \RuntimeException('Too many arguments, expected only one token');
  2887. }
  2888. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2889. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2890. } elseif ($matches[1] === 'http-basic') {
  2891. if (2 !== count($values)) {
  2892. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2893. }
  2894. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2895. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2896. }
  2897. return 0;
  2898. }
  2899. if (Preg::isMatch('/^scripts\.(.+)/', $settingKey, $matches)) {
  2900. if ($input->getOption('unset')) {
  2901. $this->configSource->removeProperty($settingKey);
  2902. return 0;
  2903. }
  2904. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2905. return 0;
  2906. }
  2907. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2908. }
  2909. protected function handleSingleValue(string $key, array $callbacks, array $values, string $method): void
  2910. {
  2911. list($validator, $normalizer) = $callbacks;
  2912. if (1 !== count($values)) {
  2913. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2914. }
  2915. if (true !== $validation = $validator($values[0])) {
  2916. throw new \RuntimeException(sprintf(
  2917. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2918. $values[0]
  2919. ));
  2920. }
  2921. $normalizedValue = $normalizer($values[0]);
  2922. if ($key === 'disable-tls') {
  2923. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2924. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2925. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2926. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2927. }
  2928. }
  2929. call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2930. }
  2931. protected function handleMultiValue(string $key, array $callbacks, array $values, string $method): void
  2932. {
  2933. list($validator, $normalizer) = $callbacks;
  2934. if (true !== $validation = $validator($values)) {
  2935. throw new \RuntimeException(sprintf(
  2936. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2937. json_encode($values)
  2938. ));
  2939. }
  2940. call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2941. }
  2942. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, ?string $k = null, bool $showSource = false): void
  2943. {
  2944. $origK = $k;
  2945. $io = $this->getIO();
  2946. foreach ($contents as $key => $value) {
  2947. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2948. continue;
  2949. }
  2950. $rawVal = $rawContents[$key] ?? null;
  2951. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2952. $k .= Preg::replace('{^config\.}', '', $key . '.');
  2953. $this->listConfiguration($value, $rawVal, $output, $k, $showSource);
  2954. $k = $origK;
  2955. continue;
  2956. }
  2957. if (is_array($value)) {
  2958. $value = array_map(function ($val) {
  2959. return is_array($val) ? json_encode($val) : $val;
  2960. }, $value);
  2961. $value = '['.implode(', ', $value).']';
  2962. }
  2963. if (is_bool($value)) {
  2964. $value = var_export($value, true);
  2965. }
  2966. $source = '';
  2967. if ($showSource) {
  2968. $source = ' (' . $this->config->getSourceOfValue($k . $key) . ')';
  2969. }
  2970. if (null !== $k && 0 === strpos($k, 'repositories')) {
  2971. $link = 'https://getcomposer.org/doc/05-repositories.md';
  2972. } else {
  2973. $id = Preg::replace('{\..*$}', '', $k === '' || $k === null ? (string) $key : $k);
  2974. $id = Preg::replace('{[^a-z0-9]}i', '-', strtolower(trim($id)));
  2975. $id = Preg::replace('{-+}', '-', $id);
  2976. $link = 'https://getcomposer.org/doc/06-config.md#' . $id;
  2977. }
  2978. if (is_string($rawVal) && $rawVal != $value) {
  2979. $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $rawVal . ' (' . $value . ')</info>' . $source, true, IOInterface::QUIET);
  2980. } else {
  2981. $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $value . '</info>' . $source, true, IOInterface::QUIET);
  2982. }
  2983. }
  2984. }
  2985. }
  2986. <?php declare(strict_types=1);
  2987. namespace Composer\Command;
  2988. use Composer\Config;
  2989. use Composer\Factory;
  2990. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  2991. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  2992. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  2993. use Composer\Installer;
  2994. use Composer\Installer\ProjectInstaller;
  2995. use Composer\Installer\SuggestedPackagesReporter;
  2996. use Composer\IO\IOInterface;
  2997. use Composer\Package\BasePackage;
  2998. use Composer\DependencyResolver\Operation\InstallOperation;
  2999. use Composer\Package\Version\VersionSelector;
  3000. use Composer\Package\AliasPackage;
  3001. use Composer\Pcre\Preg;
  3002. use Composer\Repository\RepositoryFactory;
  3003. use Composer\Repository\CompositeRepository;
  3004. use Composer\Repository\PlatformRepository;
  3005. use Composer\Repository\InstalledArrayRepository;
  3006. use Composer\Repository\RepositorySet;
  3007. use Composer\Script\ScriptEvents;
  3008. use Composer\Util\Silencer;
  3009. use Symfony\Component\Console\Input\InputArgument;
  3010. use Symfony\Component\Console\Input\InputInterface;
  3011. use Symfony\Component\Console\Input\InputOption;
  3012. use Symfony\Component\Console\Output\OutputInterface;
  3013. use Symfony\Component\Finder\Finder;
  3014. use Composer\Json\JsonFile;
  3015. use Composer\Config\JsonConfigSource;
  3016. use Composer\Util\Filesystem;
  3017. use Composer\Util\Platform;
  3018. use Composer\Util\ProcessExecutor;
  3019. use Composer\Package\Version\VersionParser;
  3020. class CreateProjectCommand extends BaseCommand
  3021. {
  3022. protected $suggestedPackagesReporter;
  3023. protected function configure(): void
  3024. {
  3025. $this
  3026. ->setName('create-project')
  3027. ->setDescription('Creates new project from a package into given directory.')
  3028. ->setDefinition(array(
  3029. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  3030. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  3031. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  3032. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  3033. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3034. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  3035. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).'),
  3036. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories to look the package up, either by URL or using JSON arrays'),
  3037. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  3038. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the custom repository in the composer.json. If a lock file is present it will be deleted and an update will be run instead of install.'),
  3039. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3040. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3041. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3042. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  3043. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3044. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  3045. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  3046. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  3047. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  3048. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  3049. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  3050. new InputOption('ask', null, InputOption::VALUE_NONE, 'Whether to ask for project directory.'),
  3051. ))
  3052. ->setHelp(
  3053. <<<EOT
  3054. The <info>create-project</info> command creates a new project from a given
  3055. package into a new directory. If executed without params and in a directory
  3056. with a composer.json file it installs the packages for the current project.
  3057. You can use this command to bootstrap new projects or setup a clean
  3058. version-controlled installation for developers of your project.
  3059. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  3060. You can also specify the version with the package name using = or : as separator.
  3061. <info>php composer.phar create-project vendor/project:version target-directory</info>
  3062. To install unstable packages, either specify the version you want, or use the
  3063. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  3064. To setup a developer workable version you should create the project using the source
  3065. controlled code by appending the <info>'--prefer-source'</info> flag.
  3066. To install a package from another repository than the default one you
  3067. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  3068. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  3069. EOT
  3070. )
  3071. ;
  3072. }
  3073. protected function execute(InputInterface $input, OutputInterface $output): int
  3074. {
  3075. $config = Factory::createConfig();
  3076. $io = $this->getIO();
  3077. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  3078. if ($input->getOption('dev')) {
  3079. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3080. }
  3081. if ($input->getOption('no-custom-installers')) {
  3082. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3083. $input->setOption('no-plugins', true);
  3084. }
  3085. if ($input->isInteractive() && $input->getOption('ask')) {
  3086. $package = $input->getArgument('package');
  3087. if (null === $package) {
  3088. throw new \RuntimeException('Not enough arguments (missing: "package").');
  3089. }
  3090. $parts = explode("/", strtolower($package), 2);
  3091. $input->setArgument('directory', $io->ask('New project directory [<comment>'.array_pop($parts).'</comment>]: '));
  3092. }
  3093. return $this->installProject(
  3094. $io,
  3095. $config,
  3096. $input,
  3097. $input->getArgument('package'),
  3098. $input->getArgument('directory'),
  3099. $input->getArgument('version'),
  3100. $input->getOption('stability'),
  3101. $preferSource,
  3102. $preferDist,
  3103. !$input->getOption('no-dev'),
  3104. $input->getOption('repository') ?: $input->getOption('repository-url'),
  3105. $input->getOption('no-plugins'),
  3106. $input->getOption('no-scripts'),
  3107. $input->getOption('no-progress'),
  3108. $input->getOption('no-install'),
  3109. $this->getPlatformRequirementFilter($input),
  3110. !$input->getOption('no-secure-http'),
  3111. $input->getOption('add-repository')
  3112. );
  3113. }
  3114. public function installProject(IOInterface $io, Config $config, InputInterface $input, ?string $packageName = null, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $noInstall = false, PlatformRequirementFilterInterface $platformRequirementFilter = null, bool $secureHttp = true, bool $addRepository = false): int
  3115. {
  3116. $oldCwd = Platform::getCwd();
  3117. if ($repositories !== null && !is_array($repositories)) {
  3118. $repositories = (array) $repositories;
  3119. }
  3120. $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
  3121. $io->loadConfiguration($config);
  3122. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  3123. if ($packageName !== null) {
  3124. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $platformRequirementFilter, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositories, $disablePlugins, $disableScripts, $noProgress, $secureHttp);
  3125. } else {
  3126. $installedFromVcs = false;
  3127. }
  3128. if ($repositories !== null && $addRepository && is_file('composer.lock')) {
  3129. unlink('composer.lock');
  3130. }
  3131. $composer = Factory::create($io, null, $disablePlugins, $disableScripts);
  3132. if ($repositories !== null && $addRepository) {
  3133. foreach ($repositories as $index => $repo) {
  3134. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repo, true);
  3135. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  3136. $name = RepositoryFactory::generateRepositoryName($index, $repoConfig, $composerJsonRepositoriesConfig);
  3137. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  3138. if (
  3139. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3140. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3141. ) {
  3142. $configSource->addRepository('packagist.org', false);
  3143. } else {
  3144. $configSource->addRepository($name, $repoConfig, false);
  3145. }
  3146. $composer = Factory::create($io, null, $disablePlugins);
  3147. }
  3148. }
  3149. $process = $composer->getLoop()->getProcessExecutor();
  3150. $fs = new Filesystem($process);
  3151. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  3152. $config = $composer->getConfig();
  3153. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  3154. if ($noInstall === false) {
  3155. $composer->getInstallationManager()->setOutputProgress(!$noProgress);
  3156. $installer = Installer::create($io, $composer);
  3157. $installer->setPreferSource($preferSource)
  3158. ->setPreferDist($preferDist)
  3159. ->setDevMode($installDevPackages)
  3160. ->setPlatformRequirementFilter($platformRequirementFilter)
  3161. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  3162. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  3163. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  3164. ->setApcuAutoloader($config->get('apcu-autoloader'));
  3165. if (!$composer->getLocker()->isLocked()) {
  3166. $installer->setUpdate(true);
  3167. }
  3168. if ($disablePlugins) {
  3169. $installer->disablePlugins();
  3170. }
  3171. $status = $installer->run();
  3172. if (0 !== $status) {
  3173. return $status;
  3174. }
  3175. }
  3176. $hasVcs = $installedFromVcs;
  3177. if (
  3178. !$input->getOption('keep-vcs')
  3179. && $installedFromVcs
  3180. && (
  3181. $input->getOption('remove-vcs')
  3182. || !$io->isInteractive()
  3183. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ')
  3184. )
  3185. ) {
  3186. $finder = new Finder();
  3187. $finder->depth(0)->directories()->in(Platform::getCwd())->ignoreVCS(false)->ignoreDotFiles(false);
  3188. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  3189. $finder->name($vcsName);
  3190. }
  3191. try {
  3192. $dirs = iterator_to_array($finder);
  3193. unset($finder);
  3194. foreach ($dirs as $dir) {
  3195. if (!$fs->removeDirectory((string) $dir)) {
  3196. throw new \RuntimeException('Could not remove '.$dir);
  3197. }
  3198. }
  3199. } catch (\Exception $e) {
  3200. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  3201. }
  3202. $hasVcs = false;
  3203. }
  3204. if (!$hasVcs) {
  3205. $package = $composer->getPackage();
  3206. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  3207. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  3208. foreach ($package->{'get'.$meta['method']}() as $link) {
  3209. if ($link->getPrettyConstraint() === 'self.version') {
  3210. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  3211. }
  3212. }
  3213. }
  3214. }
  3215. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  3216. chdir($oldCwd);
  3217. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  3218. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  3219. Silencer::call('rmdir', $vendorComposerDir);
  3220. $vendorDir = $config->get('vendor-dir');
  3221. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  3222. Silencer::call('rmdir', $vendorDir);
  3223. }
  3224. }
  3225. return 0;
  3226. }
  3227. protected function installRootPackage(IOInterface $io, Config $config, string $packageName, PlatformRequirementFilterInterface $platformRequirementFilter, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, array $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $secureHttp = true): bool
  3228. {
  3229. if (!$secureHttp) {
  3230. $config->merge(array('config' => array('secure-http' => false)), Config::SOURCE_COMMAND);
  3231. }
  3232. $parser = new VersionParser();
  3233. $requirements = $parser->parseNameVersionPairs(array($packageName));
  3234. $name = strtolower($requirements[0]['name']);
  3235. if (!$packageVersion && isset($requirements[0]['version'])) {
  3236. $packageVersion = $requirements[0]['version'];
  3237. }
  3238. if (null === $directory) {
  3239. $parts = explode("/", $name, 2);
  3240. $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  3241. }
  3242. $process = new ProcessExecutor($io);
  3243. $fs = new Filesystem($process);
  3244. if (!$fs->isAbsolutePath($directory)) {
  3245. $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . $directory;
  3246. }
  3247. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(Platform::getCwd(), $directory, true) . '"</info>');
  3248. if (file_exists($directory)) {
  3249. if (!is_dir($directory)) {
  3250. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  3251. }
  3252. if (!$fs->isDirEmpty($directory)) {
  3253. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  3254. }
  3255. }
  3256. if (null === $stability) {
  3257. if (null === $packageVersion) {
  3258. $stability = 'stable';
  3259. } elseif (Preg::isMatch('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  3260. $stability = $match[1];
  3261. } else {
  3262. $stability = VersionParser::parseStability($packageVersion);
  3263. }
  3264. }
  3265. $stability = VersionParser::normalizeStability($stability);
  3266. if (!isset(BasePackage::$stabilities[$stability])) {
  3267. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  3268. }
  3269. $composer = Factory::create($io, $config->all(), $disablePlugins);
  3270. $config = $composer->getConfig();
  3271. $rm = $composer->getRepositoryManager();
  3272. $repositorySet = new RepositorySet($stability);
  3273. if (null === $repositories) {
  3274. $repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)));
  3275. } else {
  3276. foreach ($repositories as $repo) {
  3277. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
  3278. if (
  3279. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3280. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3281. ) {
  3282. continue;
  3283. }
  3284. $repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig, $rm));
  3285. }
  3286. }
  3287. $platformOverrides = $config->get('platform') ?: array();
  3288. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  3289. $versionSelector = new VersionSelector($repositorySet, $platformRepo);
  3290. $package = $versionSelector->findBestCandidate($name, $packageVersion, $stability, $platformRequirementFilter);
  3291. if (!$package) {
  3292. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  3293. if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && $versionSelector->findBestCandidate($name, $packageVersion, $stability, PlatformRequirementFilterFactory::ignoreAll())) {
  3294. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version, PHP extensions and Composer version.');
  3295. }
  3296. throw new \InvalidArgumentException($errorMessage .'.');
  3297. }
  3298. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  3299. @mkdir($directory, 0777, true);
  3300. if ($realDir = realpath($directory)) {
  3301. pcntl_async_signals(true);
  3302. pcntl_signal(SIGINT, function () use ($realDir): void {
  3303. $fs = new Filesystem();
  3304. $fs->removeDirectory($realDir);
  3305. exit(130);
  3306. });
  3307. }
  3308. }
  3309. if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli') {
  3310. @mkdir($directory, 0777, true);
  3311. if ($realDir = realpath($directory)) {
  3312. sapi_windows_set_ctrl_handler(function () use ($realDir): void {
  3313. $fs = new Filesystem();
  3314. $fs->removeDirectory($realDir);
  3315. exit(130);
  3316. });
  3317. }
  3318. }
  3319. if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  3320. $package = $package->getAliasOf();
  3321. }
  3322. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  3323. if ($disablePlugins) {
  3324. $io->writeError('<info>Plugins have been disabled.</info>');
  3325. }
  3326. if ($package instanceof AliasPackage) {
  3327. $package = $package->getAliasOf();
  3328. }
  3329. $dm = $composer->getDownloadManager();
  3330. $dm->setPreferSource($preferSource)
  3331. ->setPreferDist($preferDist);
  3332. $projectInstaller = new ProjectInstaller($directory, $dm, $fs);
  3333. $im = $composer->getInstallationManager();
  3334. $im->setOutputProgress(!$noProgress);
  3335. $im->addInstaller($projectInstaller);
  3336. $im->execute(new InstalledArrayRepository(), array(new InstallOperation($package)));
  3337. $im->notifyInstalls($io);
  3338. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  3339. $installedFromVcs = 'source' === $package->getInstallationSource();
  3340. $io->writeError('<info>Created project in ' . $directory . '</info>');
  3341. chdir($directory);
  3342. Platform::putEnv('COMPOSER_ROOT_VERSION', $package->getPrettyVersion());
  3343. return $installedFromVcs;
  3344. }
  3345. }
  3346. <?php declare(strict_types=1);
  3347. namespace Composer\Command;
  3348. use Symfony\Component\Console\Input\InputInterface;
  3349. use Symfony\Component\Console\Output\OutputInterface;
  3350. use Symfony\Component\Console\Input\InputArgument;
  3351. use Symfony\Component\Console\Input\InputOption;
  3352. class DependsCommand extends BaseDependencyCommand
  3353. {
  3354. protected function configure(): void
  3355. {
  3356. $this
  3357. ->setName('depends')
  3358. ->setAliases(array('why'))
  3359. ->setDescription('Shows which packages cause the given package to be installed.')
  3360. ->setDefinition(array(
  3361. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  3362. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  3363. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  3364. ))
  3365. ->setHelp(
  3366. <<<EOT
  3367. Displays detailed information about where a package is referenced.
  3368. <info>php composer.phar depends composer/composer</info>
  3369. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  3370. EOT
  3371. )
  3372. ;
  3373. }
  3374. protected function execute(InputInterface $input, OutputInterface $output): int
  3375. {
  3376. return parent::doExecute($input, $output);
  3377. }
  3378. }
  3379. <?php declare(strict_types=1);
  3380. namespace Composer\Command;
  3381. use Composer\Composer;
  3382. use Composer\Factory;
  3383. use Composer\Config;
  3384. use Composer\Downloader\TransportException;
  3385. use Composer\Pcre\Preg;
  3386. use Composer\Repository\PlatformRepository;
  3387. use Composer\Plugin\CommandEvent;
  3388. use Composer\Plugin\PluginEvents;
  3389. use Composer\Util\ConfigValidator;
  3390. use Composer\Util\IniHelper;
  3391. use Composer\Util\ProcessExecutor;
  3392. use Composer\Util\HttpDownloader;
  3393. use Composer\Util\StreamContextFactory;
  3394. use Composer\Util\Platform;
  3395. use Composer\SelfUpdate\Keys;
  3396. use Composer\SelfUpdate\Versions;
  3397. use Composer\IO\NullIO;
  3398. use Composer\Package\CompletePackageInterface;
  3399. use Composer\XdebugHandler\XdebugHandler;
  3400. use Symfony\Component\Console\Input\InputInterface;
  3401. use Symfony\Component\Console\Output\OutputInterface;
  3402. use Symfony\Component\Process\ExecutableFinder;
  3403. class DiagnoseCommand extends BaseCommand
  3404. {
  3405. protected $httpDownloader;
  3406. protected $process;
  3407. protected $exitCode = 0;
  3408. protected function configure(): void
  3409. {
  3410. $this
  3411. ->setName('diagnose')
  3412. ->setDescription('Diagnoses the system to identify common errors.')
  3413. ->setHelp(
  3414. <<<EOT
  3415. The <info>diagnose</info> command checks common errors to help debugging problems.
  3416. The process exit code will be 1 in case of warnings and 2 for errors.
  3417. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  3418. EOT
  3419. )
  3420. ;
  3421. }
  3422. protected function execute(InputInterface $input, OutputInterface $output)
  3423. {
  3424. $composer = $this->tryComposer();
  3425. $io = $this->getIO();
  3426. if ($composer) {
  3427. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  3428. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3429. $io->write('Checking composer.json: ', false);
  3430. $this->outputResult($this->checkComposerSchema());
  3431. $this->process = $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io);
  3432. } else {
  3433. $this->process = new ProcessExecutor($io);
  3434. }
  3435. if ($composer) {
  3436. $config = $composer->getConfig();
  3437. } else {
  3438. $config = Factory::createConfig();
  3439. }
  3440. $config->merge(array('config' => array('secure-http' => false)), Config::SOURCE_COMMAND);
  3441. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  3442. $this->httpDownloader = Factory::createHttpDownloader($io, $config);
  3443. $io->write('Checking platform settings: ', false);
  3444. $this->outputResult($this->checkPlatform());
  3445. $io->write('Checking git settings: ', false);
  3446. $this->outputResult($this->checkGit());
  3447. $io->write('Checking http connectivity to packagist: ', false);
  3448. $this->outputResult($this->checkHttp('http', $config));
  3449. $io->write('Checking https connectivity to packagist: ', false);
  3450. $this->outputResult($this->checkHttp('https', $config));
  3451. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  3452. if (!empty($opts['http']['proxy'])) {
  3453. $io->write('Checking HTTP proxy: ', false);
  3454. $this->outputResult($this->checkHttpProxy());
  3455. }
  3456. if ($oauth = $config->get('github-oauth')) {
  3457. foreach ($oauth as $domain => $token) {
  3458. $io->write('Checking '.$domain.' oauth access: ', false);
  3459. $this->outputResult($this->checkGithubOauth($domain, $token));
  3460. }
  3461. } else {
  3462. $io->write('Checking github.com rate limit: ', false);
  3463. try {
  3464. $rate = $this->getGithubRateLimit('github.com');
  3465. if (!is_array($rate)) {
  3466. $this->outputResult($rate);
  3467. } elseif (10 > $rate['remaining']) {
  3468. $io->write('<warning>WARNING</warning>');
  3469. $io->write(sprintf(
  3470. '<comment>Github has a rate limit on their API. '
  3471. . 'You currently have <options=bold>%u</options=bold> '
  3472. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  3473. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  3474. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  3475. $rate['remaining'],
  3476. $rate['limit']
  3477. ));
  3478. } else {
  3479. $this->outputResult(true);
  3480. }
  3481. } catch (\Exception $e) {
  3482. if ($e instanceof TransportException && $e->getCode() === 401) {
  3483. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  3484. } else {
  3485. $this->outputResult($e);
  3486. }
  3487. }
  3488. }
  3489. $io->write('Checking disk free space: ', false);
  3490. $this->outputResult($this->checkDiskSpace($config));
  3491. if (strpos(__FILE__, 'phar:') === 0) {
  3492. $io->write('Checking pubkeys: ', false);
  3493. $this->outputResult($this->checkPubKeys($config));
  3494. $io->write('Checking composer version: ', false);
  3495. $this->outputResult($this->checkVersion($config));
  3496. }
  3497. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::getVersion()));
  3498. $platformOverrides = $config->get('platform') ?: array();
  3499. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  3500. $phpPkg = $platformRepo->findPackage('php', '*');
  3501. $phpVersion = $phpPkg->getPrettyVersion();
  3502. if ($phpPkg instanceof CompletePackageInterface && false !== strpos($phpPkg->getDescription(), 'overridden')) {
  3503. $phpVersion .= ' - ' . $phpPkg->getDescription();
  3504. }
  3505. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  3506. if (defined('PHP_BINARY')) {
  3507. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  3508. }
  3509. $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>'));
  3510. $io->write('cURL version: ' . $this->getCurlVersion());
  3511. $finder = new ExecutableFinder;
  3512. $hasSystemUnzip = (bool) $finder->find('unzip');
  3513. $bin7zip = '';
  3514. if ($hasSystem7zip = (bool) $finder->find('7z', null, array('C:\Program Files\7-Zip'))) {
  3515. $bin7zip = '7z';
  3516. }
  3517. if (!Platform::isWindows() && !$hasSystem7zip && $hasSystem7zip = (bool) $finder->find('7zz')) {
  3518. $bin7zip = '7zz';
  3519. }
  3520. $io->write(
  3521. 'zip: ' . (extension_loaded('zip') ? '<comment>extension present</comment>' : '<comment>extension not loaded</comment>')
  3522. . ', ' . ($hasSystemUnzip ? '<comment>unzip present</comment>' : '<comment>unzip not available</comment>')
  3523. . ', ' . ($hasSystem7zip ? '<comment>7-Zip present ('.$bin7zip.')</comment>' : '<comment>7-Zip not available</comment>')
  3524. . (($hasSystem7zip || $hasSystemUnzip) && !function_exists('proc_open') ? ', <warning>proc_open is disabled or not present, unzip/7-z will not be usable</warning>' : '')
  3525. );
  3526. return $this->exitCode;
  3527. }
  3528. private function checkComposerSchema()
  3529. {
  3530. $validator = new ConfigValidator($this->getIO());
  3531. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  3532. if ($errors || $warnings) {
  3533. $messages = array(
  3534. 'error' => $errors,
  3535. 'warning' => $warnings,
  3536. );
  3537. $output = '';
  3538. foreach ($messages as $style => $msgs) {
  3539. foreach ($msgs as $msg) {
  3540. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  3541. }
  3542. }
  3543. return rtrim($output);
  3544. }
  3545. return true;
  3546. }
  3547. private function checkGit()
  3548. {
  3549. if (!function_exists('proc_open')) {
  3550. return '<comment>proc_open is not available, git cannot be used</comment>';
  3551. }
  3552. $this->process->execute('git config color.ui', $output);
  3553. if (strtolower(trim($output)) === 'always') {
  3554. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  3555. }
  3556. return true;
  3557. }
  3558. private function checkHttp(string $proto, Config $config)
  3559. {
  3560. $result = $this->checkConnectivity();
  3561. if ($result !== true) {
  3562. return $result;
  3563. }
  3564. $result = array();
  3565. if ($proto === 'https' && $config->get('disable-tls') === true) {
  3566. $tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  3567. }
  3568. try {
  3569. $this->httpDownloader->get($proto . '://repo.packagist.org/packages.json');
  3570. } catch (TransportException $e) {
  3571. $hints = HttpDownloader::getExceptionHints($e);
  3572. if (null !== $hints && count($hints) > 0) {
  3573. foreach ($hints as $hint) {
  3574. $result[] = $hint;
  3575. }
  3576. }
  3577. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  3578. }
  3579. if (isset($tlsWarning)) {
  3580. $result[] = $tlsWarning;
  3581. }
  3582. if (count($result) > 0) {
  3583. return $result;
  3584. }
  3585. return true;
  3586. }
  3587. private function checkHttpProxy()
  3588. {
  3589. $result = $this->checkConnectivity();
  3590. if ($result !== true) {
  3591. return $result;
  3592. }
  3593. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  3594. try {
  3595. $json = $this->httpDownloader->get($protocol . '://repo.packagist.org/packages.json')->decodeJson();
  3596. $hash = reset($json['provider-includes']);
  3597. $hash = $hash['sha256'];
  3598. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  3599. $provider = $this->httpDownloader->get($protocol . '://repo.packagist.org/'.$path)->getBody();
  3600. if (hash('sha256', $provider) !== $hash) {
  3601. return 'It seems that your proxy is modifying http traffic on the fly';
  3602. }
  3603. } catch (\Exception $e) {
  3604. return $e;
  3605. }
  3606. return true;
  3607. }
  3608. private function checkGithubOauth(string $domain, string $token)
  3609. {
  3610. $result = $this->checkConnectivity();
  3611. if ($result !== true) {
  3612. return $result;
  3613. }
  3614. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3615. try {
  3616. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  3617. $this->httpDownloader->get($url, array(
  3618. 'retry-auth-failure' => false,
  3619. ));
  3620. return true;
  3621. } catch (\Exception $e) {
  3622. if ($e instanceof TransportException && $e->getCode() === 401) {
  3623. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  3624. }
  3625. return $e;
  3626. }
  3627. }
  3628. private function getGithubRateLimit(string $domain, string $token = null)
  3629. {
  3630. $result = $this->checkConnectivity();
  3631. if ($result !== true) {
  3632. return $result;
  3633. }
  3634. if ($token) {
  3635. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3636. }
  3637. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  3638. $data = $this->httpDownloader->get($url, array('retry-auth-failure' => false))->decodeJson();
  3639. return $data['resources']['core'];
  3640. }
  3641. private function checkDiskSpace(Config $config)
  3642. {
  3643. $minSpaceFree = 1024 * 1024;
  3644. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  3645. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  3646. ) {
  3647. return '<error>The disk hosting '.$dir.' is full</error>';
  3648. }
  3649. return true;
  3650. }
  3651. private function checkPubKeys(Config $config)
  3652. {
  3653. $home = $config->get('home');
  3654. $errors = array();
  3655. $io = $this->getIO();
  3656. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  3657. $io->write('');
  3658. }
  3659. if (file_exists($home.'/keys.tags.pub')) {
  3660. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  3661. } else {
  3662. $errors[] = '<error>Missing pubkey for tags verification</error>';
  3663. }
  3664. if (file_exists($home.'/keys.dev.pub')) {
  3665. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  3666. } else {
  3667. $errors[] = '<error>Missing pubkey for dev verification</error>';
  3668. }
  3669. if ($errors) {
  3670. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  3671. }
  3672. return $errors ?: true;
  3673. }
  3674. private function checkVersion(Config $config)
  3675. {
  3676. $result = $this->checkConnectivity();
  3677. if ($result !== true) {
  3678. return $result;
  3679. }
  3680. $versionsUtil = new Versions($config, $this->httpDownloader);
  3681. try {
  3682. $latest = $versionsUtil->getLatest();
  3683. } catch (\Exception $e) {
  3684. return $e;
  3685. }
  3686. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  3687. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  3688. }
  3689. return true;
  3690. }
  3691. private function getCurlVersion(): string
  3692. {
  3693. if (extension_loaded('curl')) {
  3694. if (!HttpDownloader::isCurlEnabled()) {
  3695. return '<error>disabled via disable_functions, using php streams fallback, which reduces performance</error>';
  3696. }
  3697. $version = curl_version();
  3698. return '<comment>'.$version['version'].'</comment> '.
  3699. 'libz <comment>'.(!empty($version['libz_version']) ? $version['libz_version'] : 'missing').'</comment> '.
  3700. 'ssl <comment>'.($version['ssl_version'] ?? 'missing').'</comment>';
  3701. }
  3702. return '<error>missing, using php streams fallback, which reduces performance</error>';
  3703. }
  3704. private function outputResult($result): void
  3705. {
  3706. $io = $this->getIO();
  3707. if (true === $result) {
  3708. $io->write('<info>OK</info>');
  3709. return;
  3710. }
  3711. $hadError = false;
  3712. $hadWarning = false;
  3713. if ($result instanceof \Exception) {
  3714. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  3715. }
  3716. if (!$result) {
  3717. $hadError = true;
  3718. } else {
  3719. if (!is_array($result)) {
  3720. $result = array($result);
  3721. }
  3722. foreach ($result as $message) {
  3723. if (false !== strpos($message, '<error>')) {
  3724. $hadError = true;
  3725. } elseif (false !== strpos($message, '<warning>')) {
  3726. $hadWarning = true;
  3727. }
  3728. }
  3729. }
  3730. if ($hadError) {
  3731. $io->write('<error>FAIL</error>');
  3732. $this->exitCode = max($this->exitCode, 2);
  3733. } elseif ($hadWarning) {
  3734. $io->write('<warning>WARNING</warning>');
  3735. $this->exitCode = max($this->exitCode, 1);
  3736. }
  3737. if ($result) {
  3738. foreach ($result as $message) {
  3739. $io->write($message);
  3740. }
  3741. }
  3742. }
  3743. private function checkPlatform()
  3744. {
  3745. $output = '';
  3746. $out = function ($msg, $style) use (&$output): void {
  3747. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  3748. };
  3749. $errors = array();
  3750. $warnings = array();
  3751. $displayIniMessage = false;
  3752. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  3753. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  3754. if (!function_exists('json_decode')) {
  3755. $errors['json'] = true;
  3756. }
  3757. if (!extension_loaded('Phar')) {
  3758. $errors['phar'] = true;
  3759. }
  3760. if (!extension_loaded('filter')) {
  3761. $errors['filter'] = true;
  3762. }
  3763. if (!extension_loaded('hash')) {
  3764. $errors['hash'] = true;
  3765. }
  3766. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  3767. $errors['iconv_mbstring'] = true;
  3768. }
  3769. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  3770. $errors['allow_url_fopen'] = true;
  3771. }
  3772. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  3773. $errors['ioncube'] = ioncube_loader_version();
  3774. }
  3775. if (PHP_VERSION_ID < 70205) {
  3776. $errors['php'] = PHP_VERSION;
  3777. }
  3778. if (!extension_loaded('openssl')) {
  3779. $errors['openssl'] = true;
  3780. }
  3781. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  3782. $warnings['openssl_version'] = true;
  3783. }
  3784. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  3785. $warnings['apc_cli'] = true;
  3786. }
  3787. if (!extension_loaded('zlib')) {
  3788. $warnings['zlib'] = true;
  3789. }
  3790. ob_start();
  3791. phpinfo(INFO_GENERAL);
  3792. $phpinfo = ob_get_clean();
  3793. if (Preg::isMatch('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3794. $configure = $match[1];
  3795. if (false !== strpos($configure, '--enable-sigchild')) {
  3796. $warnings['sigchild'] = true;
  3797. }
  3798. if (false !== strpos($configure, '--with-curlwrappers')) {
  3799. $warnings['curlwrappers'] = true;
  3800. }
  3801. }
  3802. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3803. $warnings['xdebug_profile'] = true;
  3804. } elseif (XdebugHandler::isXdebugActive()) {
  3805. $warnings['xdebug_loaded'] = true;
  3806. }
  3807. if (defined('PHP_WINDOWS_VERSION_BUILD')
  3808. && (version_compare(PHP_VERSION, '7.2.23', '<')
  3809. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  3810. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  3811. $warnings['onedrive'] = PHP_VERSION;
  3812. }
  3813. if (!empty($errors)) {
  3814. foreach ($errors as $error => $current) {
  3815. switch ($error) {
  3816. case 'json':
  3817. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3818. $text .= "Install it or recompile php without --disable-json";
  3819. break;
  3820. case 'phar':
  3821. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3822. $text .= "Install it or recompile php without --disable-phar";
  3823. break;
  3824. case 'filter':
  3825. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3826. $text .= "Install it or recompile php without --disable-filter";
  3827. break;
  3828. case 'hash':
  3829. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3830. $text .= "Install it or recompile php without --disable-hash";
  3831. break;
  3832. case 'iconv_mbstring':
  3833. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3834. $text .= "Install either of them or recompile php without --disable-iconv";
  3835. break;
  3836. case 'php':
  3837. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 7.2.5 or higher.";
  3838. break;
  3839. case 'allow_url_fopen':
  3840. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3841. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3842. $text .= " allow_url_fopen = On";
  3843. $displayIniMessage = true;
  3844. break;
  3845. case 'ioncube':
  3846. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3847. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  3848. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3849. $displayIniMessage = true;
  3850. break;
  3851. case 'openssl':
  3852. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3853. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3854. break;
  3855. default:
  3856. throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown error type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $error));
  3857. }
  3858. $out($text, 'error');
  3859. }
  3860. $output .= PHP_EOL;
  3861. }
  3862. if (!empty($warnings)) {
  3863. foreach ($warnings as $warning => $current) {
  3864. switch ($warning) {
  3865. case 'apc_cli':
  3866. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3867. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3868. $text .= " apc.enable_cli = Off";
  3869. $displayIniMessage = true;
  3870. break;
  3871. case 'zlib':
  3872. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3873. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3874. $displayIniMessage = true;
  3875. break;
  3876. case 'sigchild':
  3877. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3878. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3879. $text .= " https://bugs.php.net/bug.php?id=22999";
  3880. break;
  3881. case 'curlwrappers':
  3882. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3883. $text .= " Recompile it without this flag if possible";
  3884. break;
  3885. case 'openssl_version':
  3886. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3887. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3888. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3889. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3890. break;
  3891. case 'xdebug_loaded':
  3892. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3893. $text .= " Disabling it when using Composer is recommended.";
  3894. break;
  3895. case 'xdebug_profile':
  3896. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3897. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3898. $text .= " xdebug.profiler_enabled = 0";
  3899. $displayIniMessage = true;
  3900. break;
  3901. case 'onedrive':
  3902. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  3903. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  3904. break;
  3905. default:
  3906. throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown warning type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $warning));
  3907. }
  3908. $out($text, 'comment');
  3909. }
  3910. }
  3911. if ($displayIniMessage) {
  3912. $out($iniMessage, 'comment');
  3913. }
  3914. return !$warnings && !$errors ? true : $output;
  3915. }
  3916. private function checkConnectivity()
  3917. {
  3918. if (!ini_get('allow_url_fopen')) {
  3919. return '<info>Skipped because allow_url_fopen is missing.</info>';
  3920. }
  3921. return true;
  3922. }
  3923. }
  3924. <?php declare(strict_types=1);
  3925. namespace Composer\Command;
  3926. use Composer\Plugin\CommandEvent;
  3927. use Composer\Plugin\PluginEvents;
  3928. use Symfony\Component\Console\Input\InputInterface;
  3929. use Symfony\Component\Console\Input\InputOption;
  3930. use Symfony\Component\Console\Output\OutputInterface;
  3931. class DumpAutoloadCommand extends BaseCommand
  3932. {
  3933. protected function configure()
  3934. {
  3935. $this
  3936. ->setName('dump-autoload')
  3937. ->setAliases(array('dumpautoload'))
  3938. ->setDescription('Dumps the autoloader.')
  3939. ->setDefinition(array(
  3940. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3941. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3942. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3943. new InputOption('apcu-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu'),
  3944. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables autoload-dev rules. Composer will by default infer this automatically according to the last install or update --no-dev state.'),
  3945. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules. Composer will by default infer this automatically according to the last install or update --no-dev state.'),
  3946. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  3947. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  3948. ))
  3949. ->setHelp(
  3950. <<<EOT
  3951. <info>php composer.phar dump-autoload</info>
  3952. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3953. EOT
  3954. )
  3955. ;
  3956. }
  3957. protected function execute(InputInterface $input, OutputInterface $output)
  3958. {
  3959. $composer = $this->requireComposer();
  3960. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3961. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3962. $installationManager = $composer->getInstallationManager();
  3963. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3964. $package = $composer->getPackage();
  3965. $config = $composer->getConfig();
  3966. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3967. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3968. $apcuPrefix = $input->getOption('apcu-prefix');
  3969. $apcu = $apcuPrefix !== null || $input->getOption('apcu') || $config->get('apcu-autoloader');
  3970. if ($authoritative) {
  3971. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  3972. } elseif ($optimize) {
  3973. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  3974. } else {
  3975. $this->getIO()->write('<info>Generating autoload files</info>');
  3976. }
  3977. $generator = $composer->getAutoloadGenerator();
  3978. if ($input->getOption('no-dev')) {
  3979. $generator->setDevMode(false);
  3980. }
  3981. if ($input->getOption('dev')) {
  3982. if ($input->getOption('no-dev')) {
  3983. throw new \InvalidArgumentException('You can not use both --no-dev and --dev as they conflict with each other.');
  3984. }
  3985. $generator->setDevMode(true);
  3986. }
  3987. $generator->setClassMapAuthoritative($authoritative);
  3988. $generator->setRunScripts(true);
  3989. $generator->setApcu($apcu, $apcuPrefix);
  3990. $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
  3991. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3992. if ($authoritative) {
  3993. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3994. } elseif ($optimize) {
  3995. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3996. } else {
  3997. $this->getIO()->write('<info>Generated autoload files</info>');
  3998. }
  3999. return 0;
  4000. }
  4001. }
  4002. <?php declare(strict_types=1);
  4003. namespace Composer\Command;
  4004. use Symfony\Component\Console\Input\InputInterface;
  4005. use Symfony\Component\Console\Input\InputOption;
  4006. use Symfony\Component\Console\Output\OutputInterface;
  4007. use Symfony\Component\Console\Input\InputArgument;
  4008. class ExecCommand extends BaseCommand
  4009. {
  4010. protected function configure()
  4011. {
  4012. $this
  4013. ->setName('exec')
  4014. ->setDescription('Executes a vendored binary/script.')
  4015. ->setDefinition(array(
  4016. new InputOption('list', 'l', InputOption::VALUE_NONE),
  4017. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  4018. new InputArgument(
  4019. 'args',
  4020. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  4021. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  4022. ),
  4023. ))
  4024. ->setHelp(
  4025. <<<EOT
  4026. Executes a vendored binary/script.
  4027. Read more at https://getcomposer.org/doc/03-cli.md#exec
  4028. EOT
  4029. )
  4030. ;
  4031. }
  4032. protected function execute(InputInterface $input, OutputInterface $output)
  4033. {
  4034. $composer = $this->requireComposer();
  4035. $binDir = $composer->getConfig()->get('bin-dir');
  4036. if ($input->getOption('list') || null === $input->getArgument('binary')) {
  4037. $bins = glob($binDir . '/*');
  4038. $bins = array_merge($bins, array_map(function ($e) {
  4039. return "$e (local)";
  4040. }, $composer->getPackage()->getBinaries()));
  4041. if (!$bins) {
  4042. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  4043. }
  4044. $this->getIO()->write(
  4045. <<<EOT
  4046. <comment>Available binaries:</comment>
  4047. EOT
  4048. );
  4049. foreach ($bins as $bin) {
  4050. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  4051. continue;
  4052. }
  4053. $previousBin = $bin;
  4054. $bin = basename($bin);
  4055. $this->getIO()->write(
  4056. <<<EOT
  4057. <info>- $bin</info>
  4058. EOT
  4059. );
  4060. }
  4061. return 0;
  4062. }
  4063. $binary = $input->getArgument('binary');
  4064. $dispatcher = $composer->getEventDispatcher();
  4065. $dispatcher->addListener('__exec_command', $binary);
  4066. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory() && $this->getApplication()->getInitialWorkingDirectory() !== false) {
  4067. try {
  4068. chdir($this->getApplication()->getInitialWorkingDirectory());
  4069. } catch (\Exception $e) {
  4070. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  4071. }
  4072. }
  4073. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  4074. }
  4075. }
  4076. <?php declare(strict_types=1);
  4077. namespace Composer\Command;
  4078. use Composer\Json\JsonFile;
  4079. use Composer\Package\AliasPackage;
  4080. use Composer\Package\BasePackage;
  4081. use Composer\Package\CompletePackageInterface;
  4082. use Composer\Pcre\Preg;
  4083. use Composer\Repository\CompositeRepository;
  4084. use Composer\Semver\Constraint\MatchAllConstraint;
  4085. use Symfony\Component\Console\Formatter\OutputFormatter;
  4086. use Symfony\Component\Console\Input\InputInterface;
  4087. use Symfony\Component\Console\Input\InputOption;
  4088. use Symfony\Component\Console\Output\OutputInterface;
  4089. class FundCommand extends BaseCommand
  4090. {
  4091. protected function configure(): void
  4092. {
  4093. $this->setName('fund')
  4094. ->setDescription('Discover how to help fund the maintenance of your dependencies.')
  4095. ->setDefinition(array(
  4096. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4097. ))
  4098. ;
  4099. }
  4100. protected function execute(InputInterface $input, OutputInterface $output): int
  4101. {
  4102. $composer = $this->requireComposer();
  4103. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4104. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  4105. $fundings = array();
  4106. $packagesToLoad = array();
  4107. foreach ($repo->getPackages() as $package) {
  4108. if ($package instanceof AliasPackage) {
  4109. continue;
  4110. }
  4111. $packagesToLoad[$package->getName()] = new MatchAllConstraint();
  4112. }
  4113. $result = $remoteRepos->loadPackages($packagesToLoad, array('dev' => BasePackage::STABILITY_DEV), array());
  4114. foreach ($result['packages'] as $package) {
  4115. if (
  4116. !$package instanceof AliasPackage
  4117. && $package instanceof CompletePackageInterface
  4118. && $package->isDefaultBranch()
  4119. && $package->getFunding()
  4120. && isset($packagesToLoad[$package->getName()])
  4121. ) {
  4122. $fundings = $this->insertFundingData($fundings, $package);
  4123. unset($packagesToLoad[$package->getName()]);
  4124. }
  4125. }
  4126. foreach ($repo->getPackages() as $package) {
  4127. if ($package instanceof AliasPackage || !isset($packagesToLoad[$package->getName()])) {
  4128. continue;
  4129. }
  4130. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  4131. $fundings = $this->insertFundingData($fundings, $package);
  4132. }
  4133. }
  4134. ksort($fundings);
  4135. $io = $this->getIO();
  4136. $format = $input->getOption('format');
  4137. if (!in_array($format, array('text', 'json'))) {
  4138. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4139. return 1;
  4140. }
  4141. if ($fundings && $format === 'text') {
  4142. $prev = null;
  4143. $io->write('The following packages were found in your dependencies which publish funding information:');
  4144. foreach ($fundings as $vendor => $links) {
  4145. $io->write('');
  4146. $io->write(sprintf("<comment>%s</comment>", $vendor));
  4147. foreach ($links as $url => $packages) {
  4148. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  4149. if ($prev !== $line) {
  4150. $io->write($line);
  4151. $prev = $line;
  4152. }
  4153. $io->write(sprintf(' <href=%s>%s</>', OutputFormatter::escape($url), $url));
  4154. }
  4155. }
  4156. $io->write("");
  4157. $io->write("Please consider following these links and sponsoring the work of package authors!");
  4158. $io->write("Thank you!");
  4159. } elseif ($format === 'json') {
  4160. $io->write(JsonFile::encode($fundings));
  4161. } else {
  4162. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  4163. }
  4164. return 0;
  4165. }
  4166. private function insertFundingData(array $fundings, CompletePackageInterface $package): array
  4167. {
  4168. foreach ($package->getFunding() as $fundingOption) {
  4169. list($vendor, $packageName) = explode('/', $package->getPrettyName());
  4170. if (empty($fundingOption['url'])) {
  4171. continue;
  4172. }
  4173. $url = $fundingOption['url'];
  4174. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && Preg::isMatch('{^https://github.com/([^/]+)$}', $url, $match)) {
  4175. $url = 'https://github.com/sponsors/'.$match[1];
  4176. }
  4177. $fundings[$vendor][$url][] = $packageName;
  4178. }
  4179. return $fundings;
  4180. }
  4181. }
  4182. <?php declare(strict_types=1);
  4183. namespace Composer\Command;
  4184. use Composer\Factory;
  4185. use Composer\Pcre\Preg;
  4186. use Composer\Util\Filesystem;
  4187. use Composer\Util\Platform;
  4188. use Symfony\Component\Console\Input\InputInterface;
  4189. use Symfony\Component\Console\Input\InputArgument;
  4190. use Symfony\Component\Console\Input\StringInput;
  4191. use Symfony\Component\Console\Output\OutputInterface;
  4192. class GlobalCommand extends BaseCommand
  4193. {
  4194. protected function configure(): void
  4195. {
  4196. $this
  4197. ->setName('global')
  4198. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  4199. ->setDefinition(array(
  4200. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  4201. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4202. ))
  4203. ->setHelp(
  4204. <<<EOT
  4205. Use this command as a wrapper to run other Composer commands
  4206. within the global context of COMPOSER_HOME.
  4207. You can use this to install CLI utilities globally, all you need
  4208. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  4209. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  4210. and /home/<user>/.composer on unix systems.
  4211. If your system uses freedesktop.org standards, then it will first check
  4212. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  4213. Note: This path may vary depending on customizations to bin-dir in
  4214. composer.json or the environmental variable COMPOSER_BIN_DIR.
  4215. Read more at https://getcomposer.org/doc/03-cli.md#global
  4216. EOT
  4217. )
  4218. ;
  4219. }
  4220. public function run(InputInterface $input, OutputInterface $output): int
  4221. {
  4222. if (!method_exists($input, '__toString')) {
  4223. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  4224. }
  4225. $tokens = Preg::split('{\s+}', $input->__toString());
  4226. $args = array();
  4227. foreach ($tokens as $token) {
  4228. if ($token && $token[0] !== '-') {
  4229. $args[] = $token;
  4230. if (count($args) >= 2) {
  4231. break;
  4232. }
  4233. }
  4234. }
  4235. if (count($args) < 2) {
  4236. return parent::run($input, $output);
  4237. }
  4238. if (Platform::getEnv('COMPOSER')) {
  4239. Platform::clearEnv('COMPOSER');
  4240. }
  4241. $config = Factory::createConfig();
  4242. $home = $config->get('home');
  4243. if (!is_dir($home)) {
  4244. $fs = new Filesystem();
  4245. $fs->ensureDirectoryExists($home);
  4246. if (!is_dir($home)) {
  4247. throw new \RuntimeException('Could not create home directory');
  4248. }
  4249. }
  4250. try {
  4251. chdir($home);
  4252. } catch (\Exception $e) {
  4253. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  4254. }
  4255. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  4256. $input = new StringInput(Preg::replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  4257. $this->getApplication()->resetComposer();
  4258. return $this->getApplication()->run($input, $output);
  4259. }
  4260. public function isProxyCommand(): bool
  4261. {
  4262. return true;
  4263. }
  4264. }
  4265. <?php declare(strict_types=1);
  4266. namespace Composer\Command;
  4267. use Composer\Package\CompletePackageInterface;
  4268. use Composer\Repository\RepositoryInterface;
  4269. use Composer\Repository\RootPackageRepository;
  4270. use Composer\Repository\RepositoryFactory;
  4271. use Composer\Util\Platform;
  4272. use Composer\Util\ProcessExecutor;
  4273. use Symfony\Component\Console\Input\InputArgument;
  4274. use Symfony\Component\Console\Input\InputOption;
  4275. use Symfony\Component\Console\Input\InputInterface;
  4276. use Symfony\Component\Console\Output\OutputInterface;
  4277. class HomeCommand extends BaseCommand
  4278. {
  4279. protected function configure(): void
  4280. {
  4281. $this
  4282. ->setName('browse')
  4283. ->setAliases(array('home'))
  4284. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  4285. ->setDefinition(array(
  4286. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  4287. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  4288. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  4289. ))
  4290. ->setHelp(
  4291. <<<EOT
  4292. The home command opens or shows a package's repository URL or
  4293. homepage in your default browser.
  4294. To open the homepage by default, use -H or --homepage.
  4295. To show instead of open the repository or homepage URL, use -s or --show.
  4296. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  4297. EOT
  4298. );
  4299. }
  4300. protected function execute(InputInterface $input, OutputInterface $output): int
  4301. {
  4302. $repos = $this->initializeRepos();
  4303. $io = $this->getIO();
  4304. $return = 0;
  4305. $packages = $input->getArgument('packages');
  4306. if (count($packages) === 0) {
  4307. $io->writeError('No package specified, opening homepage for the root package');
  4308. $packages = array($this->requireComposer()->getPackage()->getName());
  4309. }
  4310. foreach ($packages as $packageName) {
  4311. $handled = false;
  4312. $packageExists = false;
  4313. foreach ($repos as $repo) {
  4314. foreach ($repo->findPackages($packageName) as $package) {
  4315. $packageExists = true;
  4316. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  4317. $handled = true;
  4318. break 2;
  4319. }
  4320. }
  4321. }
  4322. if (!$packageExists) {
  4323. $return = 1;
  4324. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  4325. }
  4326. if (!$handled) {
  4327. $return = 1;
  4328. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  4329. }
  4330. }
  4331. return $return;
  4332. }
  4333. private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly): bool
  4334. {
  4335. $support = $package->getSupport();
  4336. $url = $support['source'] ?? $package->getSourceUrl();
  4337. if (!$url || $showHomepage) {
  4338. $url = $package->getHomepage();
  4339. }
  4340. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  4341. return false;
  4342. }
  4343. if ($showOnly) {
  4344. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  4345. } else {
  4346. $this->openBrowser($url);
  4347. }
  4348. return true;
  4349. }
  4350. private function openBrowser(string $url): void
  4351. {
  4352. $url = ProcessExecutor::escape($url);
  4353. $process = new ProcessExecutor($this->getIO());
  4354. if (Platform::isWindows()) {
  4355. $process->execute('start "web" explorer ' . $url, $output);
  4356. return;
  4357. }
  4358. $linux = $process->execute('which xdg-open', $output);
  4359. $osx = $process->execute('which open', $output);
  4360. if (0 === $linux) {
  4361. $process->execute('xdg-open ' . $url, $output);
  4362. } elseif (0 === $osx) {
  4363. $process->execute('open ' . $url, $output);
  4364. } else {
  4365. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  4366. }
  4367. }
  4368. private function initializeRepos(): array
  4369. {
  4370. $composer = $this->tryComposer();
  4371. if ($composer) {
  4372. return array_merge(
  4373. array(new RootPackageRepository($composer->getPackage())),
  4374. array($composer->getRepositoryManager()->getLocalRepository()),
  4375. $composer->getRepositoryManager()->getRepositories()
  4376. );
  4377. }
  4378. return RepositoryFactory::defaultRepos($this->getIO());
  4379. }
  4380. }
  4381. <?php declare(strict_types=1);
  4382. namespace Composer\Command;
  4383. use Composer\Factory;
  4384. use Composer\Json\JsonFile;
  4385. use Composer\Json\JsonValidationException;
  4386. use Composer\Package\BasePackage;
  4387. use Composer\Package\Package;
  4388. use Composer\Pcre\Preg;
  4389. use Composer\Repository\CompositeRepository;
  4390. use Composer\Repository\PlatformRepository;
  4391. use Composer\Repository\RepositoryFactory;
  4392. use Composer\Util\Filesystem;
  4393. use Composer\Util\Silencer;
  4394. use Symfony\Component\Console\Input\ArrayInput;
  4395. use Symfony\Component\Console\Input\InputInterface;
  4396. use Symfony\Component\Console\Input\InputOption;
  4397. use Symfony\Component\Console\Output\OutputInterface;
  4398. use Symfony\Component\Process\ExecutableFinder;
  4399. use Symfony\Component\Process\Process;
  4400. use Symfony\Component\Console\Helper\FormatterHelper;
  4401. class InitCommand extends BaseCommand
  4402. {
  4403. use PackageDiscoveryTrait;
  4404. private $gitConfig;
  4405. protected function configure()
  4406. {
  4407. $this
  4408. ->setName('init')
  4409. ->setDescription('Creates a basic composer.json file in current directory.')
  4410. ->setDefinition(array(
  4411. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  4412. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  4413. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  4414. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  4415. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  4416. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4417. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4418. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  4419. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  4420. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  4421. new InputOption('autoload', 'a', InputOption::VALUE_REQUIRED, 'Add PSR-4 autoload mapping. Maps your package\'s namespace to the provided directory. (Expects a relative path, e.g. src/)'),
  4422. ))
  4423. ->setHelp(
  4424. <<<EOT
  4425. The <info>init</info> command creates a basic composer.json file
  4426. in the current directory.
  4427. <info>php composer.phar init</info>
  4428. Read more at https://getcomposer.org/doc/03-cli.md#init
  4429. EOT
  4430. )
  4431. ;
  4432. }
  4433. protected function execute(InputInterface $input, OutputInterface $output)
  4434. {
  4435. $io = $this->getIO();
  4436. $allowlist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license', 'autoload');
  4437. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowlist)));
  4438. if (isset($options['name']) && !Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $options['name'])) {
  4439. throw new \InvalidArgumentException(
  4440. 'The package name '.$options['name'].' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  4441. );
  4442. }
  4443. if (isset($options['author'])) {
  4444. $options['authors'] = $this->formatAuthors($options['author']);
  4445. unset($options['author']);
  4446. }
  4447. $repositories = $input->getOption('repository');
  4448. if (count($repositories) > 0) {
  4449. $config = Factory::createConfig($io);
  4450. foreach ($repositories as $repo) {
  4451. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo, true);
  4452. }
  4453. }
  4454. if (isset($options['stability'])) {
  4455. $options['minimum-stability'] = $options['stability'];
  4456. unset($options['stability']);
  4457. }
  4458. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  4459. if (array() === $options['require']) {
  4460. $options['require'] = new \stdClass;
  4461. }
  4462. if (isset($options['require-dev'])) {
  4463. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  4464. if (array() === $options['require-dev']) {
  4465. $options['require-dev'] = new \stdClass;
  4466. }
  4467. }
  4468. $autoloadPath = null;
  4469. if (isset($options['autoload'])) {
  4470. $autoloadPath = $options['autoload'];
  4471. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  4472. $options['autoload'] = (object) array(
  4473. 'psr-4' => array(
  4474. $namespace . '\\' => $autoloadPath,
  4475. ),
  4476. );
  4477. }
  4478. $file = new JsonFile(Factory::getComposerFile());
  4479. $json = JsonFile::encode($options);
  4480. if ($input->isInteractive()) {
  4481. $io->writeError(array('', $json, ''));
  4482. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ')) {
  4483. $io->writeError('<error>Command aborted</error>');
  4484. return 1;
  4485. }
  4486. } else {
  4487. if (json_encode($options) === '{"require":{}}') {
  4488. throw new \RuntimeException('You have to run this command in interactive mode, or specify at least some data using --name, --require, etc.');
  4489. }
  4490. $io->writeError('Writing '.$file->getPath());
  4491. }
  4492. $file->write($options);
  4493. try {
  4494. $file->validateSchema(JsonFile::LAX_SCHEMA);
  4495. } catch (JsonValidationException $e) {
  4496. $io->writeError('<error>Schema validation error, aborting</error>');
  4497. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  4498. $io->writeError($e->getMessage() . ':' . PHP_EOL . $errors);
  4499. Silencer::call('unlink', $file->getPath());
  4500. return 1;
  4501. }
  4502. if ($autoloadPath) {
  4503. $filesystem = new Filesystem();
  4504. $filesystem->ensureDirectoryExists($autoloadPath);
  4505. if (!$this->hasDependencies($options)) {
  4506. $this->runDumpAutoloadCommand($output);
  4507. }
  4508. }
  4509. if ($input->isInteractive() && is_dir('.git')) {
  4510. $ignoreFile = realpath('.gitignore');
  4511. if (false === $ignoreFile) {
  4512. $ignoreFile = realpath('.') . '/.gitignore';
  4513. }
  4514. if (!$this->hasVendorIgnore($ignoreFile)) {
  4515. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  4516. if ($io->askConfirmation($question)) {
  4517. $this->addVendorIgnore($ignoreFile);
  4518. }
  4519. }
  4520. }
  4521. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  4522. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) {
  4523. $this->updateDependencies($output);
  4524. }
  4525. if ($autoloadPath) {
  4526. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  4527. $io->writeError('PSR-4 autoloading configured. Use "<comment>namespace '.$namespace.';</comment>" in '.$autoloadPath);
  4528. $io->writeError('Include the Composer autoloader with: <comment>require \'vendor/autoload.php\';</comment>');
  4529. }
  4530. return 0;
  4531. }
  4532. protected function interact(InputInterface $input, OutputInterface $output)
  4533. {
  4534. $git = $this->getGitConfig();
  4535. $io = $this->getIO();
  4536. $formatter = $this->getHelperSet()->get('formatter');
  4537. $repositories = $input->getOption('repository');
  4538. if (count($repositories) > 0) {
  4539. $config = Factory::createConfig($io);
  4540. $repos = array(new PlatformRepository);
  4541. $createDefaultPackagistRepo = true;
  4542. foreach ($repositories as $repo) {
  4543. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
  4544. if (
  4545. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  4546. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  4547. ) {
  4548. $createDefaultPackagistRepo = false;
  4549. continue;
  4550. }
  4551. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  4552. }
  4553. if ($createDefaultPackagistRepo) {
  4554. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  4555. 'type' => 'composer',
  4556. 'url' => 'https://repo.packagist.org',
  4557. ));
  4558. }
  4559. $this->repos = new CompositeRepository($repos);
  4560. unset($repos, $config, $repositories);
  4561. }
  4562. $io->writeError(array(
  4563. '',
  4564. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  4565. '',
  4566. ));
  4567. $io->writeError(array(
  4568. '',
  4569. 'This command will guide you through creating your composer.json config.',
  4570. '',
  4571. ));
  4572. $cwd = realpath(".");
  4573. $name = $input->getOption('name');
  4574. if (null === $name) {
  4575. $name = basename($cwd);
  4576. $name = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  4577. $name = strtolower($name);
  4578. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  4579. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  4580. } elseif (isset($git['github.user'])) {
  4581. $name = $git['github.user'] . '/' . $name;
  4582. } elseif (!empty($_SERVER['USERNAME'])) {
  4583. $name = $_SERVER['USERNAME'] . '/' . $name;
  4584. } elseif (!empty($_SERVER['USER'])) {
  4585. $name = $_SERVER['USER'] . '/' . $name;
  4586. } elseif (get_current_user()) {
  4587. $name = get_current_user() . '/' . $name;
  4588. } else {
  4589. $name .= '/' . $name;
  4590. }
  4591. $name = strtolower($name);
  4592. }
  4593. $name = $io->askAndValidate(
  4594. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  4595. function ($value) use ($name) {
  4596. if (null === $value) {
  4597. return $name;
  4598. }
  4599. if (!Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  4600. throw new \InvalidArgumentException(
  4601. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  4602. );
  4603. }
  4604. return $value;
  4605. },
  4606. null,
  4607. $name
  4608. );
  4609. $input->setOption('name', $name);
  4610. $description = $input->getOption('description') ?: null;
  4611. $description = $io->ask(
  4612. 'Description [<comment>'.$description.'</comment>]: ',
  4613. $description
  4614. );
  4615. $input->setOption('description', $description);
  4616. if (null === $author = $input->getOption('author')) {
  4617. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  4618. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  4619. } elseif (isset($git['user.name'])) {
  4620. $author_name = $git['user.name'];
  4621. }
  4622. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  4623. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  4624. } elseif (isset($git['user.email'])) {
  4625. $author_email = $git['user.email'];
  4626. }
  4627. if (isset($author_name, $author_email)) {
  4628. $author = sprintf('%s <%s>', $author_name, $author_email);
  4629. }
  4630. }
  4631. $author = $io->askAndValidate(
  4632. 'Author ['.(is_string($author) ? '<comment>'.$author.'</comment>, ' : '') . 'n to skip]: ',
  4633. function ($value) use ($author) {
  4634. if ($value === 'n' || $value === 'no') {
  4635. return;
  4636. }
  4637. $value = $value ?: $author;
  4638. $author = $this->parseAuthorString($value);
  4639. if ($author['email'] === null) {
  4640. return $author['name'];
  4641. }
  4642. return sprintf('%s <%s>', $author['name'], $author['email']);
  4643. },
  4644. null,
  4645. $author
  4646. );
  4647. $input->setOption('author', $author);
  4648. $minimumStability = $input->getOption('stability') ?: null;
  4649. $minimumStability = $io->askAndValidate(
  4650. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  4651. function ($value) use ($minimumStability) {
  4652. if (null === $value) {
  4653. return $minimumStability;
  4654. }
  4655. if (!isset(BasePackage::$stabilities[$value])) {
  4656. throw new \InvalidArgumentException(
  4657. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  4658. implode(', ', array_keys(BasePackage::$stabilities))
  4659. );
  4660. }
  4661. return $value;
  4662. },
  4663. null,
  4664. $minimumStability
  4665. );
  4666. $input->setOption('stability', $minimumStability);
  4667. $type = $input->getOption('type') ?: false;
  4668. $type = $io->ask(
  4669. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  4670. $type
  4671. );
  4672. $input->setOption('type', $type);
  4673. if (null === $license = $input->getOption('license')) {
  4674. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  4675. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  4676. }
  4677. }
  4678. $license = $io->ask(
  4679. 'License [<comment>'.$license.'</comment>]: ',
  4680. $license
  4681. );
  4682. $input->setOption('license', $license);
  4683. $io->writeError(array('', 'Define your dependencies.', ''));
  4684. $repos = $this->getRepos();
  4685. $preferredStability = $minimumStability ?: 'stable';
  4686. $platformRepo = null;
  4687. if ($repos instanceof CompositeRepository) {
  4688. foreach ($repos->getRepositories() as $candidateRepo) {
  4689. if ($candidateRepo instanceof PlatformRepository) {
  4690. $platformRepo = $candidateRepo;
  4691. break;
  4692. }
  4693. }
  4694. }
  4695. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  4696. $require = $input->getOption('require');
  4697. $requirements = array();
  4698. if (count($require) > 0 || $io->askConfirmation($question)) {
  4699. $requirements = $this->determineRequirements($input, $output, $require, $platformRepo, $preferredStability);
  4700. }
  4701. $input->setOption('require', $requirements);
  4702. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  4703. $requireDev = $input->getOption('require-dev');
  4704. $devRequirements = array();
  4705. if (count($requireDev) > 0 || $io->askConfirmation($question)) {
  4706. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $platformRepo, $preferredStability);
  4707. }
  4708. $input->setOption('require-dev', $devRequirements);
  4709. $autoload = $input->getOption('autoload') ?: 'src/';
  4710. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  4711. $autoload = $io->askAndValidate(
  4712. 'Add PSR-4 autoload mapping? Maps namespace "'.$namespace.'" to the entered relative path. [<comment>'.$autoload.'</comment>, n to skip]: ',
  4713. function ($value) use ($autoload) {
  4714. if (null === $value) {
  4715. return $autoload;
  4716. }
  4717. if ($value === 'n' || $value === 'no') {
  4718. return;
  4719. }
  4720. $value = $value ?: $autoload;
  4721. if (!Preg::isMatch('{^[^/][A-Za-z0-9\-_/]+/$}', $value)) {
  4722. throw new \InvalidArgumentException(sprintf(
  4723. 'The src folder name "%s" is invalid. Please add a relative path with tailing forward slash. [A-Za-z0-9_-/]+/',
  4724. $value
  4725. ));
  4726. }
  4727. return $value;
  4728. },
  4729. null,
  4730. $autoload
  4731. );
  4732. $input->setOption('autoload', $autoload);
  4733. }
  4734. private function parseAuthorString(string $author): array
  4735. {
  4736. if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+)(?:\s+<(?P<email>.+?)>)?$/u', $author, $match)) {
  4737. $hasEmail = isset($match['email']) && '' !== $match['email'];
  4738. if ($hasEmail && !$this->isValidEmail($match['email'])) {
  4739. throw new \InvalidArgumentException('Invalid email "'.$match['email'].'"');
  4740. }
  4741. return array(
  4742. 'name' => trim($match['name']),
  4743. 'email' => $hasEmail ? $match['email'] : null,
  4744. );
  4745. }
  4746. throw new \InvalidArgumentException(
  4747. 'Invalid author string. Must be in the formats: '.
  4748. 'Jane Doe or John Smith <john@example.com>'
  4749. );
  4750. }
  4751. protected function formatAuthors(string $author): array
  4752. {
  4753. $author = $this->parseAuthorString($author);
  4754. if (null === $author['email']) {
  4755. unset($author['email']);
  4756. }
  4757. return array($author);
  4758. }
  4759. public function namespaceFromPackageName(string $packageName): ?string
  4760. {
  4761. if (!$packageName || strpos($packageName, '/') === false) {
  4762. return null;
  4763. }
  4764. $namespace = array_map(
  4765. function ($part): string {
  4766. $part = Preg::replace('/[^a-z0-9]/i', ' ', $part);
  4767. $part = ucwords($part);
  4768. return str_replace(' ', '', $part);
  4769. },
  4770. explode('/', $packageName)
  4771. );
  4772. return join('\\', $namespace);
  4773. }
  4774. protected function getGitConfig(): array
  4775. {
  4776. if (null !== $this->gitConfig) {
  4777. return $this->gitConfig;
  4778. }
  4779. $finder = new ExecutableFinder();
  4780. $gitBin = $finder->find('git');
  4781. $cmd = new Process(array($gitBin, 'config', '-l'));
  4782. $cmd->run();
  4783. if ($cmd->isSuccessful()) {
  4784. $this->gitConfig = array();
  4785. Preg::matchAll('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches);
  4786. foreach ($matches[1] as $key => $match) {
  4787. $this->gitConfig[$match] = $matches[2][$key];
  4788. }
  4789. return $this->gitConfig;
  4790. }
  4791. return $this->gitConfig = array();
  4792. }
  4793. protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor'): bool
  4794. {
  4795. if (!file_exists($ignoreFile)) {
  4796. return false;
  4797. }
  4798. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  4799. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  4800. foreach ($lines as $line) {
  4801. if (Preg::isMatch($pattern, $line)) {
  4802. return true;
  4803. }
  4804. }
  4805. return false;
  4806. }
  4807. protected function addVendorIgnore(string $ignoreFile, string $vendor = '/vendor/'): void
  4808. {
  4809. $contents = "";
  4810. if (file_exists($ignoreFile)) {
  4811. $contents = file_get_contents($ignoreFile);
  4812. if (strpos($contents, "\n") !== 0) {
  4813. $contents .= "\n";
  4814. }
  4815. }
  4816. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  4817. }
  4818. protected function isValidEmail(string $email): bool
  4819. {
  4820. if (!function_exists('filter_var')) {
  4821. return true;
  4822. }
  4823. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  4824. }
  4825. private function updateDependencies(OutputInterface $output): void
  4826. {
  4827. try {
  4828. $updateCommand = $this->getApplication()->find('update');
  4829. $this->getApplication()->resetComposer();
  4830. $updateCommand->run(new ArrayInput(array()), $output);
  4831. } catch (\Exception $e) {
  4832. $this->getIO()->writeError('Could not update dependencies. Run `composer update` to see more information.');
  4833. }
  4834. }
  4835. private function runDumpAutoloadCommand(OutputInterface $output): void
  4836. {
  4837. try {
  4838. $command = $this->getApplication()->find('dump-autoload');
  4839. $this->getApplication()->resetComposer();
  4840. $command->run(new ArrayInput(array()), $output);
  4841. } catch (\Exception $e) {
  4842. $this->getIO()->writeError('Could not run dump-autoload.');
  4843. }
  4844. }
  4845. private function hasDependencies(array $options): bool
  4846. {
  4847. $requires = (array) $options['require'];
  4848. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4849. return !empty($requires) || !empty($devRequires);
  4850. }
  4851. }
  4852. <?php declare(strict_types=1);
  4853. namespace Composer\Command;
  4854. use Composer\Installer;
  4855. use Composer\Plugin\CommandEvent;
  4856. use Composer\Plugin\PluginEvents;
  4857. use Composer\Util\HttpDownloader;
  4858. use Symfony\Component\Console\Input\InputInterface;
  4859. use Symfony\Component\Console\Input\InputOption;
  4860. use Symfony\Component\Console\Input\InputArgument;
  4861. use Symfony\Component\Console\Output\OutputInterface;
  4862. class InstallCommand extends BaseCommand
  4863. {
  4864. protected function configure()
  4865. {
  4866. $this
  4867. ->setName('install')
  4868. ->setAliases(array('i'))
  4869. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4870. ->setDefinition(array(
  4871. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4872. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  4873. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).'),
  4874. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4875. new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4876. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  4877. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4878. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4879. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4880. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Do not use, only defined here to catch misuse of the install command.'),
  4881. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4882. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4883. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4884. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4885. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  4886. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  4887. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  4888. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4889. ))
  4890. ->setHelp(
  4891. <<<EOT
  4892. The <info>install</info> command reads the composer.lock file from
  4893. the current directory, processes it, and downloads and installs all the
  4894. libraries and dependencies outlined in that file. If the file does not
  4895. exist it will look for composer.json and do the same.
  4896. <info>php composer.phar install</info>
  4897. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4898. EOT
  4899. )
  4900. ;
  4901. }
  4902. protected function execute(InputInterface $input, OutputInterface $output)
  4903. {
  4904. $io = $this->getIO();
  4905. if ($input->getOption('dev')) {
  4906. $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
  4907. }
  4908. if ($input->getOption('no-suggest')) {
  4909. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  4910. }
  4911. $args = $input->getArgument('packages');
  4912. if (count($args) > 0) {
  4913. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4914. return 1;
  4915. }
  4916. if ($input->getOption('no-install')) {
  4917. $io->writeError('<error>Invalid option "--no-install". Use "composer update --no-install" instead if you are trying to update the composer.lock file.</error>');
  4918. return 1;
  4919. }
  4920. $composer = $this->requireComposer();
  4921. if (!$composer->getLocker()->isLocked() && !HttpDownloader::isCurlEnabled()) {
  4922. $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
  4923. }
  4924. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4925. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4926. $install = Installer::create($io, $composer);
  4927. $config = $composer->getConfig();
  4928. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4929. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4930. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4931. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  4932. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4933. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  4934. $install
  4935. ->setDryRun($input->getOption('dry-run'))
  4936. ->setVerbose($input->getOption('verbose'))
  4937. ->setPreferSource($preferSource)
  4938. ->setPreferDist($preferDist)
  4939. ->setDevMode(!$input->getOption('no-dev'))
  4940. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4941. ->setOptimizeAutoloader($optimize)
  4942. ->setClassMapAuthoritative($authoritative)
  4943. ->setApcuAutoloader($apcu, $apcuPrefix)
  4944. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  4945. ;
  4946. if ($input->getOption('no-plugins')) {
  4947. $install->disablePlugins();
  4948. }
  4949. return $install->run();
  4950. }
  4951. }
  4952. <?php declare(strict_types=1);
  4953. namespace Composer\Command;
  4954. use Composer\Json\JsonFile;
  4955. use Composer\Package\CompletePackageInterface;
  4956. use Composer\Plugin\CommandEvent;
  4957. use Composer\Plugin\PluginEvents;
  4958. use Composer\Package\PackageInterface;
  4959. use Composer\Repository\RepositoryInterface;
  4960. use Composer\Util\PackageInfo;
  4961. use Symfony\Component\Console\Formatter\OutputFormatter;
  4962. use Symfony\Component\Console\Helper\Table;
  4963. use Symfony\Component\Console\Input\InputInterface;
  4964. use Symfony\Component\Console\Input\InputOption;
  4965. use Symfony\Component\Console\Output\OutputInterface;
  4966. use Symfony\Component\Console\Style\SymfonyStyle;
  4967. class LicensesCommand extends BaseCommand
  4968. {
  4969. protected function configure(): void
  4970. {
  4971. $this
  4972. ->setName('licenses')
  4973. ->setDescription('Shows information about licenses of dependencies.')
  4974. ->setDefinition(array(
  4975. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text, json or summary', 'text'),
  4976. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4977. ))
  4978. ->setHelp(
  4979. <<<EOT
  4980. The license command displays detailed information about the licenses of
  4981. the installed dependencies.
  4982. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4983. EOT
  4984. )
  4985. ;
  4986. }
  4987. protected function execute(InputInterface $input, OutputInterface $output): int
  4988. {
  4989. $composer = $this->requireComposer();
  4990. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4991. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4992. $root = $composer->getPackage();
  4993. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4994. if ($input->getOption('no-dev')) {
  4995. $packages = $this->filterRequiredPackages($repo, $root);
  4996. } else {
  4997. $packages = $this->appendPackages($repo->getPackages(), array());
  4998. }
  4999. ksort($packages);
  5000. $io = $this->getIO();
  5001. switch ($format = $input->getOption('format')) {
  5002. case 'text':
  5003. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  5004. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  5005. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  5006. $io->write('Dependencies:');
  5007. $io->write('');
  5008. $table = new Table($output);
  5009. $table->setStyle('compact');
  5010. $tableStyle = $table->getStyle();
  5011. $tableStyle->setVerticalBorderChars('');
  5012. $tableStyle->setCellRowContentFormat('%s ');
  5013. $table->setHeaders(array('Name', 'Version', 'Licenses'));
  5014. foreach ($packages as $package) {
  5015. $link = PackageInfo::getViewSourceOrHomepageUrl($package);
  5016. if ($link !== null) {
  5017. $name = '<href='.OutputFormatter::escape($link).'>'.$package->getPrettyName().'</>';
  5018. } else {
  5019. $name = $package->getPrettyName();
  5020. }
  5021. $table->addRow(array(
  5022. $name,
  5023. $package->getFullPrettyVersion(),
  5024. implode(', ', $package instanceof CompletePackageInterface ? $package->getLicense() : array()) ?: 'none',
  5025. ));
  5026. }
  5027. $table->render();
  5028. break;
  5029. case 'json':
  5030. $dependencies = array();
  5031. foreach ($packages as $package) {
  5032. $dependencies[$package->getPrettyName()] = array(
  5033. 'version' => $package->getFullPrettyVersion(),
  5034. 'license' => $package instanceof CompletePackageInterface ? $package->getLicense() : array(),
  5035. );
  5036. }
  5037. $io->write(JsonFile::encode(array(
  5038. 'name' => $root->getPrettyName(),
  5039. 'version' => $root->getFullPrettyVersion(),
  5040. 'license' => $root->getLicense(),
  5041. 'dependencies' => $dependencies,
  5042. )));
  5043. break;
  5044. case 'summary':
  5045. $usedLicenses = array();
  5046. foreach ($packages as $package) {
  5047. $licenses = $package instanceof CompletePackageInterface ? $package->getLicense() : array();
  5048. if (count($licenses) === 0) {
  5049. $licenses[] = 'none';
  5050. }
  5051. foreach ($licenses as $licenseName) {
  5052. if (!isset($usedLicenses[$licenseName])) {
  5053. $usedLicenses[$licenseName] = 0;
  5054. }
  5055. $usedLicenses[$licenseName]++;
  5056. }
  5057. }
  5058. arsort($usedLicenses, SORT_NUMERIC);
  5059. $rows = array();
  5060. foreach ($usedLicenses as $usedLicense => $numberOfDependencies) {
  5061. $rows[] = array($usedLicense, $numberOfDependencies);
  5062. }
  5063. $symfonyIo = new SymfonyStyle($input, $output);
  5064. $symfonyIo->table(
  5065. array('License', 'Number of dependencies'),
  5066. $rows
  5067. );
  5068. break;
  5069. default:
  5070. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5071. }
  5072. return 0;
  5073. }
  5074. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, array $bucket = array()): array
  5075. {
  5076. $requires = array_keys($package->getRequires());
  5077. $packageListNames = array_keys($bucket);
  5078. $packages = array_filter(
  5079. $repo->getPackages(),
  5080. function ($package) use ($requires, $packageListNames): bool {
  5081. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  5082. }
  5083. );
  5084. $bucket = $this->appendPackages($packages, $bucket);
  5085. foreach ($packages as $package) {
  5086. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  5087. }
  5088. return $bucket;
  5089. }
  5090. public function appendPackages(array $packages, array $bucket): array
  5091. {
  5092. foreach ($packages as $package) {
  5093. $bucket[$package->getName()] = $package;
  5094. }
  5095. return $bucket;
  5096. }
  5097. }
  5098. <?php declare(strict_types=1);
  5099. namespace Composer\Command;
  5100. use Symfony\Component\Console\Input\InputInterface;
  5101. use Symfony\Component\Console\Input\InputArgument;
  5102. use Symfony\Component\Console\Input\ArrayInput;
  5103. use Symfony\Component\Console\Input\InputOption;
  5104. use Symfony\Component\Console\Output\OutputInterface;
  5105. class OutdatedCommand extends BaseCommand
  5106. {
  5107. protected function configure(): void
  5108. {
  5109. $this
  5110. ->setName('outdated')
  5111. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  5112. ->setDefinition(array(
  5113. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5114. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  5115. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  5116. new InputOption('locked', null, InputOption::VALUE_NONE, 'Shows updates for packages from the lock file, regardless of what is currently in vendor dir'),
  5117. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5118. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5119. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5120. new InputOption('patch-only', 'p', InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates. Use with the --outdated option.'),
  5121. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5122. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5123. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  5124. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages). Use with the --outdated option'),
  5125. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
  5126. ))
  5127. ->setHelp(
  5128. <<<EOT
  5129. The outdated command is just a proxy for `composer show -l`
  5130. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  5131. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  5132. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  5133. compatibility breaks according to semver, so upgrade when you can but it
  5134. may involve work.
  5135. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  5136. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  5137. EOT
  5138. )
  5139. ;
  5140. }
  5141. protected function execute(InputInterface $input, OutputInterface $output): int
  5142. {
  5143. $args = array(
  5144. 'command' => 'show',
  5145. '--latest' => true,
  5146. );
  5147. if (!$input->getOption('all')) {
  5148. $args['--outdated'] = true;
  5149. }
  5150. if ($input->getOption('direct')) {
  5151. $args['--direct'] = true;
  5152. }
  5153. if (null !== $input->getArgument('package')) {
  5154. $args['package'] = $input->getArgument('package');
  5155. }
  5156. if ($input->getOption('strict')) {
  5157. $args['--strict'] = true;
  5158. }
  5159. if ($input->getOption('minor-only')) {
  5160. $args['--minor-only'] = true;
  5161. }
  5162. if ($input->getOption('patch-only')) {
  5163. $args['--patch-only'] = true;
  5164. }
  5165. if ($input->getOption('locked')) {
  5166. $args['--locked'] = true;
  5167. }
  5168. if ($input->getOption('no-dev')) {
  5169. $args['--no-dev'] = true;
  5170. }
  5171. $args['--ignore-platform-req'] = $input->getOption('ignore-platform-req');
  5172. if ($input->getOption('ignore-platform-reqs')) {
  5173. $args['--ignore-platform-reqs'] = true;
  5174. }
  5175. $args['--format'] = $input->getOption('format');
  5176. $args['--ignore'] = $input->getOption('ignore');
  5177. $input = new ArrayInput($args);
  5178. return $this->getApplication()->run($input, $output);
  5179. }
  5180. public function isProxyCommand(): bool
  5181. {
  5182. return true;
  5183. }
  5184. }
  5185. <?php declare(strict_types=1);
  5186. namespace Composer\Command;
  5187. use Composer\Factory;
  5188. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  5189. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  5190. use Composer\Package\CompletePackageInterface;
  5191. use Composer\Package\PackageInterface;
  5192. use Composer\Package\Version\VersionParser;
  5193. use Composer\Package\Version\VersionSelector;
  5194. use Composer\Pcre\Preg;
  5195. use Composer\Repository\CompositeRepository;
  5196. use Composer\Repository\PlatformRepository;
  5197. use Composer\Repository\RepositoryFactory;
  5198. use Composer\Repository\RepositorySet;
  5199. use Composer\Semver\Constraint\Constraint;
  5200. use Composer\Util\Filesystem;
  5201. use Symfony\Component\Console\Input\InputInterface;
  5202. use Symfony\Component\Console\Output\OutputInterface;
  5203. trait PackageDiscoveryTrait
  5204. {
  5205. private $repos;
  5206. private $repositorySets;
  5207. protected function getRepos(): CompositeRepository
  5208. {
  5209. if (null === $this->repos) {
  5210. $this->repos = new CompositeRepository(array_merge(
  5211. array(new PlatformRepository),
  5212. RepositoryFactory::defaultRepos($this->getIO())
  5213. ));
  5214. }
  5215. return $this->repos;
  5216. }
  5217. private function getRepositorySet(InputInterface $input, ?string $minimumStability = null): RepositorySet
  5218. {
  5219. $key = $minimumStability ?? 'default';
  5220. if (!isset($this->repositorySets[$key])) {
  5221. $this->repositorySets[$key] = $repositorySet = new RepositorySet($minimumStability ?? $this->getMinimumStability($input));
  5222. $repositorySet->addRepository($this->getRepos());
  5223. }
  5224. return $this->repositorySets[$key];
  5225. }
  5226. private function getMinimumStability(InputInterface $input): string
  5227. {
  5228. if ($input->hasOption('stability')) {
  5229. return VersionParser::normalizeStability($input->getOption('stability') ?? 'stable');
  5230. }
  5231. $file = Factory::getComposerFile();
  5232. if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) {
  5233. if (!empty($composer['minimum-stability'])) {
  5234. return VersionParser::normalizeStability($composer['minimum-stability']);
  5235. }
  5236. }
  5237. return 'stable';
  5238. }
  5239. final protected function determineRequirements(InputInterface $input, OutputInterface $output, array $requires = array(), ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $checkProvidedVersions = true, bool $fixed = false): array
  5240. {
  5241. if (count($requires) > 0) {
  5242. $requires = $this->normalizeRequirements($requires);
  5243. $result = array();
  5244. $io = $this->getIO();
  5245. foreach ($requires as $requirement) {
  5246. if (!isset($requirement['version'])) {
  5247. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, null, null, $fixed);
  5248. $requirement['version'] = $version;
  5249. $requirement['name'] = $name;
  5250. $io->writeError(sprintf(
  5251. 'Using version <info>%s</info> for <info>%s</info>',
  5252. $requirement['version'],
  5253. $requirement['name']
  5254. ));
  5255. }
  5256. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  5257. }
  5258. return $result;
  5259. }
  5260. $versionParser = new VersionParser();
  5261. $composer = $this->tryComposer();
  5262. $installedRepo = null;
  5263. if (null !== $composer) {
  5264. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5265. }
  5266. $existingPackages = array();
  5267. if (null !== $installedRepo) {
  5268. foreach ($installedRepo->getPackages() as $package) {
  5269. $existingPackages[] = $package->getName();
  5270. }
  5271. }
  5272. unset($composer, $installedRepo);
  5273. $io = $this->getIO();
  5274. while (null !== $package = $io->ask('Search for a package: ')) {
  5275. $matches = $this->getRepos()->search($package);
  5276. if (count($matches) > 0) {
  5277. foreach ($matches as $position => $foundPackage) {
  5278. if (in_array($foundPackage['name'], $existingPackages, true)) {
  5279. unset($matches[$position]);
  5280. }
  5281. }
  5282. $matches = array_values($matches);
  5283. $exactMatch = false;
  5284. foreach ($matches as $match) {
  5285. if ($match['name'] === $package) {
  5286. $exactMatch = true;
  5287. break;
  5288. }
  5289. }
  5290. if (!$exactMatch) {
  5291. $providers = $this->getRepos()->getProviders($package);
  5292. if (count($providers) > 0) {
  5293. array_unshift($matches, array('name' => $package, 'description' => ''));
  5294. }
  5295. $choices = array();
  5296. foreach ($matches as $position => $foundPackage) {
  5297. $abandoned = '';
  5298. if (isset($foundPackage['abandoned'])) {
  5299. if (is_string($foundPackage['abandoned'])) {
  5300. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  5301. } else {
  5302. $replacement = 'No replacement was suggested';
  5303. }
  5304. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  5305. }
  5306. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  5307. }
  5308. $io->writeError(array(
  5309. '',
  5310. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  5311. '',
  5312. ));
  5313. $io->writeError($choices);
  5314. $io->writeError('');
  5315. $validator = function (string $selection) use ($matches, $versionParser) {
  5316. if ('' === $selection) {
  5317. return false;
  5318. }
  5319. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  5320. $package = $matches[(int) $selection];
  5321. return $package['name'];
  5322. }
  5323. if (Preg::isMatch('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  5324. if (isset($packageMatches['version'])) {
  5325. $versionParser->parseConstraints($packageMatches['version']);
  5326. return $packageMatches['name'].' '.$packageMatches['version'];
  5327. }
  5328. return $packageMatches['name'];
  5329. }
  5330. throw new \Exception('Not a valid selection');
  5331. };
  5332. $package = $io->askAndValidate(
  5333. 'Enter package # to add, or the complete package name if it is not listed: ',
  5334. $validator,
  5335. 3,
  5336. ''
  5337. );
  5338. }
  5339. if (false !== $package && false === strpos($package, ' ')) {
  5340. $validator = function (string $input) {
  5341. $input = trim($input);
  5342. return strlen($input) > 0 ? $input : false;
  5343. };
  5344. $constraint = $io->askAndValidate(
  5345. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  5346. $validator,
  5347. 3,
  5348. ''
  5349. );
  5350. if (false === $constraint) {
  5351. list(, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $platformRepo, $preferredStability);
  5352. $io->writeError(sprintf(
  5353. 'Using version <info>%s</info> for <info>%s</info>',
  5354. $constraint,
  5355. $package
  5356. ));
  5357. }
  5358. $package .= ' '.$constraint;
  5359. }
  5360. if (false !== $package) {
  5361. $requires[] = $package;
  5362. $existingPackages[] = explode(' ', $package)[0];
  5363. }
  5364. }
  5365. }
  5366. return $requires;
  5367. }
  5368. private function findBestVersionAndNameForPackage(InputInterface $input, string $name, ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', ?string $requiredVersion = null, ?string $minimumStability = null, bool $fixed = false): array
  5369. {
  5370. $platformRequirementFilter = $this->getPlatformRequirementFilter($input);
  5371. $repoSet = $this->getRepositorySet($input, $minimumStability);
  5372. $versionSelector = new VersionSelector($repoSet, $platformRepo);
  5373. $effectiveMinimumStability = $minimumStability ?? $this->getMinimumStability($input);
  5374. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $preferredStability, $platformRequirementFilter);
  5375. if (false === $package) {
  5376. if ($platformRequirementFilter->isIgnored($name)) {
  5377. return array($name, $requiredVersion ?: '*');
  5378. }
  5379. $providers = $repoSet->getProviders($name);
  5380. if (count($providers) > 0) {
  5381. $constraint = '*';
  5382. if ($input->isInteractive()) {
  5383. $constraint = $this->getIO()->askAndValidate('Package "<info>'.$name.'</info>" does not exist but is provided by '.count($providers).' packages. Which version constraint would you like to use? [<info>*</info>] ', function ($value) {
  5384. $parser = new VersionParser();
  5385. $parser->parseConstraints($value);
  5386. return $value;
  5387. }, 3, '*');
  5388. }
  5389. return array($name, $constraint);
  5390. }
  5391. if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && false !== ($candidate = $versionSelector->findBestCandidate($name, $requiredVersion, $preferredStability, PlatformRequirementFilterFactory::ignoreAll()))) {
  5392. throw new \InvalidArgumentException(sprintf(
  5393. 'Package %s%s has requirements incompatible with your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo),
  5394. $name,
  5395. is_string($requiredVersion) ? ' at version '.$requiredVersion : ''
  5396. ));
  5397. }
  5398. if (false !== ($package = $versionSelector->findBestCandidate($name, $requiredVersion, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
  5399. if (false !== ($allReposPackage = $versionSelector->findBestCandidate($name, $requiredVersion, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_SHADOWED_REPOSITORIES))) {
  5400. throw new \InvalidArgumentException(
  5401. 'Package '.$name.' exists in '.$allReposPackage->getRepository()->getRepoName().' and '.$package->getRepository()->getRepoName().' which has a higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'
  5402. );
  5403. }
  5404. throw new \InvalidArgumentException(sprintf(
  5405. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  5406. $name,
  5407. $effectiveMinimumStability
  5408. ));
  5409. }
  5410. if (is_string($requiredVersion) && false !== ($package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter))) {
  5411. if (false !== ($allReposPackage = $versionSelector->findBestCandidate($name, $requiredVersion, $preferredStability, PlatformRequirementFilterFactory::ignoreNothing(), RepositorySet::ALLOW_SHADOWED_REPOSITORIES))) {
  5412. throw new \InvalidArgumentException(
  5413. 'Package '.$name.' exists in '.$allReposPackage->getRepository()->getRepoName().' and '.$package->getRepository()->getRepoName().' which has a higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'
  5414. );
  5415. }
  5416. throw new \InvalidArgumentException(sprintf(
  5417. 'Could not find package %s in a version matching "%s" and a stability matching "'.$effectiveMinimumStability.'".',
  5418. $name,
  5419. $requiredVersion
  5420. ));
  5421. }
  5422. if (!$platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll(), RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
  5423. $additional = '';
  5424. if (false === $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll())) {
  5425. $additional = PHP_EOL.PHP_EOL.'Additionally, the package was only found with a stability of "'.$candidate->getStability().'" while your minimum stability is "'.$effectiveMinimumStability.'".';
  5426. }
  5427. throw new \InvalidArgumentException(sprintf(
  5428. 'Could not find package %s in any version matching your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo) . '%s',
  5429. $name,
  5430. $additional
  5431. ));
  5432. }
  5433. $similar = $this->findSimilar($name);
  5434. if (count($similar) > 0) {
  5435. if (in_array($name, $similar, true)) {
  5436. throw new \InvalidArgumentException(sprintf(
  5437. "Could not find package %s. It was however found via repository search, which indicates a consistency issue with the repository.",
  5438. $name
  5439. ));
  5440. }
  5441. throw new \InvalidArgumentException(sprintf(
  5442. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  5443. $name,
  5444. implode("\n ", $similar)
  5445. ));
  5446. }
  5447. throw new \InvalidArgumentException(sprintf(
  5448. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  5449. $name,
  5450. $effectiveMinimumStability
  5451. ));
  5452. }
  5453. return array(
  5454. $package->getPrettyName(),
  5455. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  5456. );
  5457. }
  5458. private function findSimilar(string $package): array
  5459. {
  5460. try {
  5461. if (null === $this->repos) {
  5462. throw new \LogicException('findSimilar was called before $this->repos was initialized');
  5463. }
  5464. $results = $this->repos->search($package);
  5465. } catch (\Throwable $e) {
  5466. if ($e instanceof \LogicException) {
  5467. throw $e;
  5468. }
  5469. return array();
  5470. }
  5471. $similarPackages = array();
  5472. $installedRepo = $this->requireComposer()->getRepositoryManager()->getLocalRepository();
  5473. foreach ($results as $result) {
  5474. if (null !== $installedRepo->findPackage($result['name'], '*')) {
  5475. continue;
  5476. }
  5477. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  5478. }
  5479. asort($similarPackages);
  5480. return array_keys(array_slice($similarPackages, 0, 5));
  5481. }
  5482. private function getPlatformExceptionDetails(PackageInterface $candidate, ?PlatformRepository $platformRepo = null): string
  5483. {
  5484. $details = array();
  5485. if (null === $platformRepo) {
  5486. return '';
  5487. }
  5488. foreach ($candidate->getRequires() as $link) {
  5489. if (!PlatformRepository::isPlatformPackage($link->getTarget())) {
  5490. continue;
  5491. }
  5492. $platformPkg = $platformRepo->findPackage($link->getTarget(), '*');
  5493. if (null === $platformPkg) {
  5494. if ($platformRepo->isPlatformPackageDisabled($link->getTarget())) {
  5495. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is disabled by your platform config. Enable it again with "composer config platform.'.$link->getTarget().' --unset".';
  5496. } else {
  5497. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is not present.';
  5498. }
  5499. continue;
  5500. }
  5501. if (!$link->getConstraint()->matches(new Constraint('==', $platformPkg->getVersion()))) {
  5502. $platformPkgVersion = $platformPkg->getPrettyVersion();
  5503. $platformExtra = $platformPkg->getExtra();
  5504. if (isset($platformExtra['config.platform']) && $platformPkg instanceof CompletePackageInterface) {
  5505. $platformPkgVersion .= ' ('.$platformPkg->getDescription().')';
  5506. }
  5507. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' which does not match your installed version '.$platformPkgVersion.'.';
  5508. }
  5509. }
  5510. if (count($details) === 0) {
  5511. return '';
  5512. }
  5513. return ':'.PHP_EOL.' - ' . implode(PHP_EOL.' - ', $details);
  5514. }
  5515. }
  5516. <?php declare(strict_types=1);
  5517. namespace Composer\Command;
  5518. use Symfony\Component\Console\Input\InputInterface;
  5519. use Symfony\Component\Console\Output\OutputInterface;
  5520. use Symfony\Component\Console\Input\InputArgument;
  5521. use Symfony\Component\Console\Input\InputOption;
  5522. class ProhibitsCommand extends BaseDependencyCommand
  5523. {
  5524. protected function configure(): void
  5525. {
  5526. $this
  5527. ->setName('prohibits')
  5528. ->setAliases(array('why-not'))
  5529. ->setDescription('Shows which packages prevent the given package from being installed.')
  5530. ->setDefinition(array(
  5531. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  5532. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::REQUIRED, 'Version constraint, which version you expected to be installed'),
  5533. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  5534. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  5535. ))
  5536. ->setHelp(
  5537. <<<EOT
  5538. Displays detailed information about why a package cannot be installed.
  5539. <info>php composer.phar prohibits composer/composer</info>
  5540. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  5541. EOT
  5542. )
  5543. ;
  5544. }
  5545. protected function execute(InputInterface $input, OutputInterface $output): int
  5546. {
  5547. return parent::doExecute($input, $output, true);
  5548. }
  5549. }
  5550. <?php declare(strict_types=1);
  5551. namespace Composer\Command;
  5552. use Composer\DependencyResolver\Operation\InstallOperation;
  5553. use Composer\DependencyResolver\Operation\UninstallOperation;
  5554. use Composer\DependencyResolver\Transaction;
  5555. use Composer\Package\AliasPackage;
  5556. use Composer\Package\BasePackage;
  5557. use Composer\Pcre\Preg;
  5558. use Composer\Plugin\CommandEvent;
  5559. use Composer\Plugin\PluginEvents;
  5560. use Composer\Script\ScriptEvents;
  5561. use Composer\Util\Platform;
  5562. use Symfony\Component\Console\Input\InputInterface;
  5563. use Symfony\Component\Console\Input\InputOption;
  5564. use Symfony\Component\Console\Input\InputArgument;
  5565. use Symfony\Component\Console\Output\OutputInterface;
  5566. class ReinstallCommand extends BaseCommand
  5567. {
  5568. protected function configure(): void
  5569. {
  5570. $this
  5571. ->setName('reinstall')
  5572. ->setDescription('Uninstalls and reinstalls the given package names')
  5573. ->setDefinition(array(
  5574. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5575. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  5576. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).'),
  5577. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5578. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5579. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  5580. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5581. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5582. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  5583. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  5584. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  5585. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'List of package names to reinstall, can include a wildcard (*) to match any substring.'),
  5586. ))
  5587. ->setHelp(
  5588. <<<EOT
  5589. The <info>reinstall</info> command looks up installed packages by name,
  5590. uninstalls them and reinstalls them. This lets you do a clean install
  5591. of a package if you messed with its files, or if you wish to change
  5592. the installation type using --prefer-install.
  5593. <info>php composer.phar reinstall acme/foo "acme/bar-*"</info>
  5594. Read more at https://getcomposer.org/doc/03-cli.md#reinstall
  5595. EOT
  5596. )
  5597. ;
  5598. }
  5599. protected function execute(InputInterface $input, OutputInterface $output): int
  5600. {
  5601. $io = $this->getIO();
  5602. $composer = $this->requireComposer();
  5603. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5604. $packagesToReinstall = array();
  5605. $packageNamesToReinstall = array();
  5606. foreach ($input->getArgument('packages') as $pattern) {
  5607. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  5608. $matched = false;
  5609. foreach ($localRepo->getCanonicalPackages() as $package) {
  5610. if (Preg::isMatch($patternRegexp, $package->getName())) {
  5611. $matched = true;
  5612. $packagesToReinstall[] = $package;
  5613. $packageNamesToReinstall[] = $package->getName();
  5614. }
  5615. }
  5616. if (!$matched) {
  5617. $io->writeError('<warning>Pattern "' . $pattern . '" does not match any currently installed packages.</warning>');
  5618. }
  5619. }
  5620. if (!$packagesToReinstall) {
  5621. $io->writeError('<warning>Found no packages to reinstall, aborting.</warning>');
  5622. return 1;
  5623. }
  5624. $uninstallOperations = array();
  5625. foreach ($packagesToReinstall as $package) {
  5626. $uninstallOperations[] = new UninstallOperation($package);
  5627. }
  5628. $presentPackages = $localRepo->getPackages();
  5629. $resultPackages = $presentPackages;
  5630. foreach ($presentPackages as $index => $package) {
  5631. if (in_array($package->getName(), $packageNamesToReinstall, true)) {
  5632. unset($presentPackages[$index]);
  5633. }
  5634. }
  5635. $transaction = new Transaction($presentPackages, $resultPackages);
  5636. $installOperations = $transaction->getOperations();
  5637. $installOrder = array();
  5638. foreach ($installOperations as $index => $op) {
  5639. if ($op instanceof InstallOperation && !$op->getPackage() instanceof AliasPackage) {
  5640. $installOrder[$op->getPackage()->getName()] = $index;
  5641. }
  5642. }
  5643. usort($uninstallOperations, function ($a, $b) use ($installOrder): int {
  5644. return $installOrder[$b->getPackage()->getName()] - $installOrder[$a->getPackage()->getName()];
  5645. });
  5646. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'reinstall', $input, $output);
  5647. $eventDispatcher = $composer->getEventDispatcher();
  5648. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  5649. $config = $composer->getConfig();
  5650. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  5651. $installationManager = $composer->getInstallationManager();
  5652. $downloadManager = $composer->getDownloadManager();
  5653. $package = $composer->getPackage();
  5654. $installationManager->setOutputProgress(!$input->getOption('no-progress'));
  5655. if ($input->getOption('no-plugins')) {
  5656. $installationManager->disablePlugins();
  5657. }
  5658. $downloadManager->setPreferSource($preferSource);
  5659. $downloadManager->setPreferDist($preferDist);
  5660. $devMode = $localRepo->getDevMode() !== null ? $localRepo->getDevMode() : true;
  5661. Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
  5662. $eventDispatcher->dispatchScript(ScriptEvents::PRE_INSTALL_CMD, $devMode);
  5663. $installationManager->execute($localRepo, $uninstallOperations, $devMode);
  5664. $installationManager->execute($localRepo, $installOperations, $devMode);
  5665. if (!$input->getOption('no-autoloader')) {
  5666. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5667. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5668. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  5669. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5670. $generator = $composer->getAutoloadGenerator();
  5671. $generator->setClassMapAuthoritative($authoritative);
  5672. $generator->setApcu($apcu, $apcuPrefix);
  5673. $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
  5674. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  5675. }
  5676. $eventDispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, $devMode);
  5677. return 0;
  5678. }
  5679. }
  5680. <?php declare(strict_types=1);
  5681. namespace Composer\Command;
  5682. use Composer\Config\JsonConfigSource;
  5683. use Composer\DependencyResolver\Request;
  5684. use Composer\Installer;
  5685. use Composer\Pcre\Preg;
  5686. use Composer\Plugin\CommandEvent;
  5687. use Composer\Plugin\PluginEvents;
  5688. use Composer\Json\JsonFile;
  5689. use Composer\Factory;
  5690. use Symfony\Component\Console\Input\InputInterface;
  5691. use Symfony\Component\Console\Input\InputOption;
  5692. use Symfony\Component\Console\Input\InputArgument;
  5693. use Symfony\Component\Console\Output\OutputInterface;
  5694. use Composer\Package\BasePackage;
  5695. class RemoveCommand extends BaseCommand
  5696. {
  5697. protected function configure()
  5698. {
  5699. $this
  5700. ->setName('remove')
  5701. ->setDescription('Removes a package from the require or require-dev.')
  5702. ->setDefinition(array(
  5703. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  5704. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  5705. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5706. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5707. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
  5708. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  5709. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  5710. new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  5711. new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  5712. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
  5713. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  5714. new InputOption('unused', null, InputOption::VALUE_NONE, 'Remove all packages which are locked but not required by any other package.'),
  5715. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  5716. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  5717. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  5718. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5719. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5720. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  5721. ))
  5722. ->setHelp(
  5723. <<<EOT
  5724. The <info>remove</info> command removes a package from the current
  5725. list of installed packages
  5726. <info>php composer.phar remove</info>
  5727. Read more at https://getcomposer.org/doc/03-cli.md#remove
  5728. EOT
  5729. )
  5730. ;
  5731. }
  5732. protected function interact(InputInterface $input, OutputInterface $output)
  5733. {
  5734. if ($input->getOption('unused')) {
  5735. $composer = $this->requireComposer();
  5736. $locker = $composer->getLocker();
  5737. if (!$locker->isLocked()) {
  5738. throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --unused');
  5739. }
  5740. $lockedPackages = $locker->getLockedRepository()->getPackages();
  5741. $required = array();
  5742. foreach (array_merge($composer->getPackage()->getRequires(), $composer->getPackage()->getDevRequires()) as $link) {
  5743. $required[$link->getTarget()] = true;
  5744. }
  5745. do {
  5746. $found = false;
  5747. foreach ($lockedPackages as $index => $package) {
  5748. foreach ($package->getNames() as $name) {
  5749. if (isset($required[$name])) {
  5750. foreach ($package->getRequires() as $link) {
  5751. $required[$link->getTarget()] = true;
  5752. }
  5753. $found = true;
  5754. unset($lockedPackages[$index]);
  5755. break;
  5756. }
  5757. }
  5758. }
  5759. } while ($found);
  5760. $unused = array();
  5761. foreach ($lockedPackages as $package) {
  5762. $unused[] = $package->getName();
  5763. }
  5764. $input->setArgument('packages', array_merge($input->getArgument('packages'), $unused));
  5765. if (count($input->getArgument('packages')) === 0) {
  5766. $this->getIO()->writeError('<info>No unused packages to remove</info>');
  5767. $this->setCode(function (): int {
  5768. return 0;
  5769. });
  5770. }
  5771. }
  5772. }
  5773. protected function execute(InputInterface $input, OutputInterface $output)
  5774. {
  5775. $packages = $input->getArgument('packages');
  5776. $packages = array_map('strtolower', $packages);
  5777. $file = Factory::getComposerFile();
  5778. $jsonFile = new JsonFile($file);
  5779. $composer = $jsonFile->read();
  5780. $composerBackup = file_get_contents($jsonFile->getPath());
  5781. $json = new JsonConfigSource($jsonFile);
  5782. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  5783. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  5784. $io = $this->getIO();
  5785. if ($input->getOption('update-with-dependencies')) {
  5786. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  5787. }
  5788. foreach (array('require', 'require-dev') as $linkType) {
  5789. if (isset($composer[$linkType])) {
  5790. foreach ($composer[$linkType] as $name => $version) {
  5791. $composer[$linkType][strtolower($name)] = $name;
  5792. }
  5793. }
  5794. }
  5795. $dryRun = $input->getOption('dry-run');
  5796. $toRemove = array();
  5797. foreach ($packages as $package) {
  5798. if (isset($composer[$type][$package])) {
  5799. if ($dryRun) {
  5800. $toRemove[$type][] = $composer[$type][$package];
  5801. } else {
  5802. $json->removeLink($type, $composer[$type][$package]);
  5803. }
  5804. } elseif (isset($composer[$altType][$package])) {
  5805. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  5806. if ($io->isInteractive()) {
  5807. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
  5808. if ($dryRun) {
  5809. $toRemove[$altType][] = $composer[$altType][$package];
  5810. } else {
  5811. $json->removeLink($altType, $composer[$altType][$package]);
  5812. }
  5813. }
  5814. }
  5815. } elseif (isset($composer[$type]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) > 0) {
  5816. foreach ($matches as $matchedPackage) {
  5817. if ($dryRun) {
  5818. $toRemove[$type][] = $matchedPackage;
  5819. } else {
  5820. $json->removeLink($type, $matchedPackage);
  5821. }
  5822. }
  5823. } elseif (isset($composer[$altType]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) > 0) {
  5824. foreach ($matches as $matchedPackage) {
  5825. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  5826. if ($io->isInteractive()) {
  5827. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
  5828. if ($dryRun) {
  5829. $toRemove[$altType][] = $matchedPackage;
  5830. } else {
  5831. $json->removeLink($altType, $matchedPackage);
  5832. }
  5833. }
  5834. }
  5835. }
  5836. } else {
  5837. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  5838. }
  5839. }
  5840. $io->writeError('<info>'.$file.' has been updated</info>');
  5841. if ($input->getOption('no-update')) {
  5842. return 0;
  5843. }
  5844. if ($composer = $this->tryComposer()) {
  5845. $composer->getPluginManager()->deactivateInstalledPlugins();
  5846. }
  5847. $this->resetComposer();
  5848. $composer = $this->requireComposer();
  5849. if ($dryRun) {
  5850. $rootPackage = $composer->getPackage();
  5851. $links = array(
  5852. 'require' => $rootPackage->getRequires(),
  5853. 'require-dev' => $rootPackage->getDevRequires(),
  5854. );
  5855. foreach ($toRemove as $type => $names) {
  5856. foreach ($names as $name) {
  5857. unset($links[$type][$name]);
  5858. }
  5859. }
  5860. $rootPackage->setRequires($links['require']);
  5861. $rootPackage->setDevRequires($links['require-dev']);
  5862. }
  5863. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  5864. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5865. $allowPlugins = $composer->getConfig()->get('allow-plugins');
  5866. $removedPlugins = is_array($allowPlugins) ? array_intersect(array_keys($allowPlugins), $packages) : [];
  5867. if (!$dryRun && count($removedPlugins) > 0) {
  5868. if (count($allowPlugins) === count($removedPlugins)) {
  5869. $json->removeConfigSetting('allow-plugins');
  5870. } else {
  5871. foreach ($removedPlugins as $plugin) {
  5872. $json->removeConfigSetting('allow-plugins.'.$plugin);
  5873. }
  5874. }
  5875. }
  5876. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  5877. $install = Installer::create($io, $composer);
  5878. $updateDevMode = !$input->getOption('update-no-dev');
  5879. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  5880. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  5881. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  5882. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  5883. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  5884. $flags = '';
  5885. if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
  5886. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  5887. $flags .= ' --with-all-dependencies';
  5888. } elseif ($input->getOption('no-update-with-dependencies')) {
  5889. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  5890. $flags .= ' --with-dependencies';
  5891. }
  5892. $io->writeError('<info>Running composer update '.implode(' ', $packages).$flags.'</info>');
  5893. $install
  5894. ->setVerbose($input->getOption('verbose'))
  5895. ->setDevMode($updateDevMode)
  5896. ->setOptimizeAutoloader($optimize)
  5897. ->setClassMapAuthoritative($authoritative)
  5898. ->setApcuAutoloader($apcu, $apcuPrefix)
  5899. ->setUpdate(true)
  5900. ->setInstall(!$input->getOption('no-install'))
  5901. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  5902. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  5903. ->setDryRun($dryRun)
  5904. ;
  5905. if ($composer->getLocker()->isLocked()) {
  5906. $install->setUpdateAllowList($packages);
  5907. }
  5908. $status = $install->run();
  5909. if ($status !== 0) {
  5910. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  5911. file_put_contents($jsonFile->getPath(), $composerBackup);
  5912. }
  5913. if (!$dryRun) {
  5914. foreach ($packages as $package) {
  5915. if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
  5916. $io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
  5917. return 2;
  5918. }
  5919. }
  5920. }
  5921. return $status;
  5922. }
  5923. }
  5924. <?php declare(strict_types=1);
  5925. namespace Composer\Command;
  5926. use Composer\DependencyResolver\Request;
  5927. use Composer\Util\Filesystem;
  5928. use Symfony\Component\Console\Input\InputInterface;
  5929. use Symfony\Component\Console\Input\InputArgument;
  5930. use Symfony\Component\Console\Input\InputOption;
  5931. use Symfony\Component\Console\Output\OutputInterface;
  5932. use Composer\Factory;
  5933. use Composer\Installer;
  5934. use Composer\Installer\InstallerEvents;
  5935. use Composer\Json\JsonFile;
  5936. use Composer\Json\JsonManipulator;
  5937. use Composer\Package\Version\VersionParser;
  5938. use Composer\Package\Loader\ArrayLoader;
  5939. use Composer\Package\BasePackage;
  5940. use Composer\Plugin\CommandEvent;
  5941. use Composer\Plugin\PluginEvents;
  5942. use Composer\Repository\CompositeRepository;
  5943. use Composer\Repository\PlatformRepository;
  5944. use Composer\IO\IOInterface;
  5945. use Composer\Util\Silencer;
  5946. class RequireCommand extends BaseCommand
  5947. {
  5948. use PackageDiscoveryTrait;
  5949. private $newlyCreated;
  5950. private $firstRequire;
  5951. private $json;
  5952. private $file;
  5953. private $composerBackup;
  5954. private $lock;
  5955. private $lockBackup;
  5956. private $dependencyResolutionCompleted = false;
  5957. protected function configure()
  5958. {
  5959. $this
  5960. ->setName('require')
  5961. ->setDescription('Adds required packages to your composer.json and installs them.')
  5962. ->setDefinition(array(
  5963. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  5964. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  5965. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5966. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5967. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  5968. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).'),
  5969. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  5970. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  5971. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5972. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
  5973. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  5974. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  5975. new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  5976. new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  5977. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-dependencies'),
  5978. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
  5979. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  5980. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  5981. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5982. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5983. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  5984. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  5985. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5986. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5987. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  5988. ))
  5989. ->setHelp(
  5990. <<<EOT
  5991. The require command adds required packages to your composer.json and installs them.
  5992. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  5993. matches to require.
  5994. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  5995. If you do not want to install the new dependencies immediately you can call it with --no-update
  5996. Read more at https://getcomposer.org/doc/03-cli.md#require
  5997. EOT
  5998. )
  5999. ;
  6000. }
  6001. protected function execute(InputInterface $input, OutputInterface $output)
  6002. {
  6003. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  6004. pcntl_async_signals(true);
  6005. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  6006. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  6007. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  6008. }
  6009. $this->file = Factory::getComposerFile();
  6010. $io = $this->getIO();
  6011. if ($input->getOption('no-suggest')) {
  6012. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  6013. }
  6014. $this->newlyCreated = !file_exists($this->file);
  6015. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  6016. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  6017. return 1;
  6018. }
  6019. if (!Filesystem::isReadable($this->file)) {
  6020. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  6021. return 1;
  6022. }
  6023. if (filesize($this->file) === 0) {
  6024. file_put_contents($this->file, "{\n}\n");
  6025. }
  6026. $this->json = new JsonFile($this->file);
  6027. $this->lock = Factory::getLockFile($this->file);
  6028. $this->composerBackup = file_get_contents($this->json->getPath());
  6029. $this->lockBackup = file_exists($this->lock) ? file_get_contents($this->lock) : null;
  6030. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  6031. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  6032. return 1;
  6033. }
  6034. if ($input->getOption('fixed') === true) {
  6035. $config = $this->json->read();
  6036. $packageType = empty($config['type']) ? 'library' : $config['type'];
  6037. if ($packageType !== 'project') {
  6038. $io->writeError('<error>"--fixed" option is allowed for "project" package types only to prevent possible misuses.</error>');
  6039. if (empty($config['type'])) {
  6040. $io->writeError('<error>If your package is not library, you should explicitly specify "type" parameter in composer.json.</error>');
  6041. }
  6042. return 1;
  6043. }
  6044. }
  6045. $composer = $this->requireComposer();
  6046. $repos = $composer->getRepositoryManager()->getRepositories();
  6047. $platformOverrides = $composer->getConfig()->get('platform');
  6048. $this->repos = new CompositeRepository(array_merge(
  6049. array($platformRepo = new PlatformRepository(array(), $platformOverrides)),
  6050. $repos
  6051. ));
  6052. if ($composer->getPackage()->getPreferStable()) {
  6053. $preferredStability = 'stable';
  6054. } else {
  6055. $preferredStability = $composer->getPackage()->getMinimumStability();
  6056. }
  6057. try {
  6058. $requirements = $this->determineRequirements(
  6059. $input,
  6060. $output,
  6061. $input->getArgument('packages'),
  6062. $platformRepo,
  6063. $preferredStability,
  6064. !$input->getOption('no-update'),
  6065. $input->getOption('fixed')
  6066. );
  6067. } catch (\Exception $e) {
  6068. if ($this->newlyCreated) {
  6069. $this->revertComposerFile(false);
  6070. throw new \RuntimeException('No composer.json present in the current directory ('.$this->file.'), this may be the cause of the following exception.', 0, $e);
  6071. }
  6072. throw $e;
  6073. }
  6074. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  6075. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  6076. $requirements = $this->formatRequirements($requirements);
  6077. $versionParser = new VersionParser();
  6078. foreach ($requirements as $package => $constraint) {
  6079. if (strtolower($package) === $composer->getPackage()->getName()) {
  6080. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  6081. return 1;
  6082. }
  6083. if ($constraint === 'self.version') {
  6084. continue;
  6085. }
  6086. $versionParser->parseConstraints($constraint);
  6087. }
  6088. $inconsistentRequireKeys = $this->getInconsistentRequireKeys($requirements, $requireKey);
  6089. if (count($inconsistentRequireKeys) > 0) {
  6090. foreach ($inconsistentRequireKeys as $package) {
  6091. $io->warning(sprintf(
  6092. '%s is currently present in the %s key and you ran the command %s the --dev flag, which would move it to the %s key.',
  6093. $package,
  6094. $removeKey,
  6095. $input->getOption('dev') ? 'with' : 'without',
  6096. $requireKey
  6097. ));
  6098. }
  6099. if ($io->isInteractive()) {
  6100. if (!$io->askConfirmation(sprintf('<info>Do you want to move %s?</info> [<comment>no</comment>]? ', count($inconsistentRequireKeys) > 1 ? 'these requirements' : 'this requirement'), false)) {
  6101. if (!$io->askConfirmation(sprintf('<info>Do you want to re-run the command %s --dev?</info> [<comment>yes</comment>]? ', $input->getOption('dev') ? 'without' : 'with'), true)) {
  6102. return 0;
  6103. }
  6104. list($requireKey, $removeKey) = array($removeKey, $requireKey);
  6105. }
  6106. }
  6107. }
  6108. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  6109. $this->firstRequire = $this->newlyCreated;
  6110. if (!$this->firstRequire) {
  6111. $composerDefinition = $this->json->read();
  6112. if (count($composerDefinition['require'] ?? []) === 0 && count($composerDefinition['require-dev'] ?? []) === 0) {
  6113. $this->firstRequire = true;
  6114. }
  6115. }
  6116. if (!$input->getOption('dry-run') && !$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  6117. $composerDefinition = $this->json->read();
  6118. foreach ($requirements as $package => $version) {
  6119. $composerDefinition[$requireKey][$package] = $version;
  6120. unset($composerDefinition[$removeKey][$package]);
  6121. if (isset($composerDefinition[$removeKey]) && count($composerDefinition[$removeKey]) === 0) {
  6122. unset($composerDefinition[$removeKey]);
  6123. }
  6124. }
  6125. $this->json->write($composerDefinition);
  6126. }
  6127. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  6128. if ($input->getOption('no-update')) {
  6129. return 0;
  6130. }
  6131. $composer->getPluginManager()->deactivateInstalledPlugins();
  6132. try {
  6133. return $this->doUpdate($input, $output, $io, $requirements, $requireKey, $removeKey);
  6134. } catch (\Exception $e) {
  6135. if (!$this->dependencyResolutionCompleted) {
  6136. $this->revertComposerFile(false);
  6137. }
  6138. throw $e;
  6139. }
  6140. }
  6141. private function getInconsistentRequireKeys(array $newRequirements, string $requireKey): array
  6142. {
  6143. $requireKeys = $this->getPackagesByRequireKey();
  6144. $inconsistentRequirements = array();
  6145. foreach ($requireKeys as $package => $packageRequireKey) {
  6146. if (!isset($newRequirements[$package])) {
  6147. continue;
  6148. }
  6149. if ($requireKey !== $packageRequireKey) {
  6150. $inconsistentRequirements[] = $package;
  6151. }
  6152. }
  6153. return $inconsistentRequirements;
  6154. }
  6155. private function getPackagesByRequireKey(): array
  6156. {
  6157. $composerDefinition = $this->json->read();
  6158. $require = array();
  6159. $requireDev = array();
  6160. if (isset($composerDefinition['require'])) {
  6161. $require = $composerDefinition['require'];
  6162. }
  6163. if (isset($composerDefinition['require-dev'])) {
  6164. $requireDev = $composerDefinition['require-dev'];
  6165. }
  6166. return array_merge(
  6167. array_fill_keys(array_keys($require), 'require'),
  6168. array_fill_keys(array_keys($requireDev), 'require-dev')
  6169. );
  6170. }
  6171. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, string $requireKey, string $removeKey): int
  6172. {
  6173. $this->resetComposer();
  6174. $composer = $this->requireComposer();
  6175. $this->dependencyResolutionCompleted = false;
  6176. $composer->getEventDispatcher()->addListener(InstallerEvents::PRE_OPERATIONS_EXEC, function (): void {
  6177. $this->dependencyResolutionCompleted = true;
  6178. }, 10000);
  6179. if ($input->getOption('dry-run')) {
  6180. $rootPackage = $composer->getPackage();
  6181. $links = array(
  6182. 'require' => $rootPackage->getRequires(),
  6183. 'require-dev' => $rootPackage->getDevRequires(),
  6184. );
  6185. $loader = new ArrayLoader();
  6186. $newLinks = $loader->parseLinks($rootPackage->getName(), $rootPackage->getPrettyVersion(), BasePackage::$supportedLinkTypes[$requireKey]['method'], $requirements);
  6187. $links[$requireKey] = array_merge($links[$requireKey], $newLinks);
  6188. foreach ($requirements as $package => $constraint) {
  6189. unset($links[$removeKey][$package]);
  6190. }
  6191. $rootPackage->setRequires($links['require']);
  6192. $rootPackage->setDevRequires($links['require-dev']);
  6193. }
  6194. $updateDevMode = !$input->getOption('update-no-dev');
  6195. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  6196. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  6197. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  6198. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  6199. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  6200. $flags = '';
  6201. if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
  6202. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  6203. $flags .= ' --with-all-dependencies';
  6204. } elseif ($input->getOption('update-with-dependencies') || $input->getOption('with-dependencies')) {
  6205. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  6206. $flags .= ' --with-dependencies';
  6207. }
  6208. $io->writeError('<info>Running composer update '.implode(' ', array_keys($requirements)).$flags.'</info>');
  6209. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  6210. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6211. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  6212. $install = Installer::create($io, $composer);
  6213. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($composer->getConfig(), $input);
  6214. $install
  6215. ->setDryRun($input->getOption('dry-run'))
  6216. ->setVerbose($input->getOption('verbose'))
  6217. ->setPreferSource($preferSource)
  6218. ->setPreferDist($preferDist)
  6219. ->setDevMode($updateDevMode)
  6220. ->setOptimizeAutoloader($optimize)
  6221. ->setClassMapAuthoritative($authoritative)
  6222. ->setApcuAutoloader($apcu, $apcuPrefix)
  6223. ->setUpdate(true)
  6224. ->setInstall(!$input->getOption('no-install'))
  6225. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  6226. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  6227. ->setPreferStable($input->getOption('prefer-stable'))
  6228. ->setPreferLowest($input->getOption('prefer-lowest'))
  6229. ;
  6230. if (!$this->firstRequire && $composer->getLocker()->isLocked()) {
  6231. $install->setUpdateAllowList(array_keys($requirements));
  6232. }
  6233. $status = $install->run();
  6234. if ($status !== 0) {
  6235. if ($status === Installer::ERROR_DEPENDENCY_RESOLUTION_FAILED) {
  6236. foreach ($this->normalizeRequirements($input->getArgument('packages')) as $req) {
  6237. if (!isset($req['version'])) {
  6238. $io->writeError('You can also try re-running composer require with an explicit version constraint, e.g. "composer require '.$req['name'].':*" to figure out if any version is installable, or "composer require '.$req['name'].':^2.1" if you know which you need.');
  6239. break;
  6240. }
  6241. }
  6242. }
  6243. $this->revertComposerFile(false);
  6244. }
  6245. return $status;
  6246. }
  6247. private function updateFileCleanly(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): bool
  6248. {
  6249. $contents = file_get_contents($json->getPath());
  6250. $manipulator = new JsonManipulator($contents);
  6251. foreach ($new as $package => $constraint) {
  6252. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  6253. return false;
  6254. }
  6255. if (!$manipulator->removeSubNode($removeKey, $package)) {
  6256. return false;
  6257. }
  6258. }
  6259. $manipulator->removeMainKeyIfEmpty($removeKey);
  6260. file_put_contents($json->getPath(), $manipulator->getContents());
  6261. return true;
  6262. }
  6263. protected function interact(InputInterface $input, OutputInterface $output): void
  6264. {
  6265. return;
  6266. }
  6267. public function revertComposerFile(bool $hardExit = true): void
  6268. {
  6269. $io = $this->getIO();
  6270. if ($this->newlyCreated) {
  6271. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  6272. unlink($this->json->getPath());
  6273. if (file_exists($this->lock)) {
  6274. unlink($this->lock);
  6275. }
  6276. } else {
  6277. $msg = ' to its ';
  6278. if ($this->lockBackup) {
  6279. $msg = ' and '.$this->lock.' to their ';
  6280. }
  6281. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.$msg.'original content.</error>');
  6282. file_put_contents($this->json->getPath(), $this->composerBackup);
  6283. if ($this->lockBackup) {
  6284. file_put_contents($this->lock, $this->lockBackup);
  6285. }
  6286. }
  6287. if ($hardExit) {
  6288. exit(1);
  6289. }
  6290. }
  6291. }
  6292. <?php declare(strict_types=1);
  6293. namespace Composer\Command;
  6294. use Composer\Script\Event as ScriptEvent;
  6295. use Composer\Script\ScriptEvents;
  6296. use Composer\Util\ProcessExecutor;
  6297. use Composer\Util\Platform;
  6298. use Symfony\Component\Console\Input\InputInterface;
  6299. use Symfony\Component\Console\Input\InputOption;
  6300. use Symfony\Component\Console\Input\InputArgument;
  6301. use Symfony\Component\Console\Output\OutputInterface;
  6302. class RunScriptCommand extends BaseCommand
  6303. {
  6304. protected $scriptEvents = array(
  6305. ScriptEvents::PRE_INSTALL_CMD,
  6306. ScriptEvents::POST_INSTALL_CMD,
  6307. ScriptEvents::PRE_UPDATE_CMD,
  6308. ScriptEvents::POST_UPDATE_CMD,
  6309. ScriptEvents::PRE_STATUS_CMD,
  6310. ScriptEvents::POST_STATUS_CMD,
  6311. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  6312. ScriptEvents::POST_CREATE_PROJECT_CMD,
  6313. ScriptEvents::PRE_ARCHIVE_CMD,
  6314. ScriptEvents::POST_ARCHIVE_CMD,
  6315. ScriptEvents::PRE_AUTOLOAD_DUMP,
  6316. ScriptEvents::POST_AUTOLOAD_DUMP,
  6317. );
  6318. protected function configure(): void
  6319. {
  6320. $this
  6321. ->setName('run-script')
  6322. ->setAliases(array('run'))
  6323. ->setDescription('Runs the scripts defined in composer.json.')
  6324. ->setDefinition(array(
  6325. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  6326. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  6327. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  6328. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  6329. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  6330. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  6331. ))
  6332. ->setHelp(
  6333. <<<EOT
  6334. The <info>run-script</info> command runs scripts defined in composer.json:
  6335. <info>php composer.phar run-script post-update-cmd</info>
  6336. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  6337. EOT
  6338. )
  6339. ;
  6340. }
  6341. protected function execute(InputInterface $input, OutputInterface $output): int
  6342. {
  6343. if ($input->getOption('list')) {
  6344. return $this->listScripts($output);
  6345. }
  6346. $script = $input->getArgument('script');
  6347. if ($script === null) {
  6348. throw new \RuntimeException('Missing required argument "script"');
  6349. }
  6350. if (!in_array($script, $this->scriptEvents)) {
  6351. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6352. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  6353. }
  6354. }
  6355. $composer = $this->requireComposer();
  6356. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  6357. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  6358. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  6359. if (!$hasListeners) {
  6360. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  6361. }
  6362. $args = $input->getArgument('args');
  6363. if (null !== $timeout = $input->getOption('timeout')) {
  6364. if (!ctype_digit($timeout)) {
  6365. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  6366. }
  6367. ProcessExecutor::setTimeout((int) $timeout);
  6368. }
  6369. Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
  6370. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  6371. }
  6372. protected function listScripts(OutputInterface $output): int
  6373. {
  6374. $scripts = $this->requireComposer()->getPackage()->getScripts();
  6375. if (!count($scripts)) {
  6376. return 0;
  6377. }
  6378. $io = $this->getIO();
  6379. $io->writeError('<info>scripts:</info>');
  6380. $table = array();
  6381. foreach ($scripts as $name => $script) {
  6382. $description = '';
  6383. try {
  6384. $cmd = $this->getApplication()->find($name);
  6385. if ($cmd instanceof ScriptAliasCommand) {
  6386. $description = $cmd->getDescription();
  6387. }
  6388. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  6389. }
  6390. $table[] = array(' '.$name, $description);
  6391. }
  6392. $this->renderTable($table, $output);
  6393. return 0;
  6394. }
  6395. }
  6396. <?php declare(strict_types=1);
  6397. namespace Composer\Command;
  6398. use Symfony\Component\Console\Input\InputInterface;
  6399. use Symfony\Component\Console\Input\InputOption;
  6400. use Symfony\Component\Console\Input\InputArgument;
  6401. use Symfony\Component\Console\Output\OutputInterface;
  6402. class ScriptAliasCommand extends BaseCommand
  6403. {
  6404. private $script;
  6405. private $description;
  6406. public function __construct(string $script, ?string $description)
  6407. {
  6408. $this->script = $script;
  6409. $this->description = $description ?? 'Runs the '.$script.' script as defined in composer.json.';
  6410. parent::__construct();
  6411. }
  6412. protected function configure(): void
  6413. {
  6414. $this
  6415. ->setName($this->script)
  6416. ->setDescription($this->description)
  6417. ->setDefinition(array(
  6418. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  6419. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  6420. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  6421. ))
  6422. ->setHelp(
  6423. <<<EOT
  6424. The <info>run-script</info> command runs scripts defined in composer.json:
  6425. <info>php composer.phar run-script post-update-cmd</info>
  6426. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  6427. EOT
  6428. )
  6429. ;
  6430. }
  6431. protected function execute(InputInterface $input, OutputInterface $output): int
  6432. {
  6433. $composer = $this->requireComposer();
  6434. $args = $input->getArguments();
  6435. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  6436. }
  6437. }
  6438. <?php declare(strict_types=1);
  6439. namespace Composer\Command;
  6440. use Composer\Factory;
  6441. use Composer\Json\JsonFile;
  6442. use Symfony\Component\Console\Formatter\OutputFormatter;
  6443. use Symfony\Component\Console\Input\InputInterface;
  6444. use Symfony\Component\Console\Input\InputArgument;
  6445. use Symfony\Component\Console\Input\InputOption;
  6446. use Symfony\Component\Console\Output\OutputInterface;
  6447. use Composer\Repository\CompositeRepository;
  6448. use Composer\Repository\PlatformRepository;
  6449. use Composer\Repository\RepositoryInterface;
  6450. use Composer\Plugin\CommandEvent;
  6451. use Composer\Plugin\PluginEvents;
  6452. class SearchCommand extends BaseCommand
  6453. {
  6454. protected function configure(): void
  6455. {
  6456. $this
  6457. ->setName('search')
  6458. ->setDescription('Searches for packages.')
  6459. ->setDefinition(array(
  6460. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in package names'),
  6461. new InputOption('only-vendor', 'O', InputOption::VALUE_NONE, 'Search only for vendor / organization names, returns only "vendor" as result'),
  6462. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  6463. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  6464. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  6465. ))
  6466. ->setHelp(
  6467. <<<EOT
  6468. The search command searches for packages by its name
  6469. <info>php composer.phar search symfony composer</info>
  6470. Read more at https://getcomposer.org/doc/03-cli.md#search
  6471. EOT
  6472. )
  6473. ;
  6474. }
  6475. protected function execute(InputInterface $input, OutputInterface $output): int
  6476. {
  6477. $platformRepo = new PlatformRepository;
  6478. $io = $this->getIO();
  6479. $format = $input->getOption('format');
  6480. if (!in_array($format, array('text', 'json'))) {
  6481. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  6482. return 1;
  6483. }
  6484. if (!($composer = $this->tryComposer())) {
  6485. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  6486. }
  6487. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6488. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  6489. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  6490. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  6491. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6492. $mode = RepositoryInterface::SEARCH_FULLTEXT;
  6493. if ($input->getOption('only-name') === true) {
  6494. if ($input->getOption('only-vendor') === true) {
  6495. throw new \InvalidArgumentException('--only-name and --only-vendor cannot be used together');
  6496. }
  6497. $mode = RepositoryInterface::SEARCH_NAME;
  6498. } elseif ($input->getOption('only-vendor') === true) {
  6499. $mode = RepositoryInterface::SEARCH_VENDOR;
  6500. }
  6501. $type = $input->getOption('type');
  6502. $query = implode(' ', $input->getArgument('tokens'));
  6503. if ($mode !== RepositoryInterface::SEARCH_FULLTEXT) {
  6504. $query = preg_quote($query);
  6505. }
  6506. $results = $repos->search($query, $mode, $type);
  6507. if ($results && $format === 'text') {
  6508. $width = $this->getTerminalWidth();
  6509. $nameLength = 0;
  6510. foreach ($results as $result) {
  6511. $nameLength = max(strlen($result['name']), $nameLength);
  6512. }
  6513. $nameLength += 1;
  6514. foreach ($results as $result) {
  6515. $description = $result['description'] ?? '';
  6516. $warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : '';
  6517. $remaining = $width - $nameLength - strlen($warning) - 2;
  6518. if (strlen($description) > $remaining) {
  6519. $description = substr($description, 0, $remaining - 3) . '...';
  6520. }
  6521. $link = $result['url'] ?? null;
  6522. if ($link !== null) {
  6523. $io->write('<href='.OutputFormatter::escape($link).'>'.$result['name'].'</>'. str_repeat(' ', $nameLength - strlen($result['name'])) . $warning . $description);
  6524. } else {
  6525. $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description);
  6526. }
  6527. }
  6528. } elseif ($format === 'json') {
  6529. $io->write(JsonFile::encode($results));
  6530. }
  6531. return 0;
  6532. }
  6533. }
  6534. <?php declare(strict_types=1);
  6535. namespace Composer\Command;
  6536. use Composer\Composer;
  6537. use Composer\Factory;
  6538. use Composer\Config;
  6539. use Composer\Pcre\Preg;
  6540. use Composer\Util\Filesystem;
  6541. use Composer\Util\Platform;
  6542. use Composer\SelfUpdate\Keys;
  6543. use Composer\SelfUpdate\Versions;
  6544. use Composer\IO\IOInterface;
  6545. use Composer\Downloader\FilesystemException;
  6546. use Composer\Downloader\TransportException;
  6547. use Symfony\Component\Console\Input\InputInterface;
  6548. use Symfony\Component\Console\Input\InputOption;
  6549. use Symfony\Component\Console\Input\InputArgument;
  6550. use Symfony\Component\Console\Output\OutputInterface;
  6551. use Symfony\Component\Finder\Finder;
  6552. class SelfUpdateCommand extends BaseCommand
  6553. {
  6554. private const HOMEPAGE = 'getcomposer.org';
  6555. private const OLD_INSTALL_EXT = '-old.phar';
  6556. protected function configure(): void
  6557. {
  6558. $this
  6559. ->setName('self-update')
  6560. ->setAliases(array('selfupdate'))
  6561. ->setDescription('Updates composer.phar to the latest version.')
  6562. ->setDefinition(array(
  6563. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  6564. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  6565. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  6566. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6567. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  6568. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  6569. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  6570. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  6571. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  6572. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  6573. new InputOption('2.2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.2.x LTS versions'),
  6574. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  6575. ))
  6576. ->setHelp(
  6577. <<<EOT
  6578. The <info>self-update</info> command checks getcomposer.org for newer
  6579. versions of composer and if found, installs the latest.
  6580. <info>php composer.phar self-update</info>
  6581. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  6582. EOT
  6583. )
  6584. ;
  6585. }
  6586. protected function execute(InputInterface $input, OutputInterface $output): int
  6587. {
  6588. class_exists('Composer\Util\Platform');
  6589. class_exists('Composer\Downloader\FilesystemException');
  6590. $config = Factory::createConfig();
  6591. if ($config->get('disable-tls') === true) {
  6592. $baseUrl = 'http://' . self::HOMEPAGE;
  6593. } else {
  6594. $baseUrl = 'https://' . self::HOMEPAGE;
  6595. }
  6596. $io = $this->getIO();
  6597. $httpDownloader = Factory::createHttpDownloader($io, $config);
  6598. $versionsUtil = new Versions($config, $httpDownloader);
  6599. $requestedChannel = null;
  6600. foreach (Versions::CHANNELS as $channel) {
  6601. if ($input->getOption($channel)) {
  6602. $requestedChannel = $channel;
  6603. $versionsUtil->setChannel($channel);
  6604. break;
  6605. }
  6606. }
  6607. if ($input->getOption('set-channel-only')) {
  6608. return 0;
  6609. }
  6610. $cacheDir = $config->get('cache-dir');
  6611. $rollbackDir = $config->get('data-dir');
  6612. $home = $config->get('home');
  6613. $localFilename = realpath($_SERVER['argv'][0]);
  6614. if (false === $localFilename) {
  6615. $localFilename = $_SERVER['argv'][0];
  6616. }
  6617. if ($input->getOption('update-keys')) {
  6618. $this->fetchKeys($io, $config);
  6619. return 0;
  6620. }
  6621. if (!file_exists($localFilename)) {
  6622. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  6623. }
  6624. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  6625. if (!is_writable($tmpDir)) {
  6626. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  6627. }
  6628. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  6629. $composerUser = posix_getpwuid(posix_geteuid());
  6630. $homeDirOwnerId = fileowner($home);
  6631. if (is_array($composerUser) && $homeDirOwnerId !== false) {
  6632. $homeOwner = posix_getpwuid($homeDirOwnerId);
  6633. if (is_array($homeOwner) && isset($composerUser['name'], $homeOwner['name']) && $composerUser['name'] !== $homeOwner['name']) {
  6634. $io->writeError('<warning>You are running Composer as "'.$composerUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  6635. }
  6636. }
  6637. }
  6638. if ($input->getOption('rollback')) {
  6639. return $this->rollback($output, $rollbackDir, $localFilename);
  6640. }
  6641. $latest = $versionsUtil->getLatest();
  6642. $latestStable = $versionsUtil->getLatest('stable');
  6643. try {
  6644. $latestPreview = $versionsUtil->getLatest('preview');
  6645. } catch (\UnexpectedValueException $e) {
  6646. $latestPreview = $latestStable;
  6647. }
  6648. $latestVersion = $latest['version'];
  6649. $updateVersion = $input->getArgument('version') ?? $latestVersion;
  6650. $currentMajorVersion = Preg::replace('{^(\d+).*}', '$1', Composer::getVersion());
  6651. $updateMajorVersion = Preg::replace('{^(\d+).*}', '$1', $updateVersion);
  6652. $previewMajorVersion = Preg::replace('{^(\d+).*}', '$1', $latestPreview['version']);
  6653. if ($versionsUtil->getChannel() === 'stable' && null === $input->getArgument('version')) {
  6654. if ($currentMajorVersion < $updateMajorVersion) {
  6655. $skippedVersion = $updateVersion;
  6656. $versionsUtil->setChannel($currentMajorVersion);
  6657. $latest = $versionsUtil->getLatest();
  6658. $latestStable = $versionsUtil->getLatest('stable');
  6659. $latestVersion = $latest['version'];
  6660. $updateVersion = $latestVersion;
  6661. $io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://getcomposer.org/'.$updateMajorVersion.'</warning>');
  6662. } elseif ($currentMajorVersion < $previewMajorVersion) {
  6663. $io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>');
  6664. }
  6665. }
  6666. $effectiveChannel = $requestedChannel === null ? $versionsUtil->getChannel() : $requestedChannel;
  6667. if (is_numeric($effectiveChannel) && strpos($latestStable['version'], $effectiveChannel) !== 0) {
  6668. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$effectiveChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  6669. }
  6670. if (isset($latest['eol'])) {
  6671. $io->writeError('<warning>Warning: Version '.$latestVersion.' is EOL / End of Life. '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  6672. }
  6673. if (Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  6674. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  6675. return 1;
  6676. }
  6677. $channelString = $versionsUtil->getChannel();
  6678. if (is_numeric($channelString)) {
  6679. $channelString .= '.x';
  6680. }
  6681. if (Composer::VERSION === $updateVersion) {
  6682. $io->writeError(
  6683. sprintf(
  6684. '<info>You are already using the latest available Composer version %s (%s channel).</info>',
  6685. $updateVersion,
  6686. $channelString
  6687. )
  6688. );
  6689. if ($input->getOption('clean-backups')) {
  6690. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  6691. }
  6692. return 0;
  6693. }
  6694. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp'.random_int(0, 10000000).'.phar';
  6695. $backupFile = sprintf(
  6696. '%s/%s-%s%s',
  6697. $rollbackDir,
  6698. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  6699. Preg::replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  6700. self::OLD_INSTALL_EXT
  6701. );
  6702. $updatingToTag = !Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion);
  6703. $io->write(sprintf("Upgrading to version <info>%s</info> (%s channel).", $updateVersion, $channelString));
  6704. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  6705. try {
  6706. $signature = $httpDownloader->get($remoteFilename.'.sig')->getBody();
  6707. } catch (TransportException $e) {
  6708. if ($e->getStatusCode() === 404) {
  6709. throw new \InvalidArgumentException('Version "'.$updateVersion.'" could not be found.', 0, $e);
  6710. }
  6711. throw $e;
  6712. }
  6713. $io->writeError(' ', false);
  6714. $httpDownloader->copy($remoteFilename, $tempFilename);
  6715. $io->writeError('');
  6716. if (!file_exists($tempFilename) || null === $signature || '' === $signature) {
  6717. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  6718. return 1;
  6719. }
  6720. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  6721. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  6722. } else {
  6723. if (!extension_loaded('openssl')) {
  6724. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  6725. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  6726. }
  6727. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  6728. if (!file_exists($sigFile)) {
  6729. file_put_contents(
  6730. $home.'/keys.dev.pub',
  6731. <<<DEVPUBKEY
  6732. -----BEGIN PUBLIC KEY-----
  6733. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  6734. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  6735. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  6736. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  6737. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  6738. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  6739. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  6740. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  6741. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  6742. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  6743. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  6744. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  6745. -----END PUBLIC KEY-----
  6746. DEVPUBKEY
  6747. );
  6748. file_put_contents(
  6749. $home.'/keys.tags.pub',
  6750. <<<TAGSPUBKEY
  6751. -----BEGIN PUBLIC KEY-----
  6752. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  6753. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  6754. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  6755. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  6756. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  6757. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  6758. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  6759. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  6760. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  6761. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  6762. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  6763. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  6764. -----END PUBLIC KEY-----
  6765. TAGSPUBKEY
  6766. );
  6767. }
  6768. $pubkeyid = openssl_pkey_get_public($sigFile);
  6769. if (false === $pubkeyid) {
  6770. throw new \RuntimeException('Failed loading the public key from '.$sigFile);
  6771. }
  6772. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  6773. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()), true)) {
  6774. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  6775. }
  6776. $signatureData = json_decode($signature, true);
  6777. $signatureSha384 = base64_decode($signatureData['sha384'], true);
  6778. if (false === $signatureSha384) {
  6779. throw new \RuntimeException('Failed loading the phar signature from '.$remoteFilename.'.sig, got '.$signature);
  6780. }
  6781. $verified = 1 === openssl_verify((string) file_get_contents($tempFilename), $signatureSha384, $pubkeyid, $algo);
  6782. if (PHP_VERSION_ID < 80000) {
  6783. openssl_free_key($pubkeyid);
  6784. }
  6785. if (!$verified) {
  6786. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  6787. }
  6788. }
  6789. if ($input->getOption('clean-backups')) {
  6790. $this->cleanBackups($rollbackDir);
  6791. }
  6792. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  6793. @unlink($tempFilename);
  6794. return 1;
  6795. }
  6796. if (file_exists($backupFile)) {
  6797. $io->writeError(sprintf(
  6798. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  6799. Composer::VERSION
  6800. ));
  6801. } else {
  6802. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  6803. }
  6804. return 0;
  6805. }
  6806. protected function fetchKeys(IOInterface $io, Config $config): void
  6807. {
  6808. if (!$io->isInteractive()) {
  6809. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  6810. }
  6811. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  6812. $validator = function ($value): string {
  6813. if (!Preg::isMatch('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  6814. throw new \UnexpectedValueException('Invalid input');
  6815. }
  6816. return trim($value)."\n";
  6817. };
  6818. $devKey = '';
  6819. while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  6820. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  6821. while ($line = $io->ask('')) {
  6822. $devKey .= trim($line)."\n";
  6823. if (trim($line) === '-----END PUBLIC KEY-----') {
  6824. break;
  6825. }
  6826. }
  6827. }
  6828. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  6829. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  6830. $tagsKey = '';
  6831. while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  6832. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  6833. while ($line = $io->ask('')) {
  6834. $tagsKey .= trim($line)."\n";
  6835. if (trim($line) === '-----END PUBLIC KEY-----') {
  6836. break;
  6837. }
  6838. }
  6839. }
  6840. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  6841. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  6842. $io->write('Public keys stored in '.$config->get('home'));
  6843. }
  6844. protected function rollback(OutputInterface $output, string $rollbackDir, string $localFilename): int
  6845. {
  6846. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  6847. if (null === $rollbackVersion) {
  6848. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  6849. }
  6850. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  6851. if (!is_file($oldFile)) {
  6852. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  6853. }
  6854. if (!Filesystem::isReadable($oldFile)) {
  6855. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  6856. }
  6857. $io = $this->getIO();
  6858. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  6859. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  6860. return 1;
  6861. }
  6862. return 0;
  6863. }
  6864. protected function setLocalPhar(string $localFilename, string $newFilename, string $backupTarget = null): bool
  6865. {
  6866. $io = $this->getIO();
  6867. $perms = @fileperms($localFilename);
  6868. if ($perms !== false) {
  6869. @chmod($newFilename, $perms);
  6870. }
  6871. if (!$this->validatePhar($newFilename, $error)) {
  6872. $io->writeError('<error>The '.($backupTarget !== null ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  6873. if ($backupTarget !== null) {
  6874. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  6875. }
  6876. return false;
  6877. }
  6878. if ($backupTarget !== null) {
  6879. @copy($localFilename, $backupTarget);
  6880. }
  6881. try {
  6882. if (Platform::isWindows()) {
  6883. copy($newFilename, $localFilename);
  6884. @unlink($newFilename);
  6885. } else {
  6886. rename($newFilename, $localFilename);
  6887. }
  6888. return true;
  6889. } catch (\Exception $e) {
  6890. if (!is_writable(dirname($localFilename))
  6891. && $io->isInteractive()
  6892. && $this->isWindowsNonAdminUser()) {
  6893. return $this->tryAsWindowsAdmin($localFilename, $newFilename);
  6894. }
  6895. @unlink($newFilename);
  6896. $action = 'Composer '.($backupTarget !== null ? 'update' : 'rollback');
  6897. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  6898. }
  6899. }
  6900. protected function cleanBackups(string $rollbackDir, ?string $except = null): void
  6901. {
  6902. $finder = $this->getOldInstallationFinder($rollbackDir);
  6903. $io = $this->getIO();
  6904. $fs = new Filesystem;
  6905. foreach ($finder as $file) {
  6906. if ($file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  6907. continue;
  6908. }
  6909. $file = (string) $file;
  6910. $io->writeError('<info>Removing: '.$file.'</info>');
  6911. $fs->remove($file);
  6912. }
  6913. }
  6914. protected function getLastBackupVersion(string $rollbackDir): ?string
  6915. {
  6916. $finder = $this->getOldInstallationFinder($rollbackDir);
  6917. $finder->sortByName();
  6918. $files = iterator_to_array($finder);
  6919. if (count($files) > 0) {
  6920. return end($files)->getBasename(self::OLD_INSTALL_EXT);
  6921. }
  6922. return null;
  6923. }
  6924. protected function getOldInstallationFinder(string $rollbackDir): Finder
  6925. {
  6926. return Finder::create()
  6927. ->depth(0)
  6928. ->files()
  6929. ->name('*' . self::OLD_INSTALL_EXT)
  6930. ->in($rollbackDir);
  6931. }
  6932. protected function validatePhar(string $pharFile, ?string &$error): bool
  6933. {
  6934. if ((bool) ini_get('phar.readonly')) {
  6935. return true;
  6936. }
  6937. try {
  6938. $phar = new \Phar($pharFile);
  6939. unset($phar);
  6940. $result = true;
  6941. } catch (\Exception $e) {
  6942. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  6943. throw $e;
  6944. }
  6945. $error = $e->getMessage();
  6946. $result = false;
  6947. }
  6948. return $result;
  6949. }
  6950. protected function isWindowsNonAdminUser(): bool
  6951. {
  6952. if (!Platform::isWindows()) {
  6953. return false;
  6954. }
  6955. exec('fltmc.exe filters', $output, $exitCode);
  6956. return $exitCode !== 0;
  6957. }
  6958. protected function tryAsWindowsAdmin(string $localFilename, string $newFilename): bool
  6959. {
  6960. $io = $this->getIO();
  6961. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  6962. $helpMessage = 'Please run the self-update command as an Administrator.';
  6963. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  6964. if (!$io->askConfirmation($question, false)) {
  6965. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  6966. return false;
  6967. }
  6968. $tmpFile = tempnam(sys_get_temp_dir(), '');
  6969. if (false === $tmpFile) {
  6970. $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
  6971. return false;
  6972. }
  6973. $script = $tmpFile.'.vbs';
  6974. rename($tmpFile, $script);
  6975. $checksum = hash_file('sha256', $newFilename);
  6976. $source = str_replace('/', '\\', $newFilename);
  6977. $destination = str_replace('/', '\\', $localFilename);
  6978. $vbs = <<<EOT
  6979. Set UAC = CreateObject("Shell.Application")
  6980. UAC.ShellExecute "cmd.exe", "/c copy /b /y ""$source"" ""$destination""", "", "runas", 0
  6981. Wscript.Sleep(300)
  6982. EOT;
  6983. file_put_contents($script, $vbs);
  6984. exec('"'.$script.'"');
  6985. @unlink($script);
  6986. if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
  6987. $io->writeError('<info>Operation succeeded.</info>');
  6988. @unlink($newFilename);
  6989. } else {
  6990. $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
  6991. }
  6992. return $result;
  6993. }
  6994. }
  6995. <?php declare(strict_types=1);
  6996. namespace Composer\Command;
  6997. use Composer\Composer;
  6998. use Composer\DependencyResolver\DefaultPolicy;
  6999. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  7000. use Composer\Json\JsonFile;
  7001. use Composer\Package\BasePackage;
  7002. use Composer\Package\CompletePackageInterface;
  7003. use Composer\Package\Link;
  7004. use Composer\Package\AliasPackage;
  7005. use Composer\Package\Package;
  7006. use Composer\Package\PackageInterface;
  7007. use Composer\Package\Version\VersionParser;
  7008. use Composer\Package\Version\VersionSelector;
  7009. use Composer\Pcre\Preg;
  7010. use Composer\Plugin\CommandEvent;
  7011. use Composer\Plugin\PluginEvents;
  7012. use Composer\Repository\InstalledArrayRepository;
  7013. use Composer\Repository\ComposerRepository;
  7014. use Composer\Repository\CompositeRepository;
  7015. use Composer\Repository\FilterRepository;
  7016. use Composer\Repository\PlatformRepository;
  7017. use Composer\Repository\RepositoryFactory;
  7018. use Composer\Repository\InstalledRepository;
  7019. use Composer\Repository\RepositoryInterface;
  7020. use Composer\Repository\RepositorySet;
  7021. use Composer\Repository\RootPackageRepository;
  7022. use Composer\Semver\Constraint\ConstraintInterface;
  7023. use Composer\Semver\Semver;
  7024. use Composer\Spdx\SpdxLicenses;
  7025. use Composer\Util\PackageInfo;
  7026. use Symfony\Component\Console\Formatter\OutputFormatter;
  7027. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  7028. use Symfony\Component\Console\Input\InputArgument;
  7029. use Symfony\Component\Console\Input\InputInterface;
  7030. use Symfony\Component\Console\Input\InputOption;
  7031. use Symfony\Component\Console\Output\OutputInterface;
  7032. class ShowCommand extends BaseCommand
  7033. {
  7034. protected $versionParser;
  7035. protected $colors;
  7036. private $repositorySet;
  7037. protected function configure()
  7038. {
  7039. $this
  7040. ->setName('show')
  7041. ->setAliases(array('info'))
  7042. ->setDescription('Shows information about packages.')
  7043. ->setDefinition(array(
  7044. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  7045. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  7046. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  7047. new InputOption('locked', null, InputOption::VALUE_NONE, 'List all locked packages'),
  7048. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  7049. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  7050. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  7051. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  7052. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  7053. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  7054. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  7055. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  7056. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  7057. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  7058. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  7059. new InputOption('patch-only', null, InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates. Use with the --outdated option.'),
  7060. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  7061. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  7062. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  7063. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  7064. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages). Use with the --outdated option'),
  7065. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
  7066. ))
  7067. ->setHelp(
  7068. <<<EOT
  7069. The show command displays detailed information about a package, or
  7070. lists all packages available.
  7071. Read more at https://getcomposer.org/doc/03-cli.md#show
  7072. EOT
  7073. )
  7074. ;
  7075. }
  7076. protected function execute(InputInterface $input, OutputInterface $output)
  7077. {
  7078. $this->versionParser = new VersionParser;
  7079. if ($input->getOption('tree')) {
  7080. $this->initStyles($output);
  7081. }
  7082. $composer = $this->tryComposer();
  7083. $io = $this->getIO();
  7084. if ($input->getOption('installed')) {
  7085. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  7086. }
  7087. if ($input->getOption('outdated')) {
  7088. $input->setOption('latest', true);
  7089. } elseif (count($input->getOption('ignore')) > 0) {
  7090. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  7091. }
  7092. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  7093. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  7094. return 1;
  7095. }
  7096. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  7097. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  7098. return 1;
  7099. }
  7100. if ($input->getOption('patch-only') && $input->getOption('minor-only')) {
  7101. $io->writeError('The --patch-only option is not usable in combination with --minor-only');
  7102. return 1;
  7103. }
  7104. if ($input->getOption('tree') && $input->getOption('latest')) {
  7105. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  7106. return 1;
  7107. }
  7108. if ($input->getOption('tree') && $input->getOption('path')) {
  7109. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  7110. return 1;
  7111. }
  7112. $format = $input->getOption('format');
  7113. if (!in_array($format, array('text', 'json'))) {
  7114. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  7115. return 1;
  7116. }
  7117. $platformReqFilter = $this->getPlatformRequirementFilter($input);
  7118. $platformOverrides = array();
  7119. if ($composer) {
  7120. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  7121. }
  7122. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  7123. $lockedRepo = null;
  7124. if ($input->getOption('self')) {
  7125. $package = $this->requireComposer()->getPackage();
  7126. if ($input->getOption('name-only')) {
  7127. $io->write($package->getName());
  7128. return 0;
  7129. }
  7130. if ($input->getArgument('package')) {
  7131. throw new \InvalidArgumentException('You cannot use --self together with a package name');
  7132. }
  7133. $repos = $installedRepo = new InstalledRepository(array(new RootPackageRepository($package)));
  7134. } elseif ($input->getOption('platform')) {
  7135. $repos = $installedRepo = new InstalledRepository(array($platformRepo));
  7136. } elseif ($input->getOption('available')) {
  7137. $installedRepo = new InstalledRepository(array($platformRepo));
  7138. if ($composer) {
  7139. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  7140. $installedRepo->addRepository($composer->getRepositoryManager()->getLocalRepository());
  7141. } else {
  7142. $defaultRepos = RepositoryFactory::defaultRepos($io);
  7143. $repos = new CompositeRepository($defaultRepos);
  7144. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  7145. }
  7146. } elseif ($input->getOption('all') && $composer) {
  7147. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7148. $locker = $composer->getLocker();
  7149. if ($locker->isLocked()) {
  7150. $lockedRepo = $locker->getLockedRepository(true);
  7151. $installedRepo = new InstalledRepository(array($lockedRepo, $localRepo, $platformRepo));
  7152. } else {
  7153. $installedRepo = new InstalledRepository(array($localRepo, $platformRepo));
  7154. }
  7155. $repos = new CompositeRepository(array_merge(array(new FilterRepository($installedRepo, array('canonical' => false))), $composer->getRepositoryManager()->getRepositories()));
  7156. } elseif ($input->getOption('all')) {
  7157. $defaultRepos = RepositoryFactory::defaultRepos($io);
  7158. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  7159. $installedRepo = new InstalledRepository(array($platformRepo));
  7160. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  7161. } elseif ($input->getOption('locked')) {
  7162. if (!$composer || !$composer->getLocker()->isLocked()) {
  7163. throw new \UnexpectedValueException('A valid composer.json and composer.lock files is required to run this command with --locked');
  7164. }
  7165. $locker = $composer->getLocker();
  7166. $lockedRepo = $locker->getLockedRepository(!$input->getOption('no-dev'));
  7167. $repos = $installedRepo = new InstalledRepository(array($lockedRepo));
  7168. } else {
  7169. if (!$composer) {
  7170. $composer = $this->requireComposer();
  7171. }
  7172. $rootPkg = $composer->getPackage();
  7173. $repos = $installedRepo = new InstalledRepository(array($composer->getRepositoryManager()->getLocalRepository()));
  7174. if ($input->getOption('no-dev')) {
  7175. $packages = $this->filterRequiredPackages($installedRepo, $rootPkg);
  7176. $repos = $installedRepo = new InstalledRepository(array(new InstalledArrayRepository(array_map(function ($pkg): PackageInterface {
  7177. return clone $pkg;
  7178. }, $packages))));
  7179. }
  7180. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  7181. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  7182. }
  7183. }
  7184. if ($composer) {
  7185. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  7186. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7187. }
  7188. if ($input->getOption('latest') && null === $composer) {
  7189. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  7190. $input->setOption('latest', false);
  7191. }
  7192. $packageFilter = $input->getArgument('package');
  7193. if (isset($package)) {
  7194. $versions = array($package->getPrettyVersion() => $package->getVersion());
  7195. } elseif (null !== $packageFilter && !str_contains($packageFilter, '*')) {
  7196. list($package, $versions) = $this->getPackage($installedRepo, $repos, $packageFilter, $input->getArgument('version'));
  7197. if (!isset($package)) {
  7198. $options = $input->getOptions();
  7199. $hint = '';
  7200. if ($input->getOption('locked')) {
  7201. $hint .= ' in lock file';
  7202. }
  7203. if (isset($options['working-dir'])) {
  7204. $hint .= ' in ' . $options['working-dir'] . '/composer.json';
  7205. }
  7206. if (PlatformRepository::isPlatformPackage($packageFilter) && !$input->getOption('platform')) {
  7207. $hint .= ', try using --platform (-p) to show platform packages';
  7208. }
  7209. if (!$input->getOption('all')) {
  7210. $hint .= ', try using --all (-a) to show all available packages';
  7211. }
  7212. throw new \InvalidArgumentException('Package "' . $packageFilter . '" not found'.$hint.'.');
  7213. }
  7214. }
  7215. if (isset($package)) {
  7216. assert(isset($versions));
  7217. $exitCode = 0;
  7218. if ($input->getOption('tree')) {
  7219. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  7220. if ('json' === $format) {
  7221. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  7222. } else {
  7223. $this->displayPackageTree(array($arrayTree));
  7224. }
  7225. return $exitCode;
  7226. }
  7227. $latestPackage = null;
  7228. if ($input->getOption('latest')) {
  7229. $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $input->getOption('minor-only'), $input->getOption('patch-only'), $platformReqFilter);
  7230. }
  7231. if (
  7232. $input->getOption('outdated')
  7233. && $input->getOption('strict')
  7234. && null !== $latestPackage
  7235. && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
  7236. && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
  7237. ) {
  7238. $exitCode = 1;
  7239. }
  7240. if ($input->getOption('path')) {
  7241. $io->write($package->getName(), false);
  7242. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  7243. return $exitCode;
  7244. }
  7245. if ('json' === $format) {
  7246. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  7247. } else {
  7248. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  7249. }
  7250. return $exitCode;
  7251. }
  7252. if ($input->getOption('tree')) {
  7253. $rootRequires = $this->getRootRequires();
  7254. $packages = $installedRepo->getPackages();
  7255. usort($packages, function (BasePackage $a, BasePackage $b): int {
  7256. return strcmp((string) $a, (string) $b);
  7257. });
  7258. $arrayTree = array();
  7259. foreach ($packages as $package) {
  7260. if (in_array($package->getName(), $rootRequires, true)) {
  7261. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  7262. }
  7263. }
  7264. if ('json' === $format) {
  7265. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  7266. } else {
  7267. $this->displayPackageTree($arrayTree);
  7268. }
  7269. return 0;
  7270. }
  7271. $packages = array();
  7272. $packageFilterRegex = null;
  7273. if (null !== $packageFilter) {
  7274. $packageFilterRegex = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  7275. }
  7276. $packageListFilter = array();
  7277. if ($input->getOption('direct')) {
  7278. $packageListFilter = $this->getRootRequires();
  7279. }
  7280. if ($input->getOption('path') && null === $composer) {
  7281. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  7282. $input->setOption('path', false);
  7283. }
  7284. foreach ($repos->getRepositories() as $repo) {
  7285. if ($repo === $platformRepo) {
  7286. $type = 'platform';
  7287. } elseif ($lockedRepo !== null && $repo === $lockedRepo) {
  7288. $type = 'locked';
  7289. } elseif ($repo === $installedRepo || in_array($repo, $installedRepo->getRepositories(), true)) {
  7290. $type = 'installed';
  7291. } else {
  7292. $type = 'available';
  7293. }
  7294. if ($repo instanceof ComposerRepository) {
  7295. foreach ($repo->getPackageNames($packageFilter) as $name) {
  7296. $packages[$type][$name] = $name;
  7297. }
  7298. } else {
  7299. foreach ($repo->getPackages() as $package) {
  7300. if (!isset($packages[$type][$package->getName()])
  7301. || !is_object($packages[$type][$package->getName()])
  7302. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  7303. ) {
  7304. while ($package instanceof AliasPackage) {
  7305. $package = $package->getAliasOf();
  7306. }
  7307. if (!$packageFilterRegex || Preg::isMatch($packageFilterRegex, $package->getName())) {
  7308. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  7309. $packages[$type][$package->getName()] = $package;
  7310. }
  7311. }
  7312. }
  7313. }
  7314. if ($repo === $platformRepo) {
  7315. foreach ($platformRepo->getDisabledPackages() as $name => $package) {
  7316. $packages[$type][$name] = $package;
  7317. }
  7318. }
  7319. }
  7320. }
  7321. $showAllTypes = $input->getOption('all');
  7322. $showLatest = $input->getOption('latest');
  7323. $showMinorOnly = $input->getOption('minor-only');
  7324. $showPatchOnly = $input->getOption('patch-only');
  7325. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  7326. $indent = $showAllTypes ? ' ' : '';
  7327. $latestPackages = array();
  7328. $exitCode = 0;
  7329. $viewData = array();
  7330. $viewMetaData = array();
  7331. foreach (array('platform' => true, 'locked' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  7332. if (isset($packages[$type])) {
  7333. ksort($packages[$type]);
  7334. $nameLength = $versionLength = $latestLength = 0;
  7335. if ($showLatest && $showVersion) {
  7336. foreach ($packages[$type] as $package) {
  7337. if (is_object($package)) {
  7338. $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMinorOnly, $showPatchOnly, $platformReqFilter);
  7339. if ($latestPackage === null) {
  7340. continue;
  7341. }
  7342. $latestPackages[$package->getPrettyName()] = $latestPackage;
  7343. }
  7344. }
  7345. }
  7346. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  7347. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  7348. $writeLatest = $writeVersion && $showLatest;
  7349. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  7350. $hasOutdatedPackages = false;
  7351. $viewData[$type] = array();
  7352. foreach ($packages[$type] as $package) {
  7353. $packageViewData = array();
  7354. if (is_object($package)) {
  7355. $latestPackage = null;
  7356. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  7357. $latestPackage = $latestPackages[$package->getPrettyName()];
  7358. }
  7359. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned());
  7360. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  7361. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  7362. continue;
  7363. }
  7364. if ($input->getOption('outdated') || $input->getOption('strict')) {
  7365. $hasOutdatedPackages = true;
  7366. }
  7367. $packageViewData['name'] = $package->getPrettyName();
  7368. if ($format !== 'json' || true !== $input->getOption('name-only')) {
  7369. $packageViewData['homepage'] = $package instanceof CompletePackageInterface ? $package->getHomepage() : null;
  7370. $packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
  7371. }
  7372. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  7373. if ($writeVersion) {
  7374. $packageViewData['version'] = $package->getFullPrettyVersion();
  7375. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  7376. }
  7377. if ($writeLatest && $latestPackage) {
  7378. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  7379. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  7380. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  7381. }
  7382. if ($writeDescription && $package instanceof CompletePackageInterface) {
  7383. $packageViewData['description'] = $package->getDescription();
  7384. }
  7385. if ($writePath) {
  7386. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  7387. }
  7388. $packageIsAbandoned = false;
  7389. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  7390. $replacementPackageName = $latestPackage->getReplacementPackage();
  7391. $replacement = $replacementPackageName !== null
  7392. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  7393. : 'No replacement was suggested';
  7394. $packageWarning = sprintf(
  7395. 'Package %s is abandoned, you should avoid using it. %s.',
  7396. $package->getPrettyName(),
  7397. $replacement
  7398. );
  7399. $packageViewData['warning'] = $packageWarning;
  7400. $packageIsAbandoned = $replacementPackageName ?? true;
  7401. }
  7402. $packageViewData['abandoned'] = $packageIsAbandoned;
  7403. } else {
  7404. $packageViewData['name'] = $package;
  7405. $nameLength = max($nameLength, strlen($package));
  7406. }
  7407. $viewData[$type][] = $packageViewData;
  7408. }
  7409. $viewMetaData[$type] = array(
  7410. 'nameLength' => $nameLength,
  7411. 'versionLength' => $versionLength,
  7412. 'latestLength' => $latestLength,
  7413. );
  7414. if ($input->getOption('strict') && $hasOutdatedPackages) {
  7415. $exitCode = 1;
  7416. break;
  7417. }
  7418. }
  7419. }
  7420. if ('json' === $format) {
  7421. $io->write(JsonFile::encode($viewData));
  7422. } else {
  7423. if ($input->getOption('latest') && array_filter($viewData)) {
  7424. if (!$io->isDecorated()) {
  7425. $io->writeError('Legend:');
  7426. $io->writeError('! patch or minor release available - update recommended');
  7427. $io->writeError('~ major release available - update possible');
  7428. if (!$input->getOption('outdated')) {
  7429. $io->writeError('= up to date version');
  7430. }
  7431. } else {
  7432. $io->writeError('<info>Color legend:</info>');
  7433. $io->writeError('- <highlight>patch or minor</highlight> release available - update recommended');
  7434. $io->writeError('- <comment>major</comment> release available - update possible');
  7435. if (!$input->getOption('outdated')) {
  7436. $io->writeError('- <info>up to date</info> version');
  7437. }
  7438. }
  7439. }
  7440. $width = $this->getTerminalWidth();
  7441. foreach ($viewData as $type => $packages) {
  7442. $nameLength = $viewMetaData[$type]['nameLength'];
  7443. $versionLength = $viewMetaData[$type]['versionLength'];
  7444. $latestLength = $viewMetaData[$type]['latestLength'];
  7445. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  7446. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  7447. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  7448. if ($writeLatest && !$io->isDecorated()) {
  7449. $latestLength += 2;
  7450. }
  7451. if ($showAllTypes) {
  7452. if ('available' === $type) {
  7453. $io->write('<comment>' . $type . '</comment>:');
  7454. } else {
  7455. $io->write('<info>' . $type . '</info>:');
  7456. }
  7457. }
  7458. foreach ($packages as $package) {
  7459. $link = $package['source'] ?? $package['homepage'] ?? '';
  7460. if ($link !== '') {
  7461. $io->write($indent . '<href='.OutputFormatter::escape($link).'>'.$package['name'].'</>'. str_repeat(' ', $nameLength - strlen($package['name'])), false);
  7462. } else {
  7463. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  7464. }
  7465. if (isset($package['version']) && $writeVersion) {
  7466. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  7467. }
  7468. if (isset($package['latest']) && isset($package['latest-status']) && $writeLatest) {
  7469. $latestVersion = $package['latest'];
  7470. $updateStatus = $package['latest-status'];
  7471. $style = $this->updateStatusToVersionStyle($updateStatus);
  7472. if (!$io->isDecorated()) {
  7473. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  7474. }
  7475. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  7476. }
  7477. if (isset($package['description']) && $writeDescription) {
  7478. $description = strtok($package['description'], "\r\n");
  7479. $remaining = $width - $nameLength - $versionLength - 4;
  7480. if ($writeLatest) {
  7481. $remaining -= $latestLength;
  7482. }
  7483. if (strlen($description) > $remaining) {
  7484. $description = substr($description, 0, $remaining - 3) . '...';
  7485. }
  7486. $io->write(' ' . $description, false);
  7487. }
  7488. if (isset($package['path'])) {
  7489. $io->write(' ' . $package['path'], false);
  7490. }
  7491. $io->write('');
  7492. if (isset($package['warning'])) {
  7493. $io->write('<warning>' . $package['warning'] . '</warning>');
  7494. }
  7495. }
  7496. if ($showAllTypes) {
  7497. $io->write('');
  7498. }
  7499. }
  7500. }
  7501. return $exitCode;
  7502. }
  7503. protected function getRootRequires(): array
  7504. {
  7505. $rootPackage = $this->requireComposer()->getPackage();
  7506. return array_map(
  7507. 'strtolower',
  7508. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  7509. );
  7510. }
  7511. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  7512. {
  7513. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  7514. }
  7515. protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, string $name, $version = null): array
  7516. {
  7517. $name = strtolower($name);
  7518. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  7519. $policy = new DefaultPolicy();
  7520. $repositorySet = new RepositorySet('dev');
  7521. $repositorySet->allowInstalledRepositories();
  7522. $repositorySet->addRepository($repos);
  7523. $matchedPackage = null;
  7524. $versions = array();
  7525. if (PlatformRepository::isPlatformPackage($name)) {
  7526. $pool = $repositorySet->createPoolWithAllPackages();
  7527. } else {
  7528. $pool = $repositorySet->createPoolForPackage($name);
  7529. }
  7530. $matches = $pool->whatProvides($name, $constraint);
  7531. foreach ($matches as $index => $package) {
  7532. if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  7533. $package = $package->getAliasOf();
  7534. }
  7535. if (null === $version && $installedRepo->hasPackage($package)) {
  7536. $matchedPackage = $package;
  7537. }
  7538. $versions[$package->getPrettyVersion()] = $package->getVersion();
  7539. $matches[$index] = $package->getId();
  7540. }
  7541. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, $matches)) {
  7542. $matchedPackage = $pool->literalToPackage($preferred[0]);
  7543. }
  7544. return array($matchedPackage, $versions);
  7545. }
  7546. protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null): void
  7547. {
  7548. $io = $this->getIO();
  7549. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  7550. $this->printLinks($package, Link::TYPE_REQUIRE);
  7551. $this->printLinks($package, Link::TYPE_DEV_REQUIRE, 'requires (dev)');
  7552. if ($package->getSuggests()) {
  7553. $io->write("\n<info>suggests</info>");
  7554. foreach ($package->getSuggests() as $suggested => $reason) {
  7555. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  7556. }
  7557. }
  7558. $this->printLinks($package, Link::TYPE_PROVIDE);
  7559. $this->printLinks($package, Link::TYPE_CONFLICT);
  7560. $this->printLinks($package, Link::TYPE_REPLACE);
  7561. }
  7562. protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null): void
  7563. {
  7564. $io = $this->getIO();
  7565. $io->write('<info>name</info> : ' . $package->getPrettyName());
  7566. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  7567. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  7568. $this->printVersions($package, $versions, $installedRepo);
  7569. if ($latestPackage) {
  7570. $style = $this->getVersionStyle($latestPackage, $package);
  7571. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  7572. } else {
  7573. $latestPackage = $package;
  7574. }
  7575. $io->write('<info>type</info> : ' . $package->getType());
  7576. $this->printLicenses($package);
  7577. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  7578. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  7579. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  7580. if ($installedRepo->hasPackage($package)) {
  7581. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->requireComposer()->getInstallationManager()->getInstallPath($package))));
  7582. }
  7583. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  7584. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  7585. $replacement = ($latestPackage->getReplacementPackage() !== null)
  7586. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  7587. : null;
  7588. $io->writeError(
  7589. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  7590. );
  7591. }
  7592. if ($package->getSupport()) {
  7593. $io->write("\n<info>support</info>");
  7594. foreach ($package->getSupport() as $type => $value) {
  7595. $io->write('<comment>' . $type . '</comment> : '.$value);
  7596. }
  7597. }
  7598. if ($package->getAutoload()) {
  7599. $io->write("\n<info>autoload</info>");
  7600. $autoloadConfig = $package->getAutoload();
  7601. foreach ($autoloadConfig as $type => $autoloads) {
  7602. $io->write('<comment>' . $type . '</comment>');
  7603. if ($type === 'psr-0' || $type === 'psr-4') {
  7604. foreach ($autoloads as $name => $path) {
  7605. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  7606. }
  7607. } elseif ($type === 'classmap') {
  7608. $io->write(implode(', ', $autoloadConfig[$type]));
  7609. }
  7610. }
  7611. if ($package->getIncludePaths()) {
  7612. $io->write('<comment>include-path</comment>');
  7613. $io->write(implode(', ', $package->getIncludePaths()));
  7614. }
  7615. }
  7616. }
  7617. protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo): void
  7618. {
  7619. $versions = array_keys($versions);
  7620. $versions = Semver::rsort($versions);
  7621. if ($installedPackages = $installedRepo->findPackages($package->getName())) {
  7622. foreach ($installedPackages as $installedPackage) {
  7623. $installedVersion = $installedPackage->getPrettyVersion();
  7624. $key = array_search($installedVersion, $versions);
  7625. if (false !== $key) {
  7626. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  7627. }
  7628. }
  7629. }
  7630. $versions = implode(', ', $versions);
  7631. $this->getIO()->write('<info>versions</info> : ' . $versions);
  7632. }
  7633. protected function printLinks(CompletePackageInterface $package, string $linkType, string $title = null): void
  7634. {
  7635. $title = $title ?: $linkType;
  7636. $io = $this->getIO();
  7637. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  7638. $io->write("\n<info>" . $title . "</info>");
  7639. foreach ($links as $link) {
  7640. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  7641. }
  7642. }
  7643. }
  7644. protected function printLicenses(CompletePackageInterface $package): void
  7645. {
  7646. $spdxLicenses = new SpdxLicenses();
  7647. $licenses = $package->getLicense();
  7648. $io = $this->getIO();
  7649. foreach ($licenses as $licenseId) {
  7650. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  7651. if (!$license) {
  7652. $out = $licenseId;
  7653. } else {
  7654. if ($license[1] === true) {
  7655. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  7656. } else {
  7657. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  7658. }
  7659. }
  7660. $io->write('<info>license</info> : ' . $out);
  7661. }
  7662. }
  7663. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null): void
  7664. {
  7665. $json = array(
  7666. 'name' => $package->getPrettyName(),
  7667. 'description' => $package->getDescription(),
  7668. 'keywords' => $package->getKeywords() ?: array(),
  7669. 'type' => $package->getType(),
  7670. 'homepage' => $package->getHomepage(),
  7671. 'names' => $package->getNames(),
  7672. );
  7673. $json = $this->appendVersions($json, $versions);
  7674. $json = $this->appendLicenses($json, $package);
  7675. if ($latestPackage) {
  7676. $json['latest'] = $latestPackage->getPrettyVersion();
  7677. } else {
  7678. $latestPackage = $package;
  7679. }
  7680. if (null !== $package->getSourceType()) {
  7681. $json['source'] = array(
  7682. 'type' => $package->getSourceType(),
  7683. 'url' => $package->getSourceUrl(),
  7684. 'reference' => $package->getSourceReference(),
  7685. );
  7686. }
  7687. if (null !== $package->getDistType()) {
  7688. $json['dist'] = array(
  7689. 'type' => $package->getDistType(),
  7690. 'url' => $package->getDistUrl(),
  7691. 'reference' => $package->getDistReference(),
  7692. );
  7693. }
  7694. if ($installedRepo->hasPackage($package)) {
  7695. $json['path'] = realpath($this->requireComposer()->getInstallationManager()->getInstallPath($package));
  7696. if ($json['path'] === false) {
  7697. unset($json['path']);
  7698. }
  7699. }
  7700. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  7701. $json['replacement'] = $latestPackage->getReplacementPackage();
  7702. }
  7703. if ($package->getSuggests()) {
  7704. $json['suggests'] = $package->getSuggests();
  7705. }
  7706. if ($package->getSupport()) {
  7707. $json['support'] = $package->getSupport();
  7708. }
  7709. $json = $this->appendAutoload($json, $package);
  7710. if ($package->getIncludePaths()) {
  7711. $json['include_path'] = $package->getIncludePaths();
  7712. }
  7713. $json = $this->appendLinks($json, $package);
  7714. $this->getIO()->write(JsonFile::encode($json));
  7715. }
  7716. private function appendVersions(array $json, array $versions): array
  7717. {
  7718. uasort($versions, 'version_compare');
  7719. $versions = array_keys(array_reverse($versions));
  7720. $json['versions'] = $versions;
  7721. return $json;
  7722. }
  7723. private function appendLicenses(array $json, CompletePackageInterface $package): array
  7724. {
  7725. if ($licenses = $package->getLicense()) {
  7726. $spdxLicenses = new SpdxLicenses();
  7727. $json['licenses'] = array_map(function ($licenseId) use ($spdxLicenses) {
  7728. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  7729. if (!$license) {
  7730. return $licenseId;
  7731. }
  7732. return array(
  7733. 'name' => $license[0],
  7734. 'osi' => $licenseId,
  7735. 'url' => $license[2],
  7736. );
  7737. }, $licenses);
  7738. }
  7739. return $json;
  7740. }
  7741. private function appendAutoload(array $json, CompletePackageInterface $package): array
  7742. {
  7743. if ($package->getAutoload()) {
  7744. $autoload = array();
  7745. foreach ($package->getAutoload() as $type => $autoloads) {
  7746. if ($type === 'psr-0' || $type === 'psr-4') {
  7747. $psr = array();
  7748. foreach ($autoloads as $name => $path) {
  7749. if (!$path) {
  7750. $path = '.';
  7751. }
  7752. $psr[$name ?: '*'] = $path;
  7753. }
  7754. $autoload[$type] = $psr;
  7755. } elseif ($type === 'classmap') {
  7756. $autoload['classmap'] = $autoloads;
  7757. }
  7758. }
  7759. $json['autoload'] = $autoload;
  7760. }
  7761. return $json;
  7762. }
  7763. private function appendLinks(array $json, CompletePackageInterface $package): array
  7764. {
  7765. foreach (Link::$TYPES as $linkType) {
  7766. $json = $this->appendLink($json, $package, $linkType);
  7767. }
  7768. return $json;
  7769. }
  7770. private function appendLink(array $json, CompletePackageInterface $package, string $linkType): array
  7771. {
  7772. $links = $package->{'get' . ucfirst($linkType)}();
  7773. if ($links) {
  7774. $json[$linkType] = array();
  7775. foreach ($links as $link) {
  7776. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  7777. }
  7778. }
  7779. return $json;
  7780. }
  7781. protected function initStyles(OutputInterface $output): void
  7782. {
  7783. $this->colors = array(
  7784. 'green',
  7785. 'yellow',
  7786. 'cyan',
  7787. 'magenta',
  7788. 'blue',
  7789. );
  7790. foreach ($this->colors as $color) {
  7791. $style = new OutputFormatterStyle($color);
  7792. $output->getFormatter()->setStyle($color, $style);
  7793. }
  7794. }
  7795. protected function displayPackageTree(array $arrayTree): void
  7796. {
  7797. $io = $this->getIO();
  7798. foreach ($arrayTree as $package) {
  7799. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  7800. $io->write(' ' . $package['version'], false);
  7801. $io->write(' ' . strtok($package['description'], "\r\n"));
  7802. if (isset($package['requires'])) {
  7803. $requires = $package['requires'];
  7804. $treeBar = '├';
  7805. $j = 0;
  7806. $total = count($requires);
  7807. foreach ($requires as $require) {
  7808. $requireName = $require['name'];
  7809. $j++;
  7810. if ($j === $total) {
  7811. $treeBar = 'â””';
  7812. }
  7813. $level = 1;
  7814. $color = $this->colors[$level];
  7815. $info = sprintf(
  7816. '%s──<%s>%s</%s> %s',
  7817. $treeBar,
  7818. $color,
  7819. $requireName,
  7820. $color,
  7821. $require['version']
  7822. );
  7823. $this->writeTreeLine($info);
  7824. $treeBar = str_replace('â””', ' ', $treeBar);
  7825. $packagesInTree = array($package['name'], $requireName);
  7826. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  7827. }
  7828. }
  7829. }
  7830. }
  7831. protected function generatePackageTree(
  7832. PackageInterface $package,
  7833. InstalledRepository $installedRepo,
  7834. RepositoryInterface $remoteRepos
  7835. ): array {
  7836. $requires = $package->getRequires();
  7837. ksort($requires);
  7838. $children = array();
  7839. foreach ($requires as $requireName => $require) {
  7840. $packagesInTree = array($package->getName(), $requireName);
  7841. $treeChildDesc = array(
  7842. 'name' => $requireName,
  7843. 'version' => $require->getPrettyConstraint(),
  7844. );
  7845. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $packagesInTree);
  7846. if ($deepChildren) {
  7847. $treeChildDesc['requires'] = $deepChildren;
  7848. }
  7849. $children[] = $treeChildDesc;
  7850. }
  7851. $tree = array(
  7852. 'name' => $package->getPrettyName(),
  7853. 'version' => $package->getPrettyVersion(),
  7854. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : '',
  7855. );
  7856. if ($children) {
  7857. $tree['requires'] = $children;
  7858. }
  7859. return $tree;
  7860. }
  7861. protected function displayTree(
  7862. $package,
  7863. array $packagesInTree,
  7864. string $previousTreeBar = '├',
  7865. int $level = 1
  7866. ): void {
  7867. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  7868. if (is_array($package) && isset($package['requires'])) {
  7869. $requires = $package['requires'];
  7870. $treeBar = $previousTreeBar . ' ├';
  7871. $i = 0;
  7872. $total = count($requires);
  7873. foreach ($requires as $require) {
  7874. $currentTree = $packagesInTree;
  7875. $i++;
  7876. if ($i === $total) {
  7877. $treeBar = $previousTreeBar . ' â””';
  7878. }
  7879. $colorIdent = $level % count($this->colors);
  7880. $color = $this->colors[$colorIdent];
  7881. $circularWarn = in_array(
  7882. $require['name'],
  7883. $currentTree,
  7884. true
  7885. ) ? '(circular dependency aborted here)' : '';
  7886. $info = rtrim(sprintf(
  7887. '%s──<%s>%s</%s> %s %s',
  7888. $treeBar,
  7889. $color,
  7890. $require['name'],
  7891. $color,
  7892. $require['version'],
  7893. $circularWarn
  7894. ));
  7895. $this->writeTreeLine($info);
  7896. $treeBar = str_replace('â””', ' ', $treeBar);
  7897. $currentTree[] = $require['name'];
  7898. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  7899. }
  7900. }
  7901. }
  7902. protected function addTree(
  7903. string $name,
  7904. Link $link,
  7905. InstalledRepository $installedRepo,
  7906. RepositoryInterface $remoteRepos,
  7907. array $packagesInTree
  7908. ): array {
  7909. $children = array();
  7910. list($package) = $this->getPackage(
  7911. $installedRepo,
  7912. $remoteRepos,
  7913. $name,
  7914. $link->getPrettyConstraint() === 'self.version' ? $link->getConstraint() : $link->getPrettyConstraint()
  7915. );
  7916. if (is_object($package)) {
  7917. $requires = $package->getRequires();
  7918. ksort($requires);
  7919. foreach ($requires as $requireName => $require) {
  7920. $currentTree = $packagesInTree;
  7921. $treeChildDesc = array(
  7922. 'name' => $requireName,
  7923. 'version' => $require->getPrettyConstraint(),
  7924. );
  7925. if (!in_array($requireName, $currentTree, true)) {
  7926. $currentTree[] = $requireName;
  7927. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $currentTree);
  7928. if ($deepChildren) {
  7929. $treeChildDesc['requires'] = $deepChildren;
  7930. }
  7931. }
  7932. $children[] = $treeChildDesc;
  7933. }
  7934. }
  7935. return $children;
  7936. }
  7937. private function updateStatusToVersionStyle(string $updateStatus): string
  7938. {
  7939. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  7940. }
  7941. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package): string
  7942. {
  7943. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  7944. return 'up-to-date';
  7945. }
  7946. $constraint = $package->getVersion();
  7947. if (0 !== strpos($constraint, 'dev-')) {
  7948. $constraint = '^'.$constraint;
  7949. }
  7950. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  7951. return 'semver-safe-update';
  7952. }
  7953. return 'update-possible';
  7954. }
  7955. private function writeTreeLine(string $line): void
  7956. {
  7957. $io = $this->getIO();
  7958. if (!$io->isDecorated()) {
  7959. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  7960. }
  7961. $io->write($line);
  7962. }
  7963. private function findLatestPackage(PackageInterface $package, Composer $composer, PlatformRepository $platformRepo, bool $minorOnly, bool $patchOnly, PlatformRequirementFilterInterface $platformReqFilter): ?PackageInterface
  7964. {
  7965. $name = $package->getName();
  7966. $versionSelector = new VersionSelector($this->getRepositorySet($composer), $platformRepo);
  7967. $stability = $composer->getPackage()->getMinimumStability();
  7968. $flags = $composer->getPackage()->getStabilityFlags();
  7969. if (isset($flags[$name])) {
  7970. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  7971. }
  7972. $bestStability = $stability;
  7973. if ($composer->getPackage()->getPreferStable()) {
  7974. $bestStability = $package->getStability();
  7975. }
  7976. $targetVersion = null;
  7977. if (0 === strpos($package->getVersion(), 'dev-')) {
  7978. $targetVersion = $package->getVersion();
  7979. }
  7980. if ($targetVersion === null && $minorOnly) {
  7981. $targetVersion = '^' . $package->getVersion();
  7982. }
  7983. if ($targetVersion === null && $patchOnly) {
  7984. $trimmedVersion = Preg::replace('{(\.0)+$}D', '', $package->getVersion());
  7985. $partsNeeded = substr($trimmedVersion, 0, 1) === '0' ? 4 : 3;
  7986. while (substr_count($trimmedVersion, '.') + 1 < $partsNeeded) {
  7987. $trimmedVersion .= '.0';
  7988. }
  7989. $targetVersion = '~' . $trimmedVersion;
  7990. }
  7991. $candidate = $versionSelector->findBestCandidate($name, $targetVersion, $bestStability, $platformReqFilter);
  7992. while ($candidate instanceof AliasPackage) {
  7993. $candidate = $candidate->getAliasOf();
  7994. }
  7995. return $candidate !== false ? $candidate : null;
  7996. }
  7997. private function getRepositorySet(Composer $composer): RepositorySet
  7998. {
  7999. if (!$this->repositorySet) {
  8000. $this->repositorySet = new RepositorySet($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  8001. $this->repositorySet->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  8002. }
  8003. return $this->repositorySet;
  8004. }
  8005. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, array $bucket = array()): array
  8006. {
  8007. $requires = $package->getRequires();
  8008. foreach ($repo->getPackages() as $candidate) {
  8009. foreach ($candidate->getNames() as $name) {
  8010. if (isset($requires[$name])) {
  8011. if (!in_array($candidate, $bucket, true)) {
  8012. $bucket[] = $candidate;
  8013. $bucket = $this->filterRequiredPackages($repo, $candidate, $bucket);
  8014. }
  8015. break;
  8016. }
  8017. }
  8018. }
  8019. return $bucket;
  8020. }
  8021. }
  8022. <?php declare(strict_types=1);
  8023. namespace Composer\Command;
  8024. use Symfony\Component\Console\Input\InputInterface;
  8025. use Symfony\Component\Console\Input\InputOption;
  8026. use Symfony\Component\Console\Output\OutputInterface;
  8027. use Composer\Downloader\ChangeReportInterface;
  8028. use Composer\Downloader\DvcsDownloaderInterface;
  8029. use Composer\Downloader\VcsCapableDownloaderInterface;
  8030. use Composer\Package\Dumper\ArrayDumper;
  8031. use Composer\Package\Version\VersionGuesser;
  8032. use Composer\Package\Version\VersionParser;
  8033. use Composer\Plugin\CommandEvent;
  8034. use Composer\Plugin\PluginEvents;
  8035. use Composer\Script\ScriptEvents;
  8036. use Composer\Util\ProcessExecutor;
  8037. class StatusCommand extends BaseCommand
  8038. {
  8039. private const EXIT_CODE_ERRORS = 1;
  8040. private const EXIT_CODE_UNPUSHED_CHANGES = 2;
  8041. private const EXIT_CODE_VERSION_CHANGES = 4;
  8042. protected function configure(): void
  8043. {
  8044. $this
  8045. ->setName('status')
  8046. ->setDescription('Shows a list of locally modified packages.')
  8047. ->setDefinition(array(
  8048. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  8049. ))
  8050. ->setHelp(
  8051. <<<EOT
  8052. The status command displays a list of dependencies that have
  8053. been modified locally.
  8054. Read more at https://getcomposer.org/doc/03-cli.md#status
  8055. EOT
  8056. )
  8057. ;
  8058. }
  8059. protected function execute(InputInterface $input, OutputInterface $output): int
  8060. {
  8061. $composer = $this->requireComposer();
  8062. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  8063. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  8064. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  8065. $exitCode = $this->doExecute($input);
  8066. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  8067. return $exitCode;
  8068. }
  8069. private function doExecute(InputInterface $input): int
  8070. {
  8071. $composer = $this->requireComposer();
  8072. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  8073. $dm = $composer->getDownloadManager();
  8074. $im = $composer->getInstallationManager();
  8075. $errors = array();
  8076. $io = $this->getIO();
  8077. $unpushedChanges = array();
  8078. $vcsVersionChanges = array();
  8079. $parser = new VersionParser;
  8080. $guesser = new VersionGuesser($composer->getConfig(), $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io), $parser);
  8081. $dumper = new ArrayDumper;
  8082. foreach ($installedRepo->getCanonicalPackages() as $package) {
  8083. $downloader = $dm->getDownloaderForPackage($package);
  8084. $targetDir = $im->getInstallPath($package);
  8085. if ($downloader instanceof ChangeReportInterface) {
  8086. if (is_link($targetDir)) {
  8087. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  8088. }
  8089. if (null !== ($changes = $downloader->getLocalChanges($package, $targetDir))) {
  8090. $errors[$targetDir] = $changes;
  8091. }
  8092. }
  8093. if ($downloader instanceof VcsCapableDownloaderInterface) {
  8094. if ($downloader->getVcsReference($package, $targetDir)) {
  8095. switch ($package->getInstallationSource()) {
  8096. case 'source':
  8097. $previousRef = $package->getSourceReference();
  8098. break;
  8099. case 'dist':
  8100. $previousRef = $package->getDistReference();
  8101. break;
  8102. default:
  8103. $previousRef = null;
  8104. }
  8105. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  8106. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  8107. $vcsVersionChanges[$targetDir] = array(
  8108. 'previous' => array(
  8109. 'version' => $package->getPrettyVersion(),
  8110. 'ref' => $previousRef,
  8111. ),
  8112. 'current' => array(
  8113. 'version' => $currentVersion['pretty_version'],
  8114. 'ref' => $currentVersion['commit'],
  8115. ),
  8116. );
  8117. }
  8118. }
  8119. }
  8120. if ($downloader instanceof DvcsDownloaderInterface) {
  8121. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  8122. $unpushedChanges[$targetDir] = $unpushed;
  8123. }
  8124. }
  8125. }
  8126. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  8127. $io->writeError('<info>No local changes</info>');
  8128. return 0;
  8129. }
  8130. if ($errors) {
  8131. $io->writeError('<error>You have changes in the following dependencies:</error>');
  8132. foreach ($errors as $path => $changes) {
  8133. if ($input->getOption('verbose')) {
  8134. $indentedChanges = implode("\n", array_map(function ($line): string {
  8135. return ' ' . ltrim($line);
  8136. }, explode("\n", $changes)));
  8137. $io->write('<info>'.$path.'</info>:');
  8138. $io->write($indentedChanges);
  8139. } else {
  8140. $io->write($path);
  8141. }
  8142. }
  8143. }
  8144. if ($unpushedChanges) {
  8145. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  8146. foreach ($unpushedChanges as $path => $changes) {
  8147. if ($input->getOption('verbose')) {
  8148. $indentedChanges = implode("\n", array_map(function ($line): string {
  8149. return ' ' . ltrim($line);
  8150. }, explode("\n", $changes)));
  8151. $io->write('<info>'.$path.'</info>:');
  8152. $io->write($indentedChanges);
  8153. } else {
  8154. $io->write($path);
  8155. }
  8156. }
  8157. }
  8158. if ($vcsVersionChanges) {
  8159. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  8160. foreach ($vcsVersionChanges as $path => $changes) {
  8161. if ($input->getOption('verbose')) {
  8162. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  8163. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  8164. if ($io->isVeryVerbose()) {
  8165. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  8166. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  8167. }
  8168. $io->write('<info>'.$path.'</info>:');
  8169. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  8170. } else {
  8171. $io->write($path);
  8172. }
  8173. }
  8174. }
  8175. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  8176. $io->writeError('Use --verbose (-v) to see a list of files');
  8177. }
  8178. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  8179. }
  8180. }
  8181. <?php declare(strict_types=1);
  8182. namespace Composer\Command;
  8183. use Composer\Repository\PlatformRepository;
  8184. use Composer\Repository\RootPackageRepository;
  8185. use Composer\Repository\InstalledRepository;
  8186. use Composer\Installer\SuggestedPackagesReporter;
  8187. use Symfony\Component\Console\Input\InputArgument;
  8188. use Symfony\Component\Console\Input\InputInterface;
  8189. use Symfony\Component\Console\Input\InputOption;
  8190. use Symfony\Component\Console\Output\OutputInterface;
  8191. class SuggestsCommand extends BaseCommand
  8192. {
  8193. protected function configure(): void
  8194. {
  8195. $this
  8196. ->setName('suggests')
  8197. ->setDescription('Shows package suggestions.')
  8198. ->setDefinition(array(
  8199. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package (default)'),
  8200. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  8201. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show suggestions from all dependencies, including transitive ones'),
  8202. new InputOption('list', null, InputOption::VALUE_NONE, 'Show only list of suggested package names'),
  8203. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  8204. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  8205. ))
  8206. ->setHelp(
  8207. <<<EOT
  8208. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  8209. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  8210. EOT
  8211. )
  8212. ;
  8213. }
  8214. protected function execute(InputInterface $input, OutputInterface $output): int
  8215. {
  8216. $composer = $this->requireComposer();
  8217. $installedRepos = array(
  8218. new RootPackageRepository(clone $composer->getPackage()),
  8219. );
  8220. $locker = $composer->getLocker();
  8221. if ($locker->isLocked()) {
  8222. $installedRepos[] = new PlatformRepository(array(), $locker->getPlatformOverrides());
  8223. $installedRepos[] = $locker->getLockedRepository(!$input->getOption('no-dev'));
  8224. } else {
  8225. $installedRepos[] = new PlatformRepository(array(), $composer->getConfig()->get('platform') ?: array());
  8226. $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
  8227. }
  8228. $installedRepo = new InstalledRepository($installedRepos);
  8229. $reporter = new SuggestedPackagesReporter($this->getIO());
  8230. $filter = $input->getArgument('packages');
  8231. $packages = $installedRepo->getPackages();
  8232. $packages[] = $composer->getPackage();
  8233. foreach ($packages as $package) {
  8234. if (!empty($filter) && !in_array($package->getName(), $filter)) {
  8235. continue;
  8236. }
  8237. $reporter->addSuggestionsFromPackage($package);
  8238. }
  8239. $mode = SuggestedPackagesReporter::MODE_BY_PACKAGE;
  8240. if ($input->getOption('by-suggestion')) {
  8241. $mode = SuggestedPackagesReporter::MODE_BY_SUGGESTION;
  8242. }
  8243. if ($input->getOption('by-package')) {
  8244. $mode |= SuggestedPackagesReporter::MODE_BY_PACKAGE;
  8245. }
  8246. if ($input->getOption('list')) {
  8247. $mode = SuggestedPackagesReporter::MODE_LIST;
  8248. }
  8249. $reporter->output($mode, $installedRepo, empty($filter) && !$input->getOption('all') ? $composer->getPackage() : null);
  8250. return 0;
  8251. }
  8252. }
  8253. <?php declare(strict_types=1);
  8254. namespace Composer\Command;
  8255. use Composer\Composer;
  8256. use Composer\DependencyResolver\Request;
  8257. use Composer\Installer;
  8258. use Composer\IO\IOInterface;
  8259. use Composer\Package\Loader\RootPackageLoader;
  8260. use Composer\Pcre\Preg;
  8261. use Composer\Plugin\CommandEvent;
  8262. use Composer\Plugin\PluginEvents;
  8263. use Composer\Package\Version\VersionParser;
  8264. use Composer\Util\HttpDownloader;
  8265. use Composer\Semver\Constraint\MultiConstraint;
  8266. use Composer\Package\Link;
  8267. use Symfony\Component\Console\Helper\Table;
  8268. use Symfony\Component\Console\Input\InputInterface;
  8269. use Symfony\Component\Console\Input\InputOption;
  8270. use Symfony\Component\Console\Input\InputArgument;
  8271. use Symfony\Component\Console\Output\OutputInterface;
  8272. use Symfony\Component\Console\Question\Question;
  8273. class UpdateCommand extends BaseCommand
  8274. {
  8275. protected function configure()
  8276. {
  8277. $this
  8278. ->setName('update')
  8279. ->setAliases(array('u', 'upgrade'))
  8280. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  8281. ->setDefinition(array(
  8282. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  8283. new InputOption('with', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Temporary version constraint to add, e.g. foo/bar:1.0.0 or foo/bar=1.0.0'),
  8284. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  8285. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  8286. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).'),
  8287. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  8288. new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
  8289. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  8290. new InputOption('lock', null, InputOption::VALUE_NONE, 'Overwrites the lock file hash to suppress warning about the lock file being out of date without updating package versions. Package metadata like mirrors and URLs are updated if they changed.'),
  8291. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  8292. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  8293. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  8294. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  8295. new InputOption('with-dependencies', 'w', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, except those which are root requirements.'),
  8296. new InputOption('with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, including those which are root requirements.'),
  8297. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  8298. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  8299. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  8300. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  8301. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  8302. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  8303. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  8304. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  8305. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  8306. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  8307. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  8308. ))
  8309. ->setHelp(
  8310. <<<EOT
  8311. The <info>update</info> command reads the composer.json file from the
  8312. current directory, processes it, and updates, removes or installs all the
  8313. dependencies.
  8314. <info>php composer.phar update</info>
  8315. To limit the update operation to a few packages, you can list the package(s)
  8316. you want to update as such:
  8317. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  8318. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  8319. from a specific vendor:
  8320. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  8321. To run an update with more restrictive constraints you can use:
  8322. <info>php composer.phar update --with vendor/package:1.0.*</info>
  8323. To run a partial update with more restrictive constraints you can use the shorthand:
  8324. <info>php composer.phar update vendor/package:1.0.*</info>
  8325. To select packages names interactively with auto-completion use <info>-i</info>.
  8326. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  8327. EOT
  8328. )
  8329. ;
  8330. }
  8331. protected function execute(InputInterface $input, OutputInterface $output)
  8332. {
  8333. $io = $this->getIO();
  8334. if ($input->getOption('dev')) {
  8335. $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
  8336. }
  8337. if ($input->getOption('no-suggest')) {
  8338. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  8339. }
  8340. $composer = $this->requireComposer();
  8341. if (!HttpDownloader::isCurlEnabled()) {
  8342. $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
  8343. }
  8344. $packages = $input->getArgument('packages');
  8345. $reqs = $this->formatRequirements($input->getOption('with'));
  8346. if (count($packages) > 0) {
  8347. $allowlistPackagesWithRequirements = array_filter($packages, function ($pkg): bool {
  8348. return Preg::isMatch('{\S+[ =:]\S+}', $pkg);
  8349. });
  8350. foreach ($this->formatRequirements($allowlistPackagesWithRequirements) as $package => $constraint) {
  8351. $reqs[$package] = $constraint;
  8352. }
  8353. foreach ($allowlistPackagesWithRequirements as $package) {
  8354. $packageName = Preg::replace('{^([^ =:]+)[ =:].*$}', '$1', $package);
  8355. $index = array_search($package, $packages);
  8356. $packages[$index] = $packageName;
  8357. }
  8358. }
  8359. $rootPackage = $composer->getPackage();
  8360. $rootRequires = $rootPackage->getRequires();
  8361. $rootDevRequires = $rootPackage->getDevRequires();
  8362. foreach ($reqs as $package => $constraint) {
  8363. if (isset($rootRequires[$package])) {
  8364. $rootRequires[$package] = $this->appendConstraintToLink($rootRequires[$package], $constraint);
  8365. } elseif (isset($rootDevRequires[$package])) {
  8366. $rootDevRequires[$package] = $this->appendConstraintToLink($rootDevRequires[$package], $constraint);
  8367. } else {
  8368. throw new \UnexpectedValueException('Only root package requirements can receive temporary constraints and '.$package.' is not one');
  8369. }
  8370. }
  8371. $rootPackage->setRequires($rootRequires);
  8372. $rootPackage->setDevRequires($rootDevRequires);
  8373. $rootPackage->setReferences(RootPackageLoader::extractReferences($reqs, $rootPackage->getReferences()));
  8374. $rootPackage->setStabilityFlags(RootPackageLoader::extractStabilityFlags($reqs, $rootPackage->getMinimumStability(), $rootPackage->getStabilityFlags()));
  8375. if ($input->getOption('interactive')) {
  8376. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  8377. }
  8378. if ($input->getOption('root-reqs')) {
  8379. $requires = array_keys($rootRequires);
  8380. if (!$input->getOption('no-dev')) {
  8381. $requires = array_merge($requires, array_keys($rootDevRequires));
  8382. }
  8383. if (!empty($packages)) {
  8384. $packages = array_intersect($packages, $requires);
  8385. } else {
  8386. $packages = $requires;
  8387. }
  8388. }
  8389. $filteredPackages = array_filter($packages, function ($package): bool {
  8390. return !in_array($package, array('lock', 'nothing', 'mirrors'), true);
  8391. });
  8392. $updateMirrors = $input->getOption('lock') || count($filteredPackages) != count($packages);
  8393. $packages = $filteredPackages;
  8394. if ($updateMirrors && !empty($packages)) {
  8395. $io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>');
  8396. return -1;
  8397. }
  8398. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  8399. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  8400. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  8401. $install = Installer::create($io, $composer);
  8402. $config = $composer->getConfig();
  8403. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  8404. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  8405. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  8406. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  8407. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  8408. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  8409. if ($input->getOption('with-all-dependencies')) {
  8410. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  8411. } elseif ($input->getOption('with-dependencies')) {
  8412. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  8413. }
  8414. $install
  8415. ->setDryRun($input->getOption('dry-run'))
  8416. ->setVerbose($input->getOption('verbose'))
  8417. ->setPreferSource($preferSource)
  8418. ->setPreferDist($preferDist)
  8419. ->setDevMode(!$input->getOption('no-dev'))
  8420. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  8421. ->setOptimizeAutoloader($optimize)
  8422. ->setClassMapAuthoritative($authoritative)
  8423. ->setApcuAutoloader($apcu, $apcuPrefix)
  8424. ->setUpdate(true)
  8425. ->setInstall(!$input->getOption('no-install'))
  8426. ->setUpdateMirrors($updateMirrors)
  8427. ->setUpdateAllowList($packages)
  8428. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  8429. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  8430. ->setPreferStable($input->getOption('prefer-stable'))
  8431. ->setPreferLowest($input->getOption('prefer-lowest'))
  8432. ;
  8433. if ($input->getOption('no-plugins')) {
  8434. $install->disablePlugins();
  8435. }
  8436. return $install->run();
  8437. }
  8438. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages): array
  8439. {
  8440. if (!$input->isInteractive()) {
  8441. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  8442. }
  8443. $requires = array_merge(
  8444. $composer->getPackage()->getRequires(),
  8445. $composer->getPackage()->getDevRequires()
  8446. );
  8447. $autocompleterValues = array();
  8448. foreach ($requires as $require) {
  8449. $target = $require->getTarget();
  8450. $autocompleterValues[strtolower($target)] = $target;
  8451. }
  8452. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  8453. foreach ($installedPackages as $package) {
  8454. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  8455. }
  8456. $helper = $this->getHelper('question');
  8457. $question = new Question('<comment>Enter package name: </comment>', null);
  8458. $io->writeError('<info>Press enter without value to end submission</info>');
  8459. do {
  8460. $autocompleterValues = array_diff($autocompleterValues, $packages);
  8461. $question->setAutocompleterValues($autocompleterValues);
  8462. $addedPackage = $helper->ask($input, $output, $question);
  8463. if (!is_string($addedPackage) || empty($addedPackage)) {
  8464. break;
  8465. }
  8466. $addedPackage = strtolower($addedPackage);
  8467. if (!in_array($addedPackage, $packages)) {
  8468. $packages[] = $addedPackage;
  8469. }
  8470. } while (true);
  8471. $packages = array_filter($packages);
  8472. if (!$packages) {
  8473. throw new \InvalidArgumentException('You must enter minimum one package.');
  8474. }
  8475. $table = new Table($output);
  8476. $table->setHeaders(array('Selected packages'));
  8477. foreach ($packages as $package) {
  8478. $table->addRow(array($package));
  8479. }
  8480. $table->render();
  8481. if ($io->askConfirmation(sprintf(
  8482. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  8483. 1 === count($packages) ? '' : 's'
  8484. ))) {
  8485. return $packages;
  8486. }
  8487. throw new \RuntimeException('Installation aborted.');
  8488. }
  8489. private function appendConstraintToLink(Link $link, string $constraint): Link
  8490. {
  8491. $parser = new VersionParser;
  8492. $oldPrettyString = $link->getConstraint()->getPrettyString();
  8493. $newConstraint = MultiConstraint::create(array($link->getConstraint(), $parser->parseConstraints($constraint)));
  8494. $newConstraint->setPrettyString($oldPrettyString.', '.$constraint);
  8495. return new Link(
  8496. $link->getSource(),
  8497. $link->getTarget(),
  8498. $newConstraint,
  8499. $link->getDescription(),
  8500. $link->getPrettyConstraint() . ', ' . $constraint
  8501. );
  8502. }
  8503. }
  8504. <?php declare(strict_types=1);
  8505. namespace Composer\Command;
  8506. use Composer\Factory;
  8507. use Composer\IO\IOInterface;
  8508. use Composer\Package\Loader\ValidatingArrayLoader;
  8509. use Composer\Plugin\CommandEvent;
  8510. use Composer\Plugin\PluginEvents;
  8511. use Composer\Repository\InstalledRepository;
  8512. use Composer\Repository\PlatformRepository;
  8513. use Composer\Util\ConfigValidator;
  8514. use Composer\Util\Filesystem;
  8515. use Symfony\Component\Console\Input\InputArgument;
  8516. use Symfony\Component\Console\Input\InputInterface;
  8517. use Symfony\Component\Console\Input\InputOption;
  8518. use Symfony\Component\Console\Output\OutputInterface;
  8519. class ValidateCommand extends BaseCommand
  8520. {
  8521. protected function configure(): void
  8522. {
  8523. $this
  8524. ->setName('validate')
  8525. ->setDescription('Validates a composer.json and composer.lock.')
  8526. ->setDefinition(array(
  8527. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  8528. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  8529. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  8530. new InputOption('no-check-version', null, InputOption::VALUE_NONE, 'Do not report a warning if the version field is present'),
  8531. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  8532. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  8533. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  8534. ))
  8535. ->setHelp(
  8536. <<<EOT
  8537. The validate command validates a given composer.json and composer.lock
  8538. Exit codes in case of errors are:
  8539. 1 validation warning(s), only when --strict is given
  8540. 2 validation error(s)
  8541. 3 file unreadable or missing
  8542. Read more at https://getcomposer.org/doc/03-cli.md#validate
  8543. EOT
  8544. );
  8545. }
  8546. protected function execute(InputInterface $input, OutputInterface $output): int
  8547. {
  8548. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  8549. $io = $this->getIO();
  8550. if (!file_exists($file)) {
  8551. $io->writeError('<error>' . $file . ' not found.</error>');
  8552. return 3;
  8553. }
  8554. if (!Filesystem::isReadable($file)) {
  8555. $io->writeError('<error>' . $file . ' is not readable.</error>');
  8556. return 3;
  8557. }
  8558. $validator = new ConfigValidator($io);
  8559. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  8560. $checkPublish = !$input->getOption('no-check-publish');
  8561. $checkLock = !$input->getOption('no-check-lock');
  8562. $checkVersion = $input->getOption('no-check-version') ? 0 : ConfigValidator::CHECK_VERSION;
  8563. $isStrict = $input->getOption('strict');
  8564. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll, $checkVersion);
  8565. $lockErrors = array();
  8566. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  8567. $locker = $composer->getLocker();
  8568. if ($locker->isLocked() && !$locker->isFresh()) {
  8569. $lockErrors[] = '- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.';
  8570. }
  8571. if ($locker->isLocked()) {
  8572. $missingRequirements = false;
  8573. $sets = array(
  8574. array('repo' => $locker->getLockedRepository(false), 'method' => 'getRequires', 'description' => 'Required'),
  8575. array('repo' => $locker->getLockedRepository(true), 'method' => 'getDevRequires', 'description' => 'Required (in require-dev)'),
  8576. );
  8577. foreach ($sets as $set) {
  8578. $installedRepo = new InstalledRepository(array($set['repo']));
  8579. foreach (call_user_func(array($composer->getPackage(), $set['method'])) as $link) {
  8580. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  8581. continue;
  8582. }
  8583. if (!$installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint())) {
  8584. if ($results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget())) {
  8585. $provider = reset($results);
  8586. $lockErrors[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is in the lock file as "'.$provider->getPrettyVersion().'" but that does not satisfy your constraint "'.$link->getPrettyConstraint().'".';
  8587. } else {
  8588. $lockErrors[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is not present in the lock file.';
  8589. }
  8590. $missingRequirements = true;
  8591. }
  8592. }
  8593. }
  8594. if ($missingRequirements) {
  8595. $lockErrors[] = 'This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.';
  8596. $lockErrors[] = 'Read more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md';
  8597. $lockErrors[] = 'and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require';
  8598. }
  8599. }
  8600. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  8601. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  8602. if ($input->getOption('with-dependencies')) {
  8603. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  8604. foreach ($localRepo->getPackages() as $package) {
  8605. $path = $composer->getInstallationManager()->getInstallPath($package);
  8606. $file = $path . '/composer.json';
  8607. if (is_dir($path) && file_exists($file)) {
  8608. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll, $checkVersion);
  8609. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  8610. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  8611. $exitCode = max($depCode, $exitCode);
  8612. }
  8613. }
  8614. }
  8615. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  8616. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  8617. return max($eventCode, $exitCode);
  8618. }
  8619. private function outputResult(IOInterface $io, string $name, array &$errors, array &$warnings, bool $checkPublish = false, array $publishErrors = array(), bool $checkLock = false, array $lockErrors = array(), bool $printSchemaUrl = false): void
  8620. {
  8621. $doPrintSchemaUrl = false;
  8622. if ($errors) {
  8623. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  8624. } elseif ($publishErrors) {
  8625. $io->writeError('<info>' . $name . ' is valid for simple usage with Composer but has</info>');
  8626. $io->writeError('<info>strict errors that make it unable to be published as a package</info>');
  8627. $doPrintSchemaUrl = $printSchemaUrl;
  8628. } elseif ($warnings) {
  8629. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  8630. $doPrintSchemaUrl = $printSchemaUrl;
  8631. } elseif ($lockErrors) {
  8632. $io->write('<info>' . $name . ' is valid but your composer.lock has some '.($checkLock ? 'errors' : 'warnings').'</info>');
  8633. } else {
  8634. $io->write('<info>' . $name . ' is valid</info>');
  8635. }
  8636. if ($doPrintSchemaUrl) {
  8637. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  8638. }
  8639. if ($errors) {
  8640. $errors = array_map(function ($err): string {
  8641. return '- ' . $err;
  8642. }, $errors);
  8643. array_unshift($errors, '# General errors');
  8644. }
  8645. if ($warnings) {
  8646. $warnings = array_map(function ($err): string {
  8647. return '- ' . $err;
  8648. }, $warnings);
  8649. array_unshift($warnings, '# General warnings');
  8650. }
  8651. $extraWarnings = array();
  8652. if ($publishErrors) {
  8653. $publishErrors = array_map(function ($err): string {
  8654. return '- ' . $err;
  8655. }, $publishErrors);
  8656. if ($checkPublish) {
  8657. array_unshift($publishErrors, '# Publish errors');
  8658. $errors = array_merge($errors, $publishErrors);
  8659. } else {
  8660. array_unshift($publishErrors, '# Publish warnings');
  8661. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  8662. }
  8663. }
  8664. if ($lockErrors) {
  8665. if ($checkLock) {
  8666. array_unshift($lockErrors, '# Lock file errors');
  8667. $errors = array_merge($errors, $lockErrors);
  8668. } else {
  8669. array_unshift($lockErrors, '# Lock file warnings');
  8670. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  8671. }
  8672. }
  8673. $messages = array(
  8674. 'error' => $errors,
  8675. 'warning' => array_merge($warnings, $extraWarnings),
  8676. );
  8677. foreach ($messages as $style => $msgs) {
  8678. foreach ($msgs as $msg) {
  8679. if (strpos($msg, '#') === 0) {
  8680. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  8681. } else {
  8682. $io->writeError($msg);
  8683. }
  8684. }
  8685. }
  8686. }
  8687. }
  8688. <?php declare(strict_types=1);
  8689. namespace Composer;
  8690. use Composer\Package\Locker;
  8691. use Composer\Pcre\Preg;
  8692. use Composer\Plugin\PluginManager;
  8693. use Composer\Downloader\DownloadManager;
  8694. use Composer\Autoload\AutoloadGenerator;
  8695. use Composer\Package\Archiver\ArchiveManager;
  8696. class Composer extends PartialComposer
  8697. {
  8698. public const VERSION = '2.3.4';
  8699. public const BRANCH_ALIAS_VERSION = '';
  8700. public const RELEASE_DATE = '2022-04-07 21:16:35';
  8701. public const SOURCE_VERSION = '';
  8702. public const RUNTIME_API_VERSION = '2.2.2';
  8703. public static function getVersion(): string
  8704. {
  8705. if (self::VERSION === '@package_version'.'@') {
  8706. return self::SOURCE_VERSION;
  8707. }
  8708. if (self::BRANCH_ALIAS_VERSION !== '' && Preg::isMatch('{^[a-f0-9]{40}$}', self::VERSION)) {
  8709. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  8710. }
  8711. return self::VERSION;
  8712. }
  8713. private $locker;
  8714. private $downloadManager;
  8715. private $pluginManager;
  8716. private $autoloadGenerator;
  8717. private $archiveManager;
  8718. public function setLocker(Locker $locker): void
  8719. {
  8720. $this->locker = $locker;
  8721. }
  8722. public function getLocker(): Locker
  8723. {
  8724. return $this->locker;
  8725. }
  8726. public function setDownloadManager(DownloadManager $manager): void
  8727. {
  8728. $this->downloadManager = $manager;
  8729. }
  8730. public function getDownloadManager(): DownloadManager
  8731. {
  8732. return $this->downloadManager;
  8733. }
  8734. public function setArchiveManager(ArchiveManager $manager): void
  8735. {
  8736. $this->archiveManager = $manager;
  8737. }
  8738. public function getArchiveManager(): ArchiveManager
  8739. {
  8740. return $this->archiveManager;
  8741. }
  8742. public function setPluginManager(PluginManager $manager): void
  8743. {
  8744. $this->pluginManager = $manager;
  8745. }
  8746. public function getPluginManager(): PluginManager
  8747. {
  8748. return $this->pluginManager;
  8749. }
  8750. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator): void
  8751. {
  8752. $this->autoloadGenerator = $autoloadGenerator;
  8753. }
  8754. public function getAutoloadGenerator(): AutoloadGenerator
  8755. {
  8756. return $this->autoloadGenerator;
  8757. }
  8758. }
  8759. <?php declare(strict_types=1);
  8760. namespace Composer;
  8761. use Composer\Config\ConfigSourceInterface;
  8762. use Composer\Downloader\TransportException;
  8763. use Composer\IO\IOInterface;
  8764. use Composer\Pcre\Preg;
  8765. use Composer\Util\Platform;
  8766. use Composer\Util\ProcessExecutor;
  8767. class Config
  8768. {
  8769. public const SOURCE_DEFAULT = 'default';
  8770. public const SOURCE_COMMAND = 'command';
  8771. public const SOURCE_UNKNOWN = 'unknown';
  8772. public const RELATIVE_PATHS = 1;
  8773. public static $defaultConfig = array(
  8774. 'process-timeout' => 300,
  8775. 'use-include-path' => false,
  8776. 'allow-plugins' => null,
  8777. 'use-parent-dir' => 'prompt',
  8778. 'preferred-install' => 'dist',
  8779. 'notify-on-install' => true,
  8780. 'github-protocols' => array('https', 'ssh', 'git'),
  8781. 'gitlab-protocol' => null,
  8782. 'vendor-dir' => 'vendor',
  8783. 'bin-dir' => '{$vendor-dir}/bin',
  8784. 'cache-dir' => '{$home}/cache',
  8785. 'data-dir' => '{$home}',
  8786. 'cache-files-dir' => '{$cache-dir}/files',
  8787. 'cache-repo-dir' => '{$cache-dir}/repo',
  8788. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  8789. 'cache-ttl' => 15552000,
  8790. 'cache-files-ttl' => null,
  8791. 'cache-files-maxsize' => '300MiB',
  8792. 'cache-read-only' => false,
  8793. 'bin-compat' => 'auto',
  8794. 'discard-changes' => false,
  8795. 'autoloader-suffix' => null,
  8796. 'sort-packages' => false,
  8797. 'optimize-autoloader' => false,
  8798. 'classmap-authoritative' => false,
  8799. 'apcu-autoloader' => false,
  8800. 'prepend-autoloader' => true,
  8801. 'github-domains' => array('github.com'),
  8802. 'bitbucket-expose-hostname' => true,
  8803. 'disable-tls' => false,
  8804. 'secure-http' => true,
  8805. 'secure-svn-domains' => array(),
  8806. 'cafile' => null,
  8807. 'capath' => null,
  8808. 'github-expose-hostname' => true,
  8809. 'gitlab-domains' => array('gitlab.com'),
  8810. 'store-auths' => 'prompt',
  8811. 'platform' => array(),
  8812. 'archive-format' => 'tar',
  8813. 'archive-dir' => '.',
  8814. 'htaccess-protect' => true,
  8815. 'use-github-api' => true,
  8816. 'lock' => true,
  8817. 'platform-check' => 'php-only',
  8818. );
  8819. public static $defaultRepositories = array(
  8820. 'packagist.org' => array(
  8821. 'type' => 'composer',
  8822. 'url' => 'https://repo.packagist.org',
  8823. ),
  8824. );
  8825. private $config;
  8826. private $baseDir;
  8827. private $repositories;
  8828. private $configSource;
  8829. private $authConfigSource;
  8830. private $useEnvironment;
  8831. private $warnedHosts = array();
  8832. private $sourceOfConfigValue = array();
  8833. public function __construct(bool $useEnvironment = true, ?string $baseDir = null)
  8834. {
  8835. $this->config = static::$defaultConfig;
  8836. if (strtotime('2022-07-01') < time()) {
  8837. $this->config['allow-plugins'] = array();
  8838. }
  8839. $this->repositories = static::$defaultRepositories;
  8840. $this->useEnvironment = (bool) $useEnvironment;
  8841. $this->baseDir = is_string($baseDir) && '' !== $baseDir ? $baseDir : null;
  8842. foreach ($this->config as $configKey => $configValue) {
  8843. $this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
  8844. }
  8845. foreach ($this->repositories as $configKey => $configValue) {
  8846. $this->setSourceOfConfigValue($configValue, 'repositories.' . $configKey, self::SOURCE_DEFAULT);
  8847. }
  8848. }
  8849. public function setConfigSource(ConfigSourceInterface $source): void
  8850. {
  8851. $this->configSource = $source;
  8852. }
  8853. public function getConfigSource(): ConfigSourceInterface
  8854. {
  8855. return $this->configSource;
  8856. }
  8857. public function setAuthConfigSource(ConfigSourceInterface $source): void
  8858. {
  8859. $this->authConfigSource = $source;
  8860. }
  8861. public function getAuthConfigSource(): ConfigSourceInterface
  8862. {
  8863. return $this->authConfigSource;
  8864. }
  8865. public function merge(array $config, string $source = self::SOURCE_UNKNOWN): void
  8866. {
  8867. if (!empty($config['config']) && is_array($config['config'])) {
  8868. foreach ($config['config'] as $key => $val) {
  8869. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer'), true) && isset($this->config[$key])) {
  8870. $this->config[$key] = array_merge($this->config[$key], $val);
  8871. $this->setSourceOfConfigValue($val, $key, $source);
  8872. } elseif (in_array($key, array('allow-plugins'), true) && isset($this->config[$key]) && is_array($this->config[$key])) {
  8873. $this->config[$key] = array_merge($val, $this->config[$key], $val);
  8874. $this->setSourceOfConfigValue($val, $key, $source);
  8875. } elseif (in_array($key, array('gitlab-domains', 'github-domains'), true) && isset($this->config[$key])) {
  8876. $this->config[$key] = array_unique(array_merge($this->config[$key], $val));
  8877. $this->setSourceOfConfigValue($val, $key, $source);
  8878. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  8879. if (is_array($val) || is_array($this->config[$key])) {
  8880. if (is_string($val)) {
  8881. $val = array('*' => $val);
  8882. }
  8883. if (is_string($this->config[$key])) {
  8884. $this->config[$key] = array('*' => $this->config[$key]);
  8885. $this->sourceOfConfigValue[$key . '*'] = $source;
  8886. }
  8887. $this->config[$key] = array_merge($this->config[$key], $val);
  8888. $this->setSourceOfConfigValue($val, $key, $source);
  8889. if (isset($this->config[$key]['*'])) {
  8890. $wildcard = $this->config[$key]['*'];
  8891. unset($this->config[$key]['*']);
  8892. $this->config[$key]['*'] = $wildcard;
  8893. }
  8894. } else {
  8895. $this->config[$key] = $val;
  8896. $this->setSourceOfConfigValue($val, $key, $source);
  8897. }
  8898. } else {
  8899. $this->config[$key] = $val;
  8900. $this->setSourceOfConfigValue($val, $key, $source);
  8901. }
  8902. }
  8903. }
  8904. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  8905. $this->repositories = array_reverse($this->repositories, true);
  8906. $newRepos = array_reverse($config['repositories'], true);
  8907. foreach ($newRepos as $name => $repository) {
  8908. if (false === $repository) {
  8909. $this->disableRepoByName((string) $name);
  8910. continue;
  8911. }
  8912. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  8913. $this->disableRepoByName((string) key($repository));
  8914. continue;
  8915. }
  8916. if (isset($repository['type'], $repository['url']) && $repository['type'] === 'composer' && Preg::isMatch('{^https?://(?:[a-z0-9-.]+\.)?packagist.org(/|$)}', $repository['url'])) {
  8917. $this->disableRepoByName('packagist.org');
  8918. }
  8919. if (is_int($name)) {
  8920. $this->repositories[] = $repository;
  8921. $this->setSourceOfConfigValue($repository, 'repositories.' . array_search($repository, $this->repositories, true), $source);
  8922. } else {
  8923. if ($name === 'packagist') {
  8924. $this->repositories[$name . '.org'] = $repository;
  8925. $this->setSourceOfConfigValue($repository, 'repositories.' . $name . '.org', $source);
  8926. } else {
  8927. $this->repositories[$name] = $repository;
  8928. $this->setSourceOfConfigValue($repository, 'repositories.' . $name, $source);
  8929. }
  8930. }
  8931. }
  8932. $this->repositories = array_reverse($this->repositories, true);
  8933. }
  8934. }
  8935. public function getRepositories(): array
  8936. {
  8937. return $this->repositories;
  8938. }
  8939. public function get(string $key, int $flags = 0)
  8940. {
  8941. switch ($key) {
  8942. case 'vendor-dir':
  8943. case 'bin-dir':
  8944. case 'process-timeout':
  8945. case 'data-dir':
  8946. case 'cache-dir':
  8947. case 'cache-files-dir':
  8948. case 'cache-repo-dir':
  8949. case 'cache-vcs-dir':
  8950. case 'cafile':
  8951. case 'capath':
  8952. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  8953. $val = $this->getComposerEnv($env);
  8954. if ($val !== false) {
  8955. $this->setSourceOfConfigValue($val, $key, $env);
  8956. }
  8957. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  8958. $val = Platform::expandPath($val);
  8959. if (substr($key, -4) !== '-dir') {
  8960. return $val;
  8961. }
  8962. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  8963. case 'cache-read-only':
  8964. case 'htaccess-protect':
  8965. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  8966. $val = $this->getComposerEnv($env);
  8967. if (false === $val) {
  8968. $val = $this->config[$key];
  8969. } else {
  8970. $this->setSourceOfConfigValue($val, $key, $env);
  8971. }
  8972. return $val !== 'false' && (bool) $val;
  8973. case 'disable-tls':
  8974. case 'secure-http':
  8975. case 'use-github-api':
  8976. case 'lock':
  8977. if ($key === 'secure-http' && $this->get('disable-tls') === true) {
  8978. return false;
  8979. }
  8980. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  8981. case 'cache-ttl':
  8982. return (int) $this->config[$key];
  8983. case 'cache-files-maxsize':
  8984. if (!Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', (string) $this->config[$key], $matches)) {
  8985. throw new \RuntimeException(
  8986. "Could not parse the value of '$key': {$this->config[$key]}"
  8987. );
  8988. }
  8989. $size = $matches[1];
  8990. if (isset($matches[2])) {
  8991. switch (strtolower($matches[2])) {
  8992. case 'g':
  8993. $size *= 1024;
  8994. case 'm':
  8995. $size *= 1024;
  8996. case 'k':
  8997. $size *= 1024;
  8998. break;
  8999. }
  9000. }
  9001. return $size;
  9002. case 'cache-files-ttl':
  9003. if (isset($this->config[$key])) {
  9004. return (int) $this->config[$key];
  9005. }
  9006. return (int) $this->config['cache-ttl'];
  9007. case 'home':
  9008. return rtrim($this->process(Platform::expandPath($this->config[$key]), $flags), '/\\');
  9009. case 'bin-compat':
  9010. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  9011. if (!in_array($value, array('auto', 'full', 'proxy', 'symlink'))) {
  9012. throw new \RuntimeException(
  9013. "Invalid value for 'bin-compat': {$value}. Expected auto, full or proxy"
  9014. );
  9015. }
  9016. if ($value === 'symlink') {
  9017. trigger_error('config.bin-compat "symlink" is deprecated since Composer 2.2, use auto, full (for Windows compatibility) or proxy instead.', E_USER_DEPRECATED);
  9018. }
  9019. return $value;
  9020. case 'discard-changes':
  9021. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  9022. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  9023. throw new \RuntimeException(
  9024. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  9025. );
  9026. }
  9027. if ('stash' === $env) {
  9028. return 'stash';
  9029. }
  9030. return $env !== 'false' && (bool) $env;
  9031. }
  9032. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  9033. throw new \RuntimeException(
  9034. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  9035. );
  9036. }
  9037. return $this->config[$key];
  9038. case 'github-protocols':
  9039. $protos = $this->config['github-protocols'];
  9040. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  9041. unset($protos[$index]);
  9042. }
  9043. if (reset($protos) === 'http') {
  9044. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  9045. }
  9046. return $protos;
  9047. default:
  9048. if (!isset($this->config[$key])) {
  9049. return null;
  9050. }
  9051. return $this->process($this->config[$key], $flags);
  9052. }
  9053. }
  9054. public function all(int $flags = 0): array
  9055. {
  9056. $all = array(
  9057. 'repositories' => $this->getRepositories(),
  9058. );
  9059. foreach (array_keys($this->config) as $key) {
  9060. $all['config'][$key] = $this->get($key, $flags);
  9061. }
  9062. return $all;
  9063. }
  9064. public function getSourceOfValue(string $key): string
  9065. {
  9066. $this->get($key);
  9067. return $this->sourceOfConfigValue[$key] ?? self::SOURCE_UNKNOWN;
  9068. }
  9069. private function setSourceOfConfigValue($configValue, string $path, string $source): void
  9070. {
  9071. $this->sourceOfConfigValue[$path] = $source;
  9072. if (is_array($configValue)) {
  9073. foreach ($configValue as $key => $value) {
  9074. $this->setSourceOfConfigValue($value, $path . '.' . $key, $source);
  9075. }
  9076. }
  9077. }
  9078. public function raw(): array
  9079. {
  9080. return array(
  9081. 'repositories' => $this->getRepositories(),
  9082. 'config' => $this->config,
  9083. );
  9084. }
  9085. public function has(string $key): bool
  9086. {
  9087. return array_key_exists($key, $this->config);
  9088. }
  9089. private function process($value, int $flags)
  9090. {
  9091. if (!is_string($value)) {
  9092. return $value;
  9093. }
  9094. return Preg::replaceCallback('#\{\$(.+)\}#', function ($match) use ($flags) {
  9095. return $this->get($match[1], $flags);
  9096. }, $value);
  9097. }
  9098. private function realpath(string $path): string
  9099. {
  9100. if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://|\\\\\\\\)}i', $path)) {
  9101. return $path;
  9102. }
  9103. return $this->baseDir ? $this->baseDir . '/' . $path : $path;
  9104. }
  9105. private function getComposerEnv(string $var)
  9106. {
  9107. if ($this->useEnvironment) {
  9108. return Platform::getEnv($var);
  9109. }
  9110. return false;
  9111. }
  9112. private function disableRepoByName(string $name): void
  9113. {
  9114. if (isset($this->repositories[$name])) {
  9115. unset($this->repositories[$name]);
  9116. } elseif ($name === 'packagist') {
  9117. unset($this->repositories['packagist.org']);
  9118. }
  9119. }
  9120. public function prohibitUrlByConfig(string $url, IOInterface $io = null): void
  9121. {
  9122. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  9123. return;
  9124. }
  9125. $scheme = parse_url($url, PHP_URL_SCHEME);
  9126. $hostname = parse_url($url, PHP_URL_HOST);
  9127. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  9128. if ($this->get('secure-http')) {
  9129. if ($scheme === 'svn') {
  9130. if (in_array($hostname, $this->get('secure-svn-domains'), true)) {
  9131. return;
  9132. }
  9133. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-svn-domains for details.");
  9134. }
  9135. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  9136. }
  9137. if ($io) {
  9138. $host = parse_url($url, PHP_URL_HOST);
  9139. if (is_string($host)) {
  9140. if (!isset($this->warnedHosts[$host])) {
  9141. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  9142. }
  9143. $this->warnedHosts[$host] = true;
  9144. }
  9145. }
  9146. }
  9147. }
  9148. public static function disableProcessTimeout(): void
  9149. {
  9150. ProcessExecutor::setTimeout(0);
  9151. }
  9152. }
  9153. <?php declare(strict_types=1);
  9154. namespace Composer\Config;
  9155. interface ConfigSourceInterface
  9156. {
  9157. public function addRepository(string $name, $config, bool $append = true): void;
  9158. public function removeRepository(string $name): void;
  9159. public function addConfigSetting(string $name, $value): void;
  9160. public function removeConfigSetting(string $name): void;
  9161. public function addProperty(string $name, $value): void;
  9162. public function removeProperty(string $name): void;
  9163. public function addLink(string $type, string $name, string $value): void;
  9164. public function removeLink(string $type, string $name): void;
  9165. public function getName(): string;
  9166. }
  9167. <?php declare(strict_types=1);
  9168. namespace Composer\Config;
  9169. use Composer\Json\JsonFile;
  9170. use Composer\Json\JsonManipulator;
  9171. use Composer\Json\JsonValidationException;
  9172. use Composer\Pcre\Preg;
  9173. use Composer\Util\Filesystem;
  9174. use Composer\Util\Silencer;
  9175. class JsonConfigSource implements ConfigSourceInterface
  9176. {
  9177. private $file;
  9178. private $authConfig;
  9179. public function __construct(JsonFile $file, bool $authConfig = false)
  9180. {
  9181. $this->file = $file;
  9182. $this->authConfig = $authConfig;
  9183. }
  9184. public function getName(): string
  9185. {
  9186. return $this->file->getPath();
  9187. }
  9188. public function addRepository(string $name, $config, bool $append = true): void
  9189. {
  9190. $this->manipulateJson('addRepository', function (&$config, $repo, $repoConfig) use ($append): void {
  9191. if (isset($config['repositories'])) {
  9192. foreach ($config['repositories'] as $index => $val) {
  9193. if ($index === $repo) {
  9194. continue;
  9195. }
  9196. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  9197. unset($config['repositories'][$index]);
  9198. $config['repositories']['packagist.org'] = false;
  9199. break;
  9200. }
  9201. }
  9202. }
  9203. if ($append) {
  9204. $config['repositories'][$repo] = $repoConfig;
  9205. } else {
  9206. $config['repositories'] = array($repo => $repoConfig) + $config['repositories'];
  9207. }
  9208. }, $name, $config, $append);
  9209. }
  9210. public function removeRepository(string $name): void
  9211. {
  9212. $this->manipulateJson('removeRepository', function (&$config, $repo): void {
  9213. unset($config['repositories'][$repo]);
  9214. }, $name);
  9215. }
  9216. public function addConfigSetting(string $name, $value): void
  9217. {
  9218. $authConfig = $this->authConfig;
  9219. $this->manipulateJson('addConfigSetting', function (&$config, $key, $val) use ($authConfig): void {
  9220. if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  9221. list($key, $host) = explode('.', $key, 2);
  9222. if ($authConfig) {
  9223. $config[$key][$host] = $val;
  9224. } else {
  9225. $config['config'][$key][$host] = $val;
  9226. }
  9227. } else {
  9228. $config['config'][$key] = $val;
  9229. }
  9230. }, $name, $value);
  9231. }
  9232. public function removeConfigSetting(string $name): void
  9233. {
  9234. $authConfig = $this->authConfig;
  9235. $this->manipulateJson('removeConfigSetting', function (&$config, $key) use ($authConfig): void {
  9236. if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  9237. list($key, $host) = explode('.', $key, 2);
  9238. if ($authConfig) {
  9239. unset($config[$key][$host]);
  9240. } else {
  9241. unset($config['config'][$key][$host]);
  9242. }
  9243. } else {
  9244. unset($config['config'][$key]);
  9245. }
  9246. }, $name);
  9247. }
  9248. public function addProperty(string $name, $value): void
  9249. {
  9250. $this->manipulateJson('addProperty', function (&$config, $key, $val): void {
  9251. if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
  9252. $bits = explode('.', $key);
  9253. $last = array_pop($bits);
  9254. $arr = &$config[reset($bits)];
  9255. foreach ($bits as $bit) {
  9256. if (!isset($arr[$bit])) {
  9257. $arr[$bit] = array();
  9258. }
  9259. $arr = &$arr[$bit];
  9260. }
  9261. $arr[$last] = $val;
  9262. } else {
  9263. $config[$key] = $val;
  9264. }
  9265. }, $name, $value);
  9266. }
  9267. public function removeProperty(string $name): void
  9268. {
  9269. $this->manipulateJson('removeProperty', function (&$config, $key): void {
  9270. if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
  9271. $bits = explode('.', $key);
  9272. $last = array_pop($bits);
  9273. $arr = &$config[reset($bits)];
  9274. foreach ($bits as $bit) {
  9275. if (!isset($arr[$bit])) {
  9276. return;
  9277. }
  9278. $arr = &$arr[$bit];
  9279. }
  9280. unset($arr[$last]);
  9281. } else {
  9282. unset($config[$key]);
  9283. }
  9284. }, $name);
  9285. }
  9286. public function addLink(string $type, string $name, string $value): void
  9287. {
  9288. $this->manipulateJson('addLink', function (&$config, $type, $name, $value): void {
  9289. $config[$type][$name] = $value;
  9290. }, $type, $name, $value);
  9291. }
  9292. public function removeLink(string $type, string $name): void
  9293. {
  9294. $this->manipulateJson('removeSubNode', function (&$config, $type, $name): void {
  9295. unset($config[$type][$name]);
  9296. }, $type, $name);
  9297. $this->manipulateJson('removeMainKeyIfEmpty', function (&$config, $type): void {
  9298. if (0 === count($config[$type])) {
  9299. unset($config[$type]);
  9300. }
  9301. }, $type);
  9302. }
  9303. private function manipulateJson(string $method, callable $fallback, ...$args): void
  9304. {
  9305. if ($this->file->exists()) {
  9306. if (!is_writable($this->file->getPath())) {
  9307. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  9308. }
  9309. if (!Filesystem::isReadable($this->file->getPath())) {
  9310. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  9311. }
  9312. $contents = file_get_contents($this->file->getPath());
  9313. } elseif ($this->authConfig) {
  9314. $contents = "{\n}\n";
  9315. } else {
  9316. $contents = "{\n \"config\": {\n }\n}\n";
  9317. }
  9318. $manipulator = new JsonManipulator($contents);
  9319. $newFile = !$this->file->exists();
  9320. if ($this->authConfig && $method === 'addConfigSetting') {
  9321. $method = 'addSubNode';
  9322. list($mainNode, $name) = explode('.', $args[0], 2);
  9323. $args = array($mainNode, $name, $args[1]);
  9324. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  9325. $method = 'removeSubNode';
  9326. list($mainNode, $name) = explode('.', $args[0], 2);
  9327. $args = array($mainNode, $name);
  9328. }
  9329. if (call_user_func_array(array($manipulator, $method), $args)) {
  9330. file_put_contents($this->file->getPath(), $manipulator->getContents());
  9331. } else {
  9332. $config = $this->file->read();
  9333. $this->arrayUnshiftRef($args, $config);
  9334. call_user_func_array($fallback, $args);
  9335. foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev', 'scripts', 'scripts-descriptions', 'support') as $prop) {
  9336. if (isset($config[$prop]) && $config[$prop] === array()) {
  9337. $config[$prop] = new \stdClass;
  9338. }
  9339. }
  9340. foreach (array('psr-0', 'psr-4') as $prop) {
  9341. if (isset($config['autoload'][$prop]) && $config['autoload'][$prop] === array()) {
  9342. $config['autoload'][$prop] = new \stdClass;
  9343. }
  9344. if (isset($config['autoload-dev'][$prop]) && $config['autoload-dev'][$prop] === array()) {
  9345. $config['autoload-dev'][$prop] = new \stdClass;
  9346. }
  9347. }
  9348. foreach (array('platform', 'http-basic', 'bearer', 'gitlab-token', 'gitlab-oauth', 'github-oauth', 'preferred-install') as $prop) {
  9349. if (isset($config['config'][$prop]) && $config['config'][$prop] === array()) {
  9350. $config['config'][$prop] = new \stdClass;
  9351. }
  9352. }
  9353. $this->file->write($config);
  9354. }
  9355. try {
  9356. $this->file->validateSchema(JsonFile::LAX_SCHEMA);
  9357. } catch (JsonValidationException $e) {
  9358. file_put_contents($this->file->getPath(), $contents);
  9359. throw new \RuntimeException('Failed to update composer.json with a valid format, reverting to the original content. Please report an issue to us with details (command you run and a copy of your composer.json). '.PHP_EOL.implode(PHP_EOL, $e->getErrors()), 0, $e);
  9360. }
  9361. if ($newFile) {
  9362. Silencer::call('chmod', $this->file->getPath(), 0600);
  9363. }
  9364. }
  9365. private function arrayUnshiftRef(array &$array, &$value): int
  9366. {
  9367. $return = array_unshift($array, '');
  9368. $array[0] = &$value;
  9369. return $return;
  9370. }
  9371. }
  9372. <?php declare(strict_types=1);
  9373. namespace Composer\Console;
  9374. use Composer\IO\NullIO;
  9375. use Composer\Util\Filesystem;
  9376. use Composer\Util\Platform;
  9377. use Composer\Util\Silencer;
  9378. use LogicException;
  9379. use Symfony\Component\Console\Application as BaseApplication;
  9380. use Symfony\Component\Console\Exception\CommandNotFoundException;
  9381. use Symfony\Component\Console\Helper\HelperSet;
  9382. use Symfony\Component\Console\Helper\QuestionHelper;
  9383. use Symfony\Component\Console\Input\InputDefinition;
  9384. use Symfony\Component\Console\Input\InputInterface;
  9385. use Symfony\Component\Console\Input\InputOption;
  9386. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  9387. use Symfony\Component\Console\Output\OutputInterface;
  9388. use Seld\JsonLint\ParsingException;
  9389. use Composer\Command;
  9390. use Composer\Composer;
  9391. use Composer\Factory;
  9392. use Composer\IO\IOInterface;
  9393. use Composer\IO\ConsoleIO;
  9394. use Composer\Json\JsonValidationException;
  9395. use Composer\Util\ErrorHandler;
  9396. use Composer\Util\HttpDownloader;
  9397. use Composer\EventDispatcher\ScriptExecutionException;
  9398. use Composer\Exception\NoSslException;
  9399. use Composer\XdebugHandler\XdebugHandler;
  9400. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  9401. class Application extends BaseApplication
  9402. {
  9403. protected $composer;
  9404. protected $io;
  9405. private static $logo = ' ______
  9406. / ____/___ ____ ___ ____ ____ ________ _____
  9407. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  9408. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  9409. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  9410. /_/
  9411. ';
  9412. private $hasPluginCommands = false;
  9413. private $disablePluginsByDefault = false;
  9414. private $disableScriptsByDefault = false;
  9415. private $initialWorkingDirectory;
  9416. public function __construct()
  9417. {
  9418. static $shutdownRegistered = false;
  9419. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  9420. ini_set('xdebug.show_exception_trace', '0');
  9421. ini_set('xdebug.scream', '0');
  9422. }
  9423. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  9424. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  9425. }
  9426. if (!$shutdownRegistered) {
  9427. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  9428. pcntl_async_signals(true);
  9429. pcntl_signal(SIGINT, function ($sig): void {
  9430. exit(130);
  9431. });
  9432. }
  9433. $shutdownRegistered = true;
  9434. register_shutdown_function(function (): void {
  9435. $lastError = error_get_last();
  9436. if ($lastError && $lastError['message'] &&
  9437. (strpos($lastError['message'], 'Allowed memory') !== false ||
  9438. strpos($lastError['message'], 'exceeded memory') !== false )) {
  9439. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  9440. }
  9441. });
  9442. }
  9443. $this->io = new NullIO();
  9444. $this->initialWorkingDirectory = getcwd();
  9445. parent::__construct('Composer', Composer::getVersion());
  9446. }
  9447. public function run(InputInterface $input = null, OutputInterface $output = null): int
  9448. {
  9449. if (null === $output) {
  9450. $output = Factory::createOutput();
  9451. }
  9452. return parent::run($input, $output);
  9453. }
  9454. public function doRun(InputInterface $input, OutputInterface $output): int
  9455. {
  9456. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  9457. $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
  9458. if (Platform::getEnv('COMPOSER_NO_INTERACTION') || !Platform::isTty(defined('STDIN') ? STDIN : fopen('php://stdin', 'r'))) {
  9459. $input->setInteractive(false);
  9460. }
  9461. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  9462. new QuestionHelper(),
  9463. )));
  9464. ErrorHandler::register($io);
  9465. if ($input->hasParameterOption('--no-cache')) {
  9466. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  9467. Platform::putEnv('COMPOSER_CACHE_DIR', Platform::isWindows() ? 'nul' : '/dev/null');
  9468. }
  9469. $newWorkDir = $this->getNewWorkingDir($input);
  9470. if (null !== $newWorkDir) {
  9471. $oldWorkingDir = Platform::getCwd(true);
  9472. chdir($newWorkDir);
  9473. $this->initialWorkingDirectory = $newWorkDir;
  9474. $cwd = Platform::getCwd(true);
  9475. $io->writeError('Changed CWD to ' . ($cwd !== '' ? $cwd : $newWorkDir), true, IOInterface::DEBUG);
  9476. }
  9477. $commandName = '';
  9478. if ($name = $this->getCommandName($input)) {
  9479. try {
  9480. $commandName = $this->find($name)->getName();
  9481. } catch (CommandNotFoundException $e) {
  9482. $commandName = false;
  9483. } catch (\InvalidArgumentException $e) {
  9484. }
  9485. }
  9486. if ($io->isInteractive() && null === $newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile()) && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false) {
  9487. $dir = dirname(Platform::getCwd(true));
  9488. $home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
  9489. while (dirname($dir) !== $dir && $dir !== $home) {
  9490. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  9491. if ($useParentDirIfNoJsonAvailable === true || $io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ')) {
  9492. if ($useParentDirIfNoJsonAvailable === true) {
  9493. $io->writeError('<info>No composer.json in current directory, changing working directory to '.$dir.'</info>');
  9494. } else {
  9495. $io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
  9496. }
  9497. $oldWorkingDir = Platform::getCwd(true);
  9498. chdir($dir);
  9499. }
  9500. break;
  9501. }
  9502. $dir = dirname($dir);
  9503. }
  9504. }
  9505. $mayNeedPluginCommand = false === $input->hasParameterOption(array('--version', '-V'))
  9506. && (
  9507. false === $commandName
  9508. || in_array($commandName, array('', 'list', 'help'), true)
  9509. );
  9510. if ($mayNeedPluginCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands) {
  9511. try {
  9512. foreach ($this->getPluginCommands() as $command) {
  9513. if ($this->has($command->getName())) {
  9514. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  9515. } else {
  9516. $this->add($command);
  9517. }
  9518. }
  9519. } catch (NoSslException $e) {
  9520. } catch (ParsingException $e) {
  9521. $details = $e->getDetails();
  9522. $file = realpath(Factory::getComposerFile());
  9523. $line = null;
  9524. if ($details && isset($details['line'])) {
  9525. $line = $details['line'];
  9526. }
  9527. $ghe = new GithubActionError($this->io);
  9528. $ghe->emit($e->getMessage(), $file, $line);
  9529. throw $e;
  9530. }
  9531. $this->hasPluginCommands = true;
  9532. }
  9533. $isProxyCommand = false;
  9534. if ($name = $this->getCommandName($input)) {
  9535. try {
  9536. $command = $this->find($name);
  9537. $commandName = $command->getName();
  9538. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  9539. } catch (\InvalidArgumentException $e) {
  9540. }
  9541. }
  9542. if (!$isProxyCommand) {
  9543. $io->writeError(sprintf(
  9544. 'Running %s (%s) with %s on %s',
  9545. Composer::getVersion(),
  9546. Composer::RELEASE_DATE,
  9547. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  9548. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  9549. ), true, IOInterface::DEBUG);
  9550. if (PHP_VERSION_ID < 70205) {
  9551. $io->writeError('<warning>Composer supports PHP 7.2.5 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.'. Upgrading is strongly recommended but you can use Composer 2.2.x LTS as a fallback.</warning>');
  9552. }
  9553. if (XdebugHandler::isXdebugActive() && !Platform::getEnv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  9554. $io->writeError('<warning>Composer is operating slower than normal because you have Xdebug enabled. See https://getcomposer.org/xdebug</warning>');
  9555. }
  9556. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  9557. $io->writeError(sprintf('<warning>Warning: This development build of Composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  9558. }
  9559. if (
  9560. !Platform::isWindows()
  9561. && function_exists('exec')
  9562. && !Platform::getEnv('COMPOSER_ALLOW_SUPERUSER')
  9563. && (ini_get('open_basedir') || !file_exists('/.dockerenv'))
  9564. ) {
  9565. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  9566. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  9567. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  9568. if ($io->isInteractive()) {
  9569. if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
  9570. return 1;
  9571. }
  9572. }
  9573. }
  9574. if ($uid = (int) Platform::getEnv('SUDO_UID')) {
  9575. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  9576. }
  9577. }
  9578. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  9579. }
  9580. Silencer::call(function () use ($io): void {
  9581. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  9582. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  9583. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  9584. }
  9585. });
  9586. $file = Factory::getComposerFile();
  9587. if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  9588. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  9589. foreach ($composer['scripts'] as $script => $dummy) {
  9590. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  9591. if ($this->has($script)) {
  9592. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  9593. } else {
  9594. $description = null;
  9595. if (isset($composer['scripts-descriptions'][$script])) {
  9596. $description = $composer['scripts-descriptions'][$script];
  9597. }
  9598. $this->add(new Command\ScriptAliasCommand($script, $description));
  9599. }
  9600. }
  9601. }
  9602. }
  9603. }
  9604. }
  9605. try {
  9606. if ($input->hasParameterOption('--profile')) {
  9607. $startTime = microtime(true);
  9608. $this->io->enableDebugging($startTime);
  9609. }
  9610. $result = parent::doRun($input, $output);
  9611. if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
  9612. Silencer::call('chdir', $oldWorkingDir);
  9613. }
  9614. if (isset($startTime)) {
  9615. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  9616. }
  9617. return $result;
  9618. } catch (ScriptExecutionException $e) {
  9619. return $e->getCode();
  9620. } catch (\Throwable $e) {
  9621. $ghe = new GithubActionError($this->io);
  9622. $ghe->emit($e->getMessage());
  9623. $this->hintCommonErrors($e, $output);
  9624. if (!$e instanceof \Exception) {
  9625. if ($output instanceof ConsoleOutputInterface) {
  9626. $this->renderThrowable($e, $output->getErrorOutput());
  9627. } else {
  9628. $this->renderThrowable($e, $output);
  9629. }
  9630. $exitCode = $e->getCode();
  9631. if (is_numeric($exitCode)) {
  9632. $exitCode = (int) $exitCode;
  9633. if (0 === $exitCode) {
  9634. $exitCode = 1;
  9635. }
  9636. } else {
  9637. $exitCode = 1;
  9638. }
  9639. return $exitCode;
  9640. }
  9641. throw $e;
  9642. } finally {
  9643. restore_error_handler();
  9644. }
  9645. }
  9646. private function getNewWorkingDir(InputInterface $input): ?string
  9647. {
  9648. $workingDir = $input->getParameterOption(array('--working-dir', '-d'), null, true);
  9649. if (null !== $workingDir && !is_dir($workingDir)) {
  9650. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  9651. }
  9652. return $workingDir;
  9653. }
  9654. private function hintCommonErrors(\Throwable $exception, OutputInterface $output): void
  9655. {
  9656. $io = $this->getIO();
  9657. if ((get_class($exception) === LogicException::class || $exception instanceof \Error) && $output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
  9658. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  9659. }
  9660. Silencer::suppress();
  9661. try {
  9662. $composer = $this->getComposer(false, true);
  9663. if ($composer) {
  9664. $config = $composer->getConfig();
  9665. $minSpaceFree = 1024 * 1024;
  9666. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  9667. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  9668. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  9669. ) {
  9670. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  9671. }
  9672. }
  9673. } catch (\Exception $e) {
  9674. }
  9675. Silencer::restore();
  9676. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  9677. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  9678. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  9679. }
  9680. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  9681. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  9682. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  9683. }
  9684. if ($exception instanceof ProcessTimedOutException) {
  9685. $io->writeError('<error>The following exception is caused by a process timeout</error>', true, IOInterface::QUIET);
  9686. $io->writeError('<error>Check https://getcomposer.org/doc/06-config.md#process-timeout for details</error>', true, IOInterface::QUIET);
  9687. }
  9688. $hints = HttpDownloader::getExceptionHints($exception);
  9689. if (null !== $hints && count($hints) > 0) {
  9690. foreach ($hints as $hint) {
  9691. $io->writeError($hint, true, IOInterface::QUIET);
  9692. }
  9693. }
  9694. }
  9695. public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
  9696. {
  9697. if (null === $disablePlugins) {
  9698. $disablePlugins = $this->disablePluginsByDefault;
  9699. }
  9700. if (null === $disableScripts) {
  9701. $disableScripts = $this->disableScriptsByDefault;
  9702. }
  9703. if (null === $this->composer) {
  9704. try {
  9705. $this->composer = Factory::create($this->io, null, $disablePlugins, $disableScripts);
  9706. } catch (\InvalidArgumentException $e) {
  9707. if ($required) {
  9708. $this->io->writeError($e->getMessage());
  9709. if ($this->areExceptionsCaught()) {
  9710. exit(1);
  9711. }
  9712. throw $e;
  9713. }
  9714. } catch (JsonValidationException $e) {
  9715. if ($required) {
  9716. throw $e;
  9717. }
  9718. }
  9719. }
  9720. return $this->composer;
  9721. }
  9722. public function resetComposer(): void
  9723. {
  9724. $this->composer = null;
  9725. if (method_exists($this->getIO(), 'resetAuthentications')) {
  9726. $this->getIO()->resetAuthentications();
  9727. }
  9728. }
  9729. public function getIO(): IOInterface
  9730. {
  9731. return $this->io;
  9732. }
  9733. public function getHelp(): string
  9734. {
  9735. return self::$logo . parent::getHelp();
  9736. }
  9737. protected function getDefaultCommands(): array
  9738. {
  9739. $commands = array_merge(parent::getDefaultCommands(), array(
  9740. new Command\AboutCommand(),
  9741. new Command\ConfigCommand(),
  9742. new Command\DependsCommand(),
  9743. new Command\ProhibitsCommand(),
  9744. new Command\InitCommand(),
  9745. new Command\InstallCommand(),
  9746. new Command\CreateProjectCommand(),
  9747. new Command\UpdateCommand(),
  9748. new Command\SearchCommand(),
  9749. new Command\ValidateCommand(),
  9750. new Command\ShowCommand(),
  9751. new Command\SuggestsCommand(),
  9752. new Command\RequireCommand(),
  9753. new Command\DumpAutoloadCommand(),
  9754. new Command\StatusCommand(),
  9755. new Command\ArchiveCommand(),
  9756. new Command\DiagnoseCommand(),
  9757. new Command\RunScriptCommand(),
  9758. new Command\LicensesCommand(),
  9759. new Command\GlobalCommand(),
  9760. new Command\ClearCacheCommand(),
  9761. new Command\RemoveCommand(),
  9762. new Command\HomeCommand(),
  9763. new Command\ExecCommand(),
  9764. new Command\OutdatedCommand(),
  9765. new Command\CheckPlatformReqsCommand(),
  9766. new Command\FundCommand(),
  9767. new Command\ReinstallCommand(),
  9768. ));
  9769. if (strpos(__FILE__, 'phar:') === 0 || '1' === Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
  9770. $commands[] = new Command\SelfUpdateCommand();
  9771. }
  9772. return $commands;
  9773. }
  9774. public function getLongVersion(): string
  9775. {
  9776. $branchAliasString = '';
  9777. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  9778. $branchAliasString = sprintf(' (%s)', Composer::BRANCH_ALIAS_VERSION);
  9779. }
  9780. return sprintf(
  9781. '<info>%s</info> version <comment>%s%s</comment> %s',
  9782. $this->getName(),
  9783. $this->getVersion(),
  9784. $branchAliasString,
  9785. Composer::RELEASE_DATE
  9786. );
  9787. }
  9788. protected function getDefaultInputDefinition(): InputDefinition
  9789. {
  9790. $definition = parent::getDefaultInputDefinition();
  9791. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  9792. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  9793. $definition->addOption(new InputOption('--no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'));
  9794. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  9795. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  9796. return $definition;
  9797. }
  9798. private function getPluginCommands(): array
  9799. {
  9800. $commands = array();
  9801. $composer = $this->getComposer(false, false);
  9802. if (null === $composer) {
  9803. $composer = Factory::createGlobal($this->io, $this->disablePluginsByDefault, $this->disableScriptsByDefault);
  9804. }
  9805. if (null !== $composer) {
  9806. $pm = $composer->getPluginManager();
  9807. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  9808. $newCommands = $capability->getCommands();
  9809. if (!is_array($newCommands)) {
  9810. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  9811. }
  9812. foreach ($newCommands as $command) {
  9813. if (!$command instanceof Command\BaseCommand) {
  9814. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  9815. }
  9816. }
  9817. $commands = array_merge($commands, $newCommands);
  9818. }
  9819. }
  9820. return $commands;
  9821. }
  9822. public function getInitialWorkingDirectory()
  9823. {
  9824. return $this->initialWorkingDirectory;
  9825. }
  9826. private function getUseParentDirConfigValue()
  9827. {
  9828. $config = Factory::createConfig($this->io);
  9829. return $config->get('use-parent-dir');
  9830. }
  9831. }
  9832. <?php declare(strict_types=1);
  9833. namespace Composer\Console;
  9834. use Composer\IO\IOInterface;
  9835. use Composer\Util\Platform;
  9836. final class GithubActionError
  9837. {
  9838. protected $io;
  9839. public function __construct(IOInterface $io)
  9840. {
  9841. $this->io = $io;
  9842. }
  9843. public function emit(string $message, ?string $file = null, ?int $line = null): void
  9844. {
  9845. if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
  9846. $message = $this->escapeData($message);
  9847. if ($file && $line) {
  9848. $file = $this->escapeProperty($file);
  9849. $this->io->write("::error file=". $file .",line=". $line ."::". $message);
  9850. } elseif ($file) {
  9851. $file = $this->escapeProperty($file);
  9852. $this->io->write("::error file=". $file ."::". $message);
  9853. } else {
  9854. $this->io->write("::error ::". $message);
  9855. }
  9856. }
  9857. }
  9858. private function escapeData(string $data): string
  9859. {
  9860. $data = str_replace("%", '%25', $data);
  9861. $data = str_replace("\r", '%0D', $data);
  9862. $data = str_replace("\n", '%0A', $data);
  9863. return $data;
  9864. }
  9865. private function escapeProperty(string $property): string
  9866. {
  9867. $property = str_replace("%", '%25', $property);
  9868. $property = str_replace("\r", '%0D', $property);
  9869. $property = str_replace("\n", '%0A', $property);
  9870. $property = str_replace(":", '%3A', $property);
  9871. $property = str_replace(",", '%2C', $property);
  9872. return $property;
  9873. }
  9874. }
  9875. <?php declare(strict_types=1);
  9876. namespace Composer\Console;
  9877. use Closure;
  9878. use Composer\Pcre\Preg;
  9879. use Symfony\Component\Console\Formatter\OutputFormatter;
  9880. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  9881. class HtmlOutputFormatter extends OutputFormatter
  9882. {
  9883. private static $availableForegroundColors = array(
  9884. 30 => 'black',
  9885. 31 => 'red',
  9886. 32 => 'green',
  9887. 33 => 'yellow',
  9888. 34 => 'blue',
  9889. 35 => 'magenta',
  9890. 36 => 'cyan',
  9891. 37 => 'white',
  9892. );
  9893. private static $availableBackgroundColors = array(
  9894. 40 => 'black',
  9895. 41 => 'red',
  9896. 42 => 'green',
  9897. 43 => 'yellow',
  9898. 44 => 'blue',
  9899. 45 => 'magenta',
  9900. 46 => 'cyan',
  9901. 47 => 'white',
  9902. );
  9903. private static $availableOptions = array(
  9904. 1 => 'bold',
  9905. 4 => 'underscore',
  9906. );
  9907. public function __construct(array $styles = array())
  9908. {
  9909. parent::__construct(true, $styles);
  9910. }
  9911. public function format(?string $message): ?string
  9912. {
  9913. $formatted = parent::format($message);
  9914. if ($formatted === null) {
  9915. return null;
  9916. }
  9917. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  9918. return Preg::replaceCallback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", Closure::fromCallable([$this, 'formatHtml']), $formatted);
  9919. }
  9920. private function formatHtml(array $matches): string
  9921. {
  9922. $out = '<span style="';
  9923. foreach (explode(';', $matches[1]) as $code) {
  9924. if (isset(self::$availableForegroundColors[(int) $code])) {
  9925. $out .= 'color:'.self::$availableForegroundColors[(int) $code].';';
  9926. } elseif (isset(self::$availableBackgroundColors[(int) $code])) {
  9927. $out .= 'background-color:'.self::$availableBackgroundColors[(int) $code].';';
  9928. } elseif (isset(self::$availableOptions[(int) $code])) {
  9929. switch (self::$availableOptions[(int) $code]) {
  9930. case 'bold':
  9931. $out .= 'font-weight:bold;';
  9932. break;
  9933. case 'underscore':
  9934. $out .= 'text-decoration:underline;';
  9935. break;
  9936. }
  9937. }
  9938. }
  9939. return $out.'">'.$matches[2].'</span>';
  9940. }
  9941. }
  9942. <?php declare(strict_types=1);
  9943. namespace Composer\DependencyResolver;
  9944. class Decisions implements \Iterator, \Countable
  9945. {
  9946. public const DECISION_LITERAL = 0;
  9947. public const DECISION_REASON = 1;
  9948. protected $pool;
  9949. protected $decisionMap;
  9950. protected $decisionQueue = array();
  9951. public function __construct(Pool $pool)
  9952. {
  9953. $this->pool = $pool;
  9954. $this->decisionMap = array();
  9955. }
  9956. public function decide(int $literal, int $level, Rule $why): void
  9957. {
  9958. $this->addDecision($literal, $level);
  9959. $this->decisionQueue[] = array(
  9960. self::DECISION_LITERAL => $literal,
  9961. self::DECISION_REASON => $why,
  9962. );
  9963. }
  9964. public function satisfy(int $literal): bool
  9965. {
  9966. $packageId = abs($literal);
  9967. return (
  9968. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  9969. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  9970. );
  9971. }
  9972. public function conflict(int $literal): bool
  9973. {
  9974. $packageId = abs($literal);
  9975. return (
  9976. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  9977. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  9978. );
  9979. }
  9980. public function decided(int $literalOrPackageId): bool
  9981. {
  9982. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  9983. }
  9984. public function undecided(int $literalOrPackageId): bool
  9985. {
  9986. return empty($this->decisionMap[abs($literalOrPackageId)]);
  9987. }
  9988. public function decidedInstall(int $literalOrPackageId): bool
  9989. {
  9990. $packageId = abs($literalOrPackageId);
  9991. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  9992. }
  9993. public function decisionLevel(int $literalOrPackageId): int
  9994. {
  9995. $packageId = abs($literalOrPackageId);
  9996. if (isset($this->decisionMap[$packageId])) {
  9997. return abs($this->decisionMap[$packageId]);
  9998. }
  9999. return 0;
  10000. }
  10001. public function decisionRule(int $literalOrPackageId): ?Rule
  10002. {
  10003. $packageId = abs($literalOrPackageId);
  10004. foreach ($this->decisionQueue as $decision) {
  10005. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  10006. return $decision[self::DECISION_REASON];
  10007. }
  10008. }
  10009. return null;
  10010. }
  10011. public function atOffset(int $queueOffset): array
  10012. {
  10013. return $this->decisionQueue[$queueOffset];
  10014. }
  10015. public function validOffset(int $queueOffset): bool
  10016. {
  10017. return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
  10018. }
  10019. public function lastReason(): Rule
  10020. {
  10021. return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_REASON];
  10022. }
  10023. public function lastLiteral(): int
  10024. {
  10025. return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  10026. }
  10027. public function reset(): void
  10028. {
  10029. while ($decision = array_pop($this->decisionQueue)) {
  10030. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  10031. }
  10032. }
  10033. public function resetToOffset(int $offset): void
  10034. {
  10035. while (\count($this->decisionQueue) > $offset + 1) {
  10036. $decision = array_pop($this->decisionQueue);
  10037. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  10038. }
  10039. }
  10040. public function revertLast(): void
  10041. {
  10042. $this->decisionMap[abs($this->lastLiteral())] = 0;
  10043. array_pop($this->decisionQueue);
  10044. }
  10045. public function count(): int
  10046. {
  10047. return \count($this->decisionQueue);
  10048. }
  10049. public function rewind(): void
  10050. {
  10051. end($this->decisionQueue);
  10052. }
  10053. #[\ReturnTypeWillChange]
  10054. public function current()
  10055. {
  10056. return current($this->decisionQueue);
  10057. }
  10058. public function key(): ?int
  10059. {
  10060. return key($this->decisionQueue);
  10061. }
  10062. public function next(): void
  10063. {
  10064. prev($this->decisionQueue);
  10065. }
  10066. public function valid(): bool
  10067. {
  10068. return false !== current($this->decisionQueue);
  10069. }
  10070. public function isEmpty(): bool
  10071. {
  10072. return \count($this->decisionQueue) === 0;
  10073. }
  10074. protected function addDecision(int $literal, int $level): void
  10075. {
  10076. $packageId = abs($literal);
  10077. $previousDecision = $this->decisionMap[$packageId] ?? null;
  10078. if ($previousDecision != 0) {
  10079. $literalString = $this->pool->literalToPrettyString($literal, array());
  10080. $package = $this->pool->literalToPackage($literal);
  10081. throw new SolverBugException(
  10082. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  10083. );
  10084. }
  10085. if ($literal > 0) {
  10086. $this->decisionMap[$packageId] = $level;
  10087. } else {
  10088. $this->decisionMap[$packageId] = -$level;
  10089. }
  10090. }
  10091. public function toString(Pool $pool = null): string
  10092. {
  10093. $decisionMap = $this->decisionMap;
  10094. ksort($decisionMap);
  10095. $str = '[';
  10096. foreach ($decisionMap as $packageId => $level) {
  10097. $str .= (($pool) ? $pool->literalToPackage($packageId) : $packageId).':'.$level.',';
  10098. }
  10099. $str .= ']';
  10100. return $str;
  10101. }
  10102. public function __toString(): string
  10103. {
  10104. return $this->toString();
  10105. }
  10106. }
  10107. <?php declare(strict_types=1);
  10108. namespace Composer\DependencyResolver;
  10109. use Composer\Package\AliasPackage;
  10110. use Composer\Package\BasePackage;
  10111. use Composer\Package\PackageInterface;
  10112. use Composer\Semver\Constraint\Constraint;
  10113. class DefaultPolicy implements PolicyInterface
  10114. {
  10115. private $preferStable;
  10116. private $preferLowest;
  10117. private $preferredPackageResultCachePerPool;
  10118. private $sortingCachePerPool;
  10119. public function __construct(bool $preferStable = false, bool $preferLowest = false)
  10120. {
  10121. $this->preferStable = $preferStable;
  10122. $this->preferLowest = $preferLowest;
  10123. }
  10124. public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool
  10125. {
  10126. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  10127. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  10128. }
  10129. $constraint = new Constraint($operator, $b->getVersion());
  10130. $version = new Constraint('==', $a->getVersion());
  10131. return $constraint->matchSpecific($version, true);
  10132. }
  10133. public function selectPreferredPackages(Pool $pool, array $literals, string $requiredPackage = null): array
  10134. {
  10135. sort($literals);
  10136. $resultCacheKey = implode(',', $literals).$requiredPackage;
  10137. $poolId = spl_object_id($pool);
  10138. if (isset($this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey])) {
  10139. return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey];
  10140. }
  10141. $packages = $this->groupLiteralsByName($pool, $literals);
  10142. foreach ($packages as &$nameLiterals) {
  10143. usort($nameLiterals, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
  10144. $cacheKey = 'i'.$a.'.'.$b.$requiredPackage;
  10145. if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
  10146. return $this->sortingCachePerPool[$poolId][$cacheKey];
  10147. }
  10148. return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  10149. });
  10150. }
  10151. foreach ($packages as &$sortedLiterals) {
  10152. $sortedLiterals = $this->pruneToBestVersion($pool, $sortedLiterals);
  10153. $sortedLiterals = $this->pruneRemoteAliases($pool, $sortedLiterals);
  10154. }
  10155. $selected = \call_user_func_array('array_merge', array_values($packages));
  10156. usort($selected, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
  10157. $cacheKey = $a.'.'.$b.$requiredPackage;
  10158. if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
  10159. return $this->sortingCachePerPool[$poolId][$cacheKey];
  10160. }
  10161. return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  10162. });
  10163. return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey] = $selected;
  10164. }
  10165. protected function groupLiteralsByName(Pool $pool, array $literals): array
  10166. {
  10167. $packages = array();
  10168. foreach ($literals as $literal) {
  10169. $packageName = $pool->literalToPackage($literal)->getName();
  10170. if (!isset($packages[$packageName])) {
  10171. $packages[$packageName] = array();
  10172. }
  10173. $packages[$packageName][] = $literal;
  10174. }
  10175. return $packages;
  10176. }
  10177. public function compareByPriority(Pool $pool, BasePackage $a, BasePackage $b, ?string $requiredPackage = null, bool $ignoreReplace = false): int
  10178. {
  10179. if ($a->getName() === $b->getName()) {
  10180. $aAliased = $a instanceof AliasPackage;
  10181. $bAliased = $b instanceof AliasPackage;
  10182. if ($aAliased && !$bAliased) {
  10183. return -1;
  10184. }
  10185. if (!$aAliased && $bAliased) {
  10186. return 1;
  10187. }
  10188. }
  10189. if (!$ignoreReplace) {
  10190. if ($this->replaces($a, $b)) {
  10191. return 1;
  10192. }
  10193. if ($this->replaces($b, $a)) {
  10194. return -1;
  10195. }
  10196. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  10197. $requiredVendor = substr($requiredPackage, 0, $pos);
  10198. $aIsSameVendor = strpos($a->getName(), $requiredVendor) === 0;
  10199. $bIsSameVendor = strpos($b->getName(), $requiredVendor) === 0;
  10200. if ($bIsSameVendor !== $aIsSameVendor) {
  10201. return $aIsSameVendor ? -1 : 1;
  10202. }
  10203. }
  10204. }
  10205. if ($a->id === $b->id) {
  10206. return 0;
  10207. }
  10208. return ($a->id < $b->id) ? -1 : 1;
  10209. }
  10210. protected function replaces(BasePackage $source, BasePackage $target): bool
  10211. {
  10212. foreach ($source->getReplaces() as $link) {
  10213. if ($link->getTarget() === $target->getName()
  10214. ) {
  10215. return true;
  10216. }
  10217. }
  10218. return false;
  10219. }
  10220. protected function pruneToBestVersion(Pool $pool, array $literals): array
  10221. {
  10222. $operator = $this->preferLowest ? '<' : '>';
  10223. $bestLiterals = array($literals[0]);
  10224. $bestPackage = $pool->literalToPackage($literals[0]);
  10225. foreach ($literals as $i => $literal) {
  10226. if (0 === $i) {
  10227. continue;
  10228. }
  10229. $package = $pool->literalToPackage($literal);
  10230. if ($this->versionCompare($package, $bestPackage, $operator)) {
  10231. $bestPackage = $package;
  10232. $bestLiterals = array($literal);
  10233. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  10234. $bestLiterals[] = $literal;
  10235. }
  10236. }
  10237. return $bestLiterals;
  10238. }
  10239. protected function pruneRemoteAliases(Pool $pool, array $literals): array
  10240. {
  10241. $hasLocalAlias = false;
  10242. foreach ($literals as $literal) {
  10243. $package = $pool->literalToPackage($literal);
  10244. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  10245. $hasLocalAlias = true;
  10246. break;
  10247. }
  10248. }
  10249. if (!$hasLocalAlias) {
  10250. return $literals;
  10251. }
  10252. $selected = array();
  10253. foreach ($literals as $literal) {
  10254. $package = $pool->literalToPackage($literal);
  10255. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  10256. $selected[] = $literal;
  10257. }
  10258. }
  10259. return $selected;
  10260. }
  10261. }
  10262. <?php declare(strict_types=1);
  10263. namespace Composer\DependencyResolver;
  10264. class GenericRule extends Rule
  10265. {
  10266. protected $literals;
  10267. public function __construct(array $literals, $reason, $reasonData)
  10268. {
  10269. parent::__construct($reason, $reasonData);
  10270. sort($literals);
  10271. $this->literals = $literals;
  10272. }
  10273. public function getLiterals(): array
  10274. {
  10275. return $this->literals;
  10276. }
  10277. public function getHash()
  10278. {
  10279. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  10280. return $data['hash'];
  10281. }
  10282. public function equals(Rule $rule): bool
  10283. {
  10284. return $this->literals === $rule->getLiterals();
  10285. }
  10286. public function isAssertion(): bool
  10287. {
  10288. return 1 === \count($this->literals);
  10289. }
  10290. public function __toString(): string
  10291. {
  10292. $result = $this->isDisabled() ? 'disabled(' : '(';
  10293. foreach ($this->literals as $i => $literal) {
  10294. if ($i != 0) {
  10295. $result .= '|';
  10296. }
  10297. $result .= $literal;
  10298. }
  10299. $result .= ')';
  10300. return $result;
  10301. }
  10302. }
  10303. <?php declare(strict_types=1);
  10304. namespace Composer\DependencyResolver;
  10305. use Composer\Repository\InstalledRepositoryInterface;
  10306. use Composer\Repository\RepositoryInterface;
  10307. class LocalRepoTransaction extends Transaction
  10308. {
  10309. public function __construct(RepositoryInterface $lockedRepository, InstalledRepositoryInterface $localRepository)
  10310. {
  10311. parent::__construct(
  10312. $localRepository->getPackages(),
  10313. $lockedRepository->getPackages()
  10314. );
  10315. }
  10316. }
  10317. <?php declare(strict_types=1);
  10318. namespace Composer\DependencyResolver;
  10319. use Composer\Package\AliasPackage;
  10320. use Composer\Package\BasePackage;
  10321. use Composer\Package\Package;
  10322. class LockTransaction extends Transaction
  10323. {
  10324. protected $presentMap;
  10325. protected $unlockableMap;
  10326. protected $resultPackages;
  10327. public function __construct(Pool $pool, array $presentMap, array $unlockableMap, Decisions $decisions)
  10328. {
  10329. $this->presentMap = $presentMap;
  10330. $this->unlockableMap = $unlockableMap;
  10331. $this->setResultPackages($pool, $decisions);
  10332. parent::__construct($this->presentMap, $this->resultPackages['all']);
  10333. }
  10334. public function setResultPackages(Pool $pool, Decisions $decisions): void
  10335. {
  10336. $this->resultPackages = array('all' => array(), 'non-dev' => array(), 'dev' => array());
  10337. foreach ($decisions as $i => $decision) {
  10338. $literal = $decision[Decisions::DECISION_LITERAL];
  10339. if ($literal > 0) {
  10340. $package = $pool->literalToPackage($literal);
  10341. $this->resultPackages['all'][] = $package;
  10342. if (!isset($this->unlockableMap[$package->id])) {
  10343. $this->resultPackages['non-dev'][] = $package;
  10344. }
  10345. }
  10346. }
  10347. }
  10348. public function setNonDevPackages(LockTransaction $extractionResult): void
  10349. {
  10350. $packages = $extractionResult->getNewLockPackages(false);
  10351. $this->resultPackages['dev'] = $this->resultPackages['non-dev'];
  10352. $this->resultPackages['non-dev'] = array();
  10353. foreach ($packages as $package) {
  10354. foreach ($this->resultPackages['dev'] as $i => $resultPackage) {
  10355. if ($package->getName() == $resultPackage->getName()) {
  10356. $this->resultPackages['non-dev'][] = $resultPackage;
  10357. unset($this->resultPackages['dev'][$i]);
  10358. }
  10359. }
  10360. }
  10361. }
  10362. public function getNewLockPackages(bool $devMode, bool $updateMirrors = false): array
  10363. {
  10364. $packages = array();
  10365. foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
  10366. if (!$package instanceof AliasPackage) {
  10367. if ($updateMirrors && !isset($this->presentMap[spl_object_hash($package)])) {
  10368. foreach ($this->presentMap as $presentPackage) {
  10369. if ($package->getName() == $presentPackage->getName() && $package->getVersion() == $presentPackage->getVersion()) {
  10370. if ($presentPackage->getSourceReference() && $presentPackage->getSourceType() === $package->getSourceType()) {
  10371. $package->setSourceDistReferences($presentPackage->getSourceReference());
  10372. }
  10373. if ($presentPackage->getReleaseDate() !== null && $package instanceof Package) {
  10374. $package->setReleaseDate($presentPackage->getReleaseDate());
  10375. }
  10376. }
  10377. }
  10378. }
  10379. $packages[] = $package;
  10380. }
  10381. }
  10382. return $packages;
  10383. }
  10384. public function getAliases(array $aliases): array
  10385. {
  10386. $usedAliases = array();
  10387. foreach ($this->resultPackages['all'] as $package) {
  10388. if ($package instanceof AliasPackage) {
  10389. foreach ($aliases as $index => $alias) {
  10390. if ($alias['package'] === $package->getName()) {
  10391. $usedAliases[] = $alias;
  10392. unset($aliases[$index]);
  10393. }
  10394. }
  10395. }
  10396. }
  10397. usort($usedAliases, function ($a, $b): int {
  10398. return strcmp($a['package'], $b['package']);
  10399. });
  10400. return $usedAliases;
  10401. }
  10402. }
  10403. <?php declare(strict_types=1);
  10404. namespace Composer\DependencyResolver;
  10405. class MultiConflictRule extends Rule
  10406. {
  10407. protected $literals;
  10408. public function __construct(array $literals, $reason, $reasonData)
  10409. {
  10410. parent::__construct($reason, $reasonData);
  10411. if (\count($literals) < 3) {
  10412. throw new \RuntimeException("multi conflict rule requires at least 3 literals");
  10413. }
  10414. sort($literals);
  10415. $this->literals = $literals;
  10416. }
  10417. public function getLiterals(): array
  10418. {
  10419. return $this->literals;
  10420. }
  10421. public function getHash()
  10422. {
  10423. $data = unpack('ihash', md5('c:'.implode(',', $this->literals), true));
  10424. return $data['hash'];
  10425. }
  10426. public function equals(Rule $rule): bool
  10427. {
  10428. if ($rule instanceof MultiConflictRule) {
  10429. return $this->literals === $rule->getLiterals();
  10430. }
  10431. return false;
  10432. }
  10433. public function isAssertion(): bool
  10434. {
  10435. return false;
  10436. }
  10437. public function disable(): void
  10438. {
  10439. throw new \RuntimeException("Disabling multi conflict rules is not possible. Please contact composer at https://github.com/composer/composer to let us debug what lead to this situation.");
  10440. }
  10441. public function __toString(): string
  10442. {
  10443. $result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
  10444. foreach ($this->literals as $i => $literal) {
  10445. if ($i != 0) {
  10446. $result .= '|';
  10447. }
  10448. $result .= $literal;
  10449. }
  10450. $result .= '))';
  10451. return $result;
  10452. }
  10453. }
  10454. <?php declare(strict_types=1);
  10455. namespace Composer\DependencyResolver\Operation;
  10456. use Composer\Package\PackageInterface;
  10457. class InstallOperation extends SolverOperation implements OperationInterface
  10458. {
  10459. protected const TYPE = 'install';
  10460. protected $package;
  10461. public function __construct(PackageInterface $package)
  10462. {
  10463. $this->package = $package;
  10464. }
  10465. public function getPackage(): PackageInterface
  10466. {
  10467. return $this->package;
  10468. }
  10469. public function show($lock): string
  10470. {
  10471. return self::format($this->package, $lock);
  10472. }
  10473. public static function format(PackageInterface $package, bool $lock = false): string
  10474. {
  10475. return ($lock ? 'Locking ' : 'Installing ').'<info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
  10476. }
  10477. }
  10478. <?php declare(strict_types=1);
  10479. namespace Composer\DependencyResolver\Operation;
  10480. use Composer\Package\AliasPackage;
  10481. class MarkAliasInstalledOperation extends SolverOperation implements OperationInterface
  10482. {
  10483. protected const TYPE = 'markAliasInstalled';
  10484. protected $package;
  10485. public function __construct(AliasPackage $package)
  10486. {
  10487. $this->package = $package;
  10488. }
  10489. public function getPackage(): AliasPackage
  10490. {
  10491. return $this->package;
  10492. }
  10493. public function show($lock): string
  10494. {
  10495. return 'Marking <info>'.$this->package->getPrettyName().'</info> (<comment>'.$this->package->getFullPrettyVersion().'</comment>) as installed, alias of <info>'.$this->package->getAliasOf()->getPrettyName().'</info> (<comment>'.$this->package->getAliasOf()->getFullPrettyVersion().'</comment>)';
  10496. }
  10497. }
  10498. <?php declare(strict_types=1);
  10499. namespace Composer\DependencyResolver\Operation;
  10500. use Composer\Package\AliasPackage;
  10501. class MarkAliasUninstalledOperation extends SolverOperation implements OperationInterface
  10502. {
  10503. protected const TYPE = 'markAliasUninstalled';
  10504. protected $package;
  10505. public function __construct(AliasPackage $package)
  10506. {
  10507. $this->package = $package;
  10508. }
  10509. public function getPackage(): AliasPackage
  10510. {
  10511. return $this->package;
  10512. }
  10513. public function show($lock): string
  10514. {
  10515. return 'Marking <info>'.$this->package->getPrettyName().'</info> (<comment>'.$this->package->getFullPrettyVersion().'</comment>) as uninstalled, alias of <info>'.$this->package->getAliasOf()->getPrettyName().'</info> (<comment>'.$this->package->getAliasOf()->getFullPrettyVersion().'</comment>)';
  10516. }
  10517. }
  10518. <?php declare(strict_types=1);
  10519. namespace Composer\DependencyResolver\Operation;
  10520. interface OperationInterface
  10521. {
  10522. public function getOperationType();
  10523. public function show(bool $lock);
  10524. public function __toString();
  10525. }
  10526. <?php declare(strict_types=1);
  10527. namespace Composer\DependencyResolver\Operation;
  10528. abstract class SolverOperation implements OperationInterface
  10529. {
  10530. protected const TYPE = '';
  10531. public function getOperationType(): string
  10532. {
  10533. return static::TYPE;
  10534. }
  10535. public function __toString()
  10536. {
  10537. return $this->show(false);
  10538. }
  10539. }
  10540. <?php declare(strict_types=1);
  10541. namespace Composer\DependencyResolver\Operation;
  10542. use Composer\Package\PackageInterface;
  10543. class UninstallOperation extends SolverOperation implements OperationInterface
  10544. {
  10545. protected const TYPE = 'uninstall';
  10546. protected $package;
  10547. public function __construct(PackageInterface $package)
  10548. {
  10549. $this->package = $package;
  10550. }
  10551. public function getPackage(): PackageInterface
  10552. {
  10553. return $this->package;
  10554. }
  10555. public function show($lock): string
  10556. {
  10557. return self::format($this->package, $lock);
  10558. }
  10559. public static function format(PackageInterface $package, bool $lock = false): string
  10560. {
  10561. return 'Removing <info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
  10562. }
  10563. }
  10564. <?php declare(strict_types=1);
  10565. namespace Composer\DependencyResolver\Operation;
  10566. use Composer\Package\PackageInterface;
  10567. use Composer\Package\Version\VersionParser;
  10568. class UpdateOperation extends SolverOperation implements OperationInterface
  10569. {
  10570. protected const TYPE = 'update';
  10571. protected $initialPackage;
  10572. protected $targetPackage;
  10573. public function __construct(PackageInterface $initial, PackageInterface $target)
  10574. {
  10575. $this->initialPackage = $initial;
  10576. $this->targetPackage = $target;
  10577. }
  10578. public function getInitialPackage(): PackageInterface
  10579. {
  10580. return $this->initialPackage;
  10581. }
  10582. public function getTargetPackage(): PackageInterface
  10583. {
  10584. return $this->targetPackage;
  10585. }
  10586. public function show($lock): string
  10587. {
  10588. return self::format($this->initialPackage, $this->targetPackage, $lock);
  10589. }
  10590. public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, bool $lock = false): string
  10591. {
  10592. $fromVersion = $initialPackage->getFullPrettyVersion();
  10593. $toVersion = $targetPackage->getFullPrettyVersion();
  10594. if ($fromVersion === $toVersion && $initialPackage->getSourceReference() !== $targetPackage->getSourceReference()) {
  10595. $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
  10596. $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
  10597. } elseif ($fromVersion === $toVersion && $initialPackage->getDistReference() !== $targetPackage->getDistReference()) {
  10598. $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
  10599. $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
  10600. }
  10601. $actionName = VersionParser::isUpgrade($initialPackage->getVersion(), $targetPackage->getVersion()) ? 'Upgrading' : 'Downgrading';
  10602. return $actionName.' <info>'.$initialPackage->getPrettyName().'</info> (<comment>'.$fromVersion.'</comment> => <comment>'.$toVersion.'</comment>)';
  10603. }
  10604. }
  10605. <?php declare(strict_types=1);
  10606. namespace Composer\DependencyResolver;
  10607. use Composer\Package\PackageInterface;
  10608. use Composer\Semver\Constraint\Constraint;
  10609. interface PolicyInterface
  10610. {
  10611. public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool;
  10612. public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array;
  10613. }
  10614. <?php declare(strict_types=1);
  10615. namespace Composer\DependencyResolver;
  10616. use Composer\Package\BasePackage;
  10617. use Composer\Package\Version\VersionParser;
  10618. use Composer\Semver\CompilingMatcher;
  10619. use Composer\Semver\Constraint\ConstraintInterface;
  10620. use Composer\Semver\Constraint\Constraint;
  10621. class Pool implements \Countable
  10622. {
  10623. protected $packages = array();
  10624. protected $packageByName = array();
  10625. protected $versionParser;
  10626. protected $providerCache = array();
  10627. protected $unacceptableFixedOrLockedPackages;
  10628. protected $removedVersions = array();
  10629. protected $removedVersionsByPackage = array();
  10630. public function __construct(array $packages = array(), array $unacceptableFixedOrLockedPackages = array(), array $removedVersions = array(), array $removedVersionsByPackage = array())
  10631. {
  10632. $this->versionParser = new VersionParser;
  10633. $this->setPackages($packages);
  10634. $this->unacceptableFixedOrLockedPackages = $unacceptableFixedOrLockedPackages;
  10635. $this->removedVersions = $removedVersions;
  10636. $this->removedVersionsByPackage = $removedVersionsByPackage;
  10637. }
  10638. public function getRemovedVersions(string $name, ConstraintInterface $constraint): array
  10639. {
  10640. if (!isset($this->removedVersions[$name])) {
  10641. return array();
  10642. }
  10643. $result = array();
  10644. foreach ($this->removedVersions[$name] as $version => $prettyVersion) {
  10645. if ($constraint->matches(new Constraint('==', $version))) {
  10646. $result[$version] = $prettyVersion;
  10647. }
  10648. }
  10649. return $result;
  10650. }
  10651. public function getRemovedVersionsByPackage(string $objectHash): array
  10652. {
  10653. if (!isset($this->removedVersionsByPackage[$objectHash])) {
  10654. return array();
  10655. }
  10656. return $this->removedVersionsByPackage[$objectHash];
  10657. }
  10658. private function setPackages(array $packages): void
  10659. {
  10660. $id = 1;
  10661. foreach ($packages as $package) {
  10662. $this->packages[] = $package;
  10663. $package->id = $id++;
  10664. foreach ($package->getNames() as $provided) {
  10665. $this->packageByName[$provided][] = $package;
  10666. }
  10667. }
  10668. }
  10669. public function getPackages(): array
  10670. {
  10671. return $this->packages;
  10672. }
  10673. public function packageById(int $id): BasePackage
  10674. {
  10675. return $this->packages[$id - 1];
  10676. }
  10677. public function count(): int
  10678. {
  10679. return \count($this->packages);
  10680. }
  10681. public function whatProvides(string $name, ConstraintInterface $constraint = null): array
  10682. {
  10683. $key = (string) $constraint;
  10684. if (isset($this->providerCache[$name][$key])) {
  10685. return $this->providerCache[$name][$key];
  10686. }
  10687. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint);
  10688. }
  10689. private function computeWhatProvides(string $name, ConstraintInterface $constraint = null): array
  10690. {
  10691. if (!isset($this->packageByName[$name])) {
  10692. return array();
  10693. }
  10694. $matches = array();
  10695. foreach ($this->packageByName[$name] as $candidate) {
  10696. if ($this->match($candidate, $name, $constraint)) {
  10697. $matches[] = $candidate;
  10698. }
  10699. }
  10700. return $matches;
  10701. }
  10702. public function literalToPackage(int $literal): BasePackage
  10703. {
  10704. $packageId = abs($literal);
  10705. return $this->packageById($packageId);
  10706. }
  10707. public function literalToPrettyString(int $literal, array $installedMap): string
  10708. {
  10709. $package = $this->literalToPackage($literal);
  10710. if (isset($installedMap[$package->id])) {
  10711. $prefix = ($literal > 0 ? 'keep' : 'remove');
  10712. } else {
  10713. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  10714. }
  10715. return $prefix.' '.$package->getPrettyString();
  10716. }
  10717. public function match(BasePackage $candidate, string $name, ConstraintInterface $constraint = null): bool
  10718. {
  10719. $candidateName = $candidate->getName();
  10720. $candidateVersion = $candidate->getVersion();
  10721. if ($candidateName === $name) {
  10722. return $constraint === null || CompilingMatcher::match($constraint, Constraint::OP_EQ, $candidateVersion);
  10723. }
  10724. $provides = $candidate->getProvides();
  10725. $replaces = $candidate->getReplaces();
  10726. if (isset($replaces[0]) || isset($provides[0])) {
  10727. foreach ($provides as $link) {
  10728. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  10729. return true;
  10730. }
  10731. }
  10732. foreach ($replaces as $link) {
  10733. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  10734. return true;
  10735. }
  10736. }
  10737. return false;
  10738. }
  10739. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  10740. return true;
  10741. }
  10742. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  10743. return true;
  10744. }
  10745. return false;
  10746. }
  10747. public function isUnacceptableFixedOrLockedPackage(BasePackage $package): bool
  10748. {
  10749. return \in_array($package, $this->unacceptableFixedOrLockedPackages, true);
  10750. }
  10751. public function getUnacceptableFixedOrLockedPackages(): array
  10752. {
  10753. return $this->unacceptableFixedOrLockedPackages;
  10754. }
  10755. public function __toString(): string
  10756. {
  10757. $str = "Pool:\n";
  10758. foreach ($this->packages as $package) {
  10759. $str .= '- '.str_pad((string) $package->id, 6, ' ', STR_PAD_LEFT).': '.$package->getName()."\n";
  10760. }
  10761. return $str;
  10762. }
  10763. }
  10764. <?php declare(strict_types=1);
  10765. namespace Composer\DependencyResolver;
  10766. use Composer\EventDispatcher\EventDispatcher;
  10767. use Composer\IO\IOInterface;
  10768. use Composer\Package\AliasPackage;
  10769. use Composer\Package\BasePackage;
  10770. use Composer\Package\CompleteAliasPackage;
  10771. use Composer\Package\CompletePackage;
  10772. use Composer\Package\PackageInterface;
  10773. use Composer\Package\Version\StabilityFilter;
  10774. use Composer\Pcre\Preg;
  10775. use Composer\Plugin\PluginEvents;
  10776. use Composer\Plugin\PrePoolCreateEvent;
  10777. use Composer\Repository\PlatformRepository;
  10778. use Composer\Repository\RepositoryInterface;
  10779. use Composer\Repository\RootPackageRepository;
  10780. use Composer\Semver\CompilingMatcher;
  10781. use Composer\Semver\Constraint\Constraint;
  10782. use Composer\Semver\Constraint\ConstraintInterface;
  10783. use Composer\Semver\Constraint\MatchAllConstraint;
  10784. use Composer\Semver\Constraint\MultiConstraint;
  10785. use Composer\Semver\Intervals;
  10786. class PoolBuilder
  10787. {
  10788. private $acceptableStabilities;
  10789. private $stabilityFlags;
  10790. private $rootAliases;
  10791. private $rootReferences;
  10792. private $eventDispatcher;
  10793. private $poolOptimizer;
  10794. private $io;
  10795. private $aliasMap = array();
  10796. private $packagesToLoad = array();
  10797. private $loadedPackages = array();
  10798. private $loadedPerRepo = array();
  10799. private $packages = array();
  10800. private $unacceptableFixedOrLockedPackages = array();
  10801. private $updateAllowList = array();
  10802. private $skippedLoad = array();
  10803. private $pathRepoUnlocked = array();
  10804. private $maxExtendedReqs = array();
  10805. private $updateAllowWarned = array();
  10806. private $indexCounter = 0;
  10807. public function __construct(array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, IOInterface $io, EventDispatcher $eventDispatcher = null, PoolOptimizer $poolOptimizer = null)
  10808. {
  10809. $this->acceptableStabilities = $acceptableStabilities;
  10810. $this->stabilityFlags = $stabilityFlags;
  10811. $this->rootAliases = $rootAliases;
  10812. $this->rootReferences = $rootReferences;
  10813. $this->eventDispatcher = $eventDispatcher;
  10814. $this->poolOptimizer = $poolOptimizer;
  10815. $this->io = $io;
  10816. }
  10817. public function buildPool(array $repositories, Request $request): Pool
  10818. {
  10819. if ($request->getUpdateAllowList()) {
  10820. $this->updateAllowList = $request->getUpdateAllowList();
  10821. $this->warnAboutNonMatchingUpdateAllowList($request);
  10822. foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) {
  10823. if (!$this->isUpdateAllowed($lockedPackage)) {
  10824. $this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage;
  10825. foreach ($lockedPackage->getReplaces() as $link) {
  10826. $this->skippedLoad[$link->getTarget()][] = $lockedPackage;
  10827. }
  10828. if ($lockedPackage->getDistType() === 'path') {
  10829. $transportOptions = $lockedPackage->getTransportOptions();
  10830. if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
  10831. $this->pathRepoUnlocked[$lockedPackage->getName()] = true;
  10832. continue;
  10833. }
  10834. }
  10835. $request->lockPackage($lockedPackage);
  10836. }
  10837. }
  10838. }
  10839. foreach ($request->getFixedOrLockedPackages() as $package) {
  10840. $this->loadedPackages[$package->getName()] = new MatchAllConstraint();
  10841. foreach ($package->getReplaces() as $link) {
  10842. $this->loadedPackages[$link->getTarget()] = new MatchAllConstraint();
  10843. }
  10844. if (
  10845. $package->getRepository() instanceof RootPackageRepository
  10846. || $package->getRepository() instanceof PlatformRepository
  10847. || StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $package->getNames(), $package->getStability())
  10848. ) {
  10849. $this->loadPackage($request, $repositories, $package, false);
  10850. } else {
  10851. $this->unacceptableFixedOrLockedPackages[] = $package;
  10852. }
  10853. }
  10854. foreach ($request->getRequires() as $packageName => $constraint) {
  10855. if (isset($this->loadedPackages[$packageName])) {
  10856. continue;
  10857. }
  10858. $this->packagesToLoad[$packageName] = $constraint;
  10859. $this->maxExtendedReqs[$packageName] = true;
  10860. }
  10861. foreach ($this->packagesToLoad as $name => $constraint) {
  10862. if (isset($this->loadedPackages[$name])) {
  10863. unset($this->packagesToLoad[$name]);
  10864. }
  10865. }
  10866. while (!empty($this->packagesToLoad)) {
  10867. $this->loadPackagesMarkedForLoading($request, $repositories);
  10868. }
  10869. foreach ($this->packages as $i => $package) {
  10870. if (!$package instanceof AliasPackage) {
  10871. $constraint = new Constraint('==', $package->getVersion());
  10872. $aliasedPackages = array($i => $package);
  10873. if (isset($this->aliasMap[spl_object_hash($package)])) {
  10874. $aliasedPackages += $this->aliasMap[spl_object_hash($package)];
  10875. }
  10876. $found = false;
  10877. foreach ($aliasedPackages as $packageOrAlias) {
  10878. if (CompilingMatcher::match($constraint, Constraint::OP_EQ, $packageOrAlias->getVersion())) {
  10879. $found = true;
  10880. }
  10881. }
  10882. if (!$found) {
  10883. foreach ($aliasedPackages as $index => $packageOrAlias) {
  10884. unset($this->packages[$index]);
  10885. }
  10886. }
  10887. }
  10888. }
  10889. if ($this->eventDispatcher) {
  10890. $prePoolCreateEvent = new PrePoolCreateEvent(
  10891. PluginEvents::PRE_POOL_CREATE,
  10892. $repositories,
  10893. $request,
  10894. $this->acceptableStabilities,
  10895. $this->stabilityFlags,
  10896. $this->rootAliases,
  10897. $this->rootReferences,
  10898. $this->packages,
  10899. $this->unacceptableFixedOrLockedPackages
  10900. );
  10901. $this->eventDispatcher->dispatch($prePoolCreateEvent->getName(), $prePoolCreateEvent);
  10902. $this->packages = $prePoolCreateEvent->getPackages();
  10903. $this->unacceptableFixedOrLockedPackages = $prePoolCreateEvent->getUnacceptableFixedPackages();
  10904. }
  10905. $pool = new Pool($this->packages, $this->unacceptableFixedOrLockedPackages);
  10906. $this->aliasMap = array();
  10907. $this->packagesToLoad = array();
  10908. $this->loadedPackages = array();
  10909. $this->loadedPerRepo = array();
  10910. $this->packages = array();
  10911. $this->unacceptableFixedOrLockedPackages = array();
  10912. $this->maxExtendedReqs = array();
  10913. $this->skippedLoad = array();
  10914. $this->indexCounter = 0;
  10915. $this->io->debug('Built pool.');
  10916. $pool = $this->runOptimizer($request, $pool);
  10917. Intervals::clear();
  10918. return $pool;
  10919. }
  10920. private function markPackageNameForLoading(Request $request, string $name, ConstraintInterface $constraint): void
  10921. {
  10922. if (PlatformRepository::isPlatformPackage($name)) {
  10923. return;
  10924. }
  10925. if (isset($this->maxExtendedReqs[$name])) {
  10926. return;
  10927. }
  10928. $rootRequires = $request->getRequires();
  10929. if (isset($rootRequires[$name]) && !Intervals::isSubsetOf($constraint, $rootRequires[$name])) {
  10930. $constraint = $rootRequires[$name];
  10931. }
  10932. if (!isset($this->loadedPackages[$name])) {
  10933. if (isset($this->packagesToLoad[$name])) {
  10934. if (Intervals::isSubsetOf($constraint, $this->packagesToLoad[$name])) {
  10935. return;
  10936. }
  10937. $constraint = Intervals::compactConstraint(MultiConstraint::create(array($this->packagesToLoad[$name], $constraint), false));
  10938. }
  10939. $this->packagesToLoad[$name] = $constraint;
  10940. return;
  10941. }
  10942. if (Intervals::isSubsetOf($constraint, $this->loadedPackages[$name])) {
  10943. return;
  10944. }
  10945. $this->packagesToLoad[$name] = Intervals::compactConstraint(MultiConstraint::create(array($this->loadedPackages[$name], $constraint), false));
  10946. unset($this->loadedPackages[$name]);
  10947. }
  10948. private function loadPackagesMarkedForLoading(Request $request, array $repositories): void
  10949. {
  10950. foreach ($this->packagesToLoad as $name => $constraint) {
  10951. $this->loadedPackages[$name] = $constraint;
  10952. }
  10953. $packageBatch = $this->packagesToLoad;
  10954. $this->packagesToLoad = array();
  10955. foreach ($repositories as $repoIndex => $repository) {
  10956. if (empty($packageBatch)) {
  10957. break;
  10958. }
  10959. if ($repository instanceof PlatformRepository || $repository === $request->getLockedRepository()) {
  10960. continue;
  10961. }
  10962. $result = $repository->loadPackages($packageBatch, $this->acceptableStabilities, $this->stabilityFlags, $this->loadedPerRepo[$repoIndex] ?? array());
  10963. foreach ($result['namesFound'] as $name) {
  10964. unset($packageBatch[$name]);
  10965. }
  10966. foreach ($result['packages'] as $package) {
  10967. $this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()] = $package;
  10968. $this->loadPackage($request, $repositories, $package, !isset($this->pathRepoUnlocked[$package->getName()]));
  10969. }
  10970. }
  10971. }
  10972. private function loadPackage(Request $request, array $repositories, BasePackage $package, bool $propagateUpdate): void
  10973. {
  10974. $index = $this->indexCounter++;
  10975. $this->packages[$index] = $package;
  10976. if ($package instanceof AliasPackage) {
  10977. $this->aliasMap[spl_object_hash($package->getAliasOf())][$index] = $package;
  10978. }
  10979. $name = $package->getName();
  10980. if (isset($this->rootReferences[$name])) {
  10981. if (!$request->isLockedPackage($package) && !$request->isFixedPackage($package)) {
  10982. $package->setSourceDistReferences($this->rootReferences[$name]);
  10983. }
  10984. }
  10985. if ($propagateUpdate && isset($this->rootAliases[$name][$package->getVersion()])) {
  10986. $alias = $this->rootAliases[$name][$package->getVersion()];
  10987. if ($package instanceof AliasPackage) {
  10988. $basePackage = $package->getAliasOf();
  10989. } else {
  10990. $basePackage = $package;
  10991. }
  10992. if ($basePackage instanceof CompletePackage) {
  10993. $aliasPackage = new CompleteAliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
  10994. } else {
  10995. $aliasPackage = new AliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
  10996. }
  10997. $aliasPackage->setRootPackageAlias(true);
  10998. $newIndex = $this->indexCounter++;
  10999. $this->packages[$newIndex] = $aliasPackage;
  11000. $this->aliasMap[spl_object_hash($aliasPackage->getAliasOf())][$newIndex] = $aliasPackage;
  11001. }
  11002. foreach ($package->getRequires() as $link) {
  11003. $require = $link->getTarget();
  11004. $linkConstraint = $link->getConstraint();
  11005. if (isset($this->skippedLoad[$require])) {
  11006. if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
  11007. $skippedRootRequires = $this->getSkippedRootRequires($request, $require);
  11008. if ($request->getUpdateAllowTransitiveRootDependencies() || !$skippedRootRequires) {
  11009. $this->unlockPackage($request, $repositories, $require);
  11010. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  11011. } else {
  11012. foreach ($skippedRootRequires as $rootRequire) {
  11013. if (!isset($this->updateAllowWarned[$rootRequire])) {
  11014. $this->updateAllowWarned[$rootRequire] = true;
  11015. $this->io->writeError('<warning>Dependency '.$rootRequire.' is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>');
  11016. }
  11017. }
  11018. }
  11019. } elseif (isset($this->pathRepoUnlocked[$require]) && !isset($this->loadedPackages[$require])) {
  11020. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  11021. }
  11022. } else {
  11023. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  11024. }
  11025. }
  11026. if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
  11027. foreach ($package->getReplaces() as $link) {
  11028. $replace = $link->getTarget();
  11029. if (isset($this->loadedPackages[$replace], $this->skippedLoad[$replace])) {
  11030. $skippedRootRequires = $this->getSkippedRootRequires($request, $replace);
  11031. if ($request->getUpdateAllowTransitiveRootDependencies() || !$skippedRootRequires) {
  11032. $this->unlockPackage($request, $repositories, $replace);
  11033. $this->markPackageNameForLoading($request, $replace, $link->getConstraint());
  11034. } else {
  11035. foreach ($skippedRootRequires as $rootRequire) {
  11036. if (!isset($this->updateAllowWarned[$rootRequire])) {
  11037. $this->updateAllowWarned[$rootRequire] = true;
  11038. $this->io->writeError('<warning>Dependency '.$rootRequire.' is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>');
  11039. }
  11040. }
  11041. }
  11042. }
  11043. }
  11044. }
  11045. }
  11046. private function isRootRequire(Request $request, string $name): bool
  11047. {
  11048. $rootRequires = $request->getRequires();
  11049. return isset($rootRequires[$name]);
  11050. }
  11051. private function getSkippedRootRequires(Request $request, string $name): array
  11052. {
  11053. if (!isset($this->skippedLoad[$name])) {
  11054. return array();
  11055. }
  11056. $rootRequires = $request->getRequires();
  11057. $matches = array();
  11058. if (isset($rootRequires[$name])) {
  11059. return array_map(function (PackageInterface $package) use ($name): string {
  11060. if ($name !== $package->getName()) {
  11061. return $package->getName() .' (via replace of '.$name.')';
  11062. }
  11063. return $package->getName();
  11064. }, $this->skippedLoad[$name]);
  11065. }
  11066. foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
  11067. if (isset($rootRequires[$packageOrReplacer->getName()])) {
  11068. $matches[] = $packageOrReplacer->getName();
  11069. }
  11070. foreach ($packageOrReplacer->getReplaces() as $link) {
  11071. if (isset($rootRequires[$link->getTarget()])) {
  11072. if ($name !== $packageOrReplacer->getName()) {
  11073. $matches[] = $packageOrReplacer->getName() .' (via replace of '.$name.')';
  11074. } else {
  11075. $matches[] = $packageOrReplacer->getName();
  11076. }
  11077. break;
  11078. }
  11079. }
  11080. }
  11081. return $matches;
  11082. }
  11083. private function isUpdateAllowed(BasePackage $package): bool
  11084. {
  11085. foreach ($this->updateAllowList as $pattern => $void) {
  11086. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  11087. if (Preg::isMatch($patternRegexp, $package->getName())) {
  11088. return true;
  11089. }
  11090. }
  11091. return false;
  11092. }
  11093. private function warnAboutNonMatchingUpdateAllowList(Request $request): void
  11094. {
  11095. foreach ($this->updateAllowList as $pattern => $void) {
  11096. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  11097. foreach ($request->getLockedRepository()->getPackages() as $package) {
  11098. if (Preg::isMatch($patternRegexp, $package->getName())) {
  11099. continue 2;
  11100. }
  11101. }
  11102. foreach ($request->getRequires() as $packageName => $constraint) {
  11103. if (Preg::isMatch($patternRegexp, $packageName)) {
  11104. continue 2;
  11105. }
  11106. }
  11107. if (strpos($pattern, '*') !== false) {
  11108. $this->io->writeError('<warning>Pattern "' . $pattern . '" listed for update does not match any locked packages.</warning>');
  11109. } else {
  11110. $this->io->writeError('<warning>Package "' . $pattern . '" listed for update is not locked.</warning>');
  11111. }
  11112. }
  11113. }
  11114. private function unlockPackage(Request $request, array $repositories, string $name): void
  11115. {
  11116. foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
  11117. if ($packageOrReplacer->getName() !== $name && isset($this->skippedLoad[$packageOrReplacer->getName()])) {
  11118. $replacerName = $packageOrReplacer->getName();
  11119. if ($request->getUpdateAllowTransitiveRootDependencies() || (!$this->isRootRequire($request, $name) && !$this->isRootRequire($request, $replacerName))) {
  11120. $this->unlockPackage($request, $repositories, $replacerName);
  11121. if ($this->isRootRequire($request, $replacerName)) {
  11122. $this->markPackageNameForLoading($request, $replacerName, new MatchAllConstraint);
  11123. } else {
  11124. foreach ($this->packages as $loadedPackage) {
  11125. $requires = $loadedPackage->getRequires();
  11126. if (isset($requires[$replacerName])) {
  11127. $this->markPackageNameForLoading($request, $replacerName, $requires[$replacerName]->getConstraint());
  11128. }
  11129. }
  11130. }
  11131. }
  11132. }
  11133. }
  11134. if (isset($this->pathRepoUnlocked[$name])) {
  11135. foreach ($this->packages as $index => $package) {
  11136. if ($package->getName() === $name) {
  11137. $this->removeLoadedPackage($request, $repositories, $package, $index);
  11138. }
  11139. }
  11140. }
  11141. unset($this->skippedLoad[$name], $this->loadedPackages[$name], $this->maxExtendedReqs[$name], $this->pathRepoUnlocked[$name]);
  11142. foreach ($request->getLockedPackages() as $lockedPackage) {
  11143. if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) {
  11144. if (false !== $index = array_search($lockedPackage, $this->packages, true)) {
  11145. $request->unlockPackage($lockedPackage);
  11146. $this->removeLoadedPackage($request, $repositories, $lockedPackage, $index);
  11147. foreach ($request->getFixedOrLockedPackages() as $fixedOrLockedPackage) {
  11148. if ($fixedOrLockedPackage === $lockedPackage) {
  11149. continue;
  11150. }
  11151. if (isset($this->skippedLoad[$fixedOrLockedPackage->getName()])) {
  11152. $requires = $fixedOrLockedPackage->getRequires();
  11153. if (isset($requires[$lockedPackage->getName()])) {
  11154. $this->markPackageNameForLoading($request, $lockedPackage->getName(), $requires[$lockedPackage->getName()]->getConstraint());
  11155. }
  11156. }
  11157. }
  11158. }
  11159. }
  11160. }
  11161. }
  11162. private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, int $index): void
  11163. {
  11164. $repoIndex = array_search($package->getRepository(), $repositories, true);
  11165. unset($this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()]);
  11166. unset($this->packages[$index]);
  11167. if (isset($this->aliasMap[spl_object_hash($package)])) {
  11168. foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) {
  11169. unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]);
  11170. unset($this->packages[$aliasIndex]);
  11171. }
  11172. unset($this->aliasMap[spl_object_hash($package)]);
  11173. }
  11174. }
  11175. private function runOptimizer(Request $request, Pool $pool): Pool
  11176. {
  11177. if (null === $this->poolOptimizer) {
  11178. return $pool;
  11179. }
  11180. $this->io->debug('Running pool optimizer.');
  11181. $before = microtime(true);
  11182. $total = \count($pool->getPackages());
  11183. $pool = $this->poolOptimizer->optimize($request, $pool);
  11184. $filtered = $total - \count($pool->getPackages());
  11185. if (0 === $filtered) {
  11186. return $pool;
  11187. }
  11188. $this->io->write(sprintf('Pool optimizer completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERY_VERBOSE);
  11189. $this->io->write(sprintf(
  11190. '<info>Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.</info>',
  11191. number_format($total),
  11192. number_format($filtered),
  11193. round(100 / $total * $filtered)
  11194. ), true, IOInterface::VERY_VERBOSE);
  11195. return $pool;
  11196. }
  11197. }
  11198. <?php declare(strict_types=1);
  11199. namespace Composer\DependencyResolver;
  11200. use Composer\Package\AliasPackage;
  11201. use Composer\Package\BasePackage;
  11202. use Composer\Package\Version\VersionParser;
  11203. use Composer\Semver\CompilingMatcher;
  11204. use Composer\Semver\Constraint\ConstraintInterface;
  11205. use Composer\Semver\Constraint\Constraint;
  11206. use Composer\Semver\Constraint\MultiConstraint;
  11207. use Composer\Semver\Intervals;
  11208. class PoolOptimizer
  11209. {
  11210. private $policy;
  11211. private $irremovablePackages = array();
  11212. private $requireConstraintsPerPackage = array();
  11213. private $conflictConstraintsPerPackage = array();
  11214. private $packagesToRemove = array();
  11215. private $aliasesPerPackage = array();
  11216. private $removedVersionsByPackage = array();
  11217. public function __construct(PolicyInterface $policy)
  11218. {
  11219. $this->policy = $policy;
  11220. }
  11221. public function optimize(Request $request, Pool $pool): Pool
  11222. {
  11223. $this->prepare($request, $pool);
  11224. $this->optimizeByIdenticalDependencies($request, $pool);
  11225. $this->optimizeImpossiblePackagesAway($request, $pool);
  11226. $optimizedPool = $this->applyRemovalsToPool($pool);
  11227. $this->irremovablePackages = array();
  11228. $this->requireConstraintsPerPackage = array();
  11229. $this->conflictConstraintsPerPackage = array();
  11230. $this->packagesToRemove = array();
  11231. $this->aliasesPerPackage = array();
  11232. $this->removedVersionsByPackage = array();
  11233. return $optimizedPool;
  11234. }
  11235. private function prepare(Request $request, Pool $pool): void
  11236. {
  11237. $irremovablePackageConstraintGroups = array();
  11238. foreach ($request->getFixedOrLockedPackages() as $package) {
  11239. $irremovablePackageConstraintGroups[$package->getName()][] = new Constraint('==', $package->getVersion());
  11240. }
  11241. foreach ($request->getRequires() as $require => $constraint) {
  11242. $this->extractRequireConstraintsPerPackage($require, $constraint);
  11243. }
  11244. foreach ($pool->getPackages() as $package) {
  11245. foreach ($package->getRequires() as $link) {
  11246. $this->extractRequireConstraintsPerPackage($link->getTarget(), $link->getConstraint());
  11247. }
  11248. foreach ($package->getConflicts() as $link) {
  11249. $this->extractConflictConstraintsPerPackage($link->getTarget(), $link->getConstraint());
  11250. }
  11251. if ($package instanceof AliasPackage) {
  11252. $this->aliasesPerPackage[$package->getAliasOf()->id][] = $package;
  11253. }
  11254. }
  11255. $irremovablePackageConstraints = array();
  11256. foreach ($irremovablePackageConstraintGroups as $packageName => $constraints) {
  11257. $irremovablePackageConstraints[$packageName] = 1 === \count($constraints) ? $constraints[0] : new MultiConstraint($constraints, false);
  11258. }
  11259. unset($irremovablePackageConstraintGroups);
  11260. foreach ($pool->getPackages() as $package) {
  11261. if (!isset($irremovablePackageConstraints[$package->getName()])) {
  11262. continue;
  11263. }
  11264. if (CompilingMatcher::match($irremovablePackageConstraints[$package->getName()], Constraint::OP_EQ, $package->getVersion())) {
  11265. $this->markPackageIrremovable($package);
  11266. }
  11267. }
  11268. }
  11269. private function markPackageIrremovable(BasePackage $package): void
  11270. {
  11271. $this->irremovablePackages[$package->id] = true;
  11272. if ($package instanceof AliasPackage) {
  11273. $this->markPackageIrremovable($package->getAliasOf());
  11274. }
  11275. if (isset($this->aliasesPerPackage[$package->id])) {
  11276. foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
  11277. $this->irremovablePackages[$aliasPackage->id] = true;
  11278. }
  11279. }
  11280. }
  11281. private function applyRemovalsToPool(Pool $pool): Pool
  11282. {
  11283. $packages = array();
  11284. $removedVersions = array();
  11285. foreach ($pool->getPackages() as $package) {
  11286. if (!isset($this->packagesToRemove[$package->id])) {
  11287. $packages[] = $package;
  11288. } else {
  11289. $removedVersions[$package->getName()][$package->getVersion()] = $package->getPrettyVersion();
  11290. }
  11291. }
  11292. $optimizedPool = new Pool($packages, $pool->getUnacceptableFixedOrLockedPackages(), $removedVersions, $this->removedVersionsByPackage);
  11293. return $optimizedPool;
  11294. }
  11295. private function optimizeByIdenticalDependencies(Request $request, Pool $pool): void
  11296. {
  11297. $identicalDefinitionsPerPackage = array();
  11298. $packageIdenticalDefinitionLookup = array();
  11299. foreach ($pool->getPackages() as $package) {
  11300. if (isset($this->irremovablePackages[$package->id])) {
  11301. continue;
  11302. }
  11303. $this->markPackageForRemoval($package->id);
  11304. $dependencyHash = $this->calculateDependencyHash($package);
  11305. foreach ($package->getNames(false) as $packageName) {
  11306. if (!isset($this->requireConstraintsPerPackage[$packageName])) {
  11307. continue;
  11308. }
  11309. foreach ($this->requireConstraintsPerPackage[$packageName] as $requireConstraint) {
  11310. $groupHashParts = array();
  11311. if (CompilingMatcher::match($requireConstraint, Constraint::OP_EQ, $package->getVersion())) {
  11312. $groupHashParts[] = 'require:' . (string) $requireConstraint;
  11313. }
  11314. if ($package->getReplaces()) {
  11315. foreach ($package->getReplaces() as $link) {
  11316. if (CompilingMatcher::match($link->getConstraint(), Constraint::OP_EQ, $package->getVersion())) {
  11317. $groupHashParts[] = 'require:' . (string) $link->getConstraint();
  11318. }
  11319. }
  11320. }
  11321. if (isset($this->conflictConstraintsPerPackage[$packageName])) {
  11322. foreach ($this->conflictConstraintsPerPackage[$packageName] as $conflictConstraint) {
  11323. if (CompilingMatcher::match($conflictConstraint, Constraint::OP_EQ, $package->getVersion())) {
  11324. $groupHashParts[] = 'conflict:' . (string) $conflictConstraint;
  11325. }
  11326. }
  11327. }
  11328. if (!$groupHashParts) {
  11329. continue;
  11330. }
  11331. $groupHash = implode('', $groupHashParts);
  11332. $identicalDefinitionsPerPackage[$packageName][$groupHash][$dependencyHash][] = $package;
  11333. $packageIdenticalDefinitionLookup[$package->id][$packageName] = array('groupHash' => $groupHash, 'dependencyHash' => $dependencyHash);
  11334. }
  11335. }
  11336. }
  11337. foreach ($identicalDefinitionsPerPackage as $constraintGroups) {
  11338. foreach ($constraintGroups as $constraintGroup) {
  11339. foreach ($constraintGroup as $packages) {
  11340. if (1 === \count($packages)) {
  11341. $this->keepPackage($packages[0], $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  11342. continue;
  11343. }
  11344. $literals = array();
  11345. foreach ($packages as $package) {
  11346. $literals[] = $package->id;
  11347. }
  11348. foreach ($this->policy->selectPreferredPackages($pool, $literals) as $preferredLiteral) {
  11349. $this->keepPackage($pool->literalToPackage($preferredLiteral), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  11350. }
  11351. }
  11352. }
  11353. }
  11354. }
  11355. private function calculateDependencyHash(BasePackage $package): string
  11356. {
  11357. $hash = '';
  11358. $hashRelevantLinks = array(
  11359. 'requires' => $package->getRequires(),
  11360. 'conflicts' => $package->getConflicts(),
  11361. 'replaces' => $package->getReplaces(),
  11362. 'provides' => $package->getProvides(),
  11363. );
  11364. foreach ($hashRelevantLinks as $key => $links) {
  11365. if (0 === \count($links)) {
  11366. continue;
  11367. }
  11368. $hash .= $key . ':';
  11369. $subhash = array();
  11370. foreach ($links as $link) {
  11371. $subhash[$link->getTarget()] = (string) $link->getConstraint();
  11372. }
  11373. ksort($subhash);
  11374. foreach ($subhash as $target => $constraint) {
  11375. $hash .= $target . '@' . $constraint;
  11376. }
  11377. }
  11378. return $hash;
  11379. }
  11380. private function markPackageForRemoval(int $id): void
  11381. {
  11382. if (isset($this->irremovablePackages[$id])) {
  11383. throw new \LogicException('Attempted removing a package which was previously marked irremovable');
  11384. }
  11385. $this->packagesToRemove[$id] = true;
  11386. }
  11387. private function keepPackage(BasePackage $package, array $identicalDefinitionsPerPackage, array $packageIdenticalDefinitionLookup): void
  11388. {
  11389. if (!isset($this->packagesToRemove[$package->id])) {
  11390. return;
  11391. }
  11392. unset($this->packagesToRemove[$package->id]);
  11393. if ($package instanceof AliasPackage) {
  11394. $this->keepPackage($package->getAliasOf(), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  11395. }
  11396. foreach ($package->getNames(false) as $name) {
  11397. if (isset($packageIdenticalDefinitionLookup[$package->id][$name])) {
  11398. $packageGroupPointers = $packageIdenticalDefinitionLookup[$package->id][$name];
  11399. $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
  11400. foreach ($packageGroup as $pkg) {
  11401. if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  11402. $pkg = $pkg->getAliasOf();
  11403. }
  11404. $this->removedVersionsByPackage[spl_object_hash($package)][$pkg->getVersion()] = $pkg->getPrettyVersion();
  11405. }
  11406. }
  11407. }
  11408. if (isset($this->aliasesPerPackage[$package->id])) {
  11409. foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
  11410. unset($this->packagesToRemove[$aliasPackage->id]);
  11411. foreach ($aliasPackage->getNames(false) as $name) {
  11412. if (isset($packageIdenticalDefinitionLookup[$aliasPackage->id][$name])) {
  11413. $packageGroupPointers = $packageIdenticalDefinitionLookup[$aliasPackage->id][$name];
  11414. $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
  11415. foreach ($packageGroup as $pkg) {
  11416. if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  11417. $pkg = $pkg->getAliasOf();
  11418. }
  11419. $this->removedVersionsByPackage[spl_object_hash($aliasPackage)][$pkg->getVersion()] = $pkg->getPrettyVersion();
  11420. }
  11421. }
  11422. }
  11423. }
  11424. }
  11425. }
  11426. private function optimizeImpossiblePackagesAway(Request $request, Pool $pool): void
  11427. {
  11428. if (count($request->getLockedPackages()) === 0) {
  11429. return;
  11430. }
  11431. $packageIndex = array();
  11432. foreach ($pool->getPackages() as $package) {
  11433. $id = $package->id;
  11434. if (isset($this->irremovablePackages[$id])) {
  11435. continue;
  11436. }
  11437. if (isset($this->aliasesPerPackage[$id]) || $package instanceof AliasPackage) {
  11438. continue;
  11439. }
  11440. if ($request->isFixedPackage($package) || $request->isLockedPackage($package)) {
  11441. continue;
  11442. }
  11443. $packageIndex[$package->getName()][$package->id] = $package;
  11444. }
  11445. foreach ($request->getLockedPackages() as $package) {
  11446. $isUnusedPackage = true;
  11447. foreach ($package->getNames(false) as $packageName) {
  11448. if (isset($this->requireConstraintsPerPackage[$packageName])) {
  11449. $isUnusedPackage = false;
  11450. break;
  11451. }
  11452. }
  11453. if ($isUnusedPackage) {
  11454. continue;
  11455. }
  11456. foreach ($package->getRequires() as $link) {
  11457. $require = $link->getTarget();
  11458. if (!isset($packageIndex[$require])) {
  11459. continue;
  11460. }
  11461. $linkConstraint = $link->getConstraint();
  11462. foreach ($packageIndex[$require] as $id => $requiredPkg) {
  11463. if (false === CompilingMatcher::match($linkConstraint, Constraint::OP_EQ, $requiredPkg->getVersion())) {
  11464. $this->markPackageForRemoval($id);
  11465. unset($packageIndex[$require][$id]);
  11466. }
  11467. }
  11468. }
  11469. }
  11470. }
  11471. private function extractRequireConstraintsPerPackage($package, ConstraintInterface $constraint)
  11472. {
  11473. foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
  11474. $this->requireConstraintsPerPackage[$package][(string) $expanded] = $expanded;
  11475. }
  11476. }
  11477. private function extractConflictConstraintsPerPackage($package, ConstraintInterface $constraint)
  11478. {
  11479. foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
  11480. $this->conflictConstraintsPerPackage[$package][(string) $expanded] = $expanded;
  11481. }
  11482. }
  11483. private function expandDisjunctiveMultiConstraints(ConstraintInterface $constraint)
  11484. {
  11485. $constraint = Intervals::compactConstraint($constraint);
  11486. if ($constraint instanceof MultiConstraint && $constraint->isDisjunctive()) {
  11487. return $constraint->getConstraints();
  11488. }
  11489. return array($constraint);
  11490. }
  11491. }
  11492. <?php declare(strict_types=1);
  11493. namespace Composer\DependencyResolver;
  11494. use Composer\Package\CompletePackageInterface;
  11495. use Composer\Package\AliasPackage;
  11496. use Composer\Package\BasePackage;
  11497. use Composer\Package\Link;
  11498. use Composer\Package\PackageInterface;
  11499. use Composer\Package\RootPackageInterface;
  11500. use Composer\Pcre\Preg;
  11501. use Composer\Repository\RepositorySet;
  11502. use Composer\Repository\LockArrayRepository;
  11503. use Composer\Semver\Constraint\Constraint;
  11504. use Composer\Semver\Constraint\ConstraintInterface;
  11505. use Composer\Package\Version\VersionParser;
  11506. use Composer\Repository\PlatformRepository;
  11507. class Problem
  11508. {
  11509. protected $reasonSeen;
  11510. protected $reasons = array();
  11511. protected $section = 0;
  11512. public function addRule(Rule $rule): void
  11513. {
  11514. $this->addReason(spl_object_hash($rule), $rule);
  11515. }
  11516. public function getReasons(): array
  11517. {
  11518. return $this->reasons;
  11519. }
  11520. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
  11521. {
  11522. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  11523. if (count($reasons) === 1) {
  11524. reset($reasons);
  11525. $rule = current($reasons);
  11526. if (!in_array($rule->getReason(), array(Rule::RULE_ROOT_REQUIRE, Rule::RULE_FIXED), true)) {
  11527. throw new \LogicException("Single reason problems must contain a request rule.");
  11528. }
  11529. $reasonData = $rule->getReasonData();
  11530. $packageName = $reasonData['packageName'];
  11531. $constraint = $reasonData['constraint'];
  11532. if (isset($constraint)) {
  11533. $packages = $pool->whatProvides($packageName, $constraint);
  11534. } else {
  11535. $packages = array();
  11536. }
  11537. if (empty($packages)) {
  11538. return "\n ".implode(self::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $packageName, $constraint));
  11539. }
  11540. }
  11541. return self::formatDeduplicatedRules($reasons, ' ', $repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
  11542. }
  11543. public static function formatDeduplicatedRules(array $rules, string $indent, RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
  11544. {
  11545. $messages = array();
  11546. $templates = array();
  11547. $parser = new VersionParser;
  11548. $deduplicatableRuleTypes = array(Rule::RULE_PACKAGE_REQUIRES, Rule::RULE_PACKAGE_CONFLICT);
  11549. foreach ($rules as $rule) {
  11550. $message = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
  11551. if (in_array($rule->getReason(), $deduplicatableRuleTypes, true) && Preg::isMatch('{^(?P<package>\S+) (?P<version>\S+) (?P<type>requires|conflicts)}', $message, $m)) {
  11552. $template = Preg::replace('{^\S+ \S+ }', '%s%s ', $message);
  11553. $messages[] = $template;
  11554. $templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
  11555. $sourcePackage = $rule->getSourcePackage($pool);
  11556. foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($sourcePackage)) as $version => $prettyVersion) {
  11557. $templates[$template][$m[1]][$version] = $prettyVersion;
  11558. }
  11559. } elseif ($message !== '') {
  11560. $messages[] = $message;
  11561. }
  11562. }
  11563. $result = array();
  11564. foreach (array_unique($messages) as $message) {
  11565. if (isset($templates[$message])) {
  11566. foreach ($templates[$message] as $package => $versions) {
  11567. uksort($versions, 'version_compare');
  11568. if (!$isVerbose) {
  11569. $versions = self::condenseVersionList($versions, 1);
  11570. }
  11571. if (count($versions) > 1) {
  11572. $message = Preg::replace('{^(%s%s (?:require|conflict))s}', '$1', $message);
  11573. $result[] = sprintf($message, $package, '['.implode(', ', $versions).']');
  11574. } else {
  11575. $result[] = sprintf($message, $package, ' '.reset($versions));
  11576. }
  11577. }
  11578. } else {
  11579. $result[] = $message;
  11580. }
  11581. }
  11582. return "\n$indent- ".implode("\n$indent- ", $result);
  11583. }
  11584. public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
  11585. {
  11586. foreach ($this->reasons as $sectionRules) {
  11587. foreach ($sectionRules as $rule) {
  11588. if ($rule->isCausedByLock($repositorySet, $request, $pool)) {
  11589. return true;
  11590. }
  11591. }
  11592. }
  11593. return false;
  11594. }
  11595. protected function addReason(string $id, Rule $reason): void
  11596. {
  11597. if (!isset($this->reasonSeen[$id])) {
  11598. $this->reasonSeen[$id] = true;
  11599. $this->reasons[$this->section][] = $reason;
  11600. }
  11601. }
  11602. public function nextSection(): void
  11603. {
  11604. $this->section++;
  11605. }
  11606. public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, string $packageName, ConstraintInterface $constraint = null): array
  11607. {
  11608. if (PlatformRepository::isPlatformPackage($packageName)) {
  11609. if (0 === stripos($packageName, 'php') || $packageName === 'hhvm') {
  11610. $version = self::getPlatformPackageVersion($pool, $packageName, phpversion());
  11611. $msg = "- Root composer.json requires ".$packageName.self::constraintToText($constraint).' but ';
  11612. if (defined('HHVM_VERSION') || ($packageName === 'hhvm' && count($pool->whatProvides($packageName)) > 0)) {
  11613. return array($msg, 'your HHVM version does not satisfy that requirement.');
  11614. }
  11615. if ($packageName === 'hhvm') {
  11616. return array($msg, 'HHVM was not detected on this machine, make sure it is in your PATH.');
  11617. }
  11618. if (null === $version) {
  11619. return array($msg, 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".');
  11620. }
  11621. return array($msg, 'your '.$packageName.' version ('. $version .') does not satisfy that requirement.');
  11622. }
  11623. if (0 === stripos($packageName, 'ext-')) {
  11624. if (false !== strpos($packageName, ' ')) {
  11625. return array('- ', "PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.');
  11626. }
  11627. $ext = substr($packageName, 4);
  11628. $msg = "- Root composer.json requires PHP extension ".$packageName.self::constraintToText($constraint).' but ';
  11629. $version = self::getPlatformPackageVersion($pool, $packageName, phpversion($ext) ?: '0');
  11630. if (null === $version) {
  11631. if (extension_loaded($ext)) {
  11632. return array(
  11633. $msg,
  11634. 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".',
  11635. );
  11636. }
  11637. return array($msg, 'it is missing from your system. Install or enable PHP\'s '.$ext.' extension.');
  11638. }
  11639. return array($msg, 'it has the wrong version installed ('.$version.').');
  11640. }
  11641. if (0 === stripos($packageName, 'lib-')) {
  11642. if (strtolower($packageName) === 'lib-icu') {
  11643. $error = extension_loaded('intl') ? 'it has the wrong version installed, try upgrading the intl extension.' : 'it is missing from your system, make sure the intl extension is loaded.';
  11644. return array("- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', $error);
  11645. }
  11646. return array("- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', 'it has the wrong version installed or is missing from your system, make sure to load the extension providing it.');
  11647. }
  11648. }
  11649. $lockedPackage = null;
  11650. foreach ($request->getLockedPackages() as $package) {
  11651. if ($package->getName() === $packageName) {
  11652. $lockedPackage = $package;
  11653. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  11654. return array("- ", $package->getPrettyName().' is fixed to '.$package->getPrettyVersion().' (lock file version) by a partial update but that version is rejected by your minimum-stability. Make sure you list it as an argument for the update command.');
  11655. }
  11656. break;
  11657. }
  11658. }
  11659. if ($packages = $repositorySet->findPackages($packageName, $constraint)) {
  11660. $rootReqs = $repositorySet->getRootRequires();
  11661. if (isset($rootReqs[$packageName])) {
  11662. $filtered = array_filter($packages, function ($p) use ($rootReqs, $packageName): bool {
  11663. return $rootReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
  11664. });
  11665. if (0 === count($filtered)) {
  11666. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your root composer.json require ('.$rootReqs[$packageName]->getPrettyString().').');
  11667. }
  11668. }
  11669. if ($lockedPackage) {
  11670. $fixedConstraint = new Constraint('==', $lockedPackage->getVersion());
  11671. $filtered = array_filter($packages, function ($p) use ($fixedConstraint): bool {
  11672. return $fixedConstraint->matches(new Constraint('==', $p->getVersion()));
  11673. });
  11674. if (0 === count($filtered)) {
  11675. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but the package is fixed to '.$lockedPackage->getPrettyVersion().' (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.');
  11676. }
  11677. }
  11678. $nonLockedPackages = array_filter($packages, function ($p): bool {
  11679. return !$p->getRepository() instanceof LockArrayRepository;
  11680. });
  11681. if (!$nonLockedPackages) {
  11682. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.');
  11683. }
  11684. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but these were not loaded, likely because '.(self::hasMultipleNames($packages) ? 'they conflict' : 'it conflicts').' with another require.');
  11685. }
  11686. if ($packages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
  11687. if ($allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES)) {
  11688. return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'minimum-stability', $constraint);
  11689. }
  11690. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your minimum-stability.');
  11691. }
  11692. if ($packages = $repositorySet->findPackages($packageName, null, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
  11693. if ($allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES)) {
  11694. return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'constraint', $constraint);
  11695. }
  11696. $suffix = '';
  11697. if ($constraint instanceof Constraint && $constraint->getVersion() === 'dev-master') {
  11698. foreach ($packages as $candidate) {
  11699. if (in_array($candidate->getVersion(), array('dev-default', 'dev-main'), true)) {
  11700. $suffix = ' Perhaps dev-master was renamed to '.$candidate->getPrettyVersion().'?';
  11701. break;
  11702. }
  11703. }
  11704. }
  11705. $allReposPackages = $packages;
  11706. $topPackage = reset($allReposPackages);
  11707. if ($topPackage instanceof RootPackageInterface) {
  11708. $suffix = ' See https://getcomposer.org/dep-on-root for details and assistance.';
  11709. }
  11710. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match the constraint.' . $suffix);
  11711. }
  11712. if (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  11713. $illegalChars = Preg::replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  11714. return array("- Root composer.json requires $packageName, it ", 'could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.');
  11715. }
  11716. if ($providers = $repositorySet->getProviders($packageName)) {
  11717. $maxProviders = 20;
  11718. $providersStr = implode(array_map(function ($p): string {
  11719. $description = $p['description'] ? ' '.substr($p['description'], 0, 100) : '';
  11720. return " - ${p['name']}".$description."\n";
  11721. }, count($providers) > $maxProviders + 1 ? array_slice($providers, 0, $maxProviders) : $providers));
  11722. if (count($providers) > $maxProviders + 1) {
  11723. $providersStr .= ' ... and '.(count($providers) - $maxProviders).' more.'."\n";
  11724. }
  11725. return array("- Root composer.json requires $packageName".self::constraintToText($constraint).", it ", "could not be found in any version, but the following packages provide it:\n".$providersStr." Consider requiring one of these to satisfy the $packageName requirement.");
  11726. }
  11727. return array("- Root composer.json requires $packageName, it ", "could not be found in any version, there may be a typo in the package name.");
  11728. }
  11729. public static function getPackageList(array $packages, bool $isVerbose, Pool $pool = null, ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
  11730. {
  11731. $prepared = array();
  11732. $hasDefaultBranch = array();
  11733. foreach ($packages as $package) {
  11734. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  11735. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion().($package instanceof AliasPackage ? ' (alias of '.$package->getAliasOf()->getPrettyVersion().')' : '');
  11736. if ($pool && $constraint) {
  11737. foreach ($pool->getRemovedVersions($package->getName(), $constraint) as $version => $prettyVersion) {
  11738. $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
  11739. }
  11740. }
  11741. if ($pool && $useRemovedVersionGroup) {
  11742. foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($package)) as $version => $prettyVersion) {
  11743. $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
  11744. }
  11745. }
  11746. if ($package->isDefaultBranch()) {
  11747. $hasDefaultBranch[$package->getName()] = true;
  11748. }
  11749. }
  11750. $preparedStrings = array();
  11751. foreach ($prepared as $name => $package) {
  11752. if (isset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS], $hasDefaultBranch[$name])) {
  11753. unset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS]);
  11754. }
  11755. uksort($package['versions'], 'version_compare');
  11756. if (!$isVerbose) {
  11757. $package['versions'] = self::condenseVersionList($package['versions'], 4);
  11758. }
  11759. $preparedStrings[] = $package['name'].'['.implode(', ', $package['versions']).']';
  11760. }
  11761. return implode(', ', $preparedStrings);
  11762. }
  11763. private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version): ?string
  11764. {
  11765. $available = $pool->whatProvides($packageName);
  11766. if (count($available)) {
  11767. $selected = null;
  11768. foreach ($available as $pkg) {
  11769. if ($pkg->getRepository() instanceof PlatformRepository) {
  11770. $selected = $pkg;
  11771. break;
  11772. }
  11773. }
  11774. if ($selected === null) {
  11775. $selected = reset($available);
  11776. }
  11777. if ($selected->getName() !== $packageName) {
  11778. foreach (array_merge(array_values($selected->getProvides()), array_values($selected->getReplaces())) as $link) {
  11779. if ($link->getTarget() === $packageName) {
  11780. return $link->getPrettyConstraint().' '.substr($link->getDescription(), 0, -1).'d by '.$selected->getPrettyString();
  11781. }
  11782. }
  11783. }
  11784. $version = $selected->getPrettyVersion();
  11785. $extra = $selected->getExtra();
  11786. if ($selected instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  11787. $version .= '; ' . str_replace('Package ', '', $selected->getDescription());
  11788. }
  11789. } else {
  11790. return null;
  11791. }
  11792. return $version;
  11793. }
  11794. private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array
  11795. {
  11796. if (count($versions) <= $max) {
  11797. return $versions;
  11798. }
  11799. $filtered = array();
  11800. $byMajor = array();
  11801. foreach ($versions as $version => $pretty) {
  11802. if (0 === stripos($version, 'dev-')) {
  11803. $byMajor['dev'][] = $pretty;
  11804. } else {
  11805. $byMajor[Preg::replace('{^(\d+)\..*}', '$1', $version)][] = $pretty;
  11806. }
  11807. }
  11808. foreach ($byMajor as $majorVersion => $versionsForMajor) {
  11809. $maxVersions = $majorVersion === 'dev' ? $maxDev : $max;
  11810. if (count($versionsForMajor) > $maxVersions) {
  11811. $filtered[] = $versionsForMajor[0];
  11812. $filtered[] = '...';
  11813. $filtered[] = $versionsForMajor[count($versionsForMajor) - 1];
  11814. } else {
  11815. $filtered = array_merge($filtered, $versionsForMajor);
  11816. }
  11817. }
  11818. return $filtered;
  11819. }
  11820. private static function hasMultipleNames(array $packages): bool
  11821. {
  11822. $name = null;
  11823. foreach ($packages as $package) {
  11824. if ($name === null || $name === $package->getName()) {
  11825. $name = $package->getName();
  11826. } else {
  11827. return true;
  11828. }
  11829. }
  11830. return false;
  11831. }
  11832. private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose, string $packageName, array $higherRepoPackages, array $allReposPackages, string $reason, ConstraintInterface $constraint = null): array
  11833. {
  11834. $nextRepoPackages = array();
  11835. $nextRepo = null;
  11836. foreach ($allReposPackages as $package) {
  11837. if ($nextRepo === null || $nextRepo === $package->getRepository()) {
  11838. $nextRepoPackages[] = $package;
  11839. $nextRepo = $package->getRepository();
  11840. } else {
  11841. break;
  11842. }
  11843. }
  11844. if ($higherRepoPackages) {
  11845. $topPackage = reset($higherRepoPackages);
  11846. if ($topPackage instanceof RootPackageInterface) {
  11847. return array(
  11848. "- Root composer.json requires $packageName".self::constraintToText($constraint).', it is ',
  11849. 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.$topPackage->getPrettyName().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.',
  11850. );
  11851. }
  11852. }
  11853. if ($nextRepo instanceof LockArrayRepository) {
  11854. $singular = count($higherRepoPackages) === 1;
  11855. $suggestion = 'Make sure you either fix the '.$reason.' or avoid updating this package to keep the one present in the lock file ('.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).').';
  11856. if ($nextRepoPackages[0]->getDistType() === 'path') {
  11857. $transportOptions = $nextRepoPackages[0]->getTransportOptions();
  11858. if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
  11859. $suggestion = 'Make sure you fix the '.$reason.' as packages installed from symlinked path repos are updated even in partial updates and the one from the lock file can thus not be used.';
  11860. }
  11861. }
  11862. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ',
  11863. 'found ' . self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. '.$suggestion,
  11864. );
  11865. }
  11866. return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages from the higher priority repository do not match your '.$reason.' and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.');
  11867. }
  11868. protected static function constraintToText(ConstraintInterface $constraint = null): string
  11869. {
  11870. return $constraint ? ' '.$constraint->getPrettyString() : '';
  11871. }
  11872. }
  11873. <?php declare(strict_types=1);
  11874. namespace Composer\DependencyResolver;
  11875. use Composer\Package\BasePackage;
  11876. use Composer\Package\PackageInterface;
  11877. use Composer\Repository\LockArrayRepository;
  11878. use Composer\Semver\Constraint\ConstraintInterface;
  11879. use Composer\Semver\Constraint\MatchAllConstraint;
  11880. class Request
  11881. {
  11882. public const UPDATE_ONLY_LISTED = 0;
  11883. public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE = 1;
  11884. public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS = 2;
  11885. protected $lockedRepository;
  11886. protected $requires = array();
  11887. protected $fixedPackages = array();
  11888. protected $lockedPackages = array();
  11889. protected $fixedLockedPackages = array();
  11890. protected $updateAllowList = array();
  11891. protected $updateAllowTransitiveDependencies = false;
  11892. public function __construct(LockArrayRepository $lockedRepository = null)
  11893. {
  11894. $this->lockedRepository = $lockedRepository;
  11895. }
  11896. public function requireName(string $packageName, ConstraintInterface $constraint = null): void
  11897. {
  11898. $packageName = strtolower($packageName);
  11899. if ($constraint === null) {
  11900. $constraint = new MatchAllConstraint();
  11901. }
  11902. if (isset($this->requires[$packageName])) {
  11903. throw new \LogicException('Overwriting requires seems like a bug ('.$packageName.' '.$this->requires[$packageName]->getPrettyString().' => '.$constraint->getPrettyString().', check why it is happening, might be a root alias');
  11904. }
  11905. $this->requires[$packageName] = $constraint;
  11906. }
  11907. public function fixPackage(BasePackage $package): void
  11908. {
  11909. $this->fixedPackages[spl_object_hash($package)] = $package;
  11910. }
  11911. public function lockPackage(BasePackage $package): void
  11912. {
  11913. $this->lockedPackages[spl_object_hash($package)] = $package;
  11914. }
  11915. public function fixLockedPackage(BasePackage $package): void
  11916. {
  11917. $this->fixedPackages[spl_object_hash($package)] = $package;
  11918. $this->fixedLockedPackages[spl_object_hash($package)] = $package;
  11919. }
  11920. public function unlockPackage(BasePackage $package): void
  11921. {
  11922. unset($this->lockedPackages[spl_object_hash($package)]);
  11923. }
  11924. public function setUpdateAllowList(array $updateAllowList, $updateAllowTransitiveDependencies): void
  11925. {
  11926. $this->updateAllowList = $updateAllowList;
  11927. $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
  11928. }
  11929. public function getUpdateAllowList(): array
  11930. {
  11931. return $this->updateAllowList;
  11932. }
  11933. public function getUpdateAllowTransitiveDependencies(): bool
  11934. {
  11935. return $this->updateAllowTransitiveDependencies !== self::UPDATE_ONLY_LISTED;
  11936. }
  11937. public function getUpdateAllowTransitiveRootDependencies(): bool
  11938. {
  11939. return $this->updateAllowTransitiveDependencies === self::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  11940. }
  11941. public function getRequires(): array
  11942. {
  11943. return $this->requires;
  11944. }
  11945. public function getFixedPackages(): array
  11946. {
  11947. return $this->fixedPackages;
  11948. }
  11949. public function isFixedPackage(BasePackage $package): bool
  11950. {
  11951. return isset($this->fixedPackages[spl_object_hash($package)]);
  11952. }
  11953. public function getLockedPackages(): array
  11954. {
  11955. return $this->lockedPackages;
  11956. }
  11957. public function isLockedPackage(PackageInterface $package): bool
  11958. {
  11959. return isset($this->lockedPackages[spl_object_hash($package)]) || isset($this->fixedLockedPackages[spl_object_hash($package)]);
  11960. }
  11961. public function getFixedOrLockedPackages(): array
  11962. {
  11963. return array_merge($this->fixedPackages, $this->lockedPackages);
  11964. }
  11965. public function getPresentMap(bool $packageIds = false): array
  11966. {
  11967. $presentMap = array();
  11968. if ($this->lockedRepository) {
  11969. foreach ($this->lockedRepository->getPackages() as $package) {
  11970. $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
  11971. }
  11972. }
  11973. foreach ($this->fixedPackages as $package) {
  11974. $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
  11975. }
  11976. return $presentMap;
  11977. }
  11978. public function getFixedPackagesMap(): array
  11979. {
  11980. $fixedPackagesMap = array();
  11981. foreach ($this->fixedPackages as $package) {
  11982. $fixedPackagesMap[$package->getId()] = $package;
  11983. }
  11984. return $fixedPackagesMap;
  11985. }
  11986. public function getLockedRepository(): ?LockArrayRepository
  11987. {
  11988. return $this->lockedRepository;
  11989. }
  11990. }
  11991. <?php declare(strict_types=1);
  11992. namespace Composer\DependencyResolver;
  11993. use Composer\Package\AliasPackage;
  11994. use Composer\Package\BasePackage;
  11995. use Composer\Package\Link;
  11996. use Composer\Repository\PlatformRepository;
  11997. use Composer\Repository\RepositorySet;
  11998. use Composer\Package\Version\VersionParser;
  11999. use Composer\Semver\Constraint\Constraint;
  12000. use Composer\Semver\Constraint\ConstraintInterface;
  12001. abstract class Rule
  12002. {
  12003. public const RULE_ROOT_REQUIRE = 2;
  12004. public const RULE_FIXED = 3;
  12005. public const RULE_PACKAGE_CONFLICT = 6;
  12006. public const RULE_PACKAGE_REQUIRES = 7;
  12007. public const RULE_PACKAGE_SAME_NAME = 10;
  12008. public const RULE_LEARNED = 12;
  12009. public const RULE_PACKAGE_ALIAS = 13;
  12010. public const RULE_PACKAGE_INVERSE_ALIAS = 14;
  12011. private const BITFIELD_TYPE = 0;
  12012. private const BITFIELD_REASON = 8;
  12013. private const BITFIELD_DISABLED = 16;
  12014. protected $bitfield;
  12015. protected $request;
  12016. protected $reasonData;
  12017. public function __construct($reason, $reasonData)
  12018. {
  12019. $this->reasonData = $reasonData;
  12020. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  12021. ($reason << self::BITFIELD_REASON) |
  12022. (255 << self::BITFIELD_TYPE);
  12023. }
  12024. abstract public function getLiterals(): array;
  12025. abstract public function getHash();
  12026. abstract public function __toString(): string;
  12027. abstract public function equals(Rule $rule): bool;
  12028. public function getReason(): int
  12029. {
  12030. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  12031. }
  12032. public function getReasonData()
  12033. {
  12034. return $this->reasonData;
  12035. }
  12036. public function getRequiredPackage(): ?string
  12037. {
  12038. $reason = $this->getReason();
  12039. if ($reason === self::RULE_ROOT_REQUIRE) {
  12040. return $this->reasonData['packageName'];
  12041. }
  12042. if ($reason === self::RULE_FIXED) {
  12043. return $this->reasonData['package']->getName();
  12044. }
  12045. if ($reason === self::RULE_PACKAGE_REQUIRES) {
  12046. return $this->reasonData->getTarget();
  12047. }
  12048. return null;
  12049. }
  12050. public function setType($type): void
  12051. {
  12052. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  12053. }
  12054. public function getType(): int
  12055. {
  12056. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  12057. }
  12058. public function disable(): void
  12059. {
  12060. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  12061. }
  12062. public function enable(): void
  12063. {
  12064. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  12065. }
  12066. public function isDisabled(): bool
  12067. {
  12068. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  12069. }
  12070. public function isEnabled(): bool
  12071. {
  12072. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  12073. }
  12074. abstract public function isAssertion(): bool;
  12075. public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
  12076. {
  12077. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  12078. if (PlatformRepository::isPlatformPackage($this->reasonData->getTarget())) {
  12079. return false;
  12080. }
  12081. if ($request->getLockedRepository()) {
  12082. foreach ($request->getLockedRepository()->getPackages() as $package) {
  12083. if ($package->getName() === $this->reasonData->getTarget()) {
  12084. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  12085. return true;
  12086. }
  12087. if (!$this->reasonData->getConstraint()->matches(new Constraint('=', $package->getVersion()))) {
  12088. return true;
  12089. }
  12090. if (!$request->isLockedPackage($package)) {
  12091. return true;
  12092. }
  12093. break;
  12094. }
  12095. }
  12096. }
  12097. }
  12098. if ($this->getReason() === self::RULE_ROOT_REQUIRE) {
  12099. if (PlatformRepository::isPlatformPackage($this->reasonData['packageName'])) {
  12100. return false;
  12101. }
  12102. if ($request->getLockedRepository()) {
  12103. foreach ($request->getLockedRepository()->getPackages() as $package) {
  12104. if ($package->getName() === $this->reasonData['packageName']) {
  12105. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  12106. return true;
  12107. }
  12108. if (!$this->reasonData['constraint']->matches(new Constraint('=', $package->getVersion()))) {
  12109. return true;
  12110. }
  12111. break;
  12112. }
  12113. }
  12114. }
  12115. }
  12116. return false;
  12117. }
  12118. public function getSourcePackage(Pool $pool): BasePackage
  12119. {
  12120. $literals = $this->getLiterals();
  12121. switch ($this->getReason()) {
  12122. case self::RULE_PACKAGE_CONFLICT:
  12123. $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  12124. $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  12125. if ($reasonData = $this->getReasonData()) {
  12126. if ($reasonData->getSource() === $package1->getName()) {
  12127. list($package2, $package1) = array($package1, $package2);
  12128. }
  12129. }
  12130. return $package2;
  12131. case self::RULE_PACKAGE_REQUIRES:
  12132. $sourceLiteral = array_shift($literals);
  12133. $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
  12134. return $sourcePackage;
  12135. default:
  12136. throw new \LogicException('Not implemented');
  12137. }
  12138. }
  12139. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = array(), array $learnedPool = array()): string
  12140. {
  12141. $literals = $this->getLiterals();
  12142. switch ($this->getReason()) {
  12143. case self::RULE_ROOT_REQUIRE:
  12144. $packageName = $this->reasonData['packageName'];
  12145. $constraint = $this->reasonData['constraint'];
  12146. $packages = $pool->whatProvides($packageName, $constraint);
  12147. if (!$packages) {
  12148. return 'No package found to satisfy root composer.json require '.$packageName.($constraint ? ' '.$constraint->getPrettyString() : '');
  12149. }
  12150. $packagesNonAlias = array_values(array_filter($packages, function ($p): bool {
  12151. return !($p instanceof AliasPackage);
  12152. }));
  12153. if (count($packagesNonAlias) === 1) {
  12154. $package = $packagesNonAlias[0];
  12155. if ($request->isLockedPackage($package)) {
  12156. return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion()." and an update of this package was not requested.";
  12157. }
  12158. }
  12159. return 'Root composer.json requires '.$packageName.($constraint ? ' '.$constraint->getPrettyString() : '').' -> satisfiable by '.$this->formatPackagesUnique($pool, $packages, $isVerbose, $constraint).'.';
  12160. case self::RULE_FIXED:
  12161. $package = $this->deduplicateDefaultBranchAlias($this->reasonData['package']);
  12162. if ($request->isLockedPackage($package)) {
  12163. return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion().' and an update of this package was not requested.';
  12164. }
  12165. return $package->getPrettyName().' is present at version '.$package->getPrettyVersion() . ' and cannot be modified by Composer';
  12166. case self::RULE_PACKAGE_CONFLICT:
  12167. $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  12168. $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  12169. $conflictTarget = $package1->getPrettyString();
  12170. if ($reasonData = $this->getReasonData()) {
  12171. assert($reasonData instanceof Link);
  12172. if ($reasonData->getSource() === $package1->getName()) {
  12173. list($package2, $package1) = array($package1, $package2);
  12174. $conflictTarget = $package1->getPrettyName().' '.$reasonData->getPrettyConstraint();
  12175. }
  12176. if ($reasonData->getTarget() !== $package1->getName()) {
  12177. $provideType = null;
  12178. $provided = null;
  12179. foreach ($package1->getProvides() as $provide) {
  12180. if ($provide->getTarget() === $reasonData->getTarget()) {
  12181. $provideType = 'provides';
  12182. $provided = $provide->getPrettyConstraint();
  12183. break;
  12184. }
  12185. }
  12186. foreach ($package1->getReplaces() as $replace) {
  12187. if ($replace->getTarget() === $reasonData->getTarget()) {
  12188. $provideType = 'replaces';
  12189. $provided = $replace->getPrettyConstraint();
  12190. break;
  12191. }
  12192. }
  12193. if (null !== $provideType) {
  12194. $conflictTarget = $reasonData->getTarget().' '.$reasonData->getPrettyConstraint().' ('.$package1->getPrettyString().' '.$provideType.' '.$reasonData->getTarget().' '.$provided.')';
  12195. }
  12196. }
  12197. }
  12198. return $package2->getPrettyString().' conflicts with '.$conflictTarget.'.';
  12199. case self::RULE_PACKAGE_REQUIRES:
  12200. $sourceLiteral = array_shift($literals);
  12201. $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
  12202. $reasonData = $this->reasonData;
  12203. $requires = array();
  12204. foreach ($literals as $literal) {
  12205. $requires[] = $pool->literalToPackage($literal);
  12206. }
  12207. $text = $reasonData->getPrettyString($sourcePackage);
  12208. if ($requires) {
  12209. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires, $isVerbose, $this->reasonData->getConstraint()) . '.';
  12210. } else {
  12211. $targetName = $reasonData->getTarget();
  12212. $reason = Problem::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $targetName, $this->reasonData->getConstraint());
  12213. return $text . ' -> ' . $reason[1];
  12214. }
  12215. return $text;
  12216. case self::RULE_PACKAGE_SAME_NAME:
  12217. $packageNames = array();
  12218. foreach ($literals as $literal) {
  12219. $package = $pool->literalToPackage($literal);
  12220. $packageNames[$package->getName()] = true;
  12221. }
  12222. $replacedName = $this->reasonData;
  12223. if (count($packageNames) > 1) {
  12224. $reason = null;
  12225. if (!isset($packageNames[$replacedName])) {
  12226. $reason = 'They '.(count($literals) == 2 ? 'both' : 'all').' replace '.$replacedName.' and thus cannot coexist.';
  12227. } else {
  12228. $replacerNames = $packageNames;
  12229. unset($replacerNames[$replacedName]);
  12230. $replacerNames = array_keys($replacerNames);
  12231. if (count($replacerNames) == 1) {
  12232. $reason = $replacerNames[0] . ' replaces ';
  12233. } else {
  12234. $reason = '['.implode(', ', $replacerNames).'] replace ';
  12235. }
  12236. $reason .= $replacedName.' and thus cannot coexist with it.';
  12237. }
  12238. $installedPackages = array();
  12239. $removablePackages = array();
  12240. foreach ($literals as $literal) {
  12241. if (isset($installedMap[abs($literal)])) {
  12242. $installedPackages[] = $pool->literalToPackage($literal);
  12243. } else {
  12244. $removablePackages[] = $pool->literalToPackage($literal);
  12245. }
  12246. }
  12247. if ($installedPackages && $removablePackages) {
  12248. return $this->formatPackagesUnique($pool, $removablePackages, $isVerbose, null, true).' cannot be installed as that would require removing '.$this->formatPackagesUnique($pool, $installedPackages, $isVerbose, null, true).'. '.$reason;
  12249. }
  12250. return 'Only one of these can be installed: '.$this->formatPackagesUnique($pool, $literals, $isVerbose, null, true).'. '.$reason;
  12251. }
  12252. return 'You can only install one version of a package, so only one of these can be installed: ' . $this->formatPackagesUnique($pool, $literals, $isVerbose, null, true) . '.';
  12253. case self::RULE_LEARNED:
  12254. $learnedString = ' (conflict analysis result)';
  12255. if (count($literals) === 1) {
  12256. $ruleText = $pool->literalToPrettyString($literals[0], $installedMap);
  12257. } else {
  12258. $groups = array();
  12259. foreach ($literals as $literal) {
  12260. $package = $pool->literalToPackage($literal);
  12261. if (isset($installedMap[$package->id])) {
  12262. $group = $literal > 0 ? 'keep' : 'remove';
  12263. } else {
  12264. $group = $literal > 0 ? 'install' : 'don\'t install';
  12265. }
  12266. $groups[$group][] = $this->deduplicateDefaultBranchAlias($package);
  12267. }
  12268. $ruleTexts = array();
  12269. foreach ($groups as $group => $packages) {
  12270. $ruleTexts[] = $group . (count($packages) > 1 ? ' one of' : '').' ' . $this->formatPackagesUnique($pool, $packages, $isVerbose);
  12271. }
  12272. $ruleText = implode(' | ', $ruleTexts);
  12273. }
  12274. return 'Conclusion: '.$ruleText.$learnedString;
  12275. case self::RULE_PACKAGE_ALIAS:
  12276. $aliasPackage = $pool->literalToPackage($literals[0]);
  12277. if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  12278. return '';
  12279. }
  12280. $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  12281. return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and thus requires it to be installed too.';
  12282. case self::RULE_PACKAGE_INVERSE_ALIAS:
  12283. $aliasPackage = $pool->literalToPackage($literals[1]);
  12284. if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  12285. return '';
  12286. }
  12287. $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  12288. return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and must be installed with it.';
  12289. default:
  12290. $ruleText = '';
  12291. foreach ($literals as $i => $literal) {
  12292. if ($i != 0) {
  12293. $ruleText .= '|';
  12294. }
  12295. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  12296. }
  12297. return '('.$ruleText.')';
  12298. }
  12299. }
  12300. protected function formatPackagesUnique(Pool $pool, array $packages, bool $isVerbose, ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
  12301. {
  12302. foreach ($packages as $index => $package) {
  12303. if (!\is_object($package)) {
  12304. $packages[$index] = $pool->literalToPackage($package);
  12305. }
  12306. }
  12307. return Problem::getPackageList($packages, $isVerbose, $pool, $constraint, $useRemovedVersionGroup);
  12308. }
  12309. private function deduplicateDefaultBranchAlias(BasePackage $package): BasePackage
  12310. {
  12311. if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  12312. $package = $package->getAliasOf();
  12313. }
  12314. return $package;
  12315. }
  12316. }
  12317. <?php declare(strict_types=1);
  12318. namespace Composer\DependencyResolver;
  12319. class Rule2Literals extends Rule
  12320. {
  12321. protected $literal1;
  12322. protected $literal2;
  12323. public function __construct(int $literal1, int $literal2, $reason, $reasonData)
  12324. {
  12325. parent::__construct($reason, $reasonData);
  12326. if ($literal1 < $literal2) {
  12327. $this->literal1 = $literal1;
  12328. $this->literal2 = $literal2;
  12329. } else {
  12330. $this->literal1 = $literal2;
  12331. $this->literal2 = $literal1;
  12332. }
  12333. }
  12334. public function getLiterals(): array
  12335. {
  12336. return array($this->literal1, $this->literal2);
  12337. }
  12338. public function getHash()
  12339. {
  12340. return $this->literal1.','.$this->literal2;
  12341. }
  12342. public function equals(Rule $rule): bool
  12343. {
  12344. if ($rule instanceof self) {
  12345. if ($this->literal1 !== $rule->literal1) {
  12346. return false;
  12347. }
  12348. if ($this->literal2 !== $rule->literal2) {
  12349. return false;
  12350. }
  12351. return true;
  12352. }
  12353. $literals = $rule->getLiterals();
  12354. if (2 != \count($literals)) {
  12355. return false;
  12356. }
  12357. if ($this->literal1 !== $literals[0]) {
  12358. return false;
  12359. }
  12360. if ($this->literal2 !== $literals[1]) {
  12361. return false;
  12362. }
  12363. return true;
  12364. }
  12365. public function isAssertion(): bool
  12366. {
  12367. return false;
  12368. }
  12369. public function __toString(): string
  12370. {
  12371. $result = $this->isDisabled() ? 'disabled(' : '(';
  12372. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  12373. return $result;
  12374. }
  12375. }
  12376. <?php declare(strict_types=1);
  12377. namespace Composer\DependencyResolver;
  12378. use Composer\Repository\RepositorySet;
  12379. class RuleSet implements \IteratorAggregate, \Countable
  12380. {
  12381. public const TYPE_PACKAGE = 0;
  12382. public const TYPE_REQUEST = 1;
  12383. public const TYPE_LEARNED = 4;
  12384. public $ruleById = array();
  12385. protected static $types = array(
  12386. self::TYPE_PACKAGE => 'PACKAGE',
  12387. self::TYPE_REQUEST => 'REQUEST',
  12388. self::TYPE_LEARNED => 'LEARNED',
  12389. );
  12390. protected $rules;
  12391. protected $nextRuleId = 0;
  12392. protected $rulesByHash = array();
  12393. public function __construct()
  12394. {
  12395. foreach ($this->getTypes() as $type) {
  12396. $this->rules[$type] = array();
  12397. }
  12398. }
  12399. public function add(Rule $rule, $type): void
  12400. {
  12401. if (!isset(self::$types[$type])) {
  12402. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  12403. }
  12404. $hash = $rule->getHash();
  12405. if (isset($this->rulesByHash[$hash])) {
  12406. $potentialDuplicates = $this->rulesByHash[$hash];
  12407. if (\is_array($potentialDuplicates)) {
  12408. foreach ($potentialDuplicates as $potentialDuplicate) {
  12409. if ($rule->equals($potentialDuplicate)) {
  12410. return;
  12411. }
  12412. }
  12413. } else {
  12414. if ($rule->equals($potentialDuplicates)) {
  12415. return;
  12416. }
  12417. }
  12418. }
  12419. if (!isset($this->rules[$type])) {
  12420. $this->rules[$type] = array();
  12421. }
  12422. $this->rules[$type][] = $rule;
  12423. $this->ruleById[$this->nextRuleId] = $rule;
  12424. $rule->setType($type);
  12425. $this->nextRuleId++;
  12426. if (!isset($this->rulesByHash[$hash])) {
  12427. $this->rulesByHash[$hash] = $rule;
  12428. } elseif (\is_array($this->rulesByHash[$hash])) {
  12429. $this->rulesByHash[$hash][] = $rule;
  12430. } else {
  12431. $originalRule = $this->rulesByHash[$hash];
  12432. $this->rulesByHash[$hash] = array($originalRule, $rule);
  12433. }
  12434. }
  12435. public function count(): int
  12436. {
  12437. return $this->nextRuleId;
  12438. }
  12439. public function ruleById(int $id): Rule
  12440. {
  12441. return $this->ruleById[$id];
  12442. }
  12443. public function getRules(): array
  12444. {
  12445. return $this->rules;
  12446. }
  12447. public function getIterator(): RuleSetIterator
  12448. {
  12449. return new RuleSetIterator($this->getRules());
  12450. }
  12451. public function getIteratorFor($types): RuleSetIterator
  12452. {
  12453. if (!\is_array($types)) {
  12454. $types = array($types);
  12455. }
  12456. $allRules = $this->getRules();
  12457. $rules = array();
  12458. foreach ($types as $type) {
  12459. $rules[$type] = $allRules[$type];
  12460. }
  12461. return new RuleSetIterator($rules);
  12462. }
  12463. public function getIteratorWithout($types): RuleSetIterator
  12464. {
  12465. if (!\is_array($types)) {
  12466. $types = array($types);
  12467. }
  12468. $rules = $this->getRules();
  12469. foreach ($types as $type) {
  12470. unset($rules[$type]);
  12471. }
  12472. return new RuleSetIterator($rules);
  12473. }
  12474. public function getTypes(): array
  12475. {
  12476. $types = self::$types;
  12477. return array_keys($types);
  12478. }
  12479. public function getPrettyString(RepositorySet $repositorySet = null, Request $request = null, Pool $pool = null, bool $isVerbose = false): string
  12480. {
  12481. $string = "\n";
  12482. foreach ($this->rules as $type => $rules) {
  12483. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  12484. foreach ($rules as $rule) {
  12485. $string .= ($repositorySet && $request && $pool ? $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose) : $rule)."\n";
  12486. }
  12487. $string .= "\n\n";
  12488. }
  12489. return $string;
  12490. }
  12491. public function __toString(): string
  12492. {
  12493. return $this->getPrettyString();
  12494. }
  12495. }
  12496. <?php declare(strict_types=1);
  12497. namespace Composer\DependencyResolver;
  12498. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  12499. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  12500. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  12501. use Composer\Package\BasePackage;
  12502. use Composer\Package\AliasPackage;
  12503. class RuleSetGenerator
  12504. {
  12505. protected $policy;
  12506. protected $pool;
  12507. protected $rules;
  12508. protected $addedMap = array();
  12509. protected $addedPackagesByNames = array();
  12510. public function __construct(PolicyInterface $policy, Pool $pool)
  12511. {
  12512. $this->policy = $policy;
  12513. $this->pool = $pool;
  12514. $this->rules = new RuleSet;
  12515. }
  12516. protected function createRequireRule(BasePackage $package, array $providers, $reason, $reasonData = null): ?Rule
  12517. {
  12518. $literals = array(-$package->id);
  12519. foreach ($providers as $provider) {
  12520. if ($provider === $package) {
  12521. return null;
  12522. }
  12523. $literals[] = $provider->id;
  12524. }
  12525. return new GenericRule($literals, $reason, $reasonData);
  12526. }
  12527. protected function createInstallOneOfRule(array $packages, $reason, $reasonData): Rule
  12528. {
  12529. $literals = array();
  12530. foreach ($packages as $package) {
  12531. $literals[] = $package->id;
  12532. }
  12533. return new GenericRule($literals, $reason, $reasonData);
  12534. }
  12535. protected function createRule2Literals(BasePackage $issuer, BasePackage $provider, $reason, $reasonData = null): ?Rule
  12536. {
  12537. if ($issuer === $provider) {
  12538. return null;
  12539. }
  12540. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  12541. }
  12542. protected function createMultiConflictRule(array $packages, $reason, $reasonData): Rule
  12543. {
  12544. $literals = array();
  12545. foreach ($packages as $package) {
  12546. $literals[] = -$package->id;
  12547. }
  12548. if (\count($literals) == 2) {
  12549. return new Rule2Literals($literals[0], $literals[1], $reason, $reasonData);
  12550. }
  12551. return new MultiConflictRule($literals, $reason, $reasonData);
  12552. }
  12553. private function addRule($type, Rule $newRule = null): void
  12554. {
  12555. if (!$newRule) {
  12556. return;
  12557. }
  12558. $this->rules->add($newRule, $type);
  12559. }
  12560. protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter): void
  12561. {
  12562. $workQueue = new \SplQueue;
  12563. $workQueue->enqueue($package);
  12564. while (!$workQueue->isEmpty()) {
  12565. $package = $workQueue->dequeue();
  12566. if (isset($this->addedMap[$package->id])) {
  12567. continue;
  12568. }
  12569. $this->addedMap[$package->id] = $package;
  12570. if (!$package instanceof AliasPackage) {
  12571. foreach ($package->getNames(false) as $name) {
  12572. $this->addedPackagesByNames[$name][] = $package;
  12573. }
  12574. } else {
  12575. $workQueue->enqueue($package->getAliasOf());
  12576. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($package->getAliasOf()), Rule::RULE_PACKAGE_ALIAS, $package));
  12577. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package->getAliasOf(), array($package), Rule::RULE_PACKAGE_INVERSE_ALIAS, $package->getAliasOf()));
  12578. if (!$package->hasSelfVersionRequires()) {
  12579. continue;
  12580. }
  12581. }
  12582. foreach ($package->getRequires() as $link) {
  12583. $constraint = $link->getConstraint();
  12584. if ($platformRequirementFilter->isIgnored($link->getTarget())) {
  12585. continue;
  12586. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  12587. $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint);
  12588. }
  12589. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $constraint);
  12590. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  12591. foreach ($possibleRequires as $require) {
  12592. $workQueue->enqueue($require);
  12593. }
  12594. }
  12595. }
  12596. }
  12597. protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter): void
  12598. {
  12599. foreach ($this->addedMap as $package) {
  12600. foreach ($package->getConflicts() as $link) {
  12601. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  12602. continue;
  12603. }
  12604. $constraint = $link->getConstraint();
  12605. if ($platformRequirementFilter->isIgnored($link->getTarget())) {
  12606. continue;
  12607. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  12608. $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint);
  12609. }
  12610. $conflicts = $this->pool->whatProvides($link->getTarget(), $constraint);
  12611. foreach ($conflicts as $conflict) {
  12612. if (!$conflict instanceof AliasPackage || $conflict->getName() === $link->getTarget()) {
  12613. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  12614. }
  12615. }
  12616. }
  12617. }
  12618. foreach ($this->addedPackagesByNames as $name => $packages) {
  12619. if (\count($packages) > 1) {
  12620. $reason = Rule::RULE_PACKAGE_SAME_NAME;
  12621. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createMultiConflictRule($packages, $reason, $name));
  12622. }
  12623. }
  12624. }
  12625. protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
  12626. {
  12627. foreach ($request->getFixedPackages() as $package) {
  12628. if ($package->id == -1) {
  12629. if ($this->pool->isUnacceptableFixedOrLockedPackage($package)) {
  12630. continue;
  12631. }
  12632. throw new \LogicException("Fixed package ".$package->getPrettyString()." was not added to solver pool.");
  12633. }
  12634. $this->addRulesForPackage($package, $platformRequirementFilter);
  12635. $rule = $this->createInstallOneOfRule(array($package), Rule::RULE_FIXED, array(
  12636. 'package' => $package,
  12637. ));
  12638. $this->addRule(RuleSet::TYPE_REQUEST, $rule);
  12639. }
  12640. foreach ($request->getRequires() as $packageName => $constraint) {
  12641. if ($platformRequirementFilter->isIgnored($packageName)) {
  12642. continue;
  12643. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  12644. $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
  12645. }
  12646. $packages = $this->pool->whatProvides($packageName, $constraint);
  12647. if ($packages) {
  12648. foreach ($packages as $package) {
  12649. $this->addRulesForPackage($package, $platformRequirementFilter);
  12650. }
  12651. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_ROOT_REQUIRE, array(
  12652. 'packageName' => $packageName,
  12653. 'constraint' => $constraint,
  12654. ));
  12655. $this->addRule(RuleSet::TYPE_REQUEST, $rule);
  12656. }
  12657. }
  12658. }
  12659. protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter): void
  12660. {
  12661. foreach ($this->pool->getPackages() as $package) {
  12662. if (!isset($this->addedMap[$package->id]) &&
  12663. $package instanceof AliasPackage &&
  12664. ($package->isRootPackageAlias() || isset($this->addedMap[$package->getAliasOf()->id]))
  12665. ) {
  12666. $this->addRulesForPackage($package, $platformRequirementFilter);
  12667. }
  12668. }
  12669. }
  12670. public function getRulesFor(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter = null): RuleSet
  12671. {
  12672. $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
  12673. $this->addRulesForRequest($request, $platformRequirementFilter);
  12674. $this->addRulesForRootAliases($platformRequirementFilter);
  12675. $this->addConflictRules($platformRequirementFilter);
  12676. $this->addedMap = $this->addedPackagesByNames = array();
  12677. $rules = $this->rules;
  12678. $this->rules = new RuleSet;
  12679. return $rules;
  12680. }
  12681. }
  12682. <?php declare(strict_types=1);
  12683. namespace Composer\DependencyResolver;
  12684. class RuleSetIterator implements \Iterator
  12685. {
  12686. protected $rules;
  12687. protected $types;
  12688. protected $currentOffset;
  12689. protected $currentType;
  12690. protected $currentTypeOffset;
  12691. public function __construct(array $rules)
  12692. {
  12693. $this->rules = $rules;
  12694. $this->types = array_keys($rules);
  12695. sort($this->types);
  12696. $this->rewind();
  12697. }
  12698. public function current(): Rule
  12699. {
  12700. return $this->rules[$this->currentType][$this->currentOffset];
  12701. }
  12702. public function key(): int
  12703. {
  12704. return $this->currentType;
  12705. }
  12706. public function next(): void
  12707. {
  12708. $this->currentOffset++;
  12709. if (!isset($this->rules[$this->currentType])) {
  12710. return;
  12711. }
  12712. if ($this->currentOffset >= \count($this->rules[$this->currentType])) {
  12713. $this->currentOffset = 0;
  12714. do {
  12715. $this->currentTypeOffset++;
  12716. if (!isset($this->types[$this->currentTypeOffset])) {
  12717. $this->currentType = -1;
  12718. break;
  12719. }
  12720. $this->currentType = $this->types[$this->currentTypeOffset];
  12721. } while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType]));
  12722. }
  12723. }
  12724. public function rewind(): void
  12725. {
  12726. $this->currentOffset = 0;
  12727. $this->currentTypeOffset = -1;
  12728. $this->currentType = -1;
  12729. do {
  12730. $this->currentTypeOffset++;
  12731. if (!isset($this->types[$this->currentTypeOffset])) {
  12732. $this->currentType = -1;
  12733. break;
  12734. }
  12735. $this->currentType = $this->types[$this->currentTypeOffset];
  12736. } while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType]));
  12737. }
  12738. public function valid(): bool
  12739. {
  12740. return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);
  12741. }
  12742. }
  12743. <?php declare(strict_types=1);
  12744. namespace Composer\DependencyResolver;
  12745. class RuleWatchChain extends \SplDoublyLinkedList
  12746. {
  12747. public function seek(int $offset): void
  12748. {
  12749. $this->rewind();
  12750. for ($i = 0; $i < $offset; $i++, $this->next());
  12751. }
  12752. public function remove(): void
  12753. {
  12754. $offset = $this->key();
  12755. $this->offsetUnset($offset);
  12756. $this->seek($offset);
  12757. }
  12758. }
  12759. <?php declare(strict_types=1);
  12760. namespace Composer\DependencyResolver;
  12761. class RuleWatchGraph
  12762. {
  12763. protected $watchChains = array();
  12764. public function insert(RuleWatchNode $node): void
  12765. {
  12766. if ($node->getRule()->isAssertion()) {
  12767. return;
  12768. }
  12769. if (!$node->getRule() instanceof MultiConflictRule) {
  12770. foreach (array($node->watch1, $node->watch2) as $literal) {
  12771. if (!isset($this->watchChains[$literal])) {
  12772. $this->watchChains[$literal] = new RuleWatchChain;
  12773. }
  12774. $this->watchChains[$literal]->unshift($node);
  12775. }
  12776. } else {
  12777. foreach ($node->getRule()->getLiterals() as $literal) {
  12778. if (!isset($this->watchChains[$literal])) {
  12779. $this->watchChains[$literal] = new RuleWatchChain;
  12780. }
  12781. $this->watchChains[$literal]->unshift($node);
  12782. }
  12783. }
  12784. }
  12785. public function propagateLiteral(int $decidedLiteral, int $level, Decisions $decisions): ?Rule
  12786. {
  12787. $literal = -$decidedLiteral;
  12788. if (!isset($this->watchChains[$literal])) {
  12789. return null;
  12790. }
  12791. $chain = $this->watchChains[$literal];
  12792. $chain->rewind();
  12793. while ($chain->valid()) {
  12794. $node = $chain->current();
  12795. if (!$node->getRule() instanceof MultiConflictRule) {
  12796. $otherWatch = $node->getOtherWatch($literal);
  12797. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  12798. $ruleLiterals = $node->getRule()->getLiterals();
  12799. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions): bool {
  12800. return $literal !== $ruleLiteral &&
  12801. $otherWatch !== $ruleLiteral &&
  12802. !$decisions->conflict($ruleLiteral);
  12803. });
  12804. if ($alternativeLiterals) {
  12805. reset($alternativeLiterals);
  12806. $this->moveWatch($literal, current($alternativeLiterals), $node);
  12807. continue;
  12808. }
  12809. if ($decisions->conflict($otherWatch)) {
  12810. return $node->getRule();
  12811. }
  12812. $decisions->decide($otherWatch, $level, $node->getRule());
  12813. }
  12814. } else {
  12815. foreach ($node->getRule()->getLiterals() as $otherLiteral) {
  12816. if ($literal !== $otherLiteral && !$decisions->satisfy($otherLiteral)) {
  12817. if ($decisions->conflict($otherLiteral)) {
  12818. return $node->getRule();
  12819. }
  12820. $decisions->decide($otherLiteral, $level, $node->getRule());
  12821. }
  12822. }
  12823. }
  12824. $chain->next();
  12825. }
  12826. return null;
  12827. }
  12828. protected function moveWatch(int $fromLiteral, int $toLiteral, RuleWatchNode $node): void
  12829. {
  12830. if (!isset($this->watchChains[$toLiteral])) {
  12831. $this->watchChains[$toLiteral] = new RuleWatchChain;
  12832. }
  12833. $node->moveWatch($fromLiteral, $toLiteral);
  12834. $this->watchChains[$fromLiteral]->remove();
  12835. $this->watchChains[$toLiteral]->unshift($node);
  12836. }
  12837. }
  12838. <?php declare(strict_types=1);
  12839. namespace Composer\DependencyResolver;
  12840. class RuleWatchNode
  12841. {
  12842. public $watch1;
  12843. public $watch2;
  12844. protected $rule;
  12845. public function __construct(Rule $rule)
  12846. {
  12847. $this->rule = $rule;
  12848. $literals = $rule->getLiterals();
  12849. $literalCount = \count($literals);
  12850. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  12851. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  12852. }
  12853. public function watch2OnHighest(Decisions $decisions): void
  12854. {
  12855. $literals = $this->rule->getLiterals();
  12856. if (\count($literals) < 3 || $this->rule instanceof MultiConflictRule) {
  12857. return;
  12858. }
  12859. $watchLevel = 0;
  12860. foreach ($literals as $literal) {
  12861. $level = $decisions->decisionLevel($literal);
  12862. if ($level > $watchLevel) {
  12863. $this->watch2 = $literal;
  12864. $watchLevel = $level;
  12865. }
  12866. }
  12867. }
  12868. public function getRule(): Rule
  12869. {
  12870. return $this->rule;
  12871. }
  12872. public function getOtherWatch(int $literal): int
  12873. {
  12874. if ($this->watch1 == $literal) {
  12875. return $this->watch2;
  12876. }
  12877. return $this->watch1;
  12878. }
  12879. public function moveWatch(int $from, int $to): void
  12880. {
  12881. if ($this->watch1 == $from) {
  12882. $this->watch1 = $to;
  12883. } else {
  12884. $this->watch2 = $to;
  12885. }
  12886. }
  12887. }
  12888. <?php declare(strict_types=1);
  12889. namespace Composer\DependencyResolver;
  12890. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  12891. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  12892. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  12893. use Composer\IO\IOInterface;
  12894. use Composer\Package\BasePackage;
  12895. class Solver
  12896. {
  12897. private const BRANCH_LITERALS = 0;
  12898. private const BRANCH_LEVEL = 1;
  12899. protected $policy;
  12900. protected $pool;
  12901. protected $rules;
  12902. protected $watchGraph;
  12903. protected $decisions;
  12904. protected $fixedMap;
  12905. protected $propagateIndex;
  12906. protected $branches = array();
  12907. protected $problems = array();
  12908. protected $learnedPool = array();
  12909. protected $learnedWhy = array();
  12910. public $testFlagLearnedPositiveLiteral = false;
  12911. protected $io;
  12912. public function __construct(PolicyInterface $policy, Pool $pool, IOInterface $io)
  12913. {
  12914. $this->io = $io;
  12915. $this->policy = $policy;
  12916. $this->pool = $pool;
  12917. }
  12918. public function getRuleSetSize(): int
  12919. {
  12920. return \count($this->rules);
  12921. }
  12922. public function getPool(): Pool
  12923. {
  12924. return $this->pool;
  12925. }
  12926. private function makeAssertionRuleDecisions(): void
  12927. {
  12928. $decisionStart = \count($this->decisions) - 1;
  12929. $rulesCount = \count($this->rules);
  12930. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  12931. $rule = $this->rules->ruleById[$ruleIndex];
  12932. if (!$rule->isAssertion() || $rule->isDisabled()) {
  12933. continue;
  12934. }
  12935. $literals = $rule->getLiterals();
  12936. $literal = $literals[0];
  12937. if (!$this->decisions->decided($literal)) {
  12938. $this->decisions->decide($literal, 1, $rule);
  12939. continue;
  12940. }
  12941. if ($this->decisions->satisfy($literal)) {
  12942. continue;
  12943. }
  12944. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  12945. $rule->disable();
  12946. continue;
  12947. }
  12948. $conflict = $this->decisions->decisionRule($literal);
  12949. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  12950. $problem = new Problem();
  12951. $problem->addRule($rule);
  12952. $problem->addRule($conflict);
  12953. $rule->disable();
  12954. $this->problems[] = $problem;
  12955. continue;
  12956. }
  12957. $problem = new Problem();
  12958. $problem->addRule($rule);
  12959. $problem->addRule($conflict);
  12960. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_REQUEST) as $assertRule) {
  12961. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  12962. continue;
  12963. }
  12964. $assertRuleLiterals = $assertRule->getLiterals();
  12965. $assertRuleLiteral = $assertRuleLiterals[0];
  12966. if (abs($literal) !== abs($assertRuleLiteral)) {
  12967. continue;
  12968. }
  12969. $problem->addRule($assertRule);
  12970. $assertRule->disable();
  12971. }
  12972. $this->problems[] = $problem;
  12973. $this->decisions->resetToOffset($decisionStart);
  12974. $ruleIndex = -1;
  12975. }
  12976. }
  12977. protected function setupFixedMap(Request $request): void
  12978. {
  12979. $this->fixedMap = array();
  12980. foreach ($request->getFixedPackages() as $package) {
  12981. $this->fixedMap[$package->id] = $package;
  12982. }
  12983. }
  12984. protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
  12985. {
  12986. foreach ($request->getRequires() as $packageName => $constraint) {
  12987. if ($platformRequirementFilter->isIgnored($packageName)) {
  12988. continue;
  12989. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  12990. $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
  12991. }
  12992. if (!$this->pool->whatProvides($packageName, $constraint)) {
  12993. $problem = new Problem();
  12994. $problem->addRule(new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => $packageName, 'constraint' => $constraint)));
  12995. $this->problems[] = $problem;
  12996. }
  12997. }
  12998. }
  12999. public function solve(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter = null): LockTransaction
  13000. {
  13001. $platformRequirementFilter = $platformRequirementFilter ?: PlatformRequirementFilterFactory::ignoreNothing();
  13002. $this->setupFixedMap($request);
  13003. $this->io->writeError('Generating rules', true, IOInterface::DEBUG);
  13004. $ruleSetGenerator = new RuleSetGenerator($this->policy, $this->pool);
  13005. $this->rules = $ruleSetGenerator->getRulesFor($request, $platformRequirementFilter);
  13006. unset($ruleSetGenerator);
  13007. $this->checkForRootRequireProblems($request, $platformRequirementFilter);
  13008. $this->decisions = new Decisions($this->pool);
  13009. $this->watchGraph = new RuleWatchGraph;
  13010. foreach ($this->rules as $rule) {
  13011. $this->watchGraph->insert(new RuleWatchNode($rule));
  13012. }
  13013. $this->makeAssertionRuleDecisions();
  13014. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  13015. $before = microtime(true);
  13016. $this->runSat();
  13017. $this->io->writeError('', true, IOInterface::DEBUG);
  13018. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  13019. if ($this->problems) {
  13020. throw new SolverProblemsException($this->problems, $this->learnedPool);
  13021. }
  13022. return new LockTransaction($this->pool, $request->getPresentMap(), $request->getFixedPackagesMap(), $this->decisions);
  13023. }
  13024. protected function propagate(int $level): ?Rule
  13025. {
  13026. while ($this->decisions->validOffset($this->propagateIndex)) {
  13027. $decision = $this->decisions->atOffset($this->propagateIndex);
  13028. $conflict = $this->watchGraph->propagateLiteral(
  13029. $decision[Decisions::DECISION_LITERAL],
  13030. $level,
  13031. $this->decisions
  13032. );
  13033. $this->propagateIndex++;
  13034. if ($conflict) {
  13035. return $conflict;
  13036. }
  13037. }
  13038. return null;
  13039. }
  13040. private function revert(int $level): void
  13041. {
  13042. while (!$this->decisions->isEmpty()) {
  13043. $literal = $this->decisions->lastLiteral();
  13044. if ($this->decisions->undecided($literal)) {
  13045. break;
  13046. }
  13047. $decisionLevel = $this->decisions->decisionLevel($literal);
  13048. if ($decisionLevel <= $level) {
  13049. break;
  13050. }
  13051. $this->decisions->revertLast();
  13052. $this->propagateIndex = \count($this->decisions);
  13053. }
  13054. while (!empty($this->branches) && $this->branches[\count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  13055. array_pop($this->branches);
  13056. }
  13057. }
  13058. private function setPropagateLearn(int $level, $literal, Rule $rule): int
  13059. {
  13060. $level++;
  13061. $this->decisions->decide($literal, $level, $rule);
  13062. while (true) {
  13063. $rule = $this->propagate($level);
  13064. if (!$rule) {
  13065. break;
  13066. }
  13067. if ($level == 1) {
  13068. return $this->analyzeUnsolvable($rule);
  13069. }
  13070. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  13071. if ($newLevel <= 0 || $newLevel >= $level) {
  13072. throw new SolverBugException(
  13073. "Trying to revert to invalid level ".$newLevel." from level ".$level."."
  13074. );
  13075. }
  13076. $level = $newLevel;
  13077. $this->revert($level);
  13078. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  13079. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  13080. $ruleNode = new RuleWatchNode($newRule);
  13081. $ruleNode->watch2OnHighest($this->decisions);
  13082. $this->watchGraph->insert($ruleNode);
  13083. $this->decisions->decide($learnLiteral, $level, $newRule);
  13084. }
  13085. return $level;
  13086. }
  13087. private function selectAndInstall(int $level, array $decisionQueue, Rule $rule): int
  13088. {
  13089. $literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
  13090. $selectedLiteral = array_shift($literals);
  13091. if (\count($literals)) {
  13092. $this->branches[] = array($literals, $level);
  13093. }
  13094. return $this->setPropagateLearn($level, $selectedLiteral, $rule);
  13095. }
  13096. protected function analyze(int $level, Rule $rule): array
  13097. {
  13098. $analyzedRule = $rule;
  13099. $ruleLevel = 1;
  13100. $num = 0;
  13101. $l1num = 0;
  13102. $seen = array();
  13103. $learnedLiterals = array(null);
  13104. $decisionId = \count($this->decisions);
  13105. $this->learnedPool[] = array();
  13106. while (true) {
  13107. $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
  13108. foreach ($rule->getLiterals() as $literal) {
  13109. if ($rule instanceof MultiConflictRule && !$this->decisions->decided($literal)) {
  13110. continue;
  13111. }
  13112. if ($this->decisions->satisfy($literal)) {
  13113. continue;
  13114. }
  13115. if (isset($seen[abs($literal)])) {
  13116. continue;
  13117. }
  13118. $seen[abs($literal)] = true;
  13119. $l = $this->decisions->decisionLevel($literal);
  13120. if (1 === $l) {
  13121. $l1num++;
  13122. } elseif ($level === $l) {
  13123. $num++;
  13124. } else {
  13125. $learnedLiterals[] = $literal;
  13126. if ($l > $ruleLevel) {
  13127. $ruleLevel = $l;
  13128. }
  13129. }
  13130. }
  13131. unset($literal);
  13132. $l1retry = true;
  13133. while ($l1retry) {
  13134. $l1retry = false;
  13135. if (0 === $num && 0 === --$l1num) {
  13136. break 2;
  13137. }
  13138. while (true) {
  13139. if ($decisionId <= 0) {
  13140. throw new SolverBugException(
  13141. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  13142. );
  13143. }
  13144. $decisionId--;
  13145. $decision = $this->decisions->atOffset($decisionId);
  13146. $literal = $decision[Decisions::DECISION_LITERAL];
  13147. if (isset($seen[abs($literal)])) {
  13148. break;
  13149. }
  13150. }
  13151. unset($seen[abs($literal)]);
  13152. if (0 !== $num && 0 === --$num) {
  13153. if ($literal < 0) {
  13154. $this->testFlagLearnedPositiveLiteral = true;
  13155. }
  13156. $learnedLiterals[0] = -$literal;
  13157. if (!$l1num) {
  13158. break 2;
  13159. }
  13160. foreach ($learnedLiterals as $i => $learnedLiteral) {
  13161. if ($i !== 0) {
  13162. unset($seen[abs($learnedLiteral)]);
  13163. }
  13164. }
  13165. $l1num++;
  13166. $l1retry = true;
  13167. } else {
  13168. $decision = $this->decisions->atOffset($decisionId);
  13169. $rule = $decision[Decisions::DECISION_REASON];
  13170. if ($rule instanceof MultiConflictRule) {
  13171. foreach ($rule->getLiterals() as $literal) {
  13172. if (!isset($seen[abs($literal)]) && $this->decisions->satisfy(-$literal)) {
  13173. $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
  13174. $l = $this->decisions->decisionLevel($literal);
  13175. if (1 === $l) {
  13176. $l1num++;
  13177. } elseif ($level === $l) {
  13178. $num++;
  13179. } else {
  13180. $learnedLiterals[] = $literal;
  13181. if ($l > $ruleLevel) {
  13182. $ruleLevel = $l;
  13183. }
  13184. }
  13185. $seen[abs($literal)] = true;
  13186. break;
  13187. }
  13188. }
  13189. $l1retry = true;
  13190. }
  13191. }
  13192. }
  13193. $decision = $this->decisions->atOffset($decisionId);
  13194. $rule = $decision[Decisions::DECISION_REASON];
  13195. }
  13196. $why = \count($this->learnedPool) - 1;
  13197. if (!$learnedLiterals[0]) {
  13198. throw new SolverBugException(
  13199. "Did not find a learnable literal in analyzed rule $analyzedRule."
  13200. );
  13201. }
  13202. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  13203. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  13204. }
  13205. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen): void
  13206. {
  13207. $why = spl_object_hash($conflictRule);
  13208. $ruleSeen[$why] = true;
  13209. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  13210. $learnedWhy = $this->learnedWhy[$why];
  13211. $problemRules = $this->learnedPool[$learnedWhy];
  13212. foreach ($problemRules as $problemRule) {
  13213. if (!isset($ruleSeen[spl_object_hash($problemRule)])) {
  13214. $this->analyzeUnsolvableRule($problem, $problemRule, $ruleSeen);
  13215. }
  13216. }
  13217. return;
  13218. }
  13219. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  13220. return;
  13221. }
  13222. $problem->nextSection();
  13223. $problem->addRule($conflictRule);
  13224. }
  13225. private function analyzeUnsolvable(Rule $conflictRule): int
  13226. {
  13227. $problem = new Problem();
  13228. $problem->addRule($conflictRule);
  13229. $ruleSeen = array();
  13230. $this->analyzeUnsolvableRule($problem, $conflictRule, $ruleSeen);
  13231. $this->problems[] = $problem;
  13232. $seen = array();
  13233. $literals = $conflictRule->getLiterals();
  13234. foreach ($literals as $literal) {
  13235. if ($this->decisions->satisfy($literal)) {
  13236. continue;
  13237. }
  13238. $seen[abs($literal)] = true;
  13239. }
  13240. foreach ($this->decisions as $decision) {
  13241. $literal = $decision[Decisions::DECISION_LITERAL];
  13242. if (!isset($seen[abs($literal)])) {
  13243. continue;
  13244. }
  13245. $why = $decision[Decisions::DECISION_REASON];
  13246. $problem->addRule($why);
  13247. $this->analyzeUnsolvableRule($problem, $why, $ruleSeen);
  13248. $literals = $why->getLiterals();
  13249. foreach ($literals as $literal) {
  13250. if ($this->decisions->satisfy($literal)) {
  13251. continue;
  13252. }
  13253. $seen[abs($literal)] = true;
  13254. }
  13255. }
  13256. return 0;
  13257. }
  13258. private function enableDisableLearnedRules(): void
  13259. {
  13260. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  13261. $why = $this->learnedWhy[spl_object_hash($rule)];
  13262. $problemRules = $this->learnedPool[$why];
  13263. $foundDisabled = false;
  13264. foreach ($problemRules as $problemRule) {
  13265. if ($problemRule->isDisabled()) {
  13266. $foundDisabled = true;
  13267. break;
  13268. }
  13269. }
  13270. if ($foundDisabled && $rule->isEnabled()) {
  13271. $rule->disable();
  13272. } elseif (!$foundDisabled && $rule->isDisabled()) {
  13273. $rule->enable();
  13274. }
  13275. }
  13276. }
  13277. private function runSat(): void
  13278. {
  13279. $this->propagateIndex = 0;
  13280. $level = 1;
  13281. $systemLevel = $level + 1;
  13282. while (true) {
  13283. if (1 === $level) {
  13284. $conflictRule = $this->propagate($level);
  13285. if (null !== $conflictRule) {
  13286. if ($this->analyzeUnsolvable($conflictRule)) {
  13287. continue;
  13288. }
  13289. return;
  13290. }
  13291. }
  13292. if ($level < $systemLevel) {
  13293. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_REQUEST);
  13294. foreach ($iterator as $rule) {
  13295. if ($rule->isEnabled()) {
  13296. $decisionQueue = array();
  13297. $noneSatisfied = true;
  13298. foreach ($rule->getLiterals() as $literal) {
  13299. if ($this->decisions->satisfy($literal)) {
  13300. $noneSatisfied = false;
  13301. break;
  13302. }
  13303. if ($literal > 0 && $this->decisions->undecided($literal)) {
  13304. $decisionQueue[] = $literal;
  13305. }
  13306. }
  13307. if ($noneSatisfied && \count($decisionQueue)) {
  13308. $prunedQueue = array();
  13309. foreach ($decisionQueue as $literal) {
  13310. if (isset($this->fixedMap[abs($literal)])) {
  13311. $prunedQueue[] = $literal;
  13312. }
  13313. }
  13314. if (!empty($prunedQueue)) {
  13315. $decisionQueue = $prunedQueue;
  13316. }
  13317. }
  13318. if ($noneSatisfied && \count($decisionQueue)) {
  13319. $oLevel = $level;
  13320. $level = $this->selectAndInstall($level, $decisionQueue, $rule);
  13321. if (0 === $level) {
  13322. return;
  13323. }
  13324. if ($level <= $oLevel) {
  13325. break;
  13326. }
  13327. }
  13328. }
  13329. }
  13330. $systemLevel = $level + 1;
  13331. $iterator->next();
  13332. if ($iterator->valid()) {
  13333. continue;
  13334. }
  13335. }
  13336. if ($level < $systemLevel) {
  13337. $systemLevel = $level;
  13338. }
  13339. $rulesCount = \count($this->rules);
  13340. $pass = 1;
  13341. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  13342. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  13343. if ($i == $rulesCount) {
  13344. if (1 === $pass) {
  13345. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  13346. } else {
  13347. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  13348. }
  13349. $i = 0;
  13350. $pass++;
  13351. }
  13352. $rule = $this->rules->ruleById[$i];
  13353. $literals = $rule->getLiterals();
  13354. if ($rule->isDisabled()) {
  13355. continue;
  13356. }
  13357. $decisionQueue = array();
  13358. foreach ($literals as $literal) {
  13359. if ($literal <= 0) {
  13360. if (!$this->decisions->decidedInstall($literal)) {
  13361. continue 2;
  13362. }
  13363. } else {
  13364. if ($this->decisions->decidedInstall($literal)) {
  13365. continue 2;
  13366. }
  13367. if ($this->decisions->undecided($literal)) {
  13368. $decisionQueue[] = $literal;
  13369. }
  13370. }
  13371. }
  13372. if (\count($decisionQueue) < 2) {
  13373. continue;
  13374. }
  13375. $level = $this->selectAndInstall($level, $decisionQueue, $rule);
  13376. if (0 === $level) {
  13377. return;
  13378. }
  13379. $rulesCount = \count($this->rules);
  13380. $n = -1;
  13381. }
  13382. if ($level < $systemLevel) {
  13383. continue;
  13384. }
  13385. if (\count($this->branches)) {
  13386. $lastLiteral = null;
  13387. $lastLevel = null;
  13388. $lastBranchIndex = 0;
  13389. $lastBranchOffset = 0;
  13390. for ($i = \count($this->branches) - 1; $i >= 0; $i--) {
  13391. list($literals, $l) = $this->branches[$i];
  13392. foreach ($literals as $offset => $literal) {
  13393. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  13394. $lastLiteral = $literal;
  13395. $lastBranchIndex = $i;
  13396. $lastBranchOffset = $offset;
  13397. $lastLevel = $l;
  13398. }
  13399. }
  13400. }
  13401. if ($lastLiteral) {
  13402. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  13403. $level = $lastLevel;
  13404. $this->revert($level);
  13405. $why = $this->decisions->lastReason();
  13406. $level = $this->setPropagateLearn($level, $lastLiteral, $why);
  13407. if ($level == 0) {
  13408. return;
  13409. }
  13410. continue;
  13411. }
  13412. }
  13413. break;
  13414. }
  13415. }
  13416. }
  13417. <?php declare(strict_types=1);
  13418. namespace Composer\DependencyResolver;
  13419. class SolverBugException extends \RuntimeException
  13420. {
  13421. public function __construct(string $message)
  13422. {
  13423. parent::__construct(
  13424. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  13425. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  13426. );
  13427. }
  13428. }
  13429. <?php declare(strict_types=1);
  13430. namespace Composer\DependencyResolver;
  13431. use Composer\Util\IniHelper;
  13432. use Composer\Repository\RepositorySet;
  13433. class SolverProblemsException extends \RuntimeException
  13434. {
  13435. public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
  13436. protected $problems;
  13437. protected $learnedPool;
  13438. public function __construct(array $problems, array $learnedPool)
  13439. {
  13440. $this->problems = $problems;
  13441. $this->learnedPool = $learnedPool;
  13442. parent::__construct('Failed resolving dependencies with '.count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED);
  13443. }
  13444. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, bool $isDevExtraction = false): string
  13445. {
  13446. $installedMap = $request->getPresentMap(true);
  13447. $missingExtensions = array();
  13448. $isCausedByLock = false;
  13449. $problems = array();
  13450. foreach ($this->problems as $problem) {
  13451. $problems[] = $problem->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $this->learnedPool)."\n";
  13452. $missingExtensions = array_merge($missingExtensions, $this->getExtensionProblems($problem->getReasons()));
  13453. $isCausedByLock = $isCausedByLock || $problem->isCausedByLock($repositorySet, $request, $pool);
  13454. }
  13455. $i = 1;
  13456. $text = "\n";
  13457. foreach (array_unique($problems) as $problem) {
  13458. $text .= " Problem ".($i++).$problem;
  13459. }
  13460. $hints = array();
  13461. if (!$isDevExtraction && (strpos($text, 'could not be found') || strpos($text, 'no matching package found'))) {
  13462. $hints[] = "Potential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  13463. }
  13464. if (!empty($missingExtensions)) {
  13465. $hints[] = $this->createExtensionHint($missingExtensions);
  13466. }
  13467. if ($isCausedByLock && !$isDevExtraction && !$request->getUpdateAllowTransitiveRootDependencies()) {
  13468. $hints[] = "Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.";
  13469. }
  13470. if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match') && strpos($text, '- ocramius/package-versions')) {
  13471. $hints[] = "<warning>ocramius/package-versions only provides support for Composer 2 in 1.8+, which requires PHP 7.4.</warning>\nIf you can not upgrade PHP you can require <info>composer/package-versions-deprecated</info> to resolve this with PHP 7.0+.";
  13472. }
  13473. if (!class_exists('PHPUnit\Framework\TestCase', false)) {
  13474. if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match')) {
  13475. $hints[] = "You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.";
  13476. }
  13477. }
  13478. if ($hints) {
  13479. $text .= "\n" . implode("\n\n", $hints);
  13480. }
  13481. return $text;
  13482. }
  13483. public function getProblems(): array
  13484. {
  13485. return $this->problems;
  13486. }
  13487. private function createExtensionHint(array $missingExtensions): string
  13488. {
  13489. $paths = IniHelper::getAll();
  13490. if (count($paths) === 1 && empty($paths[0])) {
  13491. return '';
  13492. }
  13493. $ignoreExtensionsArguments = implode(" ", array_map(function ($extension) {
  13494. return "--ignore-platform-req=$extension";
  13495. }, $missingExtensions));
  13496. $text = "To enable extensions, verify that they are enabled in your .ini files:\n - ";
  13497. $text .= implode("\n - ", $paths);
  13498. $text .= "\nYou can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.";
  13499. $text .= "\nAlternatively, you can run Composer with `$ignoreExtensionsArguments` to temporarily ignore these required extensions.";
  13500. return $text;
  13501. }
  13502. private function getExtensionProblems(array $reasonSets): array
  13503. {
  13504. $missingExtensions = array();
  13505. foreach ($reasonSets as $reasonSet) {
  13506. foreach ($reasonSet as $rule) {
  13507. $required = $rule->getRequiredPackage();
  13508. if (null !== $required && 0 === strpos($required, 'ext-')) {
  13509. $missingExtensions[$required] = 1;
  13510. }
  13511. }
  13512. }
  13513. return array_keys($missingExtensions);
  13514. }
  13515. }
  13516. <?php declare(strict_types=1);
  13517. namespace Composer\DependencyResolver;
  13518. use Composer\Package\AliasPackage;
  13519. use Composer\Package\Link;
  13520. use Composer\Package\PackageInterface;
  13521. use Composer\Repository\PlatformRepository;
  13522. use Composer\DependencyResolver\Operation\OperationInterface;
  13523. class Transaction
  13524. {
  13525. protected $operations;
  13526. protected $presentPackages;
  13527. protected $resultPackageMap;
  13528. protected $resultPackagesByName = array();
  13529. public function __construct(array $presentPackages, array $resultPackages)
  13530. {
  13531. $this->presentPackages = $presentPackages;
  13532. $this->setResultPackageMaps($resultPackages);
  13533. $this->operations = $this->calculateOperations();
  13534. }
  13535. public function getOperations(): array
  13536. {
  13537. return $this->operations;
  13538. }
  13539. private function setResultPackageMaps(array $resultPackages): void
  13540. {
  13541. $packageSort = function (PackageInterface $a, PackageInterface $b): int {
  13542. if ($a->getName() == $b->getName()) {
  13543. if ($a instanceof AliasPackage != $b instanceof AliasPackage) {
  13544. return $a instanceof AliasPackage ? -1 : 1;
  13545. }
  13546. return strcmp($b->getVersion(), $a->getVersion());
  13547. }
  13548. return strcmp($b->getName(), $a->getName());
  13549. };
  13550. $this->resultPackageMap = array();
  13551. foreach ($resultPackages as $package) {
  13552. $this->resultPackageMap[spl_object_hash($package)] = $package;
  13553. foreach ($package->getNames() as $name) {
  13554. $this->resultPackagesByName[$name][] = $package;
  13555. }
  13556. }
  13557. uasort($this->resultPackageMap, $packageSort);
  13558. foreach ($this->resultPackagesByName as $name => $packages) {
  13559. uasort($this->resultPackagesByName[$name], $packageSort);
  13560. }
  13561. }
  13562. protected function calculateOperations(): array
  13563. {
  13564. $operations = array();
  13565. $presentPackageMap = array();
  13566. $removeMap = array();
  13567. $presentAliasMap = array();
  13568. $removeAliasMap = array();
  13569. foreach ($this->presentPackages as $package) {
  13570. if ($package instanceof AliasPackage) {
  13571. $presentAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
  13572. $removeAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
  13573. } else {
  13574. $presentPackageMap[$package->getName()] = $package;
  13575. $removeMap[$package->getName()] = $package;
  13576. }
  13577. }
  13578. $stack = $this->getRootPackages();
  13579. $visited = array();
  13580. $processed = array();
  13581. while (!empty($stack)) {
  13582. $package = array_pop($stack);
  13583. if (isset($processed[spl_object_hash($package)])) {
  13584. continue;
  13585. }
  13586. if (!isset($visited[spl_object_hash($package)])) {
  13587. $visited[spl_object_hash($package)] = true;
  13588. $stack[] = $package;
  13589. if ($package instanceof AliasPackage) {
  13590. $stack[] = $package->getAliasOf();
  13591. } else {
  13592. foreach ($package->getRequires() as $link) {
  13593. $possibleRequires = $this->getProvidersInResult($link);
  13594. foreach ($possibleRequires as $require) {
  13595. $stack[] = $require;
  13596. }
  13597. }
  13598. }
  13599. } elseif (!isset($processed[spl_object_hash($package)])) {
  13600. $processed[spl_object_hash($package)] = true;
  13601. if ($package instanceof AliasPackage) {
  13602. $aliasKey = $package->getName().'::'.$package->getVersion();
  13603. if (isset($presentAliasMap[$aliasKey])) {
  13604. unset($removeAliasMap[$aliasKey]);
  13605. } else {
  13606. $operations[] = new Operation\MarkAliasInstalledOperation($package);
  13607. }
  13608. } else {
  13609. if (isset($presentPackageMap[$package->getName()])) {
  13610. $source = $presentPackageMap[$package->getName()];
  13611. if ($package->getVersion() != $presentPackageMap[$package->getName()]->getVersion() ||
  13612. $package->getDistReference() !== $presentPackageMap[$package->getName()]->getDistReference() ||
  13613. $package->getSourceReference() !== $presentPackageMap[$package->getName()]->getSourceReference()
  13614. ) {
  13615. $operations[] = new Operation\UpdateOperation($source, $package);
  13616. }
  13617. unset($removeMap[$package->getName()]);
  13618. } else {
  13619. $operations[] = new Operation\InstallOperation($package);
  13620. unset($removeMap[$package->getName()]);
  13621. }
  13622. }
  13623. }
  13624. }
  13625. foreach ($removeMap as $name => $package) {
  13626. array_unshift($operations, new Operation\UninstallOperation($package));
  13627. }
  13628. foreach ($removeAliasMap as $nameVersion => $package) {
  13629. $operations[] = new Operation\MarkAliasUninstalledOperation($package);
  13630. }
  13631. $operations = $this->movePluginsToFront($operations);
  13632. $operations = $this->moveUninstallsToFront($operations);
  13633. return $this->operations = $operations;
  13634. }
  13635. protected function getRootPackages(): array
  13636. {
  13637. $roots = $this->resultPackageMap;
  13638. foreach ($this->resultPackageMap as $packageHash => $package) {
  13639. if (!isset($roots[$packageHash])) {
  13640. continue;
  13641. }
  13642. foreach ($package->getRequires() as $link) {
  13643. $possibleRequires = $this->getProvidersInResult($link);
  13644. foreach ($possibleRequires as $require) {
  13645. if ($require !== $package) {
  13646. unset($roots[spl_object_hash($require)]);
  13647. }
  13648. }
  13649. }
  13650. }
  13651. return $roots;
  13652. }
  13653. protected function getProvidersInResult(Link $link): array
  13654. {
  13655. if (!isset($this->resultPackagesByName[$link->getTarget()])) {
  13656. return array();
  13657. }
  13658. return $this->resultPackagesByName[$link->getTarget()];
  13659. }
  13660. private function movePluginsToFront(array $operations): array
  13661. {
  13662. $dlModifyingPluginsNoDeps = array();
  13663. $dlModifyingPluginsWithDeps = array();
  13664. $dlModifyingPluginRequires = array();
  13665. $pluginsNoDeps = array();
  13666. $pluginsWithDeps = array();
  13667. $pluginRequires = array();
  13668. foreach (array_reverse($operations, true) as $idx => $op) {
  13669. if ($op instanceof Operation\InstallOperation) {
  13670. $package = $op->getPackage();
  13671. } elseif ($op instanceof Operation\UpdateOperation) {
  13672. $package = $op->getTargetPackage();
  13673. } else {
  13674. continue;
  13675. }
  13676. $isDownloadsModifyingPlugin = $package->getType() === 'composer-plugin' && ($extra = $package->getExtra()) && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true;
  13677. if ($isDownloadsModifyingPlugin || count(array_intersect($package->getNames(), $dlModifyingPluginRequires))) {
  13678. $requires = array_filter(array_keys($package->getRequires()), function ($req): bool {
  13679. return !PlatformRepository::isPlatformPackage($req);
  13680. });
  13681. if ($isDownloadsModifyingPlugin && !count($requires)) {
  13682. array_unshift($dlModifyingPluginsNoDeps, $op);
  13683. } else {
  13684. $dlModifyingPluginRequires = array_merge($dlModifyingPluginRequires, $requires);
  13685. array_unshift($dlModifyingPluginsWithDeps, $op);
  13686. }
  13687. unset($operations[$idx]);
  13688. continue;
  13689. }
  13690. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13691. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13692. $requires = array_filter(array_keys($package->getRequires()), function ($req): bool {
  13693. return !PlatformRepository::isPlatformPackage($req);
  13694. });
  13695. if ($isPlugin && !count($requires)) {
  13696. array_unshift($pluginsNoDeps, $op);
  13697. } else {
  13698. $pluginRequires = array_merge($pluginRequires, $requires);
  13699. array_unshift($pluginsWithDeps, $op);
  13700. }
  13701. unset($operations[$idx]);
  13702. }
  13703. }
  13704. return array_merge($dlModifyingPluginsNoDeps, $dlModifyingPluginsWithDeps, $pluginsNoDeps, $pluginsWithDeps, $operations);
  13705. }
  13706. private function moveUninstallsToFront(array $operations): array
  13707. {
  13708. $uninstOps = array();
  13709. foreach ($operations as $idx => $op) {
  13710. if ($op instanceof Operation\UninstallOperation || $op instanceof Operation\MarkAliasUninstalledOperation) {
  13711. $uninstOps[] = $op;
  13712. unset($operations[$idx]);
  13713. }
  13714. }
  13715. return array_merge($uninstOps, $operations);
  13716. }
  13717. }
  13718. <?php declare(strict_types=1);
  13719. namespace Composer\Downloader;
  13720. use Composer\Package\PackageInterface;
  13721. use Composer\Util\Platform;
  13722. use Symfony\Component\Finder\Finder;
  13723. use React\Promise\PromiseInterface;
  13724. use Composer\DependencyResolver\Operation\InstallOperation;
  13725. abstract class ArchiveDownloader extends FileDownloader
  13726. {
  13727. protected $cleanupExecuted = array();
  13728. public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  13729. {
  13730. unset($this->cleanupExecuted[$package->getName()]);
  13731. return parent::prepare($type, $package, $path, $prevPackage);
  13732. }
  13733. public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  13734. {
  13735. $this->cleanupExecuted[$package->getName()] = true;
  13736. return parent::cleanup($type, $package, $path, $prevPackage);
  13737. }
  13738. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  13739. {
  13740. if ($output) {
  13741. $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
  13742. }
  13743. $vendorDir = $this->config->get('vendor-dir');
  13744. if (false === strpos($this->filesystem->normalizePath($vendorDir), $this->filesystem->normalizePath($path.DIRECTORY_SEPARATOR))) {
  13745. $this->filesystem->emptyDirectory($path);
  13746. }
  13747. do {
  13748. $temporaryDir = $vendorDir.'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  13749. } while (is_dir($temporaryDir));
  13750. $this->addCleanupPath($package, $temporaryDir);
  13751. if (!is_dir($path) || realpath($path) !== Platform::getCwd()) {
  13752. $this->addCleanupPath($package, $path);
  13753. }
  13754. $this->filesystem->ensureDirectoryExists($temporaryDir);
  13755. $fileName = $this->getFileName($package, $path);
  13756. $filesystem = $this->filesystem;
  13757. $cleanup = function () use ($path, $filesystem, $temporaryDir, $package) {
  13758. $this->clearLastCacheWrite($package);
  13759. $filesystem->removeDirectory($temporaryDir);
  13760. if (is_dir($path) && realpath($path) !== Platform::getCwd()) {
  13761. $filesystem->removeDirectory($path);
  13762. }
  13763. $this->removeCleanupPath($package, $temporaryDir);
  13764. $this->removeCleanupPath($package, realpath($path));
  13765. };
  13766. try {
  13767. $promise = $this->extract($package, $fileName, $temporaryDir);
  13768. } catch (\Exception $e) {
  13769. $cleanup();
  13770. throw $e;
  13771. }
  13772. return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
  13773. if (file_exists($fileName)) {
  13774. $filesystem->unlink($fileName);
  13775. }
  13776. $getFolderContent = function ($dir): array {
  13777. $finder = Finder::create()
  13778. ->ignoreVCS(false)
  13779. ->ignoreDotFiles(false)
  13780. ->notName('.DS_Store')
  13781. ->depth(0)
  13782. ->in($dir);
  13783. return iterator_to_array($finder);
  13784. };
  13785. $renameRecursively = null;
  13786. $renameRecursively = function ($from, $to) use ($filesystem, $getFolderContent, $package, &$renameRecursively) {
  13787. $contentDir = $getFolderContent($from);
  13788. foreach ($contentDir as $file) {
  13789. $file = (string) $file;
  13790. if (is_dir($to . '/' . basename($file))) {
  13791. if (!is_dir($file)) {
  13792. throw new \RuntimeException('Installing '.$package.' would lead to overwriting the '.$to.'/'.basename($file).' directory with a file from the package, invalid operation.');
  13793. }
  13794. $renameRecursively($file, $to . '/' . basename($file));
  13795. } else {
  13796. $filesystem->rename($file, $to . '/' . basename($file));
  13797. }
  13798. }
  13799. };
  13800. $renameAsOne = false;
  13801. if (!file_exists($path)) {
  13802. $renameAsOne = true;
  13803. } elseif ($filesystem->isDirEmpty($path)) {
  13804. try {
  13805. if ($filesystem->removeDirectoryPhp($path)) {
  13806. $renameAsOne = true;
  13807. }
  13808. } catch (\RuntimeException $e) {
  13809. }
  13810. }
  13811. $contentDir = $getFolderContent($temporaryDir);
  13812. $singleDirAtTopLevel = 1 === count($contentDir) && is_dir((string) reset($contentDir));
  13813. if ($renameAsOne) {
  13814. if ($singleDirAtTopLevel) {
  13815. $extractedDir = (string) reset($contentDir);
  13816. } else {
  13817. $extractedDir = $temporaryDir;
  13818. }
  13819. $filesystem->rename($extractedDir, $path);
  13820. } else {
  13821. $from = $temporaryDir;
  13822. if ($singleDirAtTopLevel) {
  13823. $from = (string) reset($contentDir);
  13824. }
  13825. $renameRecursively($from, $path);
  13826. }
  13827. $promise = $filesystem->removeDirectoryAsync($temporaryDir);
  13828. return $promise->then(function () use ($package, $path, $temporaryDir) {
  13829. $this->removeCleanupPath($package, $temporaryDir);
  13830. $this->removeCleanupPath($package, $path);
  13831. });
  13832. }, function ($e) use ($cleanup) {
  13833. $cleanup();
  13834. throw $e;
  13835. });
  13836. }
  13837. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  13838. {
  13839. return ': Extracting archive';
  13840. }
  13841. abstract protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface;
  13842. }
  13843. <?php declare(strict_types=1);
  13844. namespace Composer\Downloader;
  13845. use Composer\Package\PackageInterface;
  13846. interface ChangeReportInterface
  13847. {
  13848. public function getLocalChanges(PackageInterface $package, string $path): ?string;
  13849. }
  13850. <?php declare(strict_types=1);
  13851. namespace Composer\Downloader;
  13852. use Composer\Package\PackageInterface;
  13853. use Composer\IO\IOInterface;
  13854. use Composer\Pcre\Preg;
  13855. use Composer\Util\Filesystem;
  13856. use Composer\Exception\IrrecoverableDownloadException;
  13857. use React\Promise\PromiseInterface;
  13858. class DownloadManager
  13859. {
  13860. private $io;
  13861. private $preferDist = false;
  13862. private $preferSource;
  13863. private $packagePreferences = array();
  13864. private $filesystem;
  13865. private $downloaders = array();
  13866. public function __construct(IOInterface $io, bool $preferSource = false, Filesystem $filesystem = null)
  13867. {
  13868. $this->io = $io;
  13869. $this->preferSource = $preferSource;
  13870. $this->filesystem = $filesystem ?: new Filesystem();
  13871. }
  13872. public function setPreferSource(bool $preferSource): self
  13873. {
  13874. $this->preferSource = $preferSource;
  13875. return $this;
  13876. }
  13877. public function setPreferDist(bool $preferDist): self
  13878. {
  13879. $this->preferDist = $preferDist;
  13880. return $this;
  13881. }
  13882. public function setPreferences(array $preferences): self
  13883. {
  13884. $this->packagePreferences = $preferences;
  13885. return $this;
  13886. }
  13887. public function setDownloader(string $type, DownloaderInterface $downloader): self
  13888. {
  13889. $type = strtolower($type);
  13890. $this->downloaders[$type] = $downloader;
  13891. return $this;
  13892. }
  13893. public function getDownloader(string $type): DownloaderInterface
  13894. {
  13895. $type = strtolower($type);
  13896. if (!isset($this->downloaders[$type])) {
  13897. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  13898. }
  13899. return $this->downloaders[$type];
  13900. }
  13901. public function getDownloaderForPackage(PackageInterface $package): ?DownloaderInterface
  13902. {
  13903. $installationSource = $package->getInstallationSource();
  13904. if ('metapackage' === $package->getType()) {
  13905. return null;
  13906. }
  13907. if ('dist' === $installationSource) {
  13908. $downloader = $this->getDownloader($package->getDistType());
  13909. } elseif ('source' === $installationSource) {
  13910. $downloader = $this->getDownloader($package->getSourceType());
  13911. } else {
  13912. throw new \InvalidArgumentException(
  13913. 'Package '.$package.' does not have an installation source set'
  13914. );
  13915. }
  13916. if ($installationSource !== $downloader->getInstallationSource()) {
  13917. throw new \LogicException(sprintf(
  13918. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  13919. get_class($downloader),
  13920. $downloader->getInstallationSource(),
  13921. $installationSource,
  13922. $package
  13923. ));
  13924. }
  13925. return $downloader;
  13926. }
  13927. public function getDownloaderType(DownloaderInterface $downloader): string
  13928. {
  13929. return array_search($downloader, $this->downloaders);
  13930. }
  13931. public function download(PackageInterface $package, string $targetDir, PackageInterface $prevPackage = null): PromiseInterface
  13932. {
  13933. $targetDir = $this->normalizeTargetDir($targetDir);
  13934. $this->filesystem->ensureDirectoryExists(dirname($targetDir));
  13935. $sources = $this->getAvailableSources($package, $prevPackage);
  13936. $io = $this->io;
  13937. $download = function ($retry = false) use (&$sources, $io, $package, $targetDir, &$download, $prevPackage) {
  13938. $source = array_shift($sources);
  13939. if ($retry) {
  13940. $io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  13941. }
  13942. $package->setInstallationSource($source);
  13943. $downloader = $this->getDownloaderForPackage($package);
  13944. if (!$downloader) {
  13945. return \React\Promise\resolve(null);
  13946. }
  13947. $handleError = function ($e) use ($sources, $source, $package, $io, $download) {
  13948. if ($e instanceof \RuntimeException && !$e instanceof IrrecoverableDownloadException) {
  13949. if (!$sources) {
  13950. throw $e;
  13951. }
  13952. $io->writeError(
  13953. ' <warning>Failed to download '.
  13954. $package->getPrettyName().
  13955. ' from ' . $source . ': '.
  13956. $e->getMessage().'</warning>'
  13957. );
  13958. return $download(true);
  13959. }
  13960. throw $e;
  13961. };
  13962. try {
  13963. $result = $downloader->download($package, $targetDir, $prevPackage);
  13964. } catch (\Exception $e) {
  13965. return $handleError($e);
  13966. }
  13967. $res = $result->then(function ($res) {
  13968. return $res;
  13969. }, $handleError);
  13970. return $res;
  13971. };
  13972. return $download();
  13973. }
  13974. public function prepare(string $type, PackageInterface $package, string $targetDir, PackageInterface $prevPackage = null): PromiseInterface
  13975. {
  13976. $targetDir = $this->normalizeTargetDir($targetDir);
  13977. $downloader = $this->getDownloaderForPackage($package);
  13978. if ($downloader) {
  13979. return $downloader->prepare($type, $package, $targetDir, $prevPackage);
  13980. }
  13981. return \React\Promise\resolve(null);
  13982. }
  13983. public function install(PackageInterface $package, string $targetDir): PromiseInterface
  13984. {
  13985. $targetDir = $this->normalizeTargetDir($targetDir);
  13986. $downloader = $this->getDownloaderForPackage($package);
  13987. if ($downloader) {
  13988. return $downloader->install($package, $targetDir);
  13989. }
  13990. return \React\Promise\resolve(null);
  13991. }
  13992. public function update(PackageInterface $initial, PackageInterface $target, string $targetDir): PromiseInterface
  13993. {
  13994. $targetDir = $this->normalizeTargetDir($targetDir);
  13995. $downloader = $this->getDownloaderForPackage($target);
  13996. $initialDownloader = $this->getDownloaderForPackage($initial);
  13997. if (!$initialDownloader && !$downloader) {
  13998. return \React\Promise\resolve(null);
  13999. }
  14000. if (!$downloader) {
  14001. return $initialDownloader->remove($initial, $targetDir);
  14002. }
  14003. $initialType = $this->getDownloaderType($initialDownloader);
  14004. $targetType = $this->getDownloaderType($downloader);
  14005. if ($initialType === $targetType) {
  14006. try {
  14007. return $downloader->update($initial, $target, $targetDir);
  14008. } catch (\RuntimeException $e) {
  14009. if (!$this->io->isInteractive()) {
  14010. throw $e;
  14011. }
  14012. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  14013. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ')) {
  14014. throw $e;
  14015. }
  14016. }
  14017. }
  14018. $promise = $initialDownloader->remove($initial, $targetDir);
  14019. return $promise->then(function ($res) use ($target, $targetDir): PromiseInterface {
  14020. return $this->install($target, $targetDir);
  14021. });
  14022. }
  14023. public function remove(PackageInterface $package, string $targetDir): PromiseInterface
  14024. {
  14025. $targetDir = $this->normalizeTargetDir($targetDir);
  14026. $downloader = $this->getDownloaderForPackage($package);
  14027. if ($downloader) {
  14028. return $downloader->remove($package, $targetDir);
  14029. }
  14030. return \React\Promise\resolve(null);
  14031. }
  14032. public function cleanup(string $type, PackageInterface $package, string $targetDir, PackageInterface $prevPackage = null): PromiseInterface
  14033. {
  14034. $targetDir = $this->normalizeTargetDir($targetDir);
  14035. $downloader = $this->getDownloaderForPackage($package);
  14036. if ($downloader) {
  14037. return $downloader->cleanup($type, $package, $targetDir, $prevPackage);
  14038. }
  14039. return \React\Promise\resolve(null);
  14040. }
  14041. protected function resolvePackageInstallPreference(PackageInterface $package): string
  14042. {
  14043. foreach ($this->packagePreferences as $pattern => $preference) {
  14044. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  14045. if (Preg::isMatch($pattern, $package->getName())) {
  14046. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  14047. return 'dist';
  14048. }
  14049. return 'source';
  14050. }
  14051. }
  14052. return $package->isDev() ? 'source' : 'dist';
  14053. }
  14054. private function getAvailableSources(PackageInterface $package, PackageInterface $prevPackage = null): array
  14055. {
  14056. $sourceType = $package->getSourceType();
  14057. $distType = $package->getDistType();
  14058. $sources = array();
  14059. if ($sourceType) {
  14060. $sources[] = 'source';
  14061. }
  14062. if ($distType) {
  14063. $sources[] = 'dist';
  14064. }
  14065. if (empty($sources)) {
  14066. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  14067. }
  14068. if (
  14069. $prevPackage
  14070. && in_array($prevPackage->getInstallationSource(), $sources, true)
  14071. && !(!$prevPackage->isDev() && $prevPackage->getInstallationSource() === 'dist' && $package->isDev())
  14072. ) {
  14073. $prevSource = $prevPackage->getInstallationSource();
  14074. usort($sources, function ($a, $b) use ($prevSource): int {
  14075. return $a === $prevSource ? -1 : 1;
  14076. });
  14077. return $sources;
  14078. }
  14079. if (!$this->preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  14080. $sources = array_reverse($sources);
  14081. }
  14082. return $sources;
  14083. }
  14084. private function normalizeTargetDir(string $dir): string
  14085. {
  14086. if ($dir === '\\' || $dir === '/') {
  14087. return $dir;
  14088. }
  14089. return rtrim($dir, '\\/');
  14090. }
  14091. }
  14092. <?php declare(strict_types=1);
  14093. namespace Composer\Downloader;
  14094. use Composer\Package\PackageInterface;
  14095. use React\Promise\PromiseInterface;
  14096. interface DownloaderInterface
  14097. {
  14098. public function getInstallationSource(): string;
  14099. public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface;
  14100. public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface;
  14101. public function install(PackageInterface $package, string $path): PromiseInterface;
  14102. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface;
  14103. public function remove(PackageInterface $package, string $path): PromiseInterface;
  14104. public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface;
  14105. }
  14106. <?php declare(strict_types=1);
  14107. namespace Composer\Downloader;
  14108. use Composer\Package\PackageInterface;
  14109. interface DvcsDownloaderInterface
  14110. {
  14111. public function getUnpushedChanges(PackageInterface $package, string $path): ?string;
  14112. }
  14113. <?php declare(strict_types=1);
  14114. namespace Composer\Downloader;
  14115. use Composer\Config;
  14116. use Composer\Cache;
  14117. use Composer\IO\IOInterface;
  14118. use Composer\IO\NullIO;
  14119. use Composer\Exception\IrrecoverableDownloadException;
  14120. use Composer\Package\Comparer\Comparer;
  14121. use Composer\DependencyResolver\Operation\UpdateOperation;
  14122. use Composer\DependencyResolver\Operation\InstallOperation;
  14123. use Composer\DependencyResolver\Operation\UninstallOperation;
  14124. use Composer\Package\PackageInterface;
  14125. use Composer\Plugin\PluginEvents;
  14126. use Composer\Plugin\PostFileDownloadEvent;
  14127. use Composer\Plugin\PreFileDownloadEvent;
  14128. use Composer\EventDispatcher\EventDispatcher;
  14129. use Composer\Util\Filesystem;
  14130. use Composer\Util\Platform;
  14131. use Composer\Util\Silencer;
  14132. use Composer\Util\HttpDownloader;
  14133. use Composer\Util\Url as UrlUtil;
  14134. use Composer\Util\ProcessExecutor;
  14135. use React\Promise\PromiseInterface;
  14136. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  14137. {
  14138. protected $io;
  14139. protected $config;
  14140. protected $httpDownloader;
  14141. protected $filesystem;
  14142. protected $cache;
  14143. protected $eventDispatcher;
  14144. protected $process;
  14145. public static $downloadMetadata = array();
  14146. private $lastCacheWrites = array();
  14147. private $additionalCleanupPaths = array();
  14148. public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, Filesystem $filesystem = null, ProcessExecutor $process = null)
  14149. {
  14150. $this->io = $io;
  14151. $this->config = $config;
  14152. $this->eventDispatcher = $eventDispatcher;
  14153. $this->httpDownloader = $httpDownloader;
  14154. $this->cache = $cache;
  14155. $this->process = $process ?? new ProcessExecutor($io);
  14156. $this->filesystem = $filesystem ?: new Filesystem($this->process);
  14157. if ($this->cache && $this->cache->gcIsNecessary()) {
  14158. $this->io->writeError('Running cache garbage collection', true, IOInterface::VERY_VERBOSE);
  14159. $this->cache->gc((int) $config->get('cache-files-ttl'), (int) $config->get('cache-files-maxsize'));
  14160. }
  14161. }
  14162. public function getInstallationSource(): string
  14163. {
  14164. return 'dist';
  14165. }
  14166. public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  14167. {
  14168. if (!$package->getDistUrl()) {
  14169. throw new \InvalidArgumentException('The given package is missing url information');
  14170. }
  14171. $cacheKeyGenerator = function (PackageInterface $package, $key): string {
  14172. $cacheKey = sha1($key);
  14173. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  14174. };
  14175. $retries = 3;
  14176. $distUrls = $package->getDistUrls();
  14177. $urls = array();
  14178. foreach ($distUrls as $index => $url) {
  14179. $processedUrl = $this->processUrl($package, $url);
  14180. $urls[$index] = array(
  14181. 'base' => $url,
  14182. 'processed' => $processedUrl,
  14183. 'cacheKey' => $cacheKeyGenerator($package, $processedUrl),
  14184. );
  14185. }
  14186. $fileName = $this->getFileName($package, $path);
  14187. $this->filesystem->ensureDirectoryExists($path);
  14188. $this->filesystem->ensureDirectoryExists(dirname($fileName));
  14189. $io = $this->io;
  14190. $cache = $this->cache;
  14191. $httpDownloader = $this->httpDownloader;
  14192. $eventDispatcher = $this->eventDispatcher;
  14193. $filesystem = $this->filesystem;
  14194. $accept = null;
  14195. $reject = null;
  14196. $download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) {
  14197. $url = reset($urls);
  14198. $index = key($urls);
  14199. if ($eventDispatcher) {
  14200. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed'], 'package', $package);
  14201. $eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  14202. if ($preFileDownloadEvent->getCustomCacheKey() !== null) {
  14203. $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getCustomCacheKey());
  14204. } elseif ($preFileDownloadEvent->getProcessedUrl() !== $url['processed']) {
  14205. $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getProcessedUrl());
  14206. }
  14207. $url['processed'] = $preFileDownloadEvent->getProcessedUrl();
  14208. }
  14209. $urls[$index] = $url;
  14210. $checksum = $package->getDistSha1Checksum();
  14211. $cacheKey = $url['cacheKey'];
  14212. if ($cache && (!$checksum || $checksum === $cache->sha1($cacheKey)) && $cache->copyTo($cacheKey, $fileName)) {
  14213. if ($output) {
  14214. $io->writeError(" - Loading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) from cache", true, IOInterface::VERY_VERBOSE);
  14215. }
  14216. if (!$cache->isReadOnly()) {
  14217. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  14218. }
  14219. $result = \React\Promise\resolve($fileName);
  14220. } else {
  14221. if ($output) {
  14222. $io->writeError(" - Downloading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  14223. }
  14224. $result = $httpDownloader->addCopy($url['processed'], $fileName, $package->getTransportOptions())
  14225. ->then($accept, $reject);
  14226. }
  14227. return $result->then(function ($result) use ($fileName, $checksum, $url, $package, $eventDispatcher): string {
  14228. if (null === $result) {
  14229. return $fileName;
  14230. }
  14231. if (!file_exists($fileName)) {
  14232. throw new \UnexpectedValueException($url['base'].' could not be saved to '.$fileName.', make sure the'
  14233. .' directory is writable and you have internet connectivity');
  14234. }
  14235. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  14236. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url['base'].')');
  14237. }
  14238. if ($eventDispatcher) {
  14239. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, $fileName, $checksum, $url['processed'], 'package', $package);
  14240. $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  14241. }
  14242. return $fileName;
  14243. });
  14244. };
  14245. $accept = function ($response) use ($cache, $package, $fileName, &$urls): string {
  14246. $url = reset($urls);
  14247. $cacheKey = $url['cacheKey'];
  14248. FileDownloader::$downloadMetadata[$package->getName()] = @filesize($fileName) ?: $response->getHeader('Content-Length') ?: '?';
  14249. if ($cache && !$cache->isReadOnly()) {
  14250. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  14251. $cache->copyFrom($cacheKey, $fileName);
  14252. }
  14253. $response->collect();
  14254. return $fileName;
  14255. };
  14256. $reject = function ($e) use ($io, &$urls, $download, $fileName, $package, &$retries, $filesystem) {
  14257. if (file_exists($fileName)) {
  14258. $filesystem->unlink($fileName);
  14259. }
  14260. $this->clearLastCacheWrite($package);
  14261. if ($e instanceof IrrecoverableDownloadException) {
  14262. throw $e;
  14263. }
  14264. if ($e instanceof MaxFileSizeExceededException) {
  14265. throw $e;
  14266. }
  14267. if ($e instanceof TransportException) {
  14268. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  14269. $retries = 0;
  14270. }
  14271. }
  14272. if ($e instanceof TransportException && $e->getStatusCode() === 499) {
  14273. $retries = 0;
  14274. $urls = array();
  14275. }
  14276. if ($retries) {
  14277. usleep(500000);
  14278. $retries--;
  14279. return $download();
  14280. }
  14281. array_shift($urls);
  14282. if ($urls) {
  14283. if ($io->isDebug()) {
  14284. $io->writeError(' Failed downloading '.$package->getName().': ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  14285. $io->writeError(' Trying the next URL for '.$package->getName());
  14286. } else {
  14287. $io->writeError(' Failed downloading '.$package->getName().', trying the next URL ('.$e->getCode().': '.$e->getMessage().')');
  14288. }
  14289. $retries = 3;
  14290. usleep(100000);
  14291. return $download();
  14292. }
  14293. throw $e;
  14294. };
  14295. return $download();
  14296. }
  14297. public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  14298. {
  14299. return \React\Promise\resolve(null);
  14300. }
  14301. public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  14302. {
  14303. $fileName = $this->getFileName($package, $path);
  14304. if (file_exists($fileName)) {
  14305. $this->filesystem->unlink($fileName);
  14306. }
  14307. $dirsToCleanUp = array(
  14308. $this->config->get('vendor-dir').'/composer/',
  14309. $this->config->get('vendor-dir'),
  14310. $path,
  14311. );
  14312. if (isset($this->additionalCleanupPaths[$package->getName()])) {
  14313. foreach ($this->additionalCleanupPaths[$package->getName()] as $path) {
  14314. $this->filesystem->remove($path);
  14315. }
  14316. }
  14317. foreach ($dirsToCleanUp as $dir) {
  14318. if (is_dir($dir) && $this->filesystem->isDirEmpty($dir) && realpath($dir) !== Platform::getCwd()) {
  14319. $this->filesystem->removeDirectoryPhp($dir);
  14320. }
  14321. }
  14322. return \React\Promise\resolve(null);
  14323. }
  14324. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  14325. {
  14326. if ($output) {
  14327. $this->io->writeError(" - " . InstallOperation::format($package));
  14328. }
  14329. $this->filesystem->emptyDirectory($path);
  14330. $this->filesystem->ensureDirectoryExists($path);
  14331. $this->filesystem->rename($this->getFileName($package, $path), $path . '/' . pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_BASENAME));
  14332. if ($package->getBinaries()) {
  14333. foreach ($package->getBinaries() as $bin) {
  14334. if (file_exists($path . '/' . $bin) && !is_executable($path . '/' . $bin)) {
  14335. Silencer::call('chmod', $path . '/' . $bin, 0777 & ~umask());
  14336. }
  14337. }
  14338. }
  14339. return \React\Promise\resolve(null);
  14340. }
  14341. protected function clearLastCacheWrite(PackageInterface $package): void
  14342. {
  14343. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  14344. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  14345. unset($this->lastCacheWrites[$package->getName()]);
  14346. }
  14347. }
  14348. protected function addCleanupPath(PackageInterface $package, string $path): void
  14349. {
  14350. $this->additionalCleanupPaths[$package->getName()][] = $path;
  14351. }
  14352. protected function removeCleanupPath(PackageInterface $package, string $path): void
  14353. {
  14354. if (isset($this->additionalCleanupPaths[$package->getName()])) {
  14355. $idx = array_search($path, $this->additionalCleanupPaths[$package->getName()]);
  14356. if (false !== $idx) {
  14357. unset($this->additionalCleanupPaths[$package->getName()][$idx]);
  14358. }
  14359. }
  14360. }
  14361. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
  14362. {
  14363. $this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
  14364. $promise = $this->remove($initial, $path, false);
  14365. return $promise->then(function () use ($target, $path): PromiseInterface {
  14366. return $this->install($target, $path, false);
  14367. });
  14368. }
  14369. public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  14370. {
  14371. if ($output) {
  14372. $this->io->writeError(" - " . UninstallOperation::format($package));
  14373. }
  14374. $promise = $this->filesystem->removeDirectoryAsync($path);
  14375. return $promise->then(function ($result) use ($path): void {
  14376. if (!$result) {
  14377. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  14378. }
  14379. });
  14380. }
  14381. protected function getFileName(PackageInterface $package, string $path): string
  14382. {
  14383. return rtrim($this->config->get('vendor-dir').'/composer/tmp-'.md5($package.spl_object_hash($package)).'.'.pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  14384. }
  14385. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  14386. {
  14387. return '';
  14388. }
  14389. protected function processUrl(PackageInterface $package, string $url): string
  14390. {
  14391. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  14392. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  14393. }
  14394. if ($package->getDistReference()) {
  14395. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  14396. }
  14397. return $url;
  14398. }
  14399. public function getLocalChanges(PackageInterface $package, string $path): ?string
  14400. {
  14401. $prevIO = $this->io;
  14402. $this->io = new NullIO;
  14403. $this->io->loadConfiguration($this->config);
  14404. $e = null;
  14405. $output = '';
  14406. $targetDir = Filesystem::trimTrailingSlash($path);
  14407. try {
  14408. if (is_dir($targetDir.'_compare')) {
  14409. $this->filesystem->removeDirectory($targetDir.'_compare');
  14410. }
  14411. $this->download($package, $targetDir.'_compare', null, false);
  14412. $this->httpDownloader->wait();
  14413. $this->install($package, $targetDir.'_compare', false);
  14414. $this->process->wait();
  14415. $comparer = new Comparer();
  14416. $comparer->setSource($targetDir.'_compare');
  14417. $comparer->setUpdate($targetDir);
  14418. $comparer->doCompare();
  14419. $output = $comparer->getChangedAsString(true);
  14420. $this->filesystem->removeDirectory($targetDir.'_compare');
  14421. } catch (\Exception $e) {
  14422. }
  14423. $this->io = $prevIO;
  14424. if ($e) {
  14425. throw $e;
  14426. }
  14427. $output = trim($output);
  14428. return strlen($output) > 0 ? $output : null;
  14429. }
  14430. }
  14431. <?php declare(strict_types=1);
  14432. namespace Composer\Downloader;
  14433. class FilesystemException extends \Exception
  14434. {
  14435. public function __construct(string $message = '', int $code = 0, \Exception $previous = null)
  14436. {
  14437. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  14438. }
  14439. }
  14440. <?php declare(strict_types=1);
  14441. namespace Composer\Downloader;
  14442. use React\Promise\PromiseInterface;
  14443. use Composer\Package\PackageInterface;
  14444. use Composer\Pcre\Preg;
  14445. use Composer\Util\ProcessExecutor;
  14446. class FossilDownloader extends VcsDownloader
  14447. {
  14448. protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
  14449. {
  14450. return \React\Promise\resolve(null);
  14451. }
  14452. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  14453. {
  14454. $this->config->prohibitUrlByConfig($url, $this->io);
  14455. $url = ProcessExecutor::escape($url);
  14456. $ref = ProcessExecutor::escape($package->getSourceReference());
  14457. $repoFile = $path . '.fossil';
  14458. $this->io->writeError("Cloning ".$package->getSourceReference());
  14459. $command = sprintf('fossil clone -- %s %s', $url, ProcessExecutor::escape($repoFile));
  14460. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  14461. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14462. }
  14463. $command = sprintf('fossil open --nested -- %s', ProcessExecutor::escape($repoFile));
  14464. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  14465. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14466. }
  14467. $command = sprintf('fossil update -- %s', $ref);
  14468. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  14469. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14470. }
  14471. return \React\Promise\resolve(null);
  14472. }
  14473. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  14474. {
  14475. $this->config->prohibitUrlByConfig($url, $this->io);
  14476. $ref = ProcessExecutor::escape($target->getSourceReference());
  14477. $this->io->writeError(" Updating to ".$target->getSourceReference());
  14478. if (!$this->hasMetadataRepository($path)) {
  14479. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  14480. }
  14481. $command = sprintf('fossil pull && fossil up %s', $ref);
  14482. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  14483. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14484. }
  14485. return \React\Promise\resolve(null);
  14486. }
  14487. public function getLocalChanges(PackageInterface $package, string $path): ?string
  14488. {
  14489. if (!$this->hasMetadataRepository($path)) {
  14490. return null;
  14491. }
  14492. $this->process->execute('fossil changes', $output, realpath($path));
  14493. $output = trim($output);
  14494. return strlen($output) > 0 ? $output : null;
  14495. }
  14496. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  14497. {
  14498. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  14499. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  14500. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14501. }
  14502. $log = '';
  14503. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  14504. foreach ($this->process->splitLines($output) as $line) {
  14505. if (Preg::isMatch($match, $line)) {
  14506. break;
  14507. }
  14508. $log .= $line;
  14509. }
  14510. return $log;
  14511. }
  14512. protected function hasMetadataRepository(string $path): bool
  14513. {
  14514. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  14515. }
  14516. }
  14517. <?php declare(strict_types=1);
  14518. namespace Composer\Downloader;
  14519. use Composer\Config;
  14520. use Composer\IO\IOInterface;
  14521. use Composer\Package\PackageInterface;
  14522. use Composer\Pcre\Preg;
  14523. use Composer\Util\Filesystem;
  14524. use Composer\Util\Git as GitUtil;
  14525. use Composer\Util\Url;
  14526. use Composer\Util\Platform;
  14527. use Composer\Util\ProcessExecutor;
  14528. use Composer\Cache;
  14529. use React\Promise\PromiseInterface;
  14530. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  14531. {
  14532. private $hasStashedChanges = array();
  14533. private $hasDiscardedChanges = array();
  14534. private $gitUtil;
  14535. private $cachedPackages = array();
  14536. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  14537. {
  14538. parent::__construct($io, $config, $process, $fs);
  14539. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  14540. }
  14541. protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
  14542. {
  14543. GitUtil::cleanEnv();
  14544. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
  14545. $gitVersion = GitUtil::getVersion($this->process);
  14546. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  14547. $this->io->writeError(" - Syncing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) into cache");
  14548. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  14549. $ref = $package->getSourceReference();
  14550. if ($this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref) && is_dir($cachePath)) {
  14551. $this->cachedPackages[$package->getId()][$ref] = true;
  14552. }
  14553. } elseif (null === $gitVersion) {
  14554. throw new \RuntimeException('git was not found in your PATH, skipping source download');
  14555. }
  14556. return \React\Promise\resolve(null);
  14557. }
  14558. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  14559. {
  14560. GitUtil::cleanEnv();
  14561. $path = $this->normalizePath($path);
  14562. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
  14563. $ref = $package->getSourceReference();
  14564. $flag = Platform::isWindows() ? '/D ' : '';
  14565. if (!empty($this->cachedPackages[$package->getId()][$ref])) {
  14566. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  14567. $cloneFlags = '--dissociate --reference %cachePath% ';
  14568. $transportOptions = $package->getTransportOptions();
  14569. if (isset($transportOptions['git']['single_use_clone']) && $transportOptions['git']['single_use_clone']) {
  14570. $cloneFlags = '';
  14571. }
  14572. $command =
  14573. 'git clone --no-checkout %cachePath% %path% ' . $cloneFlags
  14574. . '&& cd '.$flag.'%path% '
  14575. . '&& git remote set-url origin -- %sanitizedUrl% && git remote add composer -- %sanitizedUrl%';
  14576. } else {
  14577. $msg = "Cloning ".$this->getShortHash($ref);
  14578. $command = 'git clone --no-checkout -- %url% %path% && cd '.$flag.'%path% && git remote add composer -- %url% && git fetch composer && git remote set-url origin -- %sanitizedUrl% && git remote set-url composer -- %sanitizedUrl%';
  14579. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  14580. throw new \RuntimeException('The required git reference for '.$package->getName().' is not in cache and network is disabled, aborting');
  14581. }
  14582. }
  14583. $this->io->writeError($msg);
  14584. $commandCallable = function (string $url) use ($path, $command, $cachePath): string {
  14585. return str_replace(
  14586. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  14587. array(
  14588. ProcessExecutor::escape($url),
  14589. ProcessExecutor::escape($path),
  14590. ProcessExecutor::escape($cachePath),
  14591. ProcessExecutor::escape(Preg::replace('{://([^@]+?):(.+?)@}', '://', $url)),
  14592. ),
  14593. $command
  14594. );
  14595. };
  14596. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  14597. $sourceUrl = $package->getSourceUrl();
  14598. if ($url !== $sourceUrl && $sourceUrl !== null) {
  14599. $this->updateOriginUrl($path, $sourceUrl);
  14600. } else {
  14601. $this->setPushUrl($path, $url);
  14602. }
  14603. if ($newRef = $this->updateToCommit($package, $path, (string) $ref, $package->getPrettyVersion())) {
  14604. if ($package->getDistReference() === $package->getSourceReference()) {
  14605. $package->setDistReference($newRef);
  14606. }
  14607. $package->setSourceReference($newRef);
  14608. }
  14609. return \React\Promise\resolve(null);
  14610. }
  14611. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  14612. {
  14613. GitUtil::cleanEnv();
  14614. $path = $this->normalizePath($path);
  14615. if (!$this->hasMetadataRepository($path)) {
  14616. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  14617. }
  14618. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', $url).'/';
  14619. $ref = $target->getSourceReference();
  14620. if (!empty($this->cachedPackages[$target->getId()][$ref])) {
  14621. $msg = "Checking out ".$this->getShortHash($ref).' from cache';
  14622. $command = '(git rev-parse --quiet --verify %ref% || (git remote set-url composer -- %cachePath% && git fetch composer && git fetch --tags composer)) && git remote set-url composer -- %sanitizedUrl%';
  14623. } else {
  14624. $msg = "Checking out ".$this->getShortHash($ref);
  14625. $command = '(git remote set-url composer -- %url% && git rev-parse --quiet --verify %ref% || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- %sanitizedUrl%';
  14626. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  14627. throw new \RuntimeException('The required git reference for '.$target->getName().' is not in cache and network is disabled, aborting');
  14628. }
  14629. }
  14630. $this->io->writeError($msg);
  14631. $commandCallable = function ($url) use ($ref, $command, $cachePath): string {
  14632. return str_replace(
  14633. array('%url%', '%ref%', '%cachePath%', '%sanitizedUrl%'),
  14634. array(
  14635. ProcessExecutor::escape($url),
  14636. ProcessExecutor::escape($ref.'^{commit}'),
  14637. ProcessExecutor::escape($cachePath),
  14638. ProcessExecutor::escape(Preg::replace('{://([^@]+?):(.+?)@}', '://', $url)),
  14639. ),
  14640. $command
  14641. );
  14642. };
  14643. $this->gitUtil->runCommand($commandCallable, $url, $path);
  14644. if ($newRef = $this->updateToCommit($target, $path, (string) $ref, $target->getPrettyVersion())) {
  14645. if ($target->getDistReference() === $target->getSourceReference()) {
  14646. $target->setDistReference($newRef);
  14647. }
  14648. $target->setSourceReference($newRef);
  14649. }
  14650. $updateOriginUrl = false;
  14651. if (
  14652. 0 === $this->process->execute('git remote -v', $output, $path)
  14653. && Preg::isMatch('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  14654. && Preg::isMatch('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  14655. ) {
  14656. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  14657. $updateOriginUrl = true;
  14658. }
  14659. }
  14660. if ($updateOriginUrl && $target->getSourceUrl() !== null) {
  14661. $this->updateOriginUrl($path, $target->getSourceUrl());
  14662. }
  14663. return \React\Promise\resolve(null);
  14664. }
  14665. public function getLocalChanges(PackageInterface $package, string $path): ?string
  14666. {
  14667. GitUtil::cleanEnv();
  14668. if (!$this->hasMetadataRepository($path)) {
  14669. return null;
  14670. }
  14671. $command = 'git status --porcelain --untracked-files=no';
  14672. if (0 !== $this->process->execute($command, $output, $path)) {
  14673. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14674. }
  14675. $output = trim($output);
  14676. return strlen($output) > 0 ? $output : null;
  14677. }
  14678. public function getUnpushedChanges(PackageInterface $package, string $path): ?string
  14679. {
  14680. GitUtil::cleanEnv();
  14681. $path = $this->normalizePath($path);
  14682. if (!$this->hasMetadataRepository($path)) {
  14683. return null;
  14684. }
  14685. $command = 'git show-ref --head -d';
  14686. if (0 !== $this->process->execute($command, $output, $path)) {
  14687. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14688. }
  14689. $refs = trim($output);
  14690. if (!Preg::isMatch('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  14691. return null;
  14692. }
  14693. $headRef = $match[1];
  14694. if (!Preg::isMatchAll('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  14695. return null;
  14696. }
  14697. $candidateBranches = $matches[1];
  14698. $branch = $candidateBranches[0];
  14699. $unpushedChanges = null;
  14700. $branchNotFoundError = false;
  14701. for ($i = 0; $i <= 1; $i++) {
  14702. $remoteBranches = array();
  14703. foreach ($candidateBranches as $candidate) {
  14704. if (Preg::isMatchAll('{^[a-f0-9]+ refs/remotes/((?:[^/]+)/'.preg_quote($candidate).')$}mi', $refs, $matches)) {
  14705. foreach ($matches[1] as $match) {
  14706. $branch = $candidate;
  14707. $remoteBranches[] = $match;
  14708. }
  14709. break;
  14710. }
  14711. }
  14712. if (!$remoteBranches) {
  14713. $unpushedChanges = 'Branch ' . $branch . ' could not be found on any remote and appears to be unpushed';
  14714. $branchNotFoundError = true;
  14715. } else {
  14716. if ($branchNotFoundError) {
  14717. $unpushedChanges = null;
  14718. }
  14719. foreach ($remoteBranches as $remoteBranch) {
  14720. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  14721. if (0 !== $this->process->execute($command, $output, $path)) {
  14722. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14723. }
  14724. $output = trim($output);
  14725. if ($unpushedChanges === null || strlen($output) < strlen($unpushedChanges)) {
  14726. $unpushedChanges = $output;
  14727. }
  14728. }
  14729. }
  14730. if ($unpushedChanges && $i === 0) {
  14731. $this->process->execute('git fetch --all', $output, $path);
  14732. $command = 'git show-ref --head -d';
  14733. if (0 !== $this->process->execute($command, $output, $path)) {
  14734. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14735. }
  14736. $refs = trim($output);
  14737. }
  14738. if (!$unpushedChanges) {
  14739. break;
  14740. }
  14741. }
  14742. return $unpushedChanges;
  14743. }
  14744. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  14745. {
  14746. GitUtil::cleanEnv();
  14747. $path = $this->normalizePath($path);
  14748. $unpushed = $this->getUnpushedChanges($package, $path);
  14749. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  14750. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  14751. }
  14752. if (null === ($changes = $this->getLocalChanges($package, $path))) {
  14753. return \React\Promise\resolve(null);
  14754. }
  14755. if (!$this->io->isInteractive()) {
  14756. $discardChanges = $this->config->get('discard-changes');
  14757. if (true === $discardChanges) {
  14758. return $this->discardChanges($path);
  14759. }
  14760. if ('stash' === $discardChanges) {
  14761. if (!$update) {
  14762. return parent::cleanChanges($package, $path, $update);
  14763. }
  14764. return $this->stashChanges($path);
  14765. }
  14766. return parent::cleanChanges($package, $path, $update);
  14767. }
  14768. $changes = array_map(function ($elem): string {
  14769. return ' '.$elem;
  14770. }, Preg::split('{\s*\r?\n\s*}', $changes));
  14771. $this->io->writeError(' <error>'.$package->getPrettyName().' has modified files:</error>');
  14772. $this->io->writeError(array_slice($changes, 0, 10));
  14773. if (count($changes) > 10) {
  14774. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  14775. }
  14776. while (true) {
  14777. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  14778. case 'y':
  14779. $this->discardChanges($path);
  14780. break 2;
  14781. case 's':
  14782. if (!$update) {
  14783. goto help;
  14784. }
  14785. $this->stashChanges($path);
  14786. break 2;
  14787. case 'n':
  14788. throw new \RuntimeException('Update aborted');
  14789. case 'v':
  14790. $this->io->writeError($changes);
  14791. break;
  14792. case 'd':
  14793. $this->viewDiff($path);
  14794. break;
  14795. case '?':
  14796. default:
  14797. help :
  14798. $this->io->writeError(array(
  14799. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  14800. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  14801. ' v - view modified files',
  14802. ' d - view local modifications (diff)',
  14803. ));
  14804. if ($update) {
  14805. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  14806. }
  14807. $this->io->writeError(' ? - print help');
  14808. break;
  14809. }
  14810. }
  14811. return \React\Promise\resolve(null);
  14812. }
  14813. protected function reapplyChanges(string $path): void
  14814. {
  14815. $path = $this->normalizePath($path);
  14816. if (!empty($this->hasStashedChanges[$path])) {
  14817. unset($this->hasStashedChanges[$path]);
  14818. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  14819. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  14820. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  14821. }
  14822. }
  14823. unset($this->hasDiscardedChanges[$path]);
  14824. }
  14825. protected function updateToCommit(PackageInterface $package, string $path, string $reference, string $prettyVersion): ?string
  14826. {
  14827. $force = !empty($this->hasDiscardedChanges[$path]) || !empty($this->hasStashedChanges[$path]) ? '-f ' : '';
  14828. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  14829. $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
  14830. $branches = null;
  14831. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  14832. $branches = $output;
  14833. }
  14834. $gitRef = $reference;
  14835. if (!Preg::isMatch('{^[a-f0-9]{40}$}', $reference)
  14836. && $branches
  14837. && Preg::isMatch('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  14838. ) {
  14839. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  14840. if (0 === $this->process->execute($command, $output, $path)) {
  14841. return null;
  14842. }
  14843. }
  14844. if (Preg::isMatch('{^[a-f0-9]{40}$}', $reference)) {
  14845. if (!Preg::isMatch('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && Preg::isMatch('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  14846. $branch = 'v' . $branch;
  14847. }
  14848. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  14849. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  14850. $resetCommand = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  14851. if (0 === $this->process->execute("($command || $fallbackCommand) && $resetCommand", $output, $path)) {
  14852. return null;
  14853. }
  14854. }
  14855. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  14856. if (0 === $this->process->execute($command, $output, $path)) {
  14857. return null;
  14858. }
  14859. $exceptionExtra = '';
  14860. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  14861. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  14862. $exceptionExtra = "\nIt looks like the commit hash is not available in the repository, maybe ".($package->isDev() ? 'the commit was removed from the branch' : 'the tag was recreated').'? Run "composer update '.$package->getPrettyName().'" to resolve this.';
  14863. }
  14864. throw new \RuntimeException(Url::sanitize('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput() . $exceptionExtra));
  14865. }
  14866. protected function updateOriginUrl(string $path, string $url): void
  14867. {
  14868. $this->process->execute(sprintf('git remote set-url origin -- %s', ProcessExecutor::escape($url)), $output, $path);
  14869. $this->setPushUrl($path, $url);
  14870. }
  14871. protected function setPushUrl(string $path, string $url): void
  14872. {
  14873. if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  14874. $protocols = $this->config->get('github-protocols');
  14875. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  14876. if (!in_array('ssh', $protocols, true)) {
  14877. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  14878. }
  14879. $cmd = sprintf('git remote set-url --push origin -- %s', ProcessExecutor::escape($pushUrl));
  14880. $this->process->execute($cmd, $ignoredOutput, $path);
  14881. }
  14882. }
  14883. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  14884. {
  14885. $path = $this->normalizePath($path);
  14886. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  14887. if (0 !== $this->process->execute($command, $output, $path)) {
  14888. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  14889. }
  14890. return $output;
  14891. }
  14892. protected function discardChanges(string $path): PromiseInterface
  14893. {
  14894. $path = $this->normalizePath($path);
  14895. if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
  14896. throw new \RuntimeException("Could not reset changes\n\n:".$output);
  14897. }
  14898. $this->hasDiscardedChanges[$path] = true;
  14899. return \React\Promise\resolve(null);
  14900. }
  14901. protected function stashChanges(string $path): PromiseInterface
  14902. {
  14903. $path = $this->normalizePath($path);
  14904. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  14905. throw new \RuntimeException("Could not stash changes\n\n:".$output);
  14906. }
  14907. $this->hasStashedChanges[$path] = true;
  14908. return \React\Promise\resolve(null);
  14909. }
  14910. protected function viewDiff(string $path): void
  14911. {
  14912. $path = $this->normalizePath($path);
  14913. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  14914. throw new \RuntimeException("Could not view diff\n\n:".$output);
  14915. }
  14916. $this->io->writeError($output);
  14917. }
  14918. protected function normalizePath(string $path): string
  14919. {
  14920. if (Platform::isWindows() && strlen($path) > 0) {
  14921. $basePath = $path;
  14922. $removed = array();
  14923. while (!is_dir($basePath) && $basePath !== '\\') {
  14924. array_unshift($removed, basename($basePath));
  14925. $basePath = dirname($basePath);
  14926. }
  14927. if ($basePath === '\\') {
  14928. return $path;
  14929. }
  14930. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  14931. }
  14932. return $path;
  14933. }
  14934. protected function hasMetadataRepository(string $path): bool
  14935. {
  14936. $path = $this->normalizePath($path);
  14937. return is_dir($path.'/.git');
  14938. }
  14939. protected function getShortHash(string $reference): string
  14940. {
  14941. if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
  14942. return substr($reference, 0, 10);
  14943. }
  14944. return $reference;
  14945. }
  14946. }
  14947. <?php declare(strict_types=1);
  14948. namespace Composer\Downloader;
  14949. use React\Promise\PromiseInterface;
  14950. use Composer\Package\PackageInterface;
  14951. use Composer\Util\Platform;
  14952. use Composer\Util\ProcessExecutor;
  14953. class GzipDownloader extends ArchiveDownloader
  14954. {
  14955. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  14956. {
  14957. $filename = pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_FILENAME);
  14958. $targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
  14959. if (!Platform::isWindows()) {
  14960. $command = 'gzip -cd -- ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  14961. if (0 === $this->process->execute($command, $ignoredOutput)) {
  14962. return \React\Promise\resolve(null);
  14963. }
  14964. if (extension_loaded('zlib')) {
  14965. $this->extractUsingExt($file, $targetFilepath);
  14966. return \React\Promise\resolve(null);
  14967. }
  14968. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  14969. throw new \RuntimeException($processError);
  14970. }
  14971. $this->extractUsingExt($file, $targetFilepath);
  14972. return \React\Promise\resolve(null);
  14973. }
  14974. private function extractUsingExt(string $file, string $targetFilepath): void
  14975. {
  14976. $archiveFile = gzopen($file, 'rb');
  14977. $targetFile = fopen($targetFilepath, 'wb');
  14978. while ($string = gzread($archiveFile, 4096)) {
  14979. fwrite($targetFile, $string, Platform::strlen($string));
  14980. }
  14981. gzclose($archiveFile);
  14982. fclose($targetFile);
  14983. }
  14984. }
  14985. <?php declare(strict_types=1);
  14986. namespace Composer\Downloader;
  14987. use React\Promise\PromiseInterface;
  14988. use Composer\Package\PackageInterface;
  14989. use Composer\Util\ProcessExecutor;
  14990. use Composer\Util\Hg as HgUtils;
  14991. class HgDownloader extends VcsDownloader
  14992. {
  14993. protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
  14994. {
  14995. if (null === HgUtils::getVersion($this->process)) {
  14996. throw new \RuntimeException('hg was not found in your PATH, skipping source download');
  14997. }
  14998. return \React\Promise\resolve(null);
  14999. }
  15000. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  15001. {
  15002. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  15003. $cloneCommand = function (string $url) use ($path): string {
  15004. return sprintf('hg clone -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  15005. };
  15006. $hgUtils->runCommand($cloneCommand, $url, $path);
  15007. $ref = ProcessExecutor::escape($package->getSourceReference());
  15008. $command = sprintf('hg up -- %s', $ref);
  15009. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  15010. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  15011. }
  15012. return \React\Promise\resolve(null);
  15013. }
  15014. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  15015. {
  15016. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  15017. $ref = $target->getSourceReference();
  15018. $this->io->writeError(" Updating to ".$target->getSourceReference());
  15019. if (!$this->hasMetadataRepository($path)) {
  15020. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  15021. }
  15022. $command = function ($url) use ($ref): string {
  15023. return sprintf('hg pull -- %s && hg up -- %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  15024. };
  15025. $hgUtils->runCommand($command, $url, $path);
  15026. return \React\Promise\resolve(null);
  15027. }
  15028. public function getLocalChanges(PackageInterface $package, string $path): ?string
  15029. {
  15030. if (!is_dir($path.'/.hg')) {
  15031. return null;
  15032. }
  15033. $this->process->execute('hg st', $output, realpath($path));
  15034. $output = trim($output);
  15035. return strlen($output) > 0 ? $output : null;
  15036. }
  15037. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  15038. {
  15039. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  15040. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  15041. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  15042. }
  15043. return $output;
  15044. }
  15045. protected function hasMetadataRepository(string $path): bool
  15046. {
  15047. return is_dir($path . '/.hg');
  15048. }
  15049. }
  15050. <?php declare(strict_types=1);
  15051. namespace Composer\Downloader;
  15052. class MaxFileSizeExceededException extends TransportException
  15053. {
  15054. }
  15055. <?php declare(strict_types=1);
  15056. namespace Composer\Downloader;
  15057. use React\Promise\PromiseInterface;
  15058. use Composer\Package\Archiver\ArchivableFilesFinder;
  15059. use Composer\Package\Dumper\ArrayDumper;
  15060. use Composer\Package\PackageInterface;
  15061. use Composer\Package\Version\VersionGuesser;
  15062. use Composer\Package\Version\VersionParser;
  15063. use Composer\Util\Platform;
  15064. use Composer\Util\Filesystem;
  15065. use Symfony\Component\Filesystem\Exception\IOException;
  15066. use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
  15067. use Composer\DependencyResolver\Operation\InstallOperation;
  15068. use Composer\DependencyResolver\Operation\UninstallOperation;
  15069. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  15070. {
  15071. private const STRATEGY_SYMLINK = 10;
  15072. private const STRATEGY_MIRROR = 20;
  15073. public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  15074. {
  15075. $path = Filesystem::trimTrailingSlash($path);
  15076. $url = $package->getDistUrl();
  15077. $realUrl = realpath($url);
  15078. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  15079. throw new \RuntimeException(sprintf(
  15080. 'Source path "%s" is not found for package %s',
  15081. $url,
  15082. $package->getName()
  15083. ));
  15084. }
  15085. if (realpath($path) === $realUrl) {
  15086. return \React\Promise\resolve(null);
  15087. }
  15088. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  15089. throw new \RuntimeException(sprintf(
  15090. 'Package %s cannot install to "%s" inside its source at "%s"',
  15091. $package->getName(),
  15092. realpath($path),
  15093. $realUrl
  15094. ));
  15095. }
  15096. return \React\Promise\resolve(null);
  15097. }
  15098. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  15099. {
  15100. $path = Filesystem::trimTrailingSlash($path);
  15101. $url = $package->getDistUrl();
  15102. $realUrl = realpath($url);
  15103. if (realpath($path) === $realUrl) {
  15104. if ($output) {
  15105. $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
  15106. }
  15107. return \React\Promise\resolve(null);
  15108. }
  15109. $transportOptions = $package->getTransportOptions() + array('relative' => true);
  15110. list($currentStrategy, $allowedStrategies) = $this->computeAllowedStrategies($transportOptions);
  15111. $symfonyFilesystem = new SymfonyFilesystem();
  15112. $this->filesystem->removeDirectory($path);
  15113. if ($output) {
  15114. $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
  15115. }
  15116. $isFallback = false;
  15117. if (self::STRATEGY_SYMLINK === $currentStrategy) {
  15118. try {
  15119. if (Platform::isWindows()) {
  15120. if ($output) {
  15121. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  15122. }
  15123. $this->filesystem->junction($realUrl, $path);
  15124. } else {
  15125. $absolutePath = $path;
  15126. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  15127. $absolutePath = Platform::getCwd() . DIRECTORY_SEPARATOR . $path;
  15128. }
  15129. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  15130. $path = rtrim($path, "/");
  15131. if ($output) {
  15132. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  15133. }
  15134. if ($transportOptions['relative']) {
  15135. $symfonyFilesystem->symlink($shortestPath.'/', $path);
  15136. } else {
  15137. $symfonyFilesystem->symlink($realUrl.'/', $path);
  15138. }
  15139. }
  15140. } catch (IOException $e) {
  15141. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  15142. if ($output) {
  15143. $this->io->writeError('');
  15144. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  15145. }
  15146. $currentStrategy = self::STRATEGY_MIRROR;
  15147. $isFallback = true;
  15148. } else {
  15149. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  15150. }
  15151. }
  15152. }
  15153. if (self::STRATEGY_MIRROR === $currentStrategy) {
  15154. $realUrl = $this->filesystem->normalizePath($realUrl);
  15155. if ($output) {
  15156. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  15157. }
  15158. $iterator = new ArchivableFilesFinder($realUrl, array());
  15159. $symfonyFilesystem->mirror($realUrl, $path, $iterator);
  15160. }
  15161. if ($output) {
  15162. $this->io->writeError('');
  15163. }
  15164. return \React\Promise\resolve(null);
  15165. }
  15166. public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  15167. {
  15168. $path = Filesystem::trimTrailingSlash($path);
  15169. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  15170. if ($output) {
  15171. $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
  15172. }
  15173. if (!$this->filesystem->removeJunction($path)) {
  15174. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  15175. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  15176. }
  15177. return \React\Promise\resolve(null);
  15178. }
  15179. $fs = new Filesystem;
  15180. $absPath = $fs->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path;
  15181. $absDistUrl = $fs->isAbsolutePath($package->getDistUrl()) ? $package->getDistUrl() : Platform::getCwd() . '/' . $package->getDistUrl();
  15182. if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
  15183. if ($output) {
  15184. $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
  15185. }
  15186. return \React\Promise\resolve(null);
  15187. }
  15188. return parent::remove($package, $path, $output);
  15189. }
  15190. public function getVcsReference(PackageInterface $package, string $path): ?string
  15191. {
  15192. $path = Filesystem::trimTrailingSlash($path);
  15193. $parser = new VersionParser;
  15194. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  15195. $dumper = new ArrayDumper;
  15196. $packageConfig = $dumper->dump($package);
  15197. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  15198. return $packageVersion['commit'];
  15199. }
  15200. return null;
  15201. }
  15202. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  15203. {
  15204. $realUrl = realpath($package->getDistUrl());
  15205. if (realpath($path) === $realUrl) {
  15206. return ': Source already present';
  15207. }
  15208. list($currentStrategy) = $this->computeAllowedStrategies($package->getTransportOptions());
  15209. if ($currentStrategy === self::STRATEGY_SYMLINK) {
  15210. if (Platform::isWindows()) {
  15211. return ': Junctioning from '.$package->getDistUrl();
  15212. }
  15213. return ': Symlinking from '.$package->getDistUrl();
  15214. }
  15215. return ': Mirroring from '.$package->getDistUrl();
  15216. }
  15217. private function computeAllowedStrategies(array $transportOptions): array
  15218. {
  15219. $currentStrategy = self::STRATEGY_SYMLINK;
  15220. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  15221. $mirrorPathRepos = Platform::getEnv('COMPOSER_MIRROR_PATH_REPOS');
  15222. if ($mirrorPathRepos) {
  15223. $currentStrategy = self::STRATEGY_MIRROR;
  15224. }
  15225. $symlinkOption = $transportOptions['symlink'] ?? null;
  15226. if (true === $symlinkOption) {
  15227. $currentStrategy = self::STRATEGY_SYMLINK;
  15228. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  15229. } elseif (false === $symlinkOption) {
  15230. $currentStrategy = self::STRATEGY_MIRROR;
  15231. $allowedStrategies = array(self::STRATEGY_MIRROR);
  15232. }
  15233. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  15234. if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  15235. throw new \RuntimeException('You are on an old Windows / old PHP combo which does not allow Composer to use junctions/symlinks and this path repository has symlink:true in its options so copying is not allowed');
  15236. }
  15237. $currentStrategy = self::STRATEGY_MIRROR;
  15238. $allowedStrategies = array(self::STRATEGY_MIRROR);
  15239. }
  15240. return array($currentStrategy, $allowedStrategies);
  15241. }
  15242. private function safeJunctions(): bool
  15243. {
  15244. return function_exists('proc_open') &&
  15245. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  15246. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  15247. }
  15248. }
  15249. <?php declare(strict_types=1);
  15250. namespace Composer\Downloader;
  15251. use React\Promise\PromiseInterface;
  15252. use Composer\Package\PackageInterface;
  15253. use Composer\Repository\VcsRepository;
  15254. use Composer\Util\Perforce;
  15255. class PerforceDownloader extends VcsDownloader
  15256. {
  15257. protected $perforce;
  15258. protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
  15259. {
  15260. return \React\Promise\resolve(null);
  15261. }
  15262. public function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  15263. {
  15264. $ref = $package->getSourceReference();
  15265. $label = $this->getLabelFromSourceReference((string) $ref);
  15266. $this->io->writeError('Cloning ' . $ref);
  15267. $this->initPerforce($package, $path, $url);
  15268. $this->perforce->setStream($ref);
  15269. $this->perforce->p4Login();
  15270. $this->perforce->writeP4ClientSpec();
  15271. $this->perforce->connectClient();
  15272. $this->perforce->syncCodeBase($label);
  15273. $this->perforce->cleanupClientSpec();
  15274. return \React\Promise\resolve(null);
  15275. }
  15276. private function getLabelFromSourceReference(string $ref): ?string
  15277. {
  15278. $pos = strpos($ref, '@');
  15279. if (false !== $pos) {
  15280. return substr($ref, $pos + 1);
  15281. }
  15282. return null;
  15283. }
  15284. public function initPerforce(PackageInterface $package, string $path, string $url): void
  15285. {
  15286. if (!empty($this->perforce)) {
  15287. $this->perforce->initializePath($path);
  15288. return;
  15289. }
  15290. $repository = $package->getRepository();
  15291. $repoConfig = null;
  15292. if ($repository instanceof VcsRepository) {
  15293. $repoConfig = $this->getRepoConfig($repository);
  15294. }
  15295. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  15296. }
  15297. private function getRepoConfig(VcsRepository $repository): array
  15298. {
  15299. return $repository->getRepoConfig();
  15300. }
  15301. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  15302. {
  15303. return $this->doInstall($target, $path, $url);
  15304. }
  15305. public function getLocalChanges(PackageInterface $package, string $path): ?string
  15306. {
  15307. $this->io->writeError('Perforce driver does not check for local changes before overriding');
  15308. return null;
  15309. }
  15310. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  15311. {
  15312. return $this->perforce->getCommitLogs($fromReference, $toReference);
  15313. }
  15314. public function setPerforce(Perforce $perforce): void
  15315. {
  15316. $this->perforce = $perforce;
  15317. }
  15318. protected function hasMetadataRepository(string $path): bool
  15319. {
  15320. return true;
  15321. }
  15322. }
  15323. <?php declare(strict_types=1);
  15324. namespace Composer\Downloader;
  15325. use React\Promise\PromiseInterface;
  15326. use Composer\Package\PackageInterface;
  15327. class PharDownloader extends ArchiveDownloader
  15328. {
  15329. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  15330. {
  15331. $archive = new \Phar($file);
  15332. $archive->extractTo($path, null, true);
  15333. return \React\Promise\resolve(null);
  15334. }
  15335. }
  15336. <?php declare(strict_types=1);
  15337. namespace Composer\Downloader;
  15338. use React\Promise\PromiseInterface;
  15339. use Composer\Util\IniHelper;
  15340. use Composer\Util\Platform;
  15341. use Composer\Util\ProcessExecutor;
  15342. use Composer\Package\PackageInterface;
  15343. use RarArchive;
  15344. class RarDownloader extends ArchiveDownloader
  15345. {
  15346. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  15347. {
  15348. $processError = null;
  15349. if (!Platform::isWindows()) {
  15350. $command = 'unrar x -- ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  15351. if (0 === $this->process->execute($command, $ignoredOutput)) {
  15352. return \React\Promise\resolve(null);
  15353. }
  15354. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  15355. }
  15356. if (!class_exists('RarArchive')) {
  15357. $iniMessage = IniHelper::getMessage();
  15358. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  15359. . $iniMessage . "\n" . $processError;
  15360. if (!Platform::isWindows()) {
  15361. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  15362. }
  15363. throw new \RuntimeException($error);
  15364. }
  15365. $rarArchive = RarArchive::open($file);
  15366. if (false === $rarArchive) {
  15367. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  15368. }
  15369. $entries = $rarArchive->getEntries();
  15370. if (false === $entries) {
  15371. throw new \RuntimeException('Could not retrieve RAR archive entries');
  15372. }
  15373. foreach ($entries as $entry) {
  15374. if (false === $entry->extract($path)) {
  15375. throw new \RuntimeException('Could not extract entry');
  15376. }
  15377. }
  15378. $rarArchive->close();
  15379. return \React\Promise\resolve(null);
  15380. }
  15381. }
  15382. <?php declare(strict_types=1);
  15383. namespace Composer\Downloader;
  15384. use Composer\Package\PackageInterface;
  15385. use Composer\Pcre\Preg;
  15386. use Composer\Util\Svn as SvnUtil;
  15387. use Composer\Repository\VcsRepository;
  15388. use Composer\Util\ProcessExecutor;
  15389. use React\Promise\PromiseInterface;
  15390. class SvnDownloader extends VcsDownloader
  15391. {
  15392. protected $cacheCredentials = true;
  15393. protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface
  15394. {
  15395. SvnUtil::cleanEnv();
  15396. $util = new SvnUtil($url, $this->io, $this->config, $this->process);
  15397. if (null === $util->binaryVersion()) {
  15398. throw new \RuntimeException('svn was not found in your PATH, skipping source download');
  15399. }
  15400. return \React\Promise\resolve(null);
  15401. }
  15402. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  15403. {
  15404. SvnUtil::cleanEnv();
  15405. $ref = $package->getSourceReference();
  15406. $repo = $package->getRepository();
  15407. if ($repo instanceof VcsRepository) {
  15408. $repoConfig = $repo->getRepoConfig();
  15409. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  15410. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  15411. }
  15412. }
  15413. $this->io->writeError(" Checking out ".$package->getSourceReference());
  15414. $this->execute($package, $url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  15415. return \React\Promise\resolve(null);
  15416. }
  15417. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  15418. {
  15419. SvnUtil::cleanEnv();
  15420. $ref = $target->getSourceReference();
  15421. if (!$this->hasMetadataRepository($path)) {
  15422. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  15423. }
  15424. $util = new SvnUtil($url, $this->io, $this->config, $this->process);
  15425. $flags = "";
  15426. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  15427. $flags .= ' --ignore-ancestry';
  15428. }
  15429. $this->io->writeError(" Checking out " . $ref);
  15430. $this->execute($target, $url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  15431. return \React\Promise\resolve(null);
  15432. }
  15433. public function getLocalChanges(PackageInterface $package, string $path): ?string
  15434. {
  15435. if (!$this->hasMetadataRepository($path)) {
  15436. return null;
  15437. }
  15438. $this->process->execute('svn status --ignore-externals', $output, $path);
  15439. return Preg::isMatch('{^ *[^X ] +}m', $output) ? $output : null;
  15440. }
  15441. protected function execute(PackageInterface $package, string $baseUrl, string $command, string $url, string $cwd = null, string $path = null): string
  15442. {
  15443. $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
  15444. $util->setCacheCredentials($this->cacheCredentials);
  15445. try {
  15446. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  15447. } catch (\RuntimeException $e) {
  15448. throw new \RuntimeException(
  15449. $package->getPrettyName().' could not be downloaded, '.$e->getMessage()
  15450. );
  15451. }
  15452. }
  15453. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  15454. {
  15455. if (null === ($changes = $this->getLocalChanges($package, $path))) {
  15456. return \React\Promise\resolve(null);
  15457. }
  15458. if (!$this->io->isInteractive()) {
  15459. if (true === $this->config->get('discard-changes')) {
  15460. return $this->discardChanges($path);
  15461. }
  15462. return parent::cleanChanges($package, $path, $update);
  15463. }
  15464. $changes = array_map(function ($elem): string {
  15465. return ' '.$elem;
  15466. }, Preg::split('{\s*\r?\n\s*}', $changes));
  15467. $countChanges = count($changes);
  15468. $this->io->writeError(sprintf(' <error>'.$package->getPrettyName().' has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  15469. $this->io->writeError(array_slice($changes, 0, 10));
  15470. if ($countChanges > 10) {
  15471. $remainingChanges = $countChanges - 10;
  15472. $this->io->writeError(
  15473. sprintf(
  15474. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  15475. $remainingChanges === 1 ? '' : 's'
  15476. )
  15477. );
  15478. }
  15479. while (true) {
  15480. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  15481. case 'y':
  15482. $this->discardChanges($path);
  15483. break 2;
  15484. case 'n':
  15485. throw new \RuntimeException('Update aborted');
  15486. case 'v':
  15487. $this->io->writeError($changes);
  15488. break;
  15489. case '?':
  15490. default:
  15491. $this->io->writeError(array(
  15492. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  15493. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  15494. ' v - view modified files',
  15495. ' ? - print help',
  15496. ));
  15497. break;
  15498. }
  15499. }
  15500. return \React\Promise\resolve(null);
  15501. }
  15502. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  15503. {
  15504. if (Preg::isMatch('{@(\d+)$}', $fromReference) && Preg::isMatch('{@(\d+)$}', $toReference)) {
  15505. $command = sprintf('svn info --non-interactive --xml -- %s', ProcessExecutor::escape($path));
  15506. if (0 !== $this->process->execute($command, $output, $path)) {
  15507. throw new \RuntimeException(
  15508. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  15509. );
  15510. }
  15511. $urlPattern = '#<url>(.*)</url>#';
  15512. if (Preg::isMatch($urlPattern, $output, $matches)) {
  15513. $baseUrl = $matches[1];
  15514. } else {
  15515. throw new \RuntimeException(
  15516. 'Unable to determine svn url for path '. $path
  15517. );
  15518. }
  15519. $fromRevision = Preg::replace('{.*@(\d+)$}', '$1', $fromReference);
  15520. $toRevision = Preg::replace('{.*@(\d+)$}', '$1', $toReference);
  15521. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  15522. $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
  15523. $util->setCacheCredentials($this->cacheCredentials);
  15524. try {
  15525. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  15526. } catch (\RuntimeException $e) {
  15527. throw new \RuntimeException(
  15528. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  15529. );
  15530. }
  15531. }
  15532. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  15533. }
  15534. protected function discardChanges(string $path): PromiseInterface
  15535. {
  15536. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  15537. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  15538. }
  15539. return \React\Promise\resolve(null);
  15540. }
  15541. protected function hasMetadataRepository(string $path): bool
  15542. {
  15543. return is_dir($path.'/.svn');
  15544. }
  15545. }
  15546. <?php declare(strict_types=1);
  15547. namespace Composer\Downloader;
  15548. use Composer\Package\PackageInterface;
  15549. use React\Promise\PromiseInterface;
  15550. class TarDownloader extends ArchiveDownloader
  15551. {
  15552. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  15553. {
  15554. $archive = new \PharData($file);
  15555. $archive->extractTo($path, null, true);
  15556. return \React\Promise\resolve(null);
  15557. }
  15558. }
  15559. <?php declare(strict_types=1);
  15560. namespace Composer\Downloader;
  15561. class TransportException extends \RuntimeException
  15562. {
  15563. protected $headers;
  15564. protected $response;
  15565. protected $statusCode;
  15566. protected $responseInfo = array();
  15567. public function setHeaders(array $headers): void
  15568. {
  15569. $this->headers = $headers;
  15570. }
  15571. public function getHeaders(): ?array
  15572. {
  15573. return $this->headers;
  15574. }
  15575. public function setResponse(?string $response): void
  15576. {
  15577. $this->response = $response;
  15578. }
  15579. public function getResponse(): ?string
  15580. {
  15581. return $this->response;
  15582. }
  15583. public function setStatusCode($statusCode): void
  15584. {
  15585. $this->statusCode = $statusCode;
  15586. }
  15587. public function getStatusCode(): ?int
  15588. {
  15589. return $this->statusCode;
  15590. }
  15591. public function getResponseInfo(): array
  15592. {
  15593. return $this->responseInfo;
  15594. }
  15595. public function setResponseInfo(array $responseInfo): void
  15596. {
  15597. $this->responseInfo = $responseInfo;
  15598. }
  15599. }
  15600. <?php declare(strict_types=1);
  15601. namespace Composer\Downloader;
  15602. use Composer\Package\PackageInterface;
  15603. interface VcsCapableDownloaderInterface
  15604. {
  15605. public function getVcsReference(PackageInterface $package, string $path): ?string;
  15606. }
  15607. <?php declare(strict_types=1);
  15608. namespace Composer\Downloader;
  15609. use Composer\Config;
  15610. use Composer\Package\Dumper\ArrayDumper;
  15611. use Composer\Package\PackageInterface;
  15612. use Composer\Package\Version\VersionGuesser;
  15613. use Composer\Package\Version\VersionParser;
  15614. use Composer\Util\ProcessExecutor;
  15615. use Composer\IO\IOInterface;
  15616. use Composer\Util\Filesystem;
  15617. use React\Promise\PromiseInterface;
  15618. use Composer\DependencyResolver\Operation\UpdateOperation;
  15619. use Composer\DependencyResolver\Operation\InstallOperation;
  15620. use Composer\DependencyResolver\Operation\UninstallOperation;
  15621. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  15622. {
  15623. protected $io;
  15624. protected $config;
  15625. protected $process;
  15626. protected $filesystem;
  15627. protected $hasCleanedChanges = array();
  15628. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  15629. {
  15630. $this->io = $io;
  15631. $this->config = $config;
  15632. $this->process = $process ?? new ProcessExecutor($io);
  15633. $this->filesystem = $fs ?? new Filesystem($this->process);
  15634. }
  15635. public function getInstallationSource(): string
  15636. {
  15637. return 'source';
  15638. }
  15639. public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  15640. {
  15641. if (!$package->getSourceReference()) {
  15642. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  15643. }
  15644. $urls = $this->prepareUrls($package->getSourceUrls());
  15645. while ($url = array_shift($urls)) {
  15646. try {
  15647. return $this->doDownload($package, $path, $url, $prevPackage);
  15648. } catch (\Exception $e) {
  15649. if ($e instanceof \PHPUnit\Framework\Exception) {
  15650. throw $e;
  15651. }
  15652. if ($this->io->isDebug()) {
  15653. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  15654. } elseif (count($urls)) {
  15655. $this->io->writeError(' Failed, trying the next URL');
  15656. }
  15657. if (!count($urls)) {
  15658. throw $e;
  15659. }
  15660. }
  15661. }
  15662. return \React\Promise\resolve(null);
  15663. }
  15664. public function prepare(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  15665. {
  15666. if ($type === 'update') {
  15667. $this->cleanChanges($prevPackage, $path, true);
  15668. $this->hasCleanedChanges[$prevPackage->getUniqueName()] = true;
  15669. } elseif ($type === 'install') {
  15670. $this->filesystem->emptyDirectory($path);
  15671. } elseif ($type === 'uninstall') {
  15672. $this->cleanChanges($package, $path, false);
  15673. }
  15674. return \React\Promise\resolve(null);
  15675. }
  15676. public function cleanup(string $type, PackageInterface $package, string $path, PackageInterface $prevPackage = null): PromiseInterface
  15677. {
  15678. if ($type === 'update' && isset($this->hasCleanedChanges[$prevPackage->getUniqueName()])) {
  15679. $this->reapplyChanges($path);
  15680. unset($this->hasCleanedChanges[$prevPackage->getUniqueName()]);
  15681. }
  15682. return \React\Promise\resolve(null);
  15683. }
  15684. public function install(PackageInterface $package, string $path): PromiseInterface
  15685. {
  15686. if (!$package->getSourceReference()) {
  15687. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  15688. }
  15689. $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
  15690. $urls = $this->prepareUrls($package->getSourceUrls());
  15691. while ($url = array_shift($urls)) {
  15692. try {
  15693. $this->doInstall($package, $path, $url);
  15694. break;
  15695. } catch (\Exception $e) {
  15696. if ($e instanceof \PHPUnit\Framework\Exception) {
  15697. throw $e;
  15698. }
  15699. if ($this->io->isDebug()) {
  15700. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  15701. } elseif (count($urls)) {
  15702. $this->io->writeError(' Failed, trying the next URL');
  15703. }
  15704. if (!count($urls)) {
  15705. throw $e;
  15706. }
  15707. }
  15708. }
  15709. return \React\Promise\resolve(null);
  15710. }
  15711. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
  15712. {
  15713. if (!$target->getSourceReference()) {
  15714. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  15715. }
  15716. $this->io->writeError(" - " . UpdateOperation::format($initial, $target).': ', false);
  15717. $urls = $this->prepareUrls($target->getSourceUrls());
  15718. $exception = null;
  15719. while ($url = array_shift($urls)) {
  15720. try {
  15721. $this->doUpdate($initial, $target, $path, $url);
  15722. $exception = null;
  15723. break;
  15724. } catch (\Exception $exception) {
  15725. if ($exception instanceof \PHPUnit\Framework\Exception) {
  15726. throw $exception;
  15727. }
  15728. if ($this->io->isDebug()) {
  15729. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  15730. } elseif (count($urls)) {
  15731. $this->io->writeError(' Failed, trying the next URL');
  15732. }
  15733. }
  15734. }
  15735. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  15736. $message = 'Pulling in changes:';
  15737. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  15738. if ('' === trim($logs)) {
  15739. $message = 'Rolling back changes:';
  15740. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  15741. }
  15742. if ('' !== trim($logs)) {
  15743. $logs = implode("\n", array_map(function ($line): string {
  15744. return ' ' . $line;
  15745. }, explode("\n", $logs)));
  15746. $logs = str_replace('<', '\<', $logs);
  15747. $this->io->writeError(' '.$message);
  15748. $this->io->writeError($logs);
  15749. }
  15750. }
  15751. if (!$urls && $exception) {
  15752. throw $exception;
  15753. }
  15754. return \React\Promise\resolve(null);
  15755. }
  15756. public function remove(PackageInterface $package, string $path): PromiseInterface
  15757. {
  15758. $this->io->writeError(" - " . UninstallOperation::format($package));
  15759. $promise = $this->filesystem->removeDirectoryAsync($path);
  15760. return $promise->then(function (bool $result) use ($path) {
  15761. if (!$result) {
  15762. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  15763. }
  15764. });
  15765. }
  15766. public function getVcsReference(PackageInterface $package, string $path): ?string
  15767. {
  15768. $parser = new VersionParser;
  15769. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  15770. $dumper = new ArrayDumper;
  15771. $packageConfig = $dumper->dump($package);
  15772. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  15773. return $packageVersion['commit'];
  15774. }
  15775. return null;
  15776. }
  15777. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  15778. {
  15779. if (null !== $this->getLocalChanges($package, $path)) {
  15780. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  15781. }
  15782. return \React\Promise\resolve(null);
  15783. }
  15784. protected function reapplyChanges(string $path): void
  15785. {
  15786. }
  15787. abstract protected function doDownload(PackageInterface $package, string $path, string $url, PackageInterface $prevPackage = null): PromiseInterface;
  15788. abstract protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface;
  15789. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface;
  15790. abstract protected function getCommitLogs(string $fromReference, string $toReference, string $path): string;
  15791. abstract protected function hasMetadataRepository(string $path): bool;
  15792. private function prepareUrls(array $urls): array
  15793. {
  15794. foreach ($urls as $index => $url) {
  15795. if (Filesystem::isLocalPath($url)) {
  15796. $fileProtocol = 'file://';
  15797. $isFileProtocol = false;
  15798. if (0 === strpos($url, $fileProtocol)) {
  15799. $url = substr($url, strlen($fileProtocol));
  15800. $isFileProtocol = true;
  15801. }
  15802. if (false !== strpos($url, '%')) {
  15803. $url = rawurldecode($url);
  15804. }
  15805. $urls[$index] = realpath($url);
  15806. if ($isFileProtocol) {
  15807. $urls[$index] = $fileProtocol . $urls[$index];
  15808. }
  15809. }
  15810. }
  15811. return $urls;
  15812. }
  15813. }
  15814. <?php declare(strict_types=1);
  15815. namespace Composer\Downloader;
  15816. use React\Promise\PromiseInterface;
  15817. use Composer\Package\PackageInterface;
  15818. use Composer\Util\ProcessExecutor;
  15819. class XzDownloader extends ArchiveDownloader
  15820. {
  15821. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  15822. {
  15823. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  15824. if (0 === $this->process->execute($command, $ignoredOutput)) {
  15825. return \React\Promise\resolve(null);
  15826. }
  15827. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  15828. throw new \RuntimeException($processError);
  15829. }
  15830. }
  15831. <?php declare(strict_types=1);
  15832. namespace Composer\Downloader;
  15833. use Composer\Package\PackageInterface;
  15834. use Composer\Pcre\Preg;
  15835. use Composer\Util\IniHelper;
  15836. use Composer\Util\Platform;
  15837. use Composer\Util\ProcessExecutor;
  15838. use Symfony\Component\Process\ExecutableFinder;
  15839. use Symfony\Component\Process\Process;
  15840. use React\Promise\PromiseInterface;
  15841. use ZipArchive;
  15842. class ZipDownloader extends ArchiveDownloader
  15843. {
  15844. private static $unzipCommands;
  15845. private static $hasZipArchive;
  15846. private static $isWindows;
  15847. private $zipArchiveObject;
  15848. public function download(PackageInterface $package, string $path, PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  15849. {
  15850. if (null === self::$unzipCommands) {
  15851. self::$unzipCommands = array();
  15852. $finder = new ExecutableFinder;
  15853. if (Platform::isWindows() && ($cmd = $finder->find('7z', null, array('C:\Program Files\7-Zip')))) {
  15854. self::$unzipCommands[] = array('7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s');
  15855. }
  15856. if ($cmd = $finder->find('unzip')) {
  15857. self::$unzipCommands[] = array('unzip', ProcessExecutor::escape($cmd).' -qq %s -d %s');
  15858. }
  15859. if (!Platform::isWindows() && ($cmd = $finder->find('7z'))) {
  15860. self::$unzipCommands[] = array('7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s');
  15861. }
  15862. if (!Platform::isWindows() && ($cmd = $finder->find('7zz'))) {
  15863. self::$unzipCommands[] = array('7zz', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s');
  15864. }
  15865. }
  15866. $procOpenMissing = false;
  15867. if (!function_exists('proc_open')) {
  15868. self::$unzipCommands = array();
  15869. $procOpenMissing = true;
  15870. }
  15871. if (null === self::$hasZipArchive) {
  15872. self::$hasZipArchive = class_exists('ZipArchive');
  15873. }
  15874. if (!self::$hasZipArchive && !self::$unzipCommands) {
  15875. $iniMessage = IniHelper::getMessage();
  15876. if ($procOpenMissing) {
  15877. $error = "The zip extension is missing and unzip/7z commands cannot be called as proc_open is disabled, skipping.\n" . $iniMessage;
  15878. } else {
  15879. $error = "The zip extension and unzip/7z commands are both missing, skipping.\n" . $iniMessage;
  15880. }
  15881. throw new \RuntimeException($error);
  15882. }
  15883. if (null === self::$isWindows) {
  15884. self::$isWindows = Platform::isWindows();
  15885. if (!self::$isWindows && !self::$unzipCommands) {
  15886. if ($procOpenMissing) {
  15887. $this->io->writeError("<warning>proc_open is disabled so 'unzip' and '7z' commands cannot be used, zip files are being unpacked using the PHP zip extension.</warning>");
  15888. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  15889. $this->io->writeError("<warning>Enabling proc_open and installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
  15890. } else {
  15891. $this->io->writeError("<warning>As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  15892. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  15893. $this->io->writeError("<warning>Installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
  15894. }
  15895. }
  15896. }
  15897. return parent::download($package, $path, $prevPackage, $output);
  15898. }
  15899. private function extractWithSystemUnzip(PackageInterface $package, string $file, string $path): PromiseInterface
  15900. {
  15901. static $warned7ZipLinux = false;
  15902. $isLastChance = !self::$hasZipArchive;
  15903. if (!self::$unzipCommands) {
  15904. return $this->extractWithZipArchive($package, $file, $path);
  15905. }
  15906. $commandSpec = reset(self::$unzipCommands);
  15907. $command = sprintf($commandSpec[1], ProcessExecutor::escape($file), ProcessExecutor::escape($path));
  15908. if (Platform::isWindows()) {
  15909. $command = sprintf($commandSpec[1], ProcessExecutor::escape(strtr($file, '/', '\\')), ProcessExecutor::escape(strtr($path, '/', '\\')));
  15910. }
  15911. $executable = $commandSpec[0];
  15912. if (!$warned7ZipLinux && !Platform::isWindows() && in_array($executable, array('7z', '7zz'), true)) {
  15913. $warned7ZipLinux = true;
  15914. if (0 === $this->process->execute($executable, $output)) {
  15915. if (Preg::isMatch('{^\s*7-Zip(?: \[64\])? ([0-9.]+)}', $output, $match) && version_compare($match[1], '21.01', '<')) {
  15916. $this->io->writeError(' <warning>Unzipping using '.$executable.' '.$match[1].' may result in incorrect file permissions. Install '.$executable.' 21.01+ or unzip to ensure you get correct permissions.</warning>');
  15917. }
  15918. }
  15919. }
  15920. $io = $this->io;
  15921. $tryFallback = function (\Throwable $processError) use ($isLastChance, $io, $file, $path, $package, $executable): \React\Promise\PromiseInterface {
  15922. if ($isLastChance) {
  15923. throw $processError;
  15924. }
  15925. if (!is_file($file)) {
  15926. $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
  15927. $io->writeError(' <warning>This most likely is due to a custom installer plugin not handling the returned Promise from the downloader</warning>');
  15928. $io->writeError(' <warning>See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix</warning>');
  15929. } else {
  15930. $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
  15931. $io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  15932. $io->writeError(' Unzip with '.$executable.' command failed, falling back to ZipArchive class');
  15933. }
  15934. return $this->extractWithZipArchive($package, $file, $path);
  15935. };
  15936. try {
  15937. $promise = $this->process->executeAsync($command);
  15938. return $promise->then(function (Process $process) use ($tryFallback, $command, $package, $file) {
  15939. if (!$process->isSuccessful()) {
  15940. if (isset($this->cleanupExecuted[$package->getName()])) {
  15941. throw new \RuntimeException('Failed to extract '.$package->getName().' as the installation was aborted by another package operation.');
  15942. }
  15943. $output = $process->getErrorOutput();
  15944. $output = str_replace(', '.$file.'.zip or '.$file.'.ZIP', '', $output);
  15945. return $tryFallback(new \RuntimeException('Failed to extract '.$package->getName().': ('.$process->getExitCode().') '.$command."\n\n".$output));
  15946. }
  15947. });
  15948. } catch (\Throwable $e) {
  15949. return $tryFallback($e);
  15950. }
  15951. }
  15952. private function extractWithZipArchive(PackageInterface $package, string $file, string $path): PromiseInterface
  15953. {
  15954. $processError = null;
  15955. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  15956. try {
  15957. if (!file_exists($file) || ($filesize = filesize($file)) === false || $filesize === 0) {
  15958. $retval = -1;
  15959. } else {
  15960. $retval = $zipArchive->open($file);
  15961. }
  15962. if (true === $retval) {
  15963. $extractResult = $zipArchive->extractTo($path);
  15964. if (true === $extractResult) {
  15965. $zipArchive->close();
  15966. return \React\Promise\resolve(null);
  15967. }
  15968. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  15969. } else {
  15970. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  15971. }
  15972. } catch (\ErrorException $e) {
  15973. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  15974. } catch (\Throwable $e) {
  15975. $processError = $e;
  15976. }
  15977. throw $processError;
  15978. }
  15979. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  15980. {
  15981. return $this->extractWithSystemUnzip($package, $file, $path);
  15982. }
  15983. protected function getErrorMessage(int $retval, string $file): string
  15984. {
  15985. switch ($retval) {
  15986. case ZipArchive::ER_EXISTS:
  15987. return sprintf("File '%s' already exists.", $file);
  15988. case ZipArchive::ER_INCONS:
  15989. return sprintf("Zip archive '%s' is inconsistent.", $file);
  15990. case ZipArchive::ER_INVAL:
  15991. return sprintf("Invalid argument (%s)", $file);
  15992. case ZipArchive::ER_MEMORY:
  15993. return sprintf("Malloc failure (%s)", $file);
  15994. case ZipArchive::ER_NOENT:
  15995. return sprintf("No such zip file: '%s'", $file);
  15996. case ZipArchive::ER_NOZIP:
  15997. return sprintf("'%s' is not a zip archive.", $file);
  15998. case ZipArchive::ER_OPEN:
  15999. return sprintf("Can't open zip file: %s", $file);
  16000. case ZipArchive::ER_READ:
  16001. return sprintf("Zip read error (%s)", $file);
  16002. case ZipArchive::ER_SEEK:
  16003. return sprintf("Zip seek error (%s)", $file);
  16004. case -1:
  16005. return sprintf("'%s' is a corrupted zip archive (0 bytes), try again.", $file);
  16006. default:
  16007. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  16008. }
  16009. }
  16010. }
  16011. <?php declare(strict_types=1);
  16012. namespace Composer\EventDispatcher;
  16013. class Event
  16014. {
  16015. protected $name;
  16016. protected $args;
  16017. protected $flags;
  16018. private $propagationStopped = false;
  16019. public function __construct(string $name, array $args = array(), array $flags = array())
  16020. {
  16021. $this->name = $name;
  16022. $this->args = $args;
  16023. $this->flags = $flags;
  16024. }
  16025. public function getName(): string
  16026. {
  16027. return $this->name;
  16028. }
  16029. public function getArguments(): array
  16030. {
  16031. return $this->args;
  16032. }
  16033. public function getFlags(): array
  16034. {
  16035. return $this->flags;
  16036. }
  16037. public function isPropagationStopped(): bool
  16038. {
  16039. return $this->propagationStopped;
  16040. }
  16041. public function stopPropagation(): void
  16042. {
  16043. $this->propagationStopped = true;
  16044. }
  16045. }
  16046. <?php declare(strict_types=1);
  16047. namespace Composer\EventDispatcher;
  16048. use Composer\DependencyResolver\Transaction;
  16049. use Composer\Installer\InstallerEvent;
  16050. use Composer\IO\IOInterface;
  16051. use Composer\Composer;
  16052. use Composer\PartialComposer;
  16053. use Composer\Pcre\Preg;
  16054. use Composer\Util\Platform;
  16055. use Composer\DependencyResolver\Operation\OperationInterface;
  16056. use Composer\Repository\RepositoryInterface;
  16057. use Composer\Script;
  16058. use Composer\Installer\PackageEvent;
  16059. use Composer\Installer\BinaryInstaller;
  16060. use Composer\Util\ProcessExecutor;
  16061. use Composer\Script\Event as ScriptEvent;
  16062. use Composer\Autoload\ClassLoader;
  16063. use Symfony\Component\Process\PhpExecutableFinder;
  16064. use Symfony\Component\Process\ExecutableFinder;
  16065. class EventDispatcher
  16066. {
  16067. protected $composer;
  16068. protected $io;
  16069. protected $loader;
  16070. protected $process;
  16071. protected $listeners = array();
  16072. protected $runScripts = true;
  16073. private $eventStack;
  16074. public function __construct(PartialComposer $composer, IOInterface $io, ProcessExecutor $process = null)
  16075. {
  16076. $this->composer = $composer;
  16077. $this->io = $io;
  16078. $this->process = $process ?? new ProcessExecutor($io);
  16079. $this->eventStack = array();
  16080. }
  16081. public function setRunScripts(bool $runScripts = true): self
  16082. {
  16083. $this->runScripts = (bool) $runScripts;
  16084. return $this;
  16085. }
  16086. public function dispatch(?string $eventName, Event $event = null): int
  16087. {
  16088. if (null === $event) {
  16089. if (null === $eventName) {
  16090. throw new \InvalidArgumentException('If no $event is passed in to '.__METHOD__.' you have to pass in an $eventName, got null.');
  16091. }
  16092. $event = new Event($eventName);
  16093. }
  16094. return $this->doDispatch($event);
  16095. }
  16096. public function dispatchScript(string $eventName, bool $devMode = false, array $additionalArgs = array(), array $flags = array()): int
  16097. {
  16098. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  16099. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  16100. }
  16101. public function dispatchPackageEvent(string $eventName, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation): int
  16102. {
  16103. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  16104. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $localRepo, $operations, $operation));
  16105. }
  16106. public function dispatchInstallerEvent(string $eventName, bool $devMode, bool $executeOperations, Transaction $transaction): int
  16107. {
  16108. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  16109. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $executeOperations, $transaction));
  16110. }
  16111. protected function doDispatch(Event $event)
  16112. {
  16113. if (Platform::getEnv('COMPOSER_DEBUG_EVENTS')) {
  16114. $details = null;
  16115. if ($event instanceof PackageEvent) {
  16116. $details = (string) $event->getOperation();
  16117. }
  16118. $this->io->writeError('Dispatching <info>'.$event->getName().'</info>'.($details ? ' ('.$details.')' : '').' event');
  16119. }
  16120. $listeners = $this->getListeners($event);
  16121. $this->pushEvent($event);
  16122. try {
  16123. $returnMax = 0;
  16124. foreach ($listeners as $callable) {
  16125. $return = 0;
  16126. $this->ensureBinDirIsInPath();
  16127. if (!is_string($callable)) {
  16128. if (!is_callable($callable)) {
  16129. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  16130. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  16131. }
  16132. if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {
  16133. $this->io->writeError(sprintf('> %s: %s', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);
  16134. }
  16135. $return = false === call_user_func($callable, $event) ? 1 : 0;
  16136. } elseif ($this->isComposerScript($callable)) {
  16137. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  16138. $script = explode(' ', substr($callable, 1));
  16139. $scriptName = $script[0];
  16140. unset($script[0]);
  16141. $args = array_merge($script, $event->getArguments());
  16142. $flags = $event->getFlags();
  16143. if (strpos($callable, '@composer ') === 0) {
  16144. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . ' ' . implode(' ', $args);
  16145. if (0 !== ($exitCode = $this->executeTty($exec))) {
  16146. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  16147. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  16148. }
  16149. } else {
  16150. if (!$this->getListeners(new Event($scriptName))) {
  16151. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  16152. }
  16153. try {
  16154. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  16155. $scriptEvent->setOriginatingEvent($event);
  16156. $return = $this->dispatch($scriptName, $scriptEvent);
  16157. } catch (ScriptExecutionException $e) {
  16158. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  16159. throw $e;
  16160. }
  16161. }
  16162. } elseif ($this->isPhpScript($callable)) {
  16163. $className = substr($callable, 0, strpos($callable, '::'));
  16164. $methodName = substr($callable, strpos($callable, '::') + 2);
  16165. if (!class_exists($className)) {
  16166. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  16167. continue;
  16168. }
  16169. if (!is_callable($callable)) {
  16170. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  16171. continue;
  16172. }
  16173. try {
  16174. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  16175. } catch (\Exception $e) {
  16176. $message = "Script %s handling the %s event terminated with an exception";
  16177. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  16178. throw $e;
  16179. }
  16180. } else {
  16181. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  16182. $exec = $callable . ($args === '' ? '' : ' '.$args);
  16183. if ($this->io->isVerbose()) {
  16184. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  16185. } elseif ($event->getName() !== '__exec_command') {
  16186. $this->io->writeError(sprintf('> %s', $exec));
  16187. }
  16188. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  16189. if ($possibleLocalBinaries) {
  16190. foreach ($possibleLocalBinaries as $localExec) {
  16191. if (Preg::isMatch('{\b'.preg_quote($callable).'$}', $localExec)) {
  16192. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  16193. $exec = Preg::replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  16194. break;
  16195. }
  16196. }
  16197. }
  16198. if (strpos($exec, '@putenv ') === 0) {
  16199. if (false === strpos($exec, '=')) {
  16200. Platform::clearEnv(substr($exec, 8));
  16201. } else {
  16202. list($var, $value) = explode('=', substr($exec, 8), 2);
  16203. Platform::putEnv($var, $value);
  16204. }
  16205. continue;
  16206. }
  16207. if (strpos($exec, '@php ') === 0) {
  16208. $pathAndArgs = substr($exec, 5);
  16209. if (Platform::isWindows()) {
  16210. $pathAndArgs = Preg::replaceCallback('{^\S+}', function ($path) {
  16211. return str_replace('/', '\\', $path[0]);
  16212. }, $pathAndArgs);
  16213. }
  16214. $matched = Preg::isMatch('{^[^\'"\s/\\\\]+}', $pathAndArgs, $match);
  16215. if ($matched && !file_exists($match[0])) {
  16216. $finder = new ExecutableFinder;
  16217. if ($pathToExec = $finder->find($match[0])) {
  16218. $pathAndArgs = $pathToExec . substr($pathAndArgs, strlen($match[0]));
  16219. }
  16220. }
  16221. $exec = $this->getPhpExecCommand() . ' ' . $pathAndArgs;
  16222. } else {
  16223. $finder = new PhpExecutableFinder();
  16224. $phpPath = $finder->find(false);
  16225. if ($phpPath) {
  16226. Platform::putEnv('PHP_BINARY', $phpPath);
  16227. }
  16228. if (Platform::isWindows()) {
  16229. $exec = Preg::replaceCallback('{^\S+}', function ($path) {
  16230. return str_replace('/', '\\', $path[0]);
  16231. }, $exec);
  16232. }
  16233. }
  16234. if (strpos($exec, 'composer ') === 0) {
  16235. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . substr($exec, 8);
  16236. }
  16237. if (0 !== ($exitCode = $this->executeTty($exec))) {
  16238. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  16239. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  16240. }
  16241. }
  16242. $returnMax = max($returnMax, $return);
  16243. if ($event->isPropagationStopped()) {
  16244. break;
  16245. }
  16246. }
  16247. } finally {
  16248. $this->popEvent();
  16249. }
  16250. return $returnMax;
  16251. }
  16252. protected function executeTty(string $exec): int
  16253. {
  16254. if ($this->io->isInteractive()) {
  16255. return $this->process->executeTty($exec);
  16256. }
  16257. return $this->process->execute($exec);
  16258. }
  16259. protected function getPhpExecCommand(): string
  16260. {
  16261. $finder = new PhpExecutableFinder();
  16262. $phpPath = $finder->find(false);
  16263. if (!$phpPath) {
  16264. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  16265. }
  16266. $phpArgs = $finder->findArguments();
  16267. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  16268. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  16269. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  16270. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  16271. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  16272. }
  16273. protected function executeEventPhpScript(string $className, string $methodName, Event $event)
  16274. {
  16275. if ($this->io->isVerbose()) {
  16276. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  16277. } else {
  16278. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  16279. }
  16280. return $className::$methodName($event);
  16281. }
  16282. public function addListener(string $eventName, $listener, int $priority = 0): void
  16283. {
  16284. $this->listeners[$eventName][$priority][] = $listener;
  16285. }
  16286. public function removeListener($listener): void
  16287. {
  16288. foreach ($this->listeners as $eventName => $priorities) {
  16289. foreach ($priorities as $priority => $listeners) {
  16290. foreach ($listeners as $index => $candidate) {
  16291. if ($listener === $candidate || (is_array($candidate) && is_object($listener) && $candidate[0] === $listener)) {
  16292. unset($this->listeners[$eventName][$priority][$index]);
  16293. }
  16294. }
  16295. }
  16296. }
  16297. }
  16298. public function addSubscriber(EventSubscriberInterface $subscriber): void
  16299. {
  16300. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  16301. if (is_string($params)) {
  16302. $this->addListener($eventName, array($subscriber, $params));
  16303. } elseif (is_string($params[0])) {
  16304. $this->addListener($eventName, array($subscriber, $params[0]), $params[1] ?? 0);
  16305. } else {
  16306. foreach ($params as $listener) {
  16307. $this->addListener($eventName, array($subscriber, $listener[0]), $listener[1] ?? 0);
  16308. }
  16309. }
  16310. }
  16311. }
  16312. protected function getListeners(Event $event): array
  16313. {
  16314. $scriptListeners = $this->runScripts ? $this->getScriptListeners($event) : array();
  16315. if (!isset($this->listeners[$event->getName()][0])) {
  16316. $this->listeners[$event->getName()][0] = array();
  16317. }
  16318. krsort($this->listeners[$event->getName()]);
  16319. $listeners = $this->listeners;
  16320. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  16321. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  16322. }
  16323. public function hasEventListeners(Event $event): bool
  16324. {
  16325. $listeners = $this->getListeners($event);
  16326. return count($listeners) > 0;
  16327. }
  16328. protected function getScriptListeners(Event $event): array
  16329. {
  16330. $package = $this->composer->getPackage();
  16331. $scripts = $package->getScripts();
  16332. if (empty($scripts[$event->getName()])) {
  16333. return array();
  16334. }
  16335. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  16336. if ($this->loader) {
  16337. $this->loader->unregister();
  16338. }
  16339. $generator = $this->composer->getAutoloadGenerator();
  16340. if ($event instanceof ScriptEvent) {
  16341. $generator->setDevMode($event->isDevMode());
  16342. }
  16343. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  16344. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  16345. $map = $generator->parseAutoloads($packageMap, $package);
  16346. $this->loader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
  16347. $this->loader->register(false);
  16348. return $scripts[$event->getName()];
  16349. }
  16350. protected function isPhpScript(string $callable): bool
  16351. {
  16352. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  16353. }
  16354. protected function isComposerScript(string $callable): bool
  16355. {
  16356. return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
  16357. }
  16358. protected function pushEvent(Event $event): int
  16359. {
  16360. $eventName = $event->getName();
  16361. if (in_array($eventName, $this->eventStack)) {
  16362. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  16363. }
  16364. return array_push($this->eventStack, $eventName);
  16365. }
  16366. protected function popEvent(): ?string
  16367. {
  16368. return array_pop($this->eventStack);
  16369. }
  16370. private function ensureBinDirIsInPath(): void
  16371. {
  16372. $pathEnv = 'PATH';
  16373. if (!isset($_SERVER[$pathEnv]) && isset($_SERVER['Path'])) {
  16374. $pathEnv = 'Path';
  16375. }
  16376. $binDir = $this->composer->getConfig()->get('bin-dir');
  16377. if (is_dir($binDir)) {
  16378. $binDir = realpath($binDir);
  16379. $pathValue = (string) Platform::getEnv($pathEnv);
  16380. if (!Preg::isMatch('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $pathValue)) {
  16381. Platform::putEnv($pathEnv, $binDir.PATH_SEPARATOR.$pathValue);
  16382. }
  16383. }
  16384. }
  16385. }
  16386. <?php declare(strict_types=1);
  16387. namespace Composer\EventDispatcher;
  16388. interface EventSubscriberInterface
  16389. {
  16390. public static function getSubscribedEvents();
  16391. }
  16392. <?php declare(strict_types=1);
  16393. namespace Composer\EventDispatcher;
  16394. class ScriptExecutionException extends \RuntimeException
  16395. {
  16396. }
  16397. <?php declare(strict_types=1);
  16398. namespace Composer\Exception;
  16399. class IrrecoverableDownloadException extends \RuntimeException
  16400. {
  16401. }
  16402. <?php declare(strict_types=1);
  16403. namespace Composer\Exception;
  16404. class NoSslException extends \RuntimeException
  16405. {
  16406. }
  16407. <?php declare(strict_types=1);
  16408. namespace Composer;
  16409. use Composer\Config\JsonConfigSource;
  16410. use Composer\Json\JsonFile;
  16411. use Composer\IO\IOInterface;
  16412. use Composer\Package\Archiver;
  16413. use Composer\Package\Version\VersionGuesser;
  16414. use Composer\Package\RootPackageInterface;
  16415. use Composer\Repository\RepositoryManager;
  16416. use Composer\Repository\RepositoryFactory;
  16417. use Composer\Util\Filesystem;
  16418. use Composer\Util\Platform;
  16419. use Composer\Util\ProcessExecutor;
  16420. use Composer\Util\HttpDownloader;
  16421. use Composer\Util\Loop;
  16422. use Composer\Util\Silencer;
  16423. use Composer\Plugin\PluginEvents;
  16424. use Composer\EventDispatcher\Event;
  16425. use Phar;
  16426. use Seld\JsonLint\DuplicateKeyException;
  16427. use Symfony\Component\Console\Formatter\OutputFormatter;
  16428. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  16429. use Symfony\Component\Console\Output\ConsoleOutput;
  16430. use Composer\EventDispatcher\EventDispatcher;
  16431. use Composer\Autoload\AutoloadGenerator;
  16432. use Composer\Package\Version\VersionParser;
  16433. use Composer\Downloader\TransportException;
  16434. use Composer\Json\JsonValidationException;
  16435. use Composer\Repository\InstalledRepositoryInterface;
  16436. use Seld\JsonLint\JsonParser;
  16437. use UnexpectedValueException;
  16438. use ZipArchive;
  16439. class Factory
  16440. {
  16441. protected static function getHomeDir(): string
  16442. {
  16443. $home = Platform::getEnv('COMPOSER_HOME');
  16444. if ($home) {
  16445. return $home;
  16446. }
  16447. if (Platform::isWindows()) {
  16448. if (!Platform::getEnv('APPDATA')) {
  16449. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  16450. }
  16451. return rtrim(strtr(Platform::getEnv('APPDATA'), '\\', '/'), '/') . '/Composer';
  16452. }
  16453. $userDir = self::getUserDir();
  16454. $dirs = array();
  16455. if (self::useXdg()) {
  16456. $xdgConfig = Platform::getEnv('XDG_CONFIG_HOME');
  16457. if (!$xdgConfig) {
  16458. $xdgConfig = $userDir . '/.config';
  16459. }
  16460. $dirs[] = $xdgConfig . '/composer';
  16461. }
  16462. $dirs[] = $userDir . '/.composer';
  16463. foreach ($dirs as $dir) {
  16464. if (Silencer::call('is_dir', $dir)) {
  16465. return $dir;
  16466. }
  16467. }
  16468. return $dirs[0];
  16469. }
  16470. protected static function getCacheDir(string $home): string
  16471. {
  16472. $cacheDir = Platform::getEnv('COMPOSER_CACHE_DIR');
  16473. if ($cacheDir) {
  16474. return $cacheDir;
  16475. }
  16476. $homeEnv = Platform::getEnv('COMPOSER_HOME');
  16477. if ($homeEnv) {
  16478. return $homeEnv . '/cache';
  16479. }
  16480. if (Platform::isWindows()) {
  16481. if ($cacheDir = Platform::getEnv('LOCALAPPDATA')) {
  16482. $cacheDir .= '/Composer';
  16483. } else {
  16484. $cacheDir = $home . '/cache';
  16485. }
  16486. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  16487. }
  16488. $userDir = self::getUserDir();
  16489. if (PHP_OS === 'Darwin') {
  16490. if (is_dir($home . '/cache') && !is_dir($userDir . '/Library/Caches/composer')) {
  16491. Silencer::call('rename', $home . '/cache', $userDir . '/Library/Caches/composer');
  16492. }
  16493. return $userDir . '/Library/Caches/composer';
  16494. }
  16495. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  16496. return $home . '/cache';
  16497. }
  16498. if (self::useXdg()) {
  16499. $xdgCache = Platform::getEnv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  16500. return $xdgCache . '/composer';
  16501. }
  16502. return $home . '/cache';
  16503. }
  16504. protected static function getDataDir(string $home): string
  16505. {
  16506. $homeEnv = Platform::getEnv('COMPOSER_HOME');
  16507. if ($homeEnv) {
  16508. return $homeEnv;
  16509. }
  16510. if (Platform::isWindows()) {
  16511. return strtr($home, '\\', '/');
  16512. }
  16513. $userDir = self::getUserDir();
  16514. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  16515. $xdgData = Platform::getEnv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  16516. return $xdgData . '/composer';
  16517. }
  16518. return $home;
  16519. }
  16520. public static function createConfig(IOInterface $io = null, ?string $cwd = null): Config
  16521. {
  16522. $cwd = $cwd ?? Platform::getCwd(true);
  16523. $config = new Config(true, $cwd);
  16524. $home = self::getHomeDir();
  16525. $config->merge(array(
  16526. 'config' => array(
  16527. 'home' => $home,
  16528. 'cache-dir' => self::getCacheDir($home),
  16529. 'data-dir' => self::getDataDir($home),
  16530. )
  16531. ), Config::SOURCE_DEFAULT);
  16532. $file = new JsonFile($config->get('home').'/config.json');
  16533. if ($file->exists()) {
  16534. if ($io instanceof IOInterface) {
  16535. $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
  16536. }
  16537. self::validateJsonSchema($io, $file);
  16538. $config->merge($file->read(), $file->getPath());
  16539. }
  16540. $config->setConfigSource(new JsonConfigSource($file));
  16541. $htaccessProtect = (bool) $config->get('htaccess-protect');
  16542. if ($htaccessProtect) {
  16543. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  16544. foreach ($dirs as $dir) {
  16545. if (!file_exists($dir . '/.htaccess')) {
  16546. if (!is_dir($dir)) {
  16547. Silencer::call('mkdir', $dir, 0777, true);
  16548. }
  16549. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  16550. }
  16551. }
  16552. }
  16553. $file = new JsonFile($config->get('home').'/auth.json');
  16554. if ($file->exists()) {
  16555. if ($io instanceof IOInterface) {
  16556. $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
  16557. }
  16558. self::validateJsonSchema($io, $file, JsonFile::AUTH_SCHEMA);
  16559. $config->merge(array('config' => $file->read()), $file->getPath());
  16560. }
  16561. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  16562. if ($composerAuthEnv = Platform::getEnv('COMPOSER_AUTH')) {
  16563. $authData = json_decode($composerAuthEnv);
  16564. if (null === $authData) {
  16565. if ($io instanceof IOInterface) {
  16566. $io->writeError('<error>COMPOSER_AUTH environment variable is malformed, should be a valid JSON object</error>');
  16567. }
  16568. } else {
  16569. if ($io instanceof IOInterface) {
  16570. $io->writeError('Loading auth config from COMPOSER_AUTH', true, IOInterface::DEBUG);
  16571. }
  16572. self::validateJsonSchema($io, $authData, JsonFile::AUTH_SCHEMA, 'COMPOSER_AUTH');
  16573. $authData = json_decode($composerAuthEnv, true);
  16574. if (null !== $authData) {
  16575. $config->merge(array('config' => $authData), 'COMPOSER_AUTH');
  16576. }
  16577. }
  16578. }
  16579. return $config;
  16580. }
  16581. public static function getComposerFile(): string
  16582. {
  16583. return trim((string) Platform::getEnv('COMPOSER')) ?: './composer.json';
  16584. }
  16585. public static function getLockFile(string $composerFile): string
  16586. {
  16587. return "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  16588. ? substr($composerFile, 0, -4).'lock'
  16589. : $composerFile . '.lock';
  16590. }
  16591. public static function createAdditionalStyles(): array
  16592. {
  16593. return array(
  16594. 'highlight' => new OutputFormatterStyle('red'),
  16595. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  16596. );
  16597. }
  16598. public static function createOutput(): ConsoleOutput
  16599. {
  16600. $styles = self::createAdditionalStyles();
  16601. $formatter = new OutputFormatter(false, $styles);
  16602. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  16603. }
  16604. public function createComposer(IOInterface $io, $localConfig = null, bool $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
  16605. {
  16606. $cwd = $cwd ?? Platform::getCwd(true);
  16607. if (null === $localConfig) {
  16608. $localConfig = static::getComposerFile();
  16609. }
  16610. $localConfigSource = Config::SOURCE_UNKNOWN;
  16611. if (is_string($localConfig)) {
  16612. $composerFile = $localConfig;
  16613. $file = new JsonFile($localConfig, null, $io);
  16614. if (!$file->exists()) {
  16615. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  16616. $message = 'Composer could not find a composer.json file in '.$cwd;
  16617. } else {
  16618. $message = 'Composer could not find the config file: '.$localConfig;
  16619. }
  16620. $instructions = $fullLoad ? 'To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage' : '';
  16621. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  16622. }
  16623. try {
  16624. $file->validateSchema(JsonFile::LAX_SCHEMA);
  16625. } catch (JsonValidationException $e) {
  16626. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  16627. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  16628. throw new JsonValidationException($message);
  16629. }
  16630. $localConfig = $file->read();
  16631. $localConfigSource = $file->getPath();
  16632. }
  16633. $config = static::createConfig($io, $cwd);
  16634. $config->merge($localConfig, $localConfigSource);
  16635. if (isset($composerFile)) {
  16636. $io->writeError('Loading config file ' . $composerFile .' ('.realpath($composerFile).')', true, IOInterface::DEBUG);
  16637. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  16638. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  16639. if ($localAuthFile->exists()) {
  16640. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  16641. $config->merge(array('config' => $localAuthFile->read()), $localAuthFile->getPath());
  16642. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  16643. }
  16644. }
  16645. $vendorDir = $config->get('vendor-dir');
  16646. $composer = $fullLoad ? new Composer() : new PartialComposer();
  16647. $composer->setConfig($config);
  16648. if ($fullLoad) {
  16649. $io->loadConfiguration($config);
  16650. if (!class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/InstalledVersions.php')) {
  16651. include $installedVersionsPath;
  16652. }
  16653. }
  16654. $httpDownloader = self::createHttpDownloader($io, $config);
  16655. $process = new ProcessExecutor($io);
  16656. $loop = new Loop($httpDownloader, $process);
  16657. $composer->setLoop($loop);
  16658. $dispatcher = new EventDispatcher($composer, $io, $process);
  16659. $dispatcher->setRunScripts(!$disableScripts);
  16660. $composer->setEventDispatcher($dispatcher);
  16661. $rm = RepositoryFactory::manager($io, $config, $httpDownloader, $dispatcher, $process);
  16662. $composer->setRepositoryManager($rm);
  16663. if (!$fullLoad && !isset($localConfig['version'])) {
  16664. $localConfig['version'] = '1.0.0';
  16665. }
  16666. $parser = new VersionParser;
  16667. $guesser = new VersionGuesser($config, $process, $parser);
  16668. $loader = $this->loadRootPackage($rm, $config, $parser, $guesser, $io);
  16669. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  16670. $composer->setPackage($package);
  16671. $this->addLocalRepository($io, $rm, $vendorDir, $package, $process);
  16672. $im = $this->createInstallationManager($loop, $io, $dispatcher);
  16673. $composer->setInstallationManager($im);
  16674. if ($composer instanceof Composer) {
  16675. $dm = $this->createDownloadManager($io, $config, $httpDownloader, $process, $dispatcher);
  16676. $composer->setDownloadManager($dm);
  16677. $generator = new AutoloadGenerator($dispatcher, $io);
  16678. $composer->setAutoloadGenerator($generator);
  16679. $am = $this->createArchiveManager($config, $dm, $loop);
  16680. $composer->setArchiveManager($am);
  16681. }
  16682. $this->createDefaultInstallers($im, $composer, $io, $process);
  16683. if ($composer instanceof Composer) {
  16684. $globalComposer = null;
  16685. if (realpath($config->get('home')) !== $cwd) {
  16686. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins, $disableScripts);
  16687. }
  16688. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  16689. $composer->setPluginManager($pm);
  16690. $pm->loadInstalledPlugins();
  16691. }
  16692. if ($composer instanceof Composer && isset($composerFile)) {
  16693. $lockFile = self::getLockFile($composerFile);
  16694. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $im, file_get_contents($composerFile), $process);
  16695. $composer->setLocker($locker);
  16696. }
  16697. if ($fullLoad) {
  16698. $initEvent = new Event(PluginEvents::INIT);
  16699. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  16700. $this->purgePackages($rm->getLocalRepository(), $im);
  16701. }
  16702. return $composer;
  16703. }
  16704. public static function createGlobal(IOInterface $io, bool $disablePlugins = false, bool $disableScripts = false): ?Composer
  16705. {
  16706. $factory = new static();
  16707. $composer = $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
  16708. assert(null === $composer || $composer instanceof Composer);
  16709. return $composer;
  16710. }
  16711. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, string $vendorDir, RootPackageInterface $rootPackage, ProcessExecutor $process = null): void
  16712. {
  16713. $fs = null;
  16714. if ($process) {
  16715. $fs = new Filesystem($process);
  16716. }
  16717. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io), true, $rootPackage, $fs));
  16718. }
  16719. protected function createGlobalComposer(IOInterface $io, Config $config, bool $disablePlugins, bool $disableScripts, bool $fullLoad = false): ?PartialComposer
  16720. {
  16721. $composer = null;
  16722. try {
  16723. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad, $disableScripts);
  16724. } catch (\Exception $e) {
  16725. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  16726. }
  16727. return $composer;
  16728. }
  16729. public function createDownloadManager(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process, EventDispatcher $eventDispatcher = null): Downloader\DownloadManager
  16730. {
  16731. $cache = null;
  16732. if ($config->get('cache-files-ttl') > 0) {
  16733. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  16734. $cache->setReadOnly($config->get('cache-read-only'));
  16735. }
  16736. $fs = new Filesystem($process);
  16737. $dm = new Downloader\DownloadManager($io, false, $fs);
  16738. switch ($preferred = $config->get('preferred-install')) {
  16739. case 'dist':
  16740. $dm->setPreferDist(true);
  16741. break;
  16742. case 'source':
  16743. $dm->setPreferSource(true);
  16744. break;
  16745. case 'auto':
  16746. default:
  16747. break;
  16748. }
  16749. if (is_array($preferred)) {
  16750. $dm->setPreferences($preferred);
  16751. }
  16752. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $process, $fs));
  16753. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $process, $fs));
  16754. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $process, $fs));
  16755. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $process, $fs));
  16756. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config, $process, $fs));
  16757. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16758. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16759. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16760. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16761. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16762. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16763. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16764. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  16765. return $dm;
  16766. }
  16767. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm, Loop $loop)
  16768. {
  16769. $am = new Archiver\ArchiveManager($dm, $loop);
  16770. if (class_exists(ZipArchive::class)) {
  16771. $am->addArchiver(new Archiver\ZipArchiver);
  16772. }
  16773. if (class_exists(Phar::class)) {
  16774. $am->addArchiver(new Archiver\PharArchiver);
  16775. }
  16776. return $am;
  16777. }
  16778. protected function createPluginManager(IOInterface $io, Composer $composer, PartialComposer $globalComposer = null, bool $disablePlugins = false): Plugin\PluginManager
  16779. {
  16780. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  16781. }
  16782. public function createInstallationManager(Loop $loop, IOInterface $io, EventDispatcher $eventDispatcher = null): Installer\InstallationManager
  16783. {
  16784. return new Installer\InstallationManager($loop, $io, $eventDispatcher);
  16785. }
  16786. protected function createDefaultInstallers(Installer\InstallationManager $im, PartialComposer $composer, IOInterface $io, ProcessExecutor $process = null): void
  16787. {
  16788. $fs = new Filesystem($process);
  16789. $binaryInstaller = new Installer\BinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $fs, rtrim($composer->getConfig()->get('vendor-dir'), '/'));
  16790. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null, $fs, $binaryInstaller));
  16791. $im->addInstaller(new Installer\PluginInstaller($io, $composer, $fs, $binaryInstaller));
  16792. $im->addInstaller(new Installer\MetapackageInstaller($io));
  16793. }
  16794. protected function purgePackages(InstalledRepositoryInterface $repo, Installer\InstallationManager $im): void
  16795. {
  16796. foreach ($repo->getPackages() as $package) {
  16797. if (!$im->isPackageInstalled($repo, $package)) {
  16798. $repo->removePackage($package);
  16799. }
  16800. }
  16801. }
  16802. protected function loadRootPackage(RepositoryManager $rm, Config $config, VersionParser $parser, VersionGuesser $guesser, IOInterface $io): Package\Loader\RootPackageLoader
  16803. {
  16804. return new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  16805. }
  16806. public static function create(IOInterface $io, $config = null, bool $disablePlugins = false, bool $disableScripts = false): Composer
  16807. {
  16808. $factory = new static();
  16809. $composer = $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
  16810. assert($composer instanceof Composer);
  16811. return $composer;
  16812. }
  16813. public static function createHttpDownloader(IOInterface $io, Config $config, array $options = array()): HttpDownloader
  16814. {
  16815. static $warned = false;
  16816. $disableTls = false;
  16817. if (isset($_SERVER['argv']) && in_array('disable-tls', $_SERVER['argv']) && (in_array('conf', $_SERVER['argv']) || in_array('config', $_SERVER['argv']))) {
  16818. $warned = true;
  16819. $disableTls = !extension_loaded('openssl');
  16820. } elseif ($config->get('disable-tls') === true) {
  16821. if (!$warned) {
  16822. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  16823. }
  16824. $warned = true;
  16825. $disableTls = true;
  16826. } elseif (!extension_loaded('openssl')) {
  16827. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  16828. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  16829. }
  16830. $httpDownloaderOptions = array();
  16831. if ($disableTls === false) {
  16832. if ($config->get('cafile')) {
  16833. $httpDownloaderOptions['ssl']['cafile'] = $config->get('cafile');
  16834. }
  16835. if ($config->get('capath')) {
  16836. $httpDownloaderOptions['ssl']['capath'] = $config->get('capath');
  16837. }
  16838. $httpDownloaderOptions = array_replace_recursive($httpDownloaderOptions, $options);
  16839. }
  16840. try {
  16841. $httpDownloader = new HttpDownloader($io, $config, $httpDownloaderOptions, $disableTls);
  16842. } catch (TransportException $e) {
  16843. if (false !== strpos($e->getMessage(), 'cafile')) {
  16844. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  16845. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  16846. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  16847. }
  16848. throw $e;
  16849. }
  16850. return $httpDownloader;
  16851. }
  16852. private static function useXdg(): bool
  16853. {
  16854. foreach (array_keys($_SERVER) as $key) {
  16855. if (strpos($key, 'XDG_') === 0) {
  16856. return true;
  16857. }
  16858. }
  16859. if (Silencer::call('is_dir', '/etc/xdg')) {
  16860. return true;
  16861. }
  16862. return false;
  16863. }
  16864. private static function getUserDir(): string
  16865. {
  16866. $home = Platform::getEnv('HOME');
  16867. if (!$home) {
  16868. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  16869. }
  16870. return rtrim(strtr($home, '\\', '/'), '/');
  16871. }
  16872. private static function validateJsonSchema(?IOInterface $io, $fileOrData, int $schema = JsonFile::LAX_SCHEMA, ?string $source = null): void
  16873. {
  16874. try {
  16875. if ($fileOrData instanceof JsonFile) {
  16876. $fileOrData->validateSchema($schema);
  16877. } else {
  16878. if (null === $source) {
  16879. throw new \InvalidArgumentException('$source is required to be provided if $fileOrData is arbitrary data');
  16880. }
  16881. JsonFile::validateJsonSchema($source, $fileOrData, $schema);
  16882. }
  16883. } catch (JsonValidationException $e) {
  16884. $msg = $e->getMessage().', this may result in errors and should be resolved:'.PHP_EOL.' - '.implode(PHP_EOL.' - ', $e->getErrors());
  16885. if ($io instanceof IOInterface) {
  16886. $io->writeError('<warning>'.$msg.'</>');
  16887. } else {
  16888. throw new UnexpectedValueException($msg);
  16889. }
  16890. }
  16891. }
  16892. }
  16893. <?php declare(strict_types=1);
  16894. namespace Composer\Filter\PlatformRequirementFilter;
  16895. use Composer\Repository\PlatformRepository;
  16896. final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFilterInterface
  16897. {
  16898. public function isIgnored(string $req): bool
  16899. {
  16900. return PlatformRepository::isPlatformPackage($req);
  16901. }
  16902. }
  16903. <?php declare(strict_types=1);
  16904. namespace Composer\Filter\PlatformRequirementFilter;
  16905. use Composer\Package\BasePackage;
  16906. use Composer\Pcre\Preg;
  16907. use Composer\Repository\PlatformRepository;
  16908. use Composer\Semver\Constraint\Constraint;
  16909. use Composer\Semver\Constraint\ConstraintInterface;
  16910. use Composer\Semver\Constraint\MatchAllConstraint;
  16911. use Composer\Semver\Constraint\MultiConstraint;
  16912. use Composer\Semver\Interval;
  16913. use Composer\Semver\Intervals;
  16914. final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface
  16915. {
  16916. private $ignoreRegex;
  16917. private $ignoreUpperBoundRegex;
  16918. public function __construct(array $reqList)
  16919. {
  16920. $ignoreAll = $ignoreUpperBound = array();
  16921. foreach ($reqList as $req) {
  16922. if (substr($req, -1) === '+') {
  16923. $ignoreUpperBound[] = substr($req, 0, -1);
  16924. } else {
  16925. $ignoreAll[] = $req;
  16926. }
  16927. }
  16928. $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll);
  16929. $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound);
  16930. }
  16931. public function isIgnored(string $req): bool
  16932. {
  16933. if (!PlatformRepository::isPlatformPackage($req)) {
  16934. return false;
  16935. }
  16936. return Preg::isMatch($this->ignoreRegex, $req);
  16937. }
  16938. public function filterConstraint(string $req, ConstraintInterface $constraint): ConstraintInterface
  16939. {
  16940. if (!PlatformRepository::isPlatformPackage($req)) {
  16941. return $constraint;
  16942. }
  16943. if (!Preg::isMatch($this->ignoreUpperBoundRegex, $req)) {
  16944. return $constraint;
  16945. }
  16946. if (Preg::isMatch($this->ignoreRegex, $req)) {
  16947. return new MatchAllConstraint;
  16948. }
  16949. $intervals = Intervals::get($constraint);
  16950. $last = end($intervals['numeric']);
  16951. if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) {
  16952. $constraint = new MultiConstraint(array($constraint, new Constraint('>=', $last->getEnd()->getVersion())), false);
  16953. }
  16954. return $constraint;
  16955. }
  16956. }
  16957. <?php declare(strict_types=1);
  16958. namespace Composer\Filter\PlatformRequirementFilter;
  16959. final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface
  16960. {
  16961. public function isIgnored(string $req): bool
  16962. {
  16963. return false;
  16964. }
  16965. }
  16966. <?php declare(strict_types=1);
  16967. namespace Composer\Filter\PlatformRequirementFilter;
  16968. final class PlatformRequirementFilterFactory
  16969. {
  16970. public static function fromBoolOrList($boolOrList): PlatformRequirementFilterInterface
  16971. {
  16972. if (is_bool($boolOrList)) {
  16973. return $boolOrList ? self::ignoreAll() : self::ignoreNothing();
  16974. }
  16975. if (is_array($boolOrList)) {
  16976. return new IgnoreListPlatformRequirementFilter($boolOrList);
  16977. }
  16978. throw new \InvalidArgumentException(
  16979. sprintf(
  16980. 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.',
  16981. gettype($boolOrList)
  16982. )
  16983. );
  16984. }
  16985. public static function ignoreAll(): PlatformRequirementFilterInterface
  16986. {
  16987. return new IgnoreAllPlatformRequirementFilter();
  16988. }
  16989. public static function ignoreNothing(): PlatformRequirementFilterInterface
  16990. {
  16991. return new IgnoreNothingPlatformRequirementFilter();
  16992. }
  16993. }
  16994. <?php declare(strict_types=1);
  16995. namespace Composer\Filter\PlatformRequirementFilter;
  16996. interface PlatformRequirementFilterInterface
  16997. {
  16998. public function isIgnored(string $req): bool;
  16999. }
  17000. <?php declare(strict_types=1);
  17001. namespace Composer\IO;
  17002. use Composer\Config;
  17003. use Composer\Pcre\Preg;
  17004. use Composer\Util\ProcessExecutor;
  17005. use Psr\Log\LogLevel;
  17006. abstract class BaseIO implements IOInterface
  17007. {
  17008. protected $authentications = array();
  17009. public function getAuthentications()
  17010. {
  17011. return $this->authentications;
  17012. }
  17013. public function resetAuthentications()
  17014. {
  17015. $this->authentications = array();
  17016. }
  17017. public function hasAuthentication($repositoryName)
  17018. {
  17019. return isset($this->authentications[$repositoryName]);
  17020. }
  17021. public function getAuthentication($repositoryName)
  17022. {
  17023. if (isset($this->authentications[$repositoryName])) {
  17024. return $this->authentications[$repositoryName];
  17025. }
  17026. return array('username' => null, 'password' => null);
  17027. }
  17028. public function setAuthentication($repositoryName, $username, $password = null)
  17029. {
  17030. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  17031. }
  17032. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  17033. {
  17034. $this->write($messages, $newline, $verbosity);
  17035. }
  17036. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  17037. {
  17038. $this->writeError($messages, $newline, $verbosity);
  17039. }
  17040. protected function checkAndSetAuthentication(string $repositoryName, string $username, string $password = null)
  17041. {
  17042. if ($this->hasAuthentication($repositoryName)) {
  17043. $auth = $this->getAuthentication($repositoryName);
  17044. if ($auth['username'] === $username && $auth['password'] === $password) {
  17045. return;
  17046. }
  17047. $this->writeError(
  17048. sprintf(
  17049. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  17050. $repositoryName
  17051. )
  17052. );
  17053. }
  17054. $this->setAuthentication($repositoryName, $username, $password);
  17055. }
  17056. public function loadConfiguration(Config $config)
  17057. {
  17058. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  17059. $githubOauth = $config->get('github-oauth') ?: array();
  17060. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  17061. $gitlabToken = $config->get('gitlab-token') ?: array();
  17062. $httpBasic = $config->get('http-basic') ?: array();
  17063. $bearerToken = $config->get('bearer') ?: array();
  17064. foreach ($bitbucketOauth as $domain => $cred) {
  17065. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  17066. }
  17067. foreach ($githubOauth as $domain => $token) {
  17068. if (!Preg::isMatch('{^[.A-Za-z0-9_]+$}', $token)) {
  17069. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  17070. }
  17071. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  17072. }
  17073. foreach ($gitlabOauth as $domain => $token) {
  17074. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  17075. }
  17076. foreach ($gitlabToken as $domain => $token) {
  17077. $username = is_array($token) && array_key_exists("username", $token) ? $token["username"] : $token;
  17078. $password = is_array($token) && array_key_exists("token", $token) ? $token["token"] : 'private-token';
  17079. $this->checkAndSetAuthentication($domain, $username, $password);
  17080. }
  17081. foreach ($httpBasic as $domain => $cred) {
  17082. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  17083. }
  17084. foreach ($bearerToken as $domain => $token) {
  17085. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  17086. }
  17087. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  17088. }
  17089. public function emergency($message, array $context = array()): void
  17090. {
  17091. $this->log(LogLevel::EMERGENCY, $message, $context);
  17092. }
  17093. public function alert($message, array $context = array()): void
  17094. {
  17095. $this->log(LogLevel::ALERT, $message, $context);
  17096. }
  17097. public function critical($message, array $context = array()): void
  17098. {
  17099. $this->log(LogLevel::CRITICAL, $message, $context);
  17100. }
  17101. public function error($message, array $context = array()): void
  17102. {
  17103. $this->log(LogLevel::ERROR, $message, $context);
  17104. }
  17105. public function warning($message, array $context = array()): void
  17106. {
  17107. $this->log(LogLevel::WARNING, $message, $context);
  17108. }
  17109. public function notice($message, array $context = array()): void
  17110. {
  17111. $this->log(LogLevel::NOTICE, $message, $context);
  17112. }
  17113. public function info($message, array $context = array()): void
  17114. {
  17115. $this->log(LogLevel::INFO, $message, $context);
  17116. }
  17117. public function debug($message, array $context = array()): void
  17118. {
  17119. $this->log(LogLevel::DEBUG, $message, $context);
  17120. }
  17121. public function log($level, $message, array $context = array()): void
  17122. {
  17123. $message = (string) $message;
  17124. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  17125. $this->writeError('<error>'.$message.'</error>');
  17126. } elseif ($level === LogLevel::WARNING) {
  17127. $this->writeError('<warning>'.$message.'</warning>');
  17128. } elseif ($level === LogLevel::NOTICE) {
  17129. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  17130. } elseif ($level === LogLevel::INFO) {
  17131. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  17132. } else {
  17133. $this->writeError($message, true, self::DEBUG);
  17134. }
  17135. }
  17136. }
  17137. <?php declare(strict_types=1);
  17138. namespace Composer\IO;
  17139. use Composer\Pcre\Preg;
  17140. use Symfony\Component\Console\Helper\QuestionHelper;
  17141. use Symfony\Component\Console\Output\StreamOutput;
  17142. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  17143. use Symfony\Component\Console\Input\StreamableInputInterface;
  17144. use Symfony\Component\Console\Input\StringInput;
  17145. use Symfony\Component\Console\Helper\HelperSet;
  17146. class BufferIO extends ConsoleIO
  17147. {
  17148. protected $input;
  17149. protected $output;
  17150. public function __construct(string $input = '', int $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  17151. {
  17152. $input = new StringInput($input);
  17153. $input->setInteractive(false);
  17154. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  17155. parent::__construct($input, $output, new HelperSet(array(
  17156. new QuestionHelper(),
  17157. )));
  17158. }
  17159. public function getOutput(): string
  17160. {
  17161. fseek($this->output->getStream(), 0);
  17162. $output = stream_get_contents($this->output->getStream());
  17163. $output = Preg::replaceCallback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches): string {
  17164. $pre = strip_tags($matches[1]);
  17165. if (strlen($pre) === strlen($matches[2])) {
  17166. return '';
  17167. }
  17168. return rtrim($matches[1])."\n";
  17169. }, $output);
  17170. return $output;
  17171. }
  17172. public function setUserInputs(array $inputs): void
  17173. {
  17174. if (!$this->input instanceof StreamableInputInterface) {
  17175. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  17176. }
  17177. $this->input->setStream($this->createStream($inputs));
  17178. $this->input->setInteractive(true);
  17179. }
  17180. private function createStream(array $inputs)
  17181. {
  17182. $stream = fopen('php://memory', 'r+');
  17183. foreach ($inputs as $input) {
  17184. fwrite($stream, $input.PHP_EOL);
  17185. }
  17186. rewind($stream);
  17187. return $stream;
  17188. }
  17189. }
  17190. <?php declare(strict_types=1);
  17191. namespace Composer\IO;
  17192. use Composer\Question\StrictConfirmationQuestion;
  17193. use Symfony\Component\Console\Helper\HelperSet;
  17194. use Symfony\Component\Console\Helper\ProgressBar;
  17195. use Symfony\Component\Console\Input\InputInterface;
  17196. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  17197. use Symfony\Component\Console\Output\OutputInterface;
  17198. use Symfony\Component\Console\Question\ChoiceQuestion;
  17199. use Symfony\Component\Console\Question\Question;
  17200. class ConsoleIO extends BaseIO
  17201. {
  17202. protected $input;
  17203. protected $output;
  17204. protected $helperSet;
  17205. protected $lastMessage = '';
  17206. protected $lastMessageErr = '';
  17207. private $startTime;
  17208. private $verbosityMap;
  17209. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  17210. {
  17211. $this->input = $input;
  17212. $this->output = $output;
  17213. $this->helperSet = $helperSet;
  17214. $this->verbosityMap = array(
  17215. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  17216. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  17217. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  17218. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  17219. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  17220. );
  17221. }
  17222. public function enableDebugging(float $startTime)
  17223. {
  17224. $this->startTime = $startTime;
  17225. }
  17226. public function isInteractive()
  17227. {
  17228. return $this->input->isInteractive();
  17229. }
  17230. public function isDecorated()
  17231. {
  17232. return $this->output->isDecorated();
  17233. }
  17234. public function isVerbose()
  17235. {
  17236. return $this->output->isVerbose();
  17237. }
  17238. public function isVeryVerbose()
  17239. {
  17240. return $this->output->isVeryVerbose();
  17241. }
  17242. public function isDebug()
  17243. {
  17244. return $this->output->isDebug();
  17245. }
  17246. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL)
  17247. {
  17248. $this->doWrite($messages, $newline, false, $verbosity);
  17249. }
  17250. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL)
  17251. {
  17252. $this->doWrite($messages, $newline, true, $verbosity);
  17253. }
  17254. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  17255. {
  17256. $this->doWrite($messages, $newline, false, $verbosity, true);
  17257. }
  17258. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  17259. {
  17260. $this->doWrite($messages, $newline, true, $verbosity, true);
  17261. }
  17262. private function doWrite($messages, bool $newline, bool $stderr, int $verbosity, bool $raw = false): void
  17263. {
  17264. $sfVerbosity = $this->verbosityMap[$verbosity];
  17265. if ($sfVerbosity > $this->output->getVerbosity()) {
  17266. return;
  17267. }
  17268. if ($raw) {
  17269. if ($sfVerbosity === OutputInterface::OUTPUT_NORMAL) {
  17270. $sfVerbosity = OutputInterface::OUTPUT_RAW;
  17271. } else {
  17272. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  17273. }
  17274. }
  17275. if (null !== $this->startTime) {
  17276. $memoryUsage = memory_get_usage() / 1024 / 1024;
  17277. $timeSpent = microtime(true) - $this->startTime;
  17278. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent): string {
  17279. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  17280. }, (array) $messages);
  17281. }
  17282. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  17283. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  17284. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  17285. return;
  17286. }
  17287. $this->output->write($messages, $newline, $sfVerbosity);
  17288. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  17289. }
  17290. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
  17291. {
  17292. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  17293. }
  17294. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
  17295. {
  17296. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  17297. }
  17298. private function doOverwrite($messages, bool $newline, ?int $size, bool $stderr, int $verbosity): void
  17299. {
  17300. $messages = implode($newline ? "\n" : '', (array) $messages);
  17301. if (!isset($size)) {
  17302. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  17303. }
  17304. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  17305. $this->doWrite($messages, false, $stderr, $verbosity);
  17306. $fill = $size - strlen(strip_tags($messages));
  17307. if ($fill > 0) {
  17308. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  17309. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  17310. }
  17311. if ($newline) {
  17312. $this->doWrite('', true, $stderr, $verbosity);
  17313. }
  17314. if ($stderr) {
  17315. $this->lastMessageErr = $messages;
  17316. } else {
  17317. $this->lastMessage = $messages;
  17318. }
  17319. }
  17320. public function getProgressBar(int $max = 0)
  17321. {
  17322. return new ProgressBar($this->getErrorOutput(), $max);
  17323. }
  17324. public function ask($question, $default = null)
  17325. {
  17326. $helper = $this->helperSet->get('question');
  17327. $question = new Question($question, $default);
  17328. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  17329. }
  17330. public function askConfirmation($question, $default = true)
  17331. {
  17332. $helper = $this->helperSet->get('question');
  17333. $question = new StrictConfirmationQuestion($question, $default);
  17334. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  17335. }
  17336. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  17337. {
  17338. $helper = $this->helperSet->get('question');
  17339. $question = new Question($question, $default);
  17340. $question->setValidator($validator);
  17341. $question->setMaxAttempts($attempts);
  17342. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  17343. }
  17344. public function askAndHideAnswer($question)
  17345. {
  17346. $helper = $this->helperSet->get('question');
  17347. $question = new Question($question);
  17348. $question->setHidden(true);
  17349. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  17350. }
  17351. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  17352. {
  17353. $helper = $this->helperSet->get('question');
  17354. $question = new ChoiceQuestion($question, $choices, $default);
  17355. $question->setMaxAttempts($attempts ?: null);
  17356. $question->setErrorMessage($errorMessage);
  17357. $question->setMultiselect($multiselect);
  17358. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  17359. if (!is_array($result)) {
  17360. return (string) array_search($result, $choices, true);
  17361. }
  17362. $results = array();
  17363. foreach ($choices as $index => $choice) {
  17364. if (in_array($choice, $result, true)) {
  17365. $results[] = (string) $index;
  17366. }
  17367. }
  17368. return $results;
  17369. }
  17370. private function getErrorOutput(): OutputInterface
  17371. {
  17372. if ($this->output instanceof ConsoleOutputInterface) {
  17373. return $this->output->getErrorOutput();
  17374. }
  17375. return $this->output;
  17376. }
  17377. }
  17378. <?php declare(strict_types=1);
  17379. namespace Composer\IO;
  17380. use Composer\Config;
  17381. use Psr\Log\LoggerInterface;
  17382. interface IOInterface extends LoggerInterface
  17383. {
  17384. public const QUIET = 1;
  17385. public const NORMAL = 2;
  17386. public const VERBOSE = 4;
  17387. public const VERY_VERBOSE = 8;
  17388. public const DEBUG = 16;
  17389. public function isInteractive();
  17390. public function isVerbose();
  17391. public function isVeryVerbose();
  17392. public function isDebug();
  17393. public function isDecorated();
  17394. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL);
  17395. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL);
  17396. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
  17397. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
  17398. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
  17399. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
  17400. public function ask(string $question, $default = null);
  17401. public function askConfirmation(string $question, bool $default = true);
  17402. public function askAndValidate(string $question, callable $validator, ?int $attempts = null, $default = null);
  17403. public function askAndHideAnswer(string $question);
  17404. public function select(string $question, array $choices, $default, $attempts = false, string $errorMessage = 'Value "%s" is invalid', bool $multiselect = false);
  17405. public function getAuthentications();
  17406. public function hasAuthentication(string $repositoryName);
  17407. public function getAuthentication(string $repositoryName);
  17408. public function setAuthentication(string $repositoryName, string $username, ?string $password = null);
  17409. public function loadConfiguration(Config $config);
  17410. }
  17411. <?php declare(strict_types=1);
  17412. namespace Composer\IO;
  17413. class NullIO extends BaseIO
  17414. {
  17415. public function isInteractive(): bool
  17416. {
  17417. return false;
  17418. }
  17419. public function isVerbose(): bool
  17420. {
  17421. return false;
  17422. }
  17423. public function isVeryVerbose(): bool
  17424. {
  17425. return false;
  17426. }
  17427. public function isDebug(): bool
  17428. {
  17429. return false;
  17430. }
  17431. public function isDecorated(): bool
  17432. {
  17433. return false;
  17434. }
  17435. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL): void
  17436. {
  17437. }
  17438. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL): void
  17439. {
  17440. }
  17441. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
  17442. {
  17443. }
  17444. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
  17445. {
  17446. }
  17447. public function ask($question, $default = null)
  17448. {
  17449. return $default;
  17450. }
  17451. public function askConfirmation($question, $default = true): bool
  17452. {
  17453. return $default;
  17454. }
  17455. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  17456. {
  17457. return $default;
  17458. }
  17459. public function askAndHideAnswer($question): ?string
  17460. {
  17461. return null;
  17462. }
  17463. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  17464. {
  17465. return $default;
  17466. }
  17467. }
  17468. <?php declare(strict_types=1);
  17469. namespace Composer;
  17470. use Composer\Autoload\AutoloadGenerator;
  17471. use Composer\Console\GithubActionError;
  17472. use Composer\DependencyResolver\DefaultPolicy;
  17473. use Composer\DependencyResolver\LocalRepoTransaction;
  17474. use Composer\DependencyResolver\LockTransaction;
  17475. use Composer\DependencyResolver\Operation\UpdateOperation;
  17476. use Composer\DependencyResolver\Operation\InstallOperation;
  17477. use Composer\DependencyResolver\Operation\UninstallOperation;
  17478. use Composer\DependencyResolver\PoolOptimizer;
  17479. use Composer\DependencyResolver\Pool;
  17480. use Composer\DependencyResolver\Request;
  17481. use Composer\DependencyResolver\Solver;
  17482. use Composer\DependencyResolver\SolverProblemsException;
  17483. use Composer\DependencyResolver\PolicyInterface;
  17484. use Composer\Downloader\DownloadManager;
  17485. use Composer\EventDispatcher\EventDispatcher;
  17486. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  17487. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  17488. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  17489. use Composer\Installer\InstallationManager;
  17490. use Composer\Installer\InstallerEvents;
  17491. use Composer\Installer\SuggestedPackagesReporter;
  17492. use Composer\IO\IOInterface;
  17493. use Composer\Package\AliasPackage;
  17494. use Composer\Package\RootAliasPackage;
  17495. use Composer\Package\BasePackage;
  17496. use Composer\Package\CompletePackage;
  17497. use Composer\Package\CompletePackageInterface;
  17498. use Composer\Package\Link;
  17499. use Composer\Package\Loader\ArrayLoader;
  17500. use Composer\Package\Dumper\ArrayDumper;
  17501. use Composer\Package\Version\VersionParser;
  17502. use Composer\Package\Package;
  17503. use Composer\Repository\ArrayRepository;
  17504. use Composer\Repository\RepositorySet;
  17505. use Composer\Repository\CompositeRepository;
  17506. use Composer\Semver\Constraint\Constraint;
  17507. use Composer\Package\Locker;
  17508. use Composer\Package\RootPackageInterface;
  17509. use Composer\Repository\InstalledArrayRepository;
  17510. use Composer\Repository\InstalledRepositoryInterface;
  17511. use Composer\Repository\InstalledRepository;
  17512. use Composer\Repository\RootPackageRepository;
  17513. use Composer\Repository\PlatformRepository;
  17514. use Composer\Repository\RepositoryInterface;
  17515. use Composer\Repository\RepositoryManager;
  17516. use Composer\Repository\LockArrayRepository;
  17517. use Composer\Script\ScriptEvents;
  17518. use Composer\Util\Platform;
  17519. class Installer
  17520. {
  17521. public const ERROR_NONE = 0;
  17522. public const ERROR_GENERIC_FAILURE = 1;
  17523. public const ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE = 3;
  17524. public const ERROR_LOCK_FILE_INVALID = 4;
  17525. public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
  17526. protected $io;
  17527. protected $config;
  17528. protected $package;
  17529. protected $fixedRootPackage;
  17530. protected $downloadManager;
  17531. protected $repositoryManager;
  17532. protected $locker;
  17533. protected $installationManager;
  17534. protected $eventDispatcher;
  17535. protected $autoloadGenerator;
  17536. protected $preferSource = false;
  17537. protected $preferDist = false;
  17538. protected $optimizeAutoloader = false;
  17539. protected $classMapAuthoritative = false;
  17540. protected $apcuAutoloader = false;
  17541. protected $apcuAutoloaderPrefix = null;
  17542. protected $devMode = false;
  17543. protected $dryRun = false;
  17544. protected $verbose = false;
  17545. protected $update = false;
  17546. protected $install = true;
  17547. protected $dumpAutoloader = true;
  17548. protected $runScripts = true;
  17549. protected $preferStable = false;
  17550. protected $preferLowest = false;
  17551. protected $writeLock;
  17552. protected $executeOperations = true;
  17553. protected $updateMirrors = false;
  17554. protected $updateAllowList = null;
  17555. protected $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  17556. protected $suggestedPackagesReporter;
  17557. protected $platformRequirementFilter;
  17558. protected $additionalFixedRepository;
  17559. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  17560. {
  17561. $this->io = $io;
  17562. $this->config = $config;
  17563. $this->package = $package;
  17564. $this->downloadManager = $downloadManager;
  17565. $this->repositoryManager = $repositoryManager;
  17566. $this->locker = $locker;
  17567. $this->installationManager = $installationManager;
  17568. $this->eventDispatcher = $eventDispatcher;
  17569. $this->autoloadGenerator = $autoloadGenerator;
  17570. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  17571. $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  17572. $this->writeLock = $config->get('lock');
  17573. }
  17574. public function run(): int
  17575. {
  17576. gc_collect_cycles();
  17577. gc_disable();
  17578. if ($this->updateAllowList && $this->updateMirrors) {
  17579. throw new \RuntimeException("The installer options updateMirrors and updateAllowList are mutually exclusive.");
  17580. }
  17581. $isFreshInstall = $this->repositoryManager->getLocalRepository()->isFresh();
  17582. if (!$this->update && !$this->locker->isLocked()) {
  17583. $this->io->writeError('<warning>No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.</warning>');
  17584. $this->update = true;
  17585. }
  17586. if ($this->dryRun) {
  17587. $this->verbose = true;
  17588. $this->runScripts = false;
  17589. $this->executeOperations = false;
  17590. $this->writeLock = false;
  17591. $this->dumpAutoloader = false;
  17592. $this->mockLocalRepositories($this->repositoryManager);
  17593. }
  17594. if ($this->update && !$this->install) {
  17595. $this->dumpAutoloader = false;
  17596. }
  17597. if ($this->runScripts) {
  17598. Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
  17599. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  17600. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  17601. }
  17602. $this->downloadManager->setPreferSource($this->preferSource);
  17603. $this->downloadManager->setPreferDist($this->preferDist);
  17604. $localRepo = $this->repositoryManager->getLocalRepository();
  17605. try {
  17606. if ($this->update) {
  17607. $res = $this->doUpdate($localRepo, $this->install);
  17608. } else {
  17609. $res = $this->doInstall($localRepo);
  17610. }
  17611. if ($res !== 0) {
  17612. return $res;
  17613. }
  17614. } catch (\Exception $e) {
  17615. if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
  17616. $this->installationManager->notifyInstalls($this->io);
  17617. }
  17618. throw $e;
  17619. }
  17620. if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
  17621. $this->installationManager->notifyInstalls($this->io);
  17622. }
  17623. if ($this->update) {
  17624. $installedRepo = new InstalledRepository(array(
  17625. $this->locker->getLockedRepository($this->devMode),
  17626. $this->createPlatformRepo(false),
  17627. new RootPackageRepository(clone $this->package),
  17628. ));
  17629. if ($isFreshInstall) {
  17630. $this->suggestedPackagesReporter->addSuggestionsFromPackage($this->package);
  17631. }
  17632. $this->suggestedPackagesReporter->outputMinimalistic($installedRepo);
  17633. }
  17634. $lockedRepository = $this->locker->getLockedRepository(true);
  17635. foreach ($lockedRepository->getPackages() as $package) {
  17636. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  17637. continue;
  17638. }
  17639. $replacement = is_string($package->getReplacementPackage())
  17640. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  17641. : 'No replacement was suggested';
  17642. $this->io->writeError(
  17643. sprintf(
  17644. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  17645. $package->getPrettyName(),
  17646. $replacement
  17647. )
  17648. );
  17649. }
  17650. if ($this->dumpAutoloader) {
  17651. if ($this->optimizeAutoloader) {
  17652. $this->io->writeError('<info>Generating optimized autoload files</info>');
  17653. } else {
  17654. $this->io->writeError('<info>Generating autoload files</info>');
  17655. }
  17656. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  17657. $this->autoloadGenerator->setApcu($this->apcuAutoloader, $this->apcuAutoloaderPrefix);
  17658. $this->autoloadGenerator->setRunScripts($this->runScripts);
  17659. $this->autoloadGenerator->setPlatformRequirementFilter($this->platformRequirementFilter);
  17660. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  17661. }
  17662. if ($this->install && $this->executeOperations) {
  17663. foreach ($localRepo->getPackages() as $package) {
  17664. $this->installationManager->ensureBinariesPresence($package);
  17665. }
  17666. }
  17667. $fundingCount = 0;
  17668. foreach ($localRepo->getPackages() as $package) {
  17669. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  17670. $fundingCount++;
  17671. }
  17672. }
  17673. if ($fundingCount > 0) {
  17674. $this->io->writeError(array(
  17675. sprintf(
  17676. "<info>%d package%s you are using %s looking for funding.</info>",
  17677. $fundingCount,
  17678. 1 === $fundingCount ? '' : 's',
  17679. 1 === $fundingCount ? 'is' : 'are'
  17680. ),
  17681. '<info>Use the `composer fund` command to find out more!</info>',
  17682. ));
  17683. }
  17684. if ($this->runScripts) {
  17685. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  17686. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  17687. }
  17688. if (!defined('HHVM_VERSION')) {
  17689. gc_enable();
  17690. }
  17691. return 0;
  17692. }
  17693. protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doInstall): int
  17694. {
  17695. $platformRepo = $this->createPlatformRepo(true);
  17696. $aliases = $this->getRootAliases(true);
  17697. $lockedRepository = null;
  17698. try {
  17699. if ($this->locker->isLocked()) {
  17700. $lockedRepository = $this->locker->getLockedRepository(true);
  17701. }
  17702. } catch (\Seld\JsonLint\ParsingException $e) {
  17703. if ($this->updateAllowList || $this->updateMirrors) {
  17704. throw $e;
  17705. }
  17706. }
  17707. if (($this->updateAllowList || $this->updateMirrors) && !$lockedRepository) {
  17708. $this->io->writeError('<error>Cannot update ' . ($this->updateMirrors ? 'lock file information' : 'only a partial set of packages') . ' without a lock file present. Run `composer update` to generate a lock file.</error>', true, IOInterface::QUIET);
  17709. return self::ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE;
  17710. }
  17711. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  17712. $policy = $this->createPolicy(true);
  17713. $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
  17714. $repositories = $this->repositoryManager->getRepositories();
  17715. foreach ($repositories as $repository) {
  17716. $repositorySet->addRepository($repository);
  17717. }
  17718. if ($lockedRepository) {
  17719. $repositorySet->addRepository($lockedRepository);
  17720. }
  17721. $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
  17722. $this->requirePackagesForUpdate($request, $lockedRepository, true);
  17723. if ($this->updateAllowList) {
  17724. $request->setUpdateAllowList($this->updateAllowList, $this->updateAllowTransitiveDependencies);
  17725. }
  17726. $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher, $this->createPoolOptimizer($policy));
  17727. $this->io->writeError('<info>Updating dependencies</info>');
  17728. $solver = new Solver($policy, $pool, $this->io);
  17729. try {
  17730. $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  17731. $ruleSetSize = $solver->getRuleSetSize();
  17732. $solver = null;
  17733. } catch (SolverProblemsException $e) {
  17734. $err = 'Your requirements could not be resolved to an installable set of packages.';
  17735. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
  17736. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  17737. $this->io->writeError($prettyProblem);
  17738. if (!$this->devMode) {
  17739. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  17740. }
  17741. $ghe = new GithubActionError($this->io);
  17742. $ghe->emit($err."\n".$prettyProblem);
  17743. return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
  17744. }
  17745. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  17746. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  17747. $pool = null;
  17748. if (!$lockTransaction->getOperations()) {
  17749. $this->io->writeError('Nothing to modify in lock file');
  17750. }
  17751. $exitCode = $this->extractDevPackages($lockTransaction, $platformRepo, $aliases, $policy, $lockedRepository);
  17752. if ($exitCode !== 0) {
  17753. return $exitCode;
  17754. }
  17755. if (method_exists('Composer\Semver\CompilingMatcher', 'clear')) {
  17756. \Composer\Semver\CompilingMatcher::clear();
  17757. }
  17758. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  17759. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  17760. $installsUpdates = $uninstalls = array();
  17761. if ($lockTransaction->getOperations()) {
  17762. $installNames = $updateNames = $uninstallNames = array();
  17763. foreach ($lockTransaction->getOperations() as $operation) {
  17764. if ($operation instanceof InstallOperation) {
  17765. $installsUpdates[] = $operation;
  17766. $installNames[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  17767. } elseif ($operation instanceof UpdateOperation) {
  17768. if ($this->updateMirrors
  17769. && $operation->getInitialPackage()->getName() == $operation->getTargetPackage()->getName()
  17770. && $operation->getInitialPackage()->getVersion() == $operation->getTargetPackage()->getVersion()
  17771. ) {
  17772. continue;
  17773. }
  17774. $installsUpdates[] = $operation;
  17775. $updateNames[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  17776. } elseif ($operation instanceof UninstallOperation) {
  17777. $uninstalls[] = $operation;
  17778. $uninstallNames[] = $operation->getPackage()->getPrettyName();
  17779. }
  17780. }
  17781. $this->io->writeError(sprintf(
  17782. "<info>Lock file operations: %d install%s, %d update%s, %d removal%s</info>",
  17783. count($installNames),
  17784. 1 === count($installNames) ? '' : 's',
  17785. count($updateNames),
  17786. 1 === count($updateNames) ? '' : 's',
  17787. count($uninstalls),
  17788. 1 === count($uninstalls) ? '' : 's'
  17789. ));
  17790. if ($installNames) {
  17791. $this->io->writeError("Installs: ".implode(', ', $installNames), true, IOInterface::VERBOSE);
  17792. }
  17793. if ($updateNames) {
  17794. $this->io->writeError("Updates: ".implode(', ', $updateNames), true, IOInterface::VERBOSE);
  17795. }
  17796. if ($uninstalls) {
  17797. $this->io->writeError("Removals: ".implode(', ', $uninstallNames), true, IOInterface::VERBOSE);
  17798. }
  17799. }
  17800. $sortByName = function ($a, $b): int {
  17801. if ($a instanceof UpdateOperation) {
  17802. $a = $a->getTargetPackage()->getName();
  17803. } else {
  17804. $a = $a->getPackage()->getName();
  17805. }
  17806. if ($b instanceof UpdateOperation) {
  17807. $b = $b->getTargetPackage()->getName();
  17808. } else {
  17809. $b = $b->getPackage()->getName();
  17810. }
  17811. return strcmp($a, $b);
  17812. };
  17813. usort($uninstalls, $sortByName);
  17814. usort($installsUpdates, $sortByName);
  17815. foreach (array_merge($uninstalls, $installsUpdates) as $operation) {
  17816. if ($operation instanceof InstallOperation) {
  17817. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  17818. }
  17819. if (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug()) {
  17820. $this->io->writeError(' - ' . $operation->show(true));
  17821. }
  17822. }
  17823. $updatedLock = $this->locker->setLockData(
  17824. $lockTransaction->getNewLockPackages(false, $this->updateMirrors),
  17825. $lockTransaction->getNewLockPackages(true, $this->updateMirrors),
  17826. $platformReqs,
  17827. $platformDevReqs,
  17828. $lockTransaction->getAliases($aliases),
  17829. $this->package->getMinimumStability(),
  17830. $this->package->getStabilityFlags(),
  17831. $this->preferStable || $this->package->getPreferStable(),
  17832. $this->preferLowest,
  17833. $this->config->get('platform') ?: array(),
  17834. $this->writeLock && $this->executeOperations
  17835. );
  17836. if ($updatedLock && $this->writeLock && $this->executeOperations) {
  17837. $this->io->writeError('<info>Writing lock file</info>');
  17838. }
  17839. if ($this->executeOperations && count($lockTransaction->getOperations()) > 0) {
  17840. $vendorDir = $this->config->get('vendor-dir');
  17841. if (is_dir($vendorDir)) {
  17842. @touch($vendorDir);
  17843. }
  17844. }
  17845. if ($doInstall) {
  17846. return $this->doInstall($localRepo, true);
  17847. }
  17848. return 0;
  17849. }
  17850. protected function extractDevPackages(LockTransaction $lockTransaction, PlatformRepository $platformRepo, array $aliases, PolicyInterface $policy, LockArrayRepository $lockedRepository = null): int
  17851. {
  17852. if (!$this->package->getDevRequires()) {
  17853. return 0;
  17854. }
  17855. $resultRepo = new ArrayRepository(array());
  17856. $loader = new ArrayLoader(null, true);
  17857. $dumper = new ArrayDumper();
  17858. foreach ($lockTransaction->getNewLockPackages(false) as $pkg) {
  17859. $resultRepo->addPackage($loader->load($dumper->dump($pkg)));
  17860. }
  17861. $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
  17862. $repositorySet->addRepository($resultRepo);
  17863. $request = $this->createRequest($this->fixedRootPackage, $platformRepo);
  17864. $this->requirePackagesForUpdate($request, $lockedRepository, false);
  17865. $pool = $repositorySet->createPoolWithAllPackages();
  17866. $solver = new Solver($policy, $pool, $this->io);
  17867. try {
  17868. $nonDevLockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  17869. $solver = null;
  17870. } catch (SolverProblemsException $e) {
  17871. $err = 'Unable to find a compatible set of packages based on your non-dev requirements alone.';
  17872. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose(), true);
  17873. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  17874. $this->io->writeError('Your requirements can be resolved successfully when require-dev packages are present.');
  17875. $this->io->writeError('You may need to move packages from require-dev or some of their dependencies to require.');
  17876. $this->io->writeError($prettyProblem);
  17877. $ghe = new GithubActionError($this->io);
  17878. $ghe->emit($err."\n".$prettyProblem);
  17879. return $e->getCode();
  17880. }
  17881. $lockTransaction->setNonDevPackages($nonDevLockTransaction);
  17882. return 0;
  17883. }
  17884. protected function doInstall(InstalledRepositoryInterface $localRepo, bool $alreadySolved = false): int
  17885. {
  17886. $this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  17887. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  17888. if (!$alreadySolved) {
  17889. $this->io->writeError('<info>Verifying lock file contents can be installed on current platform.</info>');
  17890. $platformRepo = $this->createPlatformRepo(false);
  17891. $policy = $this->createPolicy(false);
  17892. $repositorySet = $this->createRepositorySet(false, $platformRepo, array(), $lockedRepository);
  17893. $repositorySet->addRepository($lockedRepository);
  17894. $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
  17895. if (!$this->locker->isFresh()) {
  17896. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.</warning>', true, IOInterface::QUIET);
  17897. }
  17898. foreach ($lockedRepository->getPackages() as $package) {
  17899. $request->fixLockedPackage($package);
  17900. }
  17901. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  17902. $request->requireName($link->getTarget(), $link->getConstraint());
  17903. }
  17904. $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher);
  17905. $solver = new Solver($policy, $pool, $this->io);
  17906. try {
  17907. $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  17908. $solver = null;
  17909. if (0 !== count($lockTransaction->getOperations())) {
  17910. $this->io->writeError('<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>', true, IOInterface::QUIET);
  17911. return self::ERROR_LOCK_FILE_INVALID;
  17912. }
  17913. } catch (SolverProblemsException $e) {
  17914. $err = 'Your lock file does not contain a compatible set of packages. Please run composer update.';
  17915. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
  17916. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  17917. $this->io->writeError($prettyProblem);
  17918. $ghe = new GithubActionError($this->io);
  17919. $ghe->emit($err."\n".$prettyProblem);
  17920. return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
  17921. }
  17922. }
  17923. $localRepoTransaction = new LocalRepoTransaction($lockedRepository, $localRepo);
  17924. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_OPERATIONS_EXEC, $this->devMode, $this->executeOperations, $localRepoTransaction);
  17925. if (!$localRepoTransaction->getOperations()) {
  17926. $this->io->writeError('Nothing to install, update or remove');
  17927. }
  17928. if ($localRepoTransaction->getOperations()) {
  17929. $installs = $updates = $uninstalls = array();
  17930. foreach ($localRepoTransaction->getOperations() as $operation) {
  17931. if ($operation instanceof InstallOperation) {
  17932. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  17933. } elseif ($operation instanceof UpdateOperation) {
  17934. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  17935. } elseif ($operation instanceof UninstallOperation) {
  17936. $uninstalls[] = $operation->getPackage()->getPrettyName();
  17937. }
  17938. }
  17939. $this->io->writeError(sprintf(
  17940. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  17941. count($installs),
  17942. 1 === count($installs) ? '' : 's',
  17943. count($updates),
  17944. 1 === count($updates) ? '' : 's',
  17945. count($uninstalls),
  17946. 1 === count($uninstalls) ? '' : 's'
  17947. ));
  17948. if ($installs) {
  17949. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  17950. }
  17951. if ($updates) {
  17952. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  17953. }
  17954. if ($uninstalls) {
  17955. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  17956. }
  17957. }
  17958. if ($this->executeOperations) {
  17959. $localRepo->setDevPackageNames($this->locker->getDevPackageNames());
  17960. $this->installationManager->execute($localRepo, $localRepoTransaction->getOperations(), $this->devMode, $this->runScripts);
  17961. } else {
  17962. foreach ($localRepoTransaction->getOperations() as $operation) {
  17963. if (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug()) {
  17964. $this->io->writeError(' - ' . $operation->show(false));
  17965. }
  17966. }
  17967. }
  17968. return 0;
  17969. }
  17970. protected function createPlatformRepo(bool $forUpdate): PlatformRepository
  17971. {
  17972. if ($forUpdate) {
  17973. $platformOverrides = $this->config->get('platform') ?: array();
  17974. } else {
  17975. $platformOverrides = $this->locker->getPlatformOverrides();
  17976. }
  17977. return new PlatformRepository(array(), $platformOverrides);
  17978. }
  17979. private function createRepositorySet(bool $forUpdate, PlatformRepository $platformRepo, array $rootAliases = array(), ?RepositoryInterface $lockedRepository = null): RepositorySet
  17980. {
  17981. if ($forUpdate) {
  17982. $minimumStability = $this->package->getMinimumStability();
  17983. $stabilityFlags = $this->package->getStabilityFlags();
  17984. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  17985. } else {
  17986. $minimumStability = $this->locker->getMinimumStability();
  17987. $stabilityFlags = $this->locker->getStabilityFlags();
  17988. $requires = array();
  17989. foreach ($lockedRepository->getPackages() as $package) {
  17990. $constraint = new Constraint('=', $package->getVersion());
  17991. $constraint->setPrettyString($package->getPrettyVersion());
  17992. $requires[$package->getName()] = $constraint;
  17993. }
  17994. }
  17995. $rootRequires = array();
  17996. foreach ($requires as $req => $constraint) {
  17997. if ($constraint instanceof Link) {
  17998. $constraint = $constraint->getConstraint();
  17999. }
  18000. if ($this->platformRequirementFilter->isIgnored($req)) {
  18001. continue;
  18002. } elseif ($this->platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  18003. $constraint = $this->platformRequirementFilter->filterConstraint($req, $constraint);
  18004. }
  18005. $rootRequires[$req] = $constraint;
  18006. }
  18007. $this->fixedRootPackage = clone $this->package;
  18008. $this->fixedRootPackage->setRequires(array());
  18009. $this->fixedRootPackage->setDevRequires(array());
  18010. $stabilityFlags[$this->package->getName()] = BasePackage::$stabilities[VersionParser::parseStability($this->package->getVersion())];
  18011. $repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $this->package->getReferences(), $rootRequires);
  18012. $repositorySet->addRepository(new RootPackageRepository($this->fixedRootPackage));
  18013. $repositorySet->addRepository($platformRepo);
  18014. if ($this->additionalFixedRepository) {
  18015. $additionalFixedRepositories = $this->additionalFixedRepository;
  18016. if ($additionalFixedRepositories instanceof CompositeRepository) {
  18017. $additionalFixedRepositories = $additionalFixedRepositories->getRepositories();
  18018. } else {
  18019. $additionalFixedRepositories = array($additionalFixedRepositories);
  18020. }
  18021. foreach ($additionalFixedRepositories as $additionalFixedRepository) {
  18022. if ($additionalFixedRepository instanceof InstalledRepository || $additionalFixedRepository instanceof InstalledRepositoryInterface) {
  18023. $repositorySet->allowInstalledRepositories();
  18024. break;
  18025. }
  18026. }
  18027. $repositorySet->addRepository($this->additionalFixedRepository);
  18028. }
  18029. return $repositorySet;
  18030. }
  18031. private function createPolicy(bool $forUpdate): DefaultPolicy
  18032. {
  18033. $preferStable = null;
  18034. $preferLowest = null;
  18035. if (!$forUpdate) {
  18036. $preferStable = $this->locker->getPreferStable();
  18037. $preferLowest = $this->locker->getPreferLowest();
  18038. }
  18039. if (null === $preferStable) {
  18040. $preferStable = $this->preferStable || $this->package->getPreferStable();
  18041. }
  18042. if (null === $preferLowest) {
  18043. $preferLowest = $this->preferLowest;
  18044. }
  18045. return new DefaultPolicy($preferStable, $preferLowest);
  18046. }
  18047. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, LockArrayRepository $lockedRepository = null): Request
  18048. {
  18049. $request = new Request($lockedRepository);
  18050. $request->fixPackage($rootPackage);
  18051. if ($rootPackage instanceof RootAliasPackage) {
  18052. $request->fixPackage($rootPackage->getAliasOf());
  18053. }
  18054. $fixedPackages = $platformRepo->getPackages();
  18055. if ($this->additionalFixedRepository) {
  18056. $fixedPackages = array_merge($fixedPackages, $this->additionalFixedRepository->getPackages());
  18057. }
  18058. $provided = $rootPackage->getProvides();
  18059. foreach ($fixedPackages as $package) {
  18060. if ($package->getRepository() !== $platformRepo
  18061. || !isset($provided[$package->getName()])
  18062. || !$provided[$package->getName()]->getConstraint()->matches(new Constraint('=', $package->getVersion()))
  18063. ) {
  18064. $request->fixPackage($package);
  18065. }
  18066. }
  18067. return $request;
  18068. }
  18069. private function requirePackagesForUpdate(Request $request, LockArrayRepository $lockedRepository = null, bool $includeDevRequires = true): void
  18070. {
  18071. if ($this->updateMirrors) {
  18072. $excludedPackages = array();
  18073. if (!$includeDevRequires) {
  18074. $excludedPackages = array_flip($this->locker->getDevPackageNames());
  18075. }
  18076. foreach ($lockedRepository->getPackages() as $lockedPackage) {
  18077. if (!$lockedPackage instanceof AliasPackage && !isset($excludedPackages[$lockedPackage->getName()])) {
  18078. $request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
  18079. }
  18080. }
  18081. } else {
  18082. $links = $this->package->getRequires();
  18083. if ($includeDevRequires) {
  18084. $links = array_merge($links, $this->package->getDevRequires());
  18085. }
  18086. foreach ($links as $link) {
  18087. $request->requireName($link->getTarget(), $link->getConstraint());
  18088. }
  18089. }
  18090. }
  18091. private function getRootAliases(bool $forUpdate): array
  18092. {
  18093. if ($forUpdate) {
  18094. $aliases = $this->package->getAliases();
  18095. } else {
  18096. $aliases = $this->locker->getAliases();
  18097. }
  18098. return $aliases;
  18099. }
  18100. private function extractPlatformRequirements(array $links): array
  18101. {
  18102. $platformReqs = array();
  18103. foreach ($links as $link) {
  18104. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  18105. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  18106. }
  18107. }
  18108. return $platformReqs;
  18109. }
  18110. private function mockLocalRepositories(RepositoryManager $rm): void
  18111. {
  18112. $packages = array();
  18113. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  18114. $packages[(string) $package] = clone $package;
  18115. }
  18116. foreach ($packages as $key => $package) {
  18117. if ($package instanceof AliasPackage) {
  18118. $alias = (string) $package->getAliasOf();
  18119. $className = get_class($package);
  18120. $packages[$key] = new $className($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  18121. }
  18122. }
  18123. $rm->setLocalRepository(
  18124. new InstalledArrayRepository($packages)
  18125. );
  18126. }
  18127. private function createPoolOptimizer(PolicyInterface $policy): ?PoolOptimizer
  18128. {
  18129. if ('0' === Platform::getEnv('COMPOSER_POOL_OPTIMIZER')) {
  18130. $this->io->write('Pool Optimizer was disabled for debugging purposes.', true, IOInterface::DEBUG);
  18131. return null;
  18132. }
  18133. return new PoolOptimizer($policy);
  18134. }
  18135. public static function create(IOInterface $io, Composer $composer): self
  18136. {
  18137. return new static(
  18138. $io,
  18139. $composer->getConfig(),
  18140. $composer->getPackage(),
  18141. $composer->getDownloadManager(),
  18142. $composer->getRepositoryManager(),
  18143. $composer->getLocker(),
  18144. $composer->getInstallationManager(),
  18145. $composer->getEventDispatcher(),
  18146. $composer->getAutoloadGenerator()
  18147. );
  18148. }
  18149. public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository): self
  18150. {
  18151. $this->additionalFixedRepository = $additionalFixedRepository;
  18152. return $this;
  18153. }
  18154. public function setDryRun(bool $dryRun = true): self
  18155. {
  18156. $this->dryRun = (bool) $dryRun;
  18157. return $this;
  18158. }
  18159. public function isDryRun(): bool
  18160. {
  18161. return $this->dryRun;
  18162. }
  18163. public function setPreferSource(bool $preferSource = true): self
  18164. {
  18165. $this->preferSource = (bool) $preferSource;
  18166. return $this;
  18167. }
  18168. public function setPreferDist(bool $preferDist = true): self
  18169. {
  18170. $this->preferDist = (bool) $preferDist;
  18171. return $this;
  18172. }
  18173. public function setOptimizeAutoloader(bool $optimizeAutoloader): self
  18174. {
  18175. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  18176. if (!$this->optimizeAutoloader) {
  18177. $this->setClassMapAuthoritative(false);
  18178. }
  18179. return $this;
  18180. }
  18181. public function setClassMapAuthoritative(bool $classMapAuthoritative): self
  18182. {
  18183. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  18184. if ($this->classMapAuthoritative) {
  18185. $this->setOptimizeAutoloader(true);
  18186. }
  18187. return $this;
  18188. }
  18189. public function setApcuAutoloader(bool $apcuAutoloader, ?string $apcuAutoloaderPrefix = null): self
  18190. {
  18191. $this->apcuAutoloader = $apcuAutoloader;
  18192. $this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
  18193. return $this;
  18194. }
  18195. public function setUpdate(bool $update): self
  18196. {
  18197. $this->update = (bool) $update;
  18198. return $this;
  18199. }
  18200. public function setInstall(bool $install): self
  18201. {
  18202. $this->install = (bool) $install;
  18203. return $this;
  18204. }
  18205. public function setDevMode(bool $devMode = true): self
  18206. {
  18207. $this->devMode = (bool) $devMode;
  18208. return $this;
  18209. }
  18210. public function setDumpAutoloader(bool $dumpAutoloader = true): self
  18211. {
  18212. $this->dumpAutoloader = (bool) $dumpAutoloader;
  18213. return $this;
  18214. }
  18215. public function setRunScripts(bool $runScripts = true): self
  18216. {
  18217. $this->runScripts = (bool) $runScripts;
  18218. return $this;
  18219. }
  18220. public function setConfig(Config $config): self
  18221. {
  18222. $this->config = $config;
  18223. return $this;
  18224. }
  18225. public function setVerbose(bool $verbose = true): self
  18226. {
  18227. $this->verbose = (bool) $verbose;
  18228. return $this;
  18229. }
  18230. public function isVerbose(): bool
  18231. {
  18232. return $this->verbose;
  18233. }
  18234. public function setIgnorePlatformRequirements($ignorePlatformReqs): self
  18235. {
  18236. trigger_error('Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
  18237. return $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
  18238. }
  18239. public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): self
  18240. {
  18241. $this->platformRequirementFilter = $platformRequirementFilter;
  18242. return $this;
  18243. }
  18244. public function setUpdateMirrors(bool $updateMirrors): self
  18245. {
  18246. $this->updateMirrors = $updateMirrors;
  18247. return $this;
  18248. }
  18249. public function setUpdateAllowList(array $packages): self
  18250. {
  18251. $this->updateAllowList = array_flip(array_map('strtolower', $packages));
  18252. return $this;
  18253. }
  18254. public function setUpdateAllowTransitiveDependencies(int $updateAllowTransitiveDependencies): self
  18255. {
  18256. if (!in_array($updateAllowTransitiveDependencies, array(Request::UPDATE_ONLY_LISTED, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS), true)) {
  18257. throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
  18258. }
  18259. $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
  18260. return $this;
  18261. }
  18262. public function setPreferStable(bool $preferStable = true): self
  18263. {
  18264. $this->preferStable = (bool) $preferStable;
  18265. return $this;
  18266. }
  18267. public function setPreferLowest(bool $preferLowest = true): self
  18268. {
  18269. $this->preferLowest = (bool) $preferLowest;
  18270. return $this;
  18271. }
  18272. public function setWriteLock(bool $writeLock = true): self
  18273. {
  18274. $this->writeLock = (bool) $writeLock;
  18275. return $this;
  18276. }
  18277. public function setExecuteOperations(bool $executeOperations = true): self
  18278. {
  18279. $this->executeOperations = (bool) $executeOperations;
  18280. return $this;
  18281. }
  18282. public function disablePlugins(): self
  18283. {
  18284. $this->installationManager->disablePlugins();
  18285. return $this;
  18286. }
  18287. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): self
  18288. {
  18289. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  18290. return $this;
  18291. }
  18292. }
  18293. <?php declare(strict_types=1);
  18294. namespace Composer\Installer;
  18295. use Composer\IO\IOInterface;
  18296. use Composer\Package\PackageInterface;
  18297. use Composer\Pcre\Preg;
  18298. use Composer\Util\Filesystem;
  18299. use Composer\Util\Platform;
  18300. use Composer\Util\ProcessExecutor;
  18301. use Composer\Util\Silencer;
  18302. class BinaryInstaller
  18303. {
  18304. protected $binDir;
  18305. protected $binCompat;
  18306. protected $io;
  18307. protected $filesystem;
  18308. private $vendorDir;
  18309. public function __construct(IOInterface $io, string $binDir, string $binCompat, Filesystem $filesystem = null, ?string $vendorDir = null)
  18310. {
  18311. $this->binDir = $binDir;
  18312. $this->binCompat = $binCompat;
  18313. $this->io = $io;
  18314. $this->filesystem = $filesystem ?: new Filesystem();
  18315. $this->vendorDir = $vendorDir;
  18316. }
  18317. public function installBinaries(PackageInterface $package, string $installPath, bool $warnOnOverwrite = true): void
  18318. {
  18319. $binaries = $this->getBinaries($package);
  18320. if (!$binaries) {
  18321. return;
  18322. }
  18323. Platform::workaroundFilesystemIssues();
  18324. foreach ($binaries as $bin) {
  18325. $binPath = $installPath.'/'.$bin;
  18326. if (!file_exists($binPath)) {
  18327. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  18328. continue;
  18329. }
  18330. if (is_dir($binPath)) {
  18331. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': found a directory at that path</warning>');
  18332. continue;
  18333. }
  18334. if (!$this->filesystem->isAbsolutePath($binPath)) {
  18335. $binPath = realpath($binPath);
  18336. }
  18337. $this->initializeBinDir();
  18338. $link = $this->binDir.'/'.basename($bin);
  18339. if (file_exists($link)) {
  18340. if (!is_link($link)) {
  18341. if ($warnOnOverwrite) {
  18342. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  18343. }
  18344. continue;
  18345. }
  18346. if (realpath($link) === realpath($binPath)) {
  18347. $this->filesystem->unlink($link);
  18348. }
  18349. }
  18350. $binCompat = $this->binCompat;
  18351. if ($binCompat === "auto" && (Platform::isWindows() || Platform::isWindowsSubsystemForLinux())) {
  18352. $binCompat = 'full';
  18353. }
  18354. if ($binCompat === "full") {
  18355. $this->installFullBinaries($binPath, $link, $bin, $package);
  18356. } else {
  18357. $this->installUnixyProxyBinaries($binPath, $link);
  18358. }
  18359. Silencer::call('chmod', $binPath, 0777 & ~umask());
  18360. }
  18361. }
  18362. public function removeBinaries(PackageInterface $package): void
  18363. {
  18364. $this->initializeBinDir();
  18365. $binaries = $this->getBinaries($package);
  18366. if (!$binaries) {
  18367. return;
  18368. }
  18369. foreach ($binaries as $bin) {
  18370. $link = $this->binDir.'/'.basename($bin);
  18371. if (is_link($link) || file_exists($link)) {
  18372. $this->filesystem->unlink($link);
  18373. }
  18374. if (is_file($link.'.bat')) {
  18375. $this->filesystem->unlink($link.'.bat');
  18376. }
  18377. }
  18378. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  18379. Silencer::call('rmdir', $this->binDir);
  18380. }
  18381. }
  18382. public static function determineBinaryCaller(string $bin): string
  18383. {
  18384. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  18385. return 'call';
  18386. }
  18387. $handle = fopen($bin, 'r');
  18388. $line = fgets($handle);
  18389. fclose($handle);
  18390. if (Preg::isMatch('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  18391. return trim($match[1]);
  18392. }
  18393. return 'php';
  18394. }
  18395. protected function getBinaries(PackageInterface $package): array
  18396. {
  18397. return $package->getBinaries();
  18398. }
  18399. protected function installFullBinaries(string $binPath, string $link, string $bin, PackageInterface $package): void
  18400. {
  18401. if ('.bat' !== substr($binPath, -4)) {
  18402. $this->installUnixyProxyBinaries($binPath, $link);
  18403. $link .= '.bat';
  18404. if (file_exists($link)) {
  18405. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  18406. }
  18407. }
  18408. if (!file_exists($link)) {
  18409. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  18410. Silencer::call('chmod', $link, 0777 & ~umask());
  18411. }
  18412. }
  18413. protected function installUnixyProxyBinaries(string $binPath, string $link): void
  18414. {
  18415. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  18416. Silencer::call('chmod', $link, 0777 & ~umask());
  18417. }
  18418. protected function initializeBinDir(): void
  18419. {
  18420. $this->filesystem->ensureDirectoryExists($this->binDir);
  18421. $this->binDir = realpath($this->binDir);
  18422. }
  18423. protected function generateWindowsProxyCode(string $bin, string $link): string
  18424. {
  18425. $binPath = $this->filesystem->findShortestPath($link, $bin);
  18426. $caller = self::determineBinaryCaller($bin);
  18427. if ($caller === 'php') {
  18428. return "@ECHO OFF\r\n".
  18429. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  18430. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape(basename($link, '.bat')), '"\'')."\r\n".
  18431. "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
  18432. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  18433. }
  18434. return "@ECHO OFF\r\n".
  18435. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  18436. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  18437. "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
  18438. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  18439. }
  18440. protected function generateUnixyProxyCode(string $bin, string $link): string
  18441. {
  18442. $binPath = $this->filesystem->findShortestPath($link, $bin);
  18443. $binDir = ProcessExecutor::escape(dirname($binPath));
  18444. $binFile = basename($binPath);
  18445. $binContents = file_get_contents($bin);
  18446. if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) {
  18447. $proxyCode = empty($match[1]) ? '#!/usr/bin/env php' : trim($match[1]);
  18448. $binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true);
  18449. $streamProxyCode = $streamHint = '';
  18450. $globalsCode = '$GLOBALS[\'_composer_bin_dir\'] = __DIR__;'."\n";
  18451. $phpunitHack1 = $phpunitHack2 = '';
  18452. if ($this->vendorDir) {
  18453. $globalsCode .= '$GLOBALS[\'_composer_autoload_path\'] = ' . $this->filesystem->findShortestPathCode($link, $this->vendorDir . '/autoload.php', false, true).";\n";
  18454. }
  18455. if ($this->filesystem->normalizePath($bin) === $this->filesystem->normalizePath($this->vendorDir.'/phpunit/phpunit/phpunit')) {
  18456. $globalsCode .= '$GLOBALS[\'__PHPUNIT_ISOLATION_EXCLUDE_LIST\'] = $GLOBALS[\'__PHPUNIT_ISOLATION_BLACKLIST\'] = array(realpath('.$binPathExported.'));'."\n";
  18457. $phpunitHack1 = "'phpvfscomposer://'.";
  18458. $phpunitHack2 = '
  18459. $data = str_replace(\'__DIR__\', var_export(dirname($this->realpath), true), $data);
  18460. $data = str_replace(\'__FILE__\', var_export($this->realpath, true), $data);';
  18461. }
  18462. if (trim($match[0]) !== '<?php') {
  18463. $streamHint = ' using a stream wrapper to prevent the shebang from being output on PHP<8'."\n *";
  18464. $streamProxyCode = <<<STREAMPROXY
  18465. if (PHP_VERSION_ID < 80000) {
  18466. if (!class_exists('Composer\BinProxyWrapper')) {
  18467. /**
  18468. * @internal
  18469. */
  18470. final class BinProxyWrapper
  18471. {
  18472. private \$handle;
  18473. private \$position;
  18474. private \$realpath;
  18475. public function stream_open(\$path, \$mode, \$options, &\$opened_path)
  18476. {
  18477. // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
  18478. \$opened_path = substr(\$path, 17);
  18479. \$this->realpath = realpath(\$opened_path) ?: \$opened_path;
  18480. \$opened_path = $phpunitHack1\$this->realpath;
  18481. \$this->handle = fopen(\$this->realpath, \$mode);
  18482. \$this->position = 0;
  18483. return (bool) \$this->handle;
  18484. }
  18485. public function stream_read(\$count)
  18486. {
  18487. \$data = fread(\$this->handle, \$count);
  18488. if (\$this->position === 0) {
  18489. \$data = preg_replace('{^#!.*\\r?\\n}', '', \$data);
  18490. }$phpunitHack2
  18491. \$this->position += strlen(\$data);
  18492. return \$data;
  18493. }
  18494. public function stream_cast(\$castAs)
  18495. {
  18496. return \$this->handle;
  18497. }
  18498. public function stream_close()
  18499. {
  18500. fclose(\$this->handle);
  18501. }
  18502. public function stream_lock(\$operation)
  18503. {
  18504. return \$operation ? flock(\$this->handle, \$operation) : true;
  18505. }
  18506. public function stream_seek(\$offset, \$whence)
  18507. {
  18508. if (0 === fseek(\$this->handle, \$offset, \$whence)) {
  18509. \$this->position = ftell(\$this->handle);
  18510. return true;
  18511. }
  18512. return false;
  18513. }
  18514. public function stream_tell()
  18515. {
  18516. return \$this->position;
  18517. }
  18518. public function stream_eof()
  18519. {
  18520. return feof(\$this->handle);
  18521. }
  18522. public function stream_stat()
  18523. {
  18524. return array();
  18525. }
  18526. public function stream_set_option(\$option, \$arg1, \$arg2)
  18527. {
  18528. return true;
  18529. }
  18530. public function url_stat(\$path, \$flags)
  18531. {
  18532. \$path = substr(\$path, 17);
  18533. if (file_exists(\$path)) {
  18534. return stat(\$path);
  18535. }
  18536. return false;
  18537. }
  18538. }
  18539. }
  18540. if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
  18541. include("phpvfscomposer://" . $binPathExported);
  18542. exit(0);
  18543. }
  18544. }
  18545. STREAMPROXY;
  18546. }
  18547. return $proxyCode . "\n" . <<<PROXY
  18548. <?php
  18549. /**
  18550. * Proxy PHP file generated by Composer
  18551. *
  18552. * This file includes the referenced bin path ($binPath)
  18553. *$streamHint
  18554. * @generated
  18555. */
  18556. namespace Composer;
  18557. $globalsCode
  18558. $streamProxyCode
  18559. include $binPathExported;
  18560. PROXY;
  18561. }
  18562. return <<<PROXY
  18563. #!/usr/bin/env sh
  18564. # Support bash to support `source` with fallback on $0 if this does not run with bash
  18565. # https://stackoverflow.com/a/35006505/6512
  18566. selfArg="\$BASH_SOURCE"
  18567. if [ -z "\$selfArg" ]; then
  18568. selfArg="\$0"
  18569. fi
  18570. self=\$(realpath \$selfArg 2> /dev/null)
  18571. if [ -z "\$self" ]; then
  18572. self="\$selfArg"
  18573. fi
  18574. dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  18575. if [ -d /proc/cygdrive ]; then
  18576. case \$(which php) in
  18577. \$(readlink -n /proc/cygdrive)/*)
  18578. # We are in Cygwin using Windows php, so the path must be translated
  18579. dir=\$(cygpath -m "\$dir");
  18580. ;;
  18581. esac
  18582. fi
  18583. export COMPOSER_RUNTIME_BIN_DIR=\$(cd "\${self%[/\\\\]*}" > /dev/null; pwd)
  18584. # If bash is sourcing this file, we have to source the target as well
  18585. bashSource="\$BASH_SOURCE"
  18586. if [ -n "\$bashSource" ]; then
  18587. if [ "\$bashSource" != "\$0" ]; then
  18588. source "\${dir}/$binFile" "\$@"
  18589. return
  18590. fi
  18591. fi
  18592. "\${dir}/$binFile" "\$@"
  18593. PROXY;
  18594. }
  18595. }
  18596. <?php declare(strict_types=1);
  18597. namespace Composer\Installer;
  18598. use Composer\Package\PackageInterface;
  18599. interface BinaryPresenceInterface
  18600. {
  18601. public function ensureBinariesPresence(PackageInterface $package);
  18602. }
  18603. <?php declare(strict_types=1);
  18604. namespace Composer\Installer;
  18605. use Composer\IO\IOInterface;
  18606. use Composer\IO\ConsoleIO;
  18607. use Composer\Package\PackageInterface;
  18608. use Composer\Package\AliasPackage;
  18609. use Composer\Repository\InstalledRepositoryInterface;
  18610. use Composer\DependencyResolver\Operation\OperationInterface;
  18611. use Composer\DependencyResolver\Operation\InstallOperation;
  18612. use Composer\DependencyResolver\Operation\UpdateOperation;
  18613. use Composer\DependencyResolver\Operation\UninstallOperation;
  18614. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  18615. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  18616. use Composer\Downloader\FileDownloader;
  18617. use Composer\EventDispatcher\EventDispatcher;
  18618. use Composer\Util\Loop;
  18619. use Composer\Util\Platform;
  18620. use React\Promise\PromiseInterface;
  18621. class InstallationManager
  18622. {
  18623. private $installers = array();
  18624. private $cache = array();
  18625. private $notifiablePackages = array();
  18626. private $loop;
  18627. private $io;
  18628. private $eventDispatcher;
  18629. private $outputProgress;
  18630. public function __construct(Loop $loop, IOInterface $io, EventDispatcher $eventDispatcher = null)
  18631. {
  18632. $this->loop = $loop;
  18633. $this->io = $io;
  18634. $this->eventDispatcher = $eventDispatcher;
  18635. }
  18636. public function reset(): void
  18637. {
  18638. $this->notifiablePackages = array();
  18639. FileDownloader::$downloadMetadata = array();
  18640. }
  18641. public function addInstaller(InstallerInterface $installer): void
  18642. {
  18643. array_unshift($this->installers, $installer);
  18644. $this->cache = array();
  18645. }
  18646. public function removeInstaller(InstallerInterface $installer): void
  18647. {
  18648. if (false !== ($key = array_search($installer, $this->installers, true))) {
  18649. array_splice($this->installers, $key, 1);
  18650. $this->cache = array();
  18651. }
  18652. }
  18653. public function disablePlugins(): void
  18654. {
  18655. foreach ($this->installers as $i => $installer) {
  18656. if (!$installer instanceof PluginInstaller) {
  18657. continue;
  18658. }
  18659. unset($this->installers[$i]);
  18660. }
  18661. }
  18662. public function getInstaller(string $type): InstallerInterface
  18663. {
  18664. $type = strtolower($type);
  18665. if (isset($this->cache[$type])) {
  18666. return $this->cache[$type];
  18667. }
  18668. foreach ($this->installers as $installer) {
  18669. if ($installer->supports($type)) {
  18670. return $this->cache[$type] = $installer;
  18671. }
  18672. }
  18673. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  18674. }
  18675. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
  18676. {
  18677. if ($package instanceof AliasPackage) {
  18678. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  18679. }
  18680. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  18681. }
  18682. public function ensureBinariesPresence(PackageInterface $package): void
  18683. {
  18684. try {
  18685. $installer = $this->getInstaller($package->getType());
  18686. } catch (\InvalidArgumentException $e) {
  18687. return;
  18688. }
  18689. if ($installer instanceof BinaryPresenceInterface) {
  18690. $installer->ensureBinariesPresence($package);
  18691. }
  18692. }
  18693. public function execute(InstalledRepositoryInterface $repo, array $operations, bool $devMode = true, bool $runScripts = true): void
  18694. {
  18695. $cleanupPromises = array();
  18696. $loop = $this->loop;
  18697. $io = $this->io;
  18698. $runCleanup = function () use (&$cleanupPromises, $loop): void {
  18699. $promises = array();
  18700. $loop->abortJobs();
  18701. foreach ($cleanupPromises as $cleanup) {
  18702. $promises[] = new \React\Promise\Promise(function ($resolve, $reject) use ($cleanup): void {
  18703. $promise = $cleanup();
  18704. if (!$promise instanceof PromiseInterface) {
  18705. $resolve();
  18706. } else {
  18707. $promise->then(function () use ($resolve): void {
  18708. $resolve();
  18709. });
  18710. }
  18711. });
  18712. }
  18713. if (!empty($promises)) {
  18714. $loop->wait($promises);
  18715. }
  18716. };
  18717. $handleInterruptsUnix = function_exists('pcntl_async_signals') && function_exists('pcntl_signal');
  18718. $handleInterruptsWindows = PHP_VERSION_ID >= 70400 && function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli';
  18719. $prevHandler = null;
  18720. $windowsHandler = null;
  18721. if ($handleInterruptsUnix) {
  18722. pcntl_async_signals(true);
  18723. $prevHandler = pcntl_signal_get_handler(SIGINT);
  18724. pcntl_signal(SIGINT, function ($sig) use ($runCleanup, $prevHandler, $io): void {
  18725. $io->writeError('Received SIGINT, aborting', true, IOInterface::DEBUG);
  18726. $runCleanup();
  18727. if (!in_array($prevHandler, array(SIG_DFL, SIG_IGN), true)) {
  18728. call_user_func($prevHandler, $sig);
  18729. }
  18730. exit(130);
  18731. });
  18732. }
  18733. if ($handleInterruptsWindows) {
  18734. $windowsHandler = function ($event) use ($runCleanup, $io): void {
  18735. if ($event !== PHP_WINDOWS_EVENT_CTRL_C) {
  18736. return;
  18737. }
  18738. $io->writeError('Received CTRL+C, aborting', true, IOInterface::DEBUG);
  18739. $runCleanup();
  18740. exit(130);
  18741. };
  18742. sapi_windows_set_ctrl_handler($windowsHandler);
  18743. }
  18744. try {
  18745. $batches = array();
  18746. $batch = array();
  18747. foreach ($operations as $index => $operation) {
  18748. if ($operation instanceof UpdateOperation || $operation instanceof InstallOperation) {
  18749. $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
  18750. if ($package->getType() === 'composer-plugin' && ($extra = $package->getExtra()) && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true) {
  18751. if ($batch) {
  18752. $batches[] = $batch;
  18753. }
  18754. $batches[] = array($index => $operation);
  18755. $batch = array();
  18756. continue;
  18757. }
  18758. }
  18759. $batch[$index] = $operation;
  18760. }
  18761. if ($batch) {
  18762. $batches[] = $batch;
  18763. }
  18764. foreach ($batches as $batch) {
  18765. $this->downloadAndExecuteBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts, $operations);
  18766. }
  18767. } catch (\Exception $e) {
  18768. $runCleanup();
  18769. if ($handleInterruptsUnix) {
  18770. pcntl_signal(SIGINT, $prevHandler);
  18771. }
  18772. if ($handleInterruptsWindows) {
  18773. sapi_windows_set_ctrl_handler($windowsHandler, false);
  18774. }
  18775. throw $e;
  18776. }
  18777. if ($handleInterruptsUnix) {
  18778. pcntl_signal(SIGINT, $prevHandler);
  18779. }
  18780. if ($handleInterruptsWindows) {
  18781. sapi_windows_set_ctrl_handler($windowsHandler, false);
  18782. }
  18783. $repo->write($devMode, $this);
  18784. }
  18785. private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
  18786. {
  18787. $promises = array();
  18788. foreach ($operations as $index => $operation) {
  18789. $opType = $operation->getOperationType();
  18790. if (!in_array($opType, array('update', 'install', 'uninstall'))) {
  18791. continue;
  18792. }
  18793. if ($opType === 'update') {
  18794. $package = $operation->getTargetPackage();
  18795. $initialPackage = $operation->getInitialPackage();
  18796. } else {
  18797. $package = $operation->getPackage();
  18798. $initialPackage = null;
  18799. }
  18800. $installer = $this->getInstaller($package->getType());
  18801. $cleanupPromises[$index] = function () use ($opType, $installer, $package, $initialPackage) {
  18802. if (!$package->getInstallationSource()) {
  18803. return;
  18804. }
  18805. return $installer->cleanup($opType, $package, $initialPackage);
  18806. };
  18807. if ($opType !== 'uninstall') {
  18808. $promise = $installer->download($package, $initialPackage);
  18809. if ($promise) {
  18810. $promises[] = $promise;
  18811. }
  18812. }
  18813. }
  18814. if (count($promises)) {
  18815. $this->waitOnPromises($promises);
  18816. }
  18817. $batches = array();
  18818. $batch = array();
  18819. foreach ($operations as $index => $operation) {
  18820. if ($operation instanceof InstallOperation || $operation instanceof UpdateOperation) {
  18821. $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
  18822. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  18823. if ($batch) {
  18824. $batches[] = $batch;
  18825. }
  18826. $batches[] = array($index => $operation);
  18827. $batch = array();
  18828. continue;
  18829. }
  18830. }
  18831. $batch[$index] = $operation;
  18832. }
  18833. if ($batch) {
  18834. $batches[] = $batch;
  18835. }
  18836. foreach ($batches as $batch) {
  18837. $this->executeBatch($repo, $batch, $cleanupPromises, $devMode, $runScripts, $allOperations);
  18838. }
  18839. }
  18840. private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
  18841. {
  18842. $promises = array();
  18843. $postExecCallbacks = array();
  18844. foreach ($operations as $index => $operation) {
  18845. $opType = $operation->getOperationType();
  18846. if (!in_array($opType, array('update', 'install', 'uninstall'))) {
  18847. if ($this->io->isDebug()) {
  18848. $this->io->writeError(' - ' . $operation->show(false));
  18849. }
  18850. $this->$opType($repo, $operation);
  18851. continue;
  18852. }
  18853. if ($opType === 'update') {
  18854. $package = $operation->getTargetPackage();
  18855. $initialPackage = $operation->getInitialPackage();
  18856. } else {
  18857. $package = $operation->getPackage();
  18858. $initialPackage = null;
  18859. }
  18860. $installer = $this->getInstaller($package->getType());
  18861. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($opType);
  18862. if (defined($event) && $runScripts && $this->eventDispatcher) {
  18863. $this->eventDispatcher->dispatchPackageEvent(constant($event), $devMode, $repo, $allOperations, $operation);
  18864. }
  18865. $dispatcher = $this->eventDispatcher;
  18866. $io = $this->io;
  18867. $promise = $installer->prepare($opType, $package, $initialPackage);
  18868. if (!$promise instanceof PromiseInterface) {
  18869. $promise = \React\Promise\resolve(null);
  18870. }
  18871. $promise = $promise->then(function () use ($opType, $repo, $operation) {
  18872. return $this->$opType($repo, $operation);
  18873. })->then($cleanupPromises[$index])
  18874. ->then(function () use ($devMode, $repo): void {
  18875. $repo->write($devMode, $this);
  18876. }, function ($e) use ($opType, $package, $io): void {
  18877. $io->writeError(' <error>' . ucfirst($opType) .' of '.$package->getPrettyName().' failed</error>');
  18878. throw $e;
  18879. });
  18880. $postExecCallbacks[] = function () use ($opType, $runScripts, $dispatcher, $devMode, $repo, $allOperations, $operation): void {
  18881. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($opType);
  18882. if (defined($event) && $runScripts && $dispatcher) {
  18883. $dispatcher->dispatchPackageEvent(constant($event), $devMode, $repo, $allOperations, $operation);
  18884. }
  18885. };
  18886. $promises[] = $promise;
  18887. }
  18888. if (count($promises)) {
  18889. $this->waitOnPromises($promises);
  18890. }
  18891. Platform::workaroundFilesystemIssues();
  18892. foreach ($postExecCallbacks as $cb) {
  18893. $cb();
  18894. }
  18895. }
  18896. private function waitOnPromises(array $promises): void
  18897. {
  18898. $progress = null;
  18899. if (
  18900. $this->outputProgress
  18901. && $this->io instanceof ConsoleIO
  18902. && !Platform::getEnv('CI')
  18903. && !$this->io->isDebug()
  18904. && count($promises) > 1
  18905. ) {
  18906. $progress = $this->io->getProgressBar();
  18907. }
  18908. $this->loop->wait($promises, $progress);
  18909. if ($progress) {
  18910. $progress->clear();
  18911. if (!$this->io->isDecorated()) {
  18912. $this->io->writeError('');
  18913. }
  18914. }
  18915. }
  18916. public function install(InstalledRepositoryInterface $repo, InstallOperation $operation): ?PromiseInterface
  18917. {
  18918. $package = $operation->getPackage();
  18919. $installer = $this->getInstaller($package->getType());
  18920. $promise = $installer->install($repo, $package);
  18921. $this->markForNotification($package);
  18922. return $promise;
  18923. }
  18924. public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation): ?PromiseInterface
  18925. {
  18926. $initial = $operation->getInitialPackage();
  18927. $target = $operation->getTargetPackage();
  18928. $initialType = $initial->getType();
  18929. $targetType = $target->getType();
  18930. if ($initialType === $targetType) {
  18931. $installer = $this->getInstaller($initialType);
  18932. $promise = $installer->update($repo, $initial, $target);
  18933. $this->markForNotification($target);
  18934. } else {
  18935. $promise = $this->getInstaller($initialType)->uninstall($repo, $initial);
  18936. if (!$promise instanceof PromiseInterface) {
  18937. $promise = \React\Promise\resolve(null);
  18938. }
  18939. $installer = $this->getInstaller($targetType);
  18940. $promise = $promise->then(function () use ($installer, $repo, $target): PromiseInterface {
  18941. $promise = $installer->install($repo, $target);
  18942. if ($promise instanceof PromiseInterface) {
  18943. return $promise;
  18944. }
  18945. return \React\Promise\resolve(null);
  18946. });
  18947. }
  18948. return $promise;
  18949. }
  18950. public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation): ?PromiseInterface
  18951. {
  18952. $package = $operation->getPackage();
  18953. $installer = $this->getInstaller($package->getType());
  18954. return $installer->uninstall($repo, $package);
  18955. }
  18956. public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void
  18957. {
  18958. $package = $operation->getPackage();
  18959. if (!$repo->hasPackage($package)) {
  18960. $repo->addPackage(clone $package);
  18961. }
  18962. }
  18963. public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void
  18964. {
  18965. $package = $operation->getPackage();
  18966. $repo->removePackage($package);
  18967. }
  18968. public function getInstallPath(PackageInterface $package): string
  18969. {
  18970. $installer = $this->getInstaller($package->getType());
  18971. return $installer->getInstallPath($package);
  18972. }
  18973. public function setOutputProgress(bool $outputProgress): void
  18974. {
  18975. $this->outputProgress = $outputProgress;
  18976. }
  18977. public function notifyInstalls(IOInterface $io): void
  18978. {
  18979. $promises = array();
  18980. try {
  18981. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  18982. if (strpos($repoUrl, '%package%')) {
  18983. foreach ($packages as $package) {
  18984. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  18985. $params = array(
  18986. 'version' => $package->getPrettyVersion(),
  18987. 'version_normalized' => $package->getVersion(),
  18988. );
  18989. $opts = array(
  18990. 'retry-auth-failure' => false,
  18991. 'http' => array(
  18992. 'method' => 'POST',
  18993. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  18994. 'content' => http_build_query($params, '', '&'),
  18995. 'timeout' => 3,
  18996. ),
  18997. );
  18998. $promises[] = $this->loop->getHttpDownloader()->add($url, $opts);
  18999. }
  19000. continue;
  19001. }
  19002. $postData = array('downloads' => array());
  19003. foreach ($packages as $package) {
  19004. $packageNotification = array(
  19005. 'name' => $package->getPrettyName(),
  19006. 'version' => $package->getVersion(),
  19007. );
  19008. if (strpos($repoUrl, 'packagist.org/') !== false) {
  19009. if (isset(FileDownloader::$downloadMetadata[$package->getName()])) {
  19010. $packageNotification['downloaded'] = FileDownloader::$downloadMetadata[$package->getName()];
  19011. } else {
  19012. $packageNotification['downloaded'] = false;
  19013. }
  19014. }
  19015. $postData['downloads'][] = $packageNotification;
  19016. }
  19017. $opts = array(
  19018. 'retry-auth-failure' => false,
  19019. 'http' => array(
  19020. 'method' => 'POST',
  19021. 'header' => array('Content-Type: application/json'),
  19022. 'content' => json_encode($postData),
  19023. 'timeout' => 6,
  19024. ),
  19025. );
  19026. $promises[] = $this->loop->getHttpDownloader()->add($repoUrl, $opts);
  19027. }
  19028. $this->loop->wait($promises);
  19029. } catch (\Exception $e) {
  19030. }
  19031. $this->reset();
  19032. }
  19033. private function markForNotification(PackageInterface $package): void
  19034. {
  19035. if ($package->getNotificationUrl()) {
  19036. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  19037. }
  19038. }
  19039. }
  19040. <?php declare(strict_types=1);
  19041. namespace Composer\Installer;
  19042. use Composer\Composer;
  19043. use Composer\DependencyResolver\Transaction;
  19044. use Composer\EventDispatcher\Event;
  19045. use Composer\IO\IOInterface;
  19046. class InstallerEvent extends Event
  19047. {
  19048. private $composer;
  19049. private $io;
  19050. private $devMode;
  19051. private $executeOperations;
  19052. private $transaction;
  19053. public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, bool $executeOperations, Transaction $transaction)
  19054. {
  19055. parent::__construct($eventName);
  19056. $this->composer = $composer;
  19057. $this->io = $io;
  19058. $this->devMode = $devMode;
  19059. $this->executeOperations = $executeOperations;
  19060. $this->transaction = $transaction;
  19061. }
  19062. public function getComposer(): Composer
  19063. {
  19064. return $this->composer;
  19065. }
  19066. public function getIO(): IOInterface
  19067. {
  19068. return $this->io;
  19069. }
  19070. public function isDevMode(): bool
  19071. {
  19072. return $this->devMode;
  19073. }
  19074. public function isExecutingOperations(): bool
  19075. {
  19076. return $this->executeOperations;
  19077. }
  19078. public function getTransaction(): ?Transaction
  19079. {
  19080. return $this->transaction;
  19081. }
  19082. }
  19083. <?php declare(strict_types=1);
  19084. namespace Composer\Installer;
  19085. class InstallerEvents
  19086. {
  19087. public const PRE_OPERATIONS_EXEC = 'pre-operations-exec';
  19088. }
  19089. <?php declare(strict_types=1);
  19090. namespace Composer\Installer;
  19091. use Composer\Package\PackageInterface;
  19092. use Composer\Repository\InstalledRepositoryInterface;
  19093. use InvalidArgumentException;
  19094. use React\Promise\PromiseInterface;
  19095. interface InstallerInterface
  19096. {
  19097. public function supports(string $packageType);
  19098. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  19099. public function download(PackageInterface $package, PackageInterface $prevPackage = null);
  19100. public function prepare(string $type, PackageInterface $package, PackageInterface $prevPackage = null);
  19101. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  19102. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  19103. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  19104. public function cleanup(string $type, PackageInterface $package, PackageInterface $prevPackage = null);
  19105. public function getInstallPath(PackageInterface $package);
  19106. }
  19107. <?php declare(strict_types=1);
  19108. namespace Composer\Installer;
  19109. use Composer\Composer;
  19110. use Composer\IO\IOInterface;
  19111. use Composer\PartialComposer;
  19112. use Composer\Pcre\Preg;
  19113. use Composer\Repository\InstalledRepositoryInterface;
  19114. use Composer\Package\PackageInterface;
  19115. use Composer\Util\Filesystem;
  19116. use Composer\Util\Silencer;
  19117. use Composer\Util\Platform;
  19118. use React\Promise\PromiseInterface;
  19119. use Composer\Downloader\DownloadManager;
  19120. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  19121. {
  19122. protected $composer;
  19123. protected $vendorDir;
  19124. protected $downloadManager;
  19125. protected $io;
  19126. protected $type;
  19127. protected $filesystem;
  19128. protected $binaryInstaller;
  19129. public function __construct(IOInterface $io, PartialComposer $composer, ?string $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  19130. {
  19131. $this->composer = $composer;
  19132. $this->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
  19133. $this->io = $io;
  19134. $this->type = $type;
  19135. $this->filesystem = $filesystem ?: new Filesystem();
  19136. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  19137. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem, $this->vendorDir);
  19138. }
  19139. public function supports(string $packageType)
  19140. {
  19141. return $packageType === $this->type || null === $this->type;
  19142. }
  19143. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  19144. {
  19145. if (!$repo->hasPackage($package)) {
  19146. return false;
  19147. }
  19148. $installPath = $this->getInstallPath($package);
  19149. if (Filesystem::isReadable($installPath)) {
  19150. return true;
  19151. }
  19152. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  19153. }
  19154. public function download(PackageInterface $package, PackageInterface $prevPackage = null)
  19155. {
  19156. $this->initializeVendorDir();
  19157. $downloadPath = $this->getInstallPath($package);
  19158. return $this->getDownloadManager()->download($package, $downloadPath, $prevPackage);
  19159. }
  19160. public function prepare($type, PackageInterface $package, PackageInterface $prevPackage = null)
  19161. {
  19162. $this->initializeVendorDir();
  19163. $downloadPath = $this->getInstallPath($package);
  19164. return $this->getDownloadManager()->prepare($type, $package, $downloadPath, $prevPackage);
  19165. }
  19166. public function cleanup($type, PackageInterface $package, PackageInterface $prevPackage = null)
  19167. {
  19168. $this->initializeVendorDir();
  19169. $downloadPath = $this->getInstallPath($package);
  19170. return $this->getDownloadManager()->cleanup($type, $package, $downloadPath, $prevPackage);
  19171. }
  19172. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  19173. {
  19174. $this->initializeVendorDir();
  19175. $downloadPath = $this->getInstallPath($package);
  19176. if (!Filesystem::isReadable($downloadPath) && $repo->hasPackage($package)) {
  19177. $this->binaryInstaller->removeBinaries($package);
  19178. }
  19179. $promise = $this->installCode($package);
  19180. if (!$promise instanceof PromiseInterface) {
  19181. $promise = \React\Promise\resolve(null);
  19182. }
  19183. $binaryInstaller = $this->binaryInstaller;
  19184. $installPath = $this->getInstallPath($package);
  19185. return $promise->then(function () use ($binaryInstaller, $installPath, $package, $repo): void {
  19186. $binaryInstaller->installBinaries($package, $installPath);
  19187. if (!$repo->hasPackage($package)) {
  19188. $repo->addPackage(clone $package);
  19189. }
  19190. });
  19191. }
  19192. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  19193. {
  19194. if (!$repo->hasPackage($initial)) {
  19195. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  19196. }
  19197. $this->initializeVendorDir();
  19198. $this->binaryInstaller->removeBinaries($initial);
  19199. $promise = $this->updateCode($initial, $target);
  19200. if (!$promise instanceof PromiseInterface) {
  19201. $promise = \React\Promise\resolve(null);
  19202. }
  19203. $binaryInstaller = $this->binaryInstaller;
  19204. $installPath = $this->getInstallPath($target);
  19205. return $promise->then(function () use ($binaryInstaller, $installPath, $target, $initial, $repo): void {
  19206. $binaryInstaller->installBinaries($target, $installPath);
  19207. $repo->removePackage($initial);
  19208. if (!$repo->hasPackage($target)) {
  19209. $repo->addPackage(clone $target);
  19210. }
  19211. });
  19212. }
  19213. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  19214. {
  19215. if (!$repo->hasPackage($package)) {
  19216. throw new \InvalidArgumentException('Package is not installed: '.$package);
  19217. }
  19218. $promise = $this->removeCode($package);
  19219. if (!$promise instanceof PromiseInterface) {
  19220. $promise = \React\Promise\resolve(null);
  19221. }
  19222. $binaryInstaller = $this->binaryInstaller;
  19223. $downloadPath = $this->getPackageBasePath($package);
  19224. $filesystem = $this->filesystem;
  19225. return $promise->then(function () use ($binaryInstaller, $filesystem, $downloadPath, $package, $repo): void {
  19226. $binaryInstaller->removeBinaries($package);
  19227. $repo->removePackage($package);
  19228. if (strpos($package->getName(), '/')) {
  19229. $packageVendorDir = dirname($downloadPath);
  19230. if (is_dir($packageVendorDir) && $filesystem->isDirEmpty($packageVendorDir)) {
  19231. Silencer::call('rmdir', $packageVendorDir);
  19232. }
  19233. }
  19234. });
  19235. }
  19236. public function getInstallPath(PackageInterface $package)
  19237. {
  19238. $this->initializeVendorDir();
  19239. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  19240. $targetDir = $package->getTargetDir();
  19241. return $basePath . ($targetDir ? '/'.$targetDir : '');
  19242. }
  19243. public function ensureBinariesPresence(PackageInterface $package)
  19244. {
  19245. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  19246. }
  19247. protected function getPackageBasePath(PackageInterface $package)
  19248. {
  19249. $installPath = $this->getInstallPath($package);
  19250. $targetDir = $package->getTargetDir();
  19251. if ($targetDir) {
  19252. return Preg::replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  19253. }
  19254. return $installPath;
  19255. }
  19256. protected function installCode(PackageInterface $package)
  19257. {
  19258. $downloadPath = $this->getInstallPath($package);
  19259. return $this->getDownloadManager()->install($package, $downloadPath);
  19260. }
  19261. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  19262. {
  19263. $initialDownloadPath = $this->getInstallPath($initial);
  19264. $targetDownloadPath = $this->getInstallPath($target);
  19265. if ($targetDownloadPath !== $initialDownloadPath) {
  19266. if (strpos($initialDownloadPath, $targetDownloadPath) === 0
  19267. || strpos($targetDownloadPath, $initialDownloadPath) === 0
  19268. ) {
  19269. $promise = $this->removeCode($initial);
  19270. if (!$promise instanceof PromiseInterface) {
  19271. $promise = \React\Promise\resolve(null);
  19272. }
  19273. return $promise->then(function () use ($target): PromiseInterface {
  19274. $promise = $this->installCode($target);
  19275. if ($promise instanceof PromiseInterface) {
  19276. return $promise;
  19277. }
  19278. return \React\Promise\resolve(null);
  19279. });
  19280. }
  19281. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  19282. }
  19283. return $this->getDownloadManager()->update($initial, $target, $targetDownloadPath);
  19284. }
  19285. protected function removeCode(PackageInterface $package)
  19286. {
  19287. $downloadPath = $this->getPackageBasePath($package);
  19288. return $this->getDownloadManager()->remove($package, $downloadPath);
  19289. }
  19290. protected function initializeVendorDir()
  19291. {
  19292. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  19293. $this->vendorDir = realpath($this->vendorDir);
  19294. }
  19295. protected function getDownloadManager(): DownloadManager
  19296. {
  19297. assert($this->downloadManager instanceof DownloadManager, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance to be able to install/... packages'));
  19298. return $this->downloadManager;
  19299. }
  19300. }
  19301. <?php declare(strict_types=1);
  19302. namespace Composer\Installer;
  19303. use Composer\Repository\InstalledRepositoryInterface;
  19304. use Composer\Package\PackageInterface;
  19305. use Composer\IO\IOInterface;
  19306. use Composer\DependencyResolver\Operation\UpdateOperation;
  19307. use Composer\DependencyResolver\Operation\InstallOperation;
  19308. use Composer\DependencyResolver\Operation\UninstallOperation;
  19309. class MetapackageInstaller implements InstallerInterface
  19310. {
  19311. private $io;
  19312. public function __construct(IOInterface $io)
  19313. {
  19314. $this->io = $io;
  19315. }
  19316. public function supports(string $packageType)
  19317. {
  19318. return $packageType === 'metapackage';
  19319. }
  19320. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  19321. {
  19322. return $repo->hasPackage($package);
  19323. }
  19324. public function download(PackageInterface $package, PackageInterface $prevPackage = null)
  19325. {
  19326. return \React\Promise\resolve(null);
  19327. }
  19328. public function prepare($type, PackageInterface $package, PackageInterface $prevPackage = null)
  19329. {
  19330. return \React\Promise\resolve(null);
  19331. }
  19332. public function cleanup($type, PackageInterface $package, PackageInterface $prevPackage = null)
  19333. {
  19334. return \React\Promise\resolve(null);
  19335. }
  19336. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  19337. {
  19338. $this->io->writeError(" - " . InstallOperation::format($package));
  19339. $repo->addPackage(clone $package);
  19340. return \React\Promise\resolve(null);
  19341. }
  19342. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  19343. {
  19344. if (!$repo->hasPackage($initial)) {
  19345. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  19346. }
  19347. $this->io->writeError(" - " . UpdateOperation::format($initial, $target));
  19348. $repo->removePackage($initial);
  19349. $repo->addPackage(clone $target);
  19350. return \React\Promise\resolve(null);
  19351. }
  19352. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  19353. {
  19354. if (!$repo->hasPackage($package)) {
  19355. throw new \InvalidArgumentException('Package is not installed: '.$package);
  19356. }
  19357. $this->io->writeError(" - " . UninstallOperation::format($package));
  19358. $repo->removePackage($package);
  19359. return \React\Promise\resolve(null);
  19360. }
  19361. public function getInstallPath(PackageInterface $package)
  19362. {
  19363. return '';
  19364. }
  19365. }
  19366. <?php declare(strict_types=1);
  19367. namespace Composer\Installer;
  19368. use Composer\Repository\InstalledRepositoryInterface;
  19369. use Composer\Package\PackageInterface;
  19370. class NoopInstaller implements InstallerInterface
  19371. {
  19372. public function supports(string $packageType)
  19373. {
  19374. return true;
  19375. }
  19376. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  19377. {
  19378. return $repo->hasPackage($package);
  19379. }
  19380. public function download(PackageInterface $package, PackageInterface $prevPackage = null)
  19381. {
  19382. return \React\Promise\resolve(null);
  19383. }
  19384. public function prepare($type, PackageInterface $package, PackageInterface $prevPackage = null)
  19385. {
  19386. return \React\Promise\resolve(null);
  19387. }
  19388. public function cleanup($type, PackageInterface $package, PackageInterface $prevPackage = null)
  19389. {
  19390. return \React\Promise\resolve(null);
  19391. }
  19392. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  19393. {
  19394. if (!$repo->hasPackage($package)) {
  19395. $repo->addPackage(clone $package);
  19396. }
  19397. return \React\Promise\resolve(null);
  19398. }
  19399. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  19400. {
  19401. if (!$repo->hasPackage($initial)) {
  19402. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  19403. }
  19404. $repo->removePackage($initial);
  19405. if (!$repo->hasPackage($target)) {
  19406. $repo->addPackage(clone $target);
  19407. }
  19408. return \React\Promise\resolve(null);
  19409. }
  19410. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  19411. {
  19412. if (!$repo->hasPackage($package)) {
  19413. throw new \InvalidArgumentException('Package is not installed: '.$package);
  19414. }
  19415. $repo->removePackage($package);
  19416. return \React\Promise\resolve(null);
  19417. }
  19418. public function getInstallPath(PackageInterface $package)
  19419. {
  19420. $targetDir = $package->getTargetDir();
  19421. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  19422. }
  19423. }
  19424. <?php declare(strict_types=1);
  19425. namespace Composer\Installer;
  19426. use Composer\Composer;
  19427. use Composer\IO\IOInterface;
  19428. use Composer\DependencyResolver\Operation\OperationInterface;
  19429. use Composer\Repository\RepositoryInterface;
  19430. use Composer\EventDispatcher\Event;
  19431. class PackageEvent extends Event
  19432. {
  19433. private $composer;
  19434. private $io;
  19435. private $devMode;
  19436. private $localRepo;
  19437. private $operations;
  19438. private $operation;
  19439. public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
  19440. {
  19441. parent::__construct($eventName);
  19442. $this->composer = $composer;
  19443. $this->io = $io;
  19444. $this->devMode = $devMode;
  19445. $this->localRepo = $localRepo;
  19446. $this->operations = $operations;
  19447. $this->operation = $operation;
  19448. }
  19449. public function getComposer(): Composer
  19450. {
  19451. return $this->composer;
  19452. }
  19453. public function getIO(): IOInterface
  19454. {
  19455. return $this->io;
  19456. }
  19457. public function isDevMode(): bool
  19458. {
  19459. return $this->devMode;
  19460. }
  19461. public function getLocalRepo(): RepositoryInterface
  19462. {
  19463. return $this->localRepo;
  19464. }
  19465. public function getOperations(): array
  19466. {
  19467. return $this->operations;
  19468. }
  19469. public function getOperation(): OperationInterface
  19470. {
  19471. return $this->operation;
  19472. }
  19473. }
  19474. <?php declare(strict_types=1);
  19475. namespace Composer\Installer;
  19476. class PackageEvents
  19477. {
  19478. public const PRE_PACKAGE_INSTALL = 'pre-package-install';
  19479. public const POST_PACKAGE_INSTALL = 'post-package-install';
  19480. public const PRE_PACKAGE_UPDATE = 'pre-package-update';
  19481. public const POST_PACKAGE_UPDATE = 'post-package-update';
  19482. public const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  19483. public const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  19484. }
  19485. <?php declare(strict_types=1);
  19486. namespace Composer\Installer;
  19487. use Composer\Composer;
  19488. use Composer\IO\IOInterface;
  19489. use Composer\PartialComposer;
  19490. use Composer\Repository\InstalledRepositoryInterface;
  19491. use Composer\Package\PackageInterface;
  19492. use Composer\Plugin\PluginManager;
  19493. use Composer\Util\Filesystem;
  19494. use Composer\Util\Platform;
  19495. use React\Promise\PromiseInterface;
  19496. class PluginInstaller extends LibraryInstaller
  19497. {
  19498. public function __construct(IOInterface $io, PartialComposer $composer, Filesystem $fs = null, BinaryInstaller $binaryInstaller = null)
  19499. {
  19500. parent::__construct($io, $composer, 'composer-plugin', $fs, $binaryInstaller);
  19501. }
  19502. public function supports(string $packageType)
  19503. {
  19504. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  19505. }
  19506. public function download(PackageInterface $package, PackageInterface $prevPackage = null)
  19507. {
  19508. $extra = $package->getExtra();
  19509. if (empty($extra['class'])) {
  19510. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19511. }
  19512. return parent::download($package, $prevPackage);
  19513. }
  19514. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  19515. {
  19516. $promise = parent::install($repo, $package);
  19517. if (!$promise instanceof PromiseInterface) {
  19518. $promise = \React\Promise\resolve(null);
  19519. }
  19520. return $promise->then(function () use ($package, $repo): void {
  19521. try {
  19522. Platform::workaroundFilesystemIssues();
  19523. $this->getPluginManager()->registerPackage($package, true);
  19524. } catch (\Exception $e) {
  19525. $this->rollbackInstall($e, $repo, $package);
  19526. }
  19527. });
  19528. }
  19529. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  19530. {
  19531. $promise = parent::update($repo, $initial, $target);
  19532. if (!$promise instanceof PromiseInterface) {
  19533. $promise = \React\Promise\resolve(null);
  19534. }
  19535. return $promise->then(function () use ($initial, $target, $repo): void {
  19536. try {
  19537. Platform::workaroundFilesystemIssues();
  19538. $this->getPluginManager()->deactivatePackage($initial);
  19539. $this->getPluginManager()->registerPackage($target, true);
  19540. } catch (\Exception $e) {
  19541. $this->rollbackInstall($e, $repo, $target);
  19542. }
  19543. });
  19544. }
  19545. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  19546. {
  19547. $this->getPluginManager()->uninstallPackage($package);
  19548. return parent::uninstall($repo, $package);
  19549. }
  19550. private function rollbackInstall(\Exception $e, InstalledRepositoryInterface $repo, PackageInterface $package): void
  19551. {
  19552. $this->io->writeError('Plugin initialization failed ('.$e->getMessage().'), uninstalling plugin');
  19553. parent::uninstall($repo, $package);
  19554. throw $e;
  19555. }
  19556. protected function getPluginManager(): PluginManager
  19557. {
  19558. assert($this->composer instanceof Composer, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance.'));
  19559. $pluginManager = $this->composer->getPluginManager();
  19560. return $pluginManager;
  19561. }
  19562. }
  19563. <?php declare(strict_types=1);
  19564. namespace Composer\Installer;
  19565. use React\Promise\PromiseInterface;
  19566. use Composer\Package\PackageInterface;
  19567. use Composer\Downloader\DownloadManager;
  19568. use Composer\Repository\InstalledRepositoryInterface;
  19569. use Composer\Util\Filesystem;
  19570. class ProjectInstaller implements InstallerInterface
  19571. {
  19572. private $installPath;
  19573. private $downloadManager;
  19574. private $filesystem;
  19575. public function __construct(string $installPath, DownloadManager $dm, Filesystem $fs)
  19576. {
  19577. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  19578. $this->downloadManager = $dm;
  19579. $this->filesystem = $fs;
  19580. }
  19581. public function supports(string $packageType): bool
  19582. {
  19583. return true;
  19584. }
  19585. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
  19586. {
  19587. return false;
  19588. }
  19589. public function download(PackageInterface $package, PackageInterface $prevPackage = null): ?PromiseInterface
  19590. {
  19591. $installPath = $this->installPath;
  19592. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  19593. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  19594. }
  19595. if (!is_dir($installPath)) {
  19596. mkdir($installPath, 0777, true);
  19597. }
  19598. return $this->downloadManager->download($package, $installPath, $prevPackage);
  19599. }
  19600. public function prepare($type, PackageInterface $package, PackageInterface $prevPackage = null): ?PromiseInterface
  19601. {
  19602. return $this->downloadManager->prepare($type, $package, $this->installPath, $prevPackage);
  19603. }
  19604. public function cleanup($type, PackageInterface $package, PackageInterface $prevPackage = null): ?PromiseInterface
  19605. {
  19606. return $this->downloadManager->cleanup($type, $package, $this->installPath, $prevPackage);
  19607. }
  19608. public function install(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
  19609. {
  19610. return $this->downloadManager->install($package, $this->installPath);
  19611. }
  19612. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target): ?PromiseInterface
  19613. {
  19614. throw new \InvalidArgumentException("not supported");
  19615. }
  19616. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
  19617. {
  19618. throw new \InvalidArgumentException("not supported");
  19619. }
  19620. public function getInstallPath(PackageInterface $package): string
  19621. {
  19622. return $this->installPath;
  19623. }
  19624. }
  19625. <?php declare(strict_types=1);
  19626. namespace Composer\Installer;
  19627. use Composer\IO\IOInterface;
  19628. use Composer\Package\PackageInterface;
  19629. use Composer\Pcre\Preg;
  19630. use Composer\Repository\InstalledRepository;
  19631. use Symfony\Component\Console\Formatter\OutputFormatter;
  19632. class SuggestedPackagesReporter
  19633. {
  19634. public const MODE_LIST = 1;
  19635. public const MODE_BY_PACKAGE = 2;
  19636. public const MODE_BY_SUGGESTION = 4;
  19637. protected $suggestedPackages = array();
  19638. private $io;
  19639. public function __construct(IOInterface $io)
  19640. {
  19641. $this->io = $io;
  19642. }
  19643. public function getPackages(): array
  19644. {
  19645. return $this->suggestedPackages;
  19646. }
  19647. public function addPackage(string $source, string $target, string $reason): SuggestedPackagesReporter
  19648. {
  19649. $this->suggestedPackages[] = array(
  19650. 'source' => $source,
  19651. 'target' => $target,
  19652. 'reason' => $reason,
  19653. );
  19654. return $this;
  19655. }
  19656. public function addSuggestionsFromPackage(PackageInterface $package): SuggestedPackagesReporter
  19657. {
  19658. $source = $package->getPrettyName();
  19659. foreach ($package->getSuggests() as $target => $reason) {
  19660. $this->addPackage(
  19661. $source,
  19662. $target,
  19663. $reason
  19664. );
  19665. }
  19666. return $this;
  19667. }
  19668. public function output(int $mode, InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null): void
  19669. {
  19670. $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
  19671. $suggesters = array();
  19672. $suggested = array();
  19673. foreach ($suggestedPackages as $suggestion) {
  19674. $suggesters[$suggestion['source']][$suggestion['target']] = $suggestion['reason'];
  19675. $suggested[$suggestion['target']][$suggestion['source']] = $suggestion['reason'];
  19676. }
  19677. ksort($suggesters);
  19678. ksort($suggested);
  19679. if ($mode & self::MODE_LIST) {
  19680. foreach (array_keys($suggested) as $name) {
  19681. $this->io->write(sprintf('<info>%s</info>', $name));
  19682. }
  19683. return;
  19684. }
  19685. if ($mode & self::MODE_BY_PACKAGE) {
  19686. foreach ($suggesters as $suggester => $suggestions) {
  19687. $this->io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  19688. foreach ($suggestions as $suggestion => $reason) {
  19689. $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggestion, $this->escapeOutput($reason)));
  19690. }
  19691. $this->io->write('');
  19692. }
  19693. }
  19694. if ($mode & self::MODE_BY_SUGGESTION) {
  19695. if ($mode & self::MODE_BY_PACKAGE) {
  19696. $this->io->write(str_repeat('-', 78));
  19697. }
  19698. foreach ($suggested as $suggestion => $suggesters) {
  19699. $this->io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  19700. foreach ($suggesters as $suggester => $reason) {
  19701. $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggester, $this->escapeOutput($reason)));
  19702. }
  19703. $this->io->write('');
  19704. }
  19705. }
  19706. if ($onlyDependentsOf) {
  19707. $allSuggestedPackages = $this->getFilteredSuggestions($installedRepo);
  19708. $diff = count($allSuggestedPackages) - count($suggestedPackages);
  19709. if ($diff) {
  19710. $this->io->write('<info>'.$diff.' additional suggestions</info> by transitive dependencies can be shown with <info>--all</info>');
  19711. }
  19712. }
  19713. }
  19714. public function outputMinimalistic(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null): void
  19715. {
  19716. $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
  19717. if ($suggestedPackages) {
  19718. $this->io->writeError('<info>'.count($suggestedPackages).' package suggestions were added by new dependencies, use `composer suggest` to see details.</info>');
  19719. }
  19720. }
  19721. private function getFilteredSuggestions(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null): array
  19722. {
  19723. $suggestedPackages = $this->getPackages();
  19724. $installedNames = array();
  19725. if (null !== $installedRepo && !empty($suggestedPackages)) {
  19726. foreach ($installedRepo->getPackages() as $package) {
  19727. $installedNames = array_merge(
  19728. $installedNames,
  19729. $package->getNames()
  19730. );
  19731. }
  19732. }
  19733. $sourceFilter = array();
  19734. if ($onlyDependentsOf) {
  19735. $sourceFilter = array_map(function ($link): string {
  19736. return $link->getTarget();
  19737. }, array_merge($onlyDependentsOf->getRequires(), $onlyDependentsOf->getDevRequires()));
  19738. $sourceFilter[] = $onlyDependentsOf->getName();
  19739. }
  19740. $suggestions = array();
  19741. foreach ($suggestedPackages as $suggestion) {
  19742. if (in_array($suggestion['target'], $installedNames) || ($sourceFilter && !in_array($suggestion['source'], $sourceFilter))) {
  19743. continue;
  19744. }
  19745. $suggestions[] = $suggestion;
  19746. }
  19747. return $suggestions;
  19748. }
  19749. private function escapeOutput(string $string): string
  19750. {
  19751. return OutputFormatter::escape(
  19752. $this->removeControlCharacters($string)
  19753. );
  19754. }
  19755. private function removeControlCharacters(string $string): string
  19756. {
  19757. return Preg::replace(
  19758. '/[[:cntrl:]]/',
  19759. '',
  19760. str_replace("\n", ' ', $string)
  19761. );
  19762. }
  19763. }
  19764. <?php declare(strict_types=1);
  19765. namespace Composer\Json;
  19766. use Composer\Pcre\Preg;
  19767. use JsonSchema\Validator;
  19768. use Seld\JsonLint\JsonParser;
  19769. use Seld\JsonLint\ParsingException;
  19770. use Composer\Util\HttpDownloader;
  19771. use Composer\IO\IOInterface;
  19772. use Composer\Downloader\TransportException;
  19773. class JsonFile
  19774. {
  19775. public const LAX_SCHEMA = 1;
  19776. public const STRICT_SCHEMA = 2;
  19777. public const AUTH_SCHEMA = 3;
  19778. public const JSON_UNESCAPED_SLASHES = 64;
  19779. public const JSON_PRETTY_PRINT = 128;
  19780. public const JSON_UNESCAPED_UNICODE = 256;
  19781. public const COMPOSER_SCHEMA_PATH = __DIR__ . '/../../../res/composer-schema.json';
  19782. private $path;
  19783. private $httpDownloader;
  19784. private $io;
  19785. public function __construct(string $path, HttpDownloader $httpDownloader = null, IOInterface $io = null)
  19786. {
  19787. $this->path = $path;
  19788. if (null === $httpDownloader && Preg::isMatch('{^https?://}i', $path)) {
  19789. throw new \InvalidArgumentException('http urls require a HttpDownloader instance to be passed');
  19790. }
  19791. $this->httpDownloader = $httpDownloader;
  19792. $this->io = $io;
  19793. }
  19794. public function getPath(): string
  19795. {
  19796. return $this->path;
  19797. }
  19798. public function exists(): bool
  19799. {
  19800. return is_file($this->path);
  19801. }
  19802. public function read()
  19803. {
  19804. try {
  19805. if ($this->httpDownloader) {
  19806. $json = $this->httpDownloader->get($this->path)->getBody();
  19807. } else {
  19808. if ($this->io && $this->io->isDebug()) {
  19809. $realpathInfo = '';
  19810. $realpath = realpath($this->path);
  19811. if (false !== $realpath && $realpath !== $this->path) {
  19812. $realpathInfo = ' (' . $realpath . ')';
  19813. }
  19814. $this->io->writeError('Reading ' . $this->path . $realpathInfo);
  19815. }
  19816. $json = file_get_contents($this->path);
  19817. }
  19818. } catch (TransportException $e) {
  19819. throw new \RuntimeException($e->getMessage(), 0, $e);
  19820. } catch (\Exception $e) {
  19821. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  19822. }
  19823. return static::parseJson($json, $this->path);
  19824. }
  19825. public function write(array $hash, int $options = JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
  19826. {
  19827. if ($this->path === 'php://memory') {
  19828. file_put_contents($this->path, static::encode($hash, $options));
  19829. return;
  19830. }
  19831. $dir = dirname($this->path);
  19832. if (!is_dir($dir)) {
  19833. if (file_exists($dir)) {
  19834. throw new \UnexpectedValueException(
  19835. realpath($dir).' exists and is not a directory.'
  19836. );
  19837. }
  19838. if (!@mkdir($dir, 0777, true)) {
  19839. throw new \UnexpectedValueException(
  19840. $dir.' does not exist and could not be created.'
  19841. );
  19842. }
  19843. }
  19844. $retries = 3;
  19845. while ($retries--) {
  19846. try {
  19847. $this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & JSON_PRETTY_PRINT ? "\n" : ''));
  19848. break;
  19849. } catch (\Exception $e) {
  19850. if ($retries > 0) {
  19851. usleep(500000);
  19852. continue;
  19853. }
  19854. throw $e;
  19855. }
  19856. }
  19857. }
  19858. private function filePutContentsIfModified(string $path, string $content)
  19859. {
  19860. $currentContent = @file_get_contents($path);
  19861. if (!$currentContent || ($currentContent != $content)) {
  19862. return file_put_contents($path, $content);
  19863. }
  19864. return 0;
  19865. }
  19866. public function validateSchema(int $schema = self::STRICT_SCHEMA, ?string $schemaFile = null): bool
  19867. {
  19868. $content = file_get_contents($this->path);
  19869. $data = json_decode($content);
  19870. if (null === $data && 'null' !== $content) {
  19871. self::validateSyntax($content, $this->path);
  19872. }
  19873. return self::validateJsonSchema($this->path, $data, $schema, $schemaFile);
  19874. }
  19875. public static function validateJsonSchema(string $source, $data, int $schema, ?string $schemaFile = null): bool
  19876. {
  19877. $isComposerSchemaFile = false;
  19878. if (null === $schemaFile) {
  19879. $isComposerSchemaFile = true;
  19880. $schemaFile = self::COMPOSER_SCHEMA_PATH;
  19881. }
  19882. if (false === strpos($schemaFile, '://')) {
  19883. $schemaFile = 'file://' . $schemaFile;
  19884. }
  19885. $schemaData = (object) array('$ref' => $schemaFile);
  19886. if ($schema === self::LAX_SCHEMA) {
  19887. $schemaData->additionalProperties = true;
  19888. $schemaData->required = array();
  19889. } elseif ($schema === self::STRICT_SCHEMA && $isComposerSchemaFile) {
  19890. $schemaData->additionalProperties = false;
  19891. $schemaData->required = array('name', 'description');
  19892. } elseif ($schema === self::AUTH_SCHEMA && $isComposerSchemaFile) {
  19893. $schemaData = (object) array('$ref' => $schemaFile.'#/properties/config', '$schema'=> "https://json-schema.org/draft-04/schema#");
  19894. }
  19895. $validator = new Validator();
  19896. $validator->check($data, $schemaData);
  19897. if (!$validator->isValid()) {
  19898. $errors = array();
  19899. foreach ((array) $validator->getErrors() as $error) {
  19900. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  19901. }
  19902. throw new JsonValidationException('"'.$source.'" does not match the expected JSON schema', $errors);
  19903. }
  19904. return true;
  19905. }
  19906. public static function encode($data, int $options = 448)
  19907. {
  19908. $json = json_encode($data, $options);
  19909. if (false === $json) {
  19910. self::throwEncodeError(json_last_error());
  19911. }
  19912. return $json;
  19913. }
  19914. private static function throwEncodeError(int $code): void
  19915. {
  19916. switch ($code) {
  19917. case JSON_ERROR_DEPTH:
  19918. $msg = 'Maximum stack depth exceeded';
  19919. break;
  19920. case JSON_ERROR_STATE_MISMATCH:
  19921. $msg = 'Underflow or the modes mismatch';
  19922. break;
  19923. case JSON_ERROR_CTRL_CHAR:
  19924. $msg = 'Unexpected control character found';
  19925. break;
  19926. case JSON_ERROR_UTF8:
  19927. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  19928. break;
  19929. default:
  19930. $msg = 'Unknown error';
  19931. }
  19932. throw new \RuntimeException('JSON encoding failed: '.$msg);
  19933. }
  19934. public static function parseJson(?string $json, string $file = null)
  19935. {
  19936. if (null === $json) {
  19937. return null;
  19938. }
  19939. $data = json_decode($json, true);
  19940. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  19941. self::validateSyntax($json, $file);
  19942. }
  19943. return $data;
  19944. }
  19945. protected static function validateSyntax(string $json, string $file = null): bool
  19946. {
  19947. $parser = new JsonParser();
  19948. $result = $parser->lint($json);
  19949. if (null === $result) {
  19950. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  19951. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  19952. }
  19953. return true;
  19954. }
  19955. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  19956. }
  19957. }
  19958. <?php declare(strict_types=1);
  19959. namespace Composer\Json;
  19960. use Composer\Pcre\Preg;
  19961. class JsonFormatter
  19962. {
  19963. public static function format(string $json, bool $unescapeUnicode, bool $unescapeSlashes): string
  19964. {
  19965. $result = '';
  19966. $pos = 0;
  19967. $strLen = strlen($json);
  19968. $indentStr = ' ';
  19969. $newLine = "\n";
  19970. $outOfQuotes = true;
  19971. $buffer = '';
  19972. $noescape = true;
  19973. for ($i = 0; $i < $strLen; $i++) {
  19974. $char = substr($json, $i, 1);
  19975. if ('"' === $char && $noescape) {
  19976. $outOfQuotes = !$outOfQuotes;
  19977. }
  19978. if (!$outOfQuotes) {
  19979. $buffer .= $char;
  19980. $noescape = '\\' === $char ? !$noescape : true;
  19981. continue;
  19982. }
  19983. if ('' !== $buffer) {
  19984. if ($unescapeSlashes) {
  19985. $buffer = str_replace('\\/', '/', $buffer);
  19986. }
  19987. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  19988. $buffer = Preg::replaceCallback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  19989. $l = strlen($match[1]);
  19990. if ($l % 2) {
  19991. $code = hexdec($match[2]);
  19992. if (0xD800 <= $code && 0xDFFF >= $code) {
  19993. return $match[0];
  19994. }
  19995. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  19996. pack('H*', $match[2]),
  19997. 'UTF-8',
  19998. 'UCS-2BE'
  19999. );
  20000. }
  20001. return $match[0];
  20002. }, $buffer);
  20003. }
  20004. $result .= $buffer.$char;
  20005. $buffer = '';
  20006. continue;
  20007. }
  20008. if (':' === $char) {
  20009. $char .= ' ';
  20010. } elseif ('}' === $char || ']' === $char) {
  20011. $pos--;
  20012. $prevChar = substr($json, $i - 1, 1);
  20013. if ('{' !== $prevChar && '[' !== $prevChar) {
  20014. $result .= $newLine;
  20015. for ($j = 0; $j < $pos; $j++) {
  20016. $result .= $indentStr;
  20017. }
  20018. } else {
  20019. $result = rtrim($result);
  20020. }
  20021. }
  20022. $result .= $char;
  20023. if (',' === $char || '{' === $char || '[' === $char) {
  20024. $result .= $newLine;
  20025. if ('{' === $char || '[' === $char) {
  20026. $pos++;
  20027. }
  20028. for ($j = 0; $j < $pos; $j++) {
  20029. $result .= $indentStr;
  20030. }
  20031. }
  20032. }
  20033. return $result;
  20034. }
  20035. }
  20036. <?php declare(strict_types=1);
  20037. namespace Composer\Json;
  20038. use Composer\Pcre\Preg;
  20039. use Composer\Repository\PlatformRepository;
  20040. class JsonManipulator
  20041. {
  20042. private static $DEFINES = '(?(DEFINE)
  20043. (?<number> -? (?= [1-9]|0(?!\d) ) \d++ (\.\d++)? ([eE] [+-]?+ \d++)? )
  20044. (?<boolean> true | false | null )
  20045. (?<string> " ([^"\\\\]*+ | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  20046. (?<array> \[ (?: (?&json) \s*+ (?: , (?&json) \s*+ )*+ )?+ \s*+ \] )
  20047. (?<pair> \s*+ (?&string) \s*+ : (?&json) \s*+ )
  20048. (?<object> \{ (?: (?&pair) (?: , (?&pair) )*+ )?+ \s*+ \} )
  20049. (?<json> \s*+ (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  20050. )';
  20051. private $contents;
  20052. private $newline;
  20053. private $indent;
  20054. public function __construct(string $contents)
  20055. {
  20056. $contents = trim($contents);
  20057. if ($contents === '') {
  20058. $contents = '{}';
  20059. }
  20060. if (!Preg::isMatch('#^\{(.*)\}$#s', $contents)) {
  20061. throw new \InvalidArgumentException('The json file must be an object ({})');
  20062. }
  20063. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  20064. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  20065. $this->detectIndenting();
  20066. }
  20067. public function getContents(): string
  20068. {
  20069. return $this->contents . $this->newline;
  20070. }
  20071. public function addLink(string $type, string $package, string $constraint, bool $sortPackages = false): bool
  20072. {
  20073. $decoded = JsonFile::parseJson($this->contents);
  20074. if (!isset($decoded[$type])) {
  20075. return $this->addMainKey($type, array($package => $constraint));
  20076. }
  20077. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  20078. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  20079. if (!Preg::isMatch($regex, $this->contents, $matches)) {
  20080. return false;
  20081. }
  20082. $links = $matches['value'];
  20083. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  20084. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  20085. if (Preg::isMatch($regex, $links, $packageMatches)) {
  20086. $existingPackage = $packageMatches['package'];
  20087. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  20088. $links = Preg::replaceCallback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint): string {
  20089. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  20090. }, $links);
  20091. } else {
  20092. if (Preg::isMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  20093. $links = Preg::replace(
  20094. '{'.preg_quote($match[1]).'$}',
  20095. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  20096. $links
  20097. );
  20098. } else {
  20099. $links = '{' . $this->newline .
  20100. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  20101. $this->indent . '}';
  20102. }
  20103. }
  20104. if (true === $sortPackages) {
  20105. $requirements = json_decode($links, true);
  20106. $this->sortPackages($requirements);
  20107. $links = $this->format($requirements);
  20108. }
  20109. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  20110. return true;
  20111. }
  20112. private function sortPackages(array &$packages = array()): void
  20113. {
  20114. $prefix = function ($requirement): string {
  20115. if (PlatformRepository::isPlatformPackage($requirement)) {
  20116. return Preg::replace(
  20117. array(
  20118. '/^php/',
  20119. '/^hhvm/',
  20120. '/^ext/',
  20121. '/^lib/',
  20122. '/^\D/',
  20123. ),
  20124. array(
  20125. '0-$0',
  20126. '1-$0',
  20127. '2-$0',
  20128. '3-$0',
  20129. '4-$0',
  20130. ),
  20131. $requirement
  20132. );
  20133. }
  20134. return '5-'.$requirement;
  20135. };
  20136. uksort($packages, function ($a, $b) use ($prefix): int {
  20137. return strnatcmp($prefix($a), $prefix($b));
  20138. });
  20139. }
  20140. public function addRepository(string $name, $config, bool $append = true): bool
  20141. {
  20142. return $this->addSubNode('repositories', $name, $config, $append);
  20143. }
  20144. public function removeRepository(string $name): bool
  20145. {
  20146. return $this->removeSubNode('repositories', $name);
  20147. }
  20148. public function addConfigSetting(string $name, $value): bool
  20149. {
  20150. return $this->addSubNode('config', $name, $value);
  20151. }
  20152. public function removeConfigSetting(string $name): bool
  20153. {
  20154. return $this->removeSubNode('config', $name);
  20155. }
  20156. public function addProperty(string $name, $value): bool
  20157. {
  20158. if (strpos($name, 'suggest.') === 0) {
  20159. return $this->addSubNode('suggest', substr($name, 8), $value);
  20160. }
  20161. if (strpos($name, 'extra.') === 0) {
  20162. return $this->addSubNode('extra', substr($name, 6), $value);
  20163. }
  20164. if (strpos($name, 'scripts.') === 0) {
  20165. return $this->addSubNode('scripts', substr($name, 8), $value);
  20166. }
  20167. return $this->addMainKey($name, $value);
  20168. }
  20169. public function removeProperty(string $name): bool
  20170. {
  20171. if (strpos($name, 'suggest.') === 0) {
  20172. return $this->removeSubNode('suggest', substr($name, 8));
  20173. }
  20174. if (strpos($name, 'extra.') === 0) {
  20175. return $this->removeSubNode('extra', substr($name, 6));
  20176. }
  20177. if (strpos($name, 'scripts.') === 0) {
  20178. return $this->removeSubNode('scripts', substr($name, 8));
  20179. }
  20180. return $this->removeMainKey($name);
  20181. }
  20182. public function addSubNode(string $mainNode, string $name, $value, bool $append = true): bool
  20183. {
  20184. $decoded = JsonFile::parseJson($this->contents);
  20185. $subName = null;
  20186. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  20187. list($name, $subName) = explode('.', $name, 2);
  20188. }
  20189. if (!isset($decoded[$mainNode])) {
  20190. if ($subName !== null) {
  20191. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  20192. } else {
  20193. $this->addMainKey($mainNode, array($name => $value));
  20194. }
  20195. return true;
  20196. }
  20197. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  20198. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  20199. try {
  20200. if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
  20201. return false;
  20202. }
  20203. } catch (\RuntimeException $e) {
  20204. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  20205. return false;
  20206. }
  20207. throw $e;
  20208. }
  20209. $children = $match['content'];
  20210. if (!@json_decode($children)) {
  20211. return false;
  20212. }
  20213. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  20214. if (Preg::isMatch($childRegex, $children, $matches)) {
  20215. $children = Preg::replaceCallback($childRegex, function ($matches) use ($subName, $value): string {
  20216. if ($subName !== null) {
  20217. $curVal = json_decode($matches['content'], true);
  20218. if (!is_array($curVal)) {
  20219. $curVal = array();
  20220. }
  20221. $curVal[$subName] = $value;
  20222. $value = $curVal;
  20223. }
  20224. return $matches['start'] . $this->format($value, 1) . $matches['end'];
  20225. }, $children);
  20226. } else {
  20227. Preg::match('#^{ (?P<leadingspace>\s*?) (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  20228. $whitespace = '';
  20229. if (!empty($match['trailingspace'])) {
  20230. $whitespace = $match['trailingspace'];
  20231. }
  20232. if (!empty($match['content'])) {
  20233. if ($subName !== null) {
  20234. $value = array($subName => $value);
  20235. }
  20236. if ($append) {
  20237. $children = Preg::replace(
  20238. '#'.$whitespace.'}$#',
  20239. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  20240. $children
  20241. );
  20242. } else {
  20243. $whitespace = '';
  20244. if (!empty($match['leadingspace'])) {
  20245. $whitespace = $match['leadingspace'];
  20246. }
  20247. $children = Preg::replace(
  20248. '#^{'.$whitespace.'#',
  20249. addcslashes('{' . $whitespace . JsonFile::encode($name).': '.$this->format($value, 1) . ',' . $this->newline . $this->indent . $this->indent, '\\$'),
  20250. $children
  20251. );
  20252. }
  20253. } else {
  20254. if ($subName !== null) {
  20255. $value = array($subName => $value);
  20256. }
  20257. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  20258. }
  20259. }
  20260. $this->contents = Preg::replaceCallback($nodeRegex, function ($m) use ($children): string {
  20261. return $m['start'] . $children . $m['end'];
  20262. }, $this->contents);
  20263. return true;
  20264. }
  20265. public function removeSubNode(string $mainNode, string $name): bool
  20266. {
  20267. $decoded = JsonFile::parseJson($this->contents);
  20268. if (empty($decoded[$mainNode])) {
  20269. return true;
  20270. }
  20271. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  20272. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  20273. try {
  20274. if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
  20275. return false;
  20276. }
  20277. } catch (\RuntimeException $e) {
  20278. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  20279. return false;
  20280. }
  20281. throw $e;
  20282. }
  20283. $children = $match['content'];
  20284. if (!@json_decode($children, true)) {
  20285. return false;
  20286. }
  20287. $subName = null;
  20288. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  20289. list($name, $subName) = explode('.', $name, 2);
  20290. }
  20291. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  20292. return true;
  20293. }
  20294. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  20295. if (Preg::isMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  20296. if (Preg::isMatchAll('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  20297. $bestMatch = '';
  20298. foreach ($matches[0] as $match) {
  20299. if (strlen($bestMatch) < strlen($match)) {
  20300. $bestMatch = $match;
  20301. }
  20302. }
  20303. $childrenClean = Preg::replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  20304. if (1 !== $count) {
  20305. $childrenClean = Preg::replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  20306. if (1 !== $count) {
  20307. return false;
  20308. }
  20309. }
  20310. }
  20311. } else {
  20312. $childrenClean = $children;
  20313. }
  20314. if (!isset($childrenClean)) {
  20315. throw new \InvalidArgumentException("JsonManipulator: \$childrenClean is not defined. Please report at https://github.com/composer/composer/issues/new.");
  20316. }
  20317. unset($match);
  20318. Preg::match('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  20319. if (empty($match['content'])) {
  20320. $newline = $this->newline;
  20321. $indent = $this->indent;
  20322. $this->contents = Preg::replaceCallback($nodeRegex, function ($matches) use ($indent, $newline): string {
  20323. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  20324. }, $this->contents);
  20325. if ($subName !== null) {
  20326. $curVal = json_decode($children, true);
  20327. unset($curVal[$name][$subName]);
  20328. $this->addSubNode($mainNode, $name, $curVal[$name]);
  20329. }
  20330. return true;
  20331. }
  20332. $this->contents = Preg::replaceCallback($nodeRegex, function ($matches) use ($name, $subName, $childrenClean): string {
  20333. if ($subName !== null) {
  20334. $curVal = json_decode($matches['content'], true);
  20335. unset($curVal[$name][$subName]);
  20336. $childrenClean = $this->format($curVal);
  20337. }
  20338. return $matches['start'] . $childrenClean . $matches['end'];
  20339. }, $this->contents);
  20340. return true;
  20341. }
  20342. public function addMainKey(string $key, $content): bool
  20343. {
  20344. $decoded = JsonFile::parseJson($this->contents);
  20345. $content = $this->format($content);
  20346. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  20347. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  20348. if (isset($decoded[$key]) && Preg::isMatch($regex, $this->contents, $matches)) {
  20349. if (!@json_decode('{'.$matches['key'].'}')) {
  20350. return false;
  20351. }
  20352. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  20353. return true;
  20354. }
  20355. if (Preg::isMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  20356. $this->contents = Preg::replace(
  20357. '#'.$match[1].'\}$#',
  20358. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  20359. $this->contents
  20360. );
  20361. return true;
  20362. }
  20363. $this->contents = Preg::replace(
  20364. '#\}$#',
  20365. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  20366. $this->contents
  20367. );
  20368. return true;
  20369. }
  20370. public function removeMainKey(string $key): bool
  20371. {
  20372. $decoded = JsonFile::parseJson($this->contents);
  20373. if (!array_key_exists($key, $decoded)) {
  20374. return true;
  20375. }
  20376. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  20377. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  20378. if (Preg::isMatch($regex, $this->contents, $matches)) {
  20379. if (!@json_decode('{'.$matches['removal'].'}')) {
  20380. return false;
  20381. }
  20382. if (Preg::isMatch('#,\s*$#', $matches['start']) && Preg::isMatch('#^\}$#', $matches['end'])) {
  20383. $matches['start'] = rtrim(Preg::replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  20384. }
  20385. $this->contents = $matches['start'] . $matches['end'];
  20386. if (Preg::isMatch('#^\{\s*\}\s*$#', $this->contents)) {
  20387. $this->contents = "{\n}";
  20388. }
  20389. return true;
  20390. }
  20391. return false;
  20392. }
  20393. public function removeMainKeyIfEmpty(string $key): bool
  20394. {
  20395. $decoded = JsonFile::parseJson($this->contents);
  20396. if (!array_key_exists($key, $decoded)) {
  20397. return true;
  20398. }
  20399. if (is_array($decoded[$key]) && count($decoded[$key]) === 0) {
  20400. return $this->removeMainKey($key);
  20401. }
  20402. return true;
  20403. }
  20404. public function format($data, int $depth = 0): string
  20405. {
  20406. if (is_array($data)) {
  20407. reset($data);
  20408. if (is_numeric(key($data))) {
  20409. foreach ($data as $key => $val) {
  20410. $data[$key] = $this->format($val, $depth + 1);
  20411. }
  20412. return '['.implode(', ', $data).']';
  20413. }
  20414. $out = '{' . $this->newline;
  20415. $elems = array();
  20416. foreach ($data as $key => $val) {
  20417. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  20418. }
  20419. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  20420. }
  20421. return JsonFile::encode($data);
  20422. }
  20423. protected function detectIndenting(): void
  20424. {
  20425. if (Preg::isMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  20426. $this->indent = $match[1];
  20427. } else {
  20428. $this->indent = ' ';
  20429. }
  20430. }
  20431. }
  20432. <?php declare(strict_types=1);
  20433. namespace Composer\Json;
  20434. use Exception;
  20435. class JsonValidationException extends Exception
  20436. {
  20437. protected $errors;
  20438. public function __construct(string $message, array $errors = array(), Exception $previous = null)
  20439. {
  20440. $this->errors = $errors;
  20441. parent::__construct((string) $message, 0, $previous);
  20442. }
  20443. public function getErrors(): array
  20444. {
  20445. return $this->errors;
  20446. }
  20447. }
  20448. <?php declare(strict_types=1);
  20449. namespace Composer\Package;
  20450. use Composer\Semver\Constraint\Constraint;
  20451. use Composer\Package\Version\VersionParser;
  20452. class AliasPackage extends BasePackage
  20453. {
  20454. protected $version;
  20455. protected $prettyVersion;
  20456. protected $dev;
  20457. protected $rootPackageAlias = false;
  20458. protected $stability;
  20459. protected $hasSelfVersionRequires = false;
  20460. protected $aliasOf;
  20461. protected $requires;
  20462. protected $devRequires;
  20463. protected $conflicts;
  20464. protected $provides;
  20465. protected $replaces;
  20466. public function __construct(BasePackage $aliasOf, string $version, string $prettyVersion)
  20467. {
  20468. parent::__construct($aliasOf->getName());
  20469. $this->version = $version;
  20470. $this->prettyVersion = $prettyVersion;
  20471. $this->aliasOf = $aliasOf;
  20472. $this->stability = VersionParser::parseStability($version);
  20473. $this->dev = $this->stability === 'dev';
  20474. foreach (Link::$TYPES as $type) {
  20475. $links = $aliasOf->{'get' . ucfirst($type)}();
  20476. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  20477. }
  20478. }
  20479. public function getAliasOf()
  20480. {
  20481. return $this->aliasOf;
  20482. }
  20483. public function getVersion(): string
  20484. {
  20485. return $this->version;
  20486. }
  20487. public function getStability(): string
  20488. {
  20489. return $this->stability;
  20490. }
  20491. public function getPrettyVersion(): string
  20492. {
  20493. return $this->prettyVersion;
  20494. }
  20495. public function isDev(): bool
  20496. {
  20497. return $this->dev;
  20498. }
  20499. public function getRequires(): array
  20500. {
  20501. return $this->requires;
  20502. }
  20503. public function getConflicts(): array
  20504. {
  20505. return $this->conflicts;
  20506. }
  20507. public function getProvides(): array
  20508. {
  20509. return $this->provides;
  20510. }
  20511. public function getReplaces(): array
  20512. {
  20513. return $this->replaces;
  20514. }
  20515. public function getDevRequires(): array
  20516. {
  20517. return $this->devRequires;
  20518. }
  20519. public function setRootPackageAlias(bool $value): void
  20520. {
  20521. $this->rootPackageAlias = $value;
  20522. }
  20523. public function isRootPackageAlias(): bool
  20524. {
  20525. return $this->rootPackageAlias;
  20526. }
  20527. protected function replaceSelfVersionDependencies(array $links, $linkType): array
  20528. {
  20529. $prettyVersion = $this->prettyVersion;
  20530. if ($prettyVersion === VersionParser::DEFAULT_BRANCH_ALIAS) {
  20531. $prettyVersion = $this->aliasOf->getPrettyVersion();
  20532. }
  20533. if (\in_array($linkType, array(Link::TYPE_CONFLICT, Link::TYPE_PROVIDE, Link::TYPE_REPLACE), true)) {
  20534. $newLinks = array();
  20535. foreach ($links as $link) {
  20536. if ('self.version' === $link->getPrettyConstraint()) {
  20537. $newLinks[] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
  20538. $constraint->setPrettyString($prettyVersion);
  20539. }
  20540. }
  20541. $links = array_merge($links, $newLinks);
  20542. } else {
  20543. foreach ($links as $index => $link) {
  20544. if ('self.version' === $link->getPrettyConstraint()) {
  20545. if ($linkType === Link::TYPE_REQUIRE) {
  20546. $this->hasSelfVersionRequires = true;
  20547. }
  20548. $links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
  20549. $constraint->setPrettyString($prettyVersion);
  20550. }
  20551. }
  20552. }
  20553. return $links;
  20554. }
  20555. public function hasSelfVersionRequires(): bool
  20556. {
  20557. return $this->hasSelfVersionRequires;
  20558. }
  20559. public function __toString(): string
  20560. {
  20561. return parent::__toString().' ('.($this->rootPackageAlias ? 'root ' : ''). 'alias of '.$this->aliasOf->getVersion().')';
  20562. }
  20563. public function getType(): string
  20564. {
  20565. return $this->aliasOf->getType();
  20566. }
  20567. public function getTargetDir(): ?string
  20568. {
  20569. return $this->aliasOf->getTargetDir();
  20570. }
  20571. public function getExtra(): array
  20572. {
  20573. return $this->aliasOf->getExtra();
  20574. }
  20575. public function setInstallationSource(?string $type): void
  20576. {
  20577. $this->aliasOf->setInstallationSource($type);
  20578. }
  20579. public function getInstallationSource(): ?string
  20580. {
  20581. return $this->aliasOf->getInstallationSource();
  20582. }
  20583. public function getSourceType(): ?string
  20584. {
  20585. return $this->aliasOf->getSourceType();
  20586. }
  20587. public function getSourceUrl(): ?string
  20588. {
  20589. return $this->aliasOf->getSourceUrl();
  20590. }
  20591. public function getSourceUrls(): array
  20592. {
  20593. return $this->aliasOf->getSourceUrls();
  20594. }
  20595. public function getSourceReference(): ?string
  20596. {
  20597. return $this->aliasOf->getSourceReference();
  20598. }
  20599. public function setSourceReference(?string $reference): void
  20600. {
  20601. $this->aliasOf->setSourceReference($reference);
  20602. }
  20603. public function setSourceMirrors(?array $mirrors): void
  20604. {
  20605. $this->aliasOf->setSourceMirrors($mirrors);
  20606. }
  20607. public function getSourceMirrors(): ?array
  20608. {
  20609. return $this->aliasOf->getSourceMirrors();
  20610. }
  20611. public function getDistType(): ?string
  20612. {
  20613. return $this->aliasOf->getDistType();
  20614. }
  20615. public function getDistUrl(): ?string
  20616. {
  20617. return $this->aliasOf->getDistUrl();
  20618. }
  20619. public function getDistUrls(): array
  20620. {
  20621. return $this->aliasOf->getDistUrls();
  20622. }
  20623. public function getDistReference(): ?string
  20624. {
  20625. return $this->aliasOf->getDistReference();
  20626. }
  20627. public function setDistReference(?string $reference): void
  20628. {
  20629. $this->aliasOf->setDistReference($reference);
  20630. }
  20631. public function getDistSha1Checksum(): ?string
  20632. {
  20633. return $this->aliasOf->getDistSha1Checksum();
  20634. }
  20635. public function setTransportOptions(array $options): void
  20636. {
  20637. $this->aliasOf->setTransportOptions($options);
  20638. }
  20639. public function getTransportOptions(): array
  20640. {
  20641. return $this->aliasOf->getTransportOptions();
  20642. }
  20643. public function setDistMirrors(?array $mirrors): void
  20644. {
  20645. $this->aliasOf->setDistMirrors($mirrors);
  20646. }
  20647. public function getDistMirrors(): ?array
  20648. {
  20649. return $this->aliasOf->getDistMirrors();
  20650. }
  20651. public function getAutoload(): array
  20652. {
  20653. return $this->aliasOf->getAutoload();
  20654. }
  20655. public function getDevAutoload(): array
  20656. {
  20657. return $this->aliasOf->getDevAutoload();
  20658. }
  20659. public function getIncludePaths(): array
  20660. {
  20661. return $this->aliasOf->getIncludePaths();
  20662. }
  20663. public function getReleaseDate(): ?\DateTimeInterface
  20664. {
  20665. return $this->aliasOf->getReleaseDate();
  20666. }
  20667. public function getBinaries(): array
  20668. {
  20669. return $this->aliasOf->getBinaries();
  20670. }
  20671. public function getSuggests(): array
  20672. {
  20673. return $this->aliasOf->getSuggests();
  20674. }
  20675. public function getNotificationUrl(): ?string
  20676. {
  20677. return $this->aliasOf->getNotificationUrl();
  20678. }
  20679. public function isDefaultBranch(): bool
  20680. {
  20681. return $this->aliasOf->isDefaultBranch();
  20682. }
  20683. public function setDistUrl(?string $url): void
  20684. {
  20685. $this->aliasOf->setDistUrl($url);
  20686. }
  20687. public function setDistType(?string $type): void
  20688. {
  20689. $this->aliasOf->setDistType($type);
  20690. }
  20691. public function setSourceDistReferences(string $reference): void
  20692. {
  20693. $this->aliasOf->setSourceDistReferences($reference);
  20694. }
  20695. }
  20696. <?php declare(strict_types=1);
  20697. namespace Composer\Package\Archiver;
  20698. use FilterIterator;
  20699. use PharData;
  20700. class ArchivableFilesFilter extends FilterIterator
  20701. {
  20702. private $dirs = array();
  20703. public function accept(): bool
  20704. {
  20705. $file = $this->getInnerIterator()->current();
  20706. if ($file->isDir()) {
  20707. $this->dirs[] = (string) $file;
  20708. return false;
  20709. }
  20710. return true;
  20711. }
  20712. public function addEmptyDir(PharData $phar, string $sources): void
  20713. {
  20714. foreach ($this->dirs as $filepath) {
  20715. $localname = str_replace($sources . "/", '', $filepath);
  20716. $phar->addEmptyDir($localname);
  20717. }
  20718. }
  20719. }
  20720. <?php declare(strict_types=1);
  20721. namespace Composer\Package\Archiver;
  20722. use Composer\Pcre\Preg;
  20723. use Composer\Util\Filesystem;
  20724. use FilesystemIterator;
  20725. use Symfony\Component\Finder\Finder;
  20726. use Symfony\Component\Finder\SplFileInfo;
  20727. class ArchivableFilesFinder extends \FilterIterator
  20728. {
  20729. protected $finder;
  20730. public function __construct(string $sources, array $excludes, bool $ignoreFilters = false)
  20731. {
  20732. $fs = new Filesystem();
  20733. $sources = $fs->normalizePath(realpath($sources));
  20734. if ($ignoreFilters) {
  20735. $filters = array();
  20736. } else {
  20737. $filters = array(
  20738. new GitExcludeFilter($sources),
  20739. new ComposerExcludeFilter($sources, $excludes),
  20740. );
  20741. }
  20742. $this->finder = new Finder();
  20743. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs): bool {
  20744. if ($file->isLink() && ($file->getRealPath() === false || strpos($file->getRealPath(), $sources) !== 0)) {
  20745. return false;
  20746. }
  20747. $relativePath = Preg::replace(
  20748. '#^'.preg_quote($sources, '#').'#',
  20749. '',
  20750. $fs->normalizePath($file->getRealPath())
  20751. );
  20752. $exclude = false;
  20753. foreach ($filters as $filter) {
  20754. $exclude = $filter->filter($relativePath, $exclude);
  20755. }
  20756. return !$exclude;
  20757. };
  20758. if (method_exists($filter, 'bindTo')) {
  20759. $filter = $filter->bindTo(null);
  20760. }
  20761. $this->finder
  20762. ->in($sources)
  20763. ->filter($filter)
  20764. ->ignoreVCS(true)
  20765. ->ignoreDotFiles(false)
  20766. ->sortByName();
  20767. parent::__construct($this->finder->getIterator());
  20768. }
  20769. public function accept(): bool
  20770. {
  20771. $current = $this->getInnerIterator()->current();
  20772. if (!$current->isDir()) {
  20773. return true;
  20774. }
  20775. $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS);
  20776. return !$iterator->valid();
  20777. }
  20778. }
  20779. <?php declare(strict_types=1);
  20780. namespace Composer\Package\Archiver;
  20781. use Composer\Downloader\DownloadManager;
  20782. use Composer\Package\RootPackageInterface;
  20783. use Composer\Pcre\Preg;
  20784. use Composer\Util\Filesystem;
  20785. use Composer\Util\Loop;
  20786. use Composer\Util\SyncHelper;
  20787. use Composer\Json\JsonFile;
  20788. use Composer\Package\CompletePackageInterface;
  20789. class ArchiveManager
  20790. {
  20791. protected $downloadManager;
  20792. protected $loop;
  20793. protected $archivers = array();
  20794. protected $overwriteFiles = true;
  20795. public function __construct(DownloadManager $downloadManager, Loop $loop)
  20796. {
  20797. $this->downloadManager = $downloadManager;
  20798. $this->loop = $loop;
  20799. }
  20800. public function addArchiver(ArchiverInterface $archiver): void
  20801. {
  20802. $this->archivers[] = $archiver;
  20803. }
  20804. public function setOverwriteFiles(bool $overwriteFiles): self
  20805. {
  20806. $this->overwriteFiles = $overwriteFiles;
  20807. return $this;
  20808. }
  20809. public function getPackageFilename(CompletePackageInterface $package): string
  20810. {
  20811. if ($package->getArchiveName()) {
  20812. $baseName = $package->getArchiveName();
  20813. } else {
  20814. $baseName = Preg::replace('#[^a-z0-9-_]#i', '-', $package->getName());
  20815. }
  20816. $nameParts = array($baseName);
  20817. if (null !== $package->getDistReference() && Preg::isMatch('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  20818. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  20819. } else {
  20820. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  20821. }
  20822. if ($package->getSourceReference()) {
  20823. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  20824. }
  20825. $name = implode('-', array_filter($nameParts, function ($p): bool {
  20826. return !empty($p);
  20827. }));
  20828. return str_replace('/', '-', $name);
  20829. }
  20830. public function archive(CompletePackageInterface $package, string $format, string $targetDir, ?string $fileName = null, bool $ignoreFilters = false): string
  20831. {
  20832. if (empty($format)) {
  20833. throw new \InvalidArgumentException('Format must be specified');
  20834. }
  20835. $usableArchiver = null;
  20836. foreach ($this->archivers as $archiver) {
  20837. if ($archiver->supports($format, $package->getSourceType())) {
  20838. $usableArchiver = $archiver;
  20839. break;
  20840. }
  20841. }
  20842. if (null === $usableArchiver) {
  20843. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  20844. }
  20845. $filesystem = new Filesystem();
  20846. if ($package instanceof RootPackageInterface) {
  20847. $sourcePath = realpath('.');
  20848. } else {
  20849. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  20850. $filesystem->ensureDirectoryExists($sourcePath);
  20851. try {
  20852. $promise = $this->downloadManager->download($package, $sourcePath);
  20853. SyncHelper::await($this->loop, $promise);
  20854. $promise = $this->downloadManager->install($package, $sourcePath);
  20855. SyncHelper::await($this->loop, $promise);
  20856. } catch (\Exception $e) {
  20857. $filesystem->removeDirectory($sourcePath);
  20858. throw $e;
  20859. }
  20860. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  20861. $jsonFile = new JsonFile($composerJsonPath);
  20862. $jsonData = $jsonFile->read();
  20863. if (!empty($jsonData['archive']['name'])) {
  20864. $package->setArchiveName($jsonData['archive']['name']);
  20865. }
  20866. if (!empty($jsonData['archive']['exclude'])) {
  20867. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  20868. }
  20869. }
  20870. }
  20871. if (null === $fileName) {
  20872. $packageName = $this->getPackageFilename($package);
  20873. } else {
  20874. $packageName = $fileName;
  20875. }
  20876. $filesystem->ensureDirectoryExists($targetDir);
  20877. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  20878. $filesystem->ensureDirectoryExists(dirname($target));
  20879. if (!$this->overwriteFiles && file_exists($target)) {
  20880. return $target;
  20881. }
  20882. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  20883. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  20884. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  20885. $filesystem->rename($archivePath, $target);
  20886. if (!$package instanceof RootPackageInterface) {
  20887. $filesystem->removeDirectory($sourcePath);
  20888. }
  20889. $filesystem->remove($tempTarget);
  20890. return $target;
  20891. }
  20892. }
  20893. <?php declare(strict_types=1);
  20894. namespace Composer\Package\Archiver;
  20895. interface ArchiverInterface
  20896. {
  20897. public function archive(string $sources, string $target, string $format, array $excludes = array(), bool $ignoreFilters = false): string;
  20898. public function supports(string $format, ?string $sourceType): bool;
  20899. }
  20900. <?php declare(strict_types=1);
  20901. namespace Composer\Package\Archiver;
  20902. use Composer\Pcre\Preg;
  20903. use Symfony\Component\Finder;
  20904. abstract class BaseExcludeFilter
  20905. {
  20906. protected $sourcePath;
  20907. protected $excludePatterns;
  20908. public function __construct(string $sourcePath)
  20909. {
  20910. $this->sourcePath = $sourcePath;
  20911. $this->excludePatterns = array();
  20912. }
  20913. public function filter(string $relativePath, bool $exclude): bool
  20914. {
  20915. foreach ($this->excludePatterns as $patternData) {
  20916. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  20917. if ($stripLeadingSlash) {
  20918. $path = substr($relativePath, 1);
  20919. } else {
  20920. $path = $relativePath;
  20921. }
  20922. try {
  20923. if (Preg::isMatch($pattern, $path)) {
  20924. $exclude = !$negate;
  20925. }
  20926. } catch (\RuntimeException $e) {
  20927. }
  20928. }
  20929. return $exclude;
  20930. }
  20931. protected function parseLines(array $lines, callable $lineParser): array
  20932. {
  20933. return array_filter(
  20934. array_map(
  20935. function ($line) use ($lineParser) {
  20936. $line = trim($line);
  20937. if (!$line || 0 === strpos($line, '#')) {
  20938. return null;
  20939. }
  20940. return call_user_func($lineParser, $line);
  20941. },
  20942. $lines
  20943. ),
  20944. function ($pattern): bool {
  20945. return $pattern !== null;
  20946. }
  20947. );
  20948. }
  20949. protected function generatePatterns(array $rules): array
  20950. {
  20951. $patterns = array();
  20952. foreach ($rules as $rule) {
  20953. $patterns[] = $this->generatePattern($rule);
  20954. }
  20955. return $patterns;
  20956. }
  20957. protected function generatePattern(string $rule): array
  20958. {
  20959. $negate = false;
  20960. $pattern = '';
  20961. if ($rule !== '' && $rule[0] === '!') {
  20962. $negate = true;
  20963. $rule = ltrim($rule, '!');
  20964. }
  20965. $firstSlashPosition = strpos($rule, '/');
  20966. if (0 === $firstSlashPosition) {
  20967. $pattern = '^/';
  20968. } elseif (false === $firstSlashPosition || strlen($rule) - 1 === $firstSlashPosition) {
  20969. $pattern = '/';
  20970. }
  20971. $rule = trim($rule, '/');
  20972. $rule = substr(Finder\Glob::toRegex($rule), 2, -2);
  20973. return array('{'.$pattern.$rule.'(?=$|/)}', $negate, false);
  20974. }
  20975. }
  20976. <?php declare(strict_types=1);
  20977. namespace Composer\Package\Archiver;
  20978. class ComposerExcludeFilter extends BaseExcludeFilter
  20979. {
  20980. public function __construct(string $sourcePath, array $excludeRules)
  20981. {
  20982. parent::__construct($sourcePath);
  20983. $this->excludePatterns = $this->generatePatterns($excludeRules);
  20984. }
  20985. }
  20986. <?php declare(strict_types=1);
  20987. namespace Composer\Package\Archiver;
  20988. use Composer\Pcre\Preg;
  20989. class GitExcludeFilter extends BaseExcludeFilter
  20990. {
  20991. public function __construct(string $sourcePath)
  20992. {
  20993. parent::__construct($sourcePath);
  20994. if (file_exists($sourcePath.'/.gitattributes')) {
  20995. $this->excludePatterns = array_merge(
  20996. $this->excludePatterns,
  20997. $this->parseLines(
  20998. file($sourcePath.'/.gitattributes'),
  20999. array($this, 'parseGitAttributesLine')
  21000. )
  21001. );
  21002. }
  21003. }
  21004. public function parseGitAttributesLine(string $line): ?array
  21005. {
  21006. $parts = Preg::split('#\s+#', $line);
  21007. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  21008. return $this->generatePattern($parts[0]);
  21009. }
  21010. if (count($parts) == 2 && $parts[1] === '-export-ignore') {
  21011. return $this->generatePattern('!'.$parts[0]);
  21012. }
  21013. return null;
  21014. }
  21015. }
  21016. <?php declare(strict_types=1);
  21017. namespace Composer\Package\Archiver;
  21018. class PharArchiver implements ArchiverInterface
  21019. {
  21020. protected static $formats = array(
  21021. 'zip' => \Phar::ZIP,
  21022. 'tar' => \Phar::TAR,
  21023. 'tar.gz' => \Phar::TAR,
  21024. 'tar.bz2' => \Phar::TAR,
  21025. );
  21026. protected static $compressFormats = array(
  21027. 'tar.gz' => \Phar::GZ,
  21028. 'tar.bz2' => \Phar::BZ2,
  21029. );
  21030. public function archive(string $sources, string $target, string $format, array $excludes = array(), bool $ignoreFilters = false): string
  21031. {
  21032. $sources = realpath($sources);
  21033. if (file_exists($target)) {
  21034. unlink($target);
  21035. }
  21036. try {
  21037. $filename = substr($target, 0, strrpos($target, $format) - 1);
  21038. if (isset(static::$compressFormats[$format])) {
  21039. $target = $filename . '.tar';
  21040. }
  21041. $phar = new \PharData(
  21042. $target,
  21043. \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO,
  21044. '',
  21045. static::$formats[$format]
  21046. );
  21047. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  21048. $filesOnly = new ArchivableFilesFilter($files);
  21049. $phar->buildFromIterator($filesOnly, $sources);
  21050. $filesOnly->addEmptyDir($phar, $sources);
  21051. if (isset(static::$compressFormats[$format])) {
  21052. if (!$phar->canCompress(static::$compressFormats[$format])) {
  21053. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  21054. }
  21055. unlink($target);
  21056. $phar->compress(static::$compressFormats[$format]);
  21057. $target = $filename . '.' . $format;
  21058. }
  21059. return $target;
  21060. } catch (\UnexpectedValueException $e) {
  21061. $message = sprintf(
  21062. "Could not create archive '%s' from '%s': %s",
  21063. $target,
  21064. $sources,
  21065. $e->getMessage()
  21066. );
  21067. throw new \RuntimeException($message, $e->getCode(), $e);
  21068. }
  21069. }
  21070. public function supports(string $format, ?string $sourceType): bool
  21071. {
  21072. return isset(static::$formats[$format]);
  21073. }
  21074. }
  21075. <?php declare(strict_types=1);
  21076. namespace Composer\Package\Archiver;
  21077. use ZipArchive;
  21078. use Composer\Util\Filesystem;
  21079. class ZipArchiver implements ArchiverInterface
  21080. {
  21081. protected static $formats = array(
  21082. 'zip' => true,
  21083. );
  21084. public function archive(string $sources, string $target, string $format, array $excludes = array(), bool $ignoreFilters = false): string
  21085. {
  21086. $fs = new Filesystem();
  21087. $sources = $fs->normalizePath($sources);
  21088. $zip = new ZipArchive();
  21089. $res = $zip->open($target, ZipArchive::CREATE);
  21090. if ($res === true) {
  21091. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  21092. foreach ($files as $file) {
  21093. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  21094. $localname = $filepath;
  21095. if (strpos($localname, $sources . '/') === 0) {
  21096. $localname = substr($localname, strlen($sources . '/'));
  21097. }
  21098. if ($file->isDir()) {
  21099. $zip->addEmptyDir($localname);
  21100. } else {
  21101. $zip->addFile($filepath, $localname);
  21102. }
  21103. if (method_exists($zip, 'setExternalAttributesName')) {
  21104. $perms = fileperms($filepath);
  21105. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  21106. }
  21107. }
  21108. if ($zip->close()) {
  21109. return $target;
  21110. }
  21111. }
  21112. $message = sprintf(
  21113. "Could not create archive '%s' from '%s': %s",
  21114. $target,
  21115. $sources,
  21116. $zip->getStatusString()
  21117. );
  21118. throw new \RuntimeException($message);
  21119. }
  21120. public function supports(string $format, ?string $sourceType): bool
  21121. {
  21122. return isset(static::$formats[$format]) && $this->compressionAvailable();
  21123. }
  21124. private function compressionAvailable(): bool
  21125. {
  21126. return class_exists('ZipArchive');
  21127. }
  21128. }
  21129. <?php declare(strict_types=1);
  21130. namespace Composer\Package;
  21131. use Composer\Repository\RepositoryInterface;
  21132. use Composer\Repository\PlatformRepository;
  21133. abstract class BasePackage implements PackageInterface
  21134. {
  21135. public static $supportedLinkTypes = array(
  21136. 'require' => array('description' => 'requires', 'method' => Link::TYPE_REQUIRE),
  21137. 'conflict' => array('description' => 'conflicts', 'method' => Link::TYPE_CONFLICT),
  21138. 'provide' => array('description' => 'provides', 'method' => Link::TYPE_PROVIDE),
  21139. 'replace' => array('description' => 'replaces', 'method' => Link::TYPE_REPLACE),
  21140. 'require-dev' => array('description' => 'requires (for development)', 'method' => Link::TYPE_DEV_REQUIRE),
  21141. );
  21142. public const STABILITY_STABLE = 0;
  21143. public const STABILITY_RC = 5;
  21144. public const STABILITY_BETA = 10;
  21145. public const STABILITY_ALPHA = 15;
  21146. public const STABILITY_DEV = 20;
  21147. public static $stabilities = array(
  21148. 'stable' => self::STABILITY_STABLE,
  21149. 'RC' => self::STABILITY_RC,
  21150. 'beta' => self::STABILITY_BETA,
  21151. 'alpha' => self::STABILITY_ALPHA,
  21152. 'dev' => self::STABILITY_DEV,
  21153. );
  21154. public $id;
  21155. protected $name;
  21156. protected $prettyName;
  21157. protected $repository = null;
  21158. public function __construct(string $name)
  21159. {
  21160. $this->prettyName = $name;
  21161. $this->name = strtolower($name);
  21162. $this->id = -1;
  21163. }
  21164. public function getName(): string
  21165. {
  21166. return $this->name;
  21167. }
  21168. public function getPrettyName(): string
  21169. {
  21170. return $this->prettyName;
  21171. }
  21172. public function getNames($provides = true): array
  21173. {
  21174. $names = array(
  21175. $this->getName() => true,
  21176. );
  21177. if ($provides) {
  21178. foreach ($this->getProvides() as $link) {
  21179. $names[$link->getTarget()] = true;
  21180. }
  21181. }
  21182. foreach ($this->getReplaces() as $link) {
  21183. $names[$link->getTarget()] = true;
  21184. }
  21185. return array_keys($names);
  21186. }
  21187. public function setId(int $id): void
  21188. {
  21189. $this->id = $id;
  21190. }
  21191. public function getId(): int
  21192. {
  21193. return $this->id;
  21194. }
  21195. public function setRepository(RepositoryInterface $repository): void
  21196. {
  21197. if ($this->repository && $repository !== $this->repository) {
  21198. throw new \LogicException('A package can only be added to one repository');
  21199. }
  21200. $this->repository = $repository;
  21201. }
  21202. public function getRepository(): ?RepositoryInterface
  21203. {
  21204. return $this->repository;
  21205. }
  21206. public function isPlatform(): bool
  21207. {
  21208. return $this->getRepository() instanceof PlatformRepository;
  21209. }
  21210. public function getUniqueName(): string
  21211. {
  21212. return $this->getName().'-'.$this->getVersion();
  21213. }
  21214. public function equals(PackageInterface $package): bool
  21215. {
  21216. $self = $this;
  21217. if ($this instanceof AliasPackage) {
  21218. $self = $this->getAliasOf();
  21219. }
  21220. if ($package instanceof AliasPackage) {
  21221. $package = $package->getAliasOf();
  21222. }
  21223. return $package === $self;
  21224. }
  21225. public function __toString(): string
  21226. {
  21227. return $this->getUniqueName();
  21228. }
  21229. public function getPrettyString(): string
  21230. {
  21231. return $this->getPrettyName().' '.$this->getPrettyVersion();
  21232. }
  21233. public function getFullPrettyVersion(bool $truncate = true, int $displayMode = PackageInterface::DISPLAY_SOURCE_REF_IF_DEV): string
  21234. {
  21235. if ($displayMode === PackageInterface::DISPLAY_SOURCE_REF_IF_DEV &&
  21236. (!$this->isDev() || !\in_array($this->getSourceType(), array('hg', 'git')))
  21237. ) {
  21238. return $this->getPrettyVersion();
  21239. }
  21240. switch ($displayMode) {
  21241. case PackageInterface::DISPLAY_SOURCE_REF_IF_DEV:
  21242. case PackageInterface::DISPLAY_SOURCE_REF:
  21243. $reference = $this->getSourceReference();
  21244. break;
  21245. case PackageInterface::DISPLAY_DIST_REF:
  21246. $reference = $this->getDistReference();
  21247. break;
  21248. default:
  21249. throw new \UnexpectedValueException('Display mode '.$displayMode.' is not supported');
  21250. }
  21251. if (null === $reference) {
  21252. return $this->getPrettyVersion();
  21253. }
  21254. if ($truncate && \strlen($reference) === 40 && $this->getSourceType() !== 'svn') {
  21255. return $this->getPrettyVersion() . ' ' . substr($reference, 0, 7);
  21256. }
  21257. return $this->getPrettyVersion() . ' ' . $reference;
  21258. }
  21259. public function getStabilityPriority(): int
  21260. {
  21261. return self::$stabilities[$this->getStability()];
  21262. }
  21263. public function __clone()
  21264. {
  21265. $this->repository = null;
  21266. $this->id = -1;
  21267. }
  21268. public static function packageNameToRegexp(string $allowPattern, string $wrap = '{^%s$}i'): string
  21269. {
  21270. $cleanedAllowPattern = str_replace('\\*', '.*', preg_quote($allowPattern));
  21271. return sprintf($wrap, $cleanedAllowPattern);
  21272. }
  21273. public static function packageNamesToRegexp(array $packageNames, string $wrap = '{^(?:%s)$}iD'): string
  21274. {
  21275. $packageNames = array_map(
  21276. function ($packageName): string {
  21277. return BasePackage::packageNameToRegexp($packageName, '%s');
  21278. },
  21279. $packageNames
  21280. );
  21281. return sprintf($wrap, implode('|', $packageNames));
  21282. }
  21283. }
  21284. <?php declare(strict_types=1);
  21285. namespace Composer\Package\Comparer;
  21286. use Composer\Util\Platform;
  21287. class Comparer
  21288. {
  21289. private $source;
  21290. private $update;
  21291. private $changed;
  21292. public function setSource(string $source): void
  21293. {
  21294. $this->source = $source;
  21295. }
  21296. public function setUpdate(string $update): void
  21297. {
  21298. $this->update = $update;
  21299. }
  21300. public function getChanged(bool $explicated = false)
  21301. {
  21302. $changed = $this->changed;
  21303. if (!count($changed)) {
  21304. return false;
  21305. }
  21306. if ($explicated) {
  21307. foreach ($changed as $sectionKey => $itemSection) {
  21308. foreach ($itemSection as $itemKey => $item) {
  21309. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  21310. }
  21311. }
  21312. }
  21313. return $changed;
  21314. }
  21315. public function getChangedAsString(bool $toString = false, bool $explicated = false): string
  21316. {
  21317. $changed = $this->getChanged($explicated);
  21318. if (false === $changed) {
  21319. return '';
  21320. }
  21321. $strings = array();
  21322. foreach ($changed as $sectionKey => $itemSection) {
  21323. foreach ($itemSection as $itemKey => $item) {
  21324. $strings[] = $item."\r\n";
  21325. }
  21326. }
  21327. return trim(implode("\r\n", $strings));
  21328. }
  21329. public function doCompare(): void
  21330. {
  21331. $source = array();
  21332. $destination = array();
  21333. $this->changed = array();
  21334. $currentDirectory = Platform::getCwd();
  21335. chdir($this->source);
  21336. $source = $this->doTree('.', $source);
  21337. if (!is_array($source)) {
  21338. return;
  21339. }
  21340. chdir($currentDirectory);
  21341. chdir($this->update);
  21342. $destination = $this->doTree('.', $destination);
  21343. if (!is_array($destination)) {
  21344. exit;
  21345. }
  21346. chdir($currentDirectory);
  21347. foreach ($source as $dir => $value) {
  21348. foreach ($value as $file => $hash) {
  21349. if (isset($destination[$dir][$file])) {
  21350. if ($hash !== $destination[$dir][$file]) {
  21351. $this->changed['changed'][] = $dir.'/'.$file;
  21352. }
  21353. } else {
  21354. $this->changed['removed'][] = $dir.'/'.$file;
  21355. }
  21356. }
  21357. }
  21358. foreach ($destination as $dir => $value) {
  21359. foreach ($value as $file => $hash) {
  21360. if (!isset($source[$dir][$file])) {
  21361. $this->changed['added'][] = $dir.'/'.$file;
  21362. }
  21363. }
  21364. }
  21365. }
  21366. private function doTree(string $dir, array &$array)
  21367. {
  21368. if ($dh = opendir($dir)) {
  21369. while ($file = readdir($dh)) {
  21370. if ($file !== '.' && $file !== '..') {
  21371. if (is_link($dir.'/'.$file)) {
  21372. $array[$dir][$file] = readlink($dir.'/'.$file);
  21373. } elseif (is_dir($dir.'/'.$file)) {
  21374. if (!count($array)) {
  21375. $array[0] = 'Temp';
  21376. }
  21377. if (!$this->doTree($dir.'/'.$file, $array)) {
  21378. return false;
  21379. }
  21380. } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
  21381. $array[$dir][$file] = md5_file($dir.'/'.$file);
  21382. }
  21383. }
  21384. }
  21385. if (count($array) > 1 && isset($array['0'])) {
  21386. unset($array['0']);
  21387. }
  21388. return $array;
  21389. }
  21390. return false;
  21391. }
  21392. }
  21393. <?php declare(strict_types=1);
  21394. namespace Composer\Package;
  21395. class CompleteAliasPackage extends AliasPackage implements CompletePackageInterface
  21396. {
  21397. protected $aliasOf;
  21398. public function __construct(CompletePackage $aliasOf, string $version, string $prettyVersion)
  21399. {
  21400. parent::__construct($aliasOf, $version, $prettyVersion);
  21401. }
  21402. public function getAliasOf()
  21403. {
  21404. return $this->aliasOf;
  21405. }
  21406. public function getScripts(): array
  21407. {
  21408. return $this->aliasOf->getScripts();
  21409. }
  21410. public function setScripts(array $scripts): void
  21411. {
  21412. $this->aliasOf->setScripts($scripts);
  21413. }
  21414. public function getRepositories(): array
  21415. {
  21416. return $this->aliasOf->getRepositories();
  21417. }
  21418. public function setRepositories(array $repositories): void
  21419. {
  21420. $this->aliasOf->setRepositories($repositories);
  21421. }
  21422. public function getLicense(): array
  21423. {
  21424. return $this->aliasOf->getLicense();
  21425. }
  21426. public function setLicense(array $license): void
  21427. {
  21428. $this->aliasOf->setLicense($license);
  21429. }
  21430. public function getKeywords(): array
  21431. {
  21432. return $this->aliasOf->getKeywords();
  21433. }
  21434. public function setKeywords(array $keywords): void
  21435. {
  21436. $this->aliasOf->setKeywords($keywords);
  21437. }
  21438. public function getDescription(): ?string
  21439. {
  21440. return $this->aliasOf->getDescription();
  21441. }
  21442. public function setDescription(?string $description): void
  21443. {
  21444. $this->aliasOf->setDescription($description);
  21445. }
  21446. public function getHomepage(): ?string
  21447. {
  21448. return $this->aliasOf->getHomepage();
  21449. }
  21450. public function setHomepage(?string $homepage): void
  21451. {
  21452. $this->aliasOf->setHomepage($homepage);
  21453. }
  21454. public function getAuthors(): array
  21455. {
  21456. return $this->aliasOf->getAuthors();
  21457. }
  21458. public function setAuthors(array $authors): void
  21459. {
  21460. $this->aliasOf->setAuthors($authors);
  21461. }
  21462. public function getSupport(): array
  21463. {
  21464. return $this->aliasOf->getSupport();
  21465. }
  21466. public function setSupport(array $support): void
  21467. {
  21468. $this->aliasOf->setSupport($support);
  21469. }
  21470. public function getFunding(): array
  21471. {
  21472. return $this->aliasOf->getFunding();
  21473. }
  21474. public function setFunding(array $funding): void
  21475. {
  21476. $this->aliasOf->setFunding($funding);
  21477. }
  21478. public function isAbandoned(): bool
  21479. {
  21480. return $this->aliasOf->isAbandoned();
  21481. }
  21482. public function getReplacementPackage(): ?string
  21483. {
  21484. return $this->aliasOf->getReplacementPackage();
  21485. }
  21486. public function setAbandoned($abandoned): void
  21487. {
  21488. $this->aliasOf->setAbandoned($abandoned);
  21489. }
  21490. public function getArchiveName(): ?string
  21491. {
  21492. return $this->aliasOf->getArchiveName();
  21493. }
  21494. public function setArchiveName(?string $name): void
  21495. {
  21496. $this->aliasOf->setArchiveName($name);
  21497. }
  21498. public function getArchiveExcludes(): array
  21499. {
  21500. return $this->aliasOf->getArchiveExcludes();
  21501. }
  21502. public function setArchiveExcludes(array $excludes): void
  21503. {
  21504. $this->aliasOf->setArchiveExcludes($excludes);
  21505. }
  21506. }
  21507. <?php declare(strict_types=1);
  21508. namespace Composer\Package;
  21509. class CompletePackage extends Package implements CompletePackageInterface
  21510. {
  21511. protected $repositories = array();
  21512. protected $license = array();
  21513. protected $keywords = array();
  21514. protected $authors = array();
  21515. protected $description = null;
  21516. protected $homepage = null;
  21517. protected $scripts = array();
  21518. protected $support = array();
  21519. protected $funding = array();
  21520. protected $abandoned = false;
  21521. protected $archiveName = null;
  21522. protected $archiveExcludes = array();
  21523. public function setScripts(array $scripts): void
  21524. {
  21525. $this->scripts = $scripts;
  21526. }
  21527. public function getScripts(): array
  21528. {
  21529. return $this->scripts;
  21530. }
  21531. public function setRepositories(array $repositories): void
  21532. {
  21533. $this->repositories = $repositories;
  21534. }
  21535. public function getRepositories(): array
  21536. {
  21537. return $this->repositories;
  21538. }
  21539. public function setLicense(array $license): void
  21540. {
  21541. $this->license = $license;
  21542. }
  21543. public function getLicense(): array
  21544. {
  21545. return $this->license;
  21546. }
  21547. public function setKeywords(array $keywords): void
  21548. {
  21549. $this->keywords = $keywords;
  21550. }
  21551. public function getKeywords(): array
  21552. {
  21553. return $this->keywords;
  21554. }
  21555. public function setAuthors(array $authors): void
  21556. {
  21557. $this->authors = $authors;
  21558. }
  21559. public function getAuthors(): array
  21560. {
  21561. return $this->authors;
  21562. }
  21563. public function setDescription(?string $description): void
  21564. {
  21565. $this->description = $description;
  21566. }
  21567. public function getDescription(): ?string
  21568. {
  21569. return $this->description;
  21570. }
  21571. public function setHomepage(?string $homepage): void
  21572. {
  21573. $this->homepage = $homepage;
  21574. }
  21575. public function getHomepage(): ?string
  21576. {
  21577. return $this->homepage;
  21578. }
  21579. public function setSupport(array $support): void
  21580. {
  21581. $this->support = $support;
  21582. }
  21583. public function getSupport(): array
  21584. {
  21585. return $this->support;
  21586. }
  21587. public function setFunding(array $funding): void
  21588. {
  21589. $this->funding = $funding;
  21590. }
  21591. public function getFunding(): array
  21592. {
  21593. return $this->funding;
  21594. }
  21595. public function isAbandoned(): bool
  21596. {
  21597. return (bool) $this->abandoned;
  21598. }
  21599. public function setAbandoned($abandoned): void
  21600. {
  21601. $this->abandoned = $abandoned;
  21602. }
  21603. public function getReplacementPackage(): ?string
  21604. {
  21605. return \is_string($this->abandoned) ? $this->abandoned : null;
  21606. }
  21607. public function setArchiveName(?string $name): void
  21608. {
  21609. $this->archiveName = $name;
  21610. }
  21611. public function getArchiveName(): ?string
  21612. {
  21613. return $this->archiveName;
  21614. }
  21615. public function setArchiveExcludes(array $excludes): void
  21616. {
  21617. $this->archiveExcludes = $excludes;
  21618. }
  21619. public function getArchiveExcludes(): array
  21620. {
  21621. return $this->archiveExcludes;
  21622. }
  21623. }
  21624. <?php declare(strict_types=1);
  21625. namespace Composer\Package;
  21626. interface CompletePackageInterface extends PackageInterface
  21627. {
  21628. public function getScripts(): array;
  21629. public function setScripts(array $scripts): void;
  21630. public function getRepositories(): array;
  21631. public function setRepositories(array $repositories): void;
  21632. public function getLicense(): array;
  21633. public function setLicense(array $license): void;
  21634. public function getKeywords(): array;
  21635. public function setKeywords(array $keywords): void;
  21636. public function getDescription(): ?string;
  21637. public function setDescription(string $description): void;
  21638. public function getHomepage(): ?string;
  21639. public function setHomepage(string $homepage): void;
  21640. public function getAuthors(): array;
  21641. public function setAuthors(array $authors): void;
  21642. public function getSupport(): array;
  21643. public function setSupport(array $support): void;
  21644. public function getFunding(): array;
  21645. public function setFunding(array $funding): void;
  21646. public function isAbandoned(): bool;
  21647. public function getReplacementPackage(): ?string;
  21648. public function setAbandoned($abandoned): void;
  21649. public function getArchiveName(): ?string;
  21650. public function setArchiveName(string $name): void;
  21651. public function getArchiveExcludes(): array;
  21652. public function setArchiveExcludes(array $excludes): void;
  21653. }
  21654. <?php declare(strict_types=1);
  21655. namespace Composer\Package\Dumper;
  21656. use Composer\Package\BasePackage;
  21657. use Composer\Package\PackageInterface;
  21658. use Composer\Package\CompletePackageInterface;
  21659. use Composer\Package\RootPackageInterface;
  21660. class ArrayDumper
  21661. {
  21662. public function dump(PackageInterface $package): array
  21663. {
  21664. $keys = array(
  21665. 'binaries' => 'bin',
  21666. 'type',
  21667. 'extra',
  21668. 'installationSource' => 'installation-source',
  21669. 'autoload',
  21670. 'devAutoload' => 'autoload-dev',
  21671. 'notificationUrl' => 'notification-url',
  21672. 'includePaths' => 'include-path',
  21673. );
  21674. $data = array();
  21675. $data['name'] = $package->getPrettyName();
  21676. $data['version'] = $package->getPrettyVersion();
  21677. $data['version_normalized'] = $package->getVersion();
  21678. if ($package->getTargetDir()) {
  21679. $data['target-dir'] = $package->getTargetDir();
  21680. }
  21681. if ($package->getSourceType()) {
  21682. $data['source']['type'] = $package->getSourceType();
  21683. $data['source']['url'] = $package->getSourceUrl();
  21684. if (null !== ($value = $package->getSourceReference())) {
  21685. $data['source']['reference'] = $value;
  21686. }
  21687. if ($mirrors = $package->getSourceMirrors()) {
  21688. $data['source']['mirrors'] = $mirrors;
  21689. }
  21690. }
  21691. if ($package->getDistType()) {
  21692. $data['dist']['type'] = $package->getDistType();
  21693. $data['dist']['url'] = $package->getDistUrl();
  21694. if (null !== ($value = $package->getDistReference())) {
  21695. $data['dist']['reference'] = $value;
  21696. }
  21697. if (null !== ($value = $package->getDistSha1Checksum())) {
  21698. $data['dist']['shasum'] = $value;
  21699. }
  21700. if ($mirrors = $package->getDistMirrors()) {
  21701. $data['dist']['mirrors'] = $mirrors;
  21702. }
  21703. }
  21704. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  21705. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  21706. foreach ($links as $link) {
  21707. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  21708. }
  21709. ksort($data[$type]);
  21710. }
  21711. }
  21712. if ($packages = $package->getSuggests()) {
  21713. ksort($packages);
  21714. $data['suggest'] = $packages;
  21715. }
  21716. if ($package->getReleaseDate() instanceof \DateTimeInterface) {
  21717. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  21718. }
  21719. if ($package->isDefaultBranch()) {
  21720. $data['default-branch'] = true;
  21721. }
  21722. $data = $this->dumpValues($package, $keys, $data);
  21723. if ($package instanceof CompletePackageInterface) {
  21724. if ($package->getArchiveName()) {
  21725. $data['archive']['name'] = $package->getArchiveName();
  21726. }
  21727. if ($package->getArchiveExcludes()) {
  21728. $data['archive']['exclude'] = $package->getArchiveExcludes();
  21729. }
  21730. $keys = array(
  21731. 'scripts',
  21732. 'license',
  21733. 'authors',
  21734. 'description',
  21735. 'homepage',
  21736. 'keywords',
  21737. 'repositories',
  21738. 'support',
  21739. 'funding',
  21740. );
  21741. $data = $this->dumpValues($package, $keys, $data);
  21742. if (isset($data['keywords']) && \is_array($data['keywords'])) {
  21743. sort($data['keywords']);
  21744. }
  21745. if ($package->isAbandoned()) {
  21746. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  21747. }
  21748. }
  21749. if ($package instanceof RootPackageInterface) {
  21750. $minimumStability = $package->getMinimumStability();
  21751. if ($minimumStability) {
  21752. $data['minimum-stability'] = $minimumStability;
  21753. }
  21754. }
  21755. if (\count($package->getTransportOptions()) > 0) {
  21756. $data['transport-options'] = $package->getTransportOptions();
  21757. }
  21758. return $data;
  21759. }
  21760. private function dumpValues(PackageInterface $package, array $keys, array $data): array
  21761. {
  21762. foreach ($keys as $method => $key) {
  21763. if (is_numeric($method)) {
  21764. $method = $key;
  21765. }
  21766. $getter = 'get'.ucfirst($method);
  21767. $value = $package->$getter();
  21768. if (null !== $value && !(\is_array($value) && 0 === \count($value))) {
  21769. $data[$key] = $value;
  21770. }
  21771. }
  21772. return $data;
  21773. }
  21774. }
  21775. <?php declare(strict_types=1);
  21776. namespace Composer\Package;
  21777. use Composer\Semver\Constraint\ConstraintInterface;
  21778. class Link
  21779. {
  21780. public const TYPE_REQUIRE = 'requires';
  21781. public const TYPE_DEV_REQUIRE = 'devRequires';
  21782. public const TYPE_PROVIDE = 'provides';
  21783. public const TYPE_CONFLICT = 'conflicts';
  21784. public const TYPE_REPLACE = 'replaces';
  21785. public const TYPE_DOES_NOT_REQUIRE = 'does not require';
  21786. private const TYPE_UNKNOWN = 'relates to';
  21787. public static $TYPES = array(
  21788. self::TYPE_REQUIRE,
  21789. self::TYPE_DEV_REQUIRE,
  21790. self::TYPE_PROVIDE,
  21791. self::TYPE_CONFLICT,
  21792. self::TYPE_REPLACE,
  21793. );
  21794. protected $source;
  21795. protected $target;
  21796. protected $constraint;
  21797. protected $description;
  21798. protected $prettyConstraint;
  21799. public function __construct(
  21800. string $source,
  21801. string $target,
  21802. ConstraintInterface $constraint,
  21803. $description = self::TYPE_UNKNOWN,
  21804. ?string $prettyConstraint = null
  21805. ) {
  21806. $this->source = strtolower($source);
  21807. $this->target = strtolower($target);
  21808. $this->constraint = $constraint;
  21809. $this->description = self::TYPE_DEV_REQUIRE === $description ? 'requires (for development)' : $description;
  21810. $this->prettyConstraint = $prettyConstraint;
  21811. }
  21812. public function getDescription(): string
  21813. {
  21814. return $this->description;
  21815. }
  21816. public function getSource(): string
  21817. {
  21818. return $this->source;
  21819. }
  21820. public function getTarget(): string
  21821. {
  21822. return $this->target;
  21823. }
  21824. public function getConstraint(): ConstraintInterface
  21825. {
  21826. return $this->constraint;
  21827. }
  21828. public function getPrettyConstraint(): string
  21829. {
  21830. if (null === $this->prettyConstraint) {
  21831. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  21832. }
  21833. return $this->prettyConstraint;
  21834. }
  21835. public function __toString(): string
  21836. {
  21837. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  21838. }
  21839. public function getPrettyString(PackageInterface $sourcePackage): string
  21840. {
  21841. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString();
  21842. }
  21843. }
  21844. <?php declare(strict_types=1);
  21845. namespace Composer\Package\Loader;
  21846. use Composer\Package\BasePackage;
  21847. use Composer\Package\CompleteAliasPackage;
  21848. use Composer\Package\CompletePackage;
  21849. use Composer\Package\RootPackage;
  21850. use Composer\Package\PackageInterface;
  21851. use Composer\Package\CompletePackageInterface;
  21852. use Composer\Package\Link;
  21853. use Composer\Package\RootAliasPackage;
  21854. use Composer\Package\Version\VersionParser;
  21855. use Composer\Pcre\Preg;
  21856. class ArrayLoader implements LoaderInterface
  21857. {
  21858. protected $versionParser;
  21859. protected $loadOptions;
  21860. public function __construct(VersionParser $parser = null, bool $loadOptions = false)
  21861. {
  21862. if (!$parser) {
  21863. $parser = new VersionParser;
  21864. }
  21865. $this->versionParser = $parser;
  21866. $this->loadOptions = $loadOptions;
  21867. }
  21868. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
  21869. {
  21870. if ($class !== 'Composer\Package\CompletePackage' && $class !== 'Composer\Package\RootPackage') {
  21871. trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
  21872. }
  21873. $package = $this->createObject($config, $class);
  21874. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  21875. if (isset($config[$type])) {
  21876. $method = 'set'.ucfirst($opts['method']);
  21877. $package->{$method}(
  21878. $this->parseLinks(
  21879. $package->getName(),
  21880. $package->getPrettyVersion(),
  21881. $opts['method'],
  21882. $config[$type]
  21883. )
  21884. );
  21885. }
  21886. }
  21887. $package = $this->configureObject($package, $config);
  21888. return $package;
  21889. }
  21890. public function loadPackages(array $versions): array
  21891. {
  21892. $packages = array();
  21893. $linkCache = array();
  21894. foreach ($versions as $version) {
  21895. $package = $this->createObject($version, 'Composer\Package\CompletePackage');
  21896. $this->configureCachedLinks($linkCache, $package, $version);
  21897. $package = $this->configureObject($package, $version);
  21898. $packages[] = $package;
  21899. }
  21900. return $packages;
  21901. }
  21902. private function createObject(array $config, string $class): CompletePackage
  21903. {
  21904. if (!isset($config['name'])) {
  21905. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  21906. }
  21907. if (!isset($config['version']) || !is_scalar($config['version'])) {
  21908. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  21909. }
  21910. if (!is_string($config['version'])) {
  21911. $config['version'] = (string) $config['version'];
  21912. }
  21913. if (isset($config['version_normalized']) && is_string($config['version_normalized'])) {
  21914. $version = $config['version_normalized'];
  21915. if ($version === VersionParser::DEFAULT_BRANCH_ALIAS) {
  21916. $version = $this->versionParser->normalize($config['version']);
  21917. }
  21918. } else {
  21919. $version = $this->versionParser->normalize($config['version']);
  21920. }
  21921. return new $class($config['name'], $version, $config['version']);
  21922. }
  21923. private function configureObject(PackageInterface $package, array $config): BasePackage
  21924. {
  21925. if (!$package instanceof CompletePackage) {
  21926. throw new \LogicException('ArrayLoader expects instances of the Composer\Package\CompletePackage class to function correctly');
  21927. }
  21928. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  21929. if (isset($config['target-dir'])) {
  21930. $package->setTargetDir($config['target-dir']);
  21931. }
  21932. if (isset($config['extra']) && \is_array($config['extra'])) {
  21933. $package->setExtra($config['extra']);
  21934. }
  21935. if (isset($config['bin'])) {
  21936. if (!\is_array($config['bin'])) {
  21937. $config['bin'] = array($config['bin']);
  21938. }
  21939. foreach ($config['bin'] as $key => $bin) {
  21940. $config['bin'][$key] = ltrim($bin, '/');
  21941. }
  21942. $package->setBinaries($config['bin']);
  21943. }
  21944. if (isset($config['installation-source'])) {
  21945. $package->setInstallationSource($config['installation-source']);
  21946. }
  21947. if (isset($config['default-branch']) && $config['default-branch'] === true) {
  21948. $package->setIsDefaultBranch(true);
  21949. }
  21950. if (isset($config['source'])) {
  21951. if (!isset($config['source']['type'], $config['source']['url'], $config['source']['reference'])) {
  21952. throw new \UnexpectedValueException(sprintf(
  21953. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  21954. $config['name'],
  21955. json_encode($config['source'])
  21956. ));
  21957. }
  21958. $package->setSourceType($config['source']['type']);
  21959. $package->setSourceUrl($config['source']['url']);
  21960. $package->setSourceReference(isset($config['source']['reference']) ? (string) $config['source']['reference'] : null);
  21961. if (isset($config['source']['mirrors'])) {
  21962. $package->setSourceMirrors($config['source']['mirrors']);
  21963. }
  21964. }
  21965. if (isset($config['dist'])) {
  21966. if (!isset($config['dist']['type'], $config['dist']['url'])) {
  21967. throw new \UnexpectedValueException(sprintf(
  21968. "Package %s's dist key should be specified as ".
  21969. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  21970. $config['name'],
  21971. json_encode($config['dist'])
  21972. ));
  21973. }
  21974. $package->setDistType($config['dist']['type']);
  21975. $package->setDistUrl($config['dist']['url']);
  21976. $package->setDistReference(isset($config['dist']['reference']) ? (string) $config['dist']['reference'] : null);
  21977. $package->setDistSha1Checksum($config['dist']['shasum'] ?? null);
  21978. if (isset($config['dist']['mirrors'])) {
  21979. $package->setDistMirrors($config['dist']['mirrors']);
  21980. }
  21981. }
  21982. if (isset($config['suggest']) && \is_array($config['suggest'])) {
  21983. foreach ($config['suggest'] as $target => $reason) {
  21984. if ('self.version' === trim($reason)) {
  21985. $config['suggest'][$target] = $package->getPrettyVersion();
  21986. }
  21987. }
  21988. $package->setSuggests($config['suggest']);
  21989. }
  21990. if (isset($config['autoload'])) {
  21991. $package->setAutoload($config['autoload']);
  21992. }
  21993. if (isset($config['autoload-dev'])) {
  21994. $package->setDevAutoload($config['autoload-dev']);
  21995. }
  21996. if (isset($config['include-path'])) {
  21997. $package->setIncludePaths($config['include-path']);
  21998. }
  21999. if (!empty($config['time'])) {
  22000. $time = Preg::isMatch('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  22001. try {
  22002. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  22003. $package->setReleaseDate($date);
  22004. } catch (\Exception $e) {
  22005. }
  22006. }
  22007. if (!empty($config['notification-url'])) {
  22008. $package->setNotificationUrl($config['notification-url']);
  22009. }
  22010. if ($package instanceof CompletePackageInterface) {
  22011. if (!empty($config['archive']['name'])) {
  22012. $package->setArchiveName($config['archive']['name']);
  22013. }
  22014. if (!empty($config['archive']['exclude'])) {
  22015. $package->setArchiveExcludes($config['archive']['exclude']);
  22016. }
  22017. if (isset($config['scripts']) && \is_array($config['scripts'])) {
  22018. foreach ($config['scripts'] as $event => $listeners) {
  22019. $config['scripts'][$event] = (array) $listeners;
  22020. }
  22021. foreach (array('composer', 'php', 'putenv') as $reserved) {
  22022. if (isset($config['scripts'][$reserved])) {
  22023. trigger_error('The `'.$reserved.'` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  22024. }
  22025. }
  22026. $package->setScripts($config['scripts']);
  22027. }
  22028. if (!empty($config['description']) && \is_string($config['description'])) {
  22029. $package->setDescription($config['description']);
  22030. }
  22031. if (!empty($config['homepage']) && \is_string($config['homepage'])) {
  22032. $package->setHomepage($config['homepage']);
  22033. }
  22034. if (!empty($config['keywords']) && \is_array($config['keywords'])) {
  22035. $package->setKeywords($config['keywords']);
  22036. }
  22037. if (!empty($config['license'])) {
  22038. $package->setLicense(\is_array($config['license']) ? $config['license'] : array($config['license']));
  22039. }
  22040. if (!empty($config['authors']) && \is_array($config['authors'])) {
  22041. $package->setAuthors($config['authors']);
  22042. }
  22043. if (isset($config['support'])) {
  22044. $package->setSupport($config['support']);
  22045. }
  22046. if (!empty($config['funding']) && \is_array($config['funding'])) {
  22047. $package->setFunding($config['funding']);
  22048. }
  22049. if (isset($config['abandoned'])) {
  22050. $package->setAbandoned($config['abandoned']);
  22051. }
  22052. }
  22053. if ($this->loadOptions && isset($config['transport-options'])) {
  22054. $package->setTransportOptions($config['transport-options']);
  22055. }
  22056. if ($aliasNormalized = $this->getBranchAlias($config)) {
  22057. $prettyAlias = Preg::replace('{(\.9{7})+}', '.x', $aliasNormalized);
  22058. if ($package instanceof RootPackage) {
  22059. return new RootAliasPackage($package, $aliasNormalized, $prettyAlias);
  22060. }
  22061. return new CompleteAliasPackage($package, $aliasNormalized, $prettyAlias);
  22062. }
  22063. return $package;
  22064. }
  22065. private function configureCachedLinks(array &$linkCache, PackageInterface $package, array $config): void
  22066. {
  22067. $name = $package->getName();
  22068. $prettyVersion = $package->getPrettyVersion();
  22069. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  22070. if (isset($config[$type])) {
  22071. $method = 'set'.ucfirst($opts['method']);
  22072. $links = array();
  22073. foreach ($config[$type] as $prettyTarget => $constraint) {
  22074. $target = strtolower($prettyTarget);
  22075. if ($target === $name) {
  22076. continue;
  22077. }
  22078. if ($constraint === 'self.version') {
  22079. $links[$target] = $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint);
  22080. } else {
  22081. if (!isset($linkCache[$name][$type][$target][$constraint])) {
  22082. $linkCache[$name][$type][$target][$constraint] = array($target, $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint));
  22083. }
  22084. list($target, $link) = $linkCache[$name][$type][$target][$constraint];
  22085. $links[$target] = $link;
  22086. }
  22087. }
  22088. $package->{$method}($links);
  22089. }
  22090. }
  22091. }
  22092. public function parseLinks(string $source, string $sourceVersion, string $description, array $links): array
  22093. {
  22094. $res = array();
  22095. foreach ($links as $target => $constraint) {
  22096. $target = strtolower((string) $target);
  22097. $res[$target] = $this->createLink($source, $sourceVersion, $description, $target, $constraint);
  22098. }
  22099. return $res;
  22100. }
  22101. private function createLink(string $source, string $sourceVersion, string $description, string $target, string $prettyConstraint): Link
  22102. {
  22103. if (!\is_string($prettyConstraint)) {
  22104. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')');
  22105. }
  22106. if ('self.version' === $prettyConstraint) {
  22107. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  22108. } else {
  22109. $parsedConstraint = $this->versionParser->parseConstraints($prettyConstraint);
  22110. }
  22111. return new Link($source, $target, $parsedConstraint, $description, $prettyConstraint);
  22112. }
  22113. public function getBranchAlias(array $config): ?string
  22114. {
  22115. if (!isset($config['version']) || !is_scalar($config['version'])) {
  22116. throw new \UnexpectedValueException('no/invalid version defined');
  22117. }
  22118. if (!is_string($config['version'])) {
  22119. $config['version'] = (string) $config['version'];
  22120. }
  22121. if (strpos($config['version'], 'dev-') !== 0 && '-dev' !== substr($config['version'], -4)) {
  22122. return null;
  22123. }
  22124. if (isset($config['extra']['branch-alias']) && \is_array($config['extra']['branch-alias'])) {
  22125. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  22126. $sourceBranch = (string) $sourceBranch;
  22127. if ('-dev' !== substr($targetBranch, -4)) {
  22128. continue;
  22129. }
  22130. if ($targetBranch === VersionParser::DEFAULT_BRANCH_ALIAS) {
  22131. $validatedTargetBranch = VersionParser::DEFAULT_BRANCH_ALIAS;
  22132. } else {
  22133. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  22134. }
  22135. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  22136. continue;
  22137. }
  22138. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  22139. continue;
  22140. }
  22141. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  22142. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  22143. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  22144. ) {
  22145. continue;
  22146. }
  22147. return $validatedTargetBranch;
  22148. }
  22149. }
  22150. if (
  22151. isset($config['default-branch'])
  22152. && $config['default-branch'] === true
  22153. && false === $this->versionParser->parseNumericAliasPrefix($config['version'])
  22154. ) {
  22155. return VersionParser::DEFAULT_BRANCH_ALIAS;
  22156. }
  22157. return null;
  22158. }
  22159. }
  22160. <?php declare(strict_types=1);
  22161. namespace Composer\Package\Loader;
  22162. class InvalidPackageException extends \Exception
  22163. {
  22164. private $errors;
  22165. private $warnings;
  22166. private $data;
  22167. public function __construct(array $errors, array $warnings, array $data)
  22168. {
  22169. $this->errors = $errors;
  22170. $this->warnings = $warnings;
  22171. $this->data = $data;
  22172. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  22173. }
  22174. public function getData(): array
  22175. {
  22176. return $this->data;
  22177. }
  22178. public function getErrors(): array
  22179. {
  22180. return $this->errors;
  22181. }
  22182. public function getWarnings(): array
  22183. {
  22184. return $this->warnings;
  22185. }
  22186. }
  22187. <?php declare(strict_types=1);
  22188. namespace Composer\Package\Loader;
  22189. use Composer\Json\JsonFile;
  22190. use Composer\Package\BasePackage;
  22191. use Composer\Package\CompletePackage;
  22192. use Composer\Package\CompleteAliasPackage;
  22193. use Composer\Package\RootPackage;
  22194. use Composer\Package\RootAliasPackage;
  22195. class JsonLoader
  22196. {
  22197. private $loader;
  22198. public function __construct(LoaderInterface $loader)
  22199. {
  22200. $this->loader = $loader;
  22201. }
  22202. public function load($json): BasePackage
  22203. {
  22204. if ($json instanceof JsonFile) {
  22205. $config = $json->read();
  22206. } elseif (file_exists($json)) {
  22207. $config = JsonFile::parseJson(file_get_contents($json), $json);
  22208. } elseif (is_string($json)) {
  22209. $config = JsonFile::parseJson($json);
  22210. } else {
  22211. throw new \InvalidArgumentException(sprintf(
  22212. "JsonLoader: Unknown \$json parameter %s. Please report at https://github.com/composer/composer/issues/new.",
  22213. gettype($json)
  22214. ));
  22215. }
  22216. return $this->loader->load($config);
  22217. }
  22218. }
  22219. <?php declare(strict_types=1);
  22220. namespace Composer\Package\Loader;
  22221. use Composer\Package\CompletePackage;
  22222. use Composer\Package\CompleteAliasPackage;
  22223. use Composer\Package\RootAliasPackage;
  22224. use Composer\Package\RootPackage;
  22225. use Composer\Package\BasePackage;
  22226. interface LoaderInterface
  22227. {
  22228. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage;
  22229. }
  22230. <?php declare(strict_types=1);
  22231. namespace Composer\Package\Loader;
  22232. use Composer\Package\BasePackage;
  22233. use Composer\Config;
  22234. use Composer\IO\IOInterface;
  22235. use Composer\Package\RootAliasPackage;
  22236. use Composer\Pcre\Preg;
  22237. use Composer\Repository\RepositoryFactory;
  22238. use Composer\Package\Version\VersionGuesser;
  22239. use Composer\Package\Version\VersionParser;
  22240. use Composer\Package\RootPackage;
  22241. use Composer\Repository\RepositoryManager;
  22242. use Composer\Util\Platform;
  22243. use Composer\Util\ProcessExecutor;
  22244. class RootPackageLoader extends ArrayLoader
  22245. {
  22246. private $manager;
  22247. private $config;
  22248. private $versionGuesser;
  22249. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  22250. {
  22251. parent::__construct($parser);
  22252. $this->manager = $manager;
  22253. $this->config = $config;
  22254. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor($io), $this->versionParser);
  22255. }
  22256. public function load(array $config, string $class = 'Composer\Package\RootPackage', ?string $cwd = null): BasePackage
  22257. {
  22258. if ($class !== 'Composer\Package\RootPackage') {
  22259. trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
  22260. }
  22261. if (!isset($config['name'])) {
  22262. $config['name'] = '__root__';
  22263. } elseif ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  22264. throw new \RuntimeException('Your package name '.$err);
  22265. }
  22266. $autoVersioned = false;
  22267. if (!isset($config['version'])) {
  22268. $commit = null;
  22269. if (Platform::getEnv('COMPOSER_ROOT_VERSION')) {
  22270. $config['version'] = Platform::getEnv('COMPOSER_ROOT_VERSION');
  22271. } else {
  22272. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?? Platform::getCwd(true));
  22273. if ($versionData) {
  22274. $config['version'] = $versionData['pretty_version'];
  22275. $config['version_normalized'] = $versionData['version'];
  22276. $commit = $versionData['commit'];
  22277. }
  22278. }
  22279. if (!isset($config['version'])) {
  22280. $config['version'] = '1.0.0';
  22281. $autoVersioned = true;
  22282. }
  22283. if ($commit) {
  22284. $config['source'] = array(
  22285. 'type' => '',
  22286. 'url' => '',
  22287. 'reference' => $commit,
  22288. );
  22289. $config['dist'] = array(
  22290. 'type' => '',
  22291. 'url' => '',
  22292. 'reference' => $commit,
  22293. );
  22294. }
  22295. }
  22296. $package = parent::load($config, $class);
  22297. if ($package instanceof RootAliasPackage) {
  22298. $realPackage = $package->getAliasOf();
  22299. } else {
  22300. $realPackage = $package;
  22301. }
  22302. if (!$realPackage instanceof RootPackage) {
  22303. throw new \LogicException('Expecting a Composer\Package\RootPackage at this point');
  22304. }
  22305. if ($autoVersioned) {
  22306. $realPackage->replaceVersion($realPackage->getVersion(), RootPackage::DEFAULT_PRETTY_VERSION);
  22307. }
  22308. if (isset($config['minimum-stability'])) {
  22309. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  22310. }
  22311. $aliases = array();
  22312. $stabilityFlags = array();
  22313. $references = array();
  22314. foreach (array('require', 'require-dev') as $linkType) {
  22315. if (isset($config[$linkType])) {
  22316. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  22317. $method = 'get'.ucfirst($linkInfo['method']);
  22318. $links = array();
  22319. foreach ($realPackage->$method() as $link) {
  22320. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  22321. }
  22322. $aliases = $this->extractAliases($links, $aliases);
  22323. $stabilityFlags = self::extractStabilityFlags($links, $realPackage->getMinimumStability(), $stabilityFlags);
  22324. $references = self::extractReferences($links, $references);
  22325. if (isset($links[$config['name']])) {
  22326. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  22327. 'Did you accidentally name your root package after an external package?', $config['name']));
  22328. }
  22329. }
  22330. }
  22331. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  22332. if (isset($config[$linkType])) {
  22333. foreach ($config[$linkType] as $linkName => $constraint) {
  22334. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  22335. throw new \RuntimeException($linkType.'.'.$err);
  22336. }
  22337. }
  22338. }
  22339. }
  22340. $realPackage->setAliases($aliases);
  22341. $realPackage->setStabilityFlags($stabilityFlags);
  22342. $realPackage->setReferences($references);
  22343. if (isset($config['prefer-stable'])) {
  22344. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  22345. }
  22346. if (isset($config['config'])) {
  22347. $realPackage->setConfig($config['config']);
  22348. }
  22349. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  22350. foreach ($repos as $repo) {
  22351. $this->manager->addRepository($repo);
  22352. }
  22353. $realPackage->setRepositories($this->config->getRepositories());
  22354. return $package;
  22355. }
  22356. private function extractAliases(array $requires, array $aliases): array
  22357. {
  22358. foreach ($requires as $reqName => $reqVersion) {
  22359. if (Preg::isMatch('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  22360. $aliases[] = array(
  22361. 'package' => strtolower($reqName),
  22362. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  22363. 'alias' => $match[2],
  22364. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  22365. );
  22366. } elseif (strpos($reqVersion, ' as ') !== false) {
  22367. throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".');
  22368. }
  22369. }
  22370. return $aliases;
  22371. }
  22372. public static function extractStabilityFlags(array $requires, string $minimumStability, array $stabilityFlags): array
  22373. {
  22374. $stabilities = BasePackage::$stabilities;
  22375. $minimumStability = $stabilities[$minimumStability];
  22376. foreach ($requires as $reqName => $reqVersion) {
  22377. $constraints = array();
  22378. $orSplit = Preg::split('{\s*\|\|?\s*}', trim($reqVersion));
  22379. foreach ($orSplit as $orConstraint) {
  22380. $andSplit = Preg::split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  22381. foreach ($andSplit as $andConstraint) {
  22382. $constraints[] = $andConstraint;
  22383. }
  22384. }
  22385. $matched = false;
  22386. foreach ($constraints as $constraint) {
  22387. if (Preg::isMatch('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  22388. $name = strtolower($reqName);
  22389. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  22390. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  22391. continue;
  22392. }
  22393. $stabilityFlags[$name] = $stability;
  22394. $matched = true;
  22395. }
  22396. }
  22397. if ($matched) {
  22398. continue;
  22399. }
  22400. foreach ($constraints as $constraint) {
  22401. $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  22402. if (Preg::isMatch('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  22403. $name = strtolower($reqName);
  22404. $stability = $stabilities[$stabilityName];
  22405. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  22406. continue;
  22407. }
  22408. $stabilityFlags[$name] = $stability;
  22409. }
  22410. }
  22411. }
  22412. return $stabilityFlags;
  22413. }
  22414. public static function extractReferences(array $requires, array $references): array
  22415. {
  22416. foreach ($requires as $reqName => $reqVersion) {
  22417. $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  22418. if (Preg::isMatch('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  22419. $name = strtolower($reqName);
  22420. $references[$name] = $match[1];
  22421. }
  22422. }
  22423. return $references;
  22424. }
  22425. }
  22426. <?php declare(strict_types=1);
  22427. namespace Composer\Package\Loader;
  22428. use Composer\Package\BasePackage;
  22429. use Composer\Pcre\Preg;
  22430. use Composer\Semver\Constraint\Constraint;
  22431. use Composer\Package\Version\VersionParser;
  22432. use Composer\Repository\PlatformRepository;
  22433. use Composer\Spdx\SpdxLicenses;
  22434. class ValidatingArrayLoader implements LoaderInterface
  22435. {
  22436. public const CHECK_ALL = 3;
  22437. public const CHECK_UNBOUND_CONSTRAINTS = 1;
  22438. public const CHECK_STRICT_CONSTRAINTS = 2;
  22439. private $loader;
  22440. private $versionParser;
  22441. private $errors;
  22442. private $warnings;
  22443. private $config;
  22444. private $flags;
  22445. public function __construct(LoaderInterface $loader, bool $strictName = true, VersionParser $parser = null, int $flags = 0)
  22446. {
  22447. $this->loader = $loader;
  22448. $this->versionParser = $parser ?: new VersionParser();
  22449. $this->flags = $flags;
  22450. if ($strictName !== true) {
  22451. trigger_error('$strictName must be set to true in ValidatingArrayLoader\'s constructor as of 2.2, and it will be removed in 3.0', E_USER_DEPRECATED);
  22452. }
  22453. }
  22454. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
  22455. {
  22456. $this->errors = array();
  22457. $this->warnings = array();
  22458. $this->config = $config;
  22459. $this->validateString('name', true);
  22460. if ($err = self::hasPackageNamingError($config['name'])) {
  22461. $this->errors[] = 'name : '.$err;
  22462. }
  22463. if (!empty($this->config['version'])) {
  22464. if (!is_scalar($this->config['version'])) {
  22465. $this->validateString('version');
  22466. } else {
  22467. if (!is_string($this->config['version'])) {
  22468. $this->config['version'] = (string) $this->config['version'];
  22469. }
  22470. try {
  22471. $this->versionParser->normalize($this->config['version']);
  22472. } catch (\Exception $e) {
  22473. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  22474. unset($this->config['version']);
  22475. }
  22476. }
  22477. }
  22478. if (!empty($this->config['config']['platform'])) {
  22479. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  22480. if (false === $platform) {
  22481. continue;
  22482. }
  22483. if (!is_string($platform)) {
  22484. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.gettype($platform).' '.var_export($platform, true).'): expected string or false';
  22485. continue;
  22486. }
  22487. try {
  22488. $this->versionParser->normalize($platform);
  22489. } catch (\Exception $e) {
  22490. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  22491. }
  22492. }
  22493. }
  22494. $this->validateRegex('type', '[A-Za-z0-9-]+');
  22495. $this->validateString('target-dir');
  22496. $this->validateArray('extra');
  22497. if (isset($this->config['bin'])) {
  22498. if (is_string($this->config['bin'])) {
  22499. $this->validateString('bin');
  22500. } else {
  22501. $this->validateFlatArray('bin');
  22502. }
  22503. }
  22504. $this->validateArray('scripts');
  22505. $this->validateString('description');
  22506. $this->validateUrl('homepage');
  22507. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  22508. $releaseDate = null;
  22509. $this->validateString('time');
  22510. if (!empty($this->config['time'])) {
  22511. try {
  22512. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  22513. } catch (\Exception $e) {
  22514. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  22515. unset($this->config['time']);
  22516. }
  22517. }
  22518. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  22519. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  22520. $licenses = (array) $this->config['license'];
  22521. $licenseValidator = new SpdxLicenses();
  22522. foreach ($licenses as $license) {
  22523. if ('proprietary' === $license) {
  22524. continue;
  22525. }
  22526. $licenseToValidate = str_replace('proprietary', 'MIT', $license);
  22527. if (!$licenseValidator->validate($licenseToValidate)) {
  22528. if ($licenseValidator->validate(trim($licenseToValidate))) {
  22529. $this->warnings[] = sprintf(
  22530. 'License %s must not contain extra spaces, make sure to trim it.',
  22531. json_encode($license)
  22532. );
  22533. } else {
  22534. $this->warnings[] = sprintf(
  22535. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  22536. 'If the software is closed-source, you may use "proprietary" as license.',
  22537. json_encode($license)
  22538. );
  22539. }
  22540. }
  22541. }
  22542. }
  22543. }
  22544. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  22545. foreach ($this->config['authors'] as $key => $author) {
  22546. if (!is_array($author)) {
  22547. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  22548. unset($this->config['authors'][$key]);
  22549. continue;
  22550. }
  22551. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  22552. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  22553. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  22554. unset($this->config['authors'][$key][$authorData]);
  22555. }
  22556. }
  22557. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  22558. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  22559. unset($this->config['authors'][$key]['homepage']);
  22560. }
  22561. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  22562. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  22563. unset($this->config['authors'][$key]['email']);
  22564. }
  22565. if (empty($this->config['authors'][$key])) {
  22566. unset($this->config['authors'][$key]);
  22567. }
  22568. }
  22569. if (empty($this->config['authors'])) {
  22570. unset($this->config['authors']);
  22571. }
  22572. }
  22573. if ($this->validateArray('support') && !empty($this->config['support'])) {
  22574. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  22575. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  22576. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  22577. unset($this->config['support'][$key]);
  22578. }
  22579. }
  22580. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  22581. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  22582. unset($this->config['support']['email']);
  22583. }
  22584. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc', 'ircs'))) {
  22585. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> or ircs:// URL';
  22586. unset($this->config['support']['irc']);
  22587. }
  22588. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  22589. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  22590. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  22591. unset($this->config['support'][$key]);
  22592. }
  22593. }
  22594. if (empty($this->config['support'])) {
  22595. unset($this->config['support']);
  22596. }
  22597. }
  22598. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  22599. foreach ($this->config['funding'] as $key => $fundingOption) {
  22600. if (!is_array($fundingOption)) {
  22601. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  22602. unset($this->config['funding'][$key]);
  22603. continue;
  22604. }
  22605. foreach (array('type', 'url') as $fundingData) {
  22606. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  22607. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  22608. unset($this->config['funding'][$key][$fundingData]);
  22609. }
  22610. }
  22611. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  22612. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  22613. unset($this->config['funding'][$key]['url']);
  22614. }
  22615. if (empty($this->config['funding'][$key])) {
  22616. unset($this->config['funding'][$key]);
  22617. }
  22618. }
  22619. if (empty($this->config['funding'])) {
  22620. unset($this->config['funding']);
  22621. }
  22622. }
  22623. $unboundConstraint = new Constraint('=', '10000000-dev');
  22624. $stableConstraint = new Constraint('=', '1.0.0');
  22625. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  22626. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  22627. foreach ($this->config[$linkType] as $package => $constraint) {
  22628. if (0 === strcasecmp($package, $this->config['name'])) {
  22629. $this->errors[] = $linkType.'.'.$package.' : a package cannot set a '.$linkType.' on itself';
  22630. unset($this->config[$linkType][$package]);
  22631. continue;
  22632. }
  22633. if ($err = self::hasPackageNamingError($package, true)) {
  22634. $this->errors[] = $linkType.'.'.$err;
  22635. } elseif (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $package)) {
  22636. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  22637. }
  22638. if (!is_string($constraint)) {
  22639. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  22640. unset($this->config[$linkType][$package]);
  22641. } elseif ('self.version' !== $constraint) {
  22642. try {
  22643. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  22644. } catch (\Exception $e) {
  22645. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  22646. unset($this->config[$linkType][$package]);
  22647. continue;
  22648. }
  22649. if (
  22650. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  22651. && 'require' === $linkType
  22652. && $linkConstraint->matches($unboundConstraint)
  22653. && !PlatformRepository::isPlatformPackage($package)
  22654. ) {
  22655. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  22656. } elseif (
  22657. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  22658. && 'require' === $linkType
  22659. && $linkConstraint instanceof Constraint && in_array($linkConstraint->getOperator(), ['==', '='], true)
  22660. && (new Constraint('>=', '1.0.0.0-dev'))->matches($linkConstraint)
  22661. ) {
  22662. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  22663. }
  22664. }
  22665. if ($linkType === 'conflict' && isset($this->config['replace']) && $keys = array_intersect_key($this->config['replace'], $this->config['conflict'])) {
  22666. $this->errors[] = $linkType.'.'.$package.' : you cannot conflict with a package that is also replaced, as replace already creates an implicit conflict rule';
  22667. unset($this->config[$linkType][$package]);
  22668. }
  22669. }
  22670. }
  22671. }
  22672. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  22673. foreach ($this->config['suggest'] as $package => $description) {
  22674. if (!is_string($description)) {
  22675. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  22676. unset($this->config['suggest'][$package]);
  22677. }
  22678. }
  22679. }
  22680. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  22681. if (!isset(BasePackage::$stabilities[strtolower($this->config['minimum-stability'])]) && $this->config['minimum-stability'] !== 'RC') {
  22682. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  22683. unset($this->config['minimum-stability']);
  22684. }
  22685. }
  22686. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  22687. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  22688. foreach ($this->config['autoload'] as $type => $typeConfig) {
  22689. if (!in_array($type, $types)) {
  22690. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  22691. unset($this->config['autoload'][$type]);
  22692. }
  22693. if ($type === 'psr-4') {
  22694. foreach ($typeConfig as $namespace => $dirs) {
  22695. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  22696. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  22697. }
  22698. }
  22699. }
  22700. }
  22701. }
  22702. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  22703. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  22704. unset($this->config['autoload']['psr-4']);
  22705. }
  22706. foreach (array('source', 'dist') as $srcType) {
  22707. if ($this->validateArray($srcType) && !empty($this->config[$srcType])) {
  22708. if (!isset($this->config[$srcType]['type'])) {
  22709. $this->errors[] = $srcType . '.type : must be present';
  22710. }
  22711. if (!isset($this->config[$srcType]['url'])) {
  22712. $this->errors[] = $srcType . '.url : must be present';
  22713. }
  22714. if ($srcType === 'source' && !isset($this->config[$srcType]['reference'])) {
  22715. $this->errors[] = $srcType . '.reference : must be present';
  22716. }
  22717. if (isset($this->config[$srcType]['type']) && !is_string($this->config[$srcType]['type'])) {
  22718. $this->errors[] = $srcType . '.type : should be a string, '.gettype($this->config[$srcType]['type']).' given';
  22719. }
  22720. if (isset($this->config[$srcType]['url']) && !is_string($this->config[$srcType]['url'])) {
  22721. $this->errors[] = $srcType . '.url : should be a string, '.gettype($this->config[$srcType]['url']).' given';
  22722. }
  22723. if (isset($this->config[$srcType]['reference']) && !is_string($this->config[$srcType]['reference']) && !is_int($this->config[$srcType]['reference'])) {
  22724. $this->errors[] = $srcType . '.reference : should be a string or int, '.gettype($this->config[$srcType]['reference']).' given';
  22725. }
  22726. if (isset($this->config[$srcType]['reference']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['reference'])) {
  22727. $this->errors[] = $srcType . '.reference : must not start with a "-", "'.$this->config[$srcType]['reference'].'" given';
  22728. }
  22729. if (isset($this->config[$srcType]['url']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['url'])) {
  22730. $this->errors[] = $srcType . '.url : must not start with a "-", "'.$this->config[$srcType]['url'].'" given';
  22731. }
  22732. }
  22733. }
  22734. $this->validateFlatArray('include-path');
  22735. $this->validateArray('transport-options');
  22736. if (isset($this->config['extra']['branch-alias'])) {
  22737. if (!is_array($this->config['extra']['branch-alias'])) {
  22738. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  22739. } else {
  22740. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  22741. if (!is_string($targetBranch)) {
  22742. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.json_encode($targetBranch).') must be a string, "'.gettype($targetBranch).'" received.';
  22743. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  22744. continue;
  22745. }
  22746. if ('-dev' !== substr($targetBranch, -4)) {
  22747. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  22748. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  22749. continue;
  22750. }
  22751. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  22752. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  22753. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  22754. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  22755. continue;
  22756. }
  22757. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  22758. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  22759. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  22760. ) {
  22761. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  22762. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  22763. }
  22764. }
  22765. }
  22766. }
  22767. if ($this->errors) {
  22768. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  22769. }
  22770. $package = $this->loader->load($this->config, $class);
  22771. $this->config = array();
  22772. return $package;
  22773. }
  22774. public function getWarnings(): array
  22775. {
  22776. return $this->warnings;
  22777. }
  22778. public function getErrors(): array
  22779. {
  22780. return $this->errors;
  22781. }
  22782. public static function hasPackageNamingError(string $name, bool $isLink = false): ?string
  22783. {
  22784. if (PlatformRepository::isPlatformPackage($name)) {
  22785. return null;
  22786. }
  22787. if (!Preg::isMatch('{^[a-z0-9](?:[_.-]?[a-z0-9]+)*/[a-z0-9](?:(?:[_.]?|-{0,2})[a-z0-9]+)*$}iD', $name)) {
  22788. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".';
  22789. }
  22790. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  22791. $bits = explode('/', strtolower($name));
  22792. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  22793. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  22794. }
  22795. if (Preg::isMatch('{\.json$}', $name)) {
  22796. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  22797. }
  22798. if (Preg::isMatch('{[A-Z]}', $name)) {
  22799. if ($isLink) {
  22800. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  22801. }
  22802. $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  22803. $suggestName = strtolower($suggestName);
  22804. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  22805. }
  22806. return null;
  22807. }
  22808. private function validateRegex(string $property, string $regex, bool $mandatory = false): bool
  22809. {
  22810. if (!$this->validateString($property, $mandatory)) {
  22811. return false;
  22812. }
  22813. if (!Preg::isMatch('{^'.$regex.'$}u', $this->config[$property])) {
  22814. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  22815. if ($mandatory) {
  22816. $this->errors[] = $message;
  22817. } else {
  22818. $this->warnings[] = $message;
  22819. }
  22820. unset($this->config[$property]);
  22821. return false;
  22822. }
  22823. return true;
  22824. }
  22825. private function validateString(string $property, bool $mandatory = false): bool
  22826. {
  22827. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  22828. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  22829. unset($this->config[$property]);
  22830. return false;
  22831. }
  22832. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  22833. if ($mandatory) {
  22834. $this->errors[] = $property.' : must be present';
  22835. }
  22836. unset($this->config[$property]);
  22837. return false;
  22838. }
  22839. return true;
  22840. }
  22841. private function validateArray(string $property, bool $mandatory = false): bool
  22842. {
  22843. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  22844. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  22845. unset($this->config[$property]);
  22846. return false;
  22847. }
  22848. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  22849. if ($mandatory) {
  22850. $this->errors[] = $property.' : must be present and contain at least one element';
  22851. }
  22852. unset($this->config[$property]);
  22853. return false;
  22854. }
  22855. return true;
  22856. }
  22857. private function validateFlatArray(string $property, ?string $regex = null, bool $mandatory = false): bool
  22858. {
  22859. if (!$this->validateArray($property, $mandatory)) {
  22860. return false;
  22861. }
  22862. $pass = true;
  22863. foreach ($this->config[$property] as $key => $value) {
  22864. if (!is_string($value) && !is_numeric($value)) {
  22865. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  22866. unset($this->config[$property][$key]);
  22867. $pass = false;
  22868. continue;
  22869. }
  22870. if ($regex && !Preg::isMatch('{^'.$regex.'$}u', $value)) {
  22871. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  22872. unset($this->config[$property][$key]);
  22873. $pass = false;
  22874. }
  22875. }
  22876. return $pass;
  22877. }
  22878. private function validateUrl(string $property, bool $mandatory = false): bool
  22879. {
  22880. if (!$this->validateString($property, $mandatory)) {
  22881. return false;
  22882. }
  22883. if (!$this->filterUrl($this->config[$property])) {
  22884. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  22885. unset($this->config[$property]);
  22886. return false;
  22887. }
  22888. return true;
  22889. }
  22890. private function filterUrl($value, array $schemes = array('http', 'https')): bool
  22891. {
  22892. if ($value === '') {
  22893. return true;
  22894. }
  22895. $bits = parse_url($value);
  22896. if (empty($bits['scheme']) || empty($bits['host'])) {
  22897. return false;
  22898. }
  22899. if (!in_array($bits['scheme'], $schemes, true)) {
  22900. return false;
  22901. }
  22902. return true;
  22903. }
  22904. }
  22905. <?php declare(strict_types=1);
  22906. namespace Composer\Package;
  22907. use Composer\Json\JsonFile;
  22908. use Composer\Installer\InstallationManager;
  22909. use Composer\Pcre\Preg;
  22910. use Composer\Repository\LockArrayRepository;
  22911. use Composer\Util\ProcessExecutor;
  22912. use Composer\Package\Dumper\ArrayDumper;
  22913. use Composer\Package\Loader\ArrayLoader;
  22914. use Composer\Package\Version\VersionParser;
  22915. use Composer\Plugin\PluginInterface;
  22916. use Composer\Util\Git as GitUtil;
  22917. use Composer\IO\IOInterface;
  22918. use Seld\JsonLint\ParsingException;
  22919. class Locker
  22920. {
  22921. private $lockFile;
  22922. private $installationManager;
  22923. private $hash;
  22924. private $contentHash;
  22925. private $loader;
  22926. private $dumper;
  22927. private $process;
  22928. private $lockDataCache = null;
  22929. private $virtualFileWritten = false;
  22930. public function __construct(IOInterface $io, JsonFile $lockFile, InstallationManager $installationManager, string $composerFileContents, ProcessExecutor $process = null)
  22931. {
  22932. $this->lockFile = $lockFile;
  22933. $this->installationManager = $installationManager;
  22934. $this->hash = md5($composerFileContents);
  22935. $this->contentHash = self::getContentHash($composerFileContents);
  22936. $this->loader = new ArrayLoader(null, true);
  22937. $this->dumper = new ArrayDumper();
  22938. $this->process = $process ?? new ProcessExecutor($io);
  22939. }
  22940. public static function getContentHash(string $composerFileContents): string
  22941. {
  22942. $content = JsonFile::parseJson($composerFileContents, 'composer.json');
  22943. $relevantKeys = array(
  22944. 'name',
  22945. 'version',
  22946. 'require',
  22947. 'require-dev',
  22948. 'conflict',
  22949. 'replace',
  22950. 'provide',
  22951. 'minimum-stability',
  22952. 'prefer-stable',
  22953. 'repositories',
  22954. 'extra',
  22955. );
  22956. $relevantContent = array();
  22957. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  22958. $relevantContent[$key] = $content[$key];
  22959. }
  22960. if (isset($content['config']['platform'])) {
  22961. $relevantContent['config']['platform'] = $content['config']['platform'];
  22962. }
  22963. ksort($relevantContent);
  22964. return md5(JsonFile::encode($relevantContent, 0));
  22965. }
  22966. public function isLocked(): bool
  22967. {
  22968. if (!$this->virtualFileWritten && !$this->lockFile->exists()) {
  22969. return false;
  22970. }
  22971. $data = $this->getLockData();
  22972. return isset($data['packages']);
  22973. }
  22974. public function isFresh(): bool
  22975. {
  22976. $lock = $this->lockFile->read();
  22977. if (!empty($lock['content-hash'])) {
  22978. return $this->contentHash === $lock['content-hash'];
  22979. }
  22980. if (!empty($lock['hash'])) {
  22981. return $this->hash === $lock['hash'];
  22982. }
  22983. return false;
  22984. }
  22985. public function getLockedRepository(bool $withDevReqs = false): LockArrayRepository
  22986. {
  22987. $lockData = $this->getLockData();
  22988. $packages = new LockArrayRepository();
  22989. $lockedPackages = $lockData['packages'];
  22990. if ($withDevReqs) {
  22991. if (isset($lockData['packages-dev'])) {
  22992. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  22993. } else {
  22994. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or delete it and run composer update to generate a new lock file.');
  22995. }
  22996. }
  22997. if (empty($lockedPackages)) {
  22998. return $packages;
  22999. }
  23000. if (isset($lockedPackages[0]['name'])) {
  23001. $packageByName = array();
  23002. foreach ($lockedPackages as $info) {
  23003. $package = $this->loader->load($info);
  23004. $packages->addPackage($package);
  23005. $packageByName[$package->getName()] = $package;
  23006. if ($package instanceof AliasPackage) {
  23007. $packageByName[$package->getAliasOf()->getName()] = $package->getAliasOf();
  23008. }
  23009. }
  23010. if (isset($lockData['aliases'])) {
  23011. foreach ($lockData['aliases'] as $alias) {
  23012. if (isset($packageByName[$alias['package']])) {
  23013. $aliasPkg = new CompleteAliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias']);
  23014. $aliasPkg->setRootPackageAlias(true);
  23015. $packages->addPackage($aliasPkg);
  23016. }
  23017. }
  23018. }
  23019. return $packages;
  23020. }
  23021. throw new \RuntimeException('Your composer.lock is invalid. Run "composer update" to generate a new one.');
  23022. }
  23023. public function getDevPackageNames(): array
  23024. {
  23025. $names = array();
  23026. $lockData = $this->getLockData();
  23027. if (isset($lockData['packages-dev'])) {
  23028. foreach ($lockData['packages-dev'] as $package) {
  23029. $names[] = strtolower($package['name']);
  23030. }
  23031. }
  23032. return $names;
  23033. }
  23034. public function getPlatformRequirements(bool $withDevReqs = false): array
  23035. {
  23036. $lockData = $this->getLockData();
  23037. $requirements = array();
  23038. if (!empty($lockData['platform'])) {
  23039. $requirements = $this->loader->parseLinks(
  23040. '__root__',
  23041. '1.0.0',
  23042. Link::TYPE_REQUIRE,
  23043. $lockData['platform'] ?? array()
  23044. );
  23045. }
  23046. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  23047. $devRequirements = $this->loader->parseLinks(
  23048. '__root__',
  23049. '1.0.0',
  23050. Link::TYPE_REQUIRE,
  23051. $lockData['platform-dev'] ?? array()
  23052. );
  23053. $requirements = array_merge($requirements, $devRequirements);
  23054. }
  23055. return $requirements;
  23056. }
  23057. public function getMinimumStability(): string
  23058. {
  23059. $lockData = $this->getLockData();
  23060. return $lockData['minimum-stability'] ?? 'stable';
  23061. }
  23062. public function getStabilityFlags(): array
  23063. {
  23064. $lockData = $this->getLockData();
  23065. return $lockData['stability-flags'] ?? array();
  23066. }
  23067. public function getPreferStable(): ?bool
  23068. {
  23069. $lockData = $this->getLockData();
  23070. return $lockData['prefer-stable'] ?? null;
  23071. }
  23072. public function getPreferLowest(): ?bool
  23073. {
  23074. $lockData = $this->getLockData();
  23075. return $lockData['prefer-lowest'] ?? null;
  23076. }
  23077. public function getPlatformOverrides(): array
  23078. {
  23079. $lockData = $this->getLockData();
  23080. return $lockData['platform-overrides'] ?? array();
  23081. }
  23082. public function getAliases(): array
  23083. {
  23084. $lockData = $this->getLockData();
  23085. return $lockData['aliases'] ?? array();
  23086. }
  23087. public function getLockData(): array
  23088. {
  23089. if (null !== $this->lockDataCache) {
  23090. return $this->lockDataCache;
  23091. }
  23092. if (!$this->lockFile->exists()) {
  23093. throw new \LogicException('No lockfile found. Unable to read locked packages');
  23094. }
  23095. return $this->lockDataCache = $this->lockFile->read();
  23096. }
  23097. public function setLockData(array $packages, ?array $devPackages, array $platformReqs, array $platformDevReqs, array $aliases, string $minimumStability, array $stabilityFlags, bool $preferStable, bool $preferLowest, array $platformOverrides, bool $write = true): bool
  23098. {
  23099. $aliases = array_map(function ($alias): array {
  23100. if (in_array($alias['version'], array('dev-master', 'dev-trunk', 'dev-default'), true)) {
  23101. $alias['version'] = VersionParser::DEFAULT_BRANCH_ALIAS;
  23102. }
  23103. return $alias;
  23104. }, $aliases);
  23105. $lock = array(
  23106. '_readme' => array('This file locks the dependencies of your project to a known state',
  23107. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  23108. 'This file is @gener'.'ated automatically', ),
  23109. 'content-hash' => $this->contentHash,
  23110. 'packages' => null,
  23111. 'packages-dev' => null,
  23112. 'aliases' => $aliases,
  23113. 'minimum-stability' => $minimumStability,
  23114. 'stability-flags' => $stabilityFlags,
  23115. 'prefer-stable' => $preferStable,
  23116. 'prefer-lowest' => $preferLowest,
  23117. );
  23118. $lock['packages'] = $this->lockPackages($packages);
  23119. if (null !== $devPackages) {
  23120. $lock['packages-dev'] = $this->lockPackages($devPackages);
  23121. }
  23122. $lock['platform'] = $platformReqs;
  23123. $lock['platform-dev'] = $platformDevReqs;
  23124. if ($platformOverrides) {
  23125. $lock['platform-overrides'] = $platformOverrides;
  23126. }
  23127. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  23128. try {
  23129. $isLocked = $this->isLocked();
  23130. } catch (ParsingException $e) {
  23131. $isLocked = false;
  23132. }
  23133. if (!$isLocked || $lock !== $this->getLockData()) {
  23134. if ($write) {
  23135. $this->lockFile->write($lock);
  23136. $this->lockDataCache = null;
  23137. $this->virtualFileWritten = false;
  23138. } else {
  23139. $this->virtualFileWritten = true;
  23140. $this->lockDataCache = JsonFile::parseJson(JsonFile::encode($lock));
  23141. }
  23142. return true;
  23143. }
  23144. return false;
  23145. }
  23146. private function lockPackages(array $packages): array
  23147. {
  23148. $locked = array();
  23149. foreach ($packages as $package) {
  23150. if ($package instanceof AliasPackage) {
  23151. continue;
  23152. }
  23153. $name = $package->getPrettyName();
  23154. $version = $package->getPrettyVersion();
  23155. if (!$name || !$version) {
  23156. throw new \LogicException(sprintf(
  23157. 'Package "%s" has no version or name and can not be locked',
  23158. $package
  23159. ));
  23160. }
  23161. $spec = $this->dumper->dump($package);
  23162. unset($spec['version_normalized']);
  23163. $time = $spec['time'] ?? null;
  23164. unset($spec['time']);
  23165. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  23166. $time = $this->getPackageTime($package) ?: $time;
  23167. }
  23168. if (null !== $time) {
  23169. $spec['time'] = $time;
  23170. }
  23171. unset($spec['installation-source']);
  23172. $locked[] = $spec;
  23173. }
  23174. usort($locked, function ($a, $b) {
  23175. $comparison = strcmp($a['name'], $b['name']);
  23176. if (0 !== $comparison) {
  23177. return $comparison;
  23178. }
  23179. return strcmp($a['version'], $b['version']);
  23180. });
  23181. return $locked;
  23182. }
  23183. private function getPackageTime(PackageInterface $package): ?string
  23184. {
  23185. if (!function_exists('proc_open')) {
  23186. return null;
  23187. }
  23188. $path = realpath($this->installationManager->getInstallPath($package));
  23189. $sourceType = $package->getSourceType();
  23190. $datetime = null;
  23191. if ($path && in_array($sourceType, array('git', 'hg'))) {
  23192. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  23193. switch ($sourceType) {
  23194. case 'git':
  23195. GitUtil::cleanEnv();
  23196. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && Preg::isMatch('{^\s*\d+\s*$}', $output)) {
  23197. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23198. }
  23199. break;
  23200. case 'hg':
  23201. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && Preg::isMatch('{^\s*(\d+)\s*}', $output, $match)) {
  23202. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  23203. }
  23204. break;
  23205. }
  23206. }
  23207. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  23208. }
  23209. }
  23210. <?php declare(strict_types=1);
  23211. namespace Composer\Package;
  23212. use Composer\Package\Version\VersionParser;
  23213. use Composer\Pcre\Preg;
  23214. use Composer\Util\ComposerMirror;
  23215. class Package extends BasePackage
  23216. {
  23217. protected $type;
  23218. protected $targetDir;
  23219. protected $installationSource;
  23220. protected $sourceType;
  23221. protected $sourceUrl;
  23222. protected $sourceReference;
  23223. protected $sourceMirrors;
  23224. protected $distType;
  23225. protected $distUrl;
  23226. protected $distReference;
  23227. protected $distSha1Checksum;
  23228. protected $distMirrors;
  23229. protected $version;
  23230. protected $prettyVersion;
  23231. protected $releaseDate;
  23232. protected $extra = array();
  23233. protected $binaries = array();
  23234. protected $dev;
  23235. protected $stability;
  23236. protected $notificationUrl;
  23237. protected $requires = array();
  23238. protected $conflicts = array();
  23239. protected $provides = array();
  23240. protected $replaces = array();
  23241. protected $devRequires = array();
  23242. protected $suggests = array();
  23243. protected $autoload = array();
  23244. protected $devAutoload = array();
  23245. protected $includePaths = array();
  23246. protected $isDefaultBranch = false;
  23247. protected $transportOptions = array();
  23248. public function __construct(string $name, string $version, string $prettyVersion)
  23249. {
  23250. parent::__construct($name);
  23251. $this->version = $version;
  23252. $this->prettyVersion = $prettyVersion;
  23253. $this->stability = VersionParser::parseStability($version);
  23254. $this->dev = $this->stability === 'dev';
  23255. }
  23256. public function isDev(): bool
  23257. {
  23258. return $this->dev;
  23259. }
  23260. public function setType(string $type): void
  23261. {
  23262. $this->type = $type;
  23263. }
  23264. public function getType(): string
  23265. {
  23266. return $this->type ?: 'library';
  23267. }
  23268. public function getStability(): string
  23269. {
  23270. return $this->stability;
  23271. }
  23272. public function setTargetDir(?string $targetDir): void
  23273. {
  23274. $this->targetDir = $targetDir;
  23275. }
  23276. public function getTargetDir(): ?string
  23277. {
  23278. if (null === $this->targetDir) {
  23279. return null;
  23280. }
  23281. return ltrim(Preg::replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  23282. }
  23283. public function setExtra(array $extra): void
  23284. {
  23285. $this->extra = $extra;
  23286. }
  23287. public function getExtra(): array
  23288. {
  23289. return $this->extra;
  23290. }
  23291. public function setBinaries(array $binaries): void
  23292. {
  23293. $this->binaries = $binaries;
  23294. }
  23295. public function getBinaries(): array
  23296. {
  23297. return $this->binaries;
  23298. }
  23299. public function setInstallationSource(?string $type): void
  23300. {
  23301. $this->installationSource = $type;
  23302. }
  23303. public function getInstallationSource(): ?string
  23304. {
  23305. return $this->installationSource;
  23306. }
  23307. public function setSourceType(?string $type): void
  23308. {
  23309. $this->sourceType = $type;
  23310. }
  23311. public function getSourceType(): ?string
  23312. {
  23313. return $this->sourceType;
  23314. }
  23315. public function setSourceUrl(?string $url): void
  23316. {
  23317. $this->sourceUrl = $url;
  23318. }
  23319. public function getSourceUrl(): ?string
  23320. {
  23321. return $this->sourceUrl;
  23322. }
  23323. public function setSourceReference(?string $reference): void
  23324. {
  23325. $this->sourceReference = $reference;
  23326. }
  23327. public function getSourceReference(): ?string
  23328. {
  23329. return $this->sourceReference;
  23330. }
  23331. public function setSourceMirrors(?array $mirrors): void
  23332. {
  23333. $this->sourceMirrors = $mirrors;
  23334. }
  23335. public function getSourceMirrors(): ?array
  23336. {
  23337. return $this->sourceMirrors;
  23338. }
  23339. public function getSourceUrls(): array
  23340. {
  23341. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  23342. }
  23343. public function setDistType(?string $type): void
  23344. {
  23345. $this->distType = $type;
  23346. }
  23347. public function getDistType(): ?string
  23348. {
  23349. return $this->distType;
  23350. }
  23351. public function setDistUrl(?string $url): void
  23352. {
  23353. $this->distUrl = $url;
  23354. }
  23355. public function getDistUrl(): ?string
  23356. {
  23357. return $this->distUrl;
  23358. }
  23359. public function setDistReference(?string $reference): void
  23360. {
  23361. $this->distReference = $reference;
  23362. }
  23363. public function getDistReference(): ?string
  23364. {
  23365. return $this->distReference;
  23366. }
  23367. public function setDistSha1Checksum(?string $sha1checksum): void
  23368. {
  23369. $this->distSha1Checksum = $sha1checksum;
  23370. }
  23371. public function getDistSha1Checksum(): ?string
  23372. {
  23373. return $this->distSha1Checksum;
  23374. }
  23375. public function setDistMirrors(?array $mirrors): void
  23376. {
  23377. $this->distMirrors = $mirrors;
  23378. }
  23379. public function getDistMirrors(): ?array
  23380. {
  23381. return $this->distMirrors;
  23382. }
  23383. public function getDistUrls(): array
  23384. {
  23385. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  23386. }
  23387. public function getTransportOptions(): array
  23388. {
  23389. return $this->transportOptions;
  23390. }
  23391. public function setTransportOptions(array $options): void
  23392. {
  23393. $this->transportOptions = $options;
  23394. }
  23395. public function getVersion(): string
  23396. {
  23397. return $this->version;
  23398. }
  23399. public function getPrettyVersion(): string
  23400. {
  23401. return $this->prettyVersion;
  23402. }
  23403. public function setReleaseDate(?\DateTimeInterface $releaseDate): void
  23404. {
  23405. $this->releaseDate = $releaseDate;
  23406. }
  23407. public function getReleaseDate(): ?\DateTimeInterface
  23408. {
  23409. return $this->releaseDate;
  23410. }
  23411. public function setRequires(array $requires): void
  23412. {
  23413. if (isset($requires[0])) {
  23414. $requires = $this->convertLinksToMap($requires, 'setRequires');
  23415. }
  23416. $this->requires = $requires;
  23417. }
  23418. public function getRequires(): array
  23419. {
  23420. return $this->requires;
  23421. }
  23422. public function setConflicts(array $conflicts): void
  23423. {
  23424. if (isset($conflicts[0])) {
  23425. $conflicts = $this->convertLinksToMap($conflicts, 'setConflicts');
  23426. }
  23427. $this->conflicts = $conflicts;
  23428. }
  23429. public function getConflicts(): array
  23430. {
  23431. return $this->conflicts;
  23432. }
  23433. public function setProvides(array $provides): void
  23434. {
  23435. if (isset($provides[0])) {
  23436. $provides = $this->convertLinksToMap($provides, 'setProvides');
  23437. }
  23438. $this->provides = $provides;
  23439. }
  23440. public function getProvides(): array
  23441. {
  23442. return $this->provides;
  23443. }
  23444. public function setReplaces(array $replaces): void
  23445. {
  23446. if (isset($replaces[0])) {
  23447. $replaces = $this->convertLinksToMap($replaces, 'setReplaces');
  23448. }
  23449. $this->replaces = $replaces;
  23450. }
  23451. public function getReplaces(): array
  23452. {
  23453. return $this->replaces;
  23454. }
  23455. public function setDevRequires(array $devRequires): void
  23456. {
  23457. if (isset($devRequires[0])) {
  23458. $devRequires = $this->convertLinksToMap($devRequires, 'setDevRequires');
  23459. }
  23460. $this->devRequires = $devRequires;
  23461. }
  23462. public function getDevRequires(): array
  23463. {
  23464. return $this->devRequires;
  23465. }
  23466. public function setSuggests(array $suggests): void
  23467. {
  23468. $this->suggests = $suggests;
  23469. }
  23470. public function getSuggests(): array
  23471. {
  23472. return $this->suggests;
  23473. }
  23474. public function setAutoload(array $autoload): void
  23475. {
  23476. $this->autoload = $autoload;
  23477. }
  23478. public function getAutoload(): array
  23479. {
  23480. return $this->autoload;
  23481. }
  23482. public function setDevAutoload(array $devAutoload): void
  23483. {
  23484. $this->devAutoload = $devAutoload;
  23485. }
  23486. public function getDevAutoload(): array
  23487. {
  23488. return $this->devAutoload;
  23489. }
  23490. public function setIncludePaths(array $includePaths): void
  23491. {
  23492. $this->includePaths = $includePaths;
  23493. }
  23494. public function getIncludePaths(): array
  23495. {
  23496. return $this->includePaths;
  23497. }
  23498. public function setNotificationUrl(string $notificationUrl): void
  23499. {
  23500. $this->notificationUrl = $notificationUrl;
  23501. }
  23502. public function getNotificationUrl(): ?string
  23503. {
  23504. return $this->notificationUrl;
  23505. }
  23506. public function setIsDefaultBranch(bool $defaultBranch): void
  23507. {
  23508. $this->isDefaultBranch = $defaultBranch;
  23509. }
  23510. public function isDefaultBranch(): bool
  23511. {
  23512. return $this->isDefaultBranch;
  23513. }
  23514. public function setSourceDistReferences(string $reference): void
  23515. {
  23516. $this->setSourceReference($reference);
  23517. if (
  23518. $this->getDistUrl() !== null
  23519. && Preg::isMatch('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $this->getDistUrl())
  23520. ) {
  23521. $this->setDistReference($reference);
  23522. $this->setDistUrl(Preg::replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $this->getDistUrl()));
  23523. } elseif ($this->getDistReference()) {
  23524. $this->setDistReference($reference);
  23525. }
  23526. }
  23527. public function replaceVersion(string $version, string $prettyVersion): void
  23528. {
  23529. $this->version = $version;
  23530. $this->prettyVersion = $prettyVersion;
  23531. $this->stability = VersionParser::parseStability($version);
  23532. $this->dev = $this->stability === 'dev';
  23533. }
  23534. protected function getUrls(?string $url, ?array $mirrors, ?string $ref, ?string $type, string $urlType): array
  23535. {
  23536. if (!$url) {
  23537. return array();
  23538. }
  23539. if ($urlType === 'dist' && false !== strpos($url, '%')) {
  23540. $url = ComposerMirror::processUrl($url, $this->name, $this->version, $ref, $type, $this->prettyVersion);
  23541. }
  23542. $urls = array($url);
  23543. if ($mirrors) {
  23544. foreach ($mirrors as $mirror) {
  23545. if ($urlType === 'dist') {
  23546. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type, $this->prettyVersion);
  23547. } elseif ($urlType === 'source' && $type === 'git') {
  23548. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  23549. } elseif ($urlType === 'source' && $type === 'hg') {
  23550. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  23551. } else {
  23552. continue;
  23553. }
  23554. if (!\in_array($mirrorUrl, $urls)) {
  23555. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  23556. $func($urls, $mirrorUrl);
  23557. }
  23558. }
  23559. }
  23560. return $urls;
  23561. }
  23562. private function convertLinksToMap(array $links, string $source): array
  23563. {
  23564. trigger_error('Package::'.$source.' must be called with a map of lowercased package name => Link object, got a indexed array, this is deprecated and you should fix your usage.');
  23565. $newLinks = array();
  23566. foreach ($links as $link) {
  23567. $newLinks[$link->getTarget()] = $link;
  23568. }
  23569. return $newLinks;
  23570. }
  23571. }
  23572. <?php declare(strict_types=1);
  23573. namespace Composer\Package;
  23574. use Composer\Repository\RepositoryInterface;
  23575. interface PackageInterface
  23576. {
  23577. public const DISPLAY_SOURCE_REF_IF_DEV = 0;
  23578. public const DISPLAY_SOURCE_REF = 1;
  23579. public const DISPLAY_DIST_REF = 2;
  23580. public function getName(): string;
  23581. public function getPrettyName(): string;
  23582. public function getNames(bool $provides = true): array;
  23583. public function setId(int $id): void;
  23584. public function getId(): int;
  23585. public function isDev(): bool;
  23586. public function getType(): string;
  23587. public function getTargetDir(): ?string;
  23588. public function getExtra(): array;
  23589. public function setInstallationSource(?string $type): void;
  23590. public function getInstallationSource(): ?string;
  23591. public function getSourceType(): ?string;
  23592. public function getSourceUrl(): ?string;
  23593. public function getSourceUrls(): array;
  23594. public function getSourceReference(): ?string;
  23595. public function getSourceMirrors(): ?array;
  23596. public function setSourceMirrors(?array $mirrors): void;
  23597. public function getDistType(): ?string;
  23598. public function getDistUrl(): ?string;
  23599. public function getDistUrls(): array;
  23600. public function getDistReference(): ?string;
  23601. public function getDistSha1Checksum(): ?string;
  23602. public function getDistMirrors(): ?array;
  23603. public function setDistMirrors(?array $mirrors): void;
  23604. public function getVersion(): string;
  23605. public function getPrettyVersion(): string;
  23606. public function getFullPrettyVersion(bool $truncate = true, int $displayMode = self::DISPLAY_SOURCE_REF_IF_DEV): string;
  23607. public function getReleaseDate(): ?\DateTimeInterface;
  23608. public function getStability(): string;
  23609. public function getRequires(): array;
  23610. public function getConflicts(): array;
  23611. public function getProvides(): array;
  23612. public function getReplaces(): array;
  23613. public function getDevRequires(): array;
  23614. public function getSuggests(): array;
  23615. public function getAutoload(): array;
  23616. public function getDevAutoload(): array;
  23617. public function getIncludePaths(): array;
  23618. public function setRepository(RepositoryInterface $repository): void;
  23619. public function getRepository(): ?RepositoryInterface;
  23620. public function getBinaries(): array;
  23621. public function getUniqueName(): string;
  23622. public function getNotificationUrl(): ?string;
  23623. public function __toString(): string;
  23624. public function getPrettyString(): string;
  23625. public function isDefaultBranch(): bool;
  23626. public function getTransportOptions(): array;
  23627. public function setTransportOptions(array $options): void;
  23628. public function setSourceReference(?string $reference): void;
  23629. public function setDistUrl(?string $url): void;
  23630. public function setDistType(?string $type): void;
  23631. public function setDistReference(?string $reference): void;
  23632. public function setSourceDistReferences(string $reference): void;
  23633. }
  23634. <?php declare(strict_types=1);
  23635. namespace Composer\Package;
  23636. class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterface
  23637. {
  23638. protected $aliasOf;
  23639. public function __construct(RootPackage $aliasOf, string $version, string $prettyVersion)
  23640. {
  23641. parent::__construct($aliasOf, $version, $prettyVersion);
  23642. }
  23643. public function getAliasOf()
  23644. {
  23645. return $this->aliasOf;
  23646. }
  23647. public function getAliases(): array
  23648. {
  23649. return $this->aliasOf->getAliases();
  23650. }
  23651. public function getMinimumStability(): string
  23652. {
  23653. return $this->aliasOf->getMinimumStability();
  23654. }
  23655. public function getStabilityFlags(): array
  23656. {
  23657. return $this->aliasOf->getStabilityFlags();
  23658. }
  23659. public function getReferences(): array
  23660. {
  23661. return $this->aliasOf->getReferences();
  23662. }
  23663. public function getPreferStable(): bool
  23664. {
  23665. return $this->aliasOf->getPreferStable();
  23666. }
  23667. public function getConfig(): array
  23668. {
  23669. return $this->aliasOf->getConfig();
  23670. }
  23671. public function setRequires(array $requires): void
  23672. {
  23673. $this->requires = $this->replaceSelfVersionDependencies($requires, Link::TYPE_REQUIRE);
  23674. $this->aliasOf->setRequires($requires);
  23675. }
  23676. public function setDevRequires(array $devRequires): void
  23677. {
  23678. $this->devRequires = $this->replaceSelfVersionDependencies($devRequires, Link::TYPE_DEV_REQUIRE);
  23679. $this->aliasOf->setDevRequires($devRequires);
  23680. }
  23681. public function setConflicts(array $conflicts): void
  23682. {
  23683. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT);
  23684. $this->aliasOf->setConflicts($conflicts);
  23685. }
  23686. public function setProvides(array $provides): void
  23687. {
  23688. $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE);
  23689. $this->aliasOf->setProvides($provides);
  23690. }
  23691. public function setReplaces(array $replaces): void
  23692. {
  23693. $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE);
  23694. $this->aliasOf->setReplaces($replaces);
  23695. }
  23696. public function setAutoload(array $autoload): void
  23697. {
  23698. $this->aliasOf->setAutoload($autoload);
  23699. }
  23700. public function setDevAutoload(array $devAutoload): void
  23701. {
  23702. $this->aliasOf->setDevAutoload($devAutoload);
  23703. }
  23704. public function setStabilityFlags(array $stabilityFlags): void
  23705. {
  23706. $this->aliasOf->setStabilityFlags($stabilityFlags);
  23707. }
  23708. public function setMinimumStability($minimumStability): void
  23709. {
  23710. $this->aliasOf->setMinimumStability($minimumStability);
  23711. }
  23712. public function setPreferStable($preferStable): void
  23713. {
  23714. $this->aliasOf->setPreferStable($preferStable);
  23715. }
  23716. public function setConfig(array $config): void
  23717. {
  23718. $this->aliasOf->setConfig($config);
  23719. }
  23720. public function setReferences(array $references): void
  23721. {
  23722. $this->aliasOf->setReferences($references);
  23723. }
  23724. public function setAliases(array $aliases): void
  23725. {
  23726. $this->aliasOf->setAliases($aliases);
  23727. }
  23728. public function setSuggests(array $suggests): void
  23729. {
  23730. $this->aliasOf->setSuggests($suggests);
  23731. }
  23732. public function setExtra(array $extra): void
  23733. {
  23734. $this->aliasOf->setExtra($extra);
  23735. }
  23736. public function __clone()
  23737. {
  23738. parent::__clone();
  23739. $this->aliasOf = clone $this->aliasOf;
  23740. }
  23741. }
  23742. <?php declare(strict_types=1);
  23743. namespace Composer\Package;
  23744. class RootPackage extends CompletePackage implements RootPackageInterface
  23745. {
  23746. public const DEFAULT_PRETTY_VERSION = '1.0.0+no-version-set';
  23747. protected $minimumStability = 'stable';
  23748. protected $preferStable = false;
  23749. protected $stabilityFlags = array();
  23750. protected $config = array();
  23751. protected $references = array();
  23752. protected $aliases = array();
  23753. public function setMinimumStability(string $minimumStability): void
  23754. {
  23755. $this->minimumStability = $minimumStability;
  23756. }
  23757. public function getMinimumStability(): string
  23758. {
  23759. return $this->minimumStability;
  23760. }
  23761. public function setStabilityFlags(array $stabilityFlags): void
  23762. {
  23763. $this->stabilityFlags = $stabilityFlags;
  23764. }
  23765. public function getStabilityFlags(): array
  23766. {
  23767. return $this->stabilityFlags;
  23768. }
  23769. public function setPreferStable(bool $preferStable): void
  23770. {
  23771. $this->preferStable = $preferStable;
  23772. }
  23773. public function getPreferStable(): bool
  23774. {
  23775. return $this->preferStable;
  23776. }
  23777. public function setConfig(array $config): void
  23778. {
  23779. $this->config = $config;
  23780. }
  23781. public function getConfig(): array
  23782. {
  23783. return $this->config;
  23784. }
  23785. public function setReferences(array $references): void
  23786. {
  23787. $this->references = $references;
  23788. }
  23789. public function getReferences(): array
  23790. {
  23791. return $this->references;
  23792. }
  23793. public function setAliases(array $aliases): void
  23794. {
  23795. $this->aliases = $aliases;
  23796. }
  23797. public function getAliases(): array
  23798. {
  23799. return $this->aliases;
  23800. }
  23801. }
  23802. <?php declare(strict_types=1);
  23803. namespace Composer\Package;
  23804. interface RootPackageInterface extends CompletePackageInterface
  23805. {
  23806. public function getAliases(): array;
  23807. public function getMinimumStability(): string;
  23808. public function getStabilityFlags(): array;
  23809. public function getReferences(): array;
  23810. public function getPreferStable(): bool;
  23811. public function getConfig(): array;
  23812. public function setRequires(array $requires): void;
  23813. public function setDevRequires(array $devRequires): void;
  23814. public function setConflicts(array $conflicts): void;
  23815. public function setProvides(array $provides): void;
  23816. public function setReplaces(array $replaces): void;
  23817. public function setRepositories(array $repositories): void;
  23818. public function setAutoload(array $autoload): void;
  23819. public function setDevAutoload(array $devAutoload): void;
  23820. public function setStabilityFlags(array $stabilityFlags): void;
  23821. public function setMinimumStability(string $minimumStability): void;
  23822. public function setPreferStable(bool $preferStable): void;
  23823. public function setConfig(array $config): void;
  23824. public function setReferences(array $references): void;
  23825. public function setAliases(array $aliases): void;
  23826. public function setSuggests(array $suggests): void;
  23827. public function setExtra(array $extra): void;
  23828. }
  23829. <?php declare(strict_types=1);
  23830. namespace Composer\Package\Version;
  23831. use Composer\Package\BasePackage;
  23832. class StabilityFilter
  23833. {
  23834. public static function isPackageAcceptable(array $acceptableStabilities, array $stabilityFlags, array $names, string $stability): bool
  23835. {
  23836. foreach ($names as $name) {
  23837. if (isset($stabilityFlags[$name])) {
  23838. if (BasePackage::$stabilities[$stability] <= $stabilityFlags[$name]) {
  23839. return true;
  23840. }
  23841. } elseif (isset($acceptableStabilities[$stability])) {
  23842. return true;
  23843. }
  23844. }
  23845. return false;
  23846. }
  23847. }
  23848. <?php declare(strict_types=1);
  23849. namespace Composer\Package\Version;
  23850. use Composer\Config;
  23851. use Composer\Pcre\Preg;
  23852. use Composer\Repository\Vcs\HgDriver;
  23853. use Composer\IO\NullIO;
  23854. use Composer\Semver\VersionParser as SemverVersionParser;
  23855. use Composer\Util\Git as GitUtil;
  23856. use Composer\Util\HttpDownloader;
  23857. use Composer\Util\ProcessExecutor;
  23858. use Composer\Util\Svn as SvnUtil;
  23859. use React\Promise\CancellablePromiseInterface;
  23860. use Symfony\Component\Process\Process;
  23861. class VersionGuesser
  23862. {
  23863. private $config;
  23864. private $process;
  23865. private $versionParser;
  23866. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  23867. {
  23868. $this->config = $config;
  23869. $this->process = $process;
  23870. $this->versionParser = $versionParser;
  23871. }
  23872. public function guessVersion(array $packageConfig, string $path): ?array
  23873. {
  23874. if (!function_exists('proc_open')) {
  23875. return null;
  23876. }
  23877. $versionData = $this->guessGitVersion($packageConfig, $path);
  23878. if (null !== $versionData && null !== $versionData['version']) {
  23879. return $this->postprocess($versionData);
  23880. }
  23881. $versionData = $this->guessHgVersion($packageConfig, $path);
  23882. if (null !== $versionData && null !== $versionData['version']) {
  23883. return $this->postprocess($versionData);
  23884. }
  23885. $versionData = $this->guessFossilVersion($path);
  23886. if (null !== $versionData && null !== $versionData['version']) {
  23887. return $this->postprocess($versionData);
  23888. }
  23889. $versionData = $this->guessSvnVersion($packageConfig, $path);
  23890. if (null !== $versionData && null !== $versionData['version']) {
  23891. return $this->postprocess($versionData);
  23892. }
  23893. return null;
  23894. }
  23895. private function postprocess(array $versionData): array
  23896. {
  23897. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) {
  23898. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  23899. }
  23900. if ('-dev' === substr($versionData['version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['version'])) {
  23901. $versionData['pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['version']);
  23902. }
  23903. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['feature_version'])) {
  23904. $versionData['feature_pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  23905. }
  23906. return $versionData;
  23907. }
  23908. private function guessGitVersion(array $packageConfig, string $path): array
  23909. {
  23910. GitUtil::cleanEnv();
  23911. $commit = null;
  23912. $version = null;
  23913. $prettyVersion = null;
  23914. $featureVersion = null;
  23915. $featurePrettyVersion = null;
  23916. $isDetached = false;
  23917. if (0 === $this->process->execute(['git', 'branch', '-a', '--no-color', '--no-abbrev', '-v'], $output, $path)) {
  23918. $branches = array();
  23919. $isFeatureBranch = false;
  23920. foreach ($this->process->splitLines($output) as $branch) {
  23921. if ($branch && Preg::isMatch('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  23922. if (
  23923. $match[1] === '(no branch)'
  23924. || strpos($match[1], '(detached ') === 0
  23925. || strpos($match[1], '(HEAD detached at') === 0
  23926. ) {
  23927. $version = 'dev-' . $match[2];
  23928. $prettyVersion = $version;
  23929. $isFeatureBranch = true;
  23930. $isDetached = true;
  23931. } else {
  23932. $version = $this->versionParser->normalizeBranch($match[1]);
  23933. $prettyVersion = 'dev-' . $match[1];
  23934. $isFeatureBranch = $this->isFeatureBranch($packageConfig, $match[1]);
  23935. }
  23936. if ($match[2]) {
  23937. $commit = $match[2];
  23938. }
  23939. }
  23940. if ($branch && !Preg::isMatch('{^ *.+/HEAD }', $branch)) {
  23941. if (Preg::isMatch('{^(?:\* )? *((?:remotes/(?:origin|upstream)/)?[^\s/]+) *([a-f0-9]+) .*$}', $branch, $match)) {
  23942. $branches[] = $match[1];
  23943. }
  23944. }
  23945. }
  23946. if ($isFeatureBranch) {
  23947. $featureVersion = $version;
  23948. $featurePrettyVersion = $prettyVersion;
  23949. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  23950. $version = $result['version'];
  23951. $prettyVersion = $result['pretty_version'];
  23952. }
  23953. }
  23954. if (!$version || $isDetached) {
  23955. $result = $this->versionFromGitTags($path);
  23956. if ($result) {
  23957. $version = $result['version'];
  23958. $prettyVersion = $result['pretty_version'];
  23959. $featureVersion = null;
  23960. $featurePrettyVersion = null;
  23961. }
  23962. }
  23963. if (!$commit) {
  23964. $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
  23965. if (0 === $this->process->execute($command, $output, $path)) {
  23966. $commit = trim($output) ?: null;
  23967. }
  23968. }
  23969. if ($featureVersion) {
  23970. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion);
  23971. }
  23972. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  23973. }
  23974. private function versionFromGitTags(string $path): ?array
  23975. {
  23976. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  23977. try {
  23978. $version = $this->versionParser->normalize(trim($output));
  23979. return array('version' => $version, 'pretty_version' => trim($output));
  23980. } catch (\Exception $e) {
  23981. }
  23982. }
  23983. return null;
  23984. }
  23985. private function guessHgVersion(array $packageConfig, string $path): ?array
  23986. {
  23987. if (0 === $this->process->execute('hg branch', $output, $path)) {
  23988. $branch = trim($output);
  23989. $version = $this->versionParser->normalizeBranch($branch);
  23990. $isFeatureBranch = 0 === strpos($version, 'dev-');
  23991. if (VersionParser::DEFAULT_BRANCH_ALIAS === $version) {
  23992. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  23993. }
  23994. if (!$isFeatureBranch) {
  23995. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  23996. }
  23997. $io = new NullIO();
  23998. $driver = new HgDriver(array('url' => $path), $io, $this->config, new HttpDownloader($io, $this->config), $this->process);
  23999. $branches = array_map('strval', array_keys($driver->getBranches()));
  24000. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  24001. $result['commit'] = '';
  24002. $result['feature_version'] = $version;
  24003. $result['feature_pretty_version'] = $version;
  24004. return $result;
  24005. }
  24006. return null;
  24007. }
  24008. private function guessFeatureVersion(array $packageConfig, ?string $version, array $branches, string $scmCmdline, string $path): array
  24009. {
  24010. $prettyVersion = $version;
  24011. if (!isset($packageConfig['extra']['branch-alias'][$version])
  24012. || strpos(json_encode($packageConfig), '"self.version"')
  24013. ) {
  24014. $branch = Preg::replace('{^dev-}', '', $version);
  24015. $length = PHP_INT_MAX;
  24016. if (!$this->isFeatureBranch($packageConfig, $branch)) {
  24017. return array('version' => $version, 'pretty_version' => $prettyVersion);
  24018. }
  24019. usort($branches, function ($a, $b): int {
  24020. $aRemote = 0 === strpos($a, 'remotes/');
  24021. $bRemote = 0 === strpos($b, 'remotes/');
  24022. if ($aRemote !== $bRemote) {
  24023. return $aRemote ? 1 : -1;
  24024. }
  24025. return strnatcasecmp($b, $a);
  24026. });
  24027. $promises = [];
  24028. $this->process->setMaxJobs(30);
  24029. try {
  24030. foreach ($branches as $candidate) {
  24031. $candidateVersion = Preg::replace('{^remotes/\S+/}', '', $candidate);
  24032. if ($candidate === $branch || $this->isFeatureBranch($packageConfig, $candidateVersion)) {
  24033. continue;
  24034. }
  24035. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  24036. $promises[] = $this->process->executeAsync($cmdLine, $path)->then(function (Process $process) use (&$length, &$version, &$prettyVersion, $candidateVersion, &$promises): void {
  24037. if (!$process->isSuccessful()) {
  24038. return;
  24039. }
  24040. $output = $process->getOutput();
  24041. if (strlen($output) < $length) {
  24042. $length = strlen($output);
  24043. $version = $this->versionParser->normalizeBranch($candidateVersion);
  24044. $prettyVersion = 'dev-' . $candidateVersion;
  24045. if ($length === 0) {
  24046. foreach ($promises as $promise) {
  24047. if ($promise instanceof CancellablePromiseInterface) {
  24048. $promise->cancel();
  24049. }
  24050. }
  24051. }
  24052. }
  24053. });
  24054. }
  24055. $this->process->wait();
  24056. } finally {
  24057. $this->process->resetMaxJobs();
  24058. }
  24059. }
  24060. return array('version' => $version, 'pretty_version' => $prettyVersion);
  24061. }
  24062. private function isFeatureBranch(array $packageConfig, ?string $branchName): bool
  24063. {
  24064. $nonFeatureBranches = '';
  24065. if (!empty($packageConfig['non-feature-branches'])) {
  24066. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  24067. }
  24068. return !Preg::isMatch('{^(' . $nonFeatureBranches . '|master|main|latest|next|current|support|tip|trunk|default|develop|\d+\..+)$}', $branchName, $match);
  24069. }
  24070. private function guessFossilVersion(string $path): array
  24071. {
  24072. $version = null;
  24073. $prettyVersion = null;
  24074. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  24075. $branch = trim($output);
  24076. $version = $this->versionParser->normalizeBranch($branch);
  24077. $prettyVersion = 'dev-' . $branch;
  24078. }
  24079. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  24080. try {
  24081. $version = $this->versionParser->normalize(trim($output));
  24082. $prettyVersion = trim($output);
  24083. } catch (\Exception $e) {
  24084. }
  24085. }
  24086. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  24087. }
  24088. private function guessSvnVersion(array $packageConfig, string $path): ?array
  24089. {
  24090. SvnUtil::cleanEnv();
  24091. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  24092. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  24093. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  24094. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  24095. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  24096. if (Preg::isMatch($urlPattern, $output, $matches)) {
  24097. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  24098. $version = $this->versionParser->normalizeBranch($matches[3]);
  24099. $prettyVersion = 'dev-' . $matches[3];
  24100. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  24101. }
  24102. $prettyVersion = trim($matches[1]);
  24103. if ($prettyVersion === 'trunk') {
  24104. $version = 'dev-trunk';
  24105. } else {
  24106. $version = $this->versionParser->normalize($prettyVersion);
  24107. }
  24108. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  24109. }
  24110. }
  24111. return null;
  24112. }
  24113. }
  24114. <?php declare(strict_types=1);
  24115. namespace Composer\Package\Version;
  24116. use Composer\Pcre\Preg;
  24117. use Composer\Repository\PlatformRepository;
  24118. use Composer\Semver\VersionParser as SemverVersionParser;
  24119. use Composer\Semver\Semver;
  24120. use Composer\Semver\Constraint\ConstraintInterface;
  24121. class VersionParser extends SemverVersionParser
  24122. {
  24123. public const DEFAULT_BRANCH_ALIAS = '9999999-dev';
  24124. private static $constraints = array();
  24125. public function parseConstraints($constraints): ConstraintInterface
  24126. {
  24127. if (!isset(self::$constraints[$constraints])) {
  24128. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  24129. }
  24130. return self::$constraints[$constraints];
  24131. }
  24132. public function parseNameVersionPairs(array $pairs): array
  24133. {
  24134. $pairs = array_values($pairs);
  24135. $result = array();
  24136. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  24137. $pair = Preg::replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  24138. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !Preg::isMatch('{(?<=[a-z0-9_/-])\*|\*(?=[a-z0-9_/-])}i', $pairs[$i + 1]) && !PlatformRepository::isPlatformPackage($pairs[$i + 1])) {
  24139. $pair .= ' '.$pairs[$i + 1];
  24140. $i++;
  24141. }
  24142. if (strpos($pair, ' ')) {
  24143. list($name, $version) = explode(' ', $pair, 2);
  24144. $result[] = array('name' => $name, 'version' => $version);
  24145. } else {
  24146. $result[] = array('name' => $pair);
  24147. }
  24148. }
  24149. return $result;
  24150. }
  24151. public static function isUpgrade(string $normalizedFrom, string $normalizedTo): bool
  24152. {
  24153. if ($normalizedFrom === $normalizedTo) {
  24154. return true;
  24155. }
  24156. if (in_array($normalizedFrom, array('dev-master', 'dev-trunk', 'dev-default'), true)) {
  24157. $normalizedFrom = VersionParser::DEFAULT_BRANCH_ALIAS;
  24158. }
  24159. if (in_array($normalizedTo, array('dev-master', 'dev-trunk', 'dev-default'), true)) {
  24160. $normalizedTo = VersionParser::DEFAULT_BRANCH_ALIAS;
  24161. }
  24162. if (strpos($normalizedFrom, 'dev-') === 0 || strpos($normalizedTo, 'dev-') === 0) {
  24163. return true;
  24164. }
  24165. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  24166. return $sorted[0] === $normalizedFrom;
  24167. }
  24168. }
  24169. <?php declare(strict_types=1);
  24170. namespace Composer\Package\Version;
  24171. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  24172. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  24173. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  24174. use Composer\Package\BasePackage;
  24175. use Composer\Package\AliasPackage;
  24176. use Composer\Package\PackageInterface;
  24177. use Composer\Composer;
  24178. use Composer\Package\Loader\ArrayLoader;
  24179. use Composer\Package\Dumper\ArrayDumper;
  24180. use Composer\Pcre\Preg;
  24181. use Composer\Repository\RepositorySet;
  24182. use Composer\Repository\PlatformRepository;
  24183. use Composer\Semver\Constraint\Constraint;
  24184. use Composer\Semver\Constraint\ConstraintInterface;
  24185. class VersionSelector
  24186. {
  24187. private $repositorySet;
  24188. private $platformConstraints = array();
  24189. private $parser;
  24190. public function __construct(RepositorySet $repositorySet, PlatformRepository $platformRepo = null)
  24191. {
  24192. $this->repositorySet = $repositorySet;
  24193. if ($platformRepo) {
  24194. foreach ($platformRepo->getPackages() as $package) {
  24195. $this->platformConstraints[$package->getName()][] = new Constraint('==', $package->getVersion());
  24196. }
  24197. }
  24198. }
  24199. public function findBestCandidate(string $packageName, string $targetPackageVersion = null, string $preferredStability = 'stable', $platformRequirementFilter = null, int $repoSetFlags = 0)
  24200. {
  24201. if (!isset(BasePackage::$stabilities[$preferredStability])) {
  24202. throw new \UnexpectedValueException('Expected a valid stability name as 3rd argument, got '.$preferredStability);
  24203. }
  24204. if (null === $platformRequirementFilter) {
  24205. $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  24206. } elseif (!($platformRequirementFilter instanceof PlatformRequirementFilterInterface)) {
  24207. trigger_error('VersionSelector::findBestCandidate with ignored platform reqs as bool|array is deprecated since Composer 2.2, use an instance of PlatformRequirementFilterInterface instead.', E_USER_DEPRECATED);
  24208. $platformRequirementFilter = PlatformRequirementFilterFactory::fromBoolOrList($platformRequirementFilter);
  24209. }
  24210. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  24211. $candidates = $this->repositorySet->findPackages(strtolower($packageName), $constraint, $repoSetFlags);
  24212. if ($this->platformConstraints && !($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter)) {
  24213. $platformConstraints = $this->platformConstraints;
  24214. $candidates = array_filter($candidates, function ($pkg) use ($platformConstraints, $platformRequirementFilter): bool {
  24215. $reqs = $pkg->getRequires();
  24216. foreach ($reqs as $name => $link) {
  24217. if (!$platformRequirementFilter->isIgnored($name)) {
  24218. if (isset($platformConstraints[$name])) {
  24219. foreach ($platformConstraints[$name] as $constraint) {
  24220. if ($link->getConstraint()->matches($constraint)) {
  24221. continue 2;
  24222. }
  24223. }
  24224. return false;
  24225. } elseif (PlatformRepository::isPlatformPackage($name)) {
  24226. return false;
  24227. }
  24228. }
  24229. }
  24230. return true;
  24231. });
  24232. }
  24233. if (!$candidates) {
  24234. return false;
  24235. }
  24236. $package = reset($candidates);
  24237. $minPriority = BasePackage::$stabilities[$preferredStability];
  24238. foreach ($candidates as $candidate) {
  24239. $candidatePriority = $candidate->getStabilityPriority();
  24240. $currentPriority = $package->getStabilityPriority();
  24241. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  24242. continue;
  24243. }
  24244. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  24245. $package = $candidate;
  24246. continue;
  24247. }
  24248. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  24249. $package = $candidate;
  24250. continue;
  24251. }
  24252. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  24253. $package = $candidate;
  24254. }
  24255. }
  24256. if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  24257. $package = $package->getAliasOf();
  24258. }
  24259. return $package;
  24260. }
  24261. public function findRecommendedRequireVersion(PackageInterface $package): string
  24262. {
  24263. if (0 === strpos($package->getName(), 'ext-')) {
  24264. $phpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  24265. $extVersion = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
  24266. if ($phpVersion === $extVersion) {
  24267. return '*';
  24268. }
  24269. }
  24270. $version = $package->getVersion();
  24271. if (!$package->isDev()) {
  24272. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  24273. }
  24274. $loader = new ArrayLoader($this->getParser());
  24275. $dumper = new ArrayDumper();
  24276. $extra = $loader->getBranchAlias($dumper->dump($package));
  24277. if ($extra && $extra !== VersionParser::DEFAULT_BRANCH_ALIAS) {
  24278. $extra = Preg::replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  24279. if ($count) {
  24280. $extra = str_replace('.9999999', '.0', $extra);
  24281. return $this->transformVersion($extra, $extra, 'dev');
  24282. }
  24283. }
  24284. return $package->getPrettyVersion();
  24285. }
  24286. private function transformVersion(string $version, string $prettyVersion, string $stability): string
  24287. {
  24288. $semanticVersionParts = explode('.', $version);
  24289. if (count($semanticVersionParts) == 4 && Preg::isMatch('{^0\D?}', $semanticVersionParts[3])) {
  24290. if ($semanticVersionParts[0] === '0') {
  24291. unset($semanticVersionParts[3]);
  24292. } else {
  24293. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  24294. }
  24295. $version = implode('.', $semanticVersionParts);
  24296. } else {
  24297. return $prettyVersion;
  24298. }
  24299. if ($stability != 'stable') {
  24300. $version .= '@'.$stability;
  24301. }
  24302. return '^' . $version;
  24303. }
  24304. private function getParser(): VersionParser
  24305. {
  24306. if ($this->parser === null) {
  24307. $this->parser = new VersionParser();
  24308. }
  24309. return $this->parser;
  24310. }
  24311. }
  24312. <?php declare(strict_types=1);
  24313. namespace Composer;
  24314. use Composer\Package\RootPackageInterface;
  24315. use Composer\Util\Loop;
  24316. use Composer\Repository\RepositoryManager;
  24317. use Composer\Installer\InstallationManager;
  24318. use Composer\EventDispatcher\EventDispatcher;
  24319. class PartialComposer
  24320. {
  24321. private $package;
  24322. private $loop;
  24323. private $repositoryManager;
  24324. private $installationManager;
  24325. private $config;
  24326. private $eventDispatcher;
  24327. public function setPackage(RootPackageInterface $package): void
  24328. {
  24329. $this->package = $package;
  24330. }
  24331. public function getPackage(): RootPackageInterface
  24332. {
  24333. return $this->package;
  24334. }
  24335. public function setConfig(Config $config): void
  24336. {
  24337. $this->config = $config;
  24338. }
  24339. public function getConfig(): Config
  24340. {
  24341. return $this->config;
  24342. }
  24343. public function setLoop(Loop $loop): void
  24344. {
  24345. $this->loop = $loop;
  24346. }
  24347. public function getLoop(): Loop
  24348. {
  24349. return $this->loop;
  24350. }
  24351. public function setRepositoryManager(RepositoryManager $manager): void
  24352. {
  24353. $this->repositoryManager = $manager;
  24354. }
  24355. public function getRepositoryManager(): RepositoryManager
  24356. {
  24357. return $this->repositoryManager;
  24358. }
  24359. public function setInstallationManager(InstallationManager $manager): void
  24360. {
  24361. $this->installationManager = $manager;
  24362. }
  24363. public function getInstallationManager(): InstallationManager
  24364. {
  24365. return $this->installationManager;
  24366. }
  24367. public function setEventDispatcher(EventDispatcher $eventDispatcher): void
  24368. {
  24369. $this->eventDispatcher = $eventDispatcher;
  24370. }
  24371. public function getEventDispatcher(): EventDispatcher
  24372. {
  24373. return $this->eventDispatcher;
  24374. }
  24375. }
  24376. <?php declare(strict_types=1);
  24377. namespace Composer\Platform;
  24378. use Composer\Util\Platform;
  24379. use Composer\Util\ProcessExecutor;
  24380. use Symfony\Component\Process\ExecutableFinder;
  24381. class HhvmDetector
  24382. {
  24383. private static $hhvmVersion = null;
  24384. private $executableFinder;
  24385. private $processExecutor;
  24386. public function __construct(ExecutableFinder $executableFinder = null, ProcessExecutor $processExecutor = null)
  24387. {
  24388. $this->executableFinder = $executableFinder;
  24389. $this->processExecutor = $processExecutor;
  24390. }
  24391. public function reset(): void
  24392. {
  24393. self::$hhvmVersion = null;
  24394. }
  24395. public function getVersion(): ?string
  24396. {
  24397. if (null !== self::$hhvmVersion) {
  24398. return self::$hhvmVersion ?: null;
  24399. }
  24400. self::$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  24401. if (self::$hhvmVersion === null && !Platform::isWindows()) {
  24402. self::$hhvmVersion = false;
  24403. $this->executableFinder = $this->executableFinder ?: new ExecutableFinder();
  24404. $hhvmPath = $this->executableFinder->find('hhvm');
  24405. if ($hhvmPath !== null) {
  24406. $this->processExecutor = $this->processExecutor ?? new ProcessExecutor();
  24407. $exitCode = $this->processExecutor->execute(
  24408. ProcessExecutor::escape($hhvmPath).
  24409. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  24410. self::$hhvmVersion
  24411. );
  24412. if ($exitCode !== 0) {
  24413. self::$hhvmVersion = false;
  24414. }
  24415. }
  24416. }
  24417. return self::$hhvmVersion ?: null;
  24418. }
  24419. }
  24420. <?php declare(strict_types=1);
  24421. namespace Composer\Platform;
  24422. class Runtime
  24423. {
  24424. public function hasConstant(string $constant, ?string $class = null): bool
  24425. {
  24426. return defined(ltrim($class.'::'.$constant, ':'));
  24427. }
  24428. public function getConstant(string $constant, ?string $class = null)
  24429. {
  24430. return constant(ltrim($class.'::'.$constant, ':'));
  24431. }
  24432. public function hasFunction(string $fn): bool
  24433. {
  24434. return function_exists($fn);
  24435. }
  24436. public function invoke(callable $callable, array $arguments = array())
  24437. {
  24438. return call_user_func_array($callable, $arguments);
  24439. }
  24440. public function hasClass(string $class): bool
  24441. {
  24442. return class_exists($class, false);
  24443. }
  24444. public function construct(string $class, array $arguments = array()): object
  24445. {
  24446. if (empty($arguments)) {
  24447. return new $class;
  24448. }
  24449. $refl = new \ReflectionClass($class);
  24450. return $refl->newInstanceArgs($arguments);
  24451. }
  24452. public function getExtensions(): array
  24453. {
  24454. return get_loaded_extensions();
  24455. }
  24456. public function getExtensionVersion(string $extension): string
  24457. {
  24458. $version = phpversion($extension);
  24459. if ($version === false) {
  24460. $version = '0';
  24461. }
  24462. return $version;
  24463. }
  24464. public function getExtensionInfo(string $extension): string
  24465. {
  24466. $reflector = new \ReflectionExtension($extension);
  24467. ob_start();
  24468. $reflector->info();
  24469. return ob_get_clean();
  24470. }
  24471. }
  24472. <?php declare(strict_types=1);
  24473. namespace Composer\Platform;
  24474. use Composer\Pcre\Preg;
  24475. class Version
  24476. {
  24477. public static function parseOpenssl(string $opensslVersion, ?bool &$isFips): ?string
  24478. {
  24479. $isFips = false;
  24480. if (!Preg::isMatch('/^(?<version>[0-9.]+)(?<patch>[a-z]{0,2})?(?<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)?(?<garbage>-\w+)?(?<garbage2> \(.+?\))?$/', $opensslVersion, $matches)) {
  24481. return null;
  24482. }
  24483. $isFips = strpos($matches['suffix'], 'fips') !== false;
  24484. $suffix = strtr('-'.ltrim($matches['suffix'], '-'), array('-fips' => '', '-pre' => '-alpha'));
  24485. $patch = self::convertAlphaVersionToIntVersion($matches['patch']);
  24486. return rtrim($matches['version'].'.'.$patch.$suffix, '-');
  24487. }
  24488. public static function parseLibjpeg(string $libjpegVersion): ?string
  24489. {
  24490. if (!Preg::isMatch('/^(?<major>\d+)(?<minor>[a-z]*)$/', $libjpegVersion, $matches)) {
  24491. return null;
  24492. }
  24493. return $matches['major'].'.'.self::convertAlphaVersionToIntVersion($matches['minor']);
  24494. }
  24495. public static function parseZoneinfoVersion(string $zoneinfoVersion): ?string
  24496. {
  24497. if (!Preg::isMatch('/^(?<year>\d{4})(?<revision>[a-z]*)$/', $zoneinfoVersion, $matches)) {
  24498. return null;
  24499. }
  24500. return $matches['year'].'.'.self::convertAlphaVersionToIntVersion($matches['revision']);
  24501. }
  24502. private static function convertAlphaVersionToIntVersion(string $alpha): int
  24503. {
  24504. return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
  24505. }
  24506. public static function convertLibxpmVersionId(int $versionId): string
  24507. {
  24508. return self::convertVersionId($versionId, 100);
  24509. }
  24510. public static function convertOpenldapVersionId(int $versionId): string
  24511. {
  24512. return self::convertVersionId($versionId, 100);
  24513. }
  24514. private static function convertVersionId(int $versionId, int $base): string
  24515. {
  24516. return sprintf(
  24517. '%d.%d.%d',
  24518. $versionId / ($base * $base),
  24519. (int) ($versionId / $base) % $base,
  24520. $versionId % $base
  24521. );
  24522. }
  24523. }
  24524. <?php declare(strict_types=1);
  24525. namespace Composer\Plugin\Capability;
  24526. interface Capability
  24527. {
  24528. }
  24529. <?php declare(strict_types=1);
  24530. namespace Composer\Plugin\Capability;
  24531. interface CommandProvider extends Capability
  24532. {
  24533. public function getCommands();
  24534. }
  24535. <?php declare(strict_types=1);
  24536. namespace Composer\Plugin;
  24537. interface Capable
  24538. {
  24539. public function getCapabilities();
  24540. }
  24541. <?php declare(strict_types=1);
  24542. namespace Composer\Plugin;
  24543. use Composer\EventDispatcher\Event;
  24544. use Symfony\Component\Console\Input\InputInterface;
  24545. use Symfony\Component\Console\Output\OutputInterface;
  24546. class CommandEvent extends Event
  24547. {
  24548. private $commandName;
  24549. private $input;
  24550. private $output;
  24551. public function __construct(string $name, string $commandName, InputInterface $input, OutputInterface $output, array $args = array(), array $flags = array())
  24552. {
  24553. parent::__construct($name, $args, $flags);
  24554. $this->commandName = $commandName;
  24555. $this->input = $input;
  24556. $this->output = $output;
  24557. }
  24558. public function getInput(): InputInterface
  24559. {
  24560. return $this->input;
  24561. }
  24562. public function getOutput(): OutputInterface
  24563. {
  24564. return $this->output;
  24565. }
  24566. public function getCommandName(): string
  24567. {
  24568. return $this->commandName;
  24569. }
  24570. }
  24571. <?php declare(strict_types=1);
  24572. namespace Composer\Plugin;
  24573. class PluginEvents
  24574. {
  24575. public const INIT = 'init';
  24576. public const COMMAND = 'command';
  24577. public const PRE_FILE_DOWNLOAD = 'pre-file-download';
  24578. public const POST_FILE_DOWNLOAD = 'post-file-download';
  24579. public const PRE_COMMAND_RUN = 'pre-command-run';
  24580. public const PRE_POOL_CREATE = 'pre-pool-create';
  24581. }
  24582. <?php declare(strict_types=1);
  24583. namespace Composer\Plugin;
  24584. use Composer\Composer;
  24585. use Composer\IO\IOInterface;
  24586. interface PluginInterface
  24587. {
  24588. public const PLUGIN_API_VERSION = '2.3.0';
  24589. public function activate(Composer $composer, IOInterface $io);
  24590. public function deactivate(Composer $composer, IOInterface $io);
  24591. public function uninstall(Composer $composer, IOInterface $io);
  24592. }
  24593. <?php declare(strict_types=1);
  24594. namespace Composer\Plugin;
  24595. use Composer\Composer;
  24596. use Composer\EventDispatcher\EventSubscriberInterface;
  24597. use Composer\Installer\InstallerInterface;
  24598. use Composer\IO\IOInterface;
  24599. use Composer\Package\BasePackage;
  24600. use Composer\Package\CompletePackage;
  24601. use Composer\Package\Package;
  24602. use Composer\Package\Version\VersionParser;
  24603. use Composer\PartialComposer;
  24604. use Composer\Pcre\Preg;
  24605. use Composer\Repository\RepositoryInterface;
  24606. use Composer\Repository\InstalledRepository;
  24607. use Composer\Repository\RootPackageRepository;
  24608. use Composer\Package\PackageInterface;
  24609. use Composer\Package\Link;
  24610. use Composer\Semver\Constraint\Constraint;
  24611. use Composer\Plugin\Capability\Capability;
  24612. use Composer\Util\PackageSorter;
  24613. class PluginManager
  24614. {
  24615. protected $composer;
  24616. protected $io;
  24617. protected $globalComposer;
  24618. protected $versionParser;
  24619. protected $disablePlugins = false;
  24620. protected $plugins = array();
  24621. protected $registeredPlugins = array();
  24622. private $allowPluginRules;
  24623. private $allowGlobalPluginRules;
  24624. private static $classCounter = 0;
  24625. public function __construct(IOInterface $io, Composer $composer, PartialComposer $globalComposer = null, bool $disablePlugins = false)
  24626. {
  24627. $this->io = $io;
  24628. $this->composer = $composer;
  24629. $this->globalComposer = $globalComposer;
  24630. $this->versionParser = new VersionParser();
  24631. $this->disablePlugins = $disablePlugins;
  24632. $this->allowPluginRules = $this->parseAllowedPlugins($composer->getConfig()->get('allow-plugins'));
  24633. $this->allowGlobalPluginRules = $this->parseAllowedPlugins($globalComposer !== null ? $globalComposer->getConfig()->get('allow-plugins') : false);
  24634. }
  24635. public function loadInstalledPlugins(): void
  24636. {
  24637. if ($this->disablePlugins) {
  24638. return;
  24639. }
  24640. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  24641. $globalRepo = $this->globalComposer !== null ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  24642. $this->loadRepository($repo, false);
  24643. if ($globalRepo) {
  24644. $this->loadRepository($globalRepo, true);
  24645. }
  24646. }
  24647. public function deactivateInstalledPlugins(): void
  24648. {
  24649. if ($this->disablePlugins) {
  24650. return;
  24651. }
  24652. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  24653. $this->deactivateRepository($repo, false);
  24654. if ($this->globalComposer !== null) {
  24655. $this->deactivateRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
  24656. }
  24657. }
  24658. public function getPlugins(): array
  24659. {
  24660. return $this->plugins;
  24661. }
  24662. public function getGlobalComposer(): ?PartialComposer
  24663. {
  24664. return $this->globalComposer;
  24665. }
  24666. public function registerPackage(PackageInterface $package, bool $failOnMissingClasses = false, bool $isGlobalPlugin = false): void
  24667. {
  24668. if ($this->disablePlugins) {
  24669. return;
  24670. }
  24671. if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin)) {
  24672. $this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG);
  24673. return;
  24674. }
  24675. if ($package->getType() === 'composer-plugin') {
  24676. $requiresComposer = null;
  24677. foreach ($package->getRequires() as $link) {
  24678. if ('composer-plugin-api' === $link->getTarget()) {
  24679. $requiresComposer = $link->getConstraint();
  24680. break;
  24681. }
  24682. }
  24683. if (!$requiresComposer) {
  24684. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  24685. }
  24686. $currentPluginApiVersion = $this->getPluginApiVersion();
  24687. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  24688. if ($requiresComposer->getPrettyString() === $this->getPluginApiVersion()) {
  24689. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api '.$this->getPluginApiVersion().', this *WILL* break in the future and it should be fixed ASAP (require ^'.$this->getPluginApiVersion().' instead for example).</warning>');
  24690. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  24691. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin '.($isGlobalPlugin ? '(installed globally) ' : '').'was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  24692. return;
  24693. }
  24694. if ($package->getName() === 'symfony/flex' && Preg::isMatch('{^[0-9.]+$}', $package->getVersion()) && version_compare($package->getVersion(), '1.9.8', '<')) {
  24695. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin '.($isGlobalPlugin ? '(installed globally) ' : '').'was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.</warning>');
  24696. return;
  24697. }
  24698. }
  24699. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  24700. if (isset($this->registeredPlugins[$package->getName()])) {
  24701. return;
  24702. }
  24703. $extra = $package->getExtra();
  24704. if (empty($extra['class'])) {
  24705. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  24706. }
  24707. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  24708. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  24709. $globalRepo = $this->globalComposer !== null ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  24710. $rootPackage = clone $this->composer->getPackage();
  24711. $rootPackageAutoloads = $rootPackage->getAutoload();
  24712. $rootPackageAutoloads['files'] = array();
  24713. $rootPackage->setAutoload($rootPackageAutoloads);
  24714. $rootPackageAutoloads = $rootPackage->getDevAutoload();
  24715. $rootPackageAutoloads['files'] = array();
  24716. $rootPackage->setDevAutoload($rootPackageAutoloads);
  24717. unset($rootPackageAutoloads);
  24718. $rootPackageRepo = new RootPackageRepository($rootPackage);
  24719. $installedRepo = new InstalledRepository(array($localRepo, $rootPackageRepo));
  24720. if ($globalRepo) {
  24721. $installedRepo->addRepository($globalRepo);
  24722. }
  24723. $autoloadPackages = array($package->getName() => $package);
  24724. $autoloadPackages = $this->collectDependencies($installedRepo, $autoloadPackages, $package);
  24725. $generator = $this->composer->getAutoloadGenerator();
  24726. $autoloads = array(array($rootPackage, ''));
  24727. foreach ($autoloadPackages as $autoloadPackage) {
  24728. if ($autoloadPackage === $rootPackage) {
  24729. continue;
  24730. }
  24731. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  24732. $autoloads[] = array($autoloadPackage, $downloadPath);
  24733. }
  24734. $map = $generator->parseAutoloads($autoloads, $rootPackage);
  24735. $classLoader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
  24736. $classLoader->register(false);
  24737. foreach ($map['files'] as $fileIdentifier => $file) {
  24738. if ($fileIdentifier === '7e9bd612cc444b3eed788ebbe46263a0') {
  24739. continue;
  24740. }
  24741. \Composer\Autoload\composerRequire($fileIdentifier, $file);
  24742. }
  24743. foreach ($classes as $class) {
  24744. if (class_exists($class, false)) {
  24745. $class = trim($class, '\\');
  24746. $path = $classLoader->findFile($class);
  24747. $code = file_get_contents($path);
  24748. $separatorPos = strrpos($class, '\\');
  24749. $className = $class;
  24750. if ($separatorPos) {
  24751. $className = substr($class, $separatorPos + 1);
  24752. }
  24753. $code = Preg::replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  24754. $code = strtr($code, array(
  24755. '__FILE__' => var_export($path, true),
  24756. '__DIR__' => var_export(dirname($path), true),
  24757. '__CLASS__' => var_export($class, true),
  24758. ));
  24759. $code = Preg::replace('/^\s*<\?(php)?/i', '', $code, 1);
  24760. eval($code);
  24761. $class .= '_composer_tmp'.self::$classCounter;
  24762. self::$classCounter++;
  24763. }
  24764. if ($oldInstallerPlugin) {
  24765. if (!is_a($class, 'Composer\Installer\InstallerInterface', true)) {
  24766. throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Installer\InstallerInterface');
  24767. }
  24768. $this->io->writeError('<warning>Loading "'.$package->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').'which is a legacy composer-installer built for Composer 1.x, it is likely to cause issues as you are running Composer 2.x.</warning>');
  24769. $installer = new $class($this->io, $this->composer);
  24770. $this->composer->getInstallationManager()->addInstaller($installer);
  24771. $this->registeredPlugins[$package->getName()] = $installer;
  24772. } elseif (class_exists($class)) {
  24773. if (!is_a($class, 'Composer\Plugin\PluginInterface', true)) {
  24774. throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Plugin\PluginInterface');
  24775. }
  24776. $plugin = new $class();
  24777. $this->addPlugin($plugin, $isGlobalPlugin, $package);
  24778. $this->registeredPlugins[$package->getName()] = $plugin;
  24779. } elseif ($failOnMissingClasses) {
  24780. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  24781. }
  24782. }
  24783. }
  24784. public function deactivatePackage(PackageInterface $package): void
  24785. {
  24786. if ($this->disablePlugins) {
  24787. return;
  24788. }
  24789. if (!isset($this->registeredPlugins[$package->getName()])) {
  24790. return;
  24791. }
  24792. $plugin = $this->registeredPlugins[$package->getName()];
  24793. unset($this->registeredPlugins[$package->getName()]);
  24794. if ($plugin instanceof InstallerInterface) {
  24795. $this->composer->getInstallationManager()->removeInstaller($plugin);
  24796. } else {
  24797. $this->removePlugin($plugin);
  24798. }
  24799. }
  24800. public function uninstallPackage(PackageInterface $package): void
  24801. {
  24802. if ($this->disablePlugins) {
  24803. return;
  24804. }
  24805. if (!isset($this->registeredPlugins[$package->getName()])) {
  24806. return;
  24807. }
  24808. $plugin = $this->registeredPlugins[$package->getName()];
  24809. if ($plugin instanceof InstallerInterface) {
  24810. $this->deactivatePackage($package);
  24811. } else {
  24812. unset($this->registeredPlugins[$package->getName()]);
  24813. $this->removePlugin($plugin);
  24814. $this->uninstallPlugin($plugin);
  24815. }
  24816. }
  24817. protected function getPluginApiVersion(): string
  24818. {
  24819. return PluginInterface::PLUGIN_API_VERSION;
  24820. }
  24821. public function addPlugin(PluginInterface $plugin, bool $isGlobalPlugin = false, PackageInterface $sourcePackage = null): void
  24822. {
  24823. if ($sourcePackage === null) {
  24824. trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED);
  24825. } elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin)) {
  24826. $this->io->writeError('Skipped loading "'.get_class($plugin).' from '.$sourcePackage->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').' as it is not in config.allow-plugins', true, IOInterface::DEBUG);
  24827. return;
  24828. }
  24829. $details = array();
  24830. if ($sourcePackage) {
  24831. $details[] = 'from '.$sourcePackage->getName();
  24832. }
  24833. if ($isGlobalPlugin) {
  24834. $details[] = 'installed globally';
  24835. }
  24836. $this->io->writeError('Loading plugin '.get_class($plugin).($details ? ' ('.implode(', ', $details).')' : ''), true, IOInterface::DEBUG);
  24837. $this->plugins[] = $plugin;
  24838. $plugin->activate($this->composer, $this->io);
  24839. if ($plugin instanceof EventSubscriberInterface) {
  24840. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  24841. }
  24842. }
  24843. public function removePlugin(PluginInterface $plugin): void
  24844. {
  24845. $index = array_search($plugin, $this->plugins, true);
  24846. if ($index === false) {
  24847. return;
  24848. }
  24849. $this->io->writeError('Unloading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  24850. unset($this->plugins[$index]);
  24851. $plugin->deactivate($this->composer, $this->io);
  24852. $this->composer->getEventDispatcher()->removeListener($plugin);
  24853. }
  24854. public function uninstallPlugin(PluginInterface $plugin): void
  24855. {
  24856. $this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG);
  24857. $plugin->uninstall($this->composer, $this->io);
  24858. }
  24859. private function loadRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
  24860. {
  24861. $packages = $repo->getPackages();
  24862. $weights = array();
  24863. foreach ($packages as $package) {
  24864. if ($package->getType() === 'composer-plugin') {
  24865. $extra = $package->getExtra();
  24866. if ($package->getName() === 'composer/installers' || true === ($extra['plugin-modifies-install-path'] ?? false)) {
  24867. $weights[$package->getName()] = -10000;
  24868. }
  24869. }
  24870. }
  24871. $sortedPackages = PackageSorter::sortPackages($packages, $weights);
  24872. foreach ($sortedPackages as $package) {
  24873. if (!($package instanceof CompletePackage)) {
  24874. continue;
  24875. }
  24876. if ('composer-plugin' === $package->getType()) {
  24877. $this->registerPackage($package, false, $isGlobalRepo);
  24878. } elseif ('composer-installer' === $package->getType()) {
  24879. $this->registerPackage($package, false, $isGlobalRepo);
  24880. }
  24881. }
  24882. }
  24883. private function deactivateRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
  24884. {
  24885. $packages = $repo->getPackages();
  24886. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  24887. foreach ($sortedPackages as $package) {
  24888. if (!($package instanceof CompletePackage)) {
  24889. continue;
  24890. }
  24891. if ('composer-plugin' === $package->getType()) {
  24892. $this->deactivatePackage($package);
  24893. } elseif ('composer-installer' === $package->getType()) {
  24894. $this->deactivatePackage($package);
  24895. }
  24896. }
  24897. }
  24898. private function collectDependencies(InstalledRepository $installedRepo, array $collected, PackageInterface $package): array
  24899. {
  24900. foreach ($package->getRequires() as $requireLink) {
  24901. foreach ($installedRepo->findPackagesWithReplacersAndProviders($requireLink->getTarget()) as $requiredPackage) {
  24902. if (!isset($collected[$requiredPackage->getName()])) {
  24903. $collected[$requiredPackage->getName()] = $requiredPackage;
  24904. $collected = $this->collectDependencies($installedRepo, $collected, $requiredPackage);
  24905. }
  24906. }
  24907. }
  24908. return $collected;
  24909. }
  24910. private function getInstallPath(PackageInterface $package, bool $global = false): string
  24911. {
  24912. if (!$global) {
  24913. return $this->composer->getInstallationManager()->getInstallPath($package);
  24914. }
  24915. assert(null !== $this->globalComposer);
  24916. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  24917. }
  24918. protected function getCapabilityImplementationClassName(PluginInterface $plugin, string $capability): ?string
  24919. {
  24920. if (!($plugin instanceof Capable)) {
  24921. return null;
  24922. }
  24923. $capabilities = (array) $plugin->getCapabilities();
  24924. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  24925. return trim($capabilities[$capability]);
  24926. }
  24927. if (
  24928. array_key_exists($capability, $capabilities)
  24929. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  24930. ) {
  24931. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], true));
  24932. }
  24933. return null;
  24934. }
  24935. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array()): ?Capability
  24936. {
  24937. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  24938. if (!class_exists($capabilityClass)) {
  24939. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  24940. }
  24941. $ctorArgs['plugin'] = $plugin;
  24942. $capabilityObj = new $capabilityClass($ctorArgs);
  24943. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  24944. throw new \RuntimeException(
  24945. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  24946. );
  24947. }
  24948. return $capabilityObj;
  24949. }
  24950. return null;
  24951. }
  24952. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array()): array
  24953. {
  24954. $capabilities = array();
  24955. foreach ($this->getPlugins() as $plugin) {
  24956. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  24957. $capabilities[] = $capability;
  24958. }
  24959. }
  24960. return $capabilities;
  24961. }
  24962. private function parseAllowedPlugins($allowPluginsConfig): ?array
  24963. {
  24964. if (null === $allowPluginsConfig) {
  24965. return null;
  24966. }
  24967. if (true === $allowPluginsConfig) {
  24968. return array('{}' => true);
  24969. }
  24970. if (false === $allowPluginsConfig) {
  24971. return array('{}' => false);
  24972. }
  24973. $rules = array();
  24974. foreach ($allowPluginsConfig as $pattern => $allow) {
  24975. $rules[BasePackage::packageNameToRegexp($pattern)] = $allow;
  24976. }
  24977. return $rules;
  24978. }
  24979. private function isPluginAllowed(string $package, bool $isGlobalPlugin): bool
  24980. {
  24981. static $warned = array();
  24982. $rules = $isGlobalPlugin ? $this->allowGlobalPluginRules : $this->allowPluginRules;
  24983. if ($rules === null) {
  24984. if (!$this->io->isInteractive()) {
  24985. if (!isset($warned['all'])) {
  24986. $this->io->writeError('<warning>For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins</warning>');
  24987. $this->io->writeError('<warning>You have until July 2022 to add the setting. Composer will then switch the default behavior to disallow all plugins.</warning>');
  24988. $warned['all'] = true;
  24989. }
  24990. return true;
  24991. }
  24992. $rules = array();
  24993. }
  24994. foreach ($rules as $pattern => $allow) {
  24995. if (Preg::isMatch($pattern, $package)) {
  24996. return $allow === true;
  24997. }
  24998. }
  24999. if ($package === 'composer/package-versions-deprecated') {
  25000. return false;
  25001. }
  25002. if (!isset($warned[$package])) {
  25003. if ($this->io->isInteractive()) {
  25004. $composer = $isGlobalPlugin && $this->globalComposer !== null ? $this->globalComposer : $this->composer;
  25005. $this->io->writeError('<warning>'.$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins</warning>');
  25006. $attempts = 0;
  25007. while (true) {
  25008. $default = '?';
  25009. if ($attempts > 5) {
  25010. $default = 'd';
  25011. }
  25012. switch ($answer = $this->io->ask('Do you trust "<fg=green;options=bold>'.$package.'</>" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [<comment>y,n,d,?</comment>] ', $default)) {
  25013. case 'y':
  25014. case 'n':
  25015. case 'd':
  25016. $allow = $answer === 'y';
  25017. if ($isGlobalPlugin) {
  25018. $this->allowGlobalPluginRules[BasePackage::packageNameToRegexp($package)] = $allow;
  25019. } else {
  25020. $this->allowPluginRules[BasePackage::packageNameToRegexp($package)] = $allow;
  25021. }
  25022. if ($answer === 'y' || $answer === 'n') {
  25023. $composer->getConfig()->getConfigSource()->addConfigSetting('allow-plugins.'.$package, $allow);
  25024. }
  25025. return $allow;
  25026. case '?':
  25027. default:
  25028. $attempts++;
  25029. $this->io->writeError(array(
  25030. 'y - add package to allow-plugins in composer.json and let it run immediately',
  25031. 'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts',
  25032. 'd - discard this, do not change composer.json and do not allow the plugin to run',
  25033. '? - print help',
  25034. ));
  25035. break;
  25036. }
  25037. }
  25038. } else {
  25039. $this->io->writeError('<warning>'.$package.($isGlobalPlugin ? ' (installed globally)' : '').' contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins</warning>');
  25040. $this->io->writeError('<warning>You can run "composer '.($isGlobalPlugin ? 'global ' : '').'config --no-plugins allow-plugins.'.$package.' [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)</warning>');
  25041. }
  25042. $warned[$package] = true;
  25043. }
  25044. return false;
  25045. }
  25046. }
  25047. <?php declare(strict_types=1);
  25048. namespace Composer\Plugin;
  25049. use Composer\EventDispatcher\Event;
  25050. use Composer\Package\PackageInterface;
  25051. class PostFileDownloadEvent extends Event
  25052. {
  25053. private $fileName;
  25054. private $checksum;
  25055. private $url;
  25056. private $context;
  25057. private $type;
  25058. public function __construct(string $name, ?string $fileName, ?string $checksum, string $url, string $type, $context = null)
  25059. {
  25060. if ($context === null && $type instanceof PackageInterface) {
  25061. $context = $type;
  25062. $type = 'package';
  25063. trigger_error('PostFileDownloadEvent::__construct should receive a $type=package and the package object in $context since Composer 2.1.', E_USER_DEPRECATED);
  25064. }
  25065. parent::__construct($name);
  25066. $this->fileName = $fileName;
  25067. $this->checksum = $checksum;
  25068. $this->url = $url;
  25069. $this->context = $context;
  25070. $this->type = $type;
  25071. }
  25072. public function getFileName(): ?string
  25073. {
  25074. return $this->fileName;
  25075. }
  25076. public function getChecksum(): ?string
  25077. {
  25078. return $this->checksum;
  25079. }
  25080. public function getUrl(): string
  25081. {
  25082. return $this->url;
  25083. }
  25084. public function getContext()
  25085. {
  25086. return $this->context;
  25087. }
  25088. public function getPackage(): ?PackageInterface
  25089. {
  25090. trigger_error('PostFileDownloadEvent::getPackage is deprecated since Composer 2.1, use getContext instead.', E_USER_DEPRECATED);
  25091. $context = $this->getContext();
  25092. return $context instanceof PackageInterface ? $context : null;
  25093. }
  25094. public function getType(): string
  25095. {
  25096. return $this->type;
  25097. }
  25098. }
  25099. <?php declare(strict_types=1);
  25100. namespace Composer\Plugin;
  25101. use Composer\EventDispatcher\Event;
  25102. use Symfony\Component\Console\Input\InputInterface;
  25103. class PreCommandRunEvent extends Event
  25104. {
  25105. private $input;
  25106. private $command;
  25107. public function __construct(string $name, InputInterface $input, string $command)
  25108. {
  25109. parent::__construct($name);
  25110. $this->input = $input;
  25111. $this->command = $command;
  25112. }
  25113. public function getInput(): InputInterface
  25114. {
  25115. return $this->input;
  25116. }
  25117. public function getCommand(): string
  25118. {
  25119. return $this->command;
  25120. }
  25121. }
  25122. <?php declare(strict_types=1);
  25123. namespace Composer\Plugin;
  25124. use Composer\EventDispatcher\Event;
  25125. use Composer\Util\HttpDownloader;
  25126. class PreFileDownloadEvent extends Event
  25127. {
  25128. private $httpDownloader;
  25129. private $processedUrl;
  25130. private $customCacheKey;
  25131. private $type;
  25132. private $context;
  25133. private $transportOptions = array();
  25134. public function __construct(string $name, HttpDownloader $httpDownloader, string $processedUrl, string $type, $context = null)
  25135. {
  25136. parent::__construct($name);
  25137. $this->httpDownloader = $httpDownloader;
  25138. $this->processedUrl = $processedUrl;
  25139. $this->type = $type;
  25140. $this->context = $context;
  25141. }
  25142. public function getHttpDownloader(): HttpDownloader
  25143. {
  25144. return $this->httpDownloader;
  25145. }
  25146. public function getProcessedUrl(): string
  25147. {
  25148. return $this->processedUrl;
  25149. }
  25150. public function setProcessedUrl(string $processedUrl): void
  25151. {
  25152. $this->processedUrl = $processedUrl;
  25153. }
  25154. public function getCustomCacheKey(): ?string
  25155. {
  25156. return $this->customCacheKey;
  25157. }
  25158. public function setCustomCacheKey(?string $customCacheKey): void
  25159. {
  25160. $this->customCacheKey = $customCacheKey;
  25161. }
  25162. public function getType(): string
  25163. {
  25164. return $this->type;
  25165. }
  25166. public function getContext()
  25167. {
  25168. return $this->context;
  25169. }
  25170. public function getTransportOptions(): array
  25171. {
  25172. return $this->transportOptions;
  25173. }
  25174. public function setTransportOptions(array $options): void
  25175. {
  25176. $this->transportOptions = $options;
  25177. }
  25178. }
  25179. <?php declare(strict_types=1);
  25180. namespace Composer\Plugin;
  25181. use Composer\EventDispatcher\Event;
  25182. use Composer\Repository\RepositoryInterface;
  25183. use Composer\DependencyResolver\Request;
  25184. use Composer\Package\BasePackage;
  25185. class PrePoolCreateEvent extends Event
  25186. {
  25187. private $repositories;
  25188. private $request;
  25189. private $acceptableStabilities;
  25190. private $stabilityFlags;
  25191. private $rootAliases;
  25192. private $rootReferences;
  25193. private $packages;
  25194. private $unacceptableFixedPackages;
  25195. public function __construct(string $name, array $repositories, Request $request, array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, array $packages, array $unacceptableFixedPackages)
  25196. {
  25197. parent::__construct($name);
  25198. $this->repositories = $repositories;
  25199. $this->request = $request;
  25200. $this->acceptableStabilities = $acceptableStabilities;
  25201. $this->stabilityFlags = $stabilityFlags;
  25202. $this->rootAliases = $rootAliases;
  25203. $this->rootReferences = $rootReferences;
  25204. $this->packages = $packages;
  25205. $this->unacceptableFixedPackages = $unacceptableFixedPackages;
  25206. }
  25207. public function getRepositories(): array
  25208. {
  25209. return $this->repositories;
  25210. }
  25211. public function getRequest(): Request
  25212. {
  25213. return $this->request;
  25214. }
  25215. public function getAcceptableStabilities(): array
  25216. {
  25217. return $this->acceptableStabilities;
  25218. }
  25219. public function getStabilityFlags(): array
  25220. {
  25221. return $this->stabilityFlags;
  25222. }
  25223. public function getRootAliases(): array
  25224. {
  25225. return $this->rootAliases;
  25226. }
  25227. public function getRootReferences(): array
  25228. {
  25229. return $this->rootReferences;
  25230. }
  25231. public function getPackages(): array
  25232. {
  25233. return $this->packages;
  25234. }
  25235. public function getUnacceptableFixedPackages(): array
  25236. {
  25237. return $this->unacceptableFixedPackages;
  25238. }
  25239. public function setPackages(array $packages): void
  25240. {
  25241. $this->packages = $packages;
  25242. }
  25243. public function setUnacceptableFixedPackages(array $packages): void
  25244. {
  25245. $this->unacceptableFixedPackages = $packages;
  25246. }
  25247. }
  25248. <?php declare(strict_types=1);
  25249. namespace Composer\Question;
  25250. use Composer\Pcre\Preg;
  25251. use Symfony\Component\Console\Exception\InvalidArgumentException;
  25252. use Symfony\Component\Console\Question\Question;
  25253. class StrictConfirmationQuestion extends Question
  25254. {
  25255. private $trueAnswerRegex;
  25256. private $falseAnswerRegex;
  25257. public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y(?:es)?$/i', string $falseAnswerRegex = '/^no?$/i')
  25258. {
  25259. parent::__construct($question, (bool) $default);
  25260. $this->trueAnswerRegex = $trueAnswerRegex;
  25261. $this->falseAnswerRegex = $falseAnswerRegex;
  25262. $this->setNormalizer($this->getDefaultNormalizer());
  25263. $this->setValidator($this->getDefaultValidator());
  25264. }
  25265. private function getDefaultNormalizer(): callable
  25266. {
  25267. $default = $this->getDefault();
  25268. $trueRegex = $this->trueAnswerRegex;
  25269. $falseRegex = $this->falseAnswerRegex;
  25270. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  25271. if (is_bool($answer)) {
  25272. return $answer;
  25273. }
  25274. if (empty($answer) && !empty($default)) {
  25275. return $default;
  25276. }
  25277. if (Preg::isMatch($trueRegex, $answer)) {
  25278. return true;
  25279. }
  25280. if (Preg::isMatch($falseRegex, $answer)) {
  25281. return false;
  25282. }
  25283. return null;
  25284. };
  25285. }
  25286. private function getDefaultValidator(): callable
  25287. {
  25288. return function ($answer): bool {
  25289. if (!is_bool($answer)) {
  25290. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  25291. }
  25292. return $answer;
  25293. };
  25294. }
  25295. }
  25296. <?php declare(strict_types=1);
  25297. namespace Composer\Repository;
  25298. use Composer\Package\AliasPackage;
  25299. use Composer\Package\BasePackage;
  25300. use Composer\Package\CompleteAliasPackage;
  25301. use Composer\Package\CompletePackage;
  25302. use Composer\Package\PackageInterface;
  25303. use Composer\Package\CompletePackageInterface;
  25304. use Composer\Package\Version\VersionParser;
  25305. use Composer\Package\Version\StabilityFilter;
  25306. use Composer\Pcre\Preg;
  25307. use Composer\Semver\Constraint\ConstraintInterface;
  25308. use Composer\Semver\Constraint\Constraint;
  25309. class ArrayRepository implements RepositoryInterface
  25310. {
  25311. protected $packages = null;
  25312. protected $packageMap = null;
  25313. public function __construct(array $packages = array())
  25314. {
  25315. foreach ($packages as $package) {
  25316. $this->addPackage($package);
  25317. }
  25318. }
  25319. public function getRepoName()
  25320. {
  25321. return 'array repo (defining '.$this->count().' package'.($this->count() > 1 ? 's' : '').')';
  25322. }
  25323. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array())
  25324. {
  25325. $packages = $this->getPackages();
  25326. $result = array();
  25327. $namesFound = array();
  25328. foreach ($packages as $package) {
  25329. if (array_key_exists($package->getName(), $packageNameMap)) {
  25330. if (
  25331. (!$packageNameMap[$package->getName()] || $packageNameMap[$package->getName()]->matches(new Constraint('==', $package->getVersion())))
  25332. && StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, $package->getNames(), $package->getStability())
  25333. && !isset($alreadyLoaded[$package->getName()][$package->getVersion()])
  25334. ) {
  25335. $result[spl_object_hash($package)] = $package;
  25336. if ($package instanceof AliasPackage && !isset($result[spl_object_hash($package->getAliasOf())])) {
  25337. $result[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
  25338. }
  25339. }
  25340. $namesFound[$package->getName()] = true;
  25341. }
  25342. }
  25343. foreach ($packages as $package) {
  25344. if ($package instanceof AliasPackage) {
  25345. if (isset($result[spl_object_hash($package->getAliasOf())])) {
  25346. $result[spl_object_hash($package)] = $package;
  25347. }
  25348. }
  25349. }
  25350. return array('namesFound' => array_keys($namesFound), 'packages' => $result);
  25351. }
  25352. public function findPackage(string $name, $constraint)
  25353. {
  25354. $name = strtolower($name);
  25355. if (!$constraint instanceof ConstraintInterface) {
  25356. $versionParser = new VersionParser();
  25357. $constraint = $versionParser->parseConstraints($constraint);
  25358. }
  25359. foreach ($this->getPackages() as $package) {
  25360. if ($name === $package->getName()) {
  25361. $pkgConstraint = new Constraint('==', $package->getVersion());
  25362. if ($constraint->matches($pkgConstraint)) {
  25363. return $package;
  25364. }
  25365. }
  25366. }
  25367. return null;
  25368. }
  25369. public function findPackages(string $name, $constraint = null)
  25370. {
  25371. $name = strtolower($name);
  25372. $packages = array();
  25373. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  25374. $versionParser = new VersionParser();
  25375. $constraint = $versionParser->parseConstraints($constraint);
  25376. }
  25377. foreach ($this->getPackages() as $package) {
  25378. if ($name === $package->getName()) {
  25379. if (null === $constraint || $constraint->matches(new Constraint('==', $package->getVersion()))) {
  25380. $packages[] = $package;
  25381. }
  25382. }
  25383. }
  25384. return $packages;
  25385. }
  25386. public function search(string $query, int $mode = 0, ?string $type = null)
  25387. {
  25388. if ($mode === self::SEARCH_FULLTEXT) {
  25389. $regex = '{(?:'.implode('|', Preg::split('{\s+}', preg_quote($query))).')}i';
  25390. } else {
  25391. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  25392. }
  25393. $matches = array();
  25394. foreach ($this->getPackages() as $package) {
  25395. $name = $package->getName();
  25396. if ($mode === self::SEARCH_VENDOR) {
  25397. list($name) = explode('/', $name);
  25398. }
  25399. if (isset($matches[$name])) {
  25400. continue;
  25401. }
  25402. if (null !== $type && $package->getType() !== $type) {
  25403. continue;
  25404. }
  25405. if (Preg::isMatch($regex, $name)
  25406. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && Preg::isMatch($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  25407. ) {
  25408. if ($mode === self::SEARCH_VENDOR) {
  25409. $matches[$name] = array(
  25410. 'name' => $name,
  25411. 'description' => null,
  25412. );
  25413. } else {
  25414. $matches[$name] = array(
  25415. 'name' => $package->getPrettyName(),
  25416. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  25417. );
  25418. if ($package instanceof CompletePackageInterface && $package->isAbandoned()) {
  25419. $matches[$name]['abandoned'] = $package->getReplacementPackage() ?: true;
  25420. }
  25421. }
  25422. }
  25423. }
  25424. return array_values($matches);
  25425. }
  25426. public function hasPackage(PackageInterface $package)
  25427. {
  25428. if ($this->packageMap === null) {
  25429. $this->packageMap = array();
  25430. foreach ($this->getPackages() as $repoPackage) {
  25431. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  25432. }
  25433. }
  25434. return isset($this->packageMap[$package->getUniqueName()]);
  25435. }
  25436. public function addPackage(PackageInterface $package)
  25437. {
  25438. if (!$package instanceof BasePackage) {
  25439. throw new \InvalidArgumentException('Only subclasses of BasePackage are supported');
  25440. }
  25441. if (null === $this->packages) {
  25442. $this->initialize();
  25443. }
  25444. $package->setRepository($this);
  25445. $this->packages[] = $package;
  25446. if ($package instanceof AliasPackage) {
  25447. $aliasedPackage = $package->getAliasOf();
  25448. if (null === $aliasedPackage->getRepository()) {
  25449. $this->addPackage($aliasedPackage);
  25450. }
  25451. }
  25452. $this->packageMap = null;
  25453. }
  25454. public function getProviders(string $packageName)
  25455. {
  25456. $result = array();
  25457. foreach ($this->getPackages() as $candidate) {
  25458. if (isset($result[$candidate->getName()])) {
  25459. continue;
  25460. }
  25461. foreach ($candidate->getProvides() as $link) {
  25462. if ($packageName === $link->getTarget()) {
  25463. $result[$candidate->getName()] = array(
  25464. 'name' => $candidate->getName(),
  25465. 'description' => $candidate instanceof CompletePackageInterface ? $candidate->getDescription() : null,
  25466. 'type' => $candidate->getType(),
  25467. );
  25468. continue 2;
  25469. }
  25470. }
  25471. }
  25472. return $result;
  25473. }
  25474. protected function createAliasPackage(BasePackage $package, string $alias, string $prettyAlias)
  25475. {
  25476. while ($package instanceof AliasPackage) {
  25477. $package = $package->getAliasOf();
  25478. }
  25479. if ($package instanceof CompletePackage) {
  25480. return new CompleteAliasPackage($package, $alias, $prettyAlias);
  25481. }
  25482. return new AliasPackage($package, $alias, $prettyAlias);
  25483. }
  25484. public function removePackage(PackageInterface $package)
  25485. {
  25486. $packageId = $package->getUniqueName();
  25487. foreach ($this->getPackages() as $key => $repoPackage) {
  25488. if ($packageId === $repoPackage->getUniqueName()) {
  25489. array_splice($this->packages, $key, 1);
  25490. $this->packageMap = null;
  25491. return;
  25492. }
  25493. }
  25494. }
  25495. public function getPackages()
  25496. {
  25497. if (null === $this->packages) {
  25498. $this->initialize();
  25499. }
  25500. if (null === $this->packages) {
  25501. throw new \LogicException('initialize failed to initialize the packages array');
  25502. }
  25503. return $this->packages;
  25504. }
  25505. public function count(): int
  25506. {
  25507. if (null === $this->packages) {
  25508. $this->initialize();
  25509. }
  25510. return count($this->packages);
  25511. }
  25512. protected function initialize()
  25513. {
  25514. $this->packages = array();
  25515. }
  25516. }
  25517. <?php declare(strict_types=1);
  25518. namespace Composer\Repository;
  25519. use Composer\IO\IOInterface;
  25520. use Composer\Json\JsonFile;
  25521. use Composer\Package\BasePackage;
  25522. use Composer\Package\Loader\ArrayLoader;
  25523. use Composer\Package\Loader\LoaderInterface;
  25524. use Composer\Util\Tar;
  25525. use Composer\Util\Zip;
  25526. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  25527. {
  25528. protected $loader;
  25529. protected $lookup;
  25530. protected $repoConfig;
  25531. private $io;
  25532. public function __construct(array $repoConfig, IOInterface $io)
  25533. {
  25534. parent::__construct();
  25535. if (!extension_loaded('zip')) {
  25536. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  25537. }
  25538. $this->loader = new ArrayLoader();
  25539. $this->lookup = $repoConfig['url'];
  25540. $this->io = $io;
  25541. $this->repoConfig = $repoConfig;
  25542. }
  25543. public function getRepoName()
  25544. {
  25545. return 'artifact repo ('.$this->lookup.')';
  25546. }
  25547. public function getRepoConfig()
  25548. {
  25549. return $this->repoConfig;
  25550. }
  25551. protected function initialize()
  25552. {
  25553. parent::initialize();
  25554. $this->scanDirectory($this->lookup);
  25555. }
  25556. private function scanDirectory(string $path): void
  25557. {
  25558. $io = $this->io;
  25559. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  25560. $iterator = new \RecursiveIteratorIterator($directory);
  25561. $regex = new \RegexIterator($iterator, '/^.+\.(zip|tar|gz|tgz)$/i');
  25562. foreach ($regex as $file) {
  25563. if (!$file->isFile()) {
  25564. continue;
  25565. }
  25566. $package = $this->getComposerInformation($file);
  25567. if (!$package) {
  25568. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  25569. continue;
  25570. }
  25571. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  25572. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  25573. $this->addPackage($package);
  25574. }
  25575. }
  25576. private function getComposerInformation(\SplFileInfo $file): ?BasePackage
  25577. {
  25578. $json = null;
  25579. $fileType = null;
  25580. $fileExtension = pathinfo($file->getPathname(), PATHINFO_EXTENSION);
  25581. if (in_array($fileExtension, array('gz', 'tar', 'tgz'), true)) {
  25582. $fileType = 'tar';
  25583. } elseif ($fileExtension === 'zip') {
  25584. $fileType = 'zip';
  25585. } else {
  25586. throw new \RuntimeException('Files with "'.$fileExtension.'" extensions aren\'t supported. Only ZIP and TAR/TAR.GZ/TGZ archives are supported.');
  25587. }
  25588. try {
  25589. if ($fileType === 'tar') {
  25590. $json = Tar::getComposerJson($file->getPathname());
  25591. } else {
  25592. $json = Zip::getComposerJson($file->getPathname());
  25593. }
  25594. } catch (\Exception $exception) {
  25595. $this->io->write('Failed loading package '.$file->getPathname().': '.$exception->getMessage(), false, IOInterface::VERBOSE);
  25596. }
  25597. if (null === $json) {
  25598. return null;
  25599. }
  25600. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  25601. $package['dist'] = array(
  25602. 'type' => $fileType,
  25603. 'url' => strtr($file->getPathname(), '\\', '/'),
  25604. 'shasum' => sha1_file($file->getRealPath()),
  25605. );
  25606. try {
  25607. $package = $this->loader->load($package);
  25608. } catch (\UnexpectedValueException $e) {
  25609. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  25610. }
  25611. return $package;
  25612. }
  25613. }
  25614. <?php declare(strict_types=1);
  25615. namespace Composer\Repository;
  25616. use Composer\Package\BasePackage;
  25617. use Composer\Package\Loader\ArrayLoader;
  25618. use Composer\Package\PackageInterface;
  25619. use Composer\Package\AliasPackage;
  25620. use Composer\Package\CompletePackage;
  25621. use Composer\Package\CompleteAliasPackage;
  25622. use Composer\Package\Version\VersionParser;
  25623. use Composer\Package\Version\StabilityFilter;
  25624. use Composer\Json\JsonFile;
  25625. use Composer\Cache;
  25626. use Composer\Config;
  25627. use Composer\IO\IOInterface;
  25628. use Composer\Pcre\Preg;
  25629. use Composer\Plugin\PostFileDownloadEvent;
  25630. use Composer\Semver\CompilingMatcher;
  25631. use Composer\Util\HttpDownloader;
  25632. use Composer\Util\Loop;
  25633. use Composer\Plugin\PluginEvents;
  25634. use Composer\Plugin\PreFileDownloadEvent;
  25635. use Composer\EventDispatcher\EventDispatcher;
  25636. use Composer\Downloader\TransportException;
  25637. use Composer\Semver\Constraint\ConstraintInterface;
  25638. use Composer\Semver\Constraint\Constraint;
  25639. use Composer\Semver\Constraint\MatchAllConstraint;
  25640. use Composer\Util\Http\Response;
  25641. use Composer\MetadataMinifier\MetadataMinifier;
  25642. use Composer\Util\Url;
  25643. use React\Promise\PromiseInterface;
  25644. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  25645. {
  25646. private $repoConfig;
  25647. private $options;
  25648. private $url;
  25649. private $baseUrl;
  25650. private $io;
  25651. private $httpDownloader;
  25652. private $loop;
  25653. protected $cache;
  25654. protected $notifyUrl = null;
  25655. protected $searchUrl = null;
  25656. protected $providersApiUrl = null;
  25657. protected $hasProviders = false;
  25658. protected $providersUrl = null;
  25659. protected $listUrl = null;
  25660. protected $hasAvailablePackageList = false;
  25661. protected $availablePackages = null;
  25662. protected $availablePackagePatterns = null;
  25663. protected $lazyProvidersUrl = null;
  25664. protected $providerListing;
  25665. protected $loader;
  25666. private $allowSslDowngrade = false;
  25667. private $eventDispatcher;
  25668. private $sourceMirrors;
  25669. private $distMirrors;
  25670. private $degradedMode = false;
  25671. private $rootData;
  25672. private $hasPartialPackages = false;
  25673. private $partialPackagesByName = null;
  25674. private $freshMetadataUrls = array();
  25675. private $packagesNotFoundCache = array();
  25676. private $versionParser;
  25677. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $eventDispatcher = null)
  25678. {
  25679. parent::__construct();
  25680. if (!Preg::isMatch('{^[\w.]+\??://}', $repoConfig['url'])) {
  25681. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  25682. }
  25683. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  25684. if (strpos($repoConfig['url'], 'https?') === 0) {
  25685. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  25686. }
  25687. $urlBits = parse_url(strtr($repoConfig['url'], '\\', '/'));
  25688. if ($urlBits === false || empty($urlBits['scheme'])) {
  25689. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  25690. }
  25691. if (!isset($repoConfig['options'])) {
  25692. $repoConfig['options'] = array();
  25693. }
  25694. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  25695. $this->allowSslDowngrade = true;
  25696. }
  25697. $this->options = $repoConfig['options'];
  25698. $this->url = $repoConfig['url'];
  25699. if (Preg::isMatch('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  25700. $this->url = $match['proto'].'://repo.packagist.org';
  25701. }
  25702. $this->baseUrl = rtrim(Preg::replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  25703. $this->io = $io;
  25704. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)), 'a-z0-9.$~');
  25705. $this->cache->setReadOnly($config->get('cache-read-only'));
  25706. $this->versionParser = new VersionParser();
  25707. $this->loader = new ArrayLoader($this->versionParser);
  25708. $this->httpDownloader = $httpDownloader;
  25709. $this->eventDispatcher = $eventDispatcher;
  25710. $this->repoConfig = $repoConfig;
  25711. $this->loop = new Loop($this->httpDownloader);
  25712. }
  25713. public function getRepoName()
  25714. {
  25715. return 'composer repo ('.Url::sanitize($this->url).')';
  25716. }
  25717. public function getRepoConfig()
  25718. {
  25719. return $this->repoConfig;
  25720. }
  25721. public function findPackage(string $name, $constraint)
  25722. {
  25723. $hasProviders = $this->hasProviders();
  25724. $name = strtolower($name);
  25725. if (!$constraint instanceof ConstraintInterface) {
  25726. $constraint = $this->versionParser->parseConstraints($constraint);
  25727. }
  25728. if ($this->lazyProvidersUrl) {
  25729. if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
  25730. return $this->filterPackages($this->whatProvides($name), $constraint, true);
  25731. }
  25732. if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
  25733. return null;
  25734. }
  25735. $packages = $this->loadAsyncPackages(array($name => $constraint));
  25736. if (count($packages['packages']) > 0) {
  25737. return reset($packages['packages']);
  25738. }
  25739. return null;
  25740. }
  25741. if ($hasProviders) {
  25742. foreach ($this->getProviderNames() as $providerName) {
  25743. if ($name === $providerName) {
  25744. return $this->filterPackages($this->whatProvides($providerName), $constraint, true);
  25745. }
  25746. }
  25747. return null;
  25748. }
  25749. return parent::findPackage($name, $constraint);
  25750. }
  25751. public function findPackages(string $name, $constraint = null)
  25752. {
  25753. $hasProviders = $this->hasProviders();
  25754. $name = strtolower($name);
  25755. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  25756. $constraint = $this->versionParser->parseConstraints($constraint);
  25757. }
  25758. if ($this->lazyProvidersUrl) {
  25759. if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
  25760. return $this->filterPackages($this->whatProvides($name), $constraint);
  25761. }
  25762. if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
  25763. return array();
  25764. }
  25765. $result = $this->loadAsyncPackages(array($name => $constraint));
  25766. return $result['packages'];
  25767. }
  25768. if ($hasProviders) {
  25769. foreach ($this->getProviderNames() as $providerName) {
  25770. if ($name === $providerName) {
  25771. return $this->filterPackages($this->whatProvides($providerName), $constraint);
  25772. }
  25773. }
  25774. return array();
  25775. }
  25776. return parent::findPackages($name, $constraint);
  25777. }
  25778. private function filterPackages(array $packages, ?ConstraintInterface $constraint = null, bool $returnFirstMatch = false)
  25779. {
  25780. if (null === $constraint) {
  25781. if ($returnFirstMatch) {
  25782. return reset($packages);
  25783. }
  25784. return $packages;
  25785. }
  25786. $filteredPackages = array();
  25787. foreach ($packages as $package) {
  25788. $pkgConstraint = new Constraint('==', $package->getVersion());
  25789. if ($constraint->matches($pkgConstraint)) {
  25790. if ($returnFirstMatch) {
  25791. return $package;
  25792. }
  25793. $filteredPackages[] = $package;
  25794. }
  25795. }
  25796. if ($returnFirstMatch) {
  25797. return null;
  25798. }
  25799. return $filteredPackages;
  25800. }
  25801. public function getPackages()
  25802. {
  25803. $hasProviders = $this->hasProviders();
  25804. if ($this->lazyProvidersUrl) {
  25805. if (is_array($this->availablePackages) && !$this->availablePackagePatterns) {
  25806. $packageMap = array();
  25807. foreach ($this->availablePackages as $name) {
  25808. $packageMap[$name] = new MatchAllConstraint();
  25809. }
  25810. $result = $this->loadAsyncPackages($packageMap);
  25811. return array_values($result['packages']);
  25812. }
  25813. if ($this->hasPartialPackages()) {
  25814. if (!is_array($this->partialPackagesByName)) {
  25815. throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
  25816. }
  25817. return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages');
  25818. }
  25819. throw new \LogicException('Composer repositories that have lazy providers and no available-packages list can not load the complete list of packages, use getPackageNames instead.');
  25820. }
  25821. if ($hasProviders) {
  25822. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getPackageNames instead.');
  25823. }
  25824. return parent::getPackages();
  25825. }
  25826. public function getPackageNames(?string $packageFilter = null)
  25827. {
  25828. $hasProviders = $this->hasProviders();
  25829. $filterResults =
  25830. function (array $results): array {
  25831. return $results;
  25832. }
  25833. ;
  25834. if (null !== $packageFilter && '' !== $packageFilter) {
  25835. $packageFilterRegex = BasePackage::packageNameToRegexp($packageFilter);
  25836. $filterResults =
  25837. function (array $results) use ($packageFilterRegex): array {
  25838. return Preg::grep($packageFilterRegex, $results);
  25839. }
  25840. ;
  25841. }
  25842. if ($this->lazyProvidersUrl) {
  25843. if (is_array($this->availablePackages)) {
  25844. return $filterResults(array_keys($this->availablePackages));
  25845. }
  25846. if ($this->listUrl) {
  25847. return $this->loadPackageList($packageFilter);
  25848. }
  25849. if ($this->hasPartialPackages() && $this->partialPackagesByName !== null) {
  25850. return $filterResults(array_keys($this->partialPackagesByName));
  25851. }
  25852. return array();
  25853. }
  25854. if ($hasProviders) {
  25855. return $filterResults($this->getProviderNames());
  25856. }
  25857. $names = array();
  25858. foreach ($this->getPackages() as $package) {
  25859. $names[] = $package->getPrettyName();
  25860. }
  25861. return $filterResults($names);
  25862. }
  25863. private function getVendorNames(): array
  25864. {
  25865. $cacheKey = 'vendor-list.txt';
  25866. $cacheAge = $this->cache->getAge($cacheKey);
  25867. if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
  25868. $cachedData = explode("\n", $cachedData);
  25869. return $cachedData;
  25870. }
  25871. $names = $this->getPackageNames();
  25872. $uniques = array();
  25873. foreach ($names as $name) {
  25874. $uniques[substr($name, 0, strpos($name, '/'))] = true;
  25875. }
  25876. $vendors = array_keys($uniques);
  25877. if (!$this->cache->isReadOnly()) {
  25878. $this->cache->write($cacheKey, implode("\n", $vendors));
  25879. }
  25880. return $vendors;
  25881. }
  25882. private function loadPackageList(?string $packageFilter = null): array
  25883. {
  25884. if (null === $this->listUrl) {
  25885. throw new \LogicException('Make sure to call loadRootServerFile before loadPackageList');
  25886. }
  25887. $url = $this->listUrl;
  25888. if (is_string($packageFilter) && $packageFilter !== '') {
  25889. $url .= '?filter='.urlencode($packageFilter);
  25890. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  25891. return $result['packageNames'];
  25892. }
  25893. $cacheKey = 'package-list.txt';
  25894. $cacheAge = $this->cache->getAge($cacheKey);
  25895. if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
  25896. $cachedData = explode("\n", $cachedData);
  25897. return $cachedData;
  25898. }
  25899. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  25900. if (!$this->cache->isReadOnly()) {
  25901. $this->cache->write($cacheKey, implode("\n", $result['packageNames']));
  25902. }
  25903. return $result['packageNames'];
  25904. }
  25905. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array())
  25906. {
  25907. $hasProviders = $this->hasProviders();
  25908. if (!$hasProviders && !$this->hasPartialPackages() && !$this->lazyProvidersUrl) {
  25909. return parent::loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  25910. }
  25911. $packages = array();
  25912. $namesFound = array();
  25913. if ($hasProviders || $this->hasPartialPackages()) {
  25914. foreach ($packageNameMap as $name => $constraint) {
  25915. $matches = array();
  25916. if (!$hasProviders && !isset($this->partialPackagesByName[$name])) {
  25917. continue;
  25918. }
  25919. $candidates = $this->whatProvides($name, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  25920. foreach ($candidates as $candidate) {
  25921. if ($candidate->getName() !== $name) {
  25922. throw new \LogicException('whatProvides should never return a package with a different name than the requested one');
  25923. }
  25924. $namesFound[$name] = true;
  25925. if (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
  25926. $matches[spl_object_hash($candidate)] = $candidate;
  25927. if ($candidate instanceof AliasPackage && !isset($matches[spl_object_hash($candidate->getAliasOf())])) {
  25928. $matches[spl_object_hash($candidate->getAliasOf())] = $candidate->getAliasOf();
  25929. }
  25930. }
  25931. }
  25932. foreach ($candidates as $candidate) {
  25933. if ($candidate instanceof AliasPackage) {
  25934. if (isset($matches[spl_object_hash($candidate->getAliasOf())])) {
  25935. $matches[spl_object_hash($candidate)] = $candidate;
  25936. }
  25937. }
  25938. }
  25939. $packages = array_merge($packages, $matches);
  25940. unset($packageNameMap[$name]);
  25941. }
  25942. }
  25943. if ($this->lazyProvidersUrl && count($packageNameMap)) {
  25944. if ($this->hasAvailablePackageList) {
  25945. foreach ($packageNameMap as $name => $constraint) {
  25946. if (!$this->lazyProvidersRepoContains(strtolower($name))) {
  25947. unset($packageNameMap[$name]);
  25948. }
  25949. }
  25950. }
  25951. $result = $this->loadAsyncPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  25952. $packages = array_merge($packages, $result['packages']);
  25953. $namesFound = array_merge($namesFound, $result['namesFound']);
  25954. }
  25955. return array('namesFound' => array_keys($namesFound), 'packages' => $packages);
  25956. }
  25957. public function search(string $query, int $mode = 0, ?string $type = null)
  25958. {
  25959. $this->loadRootServerFile(600);
  25960. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  25961. $url = str_replace(array('%query%', '%type%'), array(urlencode($query), $type), $this->searchUrl);
  25962. $search = $this->httpDownloader->get($url, $this->options)->decodeJson();
  25963. if (empty($search['results'])) {
  25964. return array();
  25965. }
  25966. $results = array();
  25967. foreach ($search['results'] as $result) {
  25968. if (!empty($result['virtual'])) {
  25969. continue;
  25970. }
  25971. $results[] = $result;
  25972. }
  25973. return $results;
  25974. }
  25975. if ($mode === self::SEARCH_VENDOR) {
  25976. $results = array();
  25977. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  25978. $vendorNames = $this->getVendorNames();
  25979. foreach (Preg::grep($regex, $vendorNames) as $name) {
  25980. $results[] = array('name' => $name, 'description' => '');
  25981. }
  25982. return $results;
  25983. }
  25984. if ($this->hasProviders() || $this->lazyProvidersUrl) {
  25985. if (Preg::isMatch('{^\^(?P<query>(?P<vendor>[a-z0-9_.-]+)/[a-z0-9_.-]*)\*?$}i', $query, $match) && $this->listUrl !== null) {
  25986. $url = $this->listUrl . '?vendor='.urlencode($match['vendor']).'&filter='.urlencode($match['query'].'*');
  25987. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  25988. $results = array();
  25989. foreach ($result['packageNames'] as $name) {
  25990. $results[] = array('name' => $name, 'description' => '');
  25991. }
  25992. return $results;
  25993. }
  25994. $results = array();
  25995. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  25996. $packageNames = $this->getPackageNames();
  25997. foreach (Preg::grep($regex, $packageNames) as $name) {
  25998. $results[] = array('name' => $name, 'description' => '');
  25999. }
  26000. return $results;
  26001. }
  26002. return parent::search($query, $mode);
  26003. }
  26004. public function getProviders(string $packageName)
  26005. {
  26006. $this->loadRootServerFile();
  26007. $result = array();
  26008. if ($this->providersApiUrl) {
  26009. $apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
  26010. foreach ($apiResult['providers'] as $provider) {
  26011. $result[$provider['name']] = $provider;
  26012. }
  26013. return $result;
  26014. }
  26015. if ($this->hasPartialPackages()) {
  26016. if (!is_array($this->partialPackagesByName)) {
  26017. throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
  26018. }
  26019. foreach ($this->partialPackagesByName as $versions) {
  26020. foreach ($versions as $candidate) {
  26021. if (isset($result[$candidate['name']]) || !isset($candidate['provide'][$packageName])) {
  26022. continue;
  26023. }
  26024. $result[$candidate['name']] = array(
  26025. 'name' => $candidate['name'],
  26026. 'description' => $candidate['description'] ?? '',
  26027. 'type' => $candidate['type'] ?? '',
  26028. );
  26029. }
  26030. }
  26031. }
  26032. if ($this->packages) {
  26033. $result = array_merge($result, parent::getProviders($packageName));
  26034. }
  26035. return $result;
  26036. }
  26037. private function getProviderNames(): array
  26038. {
  26039. $this->loadRootServerFile();
  26040. if (null === $this->providerListing) {
  26041. $data = $this->loadRootServerFile();
  26042. if (is_array($data)) {
  26043. $this->loadProviderListings($data);
  26044. }
  26045. }
  26046. if ($this->lazyProvidersUrl) {
  26047. return array();
  26048. }
  26049. if (null !== $this->providersUrl && null !== $this->providerListing) {
  26050. return array_keys($this->providerListing);
  26051. }
  26052. return array();
  26053. }
  26054. protected function configurePackageTransportOptions(PackageInterface $package): void
  26055. {
  26056. foreach ($package->getDistUrls() as $url) {
  26057. if (strpos($url, $this->baseUrl) === 0) {
  26058. $package->setTransportOptions($this->options);
  26059. return;
  26060. }
  26061. }
  26062. }
  26063. private function hasProviders(): bool
  26064. {
  26065. $this->loadRootServerFile();
  26066. return $this->hasProviders;
  26067. }
  26068. private function whatProvides(string $name, array $acceptableStabilities = null, array $stabilityFlags = null, array $alreadyLoaded = array()): array
  26069. {
  26070. $packagesSource = null;
  26071. if (!$this->hasPartialPackages() || !isset($this->partialPackagesByName[$name])) {
  26072. if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
  26073. return array();
  26074. }
  26075. if (null === $this->providerListing) {
  26076. $data = $this->loadRootServerFile();
  26077. if (is_array($data)) {
  26078. $this->loadProviderListings($data);
  26079. }
  26080. }
  26081. $useLastModifiedCheck = false;
  26082. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  26083. $hash = null;
  26084. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  26085. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  26086. $useLastModifiedCheck = true;
  26087. } elseif ($this->providersUrl) {
  26088. if (!isset($this->providerListing[$name])) {
  26089. return array();
  26090. }
  26091. $hash = $this->providerListing[$name]['sha256'];
  26092. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  26093. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  26094. } else {
  26095. return array();
  26096. }
  26097. $packages = null;
  26098. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  26099. $packages = json_decode($this->cache->read($cacheKey), true);
  26100. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  26101. } elseif ($useLastModifiedCheck) {
  26102. if ($contents = $this->cache->read($cacheKey)) {
  26103. $contents = json_decode($contents, true);
  26104. if (isset($alreadyLoaded[$name])) {
  26105. $packages = $contents;
  26106. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  26107. } elseif (isset($contents['last-modified'])) {
  26108. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  26109. $packages = true === $response ? $contents : $response;
  26110. $packagesSource = true === $response ? 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')' : 'downloaded file ('.Url::sanitize($url).')';
  26111. }
  26112. }
  26113. }
  26114. if (!$packages) {
  26115. try {
  26116. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  26117. $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
  26118. } catch (TransportException $e) {
  26119. if ($this->lazyProvidersUrl && in_array($e->getStatusCode(), array(404, 499), true)) {
  26120. $packages = array('packages' => array());
  26121. $packagesSource = 'not-found file ('.Url::sanitize($url).')';
  26122. if ($e->getStatusCode() === 499) {
  26123. $this->io->error('<warning>' . $e->getMessage() . '</warning>');
  26124. }
  26125. } else {
  26126. throw $e;
  26127. }
  26128. }
  26129. }
  26130. $loadingPartialPackage = false;
  26131. } else {
  26132. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  26133. $packagesSource = 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')';
  26134. $loadingPartialPackage = true;
  26135. }
  26136. $result = array();
  26137. $versionsToLoad = array();
  26138. foreach ($packages['packages'] as $versions) {
  26139. foreach ($versions as $version) {
  26140. $normalizedName = strtolower($version['name']);
  26141. if ($normalizedName !== $name) {
  26142. continue;
  26143. }
  26144. if (!$loadingPartialPackage && $this->hasPartialPackages() && isset($this->partialPackagesByName[$normalizedName])) {
  26145. continue;
  26146. }
  26147. if (!isset($versionsToLoad[$version['uid']])) {
  26148. if (!isset($version['version_normalized'])) {
  26149. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  26150. } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
  26151. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  26152. }
  26153. if (isset($alreadyLoaded[$name][$version['version_normalized']])) {
  26154. continue;
  26155. }
  26156. if ($this->isVersionAcceptable(null, $normalizedName, $version, $acceptableStabilities, $stabilityFlags)) {
  26157. $versionsToLoad[$version['uid']] = $version;
  26158. }
  26159. }
  26160. }
  26161. }
  26162. $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
  26163. $uids = array_keys($versionsToLoad);
  26164. foreach ($loadedPackages as $index => $package) {
  26165. $package->setRepository($this);
  26166. $uid = $uids[$index];
  26167. if ($package instanceof AliasPackage) {
  26168. $aliased = $package->getAliasOf();
  26169. $aliased->setRepository($this);
  26170. $result[$uid] = $aliased;
  26171. $result[$uid.'-alias'] = $package;
  26172. } else {
  26173. $result[$uid] = $package;
  26174. }
  26175. }
  26176. return $result;
  26177. }
  26178. protected function initialize()
  26179. {
  26180. parent::initialize();
  26181. $repoData = $this->loadDataFromServer();
  26182. foreach ($this->createPackages($repoData, 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')') as $package) {
  26183. $this->addPackage($package);
  26184. }
  26185. }
  26186. public function addPackage(PackageInterface $package)
  26187. {
  26188. parent::addPackage($package);
  26189. $this->configurePackageTransportOptions($package);
  26190. }
  26191. private function loadAsyncPackages(array $packageNames, array $acceptableStabilities = null, array $stabilityFlags = null, array $alreadyLoaded = array()): array
  26192. {
  26193. $this->loadRootServerFile();
  26194. $packages = array();
  26195. $namesFound = array();
  26196. $promises = array();
  26197. if (!$this->lazyProvidersUrl) {
  26198. throw new \LogicException('loadAsyncPackages only supports v2 protocol composer repos with a metadata-url');
  26199. }
  26200. foreach ($packageNames as $name => $constraint) {
  26201. if ($acceptableStabilities === null || $stabilityFlags === null || StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, array($name), 'dev')) {
  26202. $packageNames[$name.'~dev'] = $constraint;
  26203. }
  26204. if (isset($acceptableStabilities['dev']) && count($acceptableStabilities) === 1 && count($stabilityFlags) === 0) {
  26205. unset($packageNames[$name]);
  26206. }
  26207. }
  26208. foreach ($packageNames as $name => $constraint) {
  26209. $name = strtolower($name);
  26210. $realName = Preg::replace('{~dev$}', '', $name);
  26211. if (PlatformRepository::isPlatformPackage($realName) || '__root__' === $realName) {
  26212. continue;
  26213. }
  26214. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  26215. $cacheKey = 'provider-'.strtr($name, '/', '~').'.json';
  26216. $lastModified = null;
  26217. if ($contents = $this->cache->read($cacheKey)) {
  26218. $contents = json_decode($contents, true);
  26219. $lastModified = $contents['last-modified'] ?? null;
  26220. }
  26221. $promises[] = $this->asyncFetchFile($url, $cacheKey, $lastModified)
  26222. ->then(function ($response) use (&$packages, &$namesFound, $url, $cacheKey, $contents, $realName, $constraint, $acceptableStabilities, $stabilityFlags, $alreadyLoaded): void {
  26223. $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
  26224. if (true === $response) {
  26225. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  26226. $response = $contents;
  26227. }
  26228. if (!isset($response['packages'][$realName])) {
  26229. return;
  26230. }
  26231. $versions = $response['packages'][$realName];
  26232. if (isset($response['minified']) && $response['minified'] === 'composer/2.0') {
  26233. $versions = MetadataMinifier::expand($versions);
  26234. }
  26235. $namesFound[$realName] = true;
  26236. $versionsToLoad = array();
  26237. foreach ($versions as $version) {
  26238. if (!isset($version['version_normalized'])) {
  26239. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  26240. } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
  26241. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  26242. }
  26243. if (isset($alreadyLoaded[$realName][$version['version_normalized']])) {
  26244. continue;
  26245. }
  26246. if ($this->isVersionAcceptable($constraint, $realName, $version, $acceptableStabilities, $stabilityFlags)) {
  26247. $versionsToLoad[] = $version;
  26248. }
  26249. }
  26250. $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
  26251. foreach ($loadedPackages as $package) {
  26252. $package->setRepository($this);
  26253. $packages[spl_object_hash($package)] = $package;
  26254. if ($package instanceof AliasPackage && !isset($packages[spl_object_hash($package->getAliasOf())])) {
  26255. $package->getAliasOf()->setRepository($this);
  26256. $packages[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
  26257. }
  26258. }
  26259. });
  26260. }
  26261. $this->loop->wait($promises);
  26262. return array('namesFound' => $namesFound, 'packages' => $packages);
  26263. }
  26264. private function isVersionAcceptable(?ConstraintInterface $constraint, string $name, array $versionData, array $acceptableStabilities = null, array $stabilityFlags = null): bool
  26265. {
  26266. $versions = array($versionData['version_normalized']);
  26267. if ($alias = $this->loader->getBranchAlias($versionData)) {
  26268. $versions[] = $alias;
  26269. }
  26270. foreach ($versions as $version) {
  26271. if (null !== $acceptableStabilities && null !== $stabilityFlags && !StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, array($name), VersionParser::parseStability($version))) {
  26272. continue;
  26273. }
  26274. if ($constraint && !CompilingMatcher::match($constraint, Constraint::OP_EQ, $version)) {
  26275. continue;
  26276. }
  26277. return true;
  26278. }
  26279. return false;
  26280. }
  26281. private function getPackagesJsonUrl(): string
  26282. {
  26283. $jsonUrlParts = parse_url(strtr($this->url, '\\', '/'));
  26284. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  26285. return $this->url;
  26286. }
  26287. return $this->url . '/packages.json';
  26288. }
  26289. protected function loadRootServerFile(?int $rootMaxAge = null)
  26290. {
  26291. if (null !== $this->rootData) {
  26292. return $this->rootData;
  26293. }
  26294. if (!extension_loaded('openssl') && strpos($this->url, 'https') === 0) {
  26295. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  26296. }
  26297. if ($cachedData = $this->cache->read('packages.json')) {
  26298. $cachedData = json_decode($cachedData, true);
  26299. if ($rootMaxAge !== null && ($age = $this->cache->getAge('packages.json')) !== false && $age <= $rootMaxAge) {
  26300. $data = $cachedData;
  26301. } elseif (isset($cachedData['last-modified'])) {
  26302. $response = $this->fetchFileIfLastModified($this->getPackagesJsonUrl(), 'packages.json', $cachedData['last-modified']);
  26303. $data = true === $response ? $cachedData : $response;
  26304. }
  26305. }
  26306. if (!isset($data)) {
  26307. $data = $this->fetchFile($this->getPackagesJsonUrl(), 'packages.json', null, true);
  26308. }
  26309. if (!empty($data['notify-batch'])) {
  26310. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  26311. } elseif (!empty($data['notify'])) {
  26312. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  26313. }
  26314. if (!empty($data['search'])) {
  26315. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  26316. }
  26317. if (!empty($data['mirrors'])) {
  26318. foreach ($data['mirrors'] as $mirror) {
  26319. if (!empty($mirror['git-url'])) {
  26320. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  26321. }
  26322. if (!empty($mirror['hg-url'])) {
  26323. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  26324. }
  26325. if (!empty($mirror['dist-url'])) {
  26326. $this->distMirrors[] = array(
  26327. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  26328. 'preferred' => !empty($mirror['preferred']),
  26329. );
  26330. }
  26331. }
  26332. }
  26333. if (!empty($data['providers-lazy-url'])) {
  26334. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  26335. $this->hasProviders = true;
  26336. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  26337. }
  26338. if (!empty($data['metadata-url'])) {
  26339. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['metadata-url']);
  26340. $this->providersUrl = null;
  26341. $this->hasProviders = false;
  26342. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  26343. $this->allowSslDowngrade = false;
  26344. if (!empty($data['available-packages'])) {
  26345. $availPackages = array_map('strtolower', $data['available-packages']);
  26346. $this->availablePackages = array_combine($availPackages, $availPackages);
  26347. $this->hasAvailablePackageList = true;
  26348. }
  26349. if (!empty($data['available-package-patterns'])) {
  26350. $this->availablePackagePatterns = array_map(function ($pattern): string {
  26351. return BasePackage::packageNameToRegexp($pattern);
  26352. }, $data['available-package-patterns']);
  26353. $this->hasAvailablePackageList = true;
  26354. }
  26355. unset($data['providers-url'], $data['providers'], $data['providers-includes']);
  26356. }
  26357. if ($this->allowSslDowngrade) {
  26358. $this->url = str_replace('https://', 'http://', $this->url);
  26359. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  26360. }
  26361. if (!empty($data['providers-url'])) {
  26362. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  26363. $this->hasProviders = true;
  26364. }
  26365. if (!empty($data['list'])) {
  26366. $this->listUrl = $this->canonicalizeUrl($data['list']);
  26367. }
  26368. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  26369. $this->hasProviders = true;
  26370. }
  26371. if (!empty($data['providers-api'])) {
  26372. $this->providersApiUrl = $this->canonicalizeUrl($data['providers-api']);
  26373. }
  26374. return $this->rootData = $data;
  26375. }
  26376. private function canonicalizeUrl(string $url): string
  26377. {
  26378. if ('/' === $url[0]) {
  26379. if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  26380. return $matches[0] . $url;
  26381. }
  26382. return $this->url;
  26383. }
  26384. return $url;
  26385. }
  26386. private function loadDataFromServer(): array
  26387. {
  26388. $data = $this->loadRootServerFile();
  26389. if (true === $data) {
  26390. throw new \LogicException('loadRootServerFile should not return true during initialization');
  26391. }
  26392. return $this->loadIncludes($data);
  26393. }
  26394. private function hasPartialPackages(): bool
  26395. {
  26396. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  26397. $this->initializePartialPackages();
  26398. }
  26399. return $this->hasPartialPackages;
  26400. }
  26401. private function loadProviderListings($data): void
  26402. {
  26403. if (isset($data['providers'])) {
  26404. if (!is_array($this->providerListing)) {
  26405. $this->providerListing = array();
  26406. }
  26407. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  26408. }
  26409. if ($this->providersUrl && isset($data['provider-includes'])) {
  26410. $includes = $data['provider-includes'];
  26411. foreach ($includes as $include => $metadata) {
  26412. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  26413. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  26414. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  26415. $includedData = json_decode($this->cache->read($cacheKey), true);
  26416. } else {
  26417. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  26418. }
  26419. $this->loadProviderListings($includedData);
  26420. }
  26421. }
  26422. }
  26423. private function loadIncludes(array $data): array
  26424. {
  26425. $packages = array();
  26426. if (!isset($data['packages']) && !isset($data['includes'])) {
  26427. foreach ($data as $pkg) {
  26428. if (isset($pkg['versions']) && is_array($pkg['versions'])) {
  26429. foreach ($pkg['versions'] as $metadata) {
  26430. $packages[] = $metadata;
  26431. }
  26432. }
  26433. }
  26434. return $packages;
  26435. }
  26436. if (isset($data['packages'])) {
  26437. foreach ($data['packages'] as $package => $versions) {
  26438. foreach ($versions as $version => $metadata) {
  26439. $packages[] = $metadata;
  26440. }
  26441. }
  26442. }
  26443. if (isset($data['includes'])) {
  26444. foreach ($data['includes'] as $include => $metadata) {
  26445. if (isset($metadata['sha1']) && $this->cache->sha1((string) $include) === $metadata['sha1']) {
  26446. $includedData = json_decode($this->cache->read((string) $include), true);
  26447. } else {
  26448. $includedData = $this->fetchFile($include);
  26449. }
  26450. $packages = array_merge($packages, $this->loadIncludes($includedData));
  26451. }
  26452. }
  26453. return $packages;
  26454. }
  26455. private function createPackages(array $packages, ?string $source = null): array
  26456. {
  26457. if (!$packages) {
  26458. return array();
  26459. }
  26460. try {
  26461. foreach ($packages as &$data) {
  26462. if (!isset($data['notification-url'])) {
  26463. $data['notification-url'] = $this->notifyUrl;
  26464. }
  26465. }
  26466. $packageInstances = $this->loader->loadPackages($packages);
  26467. foreach ($packageInstances as $package) {
  26468. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  26469. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  26470. }
  26471. $package->setDistMirrors($this->distMirrors);
  26472. $this->configurePackageTransportOptions($package);
  26473. }
  26474. return $packageInstances;
  26475. } catch (\Exception $e) {
  26476. throw new \RuntimeException('Could not load packages '.($packages[0]['name'] ?? json_encode($packages)).' in '.$this->getRepoName().($source ? ' from '.$source : '').': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  26477. }
  26478. }
  26479. protected function fetchFile(string $filename, ?string $cacheKey = null, ?string $sha256 = null, bool $storeLastModifiedTime = false)
  26480. {
  26481. if (null === $cacheKey) {
  26482. $cacheKey = $filename;
  26483. $filename = $this->baseUrl.'/'.$filename;
  26484. }
  26485. if (($pos = strpos($filename, '$')) && Preg::isMatch('{^https?://}i', $filename)) {
  26486. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  26487. }
  26488. $retries = 3;
  26489. while ($retries--) {
  26490. try {
  26491. $options = $this->options;
  26492. if ($this->eventDispatcher) {
  26493. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', array('repository' => $this));
  26494. $preFileDownloadEvent->setTransportOptions($this->options);
  26495. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  26496. $filename = $preFileDownloadEvent->getProcessedUrl();
  26497. $options = $preFileDownloadEvent->getTransportOptions();
  26498. }
  26499. $response = $this->httpDownloader->get($filename, $options);
  26500. $json = (string) $response->getBody();
  26501. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  26502. if ($this->allowSslDowngrade) {
  26503. $this->url = str_replace('http://', 'https://', $this->url);
  26504. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  26505. $filename = str_replace('http://', 'https://', $filename);
  26506. }
  26507. if ($retries > 0) {
  26508. usleep(100000);
  26509. continue;
  26510. }
  26511. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  26512. }
  26513. if ($this->eventDispatcher) {
  26514. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, $sha256, $filename, 'metadata', array('response' => $response, 'repository' => $this));
  26515. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  26516. }
  26517. $data = $response->decodeJson();
  26518. HttpDownloader::outputWarnings($this->io, $this->url, $data);
  26519. if ($cacheKey && !$this->cache->isReadOnly()) {
  26520. if ($storeLastModifiedTime) {
  26521. $lastModifiedDate = $response->getHeader('last-modified');
  26522. if ($lastModifiedDate) {
  26523. $data['last-modified'] = $lastModifiedDate;
  26524. $json = JsonFile::encode($data, 0);
  26525. }
  26526. }
  26527. $this->cache->write($cacheKey, $json);
  26528. }
  26529. $response->collect();
  26530. break;
  26531. } catch (\Exception $e) {
  26532. if ($e instanceof \LogicException) {
  26533. throw $e;
  26534. }
  26535. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  26536. throw $e;
  26537. }
  26538. if ($e instanceof RepositorySecurityException) {
  26539. throw $e;
  26540. }
  26541. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  26542. if (!$this->degradedMode) {
  26543. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  26544. }
  26545. $this->degradedMode = true;
  26546. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  26547. break;
  26548. }
  26549. throw $e;
  26550. }
  26551. }
  26552. if (!isset($data)) {
  26553. throw new \LogicException("ComposerRepository: Undefined \$data. Please report at https://github.com/composer/composer/issues/new.");
  26554. }
  26555. return $data;
  26556. }
  26557. private function fetchFileIfLastModified(string $filename, string $cacheKey, string $lastModifiedTime)
  26558. {
  26559. try {
  26560. $options = $this->options;
  26561. if ($this->eventDispatcher) {
  26562. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', array('repository' => $this));
  26563. $preFileDownloadEvent->setTransportOptions($this->options);
  26564. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  26565. $filename = $preFileDownloadEvent->getProcessedUrl();
  26566. $options = $preFileDownloadEvent->getTransportOptions();
  26567. }
  26568. if (isset($options['http']['header'])) {
  26569. $options['http']['header'] = (array) $options['http']['header'];
  26570. }
  26571. $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
  26572. $response = $this->httpDownloader->get($filename, $options);
  26573. $json = (string) $response->getBody();
  26574. if ($json === '' && $response->getStatusCode() === 304) {
  26575. return true;
  26576. }
  26577. if ($this->eventDispatcher) {
  26578. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', array('response' => $response, 'repository' => $this));
  26579. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  26580. }
  26581. $data = $response->decodeJson();
  26582. HttpDownloader::outputWarnings($this->io, $this->url, $data);
  26583. $lastModifiedDate = $response->getHeader('last-modified');
  26584. $response->collect();
  26585. if ($lastModifiedDate) {
  26586. $data['last-modified'] = $lastModifiedDate;
  26587. $json = JsonFile::encode($data, 0);
  26588. }
  26589. if (!$this->cache->isReadOnly()) {
  26590. $this->cache->write($cacheKey, $json);
  26591. }
  26592. return $data;
  26593. } catch (\Exception $e) {
  26594. if ($e instanceof \LogicException) {
  26595. throw $e;
  26596. }
  26597. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  26598. throw $e;
  26599. }
  26600. if (!$this->degradedMode) {
  26601. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  26602. }
  26603. $this->degradedMode = true;
  26604. return true;
  26605. }
  26606. }
  26607. private function asyncFetchFile(string $filename, string $cacheKey, ?string $lastModifiedTime = null): PromiseInterface
  26608. {
  26609. if (isset($this->packagesNotFoundCache[$filename])) {
  26610. return \React\Promise\resolve(array('packages' => array()));
  26611. }
  26612. if (isset($this->freshMetadataUrls[$filename]) && $lastModifiedTime) {
  26613. return \React\Promise\resolve(true);
  26614. }
  26615. $httpDownloader = $this->httpDownloader;
  26616. $options = $this->options;
  26617. if ($this->eventDispatcher) {
  26618. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', array('repository' => $this));
  26619. $preFileDownloadEvent->setTransportOptions($this->options);
  26620. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  26621. $filename = $preFileDownloadEvent->getProcessedUrl();
  26622. $options = $preFileDownloadEvent->getTransportOptions();
  26623. }
  26624. if ($lastModifiedTime) {
  26625. if (isset($options['http']['header'])) {
  26626. $options['http']['header'] = (array) $options['http']['header'];
  26627. }
  26628. $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
  26629. }
  26630. $io = $this->io;
  26631. $url = $this->url;
  26632. $cache = $this->cache;
  26633. $degradedMode = &$this->degradedMode;
  26634. $eventDispatcher = $this->eventDispatcher;
  26635. $accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $eventDispatcher) {
  26636. if ($response->getStatusCode() === 404) {
  26637. $this->packagesNotFoundCache[$filename] = true;
  26638. return array('packages' => array());
  26639. }
  26640. $json = (string) $response->getBody();
  26641. if ($json === '' && $response->getStatusCode() === 304) {
  26642. $this->freshMetadataUrls[$filename] = true;
  26643. return true;
  26644. }
  26645. if ($eventDispatcher) {
  26646. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', array('response' => $response, 'repository' => $this));
  26647. $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  26648. }
  26649. $data = $response->decodeJson();
  26650. HttpDownloader::outputWarnings($io, $url, $data);
  26651. $lastModifiedDate = $response->getHeader('last-modified');
  26652. $response->collect();
  26653. if ($lastModifiedDate) {
  26654. $data['last-modified'] = $lastModifiedDate;
  26655. $json = JsonFile::encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  26656. }
  26657. if (!$cache->isReadOnly()) {
  26658. $cache->write($cacheKey, $json);
  26659. }
  26660. $this->freshMetadataUrls[$filename] = true;
  26661. return $data;
  26662. };
  26663. $reject = function ($e) use ($filename, $accept, $io, $url, &$degradedMode, $lastModifiedTime) {
  26664. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  26665. $this->packagesNotFoundCache[$filename] = true;
  26666. return false;
  26667. }
  26668. if (!$degradedMode) {
  26669. $io->writeError('<warning>'.$url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  26670. }
  26671. $degradedMode = true;
  26672. if ($lastModifiedTime) {
  26673. return $accept(new Response(array('url' => $url), 304, array(), ''));
  26674. }
  26675. if ($e instanceof TransportException && $e->getStatusCode() === 499) {
  26676. return $accept(new Response(array('url' => $url), 404, array(), ''));
  26677. }
  26678. throw $e;
  26679. };
  26680. return $httpDownloader->add($filename, $options)->then($accept, $reject);
  26681. }
  26682. private function initializePartialPackages(): void
  26683. {
  26684. $rootData = $this->loadRootServerFile();
  26685. if ($rootData === true) {
  26686. return;
  26687. }
  26688. $this->partialPackagesByName = array();
  26689. foreach ($rootData['packages'] as $package => $versions) {
  26690. foreach ($versions as $version) {
  26691. $this->partialPackagesByName[strtolower($version['name'])][] = $version;
  26692. }
  26693. }
  26694. $this->rootData = true;
  26695. }
  26696. protected function lazyProvidersRepoContains(string $name)
  26697. {
  26698. if (!$this->hasAvailablePackageList) {
  26699. throw new \LogicException('lazyProvidersRepoContains should not be called unless hasAvailablePackageList is true');
  26700. }
  26701. if (is_array($this->availablePackages) && isset($this->availablePackages[$name])) {
  26702. return true;
  26703. }
  26704. if (is_array($this->availablePackagePatterns)) {
  26705. foreach ($this->availablePackagePatterns as $providerRegex) {
  26706. if (Preg::isMatch($providerRegex, $name)) {
  26707. return true;
  26708. }
  26709. }
  26710. }
  26711. return false;
  26712. }
  26713. }
  26714. <?php declare(strict_types=1);
  26715. namespace Composer\Repository;
  26716. use Composer\Package\BasePackage;
  26717. use Composer\Package\PackageInterface;
  26718. class CompositeRepository implements RepositoryInterface
  26719. {
  26720. private $repositories;
  26721. public function __construct(array $repositories)
  26722. {
  26723. $this->repositories = array();
  26724. foreach ($repositories as $repo) {
  26725. $this->addRepository($repo);
  26726. }
  26727. }
  26728. public function getRepoName(): string
  26729. {
  26730. return 'composite repo ('.implode(', ', array_map(function ($repo): string {
  26731. return $repo->getRepoName();
  26732. }, $this->repositories)).')';
  26733. }
  26734. public function getRepositories(): array
  26735. {
  26736. return $this->repositories;
  26737. }
  26738. public function hasPackage(PackageInterface $package): bool
  26739. {
  26740. foreach ($this->repositories as $repository) {
  26741. if ($repository->hasPackage($package)) {
  26742. return true;
  26743. }
  26744. }
  26745. return false;
  26746. }
  26747. public function findPackage($name, $constraint): ?BasePackage
  26748. {
  26749. foreach ($this->repositories as $repository) {
  26750. $package = $repository->findPackage($name, $constraint);
  26751. if (null !== $package) {
  26752. return $package;
  26753. }
  26754. }
  26755. return null;
  26756. }
  26757. public function findPackages($name, $constraint = null): array
  26758. {
  26759. $packages = array();
  26760. foreach ($this->repositories as $repository) {
  26761. $packages[] = $repository->findPackages($name, $constraint);
  26762. }
  26763. return $packages ? call_user_func_array('array_merge', $packages) : array();
  26764. }
  26765. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()): array
  26766. {
  26767. $packages = array();
  26768. $namesFound = array();
  26769. foreach ($this->repositories as $repository) {
  26770. $result = $repository->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  26771. $packages[] = $result['packages'];
  26772. $namesFound[] = $result['namesFound'];
  26773. }
  26774. return array(
  26775. 'packages' => $packages ? call_user_func_array('array_merge', $packages) : array(),
  26776. 'namesFound' => $namesFound ? array_unique(call_user_func_array('array_merge', $namesFound)) : array(),
  26777. );
  26778. }
  26779. public function search(string $query, int $mode = 0, ?string $type = null): array
  26780. {
  26781. $matches = array();
  26782. foreach ($this->repositories as $repository) {
  26783. $matches[] = $repository->search($query, $mode, $type);
  26784. }
  26785. return $matches ? call_user_func_array('array_merge', $matches) : array();
  26786. }
  26787. public function getPackages(): array
  26788. {
  26789. $packages = array();
  26790. foreach ($this->repositories as $repository) {
  26791. $packages[] = $repository->getPackages();
  26792. }
  26793. return $packages ? call_user_func_array('array_merge', $packages) : array();
  26794. }
  26795. public function getProviders($packageName): array
  26796. {
  26797. $results = array();
  26798. foreach ($this->repositories as $repository) {
  26799. $results[] = $repository->getProviders($packageName);
  26800. }
  26801. return $results ? call_user_func_array('array_merge', $results) : array();
  26802. }
  26803. public function removePackage(PackageInterface $package): void
  26804. {
  26805. foreach ($this->repositories as $repository) {
  26806. if ($repository instanceof WritableRepositoryInterface) {
  26807. $repository->removePackage($package);
  26808. }
  26809. }
  26810. }
  26811. public function count(): int
  26812. {
  26813. $total = 0;
  26814. foreach ($this->repositories as $repository) {
  26815. $total += $repository->count();
  26816. }
  26817. return $total;
  26818. }
  26819. public function addRepository(RepositoryInterface $repository): void
  26820. {
  26821. if ($repository instanceof self) {
  26822. foreach ($repository->getRepositories() as $repo) {
  26823. $this->addRepository($repo);
  26824. }
  26825. } else {
  26826. $this->repositories[] = $repository;
  26827. }
  26828. }
  26829. }
  26830. <?php declare(strict_types=1);
  26831. namespace Composer\Repository;
  26832. interface ConfigurableRepositoryInterface
  26833. {
  26834. public function getRepoConfig();
  26835. }
  26836. <?php declare(strict_types=1);
  26837. namespace Composer\Repository;
  26838. use Composer\Json\JsonFile;
  26839. use Composer\Package\Loader\ArrayLoader;
  26840. use Composer\Package\RootPackageInterface;
  26841. use Composer\Package\AliasPackage;
  26842. use Composer\Package\Dumper\ArrayDumper;
  26843. use Composer\Installer\InstallationManager;
  26844. use Composer\Util\Filesystem;
  26845. use Composer\Util\Platform;
  26846. class FilesystemRepository extends WritableArrayRepository
  26847. {
  26848. protected $file;
  26849. private $dumpVersions;
  26850. private $rootPackage;
  26851. private $filesystem;
  26852. private $devMode = null;
  26853. public function __construct(JsonFile $repositoryFile, bool $dumpVersions = false, RootPackageInterface $rootPackage = null, Filesystem $filesystem = null)
  26854. {
  26855. parent::__construct();
  26856. $this->file = $repositoryFile;
  26857. $this->dumpVersions = $dumpVersions;
  26858. $this->rootPackage = $rootPackage;
  26859. $this->filesystem = $filesystem ?: new Filesystem;
  26860. if ($dumpVersions && !$rootPackage) {
  26861. throw new \InvalidArgumentException('Expected a root package instance if $dumpVersions is true');
  26862. }
  26863. }
  26864. public function getDevMode()
  26865. {
  26866. return $this->devMode;
  26867. }
  26868. protected function initialize()
  26869. {
  26870. parent::initialize();
  26871. if (!$this->file->exists()) {
  26872. return;
  26873. }
  26874. try {
  26875. $data = $this->file->read();
  26876. if (isset($data['packages'])) {
  26877. $packages = $data['packages'];
  26878. } else {
  26879. $packages = $data;
  26880. }
  26881. if (isset($data['dev-package-names'])) {
  26882. $this->setDevPackageNames($data['dev-package-names']);
  26883. }
  26884. if (isset($data['dev'])) {
  26885. $this->devMode = $data['dev'];
  26886. }
  26887. if (!is_array($packages)) {
  26888. throw new \UnexpectedValueException('Could not parse package list from the repository');
  26889. }
  26890. } catch (\Exception $e) {
  26891. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  26892. }
  26893. $loader = new ArrayLoader(null, true);
  26894. foreach ($packages as $packageData) {
  26895. $package = $loader->load($packageData);
  26896. $this->addPackage($package);
  26897. }
  26898. }
  26899. public function reload()
  26900. {
  26901. $this->packages = null;
  26902. $this->initialize();
  26903. }
  26904. public function write(bool $devMode, InstallationManager $installationManager)
  26905. {
  26906. $data = array('packages' => array(), 'dev' => $devMode, 'dev-package-names' => array());
  26907. $dumper = new ArrayDumper();
  26908. $repoDir = dirname($this->file->getPath());
  26909. $this->filesystem->ensureDirectoryExists($repoDir);
  26910. $repoDir = $this->filesystem->normalizePath(realpath($repoDir));
  26911. $installPaths = array();
  26912. foreach ($this->getCanonicalPackages() as $package) {
  26913. $pkgArray = $dumper->dump($package);
  26914. $path = $installationManager->getInstallPath($package);
  26915. $installPath = null;
  26916. if ('' !== $path && null !== $path) {
  26917. $normalizedPath = $this->filesystem->normalizePath($this->filesystem->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path);
  26918. $installPath = $this->filesystem->findShortestPath($repoDir, $normalizedPath, true);
  26919. }
  26920. $installPaths[$package->getName()] = $installPath;
  26921. $pkgArray['install-path'] = $installPath;
  26922. $data['packages'][] = $pkgArray;
  26923. if (in_array($package->getName(), $this->devPackageNames, true)) {
  26924. $data['dev-package-names'][] = $package->getName();
  26925. }
  26926. }
  26927. sort($data['dev-package-names']);
  26928. usort($data['packages'], function ($a, $b): int {
  26929. return strcmp($a['name'], $b['name']);
  26930. });
  26931. $this->file->write($data);
  26932. if ($this->dumpVersions) {
  26933. $versions = $this->generateInstalledVersions($installationManager, $installPaths, $devMode, $repoDir);
  26934. $this->filesystem->filePutContentsIfModified($repoDir.'/installed.php', '<?php return ' . $this->dumpToPhpCode($versions) . ';'."\n");
  26935. $installedVersionsClass = file_get_contents(__DIR__.'/../InstalledVersions.php');
  26936. $this->filesystem->filePutContentsIfModified($repoDir.'/InstalledVersions.php', $installedVersionsClass);
  26937. \Composer\InstalledVersions::reload($versions);
  26938. }
  26939. }
  26940. private function dumpToPhpCode(array $array = array(), int $level = 0): string
  26941. {
  26942. $lines = "array(\n";
  26943. $level++;
  26944. foreach ($array as $key => $value) {
  26945. $lines .= str_repeat(' ', $level);
  26946. $lines .= is_int($key) ? $key . ' => ' : '\'' . $key . '\' => ';
  26947. if (is_array($value)) {
  26948. if (!empty($value)) {
  26949. $lines .= $this->dumpToPhpCode($value, $level);
  26950. } else {
  26951. $lines .= "array(),\n";
  26952. }
  26953. } elseif ($key === 'install_path' && is_string($value)) {
  26954. if ($this->filesystem->isAbsolutePath($value)) {
  26955. $lines .= var_export($value, true) . ",\n";
  26956. } else {
  26957. $lines .= "__DIR__ . " . var_export('/' . $value, true) . ",\n";
  26958. }
  26959. } else {
  26960. $lines .= var_export($value, true) . ",\n";
  26961. }
  26962. }
  26963. $lines .= str_repeat(' ', $level - 1) . ')' . ($level - 1 == 0 ? '' : ",\n");
  26964. return $lines;
  26965. }
  26966. private function generateInstalledVersions(InstallationManager $installationManager, array $installPaths, bool $devMode, string $repoDir): ?array
  26967. {
  26968. if (!$this->dumpVersions) {
  26969. return null;
  26970. }
  26971. $devPackages = array_flip($this->devPackageNames);
  26972. $versions = array('versions' => array());
  26973. $packages = $this->getPackages();
  26974. $packages[] = $rootPackage = $this->rootPackage;
  26975. while ($rootPackage instanceof AliasPackage) {
  26976. $rootPackage = $rootPackage->getAliasOf();
  26977. $packages[] = $rootPackage;
  26978. }
  26979. foreach ($packages as $package) {
  26980. if ($package instanceof AliasPackage) {
  26981. continue;
  26982. }
  26983. $reference = null;
  26984. if ($package->getInstallationSource()) {
  26985. $reference = $package->getInstallationSource() === 'source' ? $package->getSourceReference() : $package->getDistReference();
  26986. }
  26987. if (null === $reference) {
  26988. $reference = ($package->getSourceReference() ?: $package->getDistReference()) ?: null;
  26989. }
  26990. if ($package instanceof RootPackageInterface) {
  26991. $to = $this->filesystem->normalizePath(realpath(Platform::getCwd()));
  26992. $installPath = $this->filesystem->findShortestPath($repoDir, $to, true);
  26993. } else {
  26994. $installPath = $installPaths[$package->getName()];
  26995. }
  26996. $versions['versions'][$package->getName()] = array(
  26997. 'pretty_version' => $package->getPrettyVersion(),
  26998. 'version' => $package->getVersion(),
  26999. 'type' => $package->getType(),
  27000. 'install_path' => $installPath,
  27001. 'aliases' => array(),
  27002. 'reference' => $reference,
  27003. 'dev_requirement' => isset($devPackages[$package->getName()]),
  27004. );
  27005. if ($package instanceof RootPackageInterface) {
  27006. $versions['root'] = $versions['versions'][$package->getName()];
  27007. unset($versions['root']['dev_requirement']);
  27008. $versions['root']['name'] = $package->getName();
  27009. $versions['root']['dev'] = $devMode;
  27010. }
  27011. }
  27012. foreach ($packages as $package) {
  27013. $isDevPackage = isset($devPackages[$package->getName()]);
  27014. foreach ($package->getReplaces() as $replace) {
  27015. if (PlatformRepository::isPlatformPackage($replace->getTarget())) {
  27016. continue;
  27017. }
  27018. if (!isset($versions['versions'][$replace->getTarget()]['dev_requirement'])) {
  27019. $versions['versions'][$replace->getTarget()]['dev_requirement'] = $isDevPackage;
  27020. } elseif (!$isDevPackage) {
  27021. $versions['versions'][$replace->getTarget()]['dev_requirement'] = false;
  27022. }
  27023. $replaced = $replace->getPrettyConstraint();
  27024. if ($replaced === 'self.version') {
  27025. $replaced = $package->getPrettyVersion();
  27026. }
  27027. if (!isset($versions['versions'][$replace->getTarget()]['replaced']) || !in_array($replaced, $versions['versions'][$replace->getTarget()]['replaced'], true)) {
  27028. $versions['versions'][$replace->getTarget()]['replaced'][] = $replaced;
  27029. }
  27030. }
  27031. foreach ($package->getProvides() as $provide) {
  27032. if (PlatformRepository::isPlatformPackage($provide->getTarget())) {
  27033. continue;
  27034. }
  27035. if (!isset($versions['versions'][$provide->getTarget()]['dev_requirement'])) {
  27036. $versions['versions'][$provide->getTarget()]['dev_requirement'] = $isDevPackage;
  27037. } elseif (!$isDevPackage) {
  27038. $versions['versions'][$provide->getTarget()]['dev_requirement'] = false;
  27039. }
  27040. $provided = $provide->getPrettyConstraint();
  27041. if ($provided === 'self.version') {
  27042. $provided = $package->getPrettyVersion();
  27043. }
  27044. if (!isset($versions['versions'][$provide->getTarget()]['provided']) || !in_array($provided, $versions['versions'][$provide->getTarget()]['provided'], true)) {
  27045. $versions['versions'][$provide->getTarget()]['provided'][] = $provided;
  27046. }
  27047. }
  27048. }
  27049. foreach ($packages as $package) {
  27050. if (!$package instanceof AliasPackage) {
  27051. continue;
  27052. }
  27053. $versions['versions'][$package->getName()]['aliases'][] = $package->getPrettyVersion();
  27054. if ($package instanceof RootPackageInterface) {
  27055. $versions['root']['aliases'][] = $package->getPrettyVersion();
  27056. }
  27057. }
  27058. ksort($versions['versions']);
  27059. ksort($versions);
  27060. return $versions;
  27061. }
  27062. }
  27063. <?php declare(strict_types=1);
  27064. namespace Composer\Repository;
  27065. use Composer\Package\PackageInterface;
  27066. use Composer\Package\BasePackage;
  27067. use Composer\Pcre\Preg;
  27068. class FilterRepository implements RepositoryInterface
  27069. {
  27070. private $only = null;
  27071. private $exclude = null;
  27072. private $canonical = true;
  27073. private $repo;
  27074. public function __construct(RepositoryInterface $repo, array $options)
  27075. {
  27076. if (isset($options['only'])) {
  27077. if (!is_array($options['only'])) {
  27078. throw new \InvalidArgumentException('"only" key for repository '.$repo->getRepoName().' should be an array');
  27079. }
  27080. $this->only = BasePackage::packageNamesToRegexp($options['only']);
  27081. }
  27082. if (isset($options['exclude'])) {
  27083. if (!is_array($options['exclude'])) {
  27084. throw new \InvalidArgumentException('"exclude" key for repository '.$repo->getRepoName().' should be an array');
  27085. }
  27086. $this->exclude = BasePackage::packageNamesToRegexp($options['exclude']);
  27087. }
  27088. if ($this->exclude && $this->only) {
  27089. throw new \InvalidArgumentException('Only one of "only" and "exclude" can be specified for repository '.$repo->getRepoName());
  27090. }
  27091. if (isset($options['canonical'])) {
  27092. if (!is_bool($options['canonical'])) {
  27093. throw new \InvalidArgumentException('"canonical" key for repository '.$repo->getRepoName().' should be a boolean');
  27094. }
  27095. $this->canonical = $options['canonical'];
  27096. }
  27097. $this->repo = $repo;
  27098. }
  27099. public function getRepoName(): string
  27100. {
  27101. return $this->repo->getRepoName();
  27102. }
  27103. public function getRepository(): RepositoryInterface
  27104. {
  27105. return $this->repo;
  27106. }
  27107. public function hasPackage(PackageInterface $package): bool
  27108. {
  27109. return $this->repo->hasPackage($package);
  27110. }
  27111. public function findPackage($name, $constraint): ?BasePackage
  27112. {
  27113. if (!$this->isAllowed($name)) {
  27114. return null;
  27115. }
  27116. return $this->repo->findPackage($name, $constraint);
  27117. }
  27118. public function findPackages($name, $constraint = null): array
  27119. {
  27120. if (!$this->isAllowed($name)) {
  27121. return array();
  27122. }
  27123. return $this->repo->findPackages($name, $constraint);
  27124. }
  27125. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array()): array
  27126. {
  27127. foreach ($packageNameMap as $name => $constraint) {
  27128. if (!$this->isAllowed($name)) {
  27129. unset($packageNameMap[$name]);
  27130. }
  27131. }
  27132. if (!$packageNameMap) {
  27133. return array('namesFound' => array(), 'packages' => array());
  27134. }
  27135. $result = $this->repo->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  27136. if (!$this->canonical) {
  27137. $result['namesFound'] = array();
  27138. }
  27139. return $result;
  27140. }
  27141. public function search(string $query, int $mode = 0, ?string $type = null): array
  27142. {
  27143. $result = array();
  27144. foreach ($this->repo->search($query, $mode, $type) as $package) {
  27145. if ($this->isAllowed($package['name'])) {
  27146. $result[] = $package;
  27147. }
  27148. }
  27149. return $result;
  27150. }
  27151. public function getPackages(): array
  27152. {
  27153. $result = array();
  27154. foreach ($this->repo->getPackages() as $package) {
  27155. if ($this->isAllowed($package->getName())) {
  27156. $result[] = $package;
  27157. }
  27158. }
  27159. return $result;
  27160. }
  27161. public function getProviders($packageName): array
  27162. {
  27163. $result = array();
  27164. foreach ($this->repo->getProviders($packageName) as $name => $provider) {
  27165. if ($this->isAllowed($provider['name'])) {
  27166. $result[$name] = $provider;
  27167. }
  27168. }
  27169. return $result;
  27170. }
  27171. public function count(): int
  27172. {
  27173. if ($this->repo->count() > 0) {
  27174. return count($this->getPackages());
  27175. }
  27176. return 0;
  27177. }
  27178. private function isAllowed(string $name): bool
  27179. {
  27180. if (!$this->only && !$this->exclude) {
  27181. return true;
  27182. }
  27183. if ($this->only) {
  27184. return Preg::isMatch($this->only, $name);
  27185. }
  27186. if ($this->exclude === null) {
  27187. return true;
  27188. }
  27189. return !Preg::isMatch($this->exclude, $name);
  27190. }
  27191. }
  27192. <?php declare(strict_types=1);
  27193. namespace Composer\Repository;
  27194. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  27195. {
  27196. public function getRepoName(): string
  27197. {
  27198. return 'installed '.parent::getRepoName();
  27199. }
  27200. public function isFresh(): bool
  27201. {
  27202. return $this->count() === 0;
  27203. }
  27204. }
  27205. <?php declare(strict_types=1);
  27206. namespace Composer\Repository;
  27207. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  27208. {
  27209. public function getRepoName()
  27210. {
  27211. return 'installed '.parent::getRepoName();
  27212. }
  27213. public function isFresh()
  27214. {
  27215. return !$this->file->exists();
  27216. }
  27217. }
  27218. <?php declare(strict_types=1);
  27219. namespace Composer\Repository;
  27220. use Composer\Package\BasePackage;
  27221. use Composer\Package\PackageInterface;
  27222. use Composer\Package\Version\VersionParser;
  27223. use Composer\Semver\Constraint\ConstraintInterface;
  27224. use Composer\Semver\Constraint\Constraint;
  27225. use Composer\Semver\Constraint\MatchAllConstraint;
  27226. use Composer\Package\RootPackageInterface;
  27227. use Composer\Package\Link;
  27228. class InstalledRepository extends CompositeRepository
  27229. {
  27230. public function findPackagesWithReplacersAndProviders(string $name, $constraint = null): array
  27231. {
  27232. $name = strtolower($name);
  27233. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  27234. $versionParser = new VersionParser();
  27235. $constraint = $versionParser->parseConstraints($constraint);
  27236. }
  27237. $matches = array();
  27238. foreach ($this->getRepositories() as $repo) {
  27239. foreach ($repo->getPackages() as $candidate) {
  27240. if ($name === $candidate->getName()) {
  27241. if (null === $constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
  27242. $matches[] = $candidate;
  27243. }
  27244. continue;
  27245. }
  27246. foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
  27247. if (
  27248. $name === $link->getTarget()
  27249. && ($constraint === null || $constraint->matches($link->getConstraint()))
  27250. ) {
  27251. $matches[] = $candidate;
  27252. continue 2;
  27253. }
  27254. }
  27255. }
  27256. }
  27257. return $matches;
  27258. }
  27259. public function getDependents($needle, ?ConstraintInterface $constraint = null, bool $invert = false, bool $recurse = true, array $packagesFound = null): array
  27260. {
  27261. $needles = array_map('strtolower', (array) $needle);
  27262. $results = array();
  27263. if (null === $packagesFound) {
  27264. $packagesFound = $needles;
  27265. }
  27266. $rootPackage = null;
  27267. foreach ($this->getPackages() as $package) {
  27268. if ($package instanceof RootPackageInterface) {
  27269. $rootPackage = $package;
  27270. break;
  27271. }
  27272. }
  27273. foreach ($this->getPackages() as $package) {
  27274. $links = $package->getRequires();
  27275. $packagesInTree = $packagesFound;
  27276. if (!$invert) {
  27277. $links += $package->getReplaces();
  27278. foreach ($package->getReplaces() as $link) {
  27279. foreach ($needles as $needle) {
  27280. if ($link->getSource() === $needle) {
  27281. if ($constraint === null || ($link->getConstraint()->matches($constraint) === true)) {
  27282. if (in_array($link->getTarget(), $packagesInTree)) {
  27283. $results[] = array($package, $link, false);
  27284. continue;
  27285. }
  27286. $packagesInTree[] = $link->getTarget();
  27287. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  27288. $results[] = array($package, $link, $dependents);
  27289. $needles[] = $link->getTarget();
  27290. }
  27291. }
  27292. }
  27293. }
  27294. }
  27295. if ($package instanceof RootPackageInterface) {
  27296. $links += $package->getDevRequires();
  27297. }
  27298. foreach ($links as $link) {
  27299. foreach ($needles as $needle) {
  27300. if ($link->getTarget() === $needle) {
  27301. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  27302. if (in_array($link->getSource(), $packagesInTree)) {
  27303. $results[] = array($package, $link, false);
  27304. continue;
  27305. }
  27306. $packagesInTree[] = $link->getSource();
  27307. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  27308. $results[] = array($package, $link, $dependents);
  27309. }
  27310. }
  27311. }
  27312. }
  27313. if ($invert && in_array($package->getName(), $needles)) {
  27314. foreach ($package->getConflicts() as $link) {
  27315. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  27316. $version = new Constraint('=', $pkg->getVersion());
  27317. if ($link->getConstraint()->matches($version) === $invert) {
  27318. $results[] = array($package, $link, false);
  27319. }
  27320. }
  27321. }
  27322. }
  27323. foreach ($package->getConflicts() as $link) {
  27324. if (in_array($link->getTarget(), $needles)) {
  27325. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  27326. $version = new Constraint('=', $pkg->getVersion());
  27327. if ($link->getConstraint()->matches($version) === $invert) {
  27328. $results[] = array($package, $link, false);
  27329. }
  27330. }
  27331. }
  27332. }
  27333. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  27334. foreach ($package->getRequires() as $link) {
  27335. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  27336. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  27337. continue;
  27338. }
  27339. $platformPkg = $this->findPackage($link->getTarget(), '*');
  27340. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  27341. $results[] = array($package, new Link($package->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_REQUIRE, $link->getPrettyConstraint().' '.$description), false);
  27342. continue;
  27343. }
  27344. foreach ($this->getPackages() as $pkg) {
  27345. if (!in_array($link->getTarget(), $pkg->getNames())) {
  27346. continue;
  27347. }
  27348. $version = new Constraint('=', $pkg->getVersion());
  27349. if ($link->getTarget() !== $pkg->getName()) {
  27350. foreach (array_merge($pkg->getReplaces(), $pkg->getProvides()) as $prov) {
  27351. if ($link->getTarget() === $prov->getTarget()) {
  27352. $version = $prov->getConstraint();
  27353. break;
  27354. }
  27355. }
  27356. }
  27357. if (!$link->getConstraint()->matches($version)) {
  27358. if ($rootPackage) {
  27359. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  27360. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  27361. $results[] = array($package, $link, false);
  27362. $results[] = array($rootPackage, $rootReq, false);
  27363. continue 3;
  27364. }
  27365. }
  27366. $results[] = array($package, $link, false);
  27367. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_DOES_NOT_REQUIRE, 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  27368. } else {
  27369. $results[] = array($package, $link, false);
  27370. }
  27371. }
  27372. continue 2;
  27373. }
  27374. }
  27375. }
  27376. }
  27377. ksort($results);
  27378. return $results;
  27379. }
  27380. public function getRepoName(): string
  27381. {
  27382. return 'installed repo ('.implode(', ', array_map(function ($repo): string {
  27383. return $repo->getRepoName();
  27384. }, $this->getRepositories())).')';
  27385. }
  27386. public function addRepository(RepositoryInterface $repository): void
  27387. {
  27388. if (
  27389. $repository instanceof LockArrayRepository
  27390. || $repository instanceof InstalledRepositoryInterface
  27391. || $repository instanceof RootPackageRepository
  27392. || $repository instanceof PlatformRepository
  27393. ) {
  27394. parent::addRepository($repository);
  27395. return;
  27396. }
  27397. throw new \LogicException('An InstalledRepository can not contain a repository of type '.get_class($repository).' ('.$repository->getRepoName().')');
  27398. }
  27399. }
  27400. <?php declare(strict_types=1);
  27401. namespace Composer\Repository;
  27402. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  27403. {
  27404. public function getDevMode();
  27405. public function isFresh();
  27406. }
  27407. <?php declare(strict_types=1);
  27408. namespace Composer\Repository;
  27409. class InvalidRepositoryException extends \Exception
  27410. {
  27411. }
  27412. <?php declare(strict_types=1);
  27413. namespace Composer\Repository;
  27414. class LockArrayRepository extends ArrayRepository
  27415. {
  27416. public function getRepoName(): string
  27417. {
  27418. return 'lock repo';
  27419. }
  27420. }
  27421. <?php declare(strict_types=1);
  27422. namespace Composer\Repository;
  27423. use Composer\Package\Loader\ArrayLoader;
  27424. use Composer\Package\Loader\ValidatingArrayLoader;
  27425. use Composer\Pcre\Preg;
  27426. class PackageRepository extends ArrayRepository
  27427. {
  27428. private $config;
  27429. public function __construct(array $config)
  27430. {
  27431. parent::__construct();
  27432. $this->config = $config['package'];
  27433. if (!is_numeric(key($this->config))) {
  27434. $this->config = array($this->config);
  27435. }
  27436. }
  27437. protected function initialize(): void
  27438. {
  27439. parent::initialize();
  27440. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), true);
  27441. foreach ($this->config as $package) {
  27442. try {
  27443. $package = $loader->load($package);
  27444. } catch (\Exception $e) {
  27445. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  27446. }
  27447. $this->addPackage($package);
  27448. }
  27449. }
  27450. public function getRepoName(): string
  27451. {
  27452. return Preg::replace('{^array }', 'package ', parent::getRepoName());
  27453. }
  27454. }
  27455. <?php declare(strict_types=1);
  27456. namespace Composer\Repository;
  27457. use Composer\Config;
  27458. use Composer\EventDispatcher\EventDispatcher;
  27459. use Composer\IO\IOInterface;
  27460. use Composer\Json\JsonFile;
  27461. use Composer\Package\CompleteAliasPackage;
  27462. use Composer\Package\CompletePackage;
  27463. use Composer\Package\Loader\ArrayLoader;
  27464. use Composer\Package\Version\VersionGuesser;
  27465. use Composer\Package\Version\VersionParser;
  27466. use Composer\Pcre\Preg;
  27467. use Composer\Util\HttpDownloader;
  27468. use Composer\Util\Platform;
  27469. use Composer\Util\ProcessExecutor;
  27470. use Composer\Util\Filesystem;
  27471. use Composer\Util\Url;
  27472. use Composer\Util\Git as GitUtil;
  27473. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  27474. {
  27475. private $loader;
  27476. private $versionGuesser;
  27477. private $url;
  27478. private $repoConfig;
  27479. private $process;
  27480. private $options;
  27481. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader = null, EventDispatcher $dispatcher = null, ProcessExecutor $process = null)
  27482. {
  27483. if (!isset($repoConfig['url'])) {
  27484. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  27485. }
  27486. $this->loader = new ArrayLoader(null, true);
  27487. $this->url = Platform::expandPath($repoConfig['url']);
  27488. $this->process = $process ?? new ProcessExecutor($io);
  27489. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  27490. $this->repoConfig = $repoConfig;
  27491. $this->options = $repoConfig['options'] ?? array();
  27492. if (!isset($this->options['relative'])) {
  27493. $filesystem = new Filesystem();
  27494. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  27495. }
  27496. parent::__construct();
  27497. }
  27498. public function getRepoName(): string
  27499. {
  27500. return 'path repo ('.Url::sanitize($this->repoConfig['url']).')';
  27501. }
  27502. public function getRepoConfig(): array
  27503. {
  27504. return $this->repoConfig;
  27505. }
  27506. protected function initialize(): void
  27507. {
  27508. parent::initialize();
  27509. $urlMatches = $this->getUrlMatches();
  27510. if (empty($urlMatches)) {
  27511. if (Preg::isMatch('{[*{}]}', $this->url)) {
  27512. $url = $this->url;
  27513. while (Preg::isMatch('{[*{}]}', $url)) {
  27514. $url = dirname($url);
  27515. }
  27516. if (is_dir($url)) {
  27517. return;
  27518. }
  27519. }
  27520. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  27521. }
  27522. foreach ($urlMatches as $url) {
  27523. $path = realpath($url) . DIRECTORY_SEPARATOR;
  27524. $composerFilePath = $path.'composer.json';
  27525. if (!file_exists($composerFilePath)) {
  27526. continue;
  27527. }
  27528. $json = file_get_contents($composerFilePath);
  27529. $package = JsonFile::parseJson($json, $composerFilePath);
  27530. $package['dist'] = array(
  27531. 'type' => 'path',
  27532. 'url' => $url,
  27533. );
  27534. $reference = $this->options['reference'] ?? 'auto';
  27535. if ('none' === $reference) {
  27536. $package['dist']['reference'] = null;
  27537. } elseif ('config' === $reference || 'auto' === $reference) {
  27538. $package['dist']['reference'] = sha1($json . serialize($this->options));
  27539. }
  27540. $package['transport-options'] = array_intersect_key($this->options, array('symlink' => true, 'relative' => true));
  27541. if (isset($package['name'], $this->options['versions'][$package['name']])) {
  27542. $package['version'] = $this->options['versions'][$package['name']];
  27543. }
  27544. if (!isset($package['version']) && ($rootVersion = Platform::getEnv('COMPOSER_ROOT_VERSION'))) {
  27545. if (
  27546. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  27547. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  27548. && $ref1 === $ref2
  27549. ) {
  27550. $package['version'] = $rootVersion;
  27551. }
  27552. }
  27553. $output = '';
  27554. if ('auto' === $reference && is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
  27555. $package['dist']['reference'] = trim($output);
  27556. }
  27557. if (!isset($package['version'])) {
  27558. $versionData = $this->versionGuesser->guessVersion($package, $path);
  27559. if (is_array($versionData) && $versionData['pretty_version']) {
  27560. if (!empty($versionData['feature_pretty_version'])) {
  27561. $package['version'] = $versionData['feature_pretty_version'];
  27562. $this->addPackage($this->loader->load($package));
  27563. }
  27564. $package['version'] = $versionData['pretty_version'];
  27565. } else {
  27566. $package['version'] = 'dev-main';
  27567. }
  27568. }
  27569. $this->addPackage($this->loader->load($package));
  27570. }
  27571. }
  27572. private function getUrlMatches(): array
  27573. {
  27574. $flags = GLOB_MARK | GLOB_ONLYDIR;
  27575. if (defined('GLOB_BRACE')) {
  27576. $flags |= GLOB_BRACE;
  27577. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  27578. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  27579. }
  27580. return array_map(function ($val): string {
  27581. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  27582. }, glob($this->url, $flags));
  27583. }
  27584. }
  27585. <?php declare(strict_types=1);
  27586. namespace Composer\Repository;
  27587. class PearRepository extends ArrayRepository
  27588. {
  27589. public function __construct()
  27590. {
  27591. throw new \InvalidArgumentException('The PEAR repository has been removed from Composer 2.x');
  27592. }
  27593. }
  27594. <?php declare(strict_types=1);
  27595. namespace Composer\Repository;
  27596. use Composer\Composer;
  27597. use Composer\Package\CompletePackage;
  27598. use Composer\Package\CompletePackageInterface;
  27599. use Composer\Package\Link;
  27600. use Composer\Package\PackageInterface;
  27601. use Composer\Package\Version\VersionParser;
  27602. use Composer\Pcre\Preg;
  27603. use Composer\Platform\HhvmDetector;
  27604. use Composer\Platform\Runtime;
  27605. use Composer\Platform\Version;
  27606. use Composer\Plugin\PluginInterface;
  27607. use Composer\Semver\Constraint\Constraint;
  27608. use Composer\Util\Silencer;
  27609. use Composer\XdebugHandler\XdebugHandler;
  27610. class PlatformRepository extends ArrayRepository
  27611. {
  27612. public const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer(?:-(?:plugin|runtime)-api)?)$}iD';
  27613. private static $lastSeenPlatformPhp = null;
  27614. private $versionParser;
  27615. private $overrides = array();
  27616. private $disabledPackages = array();
  27617. private $runtime;
  27618. private $hhvmDetector;
  27619. public function __construct(array $packages = array(), array $overrides = array(), Runtime $runtime = null, HhvmDetector $hhvmDetector = null)
  27620. {
  27621. $this->runtime = $runtime ?: new Runtime();
  27622. $this->hhvmDetector = $hhvmDetector ?: new HhvmDetector();
  27623. foreach ($overrides as $name => $version) {
  27624. if (!is_string($version) && false !== $version) {
  27625. throw new \UnexpectedValueException('config.platform.'.$name.' should be a string or false, but got '.gettype($version).' '.var_export($version, true));
  27626. }
  27627. if ($name === 'php' && $version === false) {
  27628. throw new \UnexpectedValueException('config.platform.'.$name.' cannot be set to false as you cannot disable php entirely.');
  27629. }
  27630. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  27631. }
  27632. parent::__construct($packages);
  27633. }
  27634. public function getRepoName(): string
  27635. {
  27636. return 'platform repo';
  27637. }
  27638. public function isPlatformPackageDisabled(string $name): bool
  27639. {
  27640. return isset($this->disabledPackages[$name]);
  27641. }
  27642. public function getDisabledPackages(): array
  27643. {
  27644. return $this->disabledPackages;
  27645. }
  27646. protected function initialize(): void
  27647. {
  27648. parent::initialize();
  27649. $this->versionParser = new VersionParser();
  27650. foreach ($this->overrides as $override) {
  27651. if (!self::isPlatformPackage($override['name'])) {
  27652. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  27653. }
  27654. if ($override['version'] !== false) {
  27655. $this->addOverriddenPackage($override);
  27656. }
  27657. }
  27658. $prettyVersion = Composer::getVersion();
  27659. $version = $this->versionParser->normalize($prettyVersion);
  27660. $composer = new CompletePackage('composer', $version, $prettyVersion);
  27661. $composer->setDescription('Composer package');
  27662. $this->addPackage($composer);
  27663. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  27664. $version = $this->versionParser->normalize($prettyVersion);
  27665. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  27666. $composerPluginApi->setDescription('The Composer Plugin API');
  27667. $this->addPackage($composerPluginApi);
  27668. $prettyVersion = Composer::RUNTIME_API_VERSION;
  27669. $version = $this->versionParser->normalize($prettyVersion);
  27670. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  27671. $composerRuntimeApi->setDescription('The Composer Runtime API');
  27672. $this->addPackage($composerRuntimeApi);
  27673. try {
  27674. $prettyVersion = $this->runtime->getConstant('PHP_VERSION');
  27675. $version = $this->versionParser->normalize($prettyVersion);
  27676. } catch (\UnexpectedValueException $e) {
  27677. $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $this->runtime->getConstant('PHP_VERSION'));
  27678. $version = $this->versionParser->normalize($prettyVersion);
  27679. }
  27680. $php = new CompletePackage('php', $version, $prettyVersion);
  27681. $php->setDescription('The PHP interpreter');
  27682. $this->addPackage($php);
  27683. if ($this->runtime->getConstant('PHP_DEBUG')) {
  27684. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  27685. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  27686. $this->addPackage($phpdebug);
  27687. }
  27688. if ($this->runtime->hasConstant('PHP_ZTS') && $this->runtime->getConstant('PHP_ZTS')) {
  27689. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  27690. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  27691. $this->addPackage($phpzts);
  27692. }
  27693. if ($this->runtime->getConstant('PHP_INT_SIZE') === 8) {
  27694. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  27695. $php64->setDescription('The PHP interpreter, 64bit');
  27696. $this->addPackage($php64);
  27697. }
  27698. if ($this->runtime->hasConstant('AF_INET6') || Silencer::call(array($this->runtime, 'invoke'), 'inet_pton', array('::')) !== false) {
  27699. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  27700. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  27701. $this->addPackage($phpIpv6);
  27702. }
  27703. $loadedExtensions = $this->runtime->getExtensions();
  27704. foreach ($loadedExtensions as $name) {
  27705. if (in_array($name, array('standard', 'Core'))) {
  27706. continue;
  27707. }
  27708. $this->addExtension($name, $this->runtime->getExtensionVersion($name));
  27709. }
  27710. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  27711. $this->addExtension('xdebug', $prettyVersion);
  27712. }
  27713. foreach ($loadedExtensions as $name) {
  27714. switch ($name) {
  27715. case 'amqp':
  27716. $info = $this->runtime->getExtensionInfo($name);
  27717. if (Preg::isMatch('/^librabbitmq version => (?<version>.+)$/im', $info, $librabbitmqMatches)) {
  27718. $this->addLibrary($name.'-librabbitmq', $librabbitmqMatches['version'], 'AMQP librabbitmq version');
  27719. }
  27720. if (Preg::isMatch('/^AMQP protocol version => (?<version>.+)$/im', $info, $protocolMatches)) {
  27721. $this->addLibrary($name.'-protocol', str_replace('-', '.', $protocolMatches['version']), 'AMQP protocol version');
  27722. }
  27723. break;
  27724. case 'bz2':
  27725. $info = $this->runtime->getExtensionInfo($name);
  27726. if (Preg::isMatch('/^BZip2 Version => (?<version>.*),/im', $info, $matches)) {
  27727. $this->addLibrary($name, $matches['version']);
  27728. }
  27729. break;
  27730. case 'curl':
  27731. $curlVersion = $this->runtime->invoke('curl_version');
  27732. $this->addLibrary($name, $curlVersion['version']);
  27733. $info = $this->runtime->getExtensionInfo($name);
  27734. if (Preg::isMatch('{^SSL Version => (?<library>[^/]+)/(?<version>.+)$}im', $info, $sslMatches)) {
  27735. $library = strtolower($sslMatches['library']);
  27736. if ($library === 'openssl') {
  27737. $parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips);
  27738. $this->addLibrary($name.'-openssl'.($isFips ? '-fips' : ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', array(), $isFips ? array('curl-openssl') : array());
  27739. } else {
  27740. $this->addLibrary($name.'-'.$library, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', array('curl-openssl'));
  27741. }
  27742. }
  27743. if (Preg::isMatch('{^libSSH Version => (?<library>[^/]+)/(?<version>.+?)(?:/.*)?$}im', $info, $sshMatches)) {
  27744. $this->addLibrary($name.'-'.strtolower($sshMatches['library']), $sshMatches['version'], 'curl '.$sshMatches['library'].' version');
  27745. }
  27746. if (Preg::isMatch('{^ZLib Version => (?<version>.+)$}im', $info, $zlibMatches)) {
  27747. $this->addLibrary($name.'-zlib', $zlibMatches['version'], 'curl zlib version');
  27748. }
  27749. break;
  27750. case 'date':
  27751. $info = $this->runtime->getExtensionInfo($name);
  27752. if (Preg::isMatch('/^timelib version => (?<version>.+)$/im', $info, $timelibMatches)) {
  27753. $this->addLibrary($name.'-timelib', $timelibMatches['version'], 'date timelib version');
  27754. }
  27755. if (Preg::isMatch('/^Timezone Database => (?<source>internal|external)$/im', $info, $zoneinfoSourceMatches)) {
  27756. $external = $zoneinfoSourceMatches['source'] === 'external';
  27757. if (Preg::isMatch('/^"Olson" Timezone Database Version => (?<version>.+?)(\.system)?$/im', $info, $zoneinfoMatches)) {
  27758. if ($external && in_array('timezonedb', $loadedExtensions, true)) {
  27759. $this->addLibrary('timezonedb-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date (replaced by timezonedb)', array($name.'-zoneinfo'));
  27760. } else {
  27761. $this->addLibrary($name.'-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date');
  27762. }
  27763. }
  27764. }
  27765. break;
  27766. case 'fileinfo':
  27767. $info = $this->runtime->getExtensionInfo($name);
  27768. if (Preg::isMatch('/^libmagic => (?<version>.+)$/im', $info, $magicMatches)) {
  27769. $this->addLibrary($name.'-libmagic', $magicMatches['version'], 'fileinfo libmagic version');
  27770. }
  27771. break;
  27772. case 'gd':
  27773. $this->addLibrary($name, $this->runtime->getConstant('GD_VERSION'));
  27774. $info = $this->runtime->getExtensionInfo($name);
  27775. if (Preg::isMatch('/^libJPEG Version => (?<version>.+?)(?: compatible)?$/im', $info, $libjpegMatches)) {
  27776. $this->addLibrary($name.'-libjpeg', Version::parseLibjpeg($libjpegMatches['version']), 'libjpeg version for gd');
  27777. }
  27778. if (Preg::isMatch('/^libPNG Version => (?<version>.+)$/im', $info, $libpngMatches)) {
  27779. $this->addLibrary($name.'-libpng', $libpngMatches['version'], 'libpng version for gd');
  27780. }
  27781. if (Preg::isMatch('/^FreeType Version => (?<version>.+)$/im', $info, $freetypeMatches)) {
  27782. $this->addLibrary($name.'-freetype', $freetypeMatches['version'], 'freetype version for gd');
  27783. }
  27784. if (Preg::isMatch('/^libXpm Version => (?<versionId>\d+)$/im', $info, $libxpmMatches)) {
  27785. $this->addLibrary($name.'-libxpm', Version::convertLibxpmVersionId((int) $libxpmMatches['versionId']), 'libxpm version for gd');
  27786. }
  27787. break;
  27788. case 'gmp':
  27789. $this->addLibrary($name, $this->runtime->getConstant('GMP_VERSION'));
  27790. break;
  27791. case 'iconv':
  27792. $this->addLibrary($name, $this->runtime->getConstant('ICONV_VERSION'));
  27793. break;
  27794. case 'intl':
  27795. $info = $this->runtime->getExtensionInfo($name);
  27796. $description = 'The ICU unicode and globalization support library';
  27797. if ($this->runtime->hasConstant('INTL_ICU_VERSION')) {
  27798. $this->addLibrary('icu', $this->runtime->getConstant('INTL_ICU_VERSION'), $description);
  27799. } elseif (Preg::isMatch('/^ICU version => (?<version>.+)$/im', $info, $matches)) {
  27800. $this->addLibrary('icu', $matches['version'], $description);
  27801. }
  27802. if (Preg::isMatch('/^ICU TZData version => (?<version>.*)$/im', $info, $zoneinfoMatches) && null !== ($version = Version::parseZoneinfoVersion($zoneinfoMatches['version']))) {
  27803. $this->addLibrary('icu-zoneinfo', $version, 'zoneinfo ("Olson") database for icu');
  27804. }
  27805. if ($this->runtime->hasClass('ResourceBundle')) {
  27806. $cldrVersion = $this->runtime->invoke(array('ResourceBundle', 'create'), array('root', 'ICUDATA', false))->get('Version');
  27807. $this->addLibrary('icu-cldr', $cldrVersion, 'ICU CLDR project version');
  27808. }
  27809. if ($this->runtime->hasClass('IntlChar')) {
  27810. $this->addLibrary('icu-unicode', implode('.', array_slice($this->runtime->invoke(array('IntlChar', 'getUnicodeVersion')), 0, 3)), 'ICU unicode version');
  27811. }
  27812. break;
  27813. case 'imagick':
  27814. $imageMagickVersion = $this->runtime->construct('Imagick')->getVersion();
  27815. Preg::match('/^ImageMagick (?<version>[\d.]+)(?:-(?<patch>\d+))?/', $imageMagickVersion['versionString'], $matches);
  27816. $version = $matches['version'];
  27817. if (isset($matches['patch'])) {
  27818. $version .= '.'.$matches['patch'];
  27819. }
  27820. $this->addLibrary($name.'-imagemagick', $version, null, array('imagick'));
  27821. break;
  27822. case 'ldap':
  27823. $info = $this->runtime->getExtensionInfo($name);
  27824. if (Preg::isMatch('/^Vendor Version => (?<versionId>\d+)$/im', $info, $matches) && Preg::isMatch('/^Vendor Name => (?<vendor>.+)$/im', $info, $vendorMatches)) {
  27825. $this->addLibrary($name.'-'.strtolower($vendorMatches['vendor']), Version::convertOpenldapVersionId((int) $matches['versionId']), $vendorMatches['vendor'].' version of ldap');
  27826. }
  27827. break;
  27828. case 'libxml':
  27829. $libxmlProvides = array_map(function ($extension): string {
  27830. return $extension . '-libxml';
  27831. }, array_intersect($loadedExtensions, array('dom', 'simplexml', 'xml', 'xmlreader', 'xmlwriter')));
  27832. $this->addLibrary($name, $this->runtime->getConstant('LIBXML_DOTTED_VERSION'), 'libxml library version', array(), $libxmlProvides);
  27833. break;
  27834. case 'mbstring':
  27835. $info = $this->runtime->getExtensionInfo($name);
  27836. if (Preg::isMatch('/^libmbfl version => (?<version>.+)$/im', $info, $libmbflMatches)) {
  27837. $this->addLibrary($name.'-libmbfl', $libmbflMatches['version'], 'mbstring libmbfl version');
  27838. }
  27839. if ($this->runtime->hasConstant('MB_ONIGURUMA_VERSION')) {
  27840. $this->addLibrary($name.'-oniguruma', $this->runtime->getConstant('MB_ONIGURUMA_VERSION'), 'mbstring oniguruma version');
  27841. } elseif (Preg::isMatch('/^(?:oniguruma|Multibyte regex \(oniguruma\)) version => (?<version>.+)$/im', $info, $onigurumaMatches)) {
  27842. $this->addLibrary($name.'-oniguruma', $onigurumaMatches['version'], 'mbstring oniguruma version');
  27843. }
  27844. break;
  27845. case 'memcached':
  27846. $info = $this->runtime->getExtensionInfo($name);
  27847. if (Preg::isMatch('/^libmemcached version => (?<version>.+)$/im', $info, $matches)) {
  27848. $this->addLibrary($name.'-libmemcached', $matches['version'], 'libmemcached version');
  27849. }
  27850. break;
  27851. case 'openssl':
  27852. if (Preg::isMatch('{^(?:OpenSSL|LibreSSL)?\s*(?<version>\S+)}i', $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), $matches)) {
  27853. $parsedVersion = Version::parseOpenssl($matches['version'], $isFips);
  27854. $this->addLibrary($name.($isFips ? '-fips' : ''), $parsedVersion, $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), array(), $isFips ? array($name) : array());
  27855. }
  27856. break;
  27857. case 'pcre':
  27858. $this->addLibrary($name, Preg::replace('{^(\S+).*}', '$1', $this->runtime->getConstant('PCRE_VERSION')));
  27859. $info = $this->runtime->getExtensionInfo($name);
  27860. if (Preg::isMatch('/^PCRE Unicode Version => (?<version>.+)$/im', $info, $pcreUnicodeMatches)) {
  27861. $this->addLibrary($name.'-unicode', $pcreUnicodeMatches['version'], 'PCRE Unicode version support');
  27862. }
  27863. break;
  27864. case 'mysqlnd':
  27865. case 'pdo_mysql':
  27866. $info = $this->runtime->getExtensionInfo($name);
  27867. if (Preg::isMatch('/^(?:Client API version|Version) => mysqlnd (?<version>.+?) /mi', $info, $matches)) {
  27868. $this->addLibrary($name.'-mysqlnd', $matches['version'], 'mysqlnd library version for '.$name);
  27869. }
  27870. break;
  27871. case 'mongodb':
  27872. $info = $this->runtime->getExtensionInfo($name);
  27873. if (Preg::isMatch('/^libmongoc bundled version => (?<version>.+)$/im', $info, $libmongocMatches)) {
  27874. $this->addLibrary($name.'-libmongoc', $libmongocMatches['version'], 'libmongoc version of mongodb');
  27875. }
  27876. if (Preg::isMatch('/^libbson bundled version => (?<version>.+)$/im', $info, $libbsonMatches)) {
  27877. $this->addLibrary($name.'-libbson', $libbsonMatches['version'], 'libbson version of mongodb');
  27878. }
  27879. break;
  27880. case 'pgsql':
  27881. case 'pdo_pgsql':
  27882. $info = $this->runtime->getExtensionInfo($name);
  27883. if (Preg::isMatch('/^PostgreSQL\(libpq\) Version => (?<version>.*)$/im', $info, $matches)) {
  27884. $this->addLibrary($name.'-libpq', $matches['version'], 'libpq for '.$name);
  27885. }
  27886. break;
  27887. case 'libsodium':
  27888. case 'sodium':
  27889. if ($this->runtime->hasConstant('SODIUM_LIBRARY_VERSION')) {
  27890. $this->addLibrary('libsodium', $this->runtime->getConstant('SODIUM_LIBRARY_VERSION'));
  27891. }
  27892. break;
  27893. case 'sqlite3':
  27894. case 'pdo_sqlite':
  27895. $info = $this->runtime->getExtensionInfo($name);
  27896. if (Preg::isMatch('/^SQLite Library => (?<version>.+)$/im', $info, $matches)) {
  27897. $this->addLibrary($name.'-sqlite', $matches['version']);
  27898. }
  27899. break;
  27900. case 'ssh2':
  27901. $info = $this->runtime->getExtensionInfo($name);
  27902. if (Preg::isMatch('/^libssh2 version => (?<version>.+)$/im', $info, $matches)) {
  27903. $this->addLibrary($name.'-libssh2', $matches['version']);
  27904. }
  27905. break;
  27906. case 'xsl':
  27907. $this->addLibrary('libxslt', $this->runtime->getConstant('LIBXSLT_DOTTED_VERSION'), null, array('xsl'));
  27908. $info = $this->runtime->getExtensionInfo('xsl');
  27909. if (Preg::isMatch('/^libxslt compiled against libxml Version => (?<version>.+)$/im', $info, $matches)) {
  27910. $this->addLibrary('libxslt-libxml', $matches['version'], 'libxml version libxslt is compiled against');
  27911. }
  27912. break;
  27913. case 'yaml':
  27914. $info = $this->runtime->getExtensionInfo('yaml');
  27915. if (Preg::isMatch('/^LibYAML Version => (?<version>.+)$/im', $info, $matches)) {
  27916. $this->addLibrary($name.'-libyaml', $matches['version'], 'libyaml version of yaml');
  27917. }
  27918. break;
  27919. case 'zip':
  27920. if ($this->runtime->hasConstant('LIBZIP_VERSION', 'ZipArchive')) {
  27921. $this->addLibrary($name.'-libzip', $this->runtime->getConstant('LIBZIP_VERSION', 'ZipArchive'), null, array('zip'));
  27922. }
  27923. break;
  27924. case 'zlib':
  27925. if ($this->runtime->hasConstant('ZLIB_VERSION')) {
  27926. $this->addLibrary($name, $this->runtime->getConstant('ZLIB_VERSION'));
  27927. } elseif (Preg::isMatch('/^Linked Version => (?<version>.+)$/im', $this->runtime->getExtensionInfo($name), $matches)) {
  27928. $this->addLibrary($name, $matches['version']);
  27929. }
  27930. break;
  27931. default:
  27932. break;
  27933. }
  27934. }
  27935. $hhvmVersion = $this->hhvmDetector->getVersion();
  27936. if ($hhvmVersion) {
  27937. try {
  27938. $prettyVersion = $hhvmVersion;
  27939. $version = $this->versionParser->normalize($prettyVersion);
  27940. } catch (\UnexpectedValueException $e) {
  27941. $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  27942. $version = $this->versionParser->normalize($prettyVersion);
  27943. }
  27944. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  27945. $hhvm->setDescription('The HHVM Runtime (64bit)');
  27946. $this->addPackage($hhvm);
  27947. }
  27948. }
  27949. public function addPackage(PackageInterface $package): void
  27950. {
  27951. if (!$package instanceof CompletePackage) {
  27952. throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package));
  27953. }
  27954. if (isset($this->overrides[$package->getName()])) {
  27955. if ($this->overrides[$package->getName()]['version'] === false) {
  27956. $this->addDisabledPackage($package);
  27957. return;
  27958. }
  27959. $overrider = $this->findPackage($package->getName(), '*');
  27960. if ($package->getVersion() === $overrider->getVersion()) {
  27961. $actualText = 'same as actual';
  27962. } else {
  27963. $actualText = 'actual: '.$package->getPrettyVersion();
  27964. }
  27965. if ($overrider instanceof CompletePackageInterface) {
  27966. $overrider->setDescription($overrider->getDescription().', '.$actualText);
  27967. }
  27968. return;
  27969. }
  27970. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  27971. if (isset($this->overrides[$package->getName()]) && $this->overrides[$package->getName()]['version'] === false) {
  27972. $this->addDisabledPackage($package);
  27973. return;
  27974. }
  27975. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  27976. if ($package->getVersion() === $overrider->getVersion()) {
  27977. $actualText = 'same as actual';
  27978. } else {
  27979. $actualText = 'actual: '.$package->getPrettyVersion();
  27980. }
  27981. $overrider->setDescription($overrider->getDescription().', '.$actualText);
  27982. return;
  27983. }
  27984. parent::addPackage($package);
  27985. }
  27986. private function addOverriddenPackage(array $override, ?string $name = null): CompletePackage
  27987. {
  27988. $version = $this->versionParser->normalize($override['version']);
  27989. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  27990. $package->setDescription('Package overridden via config.platform');
  27991. $package->setExtra(array('config.platform' => true));
  27992. parent::addPackage($package);
  27993. if ($package->getName() === 'php') {
  27994. self::$lastSeenPlatformPhp = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
  27995. }
  27996. return $package;
  27997. }
  27998. private function addDisabledPackage(CompletePackage $package): void
  27999. {
  28000. $package->setDescription($package->getDescription().'. <warning>Package disabled via config.platform</warning>');
  28001. $package->setExtra(array('config.platform' => true));
  28002. $this->disabledPackages[$package->getName()] = $package;
  28003. }
  28004. private function addExtension(string $name, string $prettyVersion): void
  28005. {
  28006. $extraDescription = null;
  28007. try {
  28008. $version = $this->versionParser->normalize($prettyVersion);
  28009. } catch (\UnexpectedValueException $e) {
  28010. $extraDescription = ' (actual version: '.$prettyVersion.')';
  28011. if (Preg::isMatch('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  28012. $prettyVersion = $match[1];
  28013. } else {
  28014. $prettyVersion = '0';
  28015. }
  28016. $version = $this->versionParser->normalize($prettyVersion);
  28017. }
  28018. $packageName = $this->buildPackageName($name);
  28019. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  28020. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  28021. if ($name === 'uuid') {
  28022. $ext->setReplaces(array(
  28023. 'lib-uuid' => new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion()),
  28024. ));
  28025. }
  28026. $this->addPackage($ext);
  28027. }
  28028. private function buildPackageName(string $name): string
  28029. {
  28030. return 'ext-' . str_replace(' ', '-', strtolower($name));
  28031. }
  28032. private function addLibrary(string $name, ?string $prettyVersion, ?string $description = null, array $replaces = array(), array $provides = array()): void
  28033. {
  28034. if (null === $prettyVersion) {
  28035. return;
  28036. }
  28037. try {
  28038. $version = $this->versionParser->normalize($prettyVersion);
  28039. } catch (\UnexpectedValueException $e) {
  28040. return;
  28041. }
  28042. if ($description === null) {
  28043. $description = 'The '.$name.' library';
  28044. }
  28045. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  28046. $lib->setDescription($description);
  28047. $replaceLinks = array();
  28048. foreach ($replaces as $replace) {
  28049. $replace = strtolower($replace);
  28050. $replaceLinks[$replace] = new Link('lib-'.$name, 'lib-'.$replace, new Constraint('=', $version), Link::TYPE_REPLACE, $lib->getPrettyVersion());
  28051. }
  28052. $provideLinks = array();
  28053. foreach ($provides as $provide) {
  28054. $provide = strtolower($provide);
  28055. $provideLinks[$provide] = new Link('lib-'.$name, 'lib-'.$provide, new Constraint('=', $version), Link::TYPE_PROVIDE, $lib->getPrettyVersion());
  28056. }
  28057. $lib->setReplaces($replaceLinks);
  28058. $lib->setProvides($provideLinks);
  28059. $this->addPackage($lib);
  28060. }
  28061. public static function isPlatformPackage(string $name): bool
  28062. {
  28063. static $cache = array();
  28064. if (isset($cache[$name])) {
  28065. return $cache[$name];
  28066. }
  28067. return $cache[$name] = Preg::isMatch(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name);
  28068. }
  28069. public static function getPlatformPhpVersion(): ?string
  28070. {
  28071. return self::$lastSeenPlatformPhp;
  28072. }
  28073. public function search(string $query, int $mode = 0, ?string $type = null): array
  28074. {
  28075. if ($mode === self::SEARCH_VENDOR) {
  28076. return array();
  28077. }
  28078. return parent::search($query, $mode, $type);
  28079. }
  28080. }
  28081. <?php declare(strict_types=1);
  28082. namespace Composer\Repository;
  28083. use Composer\Factory;
  28084. use Composer\IO\IOInterface;
  28085. use Composer\Config;
  28086. use Composer\EventDispatcher\EventDispatcher;
  28087. use Composer\Pcre\Preg;
  28088. use Composer\Util\HttpDownloader;
  28089. use Composer\Util\ProcessExecutor;
  28090. use Composer\Json\JsonFile;
  28091. class RepositoryFactory
  28092. {
  28093. public static function configFromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false)
  28094. {
  28095. if (0 === strpos($repository, 'http')) {
  28096. $repoConfig = array('type' => 'composer', 'url' => $repository);
  28097. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  28098. $json = new JsonFile($repository, Factory::createHttpDownloader($io, $config));
  28099. $data = $json->read();
  28100. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  28101. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  28102. } elseif ($allowFilesystem) {
  28103. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  28104. } else {
  28105. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  28106. }
  28107. } elseif (strpos($repository, '{') === 0) {
  28108. $repoConfig = JsonFile::parseJson($repository);
  28109. } else {
  28110. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  28111. }
  28112. return $repoConfig;
  28113. }
  28114. public static function fromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false, RepositoryManager $rm = null): RepositoryInterface
  28115. {
  28116. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  28117. return static::createRepo($io, $config, $repoConfig, $rm);
  28118. }
  28119. public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null): RepositoryInterface
  28120. {
  28121. if (!$rm) {
  28122. $rm = static::manager($io, $config, Factory::createHttpDownloader($io, $config));
  28123. }
  28124. $repos = self::createRepos($rm, array($repoConfig));
  28125. return reset($repos);
  28126. }
  28127. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null): array
  28128. {
  28129. if (!$config) {
  28130. $config = Factory::createConfig($io);
  28131. }
  28132. if ($io) {
  28133. $io->loadConfiguration($config);
  28134. }
  28135. if (!$rm) {
  28136. if (!$io) {
  28137. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  28138. }
  28139. $rm = static::manager($io, $config, Factory::createHttpDownloader($io, $config));
  28140. }
  28141. return self::createRepos($rm, $config->getRepositories());
  28142. }
  28143. public static function manager(IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $eventDispatcher = null, ProcessExecutor $process = null): RepositoryManager
  28144. {
  28145. $rm = new RepositoryManager($io, $config, $httpDownloader, $eventDispatcher, $process);
  28146. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  28147. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  28148. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  28149. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  28150. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  28151. $rm->setRepositoryClass('bitbucket', 'Composer\Repository\VcsRepository');
  28152. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  28153. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  28154. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  28155. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  28156. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  28157. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  28158. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  28159. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  28160. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  28161. return $rm;
  28162. }
  28163. private static function createRepos(RepositoryManager $rm, array $repoConfigs): array
  28164. {
  28165. $repos = array();
  28166. foreach ($repoConfigs as $index => $repo) {
  28167. if (is_string($repo)) {
  28168. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  28169. }
  28170. if (!is_array($repo)) {
  28171. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  28172. }
  28173. if (!isset($repo['type'])) {
  28174. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  28175. }
  28176. $name = self::generateRepositoryName($index, $repo, $repos);
  28177. if ($repo['type'] === 'filesystem') {
  28178. $repos[$name] = new FilesystemRepository($repo['json']);
  28179. } else {
  28180. $repos[$name] = $rm->createRepository($repo['type'], $repo, (string) $index);
  28181. }
  28182. }
  28183. return $repos;
  28184. }
  28185. public static function generateRepositoryName($index, array $repo, array $existingRepos): string
  28186. {
  28187. $name = is_int($index) && isset($repo['url']) ? Preg::replace('{^https?://}i', '', $repo['url']) : (string) $index;
  28188. while (isset($existingRepos[$name])) {
  28189. $name .= '2';
  28190. }
  28191. return $name;
  28192. }
  28193. }
  28194. <?php declare(strict_types=1);
  28195. namespace Composer\Repository;
  28196. use Composer\Package\PackageInterface;
  28197. use Composer\Package\BasePackage;
  28198. use Composer\Semver\Constraint\ConstraintInterface;
  28199. interface RepositoryInterface extends \Countable
  28200. {
  28201. public const SEARCH_FULLTEXT = 0;
  28202. public const SEARCH_NAME = 1;
  28203. public const SEARCH_VENDOR = 2;
  28204. public function hasPackage(PackageInterface $package);
  28205. public function findPackage(string $name, $constraint);
  28206. public function findPackages(string $name, $constraint = null);
  28207. public function getPackages();
  28208. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = array());
  28209. public function search(string $query, int $mode = 0, ?string $type = null);
  28210. public function getProviders(string $packageName);
  28211. public function getRepoName();
  28212. }
  28213. <?php declare(strict_types=1);
  28214. namespace Composer\Repository;
  28215. use Composer\IO\IOInterface;
  28216. use Composer\Config;
  28217. use Composer\EventDispatcher\EventDispatcher;
  28218. use Composer\Package\PackageInterface;
  28219. use Composer\Util\HttpDownloader;
  28220. use Composer\Util\ProcessExecutor;
  28221. class RepositoryManager
  28222. {
  28223. private $localRepository;
  28224. private $repositories = array();
  28225. private $repositoryClasses = array();
  28226. private $io;
  28227. private $config;
  28228. private $httpDownloader;
  28229. private $eventDispatcher;
  28230. private $process;
  28231. public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $eventDispatcher = null, ProcessExecutor $process = null)
  28232. {
  28233. $this->io = $io;
  28234. $this->config = $config;
  28235. $this->httpDownloader = $httpDownloader;
  28236. $this->eventDispatcher = $eventDispatcher;
  28237. $this->process = $process ?? new ProcessExecutor($io);
  28238. }
  28239. public function findPackage(string $name, $constraint): ?PackageInterface
  28240. {
  28241. foreach ($this->repositories as $repository) {
  28242. if ($package = $repository->findPackage($name, $constraint)) {
  28243. return $package;
  28244. }
  28245. }
  28246. return null;
  28247. }
  28248. public function findPackages(string $name, $constraint): array
  28249. {
  28250. $packages = array();
  28251. foreach ($this->getRepositories() as $repository) {
  28252. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  28253. }
  28254. return $packages;
  28255. }
  28256. public function addRepository(RepositoryInterface $repository): void
  28257. {
  28258. $this->repositories[] = $repository;
  28259. }
  28260. public function prependRepository(RepositoryInterface $repository): void
  28261. {
  28262. array_unshift($this->repositories, $repository);
  28263. }
  28264. public function createRepository(string $type, array $config, string $name = null): RepositoryInterface
  28265. {
  28266. if (!isset($this->repositoryClasses[$type])) {
  28267. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  28268. }
  28269. if (isset($config['packagist']) && false === $config['packagist']) {
  28270. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  28271. }
  28272. $class = $this->repositoryClasses[$type];
  28273. if (isset($config['only']) || isset($config['exclude']) || isset($config['canonical'])) {
  28274. $filterConfig = $config;
  28275. unset($config['only'], $config['exclude'], $config['canonical']);
  28276. }
  28277. $repository = new $class($config, $this->io, $this->config, $this->httpDownloader, $this->eventDispatcher, $this->process);
  28278. if (isset($filterConfig)) {
  28279. $repository = new FilterRepository($repository, $filterConfig);
  28280. }
  28281. return $repository;
  28282. }
  28283. public function setRepositoryClass(string $type, $class): void
  28284. {
  28285. $this->repositoryClasses[$type] = $class;
  28286. }
  28287. public function getRepositories(): array
  28288. {
  28289. return $this->repositories;
  28290. }
  28291. public function setLocalRepository(InstalledRepositoryInterface $repository): void
  28292. {
  28293. $this->localRepository = $repository;
  28294. }
  28295. public function getLocalRepository(): InstalledRepositoryInterface
  28296. {
  28297. return $this->localRepository;
  28298. }
  28299. }
  28300. <?php declare(strict_types=1);
  28301. namespace Composer\Repository;
  28302. class RepositorySecurityException extends \Exception
  28303. {
  28304. }
  28305. <?php declare(strict_types=1);
  28306. namespace Composer\Repository;
  28307. use Composer\DependencyResolver\PoolOptimizer;
  28308. use Composer\DependencyResolver\Pool;
  28309. use Composer\DependencyResolver\PoolBuilder;
  28310. use Composer\DependencyResolver\Request;
  28311. use Composer\EventDispatcher\EventDispatcher;
  28312. use Composer\IO\IOInterface;
  28313. use Composer\IO\NullIO;
  28314. use Composer\Package\BasePackage;
  28315. use Composer\Package\AliasPackage;
  28316. use Composer\Package\CompleteAliasPackage;
  28317. use Composer\Package\CompletePackage;
  28318. use Composer\Semver\Constraint\ConstraintInterface;
  28319. use Composer\Package\Version\StabilityFilter;
  28320. class RepositorySet
  28321. {
  28322. public const ALLOW_UNACCEPTABLE_STABILITIES = 1;
  28323. public const ALLOW_SHADOWED_REPOSITORIES = 2;
  28324. private $rootAliases;
  28325. private $rootReferences;
  28326. private $repositories = array();
  28327. private $acceptableStabilities;
  28328. private $stabilityFlags;
  28329. private $rootRequires;
  28330. private $locked = false;
  28331. private $allowInstalledRepositories = false;
  28332. public function __construct(string $minimumStability = 'stable', array $stabilityFlags = array(), array $rootAliases = array(), array $rootReferences = array(), array $rootRequires = array())
  28333. {
  28334. $this->rootAliases = self::getRootAliasesPerPackage($rootAliases);
  28335. $this->rootReferences = $rootReferences;
  28336. $this->acceptableStabilities = array();
  28337. foreach (BasePackage::$stabilities as $stability => $value) {
  28338. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  28339. $this->acceptableStabilities[$stability] = $value;
  28340. }
  28341. }
  28342. $this->stabilityFlags = $stabilityFlags;
  28343. $this->rootRequires = $rootRequires;
  28344. foreach ($rootRequires as $name => $constraint) {
  28345. if (PlatformRepository::isPlatformPackage($name)) {
  28346. unset($this->rootRequires[$name]);
  28347. }
  28348. }
  28349. }
  28350. public function allowInstalledRepositories(bool $allow = true): void
  28351. {
  28352. $this->allowInstalledRepositories = $allow;
  28353. }
  28354. public function getRootRequires(): array
  28355. {
  28356. return $this->rootRequires;
  28357. }
  28358. public function addRepository(RepositoryInterface $repo): void
  28359. {
  28360. if ($this->locked) {
  28361. throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore.");
  28362. }
  28363. if ($repo instanceof CompositeRepository) {
  28364. $repos = $repo->getRepositories();
  28365. } else {
  28366. $repos = array($repo);
  28367. }
  28368. foreach ($repos as $repo) {
  28369. $this->repositories[] = $repo;
  28370. }
  28371. }
  28372. public function findPackages(string $name, ConstraintInterface $constraint = null, int $flags = 0): array
  28373. {
  28374. $ignoreStability = ($flags & self::ALLOW_UNACCEPTABLE_STABILITIES) !== 0;
  28375. $loadFromAllRepos = ($flags & self::ALLOW_SHADOWED_REPOSITORIES) !== 0;
  28376. $packages = array();
  28377. if ($loadFromAllRepos) {
  28378. foreach ($this->repositories as $repository) {
  28379. $packages[] = $repository->findPackages($name, $constraint) ?: array();
  28380. }
  28381. } else {
  28382. foreach ($this->repositories as $repository) {
  28383. $result = $repository->loadPackages(array($name => $constraint), $ignoreStability ? BasePackage::$stabilities : $this->acceptableStabilities, $ignoreStability ? array() : $this->stabilityFlags);
  28384. $packages[] = $result['packages'];
  28385. foreach ($result['namesFound'] as $nameFound) {
  28386. if ($name === $nameFound) {
  28387. break 2;
  28388. }
  28389. }
  28390. }
  28391. }
  28392. $candidates = $packages ? call_user_func_array('array_merge', $packages) : array();
  28393. if ($ignoreStability || !$loadFromAllRepos) {
  28394. return $candidates;
  28395. }
  28396. $result = array();
  28397. foreach ($candidates as $candidate) {
  28398. if ($this->isPackageAcceptable($candidate->getNames(), $candidate->getStability())) {
  28399. $result[] = $candidate;
  28400. }
  28401. }
  28402. return $result;
  28403. }
  28404. public function getProviders(string $packageName): array
  28405. {
  28406. $providers = array();
  28407. foreach ($this->repositories as $repository) {
  28408. if ($repoProviders = $repository->getProviders($packageName)) {
  28409. $providers = array_merge($providers, $repoProviders);
  28410. }
  28411. }
  28412. return $providers;
  28413. }
  28414. public function isPackageAcceptable(array $names, string $stability): bool
  28415. {
  28416. return StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $names, $stability);
  28417. }
  28418. public function createPool(Request $request, IOInterface $io, EventDispatcher $eventDispatcher = null, PoolOptimizer $poolOptimizer = null): Pool
  28419. {
  28420. $poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $io, $eventDispatcher, $poolOptimizer);
  28421. foreach ($this->repositories as $repo) {
  28422. if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
  28423. throw new \LogicException('The pool can not accept packages from an installed repository');
  28424. }
  28425. }
  28426. $this->locked = true;
  28427. return $poolBuilder->buildPool($this->repositories, $request);
  28428. }
  28429. public function createPoolWithAllPackages(): Pool
  28430. {
  28431. foreach ($this->repositories as $repo) {
  28432. if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
  28433. throw new \LogicException('The pool can not accept packages from an installed repository');
  28434. }
  28435. }
  28436. $this->locked = true;
  28437. $packages = array();
  28438. foreach ($this->repositories as $repository) {
  28439. foreach ($repository->getPackages() as $package) {
  28440. $packages[] = $package;
  28441. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  28442. $alias = $this->rootAliases[$package->getName()][$package->getVersion()];
  28443. while ($package instanceof AliasPackage) {
  28444. $package = $package->getAliasOf();
  28445. }
  28446. if ($package instanceof CompletePackage) {
  28447. $aliasPackage = new CompleteAliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  28448. } else {
  28449. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  28450. }
  28451. $aliasPackage->setRootPackageAlias(true);
  28452. $packages[] = $aliasPackage;
  28453. }
  28454. }
  28455. }
  28456. return new Pool($packages);
  28457. }
  28458. public function createPoolForPackage(string $packageName, LockArrayRepository $lockedRepo = null): Pool
  28459. {
  28460. return $this->createPoolForPackages(array($packageName), $lockedRepo);
  28461. }
  28462. public function createPoolForPackages(array $packageNames, LockArrayRepository $lockedRepo = null): Pool
  28463. {
  28464. $request = new Request($lockedRepo);
  28465. foreach ($packageNames as $packageName) {
  28466. if (PlatformRepository::isPlatformPackage($packageName)) {
  28467. throw new \LogicException('createPoolForPackage(s) can not be used for platform packages, as they are never loaded by the PoolBuilder which expects them to be fixed. Use createPoolWithAllPackages or pass in a proper request with the platform packages you need fixed in it.');
  28468. }
  28469. $request->requireName($packageName);
  28470. }
  28471. return $this->createPool($request, new NullIO());
  28472. }
  28473. private static function getRootAliasesPerPackage(array $aliases): array
  28474. {
  28475. $normalizedAliases = array();
  28476. foreach ($aliases as $alias) {
  28477. $normalizedAliases[$alias['package']][$alias['version']] = array(
  28478. 'alias' => $alias['alias'],
  28479. 'alias_normalized' => $alias['alias_normalized'],
  28480. );
  28481. }
  28482. return $normalizedAliases;
  28483. }
  28484. }
  28485. <?php declare(strict_types=1);
  28486. namespace Composer\Repository;
  28487. use Composer\Package\RootPackageInterface;
  28488. class RootPackageRepository extends ArrayRepository
  28489. {
  28490. public function __construct(RootPackageInterface $package)
  28491. {
  28492. parent::__construct(array($package));
  28493. }
  28494. public function getRepoName(): string
  28495. {
  28496. return 'root package repo';
  28497. }
  28498. }
  28499. <?php declare(strict_types=1);
  28500. namespace Composer\Repository\Vcs;
  28501. use Composer\Cache;
  28502. use Composer\Config;
  28503. use Composer\Pcre\Preg;
  28504. use Composer\Util\ProcessExecutor;
  28505. use Composer\Util\Filesystem;
  28506. use Composer\IO\IOInterface;
  28507. class FossilDriver extends VcsDriver
  28508. {
  28509. protected $tags;
  28510. protected $branches;
  28511. protected $rootIdentifier = null;
  28512. protected $repoFile = null;
  28513. protected $checkoutDir;
  28514. public function initialize(): void
  28515. {
  28516. $this->checkFossil();
  28517. $this->config->prohibitUrlByConfig($this->url, $this->io);
  28518. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  28519. $this->checkoutDir = $this->url;
  28520. } else {
  28521. if (!Cache::isUsable((string) $this->config->get('cache-repo-dir')) || !Cache::isUsable((string) $this->config->get('cache-vcs-dir'))) {
  28522. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  28523. }
  28524. $localName = Preg::replace('{[^a-z0-9]}i', '-', $this->url);
  28525. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  28526. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  28527. $this->updateLocalRepo();
  28528. }
  28529. $this->getTags();
  28530. $this->getBranches();
  28531. }
  28532. protected function checkFossil(): void
  28533. {
  28534. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  28535. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  28536. }
  28537. }
  28538. protected function updateLocalRepo(): void
  28539. {
  28540. $fs = new Filesystem();
  28541. $fs->ensureDirectoryExists($this->checkoutDir);
  28542. if (!is_writable(dirname($this->checkoutDir))) {
  28543. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  28544. }
  28545. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  28546. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  28547. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  28548. }
  28549. } else {
  28550. $fs->removeDirectory($this->checkoutDir);
  28551. $fs->remove($this->repoFile);
  28552. $fs->ensureDirectoryExists($this->checkoutDir);
  28553. if (0 !== $this->process->execute(sprintf('fossil clone -- %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  28554. $output = $this->process->getErrorOutput();
  28555. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  28556. }
  28557. if (0 !== $this->process->execute(sprintf('fossil open --nested -- %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  28558. $output = $this->process->getErrorOutput();
  28559. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  28560. }
  28561. }
  28562. }
  28563. public function getRootIdentifier(): string
  28564. {
  28565. if (null === $this->rootIdentifier) {
  28566. $this->rootIdentifier = 'trunk';
  28567. }
  28568. return $this->rootIdentifier;
  28569. }
  28570. public function getUrl(): string
  28571. {
  28572. return $this->url;
  28573. }
  28574. public function getSource(string $identifier): array
  28575. {
  28576. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  28577. }
  28578. public function getDist(string $identifier): ?array
  28579. {
  28580. return null;
  28581. }
  28582. public function getFileContent(string $file, string $identifier): ?string
  28583. {
  28584. $command = sprintf('fossil cat -r %s -- %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  28585. $this->process->execute($command, $content, $this->checkoutDir);
  28586. if (!trim($content)) {
  28587. return null;
  28588. }
  28589. return $content;
  28590. }
  28591. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  28592. {
  28593. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  28594. list(, $date) = explode(' ', trim($output), 3);
  28595. return new \DateTimeImmutable($date, new \DateTimeZone('UTC'));
  28596. }
  28597. public function getTags(): array
  28598. {
  28599. if (null === $this->tags) {
  28600. $tags = array();
  28601. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  28602. foreach ($this->process->splitLines($output) as $tag) {
  28603. $tags[$tag] = $tag;
  28604. }
  28605. $this->tags = $tags;
  28606. }
  28607. return $this->tags;
  28608. }
  28609. public function getBranches(): array
  28610. {
  28611. if (null === $this->branches) {
  28612. $branches = array();
  28613. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  28614. foreach ($this->process->splitLines($output) as $branch) {
  28615. $branch = trim(Preg::replace('/^\*/', '', trim($branch)));
  28616. $branches[$branch] = $branch;
  28617. }
  28618. $this->branches = $branches;
  28619. }
  28620. return $this->branches;
  28621. }
  28622. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  28623. {
  28624. if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  28625. return true;
  28626. }
  28627. if (Preg::isMatch('!/fossil/|\.fossil!', $url)) {
  28628. return true;
  28629. }
  28630. if (Filesystem::isLocalPath($url)) {
  28631. $url = Filesystem::getPlatformPath($url);
  28632. if (!is_dir($url)) {
  28633. return false;
  28634. }
  28635. $process = new ProcessExecutor($io);
  28636. if ($process->execute('fossil info', $output, $url) === 0) {
  28637. return true;
  28638. }
  28639. }
  28640. return false;
  28641. }
  28642. }
  28643. <?php declare(strict_types=1);
  28644. namespace Composer\Repository\Vcs;
  28645. use Composer\Config;
  28646. use Composer\IO\IOInterface;
  28647. use Composer\Cache;
  28648. use Composer\Downloader\TransportException;
  28649. use Composer\Json\JsonFile;
  28650. use Composer\Pcre\Preg;
  28651. use Composer\Util\Bitbucket;
  28652. use Composer\Util\Http\Response;
  28653. class GitBitbucketDriver extends VcsDriver
  28654. {
  28655. protected $owner;
  28656. protected $repository;
  28657. private $hasIssues = false;
  28658. private $rootIdentifier;
  28659. private $tags;
  28660. private $branches;
  28661. private $branchesUrl = '';
  28662. private $tagsUrl = '';
  28663. private $homeUrl = '';
  28664. private $website = '';
  28665. private $cloneHttpsUrl = '';
  28666. protected $fallbackDriver = null;
  28667. private $vcsType;
  28668. public function initialize(): void
  28669. {
  28670. if (!Preg::isMatch('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $this->url, $match)) {
  28671. throw new \InvalidArgumentException(sprintf('The Bitbucket repository URL %s is invalid. It must be the HTTPS URL of a Bitbucket repository.', $this->url));
  28672. }
  28673. $this->owner = $match[1];
  28674. $this->repository = $match[2];
  28675. $this->originUrl = 'bitbucket.org';
  28676. $this->cache = new Cache(
  28677. $this->io,
  28678. implode('/', array(
  28679. $this->config->get('cache-repo-dir'),
  28680. $this->originUrl,
  28681. $this->owner,
  28682. $this->repository,
  28683. ))
  28684. );
  28685. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  28686. }
  28687. public function getUrl(): string
  28688. {
  28689. if ($this->fallbackDriver) {
  28690. return $this->fallbackDriver->getUrl();
  28691. }
  28692. return $this->cloneHttpsUrl;
  28693. }
  28694. protected function getRepoData(): bool
  28695. {
  28696. $resource = sprintf(
  28697. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  28698. $this->owner,
  28699. $this->repository,
  28700. http_build_query(
  28701. array('fields' => '-project,-owner'),
  28702. '',
  28703. '&'
  28704. )
  28705. );
  28706. $repoData = $this->fetchWithOAuthCredentials($resource, true)->decodeJson();
  28707. if ($this->fallbackDriver) {
  28708. return false;
  28709. }
  28710. $this->parseCloneUrls($repoData['links']['clone']);
  28711. $this->hasIssues = !empty($repoData['has_issues']);
  28712. $this->branchesUrl = $repoData['links']['branches']['href'];
  28713. $this->tagsUrl = $repoData['links']['tags']['href'];
  28714. $this->homeUrl = $repoData['links']['html']['href'];
  28715. $this->website = $repoData['website'];
  28716. $this->vcsType = $repoData['scm'];
  28717. return true;
  28718. }
  28719. public function getComposerInformation(string $identifier): ?array
  28720. {
  28721. if ($this->fallbackDriver) {
  28722. return $this->fallbackDriver->getComposerInformation($identifier);
  28723. }
  28724. if (!isset($this->infoCache[$identifier])) {
  28725. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  28726. $composer = JsonFile::parseJson($res);
  28727. } else {
  28728. $composer = $this->getBaseComposerInformation($identifier);
  28729. if ($this->shouldCache($identifier)) {
  28730. $this->cache->write($identifier, json_encode($composer));
  28731. }
  28732. }
  28733. if ($composer !== null) {
  28734. if (!isset($composer['support']['source'])) {
  28735. $label = array_search(
  28736. $identifier,
  28737. $this->getTags()
  28738. ) ?: array_search(
  28739. $identifier,
  28740. $this->getBranches()
  28741. ) ?: $identifier;
  28742. if (array_key_exists($label, $tags = $this->getTags())) {
  28743. $hash = $tags[$label];
  28744. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  28745. $hash = $branches[$label];
  28746. }
  28747. if (!isset($hash)) {
  28748. $composer['support']['source'] = sprintf(
  28749. 'https://%s/%s/%s/src',
  28750. $this->originUrl,
  28751. $this->owner,
  28752. $this->repository
  28753. );
  28754. } else {
  28755. $composer['support']['source'] = sprintf(
  28756. 'https://%s/%s/%s/src/%s/?at=%s',
  28757. $this->originUrl,
  28758. $this->owner,
  28759. $this->repository,
  28760. $hash,
  28761. $label
  28762. );
  28763. }
  28764. }
  28765. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  28766. $composer['support']['issues'] = sprintf(
  28767. 'https://%s/%s/%s/issues',
  28768. $this->originUrl,
  28769. $this->owner,
  28770. $this->repository
  28771. );
  28772. }
  28773. if (!isset($composer['homepage'])) {
  28774. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  28775. }
  28776. }
  28777. $this->infoCache[$identifier] = $composer;
  28778. }
  28779. return $this->infoCache[$identifier];
  28780. }
  28781. public function getFileContent(string $file, string $identifier): ?string
  28782. {
  28783. if ($this->fallbackDriver) {
  28784. return $this->fallbackDriver->getFileContent($file, $identifier);
  28785. }
  28786. if (strpos($identifier, '/') !== false) {
  28787. $branches = $this->getBranches();
  28788. if (isset($branches[$identifier])) {
  28789. $identifier = $branches[$identifier];
  28790. }
  28791. }
  28792. $resource = sprintf(
  28793. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  28794. $this->owner,
  28795. $this->repository,
  28796. $identifier,
  28797. $file
  28798. );
  28799. return $this->fetchWithOAuthCredentials($resource)->getBody();
  28800. }
  28801. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  28802. {
  28803. if ($this->fallbackDriver) {
  28804. return $this->fallbackDriver->getChangeDate($identifier);
  28805. }
  28806. if (strpos($identifier, '/') !== false) {
  28807. $branches = $this->getBranches();
  28808. if (isset($branches[$identifier])) {
  28809. $identifier = $branches[$identifier];
  28810. }
  28811. }
  28812. $resource = sprintf(
  28813. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  28814. $this->owner,
  28815. $this->repository,
  28816. $identifier
  28817. );
  28818. $commit = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  28819. return new \DateTimeImmutable($commit['date']);
  28820. }
  28821. public function getSource(string $identifier): array
  28822. {
  28823. if ($this->fallbackDriver) {
  28824. return $this->fallbackDriver->getSource($identifier);
  28825. }
  28826. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  28827. }
  28828. public function getDist(string $identifier): ?array
  28829. {
  28830. if ($this->fallbackDriver) {
  28831. return $this->fallbackDriver->getDist($identifier);
  28832. }
  28833. $url = sprintf(
  28834. 'https://bitbucket.org/%s/%s/get/%s.zip',
  28835. $this->owner,
  28836. $this->repository,
  28837. $identifier
  28838. );
  28839. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  28840. }
  28841. public function getTags(): array
  28842. {
  28843. if ($this->fallbackDriver) {
  28844. return $this->fallbackDriver->getTags();
  28845. }
  28846. if (null === $this->tags) {
  28847. $tags = array();
  28848. $resource = sprintf(
  28849. '%s?%s',
  28850. $this->tagsUrl,
  28851. http_build_query(
  28852. array(
  28853. 'pagelen' => 100,
  28854. 'fields' => 'values.name,values.target.hash,next',
  28855. 'sort' => '-target.date',
  28856. ),
  28857. '',
  28858. '&'
  28859. )
  28860. );
  28861. $hasNext = true;
  28862. while ($hasNext) {
  28863. $tagsData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  28864. foreach ($tagsData['values'] as $data) {
  28865. $tags[$data['name']] = $data['target']['hash'];
  28866. }
  28867. if (empty($tagsData['next'])) {
  28868. $hasNext = false;
  28869. } else {
  28870. $resource = $tagsData['next'];
  28871. }
  28872. }
  28873. $this->tags = $tags;
  28874. }
  28875. return $this->tags;
  28876. }
  28877. public function getBranches(): array
  28878. {
  28879. if ($this->fallbackDriver) {
  28880. return $this->fallbackDriver->getBranches();
  28881. }
  28882. if (null === $this->branches) {
  28883. $branches = array();
  28884. $resource = sprintf(
  28885. '%s?%s',
  28886. $this->branchesUrl,
  28887. http_build_query(
  28888. array(
  28889. 'pagelen' => 100,
  28890. 'fields' => 'values.name,values.target.hash,values.heads,next',
  28891. 'sort' => '-target.date',
  28892. ),
  28893. '',
  28894. '&'
  28895. )
  28896. );
  28897. $hasNext = true;
  28898. while ($hasNext) {
  28899. $branchData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  28900. foreach ($branchData['values'] as $data) {
  28901. $branches[$data['name']] = $data['target']['hash'];
  28902. }
  28903. if (empty($branchData['next'])) {
  28904. $hasNext = false;
  28905. } else {
  28906. $resource = $branchData['next'];
  28907. }
  28908. }
  28909. $this->branches = $branches;
  28910. }
  28911. return $this->branches;
  28912. }
  28913. protected function fetchWithOAuthCredentials(string $url, bool $fetchingRepoData = false): Response
  28914. {
  28915. try {
  28916. return parent::getContents($url);
  28917. } catch (TransportException $e) {
  28918. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->httpDownloader);
  28919. if (in_array($e->getCode(), array(403, 404), true) || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  28920. if (!$this->io->hasAuthentication($this->originUrl)
  28921. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  28922. ) {
  28923. return parent::getContents($url);
  28924. }
  28925. if (!$this->io->isInteractive() && $fetchingRepoData) {
  28926. $this->attemptCloneFallback();
  28927. return new Response(array('url' => 'dummy'), 200, array(), 'null');
  28928. }
  28929. }
  28930. throw $e;
  28931. }
  28932. }
  28933. protected function generateSshUrl(): string
  28934. {
  28935. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  28936. }
  28937. protected function attemptCloneFallback(): bool
  28938. {
  28939. try {
  28940. $this->setupFallbackDriver($this->generateSshUrl());
  28941. return true;
  28942. } catch (\RuntimeException $e) {
  28943. $this->fallbackDriver = null;
  28944. $this->io->writeError(
  28945. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  28946. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  28947. );
  28948. throw $e;
  28949. }
  28950. }
  28951. protected function setupFallbackDriver(string $url): void
  28952. {
  28953. $this->fallbackDriver = new GitDriver(
  28954. array('url' => $url),
  28955. $this->io,
  28956. $this->config,
  28957. $this->httpDownloader,
  28958. $this->process
  28959. );
  28960. $this->fallbackDriver->initialize();
  28961. }
  28962. protected function parseCloneUrls(array $cloneLinks): void
  28963. {
  28964. foreach ($cloneLinks as $cloneLink) {
  28965. if ($cloneLink['name'] === 'https') {
  28966. $this->cloneHttpsUrl = Preg::replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  28967. }
  28968. }
  28969. }
  28970. protected function getMainBranchData(): ?array
  28971. {
  28972. $resource = sprintf(
  28973. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  28974. $this->owner,
  28975. $this->repository
  28976. );
  28977. $data = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  28978. if (isset($data['mainbranch'])) {
  28979. return $data['mainbranch'];
  28980. }
  28981. return null;
  28982. }
  28983. public function getRootIdentifier(): string
  28984. {
  28985. if ($this->fallbackDriver) {
  28986. return $this->fallbackDriver->getRootIdentifier();
  28987. }
  28988. if (null === $this->rootIdentifier) {
  28989. if (!$this->getRepoData()) {
  28990. if (!$this->fallbackDriver) {
  28991. throw new \LogicException('A fallback driver should be setup if getRepoData returns false');
  28992. }
  28993. return $this->fallbackDriver->getRootIdentifier();
  28994. }
  28995. if ($this->vcsType !== 'git') {
  28996. throw new \RuntimeException(
  28997. $this->url.' does not appear to be a git repository, use '.
  28998. $this->cloneHttpsUrl.' but remember that Bitbucket no longer supports the mercurial repositories. '.
  28999. 'https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'
  29000. );
  29001. }
  29002. $mainBranchData = $this->getMainBranchData();
  29003. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  29004. }
  29005. return $this->rootIdentifier;
  29006. }
  29007. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  29008. {
  29009. if (!Preg::isMatch('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $url)) {
  29010. return false;
  29011. }
  29012. if (!extension_loaded('openssl')) {
  29013. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  29014. return false;
  29015. }
  29016. return true;
  29017. }
  29018. }
  29019. <?php declare(strict_types=1);
  29020. namespace Composer\Repository\Vcs;
  29021. use Composer\Pcre\Preg;
  29022. use Composer\Util\Platform;
  29023. use Composer\Util\ProcessExecutor;
  29024. use Composer\Util\Filesystem;
  29025. use Composer\Util\Url;
  29026. use Composer\Util\Git as GitUtil;
  29027. use Composer\IO\IOInterface;
  29028. use Composer\Cache;
  29029. use Composer\Config;
  29030. class GitDriver extends VcsDriver
  29031. {
  29032. protected $tags;
  29033. protected $branches;
  29034. protected $rootIdentifier;
  29035. protected $repoDir;
  29036. public function initialize(): void
  29037. {
  29038. if (Filesystem::isLocalPath($this->url)) {
  29039. $this->url = Preg::replace('{[\\/]\.git/?$}', '', $this->url);
  29040. if (!is_dir($this->url)) {
  29041. throw new \RuntimeException('Failed to read package information from '.$this->url.' as the path does not exist');
  29042. }
  29043. $this->repoDir = $this->url;
  29044. $cacheUrl = realpath($this->url);
  29045. } else {
  29046. if (!Cache::isUsable((string) $this->config->get('cache-vcs-dir'))) {
  29047. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  29048. }
  29049. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . Preg::replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  29050. GitUtil::cleanEnv();
  29051. $fs = new Filesystem();
  29052. $fs->ensureDirectoryExists(dirname($this->repoDir));
  29053. if (!is_writable(dirname($this->repoDir))) {
  29054. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  29055. }
  29056. if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  29057. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  29058. }
  29059. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  29060. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  29061. if (!is_dir($this->repoDir)) {
  29062. throw new \RuntimeException('Failed to clone '.$this->url.' to read package information from it');
  29063. }
  29064. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  29065. }
  29066. $cacheUrl = $this->url;
  29067. }
  29068. $this->getTags();
  29069. $this->getBranches();
  29070. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($cacheUrl)));
  29071. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  29072. }
  29073. public function getRootIdentifier(): string
  29074. {
  29075. if (null === $this->rootIdentifier) {
  29076. $this->rootIdentifier = 'master';
  29077. if (!(bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  29078. try {
  29079. $this->process->execute('git remote show origin', $output, $this->repoDir);
  29080. if (Preg::isMatch('{^\s*HEAD branch:\s(.+)\s*$}m', $output, $matches)) {
  29081. return $this->rootIdentifier = $matches[1];
  29082. }
  29083. } catch (\Exception $e) {
  29084. $this->io->writeError('<error>Failed to fetch root identifier from remote: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  29085. }
  29086. }
  29087. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  29088. $branches = $this->process->splitLines($output);
  29089. if (!in_array('* master', $branches)) {
  29090. foreach ($branches as $branch) {
  29091. if ($branch && Preg::isMatch('{^\* +(\S+)}', $branch, $match)) {
  29092. $this->rootIdentifier = $match[1];
  29093. break;
  29094. }
  29095. }
  29096. }
  29097. }
  29098. return $this->rootIdentifier;
  29099. }
  29100. public function getUrl(): string
  29101. {
  29102. return $this->url;
  29103. }
  29104. public function getSource(string $identifier): array
  29105. {
  29106. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  29107. }
  29108. public function getDist(string $identifier): ?array
  29109. {
  29110. return null;
  29111. }
  29112. public function getFileContent(string $file, string $identifier): ?string
  29113. {
  29114. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  29115. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  29116. if (!trim($content)) {
  29117. return null;
  29118. }
  29119. return $content;
  29120. }
  29121. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  29122. {
  29123. $this->process->execute(sprintf(
  29124. 'git -c log.showSignature=false log -1 --format=%%at %s',
  29125. ProcessExecutor::escape($identifier)
  29126. ), $output, $this->repoDir);
  29127. return new \DateTimeImmutable('@'.trim($output), new \DateTimeZone('UTC'));
  29128. }
  29129. public function getTags(): array
  29130. {
  29131. if (null === $this->tags) {
  29132. $this->tags = array();
  29133. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  29134. foreach ($output = $this->process->splitLines($output) as $tag) {
  29135. if ($tag && Preg::isMatch('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  29136. $this->tags[$match[2]] = (string) $match[1];
  29137. }
  29138. }
  29139. }
  29140. return $this->tags;
  29141. }
  29142. public function getBranches(): array
  29143. {
  29144. if (null === $this->branches) {
  29145. $branches = array();
  29146. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  29147. foreach ($this->process->splitLines($output) as $branch) {
  29148. if ($branch && !Preg::isMatch('{^ *[^/]+/HEAD }', $branch)) {
  29149. if (Preg::isMatch('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  29150. $branches[$match[1]] = $match[2];
  29151. }
  29152. }
  29153. }
  29154. $this->branches = $branches;
  29155. }
  29156. return $this->branches;
  29157. }
  29158. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  29159. {
  29160. if (Preg::isMatch('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  29161. return true;
  29162. }
  29163. if (Filesystem::isLocalPath($url)) {
  29164. $url = Filesystem::getPlatformPath($url);
  29165. if (!is_dir($url)) {
  29166. return false;
  29167. }
  29168. $process = new ProcessExecutor($io);
  29169. if ($process->execute('git tag', $output, $url) === 0) {
  29170. return true;
  29171. }
  29172. }
  29173. if (!$deep) {
  29174. return false;
  29175. }
  29176. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  29177. GitUtil::cleanEnv();
  29178. try {
  29179. $gitUtil->runCommand(function ($url): string {
  29180. return 'git ls-remote --heads -- ' . ProcessExecutor::escape($url);
  29181. }, $url, sys_get_temp_dir());
  29182. } catch (\RuntimeException $e) {
  29183. return false;
  29184. }
  29185. return true;
  29186. }
  29187. }
  29188. <?php declare(strict_types=1);
  29189. namespace Composer\Repository\Vcs;
  29190. use Composer\Config;
  29191. use Composer\Downloader\TransportException;
  29192. use Composer\Json\JsonFile;
  29193. use Composer\Cache;
  29194. use Composer\IO\IOInterface;
  29195. use Composer\Pcre\Preg;
  29196. use Composer\Util\GitHub;
  29197. use Composer\Util\Http\Response;
  29198. class GitHubDriver extends VcsDriver
  29199. {
  29200. protected $owner;
  29201. protected $repository;
  29202. protected $tags;
  29203. protected $branches;
  29204. protected $rootIdentifier;
  29205. protected $repoData;
  29206. protected $hasIssues = false;
  29207. protected $isPrivate = false;
  29208. private $isArchived = false;
  29209. private $fundingInfo;
  29210. protected $gitDriver = null;
  29211. public function initialize(): void
  29212. {
  29213. if (!Preg::isMatch('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match)) {
  29214. throw new \InvalidArgumentException(sprintf('The GitHub repository URL %s is invalid.', $this->url));
  29215. }
  29216. $this->owner = $match[3];
  29217. $this->repository = $match[4];
  29218. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  29219. if ($this->originUrl === 'www.github.com') {
  29220. $this->originUrl = 'github.com';
  29221. }
  29222. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  29223. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  29224. if ($this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'])) {
  29225. $this->setupGitDriver($this->url);
  29226. return;
  29227. }
  29228. $this->fetchRootIdentifier();
  29229. }
  29230. public function getRepositoryUrl(): string
  29231. {
  29232. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  29233. }
  29234. public function getRootIdentifier(): string
  29235. {
  29236. if ($this->gitDriver) {
  29237. return $this->gitDriver->getRootIdentifier();
  29238. }
  29239. return $this->rootIdentifier;
  29240. }
  29241. public function getUrl(): string
  29242. {
  29243. if ($this->gitDriver) {
  29244. return $this->gitDriver->getUrl();
  29245. }
  29246. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  29247. }
  29248. protected function getApiUrl(): string
  29249. {
  29250. if ('github.com' === $this->originUrl) {
  29251. $apiUrl = 'api.github.com';
  29252. } else {
  29253. $apiUrl = $this->originUrl . '/api/v3';
  29254. }
  29255. return 'https://' . $apiUrl;
  29256. }
  29257. public function getSource(string $identifier): array
  29258. {
  29259. if ($this->gitDriver) {
  29260. return $this->gitDriver->getSource($identifier);
  29261. }
  29262. if ($this->isPrivate) {
  29263. $url = $this->generateSshUrl();
  29264. } else {
  29265. $url = $this->getUrl();
  29266. }
  29267. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  29268. }
  29269. public function getDist(string $identifier): ?array
  29270. {
  29271. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  29272. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  29273. }
  29274. public function getComposerInformation(string $identifier): ?array
  29275. {
  29276. if ($this->gitDriver) {
  29277. return $this->gitDriver->getComposerInformation($identifier);
  29278. }
  29279. if (!isset($this->infoCache[$identifier])) {
  29280. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  29281. $composer = JsonFile::parseJson($res);
  29282. } else {
  29283. $composer = $this->getBaseComposerInformation($identifier);
  29284. if ($this->shouldCache($identifier)) {
  29285. $this->cache->write($identifier, json_encode($composer));
  29286. }
  29287. }
  29288. if ($composer !== null) {
  29289. if (!isset($composer['support']['source'])) {
  29290. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  29291. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  29292. }
  29293. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  29294. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  29295. }
  29296. if (!isset($composer['abandoned']) && $this->isArchived) {
  29297. $composer['abandoned'] = true;
  29298. }
  29299. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  29300. $composer['funding'] = $funding;
  29301. }
  29302. }
  29303. $this->infoCache[$identifier] = $composer;
  29304. }
  29305. return $this->infoCache[$identifier];
  29306. }
  29307. private function getFundingInfo()
  29308. {
  29309. if (null !== $this->fundingInfo) {
  29310. return $this->fundingInfo;
  29311. }
  29312. if ($this->originUrl !== 'github.com') {
  29313. return $this->fundingInfo = false;
  29314. }
  29315. foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) {
  29316. try {
  29317. $response = $this->httpDownloader->get($file, array(
  29318. 'retry-auth-failure' => false,
  29319. ))->decodeJson();
  29320. } catch (TransportException $e) {
  29321. continue;
  29322. }
  29323. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  29324. continue;
  29325. }
  29326. break;
  29327. }
  29328. if (empty($funding)) {
  29329. return $this->fundingInfo = false;
  29330. }
  29331. $result = array();
  29332. $key = null;
  29333. foreach (Preg::split('{\r?\n}', $funding) as $line) {
  29334. $line = trim($line);
  29335. if (Preg::isMatch('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  29336. if (Preg::isMatch('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
  29337. foreach (array_map('trim', Preg::split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  29338. $result[] = array('type' => $match[1], 'url' => trim($item, '"\' '));
  29339. }
  29340. } elseif (Preg::isMatch('{^([^#].*?)(\s+#.*)?$}', $match[2], $match2)) {
  29341. $result[] = array('type' => $match[1], 'url' => trim($match2[1], '"\' '));
  29342. }
  29343. $key = null;
  29344. } elseif (Preg::isMatch('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  29345. $key = $match[1];
  29346. } elseif ($key && Preg::isMatch('{^-\s*(.+)(\s+#.*)?$}', $line, $match)) {
  29347. $result[] = array('type' => $key, 'url' => trim($match[1], '"\' '));
  29348. }
  29349. }
  29350. foreach ($result as $key => $item) {
  29351. switch ($item['type']) {
  29352. case 'tidelift':
  29353. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  29354. break;
  29355. case 'github':
  29356. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  29357. break;
  29358. case 'patreon':
  29359. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  29360. break;
  29361. case 'otechie':
  29362. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  29363. break;
  29364. case 'open_collective':
  29365. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  29366. break;
  29367. case 'liberapay':
  29368. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  29369. break;
  29370. case 'ko_fi':
  29371. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  29372. break;
  29373. case 'issuehunt':
  29374. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  29375. break;
  29376. case 'community_bridge':
  29377. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  29378. break;
  29379. }
  29380. }
  29381. return $this->fundingInfo = $result;
  29382. }
  29383. public function getFileContent(string $file, string $identifier): ?string
  29384. {
  29385. if ($this->gitDriver) {
  29386. return $this->gitDriver->getFileContent($file, $identifier);
  29387. }
  29388. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  29389. $resource = $this->getContents($resource)->decodeJson();
  29390. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  29391. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  29392. }
  29393. return $content;
  29394. }
  29395. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  29396. {
  29397. if ($this->gitDriver) {
  29398. return $this->gitDriver->getChangeDate($identifier);
  29399. }
  29400. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  29401. $commit = $this->getContents($resource)->decodeJson();
  29402. return new \DateTimeImmutable($commit['commit']['committer']['date']);
  29403. }
  29404. public function getTags(): array
  29405. {
  29406. if ($this->gitDriver) {
  29407. return $this->gitDriver->getTags();
  29408. }
  29409. if (null === $this->tags) {
  29410. $tags = array();
  29411. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  29412. do {
  29413. $response = $this->getContents($resource);
  29414. $tagsData = $response->decodeJson();
  29415. foreach ($tagsData as $tag) {
  29416. $tags[$tag['name']] = $tag['commit']['sha'];
  29417. }
  29418. $resource = $this->getNextPage($response);
  29419. } while ($resource);
  29420. $this->tags = $tags;
  29421. }
  29422. return $this->tags;
  29423. }
  29424. public function getBranches(): array
  29425. {
  29426. if ($this->gitDriver) {
  29427. return $this->gitDriver->getBranches();
  29428. }
  29429. if (null === $this->branches) {
  29430. $branches = array();
  29431. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  29432. do {
  29433. $response = $this->getContents($resource);
  29434. $branchData = $response->decodeJson();
  29435. foreach ($branchData as $branch) {
  29436. $name = substr($branch['ref'], 11);
  29437. if ($name !== 'gh-pages') {
  29438. $branches[$name] = $branch['object']['sha'];
  29439. }
  29440. }
  29441. $resource = $this->getNextPage($response);
  29442. } while ($resource);
  29443. $this->branches = $branches;
  29444. }
  29445. return $this->branches;
  29446. }
  29447. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  29448. {
  29449. if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  29450. return false;
  29451. }
  29452. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  29453. if (!in_array(strtolower(Preg::replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  29454. return false;
  29455. }
  29456. if (!extension_loaded('openssl')) {
  29457. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  29458. return false;
  29459. }
  29460. return true;
  29461. }
  29462. public function getRepoData(): ?array
  29463. {
  29464. $this->fetchRootIdentifier();
  29465. return $this->repoData;
  29466. }
  29467. protected function generateSshUrl(): string
  29468. {
  29469. if (false !== strpos($this->originUrl, ':')) {
  29470. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  29471. }
  29472. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  29473. }
  29474. protected function getContents(string $url, bool $fetchingRepoData = false): Response
  29475. {
  29476. try {
  29477. return parent::getContents($url);
  29478. } catch (TransportException $e) {
  29479. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->httpDownloader);
  29480. switch ($e->getCode()) {
  29481. case 401:
  29482. case 404:
  29483. if (!$fetchingRepoData) {
  29484. throw $e;
  29485. }
  29486. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  29487. return parent::getContents($url);
  29488. }
  29489. if (!$this->io->isInteractive()) {
  29490. $this->attemptCloneFallback();
  29491. return new Response(array('url' => 'dummy'), 200, array(), 'null');
  29492. }
  29493. $scopesIssued = array();
  29494. $scopesNeeded = array();
  29495. if ($headers = $e->getHeaders()) {
  29496. if ($scopes = Response::findHeaderValue($headers, 'X-OAuth-Scopes')) {
  29497. $scopesIssued = explode(' ', $scopes);
  29498. }
  29499. if ($scopes = Response::findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  29500. $scopesNeeded = explode(' ', $scopes);
  29501. }
  29502. }
  29503. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  29504. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  29505. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  29506. }
  29507. return parent::getContents($url);
  29508. case 403:
  29509. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  29510. return parent::getContents($url);
  29511. }
  29512. if (!$this->io->isInteractive() && $fetchingRepoData) {
  29513. $this->attemptCloneFallback();
  29514. return new Response(array('url' => 'dummy'), 200, array(), 'null');
  29515. }
  29516. $rateLimited = $gitHubUtil->isRateLimited((array) $e->getHeaders());
  29517. if (!$this->io->hasAuthentication($this->originUrl)) {
  29518. if (!$this->io->isInteractive()) {
  29519. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  29520. throw $e;
  29521. }
  29522. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  29523. return parent::getContents($url);
  29524. }
  29525. if ($rateLimited) {
  29526. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  29527. $this->io->writeError(sprintf(
  29528. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  29529. $rateLimit['limit'],
  29530. $rateLimit['reset']
  29531. ));
  29532. }
  29533. throw $e;
  29534. default:
  29535. throw $e;
  29536. }
  29537. }
  29538. }
  29539. protected function fetchRootIdentifier(): void
  29540. {
  29541. if ($this->repoData) {
  29542. return;
  29543. }
  29544. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  29545. try {
  29546. $this->repoData = $this->getContents($repoDataUrl, true)->decodeJson();
  29547. } catch (TransportException $e) {
  29548. if ($e->getCode() === 499) {
  29549. $this->attemptCloneFallback();
  29550. } else {
  29551. throw $e;
  29552. }
  29553. }
  29554. if (null === $this->repoData && null !== $this->gitDriver) {
  29555. return;
  29556. }
  29557. $this->owner = $this->repoData['owner']['login'];
  29558. $this->repository = $this->repoData['name'];
  29559. $this->isPrivate = !empty($this->repoData['private']);
  29560. if (isset($this->repoData['default_branch'])) {
  29561. $this->rootIdentifier = $this->repoData['default_branch'];
  29562. } elseif (isset($this->repoData['master_branch'])) {
  29563. $this->rootIdentifier = $this->repoData['master_branch'];
  29564. } else {
  29565. $this->rootIdentifier = 'master';
  29566. }
  29567. $this->hasIssues = !empty($this->repoData['has_issues']);
  29568. $this->isArchived = !empty($this->repoData['archived']);
  29569. }
  29570. protected function attemptCloneFallback(): bool
  29571. {
  29572. $this->isPrivate = true;
  29573. try {
  29574. $this->setupGitDriver($this->generateSshUrl());
  29575. return true;
  29576. } catch (\RuntimeException $e) {
  29577. $this->gitDriver = null;
  29578. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  29579. throw $e;
  29580. }
  29581. }
  29582. protected function setupGitDriver(string $url): void
  29583. {
  29584. $this->gitDriver = new GitDriver(
  29585. array('url' => $url),
  29586. $this->io,
  29587. $this->config,
  29588. $this->httpDownloader,
  29589. $this->process
  29590. );
  29591. $this->gitDriver->initialize();
  29592. }
  29593. protected function getNextPage(Response $response): ?string
  29594. {
  29595. $header = $response->getHeader('link');
  29596. if (!$header) {
  29597. return null;
  29598. }
  29599. $links = explode(',', $header);
  29600. foreach ($links as $link) {
  29601. if (Preg::isMatch('{<(.+?)>; *rel="next"}', $link, $match)) {
  29602. return $match[1];
  29603. }
  29604. }
  29605. return null;
  29606. }
  29607. }
  29608. <?php declare(strict_types=1);
  29609. namespace Composer\Repository\Vcs;
  29610. use Composer\Config;
  29611. use Composer\Cache;
  29612. use Composer\IO\IOInterface;
  29613. use Composer\Json\JsonFile;
  29614. use Composer\Downloader\TransportException;
  29615. use Composer\Pcre\Preg;
  29616. use Composer\Util\HttpDownloader;
  29617. use Composer\Util\GitLab;
  29618. use Composer\Util\Http\Response;
  29619. class GitLabDriver extends VcsDriver
  29620. {
  29621. private $scheme;
  29622. private $namespace;
  29623. private $repository;
  29624. private $project;
  29625. private $commits = array();
  29626. private $tags;
  29627. private $branches;
  29628. protected $gitDriver = null;
  29629. protected $protocol;
  29630. private $isPrivate = true;
  29631. private $hasNonstandardOrigin = false;
  29632. public const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  29633. public function initialize(): void
  29634. {
  29635. if (!Preg::isMatch(self::URL_REGEX, $this->url, $match)) {
  29636. throw new \InvalidArgumentException(sprintf('The GitLab repository URL %s is invalid. It must be the HTTP URL of a GitLab project.', $this->url));
  29637. }
  29638. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  29639. $configuredDomains = $this->config->get('gitlab-domains');
  29640. $urlParts = explode('/', $match['parts']);
  29641. $this->scheme = !empty($match['scheme'])
  29642. ? $match['scheme']
  29643. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  29644. ;
  29645. $origin = self::determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  29646. if (false === $origin) {
  29647. throw new \LogicException('It should not be possible to create a gitlab driver with an unparseable origin URL ('.$this->url.')');
  29648. }
  29649. $this->originUrl = $origin;
  29650. if ($protocol = $this->config->get('gitlab-protocol')) {
  29651. if (!in_array($protocol, array('git', 'http', 'https'))) {
  29652. throw new \RuntimeException('gitlab-protocol must be one of git, http.');
  29653. }
  29654. $this->protocol = $protocol === 'git' ? 'ssh' : 'http';
  29655. }
  29656. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  29657. $this->hasNonstandardOrigin = true;
  29658. }
  29659. $this->namespace = implode('/', $urlParts);
  29660. $this->repository = Preg::replace('#(\.git)$#', '', $match['repo']);
  29661. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  29662. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  29663. $this->fetchProject();
  29664. }
  29665. public function setHttpDownloader(HttpDownloader $httpDownloader): void
  29666. {
  29667. $this->httpDownloader = $httpDownloader;
  29668. }
  29669. public function getComposerInformation(string $identifier): ?array
  29670. {
  29671. if ($this->gitDriver) {
  29672. return $this->gitDriver->getComposerInformation($identifier);
  29673. }
  29674. if (!isset($this->infoCache[$identifier])) {
  29675. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  29676. $composer = JsonFile::parseJson($res);
  29677. } else {
  29678. $composer = $this->getBaseComposerInformation($identifier);
  29679. if ($this->shouldCache($identifier)) {
  29680. $this->cache->write($identifier, json_encode($composer));
  29681. }
  29682. }
  29683. if (null !== $composer) {
  29684. if (!isset($composer['support']['source']) && isset($this->project['web_url'])) {
  29685. $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier;
  29686. $composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label);
  29687. }
  29688. if (!isset($composer['support']['issues']) && !empty($this->project['issues_enabled']) && isset($this->project['web_url'])) {
  29689. $composer['support']['issues'] = sprintf('%s/-/issues', $this->project['web_url']);
  29690. }
  29691. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  29692. $composer['abandoned'] = true;
  29693. }
  29694. }
  29695. $this->infoCache[$identifier] = $composer;
  29696. }
  29697. return $this->infoCache[$identifier];
  29698. }
  29699. public function getFileContent(string $file, string $identifier): ?string
  29700. {
  29701. if ($this->gitDriver) {
  29702. return $this->gitDriver->getFileContent($file, $identifier);
  29703. }
  29704. if (!Preg::isMatch('{[a-f0-9]{40}}i', $identifier)) {
  29705. $branches = $this->getBranches();
  29706. if (isset($branches[$identifier])) {
  29707. $identifier = $branches[$identifier];
  29708. }
  29709. }
  29710. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  29711. try {
  29712. $content = $this->getContents($resource)->getBody();
  29713. } catch (TransportException $e) {
  29714. if ($e->getCode() !== 404) {
  29715. throw $e;
  29716. }
  29717. return null;
  29718. }
  29719. return $content;
  29720. }
  29721. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  29722. {
  29723. if ($this->gitDriver) {
  29724. return $this->gitDriver->getChangeDate($identifier);
  29725. }
  29726. if (isset($this->commits[$identifier])) {
  29727. return new \DateTimeImmutable($this->commits[$identifier]['committed_date']);
  29728. }
  29729. return null;
  29730. }
  29731. public function getRepositoryUrl(): string
  29732. {
  29733. if ($this->protocol) {
  29734. return $this->project["{$this->protocol}_url_to_repo"];
  29735. }
  29736. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  29737. }
  29738. public function getUrl(): string
  29739. {
  29740. if ($this->gitDriver) {
  29741. return $this->gitDriver->getUrl();
  29742. }
  29743. return $this->project['web_url'];
  29744. }
  29745. public function getDist(string $identifier): ?array
  29746. {
  29747. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  29748. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  29749. }
  29750. public function getSource(string $identifier): array
  29751. {
  29752. if ($this->gitDriver) {
  29753. return $this->gitDriver->getSource($identifier);
  29754. }
  29755. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  29756. }
  29757. public function getRootIdentifier(): string
  29758. {
  29759. if ($this->gitDriver) {
  29760. return $this->gitDriver->getRootIdentifier();
  29761. }
  29762. return $this->project['default_branch'];
  29763. }
  29764. public function getBranches(): array
  29765. {
  29766. if ($this->gitDriver) {
  29767. return $this->gitDriver->getBranches();
  29768. }
  29769. if (null === $this->branches) {
  29770. $this->branches = $this->getReferences('branches');
  29771. }
  29772. return $this->branches;
  29773. }
  29774. public function getTags(): array
  29775. {
  29776. if ($this->gitDriver) {
  29777. return $this->gitDriver->getTags();
  29778. }
  29779. if (null === $this->tags) {
  29780. $this->tags = $this->getReferences('tags');
  29781. }
  29782. return $this->tags;
  29783. }
  29784. public function getApiUrl(): string
  29785. {
  29786. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  29787. }
  29788. private function urlEncodeAll(string $string): string
  29789. {
  29790. $encoded = '';
  29791. for ($i = 0; isset($string[$i]); $i++) {
  29792. $character = $string[$i];
  29793. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  29794. $character = '%' . sprintf('%02X', ord($character));
  29795. }
  29796. $encoded .= $character;
  29797. }
  29798. return $encoded;
  29799. }
  29800. protected function getReferences(string $type): array
  29801. {
  29802. $perPage = 100;
  29803. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  29804. $references = array();
  29805. do {
  29806. $response = $this->getContents($resource);
  29807. $data = $response->decodeJson();
  29808. foreach ($data as $datum) {
  29809. $references[$datum['name']] = $datum['commit']['id'];
  29810. $this->commits[$datum['commit']['id']] = $datum['commit'];
  29811. }
  29812. if (count($data) >= $perPage) {
  29813. $resource = $this->getNextPage($response);
  29814. } else {
  29815. $resource = false;
  29816. }
  29817. } while ($resource);
  29818. return $references;
  29819. }
  29820. protected function fetchProject(): void
  29821. {
  29822. $resource = $this->getApiUrl();
  29823. $this->project = $this->getContents($resource, true)->decodeJson();
  29824. if (isset($this->project['visibility'])) {
  29825. $this->isPrivate = $this->project['visibility'] !== 'public';
  29826. } else {
  29827. $this->isPrivate = false;
  29828. }
  29829. }
  29830. protected function attemptCloneFallback(): bool
  29831. {
  29832. if ($this->isPrivate === false) {
  29833. $url = $this->generatePublicUrl();
  29834. } else {
  29835. $url = $this->generateSshUrl();
  29836. }
  29837. try {
  29838. $this->setupGitDriver($url);
  29839. return true;
  29840. } catch (\RuntimeException $e) {
  29841. $this->gitDriver = null;
  29842. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  29843. throw $e;
  29844. }
  29845. }
  29846. protected function generateSshUrl(): string
  29847. {
  29848. if ($this->hasNonstandardOrigin) {
  29849. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  29850. }
  29851. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  29852. }
  29853. protected function generatePublicUrl(): string
  29854. {
  29855. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  29856. }
  29857. protected function setupGitDriver(string $url): void
  29858. {
  29859. $this->gitDriver = new GitDriver(
  29860. array('url' => $url),
  29861. $this->io,
  29862. $this->config,
  29863. $this->httpDownloader,
  29864. $this->process
  29865. );
  29866. $this->gitDriver->initialize();
  29867. }
  29868. protected function getContents(string $url, bool $fetchingRepoData = false): Response
  29869. {
  29870. try {
  29871. $response = parent::getContents($url);
  29872. if ($fetchingRepoData) {
  29873. $json = $response->decodeJson();
  29874. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  29875. $this->isPrivate = $json['visibility'] !== 'public';
  29876. $moreThanGuestAccess = false;
  29877. foreach ($json['permissions'] as $permission) {
  29878. if ($permission && $permission['access_level'] > 10) {
  29879. $moreThanGuestAccess = true;
  29880. }
  29881. }
  29882. if (!$moreThanGuestAccess) {
  29883. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  29884. $this->attemptCloneFallback();
  29885. return new Response(array('url' => 'dummy'), 200, array(), 'null');
  29886. }
  29887. }
  29888. if (!isset($json['default_branch'])) {
  29889. if (isset($json['repository_access_level']) && $json['repository_access_level'] === 'disabled') {
  29890. throw new TransportException('The GitLab repository is disabled in the project', 400);
  29891. }
  29892. if (!empty($json['id'])) {
  29893. $this->isPrivate = false;
  29894. }
  29895. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  29896. }
  29897. }
  29898. return $response;
  29899. } catch (TransportException $e) {
  29900. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->httpDownloader);
  29901. switch ($e->getCode()) {
  29902. case 401:
  29903. case 404:
  29904. if (!$fetchingRepoData) {
  29905. throw $e;
  29906. }
  29907. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  29908. return parent::getContents($url);
  29909. }
  29910. if (!$this->io->isInteractive()) {
  29911. $this->attemptCloneFallback();
  29912. return new Response(array('url' => 'dummy'), 200, array(), 'null');
  29913. }
  29914. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  29915. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  29916. return parent::getContents($url);
  29917. case 403:
  29918. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  29919. return parent::getContents($url);
  29920. }
  29921. if (!$this->io->isInteractive() && $fetchingRepoData) {
  29922. $this->attemptCloneFallback();
  29923. return new Response(array('url' => 'dummy'), 200, array(), 'null');
  29924. }
  29925. throw $e;
  29926. default:
  29927. throw $e;
  29928. }
  29929. }
  29930. }
  29931. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  29932. {
  29933. if (!Preg::isMatch(self::URL_REGEX, $url, $match)) {
  29934. return false;
  29935. }
  29936. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  29937. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  29938. $urlParts = explode('/', $match['parts']);
  29939. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  29940. return false;
  29941. }
  29942. if ('https' === $scheme && !extension_loaded('openssl')) {
  29943. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  29944. return false;
  29945. }
  29946. return true;
  29947. }
  29948. protected function getNextPage(Response $response): ?string
  29949. {
  29950. $header = $response->getHeader('link');
  29951. $links = explode(',', $header);
  29952. foreach ($links as $link) {
  29953. if (Preg::isMatch('{<(.+?)>; *rel="next"}', $link, $match)) {
  29954. return $match[1];
  29955. }
  29956. }
  29957. return null;
  29958. }
  29959. private static function determineOrigin(array $configuredDomains, string $guessedDomain, array &$urlParts, ?string $portNumber)
  29960. {
  29961. $guessedDomain = strtolower($guessedDomain);
  29962. if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  29963. if (null !== $portNumber) {
  29964. return $guessedDomain.':'.$portNumber;
  29965. }
  29966. return $guessedDomain;
  29967. }
  29968. if (null !== $portNumber) {
  29969. $guessedDomain .= ':'.$portNumber;
  29970. }
  29971. while (null !== ($part = array_shift($urlParts))) {
  29972. $guessedDomain .= '/' . $part;
  29973. if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  29974. return $guessedDomain;
  29975. }
  29976. }
  29977. return false;
  29978. }
  29979. }
  29980. <?php declare(strict_types=1);
  29981. namespace Composer\Repository\Vcs;
  29982. use Composer\Config;
  29983. use Composer\Cache;
  29984. use Composer\Pcre\Preg;
  29985. use Composer\Util\Hg as HgUtils;
  29986. use Composer\Util\ProcessExecutor;
  29987. use Composer\Util\Filesystem;
  29988. use Composer\IO\IOInterface;
  29989. class HgDriver extends VcsDriver
  29990. {
  29991. protected $tags;
  29992. protected $branches;
  29993. protected $rootIdentifier;
  29994. protected $repoDir;
  29995. public function initialize(): void
  29996. {
  29997. if (Filesystem::isLocalPath($this->url)) {
  29998. $this->repoDir = $this->url;
  29999. } else {
  30000. if (!Cache::isUsable((string) $this->config->get('cache-vcs-dir'))) {
  30001. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  30002. }
  30003. $cacheDir = $this->config->get('cache-vcs-dir');
  30004. $this->repoDir = $cacheDir . '/' . Preg::replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  30005. $fs = new Filesystem();
  30006. $fs->ensureDirectoryExists($cacheDir);
  30007. if (!is_writable(dirname($this->repoDir))) {
  30008. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  30009. }
  30010. $this->config->prohibitUrlByConfig($this->url, $this->io);
  30011. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  30012. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  30013. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  30014. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  30015. }
  30016. } else {
  30017. $fs->removeDirectory($this->repoDir);
  30018. $repoDir = $this->repoDir;
  30019. $command = function ($url) use ($repoDir): string {
  30020. return sprintf('hg clone --noupdate -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  30021. };
  30022. $hgUtils->runCommand($command, $this->url, null);
  30023. }
  30024. }
  30025. $this->getTags();
  30026. $this->getBranches();
  30027. }
  30028. public function getRootIdentifier(): string
  30029. {
  30030. if (null === $this->rootIdentifier) {
  30031. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  30032. $output = $this->process->splitLines($output);
  30033. $this->rootIdentifier = $output[0];
  30034. }
  30035. return $this->rootIdentifier;
  30036. }
  30037. public function getUrl(): string
  30038. {
  30039. return $this->url;
  30040. }
  30041. public function getSource(string $identifier): array
  30042. {
  30043. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  30044. }
  30045. public function getDist(string $identifier): ?array
  30046. {
  30047. return null;
  30048. }
  30049. public function getFileContent(string $file, string $identifier): ?string
  30050. {
  30051. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  30052. $this->process->execute($resource, $content, $this->repoDir);
  30053. if (!trim($content)) {
  30054. return null;
  30055. }
  30056. return $content;
  30057. }
  30058. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  30059. {
  30060. $this->process->execute(
  30061. sprintf(
  30062. 'hg log --template "{date|rfc3339date}" -r %s',
  30063. ProcessExecutor::escape($identifier)
  30064. ),
  30065. $output,
  30066. $this->repoDir
  30067. );
  30068. return new \DateTimeImmutable(trim($output), new \DateTimeZone('UTC'));
  30069. }
  30070. public function getTags(): array
  30071. {
  30072. if (null === $this->tags) {
  30073. $tags = array();
  30074. $this->process->execute('hg tags', $output, $this->repoDir);
  30075. foreach ($this->process->splitLines($output) as $tag) {
  30076. if ($tag && Preg::isMatch('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  30077. $tags[$match[1]] = $match[2];
  30078. }
  30079. }
  30080. unset($tags['tip']);
  30081. $this->tags = $tags;
  30082. }
  30083. return $this->tags;
  30084. }
  30085. public function getBranches(): array
  30086. {
  30087. if (null === $this->branches) {
  30088. $branches = array();
  30089. $bookmarks = array();
  30090. $this->process->execute('hg branches', $output, $this->repoDir);
  30091. foreach ($this->process->splitLines($output) as $branch) {
  30092. if ($branch && Preg::isMatch('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  30093. $branches[$match[1]] = $match[2];
  30094. }
  30095. }
  30096. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  30097. foreach ($this->process->splitLines($output) as $branch) {
  30098. if ($branch && Preg::isMatch('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  30099. $bookmarks[$match[1]] = $match[2];
  30100. }
  30101. }
  30102. $this->branches = array_merge($bookmarks, $branches);
  30103. }
  30104. return $this->branches;
  30105. }
  30106. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  30107. {
  30108. if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  30109. return true;
  30110. }
  30111. if (Filesystem::isLocalPath($url)) {
  30112. $url = Filesystem::getPlatformPath($url);
  30113. if (!is_dir($url)) {
  30114. return false;
  30115. }
  30116. $process = new ProcessExecutor($io);
  30117. if ($process->execute('hg summary', $output, $url) === 0) {
  30118. return true;
  30119. }
  30120. }
  30121. if (!$deep) {
  30122. return false;
  30123. }
  30124. $process = new ProcessExecutor($io);
  30125. $exit = $process->execute(sprintf('hg identify -- %s', ProcessExecutor::escape($url)), $ignored);
  30126. return $exit === 0;
  30127. }
  30128. }
  30129. <?php declare(strict_types=1);
  30130. namespace Composer\Repository\Vcs;
  30131. use Composer\Config;
  30132. use Composer\Cache;
  30133. use Composer\IO\IOInterface;
  30134. use Composer\Pcre\Preg;
  30135. use Composer\Util\ProcessExecutor;
  30136. use Composer\Util\Perforce;
  30137. use Composer\Util\Http\Response;
  30138. class PerforceDriver extends VcsDriver
  30139. {
  30140. protected $depot;
  30141. protected $branch;
  30142. protected $perforce = null;
  30143. public function initialize(): void
  30144. {
  30145. $this->depot = $this->repoConfig['depot'];
  30146. $this->branch = '';
  30147. if (!empty($this->repoConfig['branch'])) {
  30148. $this->branch = $this->repoConfig['branch'];
  30149. }
  30150. $this->initPerforce($this->repoConfig);
  30151. $this->perforce->p4Login();
  30152. $this->perforce->checkStream();
  30153. $this->perforce->writeP4ClientSpec();
  30154. $this->perforce->connectClient();
  30155. }
  30156. private function initPerforce(array $repoConfig): void
  30157. {
  30158. if (!empty($this->perforce)) {
  30159. return;
  30160. }
  30161. if (!Cache::isUsable((string) $this->config->get('cache-vcs-dir'))) {
  30162. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  30163. }
  30164. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  30165. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  30166. }
  30167. public function getFileContent(string $file, string $identifier): ?string
  30168. {
  30169. return $this->perforce->getFileContent($file, $identifier);
  30170. }
  30171. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  30172. {
  30173. return null;
  30174. }
  30175. public function getRootIdentifier(): string
  30176. {
  30177. return $this->branch;
  30178. }
  30179. public function getBranches(): array
  30180. {
  30181. return $this->perforce->getBranches();
  30182. }
  30183. public function getTags(): array
  30184. {
  30185. return $this->perforce->getTags();
  30186. }
  30187. public function getDist(string $identifier): ?array
  30188. {
  30189. return null;
  30190. }
  30191. public function getSource(string $identifier): array
  30192. {
  30193. return array(
  30194. 'type' => 'perforce',
  30195. 'url' => $this->repoConfig['url'],
  30196. 'reference' => $identifier,
  30197. 'p4user' => $this->perforce->getUser(),
  30198. );
  30199. }
  30200. public function getUrl(): string
  30201. {
  30202. return $this->url;
  30203. }
  30204. public function hasComposerFile(string $identifier): bool
  30205. {
  30206. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  30207. return !empty($composerInfo);
  30208. }
  30209. public function getContents(string $url): Response
  30210. {
  30211. throw new \BadMethodCallException('Not implemented/used in PerforceDriver');
  30212. }
  30213. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  30214. {
  30215. if ($deep || Preg::isMatch('#\b(perforce|p4)\b#i', $url)) {
  30216. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  30217. }
  30218. return false;
  30219. }
  30220. public function cleanup(): void
  30221. {
  30222. $this->perforce->cleanupClientSpec();
  30223. $this->perforce = null;
  30224. }
  30225. public function getDepot(): string
  30226. {
  30227. return $this->depot;
  30228. }
  30229. public function getBranch(): string
  30230. {
  30231. return $this->branch;
  30232. }
  30233. }
  30234. <?php declare(strict_types=1);
  30235. namespace Composer\Repository\Vcs;
  30236. use Composer\Cache;
  30237. use Composer\Config;
  30238. use Composer\Json\JsonFile;
  30239. use Composer\Pcre\Preg;
  30240. use Composer\Util\ProcessExecutor;
  30241. use Composer\Util\Filesystem;
  30242. use Composer\Util\Url;
  30243. use Composer\Util\Svn as SvnUtil;
  30244. use Composer\IO\IOInterface;
  30245. use Composer\Downloader\TransportException;
  30246. class SvnDriver extends VcsDriver
  30247. {
  30248. protected $baseUrl;
  30249. protected $tags;
  30250. protected $branches;
  30251. protected $rootIdentifier;
  30252. protected $trunkPath = 'trunk';
  30253. protected $branchesPath = 'branches';
  30254. protected $tagsPath = 'tags';
  30255. protected $packagePath = '';
  30256. protected $cacheCredentials = true;
  30257. private $util;
  30258. public function initialize(): void
  30259. {
  30260. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  30261. SvnUtil::cleanEnv();
  30262. if (isset($this->repoConfig['trunk-path'])) {
  30263. $this->trunkPath = $this->repoConfig['trunk-path'];
  30264. }
  30265. if (isset($this->repoConfig['branches-path'])) {
  30266. $this->branchesPath = $this->repoConfig['branches-path'];
  30267. }
  30268. if (isset($this->repoConfig['tags-path'])) {
  30269. $this->tagsPath = $this->repoConfig['tags-path'];
  30270. }
  30271. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  30272. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  30273. }
  30274. if (isset($this->repoConfig['package-path'])) {
  30275. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  30276. }
  30277. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  30278. $this->baseUrl = substr($this->url, 0, $pos);
  30279. }
  30280. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->baseUrl)));
  30281. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  30282. $this->getBranches();
  30283. $this->getTags();
  30284. }
  30285. public function getRootIdentifier(): string
  30286. {
  30287. return $this->rootIdentifier ?: $this->trunkPath;
  30288. }
  30289. public function getUrl(): string
  30290. {
  30291. return $this->url;
  30292. }
  30293. public function getSource(string $identifier): array
  30294. {
  30295. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  30296. }
  30297. public function getDist(string $identifier): ?array
  30298. {
  30299. return null;
  30300. }
  30301. protected function shouldCache(string $identifier): bool
  30302. {
  30303. return $this->cache && Preg::isMatch('{@\d+$}', $identifier);
  30304. }
  30305. public function getComposerInformation(string $identifier): ?array
  30306. {
  30307. if (!isset($this->infoCache[$identifier])) {
  30308. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  30309. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  30310. }
  30311. try {
  30312. $composer = $this->getBaseComposerInformation($identifier);
  30313. } catch (TransportException $e) {
  30314. $message = $e->getMessage();
  30315. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  30316. throw $e;
  30317. }
  30318. $composer = null;
  30319. }
  30320. if ($this->shouldCache($identifier)) {
  30321. $this->cache->write($identifier.'.json', json_encode($composer));
  30322. }
  30323. $this->infoCache[$identifier] = $composer;
  30324. }
  30325. if (!is_array($this->infoCache[$identifier])) {
  30326. return null;
  30327. }
  30328. return $this->infoCache[$identifier];
  30329. }
  30330. public function getFileContent(string $file, string $identifier): ?string
  30331. {
  30332. $identifier = '/' . trim($identifier, '/') . '/';
  30333. Preg::match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  30334. if (!empty($match[2])) {
  30335. $path = $match[1];
  30336. $rev = $match[2];
  30337. } else {
  30338. $path = $identifier;
  30339. $rev = '';
  30340. }
  30341. try {
  30342. $resource = $path.$file;
  30343. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  30344. if (!trim($output)) {
  30345. return null;
  30346. }
  30347. } catch (\RuntimeException $e) {
  30348. throw new TransportException($e->getMessage());
  30349. }
  30350. return $output;
  30351. }
  30352. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  30353. {
  30354. $identifier = '/' . trim($identifier, '/') . '/';
  30355. Preg::match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  30356. if (!empty($match[2])) {
  30357. $path = $match[1];
  30358. $rev = $match[2];
  30359. } else {
  30360. $path = $identifier;
  30361. $rev = '';
  30362. }
  30363. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  30364. foreach ($this->process->splitLines($output) as $line) {
  30365. if ($line && Preg::isMatch('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  30366. return new \DateTimeImmutable($match[1], new \DateTimeZone('UTC'));
  30367. }
  30368. }
  30369. return null;
  30370. }
  30371. public function getTags(): array
  30372. {
  30373. if (null === $this->tags) {
  30374. $tags = array();
  30375. if ($this->tagsPath !== false) {
  30376. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  30377. if ($output) {
  30378. foreach ($this->process->splitLines($output) as $line) {
  30379. $line = trim($line);
  30380. if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  30381. if (isset($match[1], $match[2]) && $match[2] !== './') {
  30382. $tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  30383. '/' . $this->tagsPath . '/' . $match[2],
  30384. $match[1]
  30385. );
  30386. }
  30387. }
  30388. }
  30389. }
  30390. }
  30391. $this->tags = $tags;
  30392. }
  30393. return $this->tags;
  30394. }
  30395. public function getBranches(): array
  30396. {
  30397. if (null === $this->branches) {
  30398. $branches = array();
  30399. if (false === $this->trunkPath) {
  30400. $trunkParent = $this->baseUrl . '/';
  30401. } else {
  30402. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  30403. }
  30404. $output = $this->execute('svn ls --verbose', $trunkParent);
  30405. if ($output) {
  30406. foreach ($this->process->splitLines($output) as $line) {
  30407. $line = trim($line);
  30408. if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  30409. if (isset($match[1], $match[2]) && $match[2] === './') {
  30410. $branches['trunk'] = $this->buildIdentifier(
  30411. '/' . $this->trunkPath,
  30412. $match[1]
  30413. );
  30414. $this->rootIdentifier = $branches['trunk'];
  30415. break;
  30416. }
  30417. }
  30418. }
  30419. }
  30420. unset($output);
  30421. if ($this->branchesPath !== false) {
  30422. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  30423. if ($output) {
  30424. foreach ($this->process->splitLines(trim($output)) as $line) {
  30425. $line = trim($line);
  30426. if ($line && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  30427. if (isset($match[1], $match[2]) && $match[2] !== './') {
  30428. $branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  30429. '/' . $this->branchesPath . '/' . $match[2],
  30430. $match[1]
  30431. );
  30432. }
  30433. }
  30434. }
  30435. }
  30436. }
  30437. $this->branches = $branches;
  30438. }
  30439. return $this->branches;
  30440. }
  30441. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  30442. {
  30443. $url = self::normalizeUrl($url);
  30444. if (Preg::isMatch('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  30445. return true;
  30446. }
  30447. if (!$deep && !Filesystem::isLocalPath($url)) {
  30448. return false;
  30449. }
  30450. $process = new ProcessExecutor($io);
  30451. $exit = $process->execute(
  30452. "svn info --non-interactive -- ".ProcessExecutor::escape($url),
  30453. $ignoredOutput
  30454. );
  30455. if ($exit === 0) {
  30456. return true;
  30457. }
  30458. if (false !== stripos($process->getErrorOutput(), 'authorization failed:')) {
  30459. return true;
  30460. }
  30461. if (false !== stripos($process->getErrorOutput(), 'Authentication failed')) {
  30462. return true;
  30463. }
  30464. return false;
  30465. }
  30466. protected static function normalizeUrl(string $url): string
  30467. {
  30468. $fs = new Filesystem();
  30469. if ($fs->isAbsolutePath($url)) {
  30470. return 'file://' . strtr($url, '\\', '/');
  30471. }
  30472. return $url;
  30473. }
  30474. protected function execute(string $command, string $url): string
  30475. {
  30476. if (null === $this->util) {
  30477. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  30478. $this->util->setCacheCredentials($this->cacheCredentials);
  30479. }
  30480. try {
  30481. return $this->util->execute($command, $url);
  30482. } catch (\RuntimeException $e) {
  30483. if (null === $this->util->binaryVersion()) {
  30484. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  30485. }
  30486. throw new \RuntimeException(
  30487. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  30488. );
  30489. }
  30490. }
  30491. protected function buildIdentifier(string $baseDir, string $revision): string
  30492. {
  30493. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  30494. }
  30495. }
  30496. <?php declare(strict_types=1);
  30497. namespace Composer\Repository\Vcs;
  30498. use Composer\Cache;
  30499. use Composer\Downloader\TransportException;
  30500. use Composer\Config;
  30501. use Composer\IO\IOInterface;
  30502. use Composer\Json\JsonFile;
  30503. use Composer\Pcre\Preg;
  30504. use Composer\Util\ProcessExecutor;
  30505. use Composer\Util\HttpDownloader;
  30506. use Composer\Util\Filesystem;
  30507. use Composer\Util\Http\Response;
  30508. abstract class VcsDriver implements VcsDriverInterface
  30509. {
  30510. protected $url;
  30511. protected $originUrl;
  30512. protected $repoConfig;
  30513. protected $io;
  30514. protected $config;
  30515. protected $process;
  30516. protected $httpDownloader;
  30517. protected $infoCache = array();
  30518. protected $cache;
  30519. final public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process)
  30520. {
  30521. if (Filesystem::isLocalPath($repoConfig['url'])) {
  30522. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  30523. }
  30524. $this->url = $repoConfig['url'];
  30525. $this->originUrl = $repoConfig['url'];
  30526. $this->repoConfig = $repoConfig;
  30527. $this->io = $io;
  30528. $this->config = $config;
  30529. $this->httpDownloader = $httpDownloader;
  30530. $this->process = $process;
  30531. }
  30532. protected function shouldCache(string $identifier): bool
  30533. {
  30534. return $this->cache && Preg::isMatch('{^[a-f0-9]{40}$}iD', $identifier);
  30535. }
  30536. public function getComposerInformation(string $identifier): ?array
  30537. {
  30538. if (!isset($this->infoCache[$identifier])) {
  30539. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  30540. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  30541. }
  30542. $composer = $this->getBaseComposerInformation($identifier);
  30543. if ($this->shouldCache($identifier)) {
  30544. $this->cache->write($identifier, JsonFile::encode($composer, 0));
  30545. }
  30546. $this->infoCache[$identifier] = $composer;
  30547. }
  30548. return $this->infoCache[$identifier];
  30549. }
  30550. protected function getBaseComposerInformation(string $identifier): ?array
  30551. {
  30552. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  30553. if (!$composerFileContent) {
  30554. return null;
  30555. }
  30556. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  30557. if ([] === $composer || !is_array($composer)) {
  30558. return null;
  30559. }
  30560. if (empty($composer['time']) && null !== ($changeDate = $this->getChangeDate($identifier))) {
  30561. $composer['time'] = $changeDate->format(DATE_RFC3339);
  30562. }
  30563. return $composer;
  30564. }
  30565. public function hasComposerFile(string $identifier): bool
  30566. {
  30567. try {
  30568. return null !== $this->getComposerInformation($identifier);
  30569. } catch (TransportException $e) {
  30570. }
  30571. return false;
  30572. }
  30573. protected function getScheme(): string
  30574. {
  30575. if (extension_loaded('openssl')) {
  30576. return 'https';
  30577. }
  30578. return 'http';
  30579. }
  30580. protected function getContents(string $url): Response
  30581. {
  30582. $options = $this->repoConfig['options'] ?? array();
  30583. return $this->httpDownloader->get($url, $options);
  30584. }
  30585. public function cleanup(): void
  30586. {
  30587. return;
  30588. }
  30589. }
  30590. <?php declare(strict_types=1);
  30591. namespace Composer\Repository\Vcs;
  30592. use Composer\Config;
  30593. use Composer\IO\IOInterface;
  30594. interface VcsDriverInterface
  30595. {
  30596. public function initialize(): void;
  30597. public function getComposerInformation(string $identifier): ?array;
  30598. public function getFileContent(string $file, string $identifier): ?string;
  30599. public function getChangeDate(string $identifier): ?\DateTimeImmutable;
  30600. public function getRootIdentifier(): string;
  30601. public function getBranches(): array;
  30602. public function getTags(): array;
  30603. public function getDist(string $identifier): ?array;
  30604. public function getSource(string $identifier): array;
  30605. public function getUrl(): string;
  30606. public function hasComposerFile(string $identifier): bool;
  30607. public function cleanup(): void;
  30608. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool;
  30609. }
  30610. <?php declare(strict_types=1);
  30611. namespace Composer\Repository;
  30612. use Composer\Downloader\TransportException;
  30613. use Composer\Pcre\Preg;
  30614. use Composer\Repository\Vcs\VcsDriverInterface;
  30615. use Composer\Package\Version\VersionParser;
  30616. use Composer\Package\Loader\ArrayLoader;
  30617. use Composer\Package\Loader\ValidatingArrayLoader;
  30618. use Composer\Package\Loader\InvalidPackageException;
  30619. use Composer\Package\Loader\LoaderInterface;
  30620. use Composer\EventDispatcher\EventDispatcher;
  30621. use Composer\Util\ProcessExecutor;
  30622. use Composer\Util\HttpDownloader;
  30623. use Composer\Util\Url;
  30624. use Composer\Semver\Constraint\Constraint;
  30625. use Composer\IO\IOInterface;
  30626. use Composer\Config;
  30627. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  30628. {
  30629. protected $url;
  30630. protected $packageName;
  30631. protected $isVerbose;
  30632. protected $isVeryVerbose;
  30633. protected $io;
  30634. protected $config;
  30635. protected $versionParser;
  30636. protected $type;
  30637. protected $loader;
  30638. protected $repoConfig;
  30639. protected $httpDownloader;
  30640. protected $processExecutor;
  30641. protected $branchErrorOccurred = false;
  30642. private $drivers;
  30643. private $driver;
  30644. private $versionCache;
  30645. private $emptyReferences = array();
  30646. private $versionTransportExceptions = array();
  30647. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, EventDispatcher $dispatcher = null, ProcessExecutor $process = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  30648. {
  30649. parent::__construct();
  30650. $this->drivers = $drivers ?: array(
  30651. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  30652. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  30653. 'bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  30654. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  30655. 'git' => 'Composer\Repository\Vcs\GitDriver',
  30656. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  30657. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  30658. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  30659. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  30660. );
  30661. $this->url = $repoConfig['url'];
  30662. $this->io = $io;
  30663. $this->type = $repoConfig['type'] ?? 'vcs';
  30664. $this->isVerbose = $io->isVerbose();
  30665. $this->isVeryVerbose = $io->isVeryVerbose();
  30666. $this->config = $config;
  30667. $this->repoConfig = $repoConfig;
  30668. $this->versionCache = $versionCache;
  30669. $this->httpDownloader = $httpDownloader;
  30670. $this->processExecutor = $process ?? new ProcessExecutor($io);
  30671. }
  30672. public function getRepoName()
  30673. {
  30674. $driverClass = get_class($this->getDriver());
  30675. $driverType = array_search($driverClass, $this->drivers);
  30676. if (!$driverType) {
  30677. $driverType = $driverClass;
  30678. }
  30679. return 'vcs repo ('.$driverType.' '.Url::sanitize($this->url).')';
  30680. }
  30681. public function getRepoConfig()
  30682. {
  30683. return $this->repoConfig;
  30684. }
  30685. public function setLoader(LoaderInterface $loader): void
  30686. {
  30687. $this->loader = $loader;
  30688. }
  30689. public function getDriver(): ?VcsDriverInterface
  30690. {
  30691. if ($this->driver) {
  30692. return $this->driver;
  30693. }
  30694. if (isset($this->drivers[$this->type])) {
  30695. $class = $this->drivers[$this->type];
  30696. $this->driver = new $class($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  30697. $this->driver->initialize();
  30698. return $this->driver;
  30699. }
  30700. foreach ($this->drivers as $driver) {
  30701. if ($driver::supports($this->io, $this->config, $this->url)) {
  30702. $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  30703. $this->driver->initialize();
  30704. return $this->driver;
  30705. }
  30706. }
  30707. foreach ($this->drivers as $driver) {
  30708. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  30709. $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  30710. $this->driver->initialize();
  30711. return $this->driver;
  30712. }
  30713. }
  30714. return null;
  30715. }
  30716. public function hadInvalidBranches(): bool
  30717. {
  30718. return $this->branchErrorOccurred;
  30719. }
  30720. public function getEmptyReferences(): array
  30721. {
  30722. return $this->emptyReferences;
  30723. }
  30724. public function getVersionTransportExceptions(): array
  30725. {
  30726. return $this->versionTransportExceptions;
  30727. }
  30728. protected function initialize()
  30729. {
  30730. parent::initialize();
  30731. $isVerbose = $this->isVerbose;
  30732. $isVeryVerbose = $this->isVeryVerbose;
  30733. $driver = $this->getDriver();
  30734. if (!$driver) {
  30735. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  30736. }
  30737. $this->versionParser = new VersionParser;
  30738. if (!$this->loader) {
  30739. $this->loader = new ArrayLoader($this->versionParser);
  30740. }
  30741. $hasRootIdentifierComposerJson = false;
  30742. try {
  30743. $hasRootIdentifierComposerJson = $driver->hasComposerFile($driver->getRootIdentifier());
  30744. if ($hasRootIdentifierComposerJson) {
  30745. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  30746. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  30747. }
  30748. } catch (\Exception $e) {
  30749. if ($e instanceof TransportException && $this->shouldRethrowTransportException($e)) {
  30750. throw $e;
  30751. }
  30752. if ($isVeryVerbose) {
  30753. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  30754. }
  30755. }
  30756. foreach ($driver->getTags() as $tag => $identifier) {
  30757. $tag = (string) $tag;
  30758. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  30759. if ($isVeryVerbose) {
  30760. $this->io->writeError($msg);
  30761. } elseif ($isVerbose) {
  30762. $this->io->overwriteError($msg, false);
  30763. }
  30764. $tag = str_replace('release-', '', $tag);
  30765. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  30766. if ($cachedPackage) {
  30767. $this->addPackage($cachedPackage);
  30768. continue;
  30769. }
  30770. if ($cachedPackage === false) {
  30771. $this->emptyReferences[] = $identifier;
  30772. continue;
  30773. }
  30774. if (!$parsedTag = $this->validateTag($tag)) {
  30775. if ($isVeryVerbose) {
  30776. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  30777. }
  30778. continue;
  30779. }
  30780. try {
  30781. $data = $driver->getComposerInformation($identifier);
  30782. if (null === $data) {
  30783. if ($isVeryVerbose) {
  30784. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  30785. }
  30786. $this->emptyReferences[] = $identifier;
  30787. continue;
  30788. }
  30789. if (isset($data['version'])) {
  30790. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  30791. } else {
  30792. $data['version'] = $tag;
  30793. $data['version_normalized'] = $parsedTag;
  30794. }
  30795. $data['version'] = Preg::replace('{[.-]?dev$}i', '', $data['version']);
  30796. $data['version_normalized'] = Preg::replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  30797. unset($data['default-branch']);
  30798. if ($data['version_normalized'] !== $parsedTag) {
  30799. if ($isVeryVerbose) {
  30800. if (Preg::isMatch('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  30801. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  30802. } else {
  30803. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  30804. }
  30805. }
  30806. continue;
  30807. }
  30808. $tagPackageName = $this->packageName ?: ($data['name'] ?? '');
  30809. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  30810. if ($isVeryVerbose) {
  30811. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  30812. }
  30813. continue;
  30814. }
  30815. if ($isVeryVerbose) {
  30816. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  30817. }
  30818. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  30819. } catch (\Exception $e) {
  30820. if ($e instanceof TransportException) {
  30821. $this->versionTransportExceptions['tags'][$tag] = $e;
  30822. if ($e->getCode() === 404) {
  30823. $this->emptyReferences[] = $identifier;
  30824. }
  30825. if ($this->shouldRethrowTransportException($e)) {
  30826. throw $e;
  30827. }
  30828. }
  30829. if ($isVeryVerbose) {
  30830. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  30831. }
  30832. continue;
  30833. }
  30834. }
  30835. if (!$isVeryVerbose) {
  30836. $this->io->overwriteError('', false);
  30837. }
  30838. $branches = $driver->getBranches();
  30839. if ($hasRootIdentifierComposerJson && isset($branches[$driver->getRootIdentifier()])) {
  30840. $branches = array($driver->getRootIdentifier() => $branches[$driver->getRootIdentifier()]) + $branches;
  30841. }
  30842. foreach ($branches as $branch => $identifier) {
  30843. $branch = (string) $branch;
  30844. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  30845. if ($isVeryVerbose) {
  30846. $this->io->writeError($msg);
  30847. } elseif ($isVerbose) {
  30848. $this->io->overwriteError($msg, false);
  30849. }
  30850. if (!$parsedBranch = $this->validateBranch($branch)) {
  30851. if ($isVeryVerbose) {
  30852. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  30853. }
  30854. continue;
  30855. }
  30856. if (strpos($parsedBranch, 'dev-') === 0 || VersionParser::DEFAULT_BRANCH_ALIAS === $parsedBranch) {
  30857. $version = 'dev-' . $branch;
  30858. } else {
  30859. $prefix = strpos($branch, 'v') === 0 ? 'v' : '';
  30860. $version = $prefix . Preg::replace('{(\.9{7})+}', '.x', $parsedBranch);
  30861. }
  30862. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose, $driver->getRootIdentifier() === $branch);
  30863. if ($cachedPackage) {
  30864. $this->addPackage($cachedPackage);
  30865. continue;
  30866. }
  30867. if ($cachedPackage === false) {
  30868. $this->emptyReferences[] = $identifier;
  30869. continue;
  30870. }
  30871. try {
  30872. $data = $driver->getComposerInformation($identifier);
  30873. if (null === $data) {
  30874. if ($isVeryVerbose) {
  30875. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  30876. }
  30877. $this->emptyReferences[] = $identifier;
  30878. continue;
  30879. }
  30880. $data['version'] = $version;
  30881. $data['version_normalized'] = $parsedBranch;
  30882. unset($data['default-branch']);
  30883. if ($driver->getRootIdentifier() === $branch) {
  30884. $data['default-branch'] = true;
  30885. }
  30886. if ($isVeryVerbose) {
  30887. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  30888. }
  30889. $packageData = $this->preProcess($driver, $data, $identifier);
  30890. $package = $this->loader->load($packageData);
  30891. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  30892. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  30893. }
  30894. $this->addPackage($package);
  30895. } catch (TransportException $e) {
  30896. $this->versionTransportExceptions['branches'][$branch] = $e;
  30897. if ($e->getCode() === 404) {
  30898. $this->emptyReferences[] = $identifier;
  30899. }
  30900. if ($this->shouldRethrowTransportException($e)) {
  30901. throw $e;
  30902. }
  30903. if ($isVeryVerbose) {
  30904. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  30905. }
  30906. continue;
  30907. } catch (\Exception $e) {
  30908. if (!$isVeryVerbose) {
  30909. $this->io->writeError('');
  30910. }
  30911. $this->branchErrorOccurred = true;
  30912. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  30913. $this->io->writeError('');
  30914. continue;
  30915. }
  30916. }
  30917. $driver->cleanup();
  30918. if (!$isVeryVerbose) {
  30919. $this->io->overwriteError('', false);
  30920. }
  30921. if (!$this->getPackages()) {
  30922. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  30923. }
  30924. }
  30925. protected function preProcess(VcsDriverInterface $driver, array $data, string $identifier): array
  30926. {
  30927. $dataPackageName = $data['name'] ?? null;
  30928. $data['name'] = $this->packageName ?: $dataPackageName;
  30929. if (!isset($data['dist'])) {
  30930. $data['dist'] = $driver->getDist($identifier);
  30931. }
  30932. if (!isset($data['source'])) {
  30933. $data['source'] = $driver->getSource($identifier);
  30934. }
  30935. return $data;
  30936. }
  30937. private function validateBranch(string $branch)
  30938. {
  30939. try {
  30940. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  30941. $this->versionParser->parseConstraints($normalizedBranch);
  30942. return $normalizedBranch;
  30943. } catch (\Exception $e) {
  30944. }
  30945. return false;
  30946. }
  30947. private function validateTag(string $version)
  30948. {
  30949. try {
  30950. return $this->versionParser->normalize($version);
  30951. } catch (\Exception $e) {
  30952. }
  30953. return false;
  30954. }
  30955. private function getCachedPackageVersion(string $version, string $identifier, bool $isVerbose, bool $isVeryVerbose, bool $isDefaultBranch = false)
  30956. {
  30957. if (!$this->versionCache) {
  30958. return null;
  30959. }
  30960. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  30961. if ($cachedPackage === false) {
  30962. if ($isVeryVerbose) {
  30963. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  30964. }
  30965. return false;
  30966. }
  30967. if ($cachedPackage) {
  30968. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  30969. if ($isVeryVerbose) {
  30970. $this->io->writeError($msg);
  30971. } elseif ($isVerbose) {
  30972. $this->io->overwriteError($msg, false);
  30973. }
  30974. unset($cachedPackage['default-branch']);
  30975. if ($isDefaultBranch) {
  30976. $cachedPackage['default-branch'] = true;
  30977. }
  30978. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  30979. if ($isVeryVerbose) {
  30980. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  30981. }
  30982. $cachedPackage = null;
  30983. }
  30984. }
  30985. if ($cachedPackage) {
  30986. return $this->loader->load($cachedPackage);
  30987. }
  30988. return null;
  30989. }
  30990. private function shouldRethrowTransportException(TransportException $e): bool
  30991. {
  30992. return in_array($e->getCode(), array(401, 403, 429), true) || $e->getCode() >= 500;
  30993. }
  30994. }
  30995. <?php declare(strict_types=1);
  30996. namespace Composer\Repository;
  30997. interface VersionCacheInterface
  30998. {
  30999. public function getVersionPackage(string $version, string $identifier);
  31000. }
  31001. <?php declare(strict_types=1);
  31002. namespace Composer\Repository;
  31003. use Composer\Package\AliasPackage;
  31004. use Composer\Installer\InstallationManager;
  31005. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  31006. {
  31007. protected $devPackageNames = array();
  31008. private $devMode = null;
  31009. public function getDevMode()
  31010. {
  31011. return $this->devMode;
  31012. }
  31013. public function setDevPackageNames(array $devPackageNames)
  31014. {
  31015. $this->devPackageNames = $devPackageNames;
  31016. }
  31017. public function getDevPackageNames()
  31018. {
  31019. return $this->devPackageNames;
  31020. }
  31021. public function write(bool $devMode, InstallationManager $installationManager)
  31022. {
  31023. $this->devMode = $devMode;
  31024. }
  31025. public function reload()
  31026. {
  31027. $this->devMode = null;
  31028. }
  31029. public function getCanonicalPackages()
  31030. {
  31031. $packages = $this->getPackages();
  31032. $packagesByName = array();
  31033. foreach ($packages as $package) {
  31034. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  31035. $packagesByName[$package->getName()] = $package;
  31036. }
  31037. }
  31038. $canonicalPackages = array();
  31039. foreach ($packagesByName as $package) {
  31040. while ($package instanceof AliasPackage) {
  31041. $package = $package->getAliasOf();
  31042. }
  31043. $canonicalPackages[] = $package;
  31044. }
  31045. return $canonicalPackages;
  31046. }
  31047. }
  31048. <?php declare(strict_types=1);
  31049. namespace Composer\Repository;
  31050. use Composer\Package\PackageInterface;
  31051. use Composer\Installer\InstallationManager;
  31052. interface WritableRepositoryInterface extends RepositoryInterface
  31053. {
  31054. public function write(bool $devMode, InstallationManager $installationManager);
  31055. public function addPackage(PackageInterface $package);
  31056. public function removePackage(PackageInterface $package);
  31057. public function getCanonicalPackages();
  31058. public function reload();
  31059. public function setDevPackageNames(array $devPackageNames);
  31060. public function getDevPackageNames();
  31061. }
  31062. <?php declare(strict_types=1);
  31063. namespace Composer\Script;
  31064. use Composer\Composer;
  31065. use Composer\IO\IOInterface;
  31066. use Composer\EventDispatcher\Event as BaseEvent;
  31067. class Event extends BaseEvent
  31068. {
  31069. private $composer;
  31070. private $io;
  31071. private $devMode;
  31072. private $originatingEvent;
  31073. public function __construct(string $name, Composer $composer, IOInterface $io, bool $devMode = false, array $args = array(), array $flags = array())
  31074. {
  31075. parent::__construct($name, $args, $flags);
  31076. $this->composer = $composer;
  31077. $this->io = $io;
  31078. $this->devMode = $devMode;
  31079. }
  31080. public function getComposer(): Composer
  31081. {
  31082. return $this->composer;
  31083. }
  31084. public function getIO(): IOInterface
  31085. {
  31086. return $this->io;
  31087. }
  31088. public function isDevMode(): bool
  31089. {
  31090. return $this->devMode;
  31091. }
  31092. public function getOriginatingEvent(): ?BaseEvent
  31093. {
  31094. return $this->originatingEvent;
  31095. }
  31096. public function setOriginatingEvent(BaseEvent $event): self
  31097. {
  31098. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  31099. return $this;
  31100. }
  31101. private function calculateOriginatingEvent(BaseEvent $event): BaseEvent
  31102. {
  31103. if ($event instanceof Event && $event->getOriginatingEvent()) {
  31104. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  31105. }
  31106. return $event;
  31107. }
  31108. }
  31109. <?php declare(strict_types=1);
  31110. namespace Composer\Script;
  31111. class ScriptEvents
  31112. {
  31113. public const PRE_INSTALL_CMD = 'pre-install-cmd';
  31114. public const POST_INSTALL_CMD = 'post-install-cmd';
  31115. public const PRE_UPDATE_CMD = 'pre-update-cmd';
  31116. public const POST_UPDATE_CMD = 'post-update-cmd';
  31117. public const PRE_STATUS_CMD = 'pre-status-cmd';
  31118. public const POST_STATUS_CMD = 'post-status-cmd';
  31119. public const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  31120. public const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  31121. public const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  31122. public const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  31123. public const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  31124. public const POST_ARCHIVE_CMD = 'post-archive-cmd';
  31125. }
  31126. <?php declare(strict_types=1);
  31127. namespace Composer\SelfUpdate;
  31128. use Composer\Pcre\Preg;
  31129. class Keys
  31130. {
  31131. public static function fingerprint(string $path): string
  31132. {
  31133. $hash = strtoupper(hash('sha256', Preg::replace('{\s}', '', file_get_contents($path))));
  31134. return implode(' ', array(
  31135. substr($hash, 0, 8),
  31136. substr($hash, 8, 8),
  31137. substr($hash, 16, 8),
  31138. substr($hash, 24, 8),
  31139. '',
  31140. substr($hash, 32, 8),
  31141. substr($hash, 40, 8),
  31142. substr($hash, 48, 8),
  31143. substr($hash, 56, 8),
  31144. ));
  31145. }
  31146. }
  31147. <?php declare(strict_types=1);
  31148. namespace Composer\SelfUpdate;
  31149. use Composer\Pcre\Preg;
  31150. use Composer\Util\HttpDownloader;
  31151. use Composer\Config;
  31152. class Versions
  31153. {
  31154. public static $channels = self::CHANNELS;
  31155. public const CHANNELS = ['stable', 'preview', 'snapshot', '1', '2', '2.2'];
  31156. private $httpDownloader;
  31157. private $config;
  31158. private $channel;
  31159. private $versionsData = null;
  31160. public function __construct(Config $config, HttpDownloader $httpDownloader)
  31161. {
  31162. $this->httpDownloader = $httpDownloader;
  31163. $this->config = $config;
  31164. }
  31165. public function getChannel(): string
  31166. {
  31167. if ($this->channel) {
  31168. return $this->channel;
  31169. }
  31170. $channelFile = $this->config->get('home').'/update-channel';
  31171. if (file_exists($channelFile)) {
  31172. $channel = trim(file_get_contents($channelFile));
  31173. if (in_array($channel, array('stable', 'preview', 'snapshot', '2.2'), true)) {
  31174. return $this->channel = $channel;
  31175. }
  31176. }
  31177. return $this->channel = 'stable';
  31178. }
  31179. public function setChannel(string $channel): void
  31180. {
  31181. if (!in_array($channel, self::$channels, true)) {
  31182. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));
  31183. }
  31184. $channelFile = $this->config->get('home').'/update-channel';
  31185. $this->channel = $channel;
  31186. file_put_contents($channelFile, (Preg::isMatch('{^\d+$}D', $channel) ? 'stable' : $channel).PHP_EOL);
  31187. }
  31188. public function getLatest(?string $channel = null): array
  31189. {
  31190. $versions = $this->getVersionsData();
  31191. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  31192. if ($version['min-php'] <= PHP_VERSION_ID) {
  31193. return $version;
  31194. }
  31195. }
  31196. throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  31197. }
  31198. private function getVersionsData(): array
  31199. {
  31200. if (null === $this->versionsData) {
  31201. if ($this->config->get('disable-tls') === true) {
  31202. $protocol = 'http';
  31203. } else {
  31204. $protocol = 'https';
  31205. }
  31206. $this->versionsData = $this->httpDownloader->get($protocol . '://getcomposer.org/versions')->decodeJson();
  31207. }
  31208. return $this->versionsData;
  31209. }
  31210. }
  31211. <?php declare(strict_types=1);
  31212. namespace Composer\Util;
  31213. use Composer\Config;
  31214. use Composer\IO\IOInterface;
  31215. use Composer\Downloader\TransportException;
  31216. use Composer\Pcre\Preg;
  31217. class AuthHelper
  31218. {
  31219. protected $io;
  31220. protected $config;
  31221. private $displayedOriginAuthentications = array();
  31222. public function __construct(IOInterface $io, Config $config)
  31223. {
  31224. $this->io = $io;
  31225. $this->config = $config;
  31226. }
  31227. public function storeAuth(string $origin, $storeAuth): void
  31228. {
  31229. $store = false;
  31230. $configSource = $this->config->getAuthConfigSource();
  31231. if ($storeAuth === true) {
  31232. $store = $configSource;
  31233. } elseif ($storeAuth === 'prompt') {
  31234. $answer = $this->io->askAndValidate(
  31235. 'Do you want to store credentials for '.$origin.' in '.$configSource->getName().' ? [Yn] ',
  31236. function ($value): string {
  31237. $input = strtolower(substr(trim($value), 0, 1));
  31238. if (in_array($input, array('y','n'))) {
  31239. return $input;
  31240. }
  31241. throw new \RuntimeException('Please answer (y)es or (n)o');
  31242. },
  31243. null,
  31244. 'y'
  31245. );
  31246. if ($answer === 'y') {
  31247. $store = $configSource;
  31248. }
  31249. }
  31250. if ($store) {
  31251. $store->addConfigSetting(
  31252. 'http-basic.'.$origin,
  31253. $this->io->getAuthentication($origin)
  31254. );
  31255. }
  31256. }
  31257. public function promptAuthIfNeeded(string $url, string $origin, int $statusCode, ?string $reason = null, array $headers = array()): ?array
  31258. {
  31259. $storeAuth = false;
  31260. if (in_array($origin, $this->config->get('github-domains'), true)) {
  31261. $gitHubUtil = new GitHub($this->io, $this->config, null);
  31262. $message = "\n";
  31263. $rateLimited = $gitHubUtil->isRateLimited($headers);
  31264. $requiresSso = $gitHubUtil->requiresSso($headers);
  31265. if ($requiresSso) {
  31266. $ssoUrl = $gitHubUtil->getSsoUrl($headers);
  31267. $message = 'GitHub API token requires SSO authorization. Authorize this token at ' . $ssoUrl . "\n";
  31268. $this->io->writeError($message);
  31269. if (!$this->io->isInteractive()) {
  31270. throw new TransportException('Could not authenticate against ' . $origin, 403);
  31271. }
  31272. $this->io->ask('After authorizing your token, confirm that you would like to retry the request');
  31273. return array('retry' => true, 'storeAuth' => $storeAuth);
  31274. }
  31275. if ($rateLimited) {
  31276. $rateLimit = $gitHubUtil->getRateLimit($headers);
  31277. if ($this->io->hasAuthentication($origin)) {
  31278. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  31279. } else {
  31280. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  31281. }
  31282. $message = sprintf(
  31283. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$url.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  31284. $rateLimit['limit'],
  31285. $rateLimit['reset']
  31286. )."\n";
  31287. } else {
  31288. $message .= 'Could not fetch '.$url.', please ';
  31289. if ($this->io->hasAuthentication($origin)) {
  31290. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  31291. } else {
  31292. $message .= 'create a GitHub OAuth token to access private repos';
  31293. }
  31294. }
  31295. if (!$gitHubUtil->authorizeOAuth($origin)
  31296. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($origin, $message))
  31297. ) {
  31298. throw new TransportException('Could not authenticate against '.$origin, 401);
  31299. }
  31300. } elseif (in_array($origin, $this->config->get('gitlab-domains'), true)) {
  31301. $message = "\n".'Could not fetch '.$url.', enter your ' . $origin . ' credentials ' .($statusCode === 401 ? 'to access private repos' : 'to go over the API rate limit');
  31302. $gitLabUtil = new GitLab($this->io, $this->config, null);
  31303. if ($this->io->hasAuthentication($origin)) {
  31304. $auth = $this->io->getAuthentication($origin);
  31305. if (in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) {
  31306. throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
  31307. }
  31308. }
  31309. if (!$gitLabUtil->authorizeOAuth($origin)
  31310. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively(parse_url($url, PHP_URL_SCHEME), $origin, $message))
  31311. ) {
  31312. throw new TransportException('Could not authenticate against '.$origin, 401);
  31313. }
  31314. } elseif ($origin === 'bitbucket.org' || $origin === 'api.bitbucket.org') {
  31315. $askForOAuthToken = true;
  31316. $origin = 'bitbucket.org';
  31317. if ($this->io->hasAuthentication($origin)) {
  31318. $auth = $this->io->getAuthentication($origin);
  31319. if ($auth['username'] !== 'x-token-auth') {
  31320. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  31321. $accessToken = $bitbucketUtil->requestToken($origin, $auth['username'], $auth['password']);
  31322. if (!empty($accessToken)) {
  31323. $this->io->setAuthentication($origin, 'x-token-auth', $accessToken);
  31324. $askForOAuthToken = false;
  31325. }
  31326. } else {
  31327. throw new TransportException('Could not authenticate against ' . $origin, 401);
  31328. }
  31329. }
  31330. if ($askForOAuthToken) {
  31331. $message = "\n".'Could not fetch ' . $url . ', please create a bitbucket OAuth token to ' . (($statusCode === 401 || $statusCode === 403) ? 'access private repos' : 'go over the API rate limit');
  31332. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  31333. if (!$bitBucketUtil->authorizeOAuth($origin)
  31334. && (!$this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($origin, $message))
  31335. ) {
  31336. throw new TransportException('Could not authenticate against ' . $origin, 401);
  31337. }
  31338. }
  31339. } else {
  31340. if ($statusCode === 404) {
  31341. return null;
  31342. }
  31343. if (!$this->io->isInteractive()) {
  31344. if ($statusCode === 401) {
  31345. $message = "The '" . $url . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  31346. } elseif ($statusCode === 403) {
  31347. $message = "The '" . $url . "' URL could not be accessed: " . $reason;
  31348. } else {
  31349. $message = "Unknown error code '" . $statusCode . "', reason: " . $reason;
  31350. }
  31351. throw new TransportException($message, $statusCode);
  31352. }
  31353. if ($this->io->hasAuthentication($origin)) {
  31354. throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
  31355. }
  31356. $this->io->writeError(' Authentication required (<info>'.$origin.'</info>):');
  31357. $username = $this->io->ask(' Username: ');
  31358. $password = $this->io->askAndHideAnswer(' Password: ');
  31359. $this->io->setAuthentication($origin, $username, $password);
  31360. $storeAuth = $this->config->get('store-auths');
  31361. }
  31362. return array('retry' => true, 'storeAuth' => $storeAuth);
  31363. }
  31364. public function addAuthenticationHeader(array $headers, string $origin, string $url): array
  31365. {
  31366. if ($this->io->hasAuthentication($origin)) {
  31367. $authenticationDisplayMessage = null;
  31368. $auth = $this->io->getAuthentication($origin);
  31369. if ($auth['password'] === 'bearer') {
  31370. $headers[] = 'Authorization: Bearer '.$auth['username'];
  31371. } elseif ('github.com' === $origin && 'x-oauth-basic' === $auth['password']) {
  31372. if (Preg::isMatch('{^https?://api\.github\.com/}', $url)) {
  31373. $headers[] = 'Authorization: token '.$auth['username'];
  31374. $authenticationDisplayMessage = 'Using GitHub token authentication';
  31375. }
  31376. } elseif (
  31377. in_array($origin, $this->config->get('gitlab-domains'), true)
  31378. && in_array($auth['password'], array('oauth2', 'private-token', 'gitlab-ci-token'), true)
  31379. ) {
  31380. if ($auth['password'] === 'oauth2') {
  31381. $headers[] = 'Authorization: Bearer '.$auth['username'];
  31382. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  31383. } else {
  31384. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  31385. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  31386. }
  31387. } elseif (
  31388. 'bitbucket.org' === $origin
  31389. && $url !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL
  31390. && 'x-token-auth' === $auth['username']
  31391. ) {
  31392. if (!$this->isPublicBitBucketDownload($url)) {
  31393. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  31394. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  31395. }
  31396. } else {
  31397. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  31398. $headers[] = 'Authorization: Basic '.$authStr;
  31399. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  31400. }
  31401. if ($authenticationDisplayMessage && (!isset($this->displayedOriginAuthentications[$origin]) || $this->displayedOriginAuthentications[$origin] !== $authenticationDisplayMessage)) {
  31402. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  31403. $this->displayedOriginAuthentications[$origin] = $authenticationDisplayMessage;
  31404. }
  31405. } elseif (in_array($origin, array('api.bitbucket.org', 'api.github.com'), true)) {
  31406. return $this->addAuthenticationHeader($headers, str_replace('api.', '', $origin), $url);
  31407. }
  31408. return $headers;
  31409. }
  31410. public function isPublicBitBucketDownload(string $urlToBitBucketFile): bool
  31411. {
  31412. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  31413. if (strpos($domain, 'bitbucket.org') === false) {
  31414. return true;
  31415. }
  31416. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  31417. $pathParts = explode('/', $path);
  31418. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  31419. }
  31420. }
  31421. <?php declare(strict_types=1);
  31422. namespace Composer\Util;
  31423. use Composer\Factory;
  31424. use Composer\IO\IOInterface;
  31425. use Composer\Config;
  31426. use Composer\Downloader\TransportException;
  31427. class Bitbucket
  31428. {
  31429. private $io;
  31430. private $config;
  31431. private $process;
  31432. private $httpDownloader;
  31433. private $token = null;
  31434. private $time;
  31435. public const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  31436. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, HttpDownloader $httpDownloader = null, int $time = null)
  31437. {
  31438. $this->io = $io;
  31439. $this->config = $config;
  31440. $this->process = $process ?: new ProcessExecutor($io);
  31441. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  31442. $this->time = $time;
  31443. }
  31444. public function getToken(): string
  31445. {
  31446. if (!isset($this->token['access_token'])) {
  31447. return '';
  31448. }
  31449. return $this->token['access_token'];
  31450. }
  31451. public function authorizeOAuth(string $originUrl): bool
  31452. {
  31453. if ($originUrl !== 'bitbucket.org') {
  31454. return false;
  31455. }
  31456. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  31457. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  31458. return true;
  31459. }
  31460. return false;
  31461. }
  31462. private function requestAccessToken(): bool
  31463. {
  31464. try {
  31465. $response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, array(
  31466. 'retry-auth-failure' => false,
  31467. 'http' => array(
  31468. 'method' => 'POST',
  31469. 'content' => 'grant_type=client_credentials',
  31470. ),
  31471. ));
  31472. $token = $response->decodeJson();
  31473. if (!isset($token['expires_in']) || !isset($token['access_token'])) {
  31474. throw new \LogicException('Expected a token configured with expires_in and access_token present, got '.json_encode($token));
  31475. }
  31476. $this->token = $token;
  31477. } catch (TransportException $e) {
  31478. if ($e->getCode() === 400) {
  31479. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  31480. $this->io->writeError('This can have three reasons:');
  31481. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  31482. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  31483. $this->io->writeError('3. You are using an OAuth consumer, but didn\'t configure it as private consumer');
  31484. return false;
  31485. }
  31486. if (in_array($e->getCode(), array(403, 401))) {
  31487. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  31488. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  31489. return false;
  31490. }
  31491. throw $e;
  31492. }
  31493. return true;
  31494. }
  31495. public function authorizeOAuthInteractively(string $originUrl, string $message = null): bool
  31496. {
  31497. if ($message) {
  31498. $this->io->writeError($message);
  31499. }
  31500. $url = 'https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/';
  31501. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  31502. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  31503. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  31504. $consumerKey = trim((string) $this->io->askAndHideAnswer('Consumer Key (hidden): '));
  31505. if (!$consumerKey) {
  31506. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  31507. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  31508. return false;
  31509. }
  31510. $consumerSecret = trim((string) $this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  31511. if (!$consumerSecret) {
  31512. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  31513. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  31514. return false;
  31515. }
  31516. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  31517. if (!$this->requestAccessToken()) {
  31518. return false;
  31519. }
  31520. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  31521. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  31522. $this->io->writeError('<info>Consumer stored successfully.</info>');
  31523. return true;
  31524. }
  31525. public function requestToken(string $originUrl, string $consumerKey, string $consumerSecret): string
  31526. {
  31527. if ($this->token !== null || $this->getTokenFromConfig($originUrl)) {
  31528. return $this->token['access_token'];
  31529. }
  31530. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  31531. if (!$this->requestAccessToken()) {
  31532. return '';
  31533. }
  31534. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  31535. if (!isset($this->token['access_token'])) {
  31536. throw new \LogicException('Failed to initialize token above');
  31537. }
  31538. return $this->token['access_token'];
  31539. }
  31540. private function storeInAuthConfig(string $originUrl, string $consumerKey, string $consumerSecret): void
  31541. {
  31542. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  31543. if (null === $this->token || !isset($this->token['expires_in'])) {
  31544. throw new \LogicException('Expected a token configured with expires_in present, got '.json_encode($this->token));
  31545. }
  31546. $time = null === $this->time ? time() : $this->time;
  31547. $consumer = array(
  31548. "consumer-key" => $consumerKey,
  31549. "consumer-secret" => $consumerSecret,
  31550. "access-token" => $this->token['access_token'],
  31551. "access-token-expiration" => $time + $this->token['expires_in'],
  31552. );
  31553. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  31554. }
  31555. private function getTokenFromConfig(string $originUrl): bool
  31556. {
  31557. $authConfig = $this->config->get('bitbucket-oauth');
  31558. if (
  31559. !isset($authConfig[$originUrl]['access-token'], $authConfig[$originUrl]['access-token-expiration'])
  31560. || time() > $authConfig[$originUrl]['access-token-expiration']
  31561. ) {
  31562. return false;
  31563. }
  31564. $this->token = array(
  31565. 'access_token' => $authConfig[$originUrl]['access-token'],
  31566. );
  31567. return true;
  31568. }
  31569. }
  31570. <?php declare(strict_types=1);
  31571. namespace Composer\Util;
  31572. use Composer\Pcre\Preg;
  31573. class ComposerMirror
  31574. {
  31575. public static function processUrl(string $mirrorUrl, string $packageName, string $version, ?string $reference, ?string $type, ?string $prettyVersion = null): string
  31576. {
  31577. if ($reference) {
  31578. $reference = Preg::isMatch('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  31579. }
  31580. $version = strpos($version, '/') === false ? $version : md5($version);
  31581. $from = array('%package%', '%version%', '%reference%', '%type%');
  31582. $to = array($packageName, $version, $reference, $type);
  31583. if (null !== $prettyVersion) {
  31584. $from[] = '%prettyVersion%';
  31585. $to[] = $prettyVersion;
  31586. }
  31587. return str_replace($from, $to, $mirrorUrl);
  31588. }
  31589. public static function processGitUrl(string $mirrorUrl, string $packageName, string $url, ?string $type): string
  31590. {
  31591. if (Preg::isMatch('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  31592. $url = 'gh-'.$match[1].'/'.$match[2];
  31593. } elseif (Preg::isMatch('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  31594. $url = 'bb-'.$match[1].'/'.$match[2];
  31595. } else {
  31596. $url = Preg::replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  31597. }
  31598. return str_replace(
  31599. array('%package%', '%normalizedUrl%', '%type%'),
  31600. array($packageName, $url, $type),
  31601. $mirrorUrl
  31602. );
  31603. }
  31604. public static function processHgUrl(string $mirrorUrl, string $packageName, string $url, string $type): string
  31605. {
  31606. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  31607. }
  31608. }
  31609. <?php declare(strict_types=1);
  31610. namespace Composer\Util;
  31611. use Composer\Package\Loader\ArrayLoader;
  31612. use Composer\Package\Loader\ValidatingArrayLoader;
  31613. use Composer\Package\Loader\InvalidPackageException;
  31614. use Composer\Json\JsonValidationException;
  31615. use Composer\IO\IOInterface;
  31616. use Composer\Json\JsonFile;
  31617. use Composer\Pcre\Preg;
  31618. use Composer\Spdx\SpdxLicenses;
  31619. use Seld\JsonLint\DuplicateKeyException;
  31620. use Seld\JsonLint\JsonParser;
  31621. class ConfigValidator
  31622. {
  31623. public const CHECK_VERSION = 1;
  31624. private $io;
  31625. public function __construct(IOInterface $io)
  31626. {
  31627. $this->io = $io;
  31628. }
  31629. public function validate(string $file, int $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL, int $flags = self::CHECK_VERSION): array
  31630. {
  31631. $errors = array();
  31632. $publishErrors = array();
  31633. $warnings = array();
  31634. $laxValid = false;
  31635. $manifest = null;
  31636. try {
  31637. $json = new JsonFile($file, null, $this->io);
  31638. $manifest = $json->read();
  31639. $json->validateSchema(JsonFile::LAX_SCHEMA);
  31640. $laxValid = true;
  31641. $json->validateSchema();
  31642. } catch (JsonValidationException $e) {
  31643. foreach ($e->getErrors() as $message) {
  31644. if ($laxValid) {
  31645. $publishErrors[] = $message;
  31646. } else {
  31647. $errors[] = $message;
  31648. }
  31649. }
  31650. } catch (\Exception $e) {
  31651. $errors[] = $e->getMessage();
  31652. return array($errors, $publishErrors, $warnings);
  31653. }
  31654. if (is_array($manifest)) {
  31655. $jsonParser = new JsonParser();
  31656. try {
  31657. $jsonParser->parse((string) file_get_contents($file), JsonParser::DETECT_KEY_CONFLICTS);
  31658. } catch (DuplicateKeyException $e) {
  31659. $details = $e->getDetails();
  31660. $warnings[] = 'Key '.$details['key'].' is a duplicate in '.$file.' at line '.$details['line'];
  31661. }
  31662. }
  31663. if (empty($manifest['license'])) {
  31664. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  31665. } else {
  31666. $licenses = (array) $manifest['license'];
  31667. foreach ($licenses as $key => $license) {
  31668. if ('proprietary' === $license) {
  31669. unset($licenses[$key]);
  31670. }
  31671. }
  31672. $licenseValidator = new SpdxLicenses();
  31673. foreach ($licenses as $license) {
  31674. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  31675. if ($spdxLicense && $spdxLicense[3]) {
  31676. if (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  31677. $warnings[] = sprintf(
  31678. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  31679. $license
  31680. );
  31681. } elseif (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  31682. $warnings[] = sprintf(
  31683. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  31684. $license
  31685. );
  31686. } else {
  31687. $warnings[] = sprintf(
  31688. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  31689. $license
  31690. );
  31691. }
  31692. }
  31693. }
  31694. }
  31695. if (($flags & self::CHECK_VERSION) && isset($manifest['version'])) {
  31696. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  31697. }
  31698. if (!empty($manifest['name']) && Preg::isMatch('{[A-Z]}', $manifest['name'])) {
  31699. $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  31700. $suggestName = strtolower($suggestName);
  31701. $publishErrors[] = sprintf(
  31702. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  31703. $manifest['name'],
  31704. $suggestName
  31705. );
  31706. }
  31707. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  31708. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  31709. }
  31710. if (isset($manifest['require'], $manifest['require-dev'])) {
  31711. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  31712. if (!empty($requireOverrides)) {
  31713. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  31714. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  31715. }
  31716. }
  31717. foreach (array('provide', 'replace') as $linkType) {
  31718. if (isset($manifest[$linkType])) {
  31719. foreach (array('require', 'require-dev') as $requireType) {
  31720. if (isset($manifest[$requireType])) {
  31721. foreach ($manifest[$linkType] as $provide => $constraint) {
  31722. if (isset($manifest[$requireType][$provide])) {
  31723. $warnings[] = 'The package ' . $provide . ' in '.$requireType.' is also listed in '.$linkType.' which satisfies the requirement. Remove it from '.$linkType.' if you wish to install it.';
  31724. }
  31725. }
  31726. }
  31727. }
  31728. }
  31729. }
  31730. $require = $manifest['require'] ?? array();
  31731. $requireDev = $manifest['require-dev'] ?? array();
  31732. $packages = array_merge($require, $requireDev);
  31733. foreach ($packages as $package => $version) {
  31734. if (Preg::isMatch('/#/', $version)) {
  31735. $warnings[] = sprintf(
  31736. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  31737. $package
  31738. );
  31739. }
  31740. }
  31741. $scriptsDescriptions = $manifest['scripts-descriptions'] ?? array();
  31742. $scripts = $manifest['scripts'] ?? array();
  31743. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  31744. if (!array_key_exists($scriptName, $scripts)) {
  31745. $warnings[] = sprintf(
  31746. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  31747. $scriptName
  31748. );
  31749. }
  31750. }
  31751. if (isset($manifest['autoload']['psr-0'][''])) {
  31752. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  31753. }
  31754. if (isset($manifest['autoload']['psr-4'][''])) {
  31755. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  31756. }
  31757. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  31758. try {
  31759. if (!isset($manifest['version'])) {
  31760. $manifest['version'] = '1.0.0';
  31761. }
  31762. if (!isset($manifest['name'])) {
  31763. $manifest['name'] = 'dummy/dummy';
  31764. }
  31765. $loader->load($manifest);
  31766. } catch (InvalidPackageException $e) {
  31767. $errors = array_merge($errors, $e->getErrors());
  31768. }
  31769. $warnings = array_merge($warnings, $loader->getWarnings());
  31770. return array($errors, $publishErrors, $warnings);
  31771. }
  31772. }
  31773. <?php declare(strict_types=1);
  31774. namespace Composer\Util;
  31775. use Composer\IO\IOInterface;
  31776. class ErrorHandler
  31777. {
  31778. private static $io;
  31779. public static function handle(int $level, string $message, string $file, int $line): bool
  31780. {
  31781. if (!(error_reporting() & $level)) {
  31782. return true;
  31783. }
  31784. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  31785. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  31786. "\na legitimately suppressed error that you were not supposed to see.";
  31787. }
  31788. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  31789. throw new \ErrorException($message, 0, $level, $file, $line);
  31790. }
  31791. if (self::$io) {
  31792. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  31793. if (self::$io->isVerbose()) {
  31794. self::$io->writeError('<warning>Stack trace:</warning>');
  31795. self::$io->writeError(array_filter(array_map(function ($a): ?string {
  31796. if (isset($a['line'], $a['file'])) {
  31797. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  31798. }
  31799. return null;
  31800. }, array_slice(debug_backtrace(), 2))));
  31801. }
  31802. }
  31803. return true;
  31804. }
  31805. public static function register(IOInterface $io = null): void
  31806. {
  31807. set_error_handler(array(__CLASS__, 'handle'));
  31808. error_reporting(E_ALL | E_STRICT);
  31809. self::$io = $io;
  31810. }
  31811. }
  31812. <?php declare(strict_types=1);
  31813. namespace Composer\Util;
  31814. use Composer\Pcre\Preg;
  31815. use React\Promise\PromiseInterface;
  31816. use RecursiveDirectoryIterator;
  31817. use RecursiveIteratorIterator;
  31818. use Symfony\Component\Filesystem\Exception\IOException;
  31819. use Symfony\Component\Finder\Finder;
  31820. class Filesystem
  31821. {
  31822. private $processExecutor;
  31823. public function __construct(ProcessExecutor $executor = null)
  31824. {
  31825. $this->processExecutor = $executor;
  31826. }
  31827. public function remove(string $file)
  31828. {
  31829. if (is_dir($file)) {
  31830. return $this->removeDirectory($file);
  31831. }
  31832. if (file_exists($file)) {
  31833. return $this->unlink($file);
  31834. }
  31835. return false;
  31836. }
  31837. public function isDirEmpty(string $dir)
  31838. {
  31839. $finder = Finder::create()
  31840. ->ignoreVCS(false)
  31841. ->ignoreDotFiles(false)
  31842. ->depth(0)
  31843. ->in($dir);
  31844. return \count($finder) === 0;
  31845. }
  31846. public function emptyDirectory(string $dir, bool $ensureDirectoryExists = true)
  31847. {
  31848. if (is_link($dir) && file_exists($dir)) {
  31849. $this->unlink($dir);
  31850. }
  31851. if ($ensureDirectoryExists) {
  31852. $this->ensureDirectoryExists($dir);
  31853. }
  31854. if (is_dir($dir)) {
  31855. $finder = Finder::create()
  31856. ->ignoreVCS(false)
  31857. ->ignoreDotFiles(false)
  31858. ->depth(0)
  31859. ->in($dir);
  31860. foreach ($finder as $path) {
  31861. $this->remove((string) $path);
  31862. }
  31863. }
  31864. }
  31865. public function removeDirectory(string $directory)
  31866. {
  31867. $edgeCaseResult = $this->removeEdgeCases($directory);
  31868. if ($edgeCaseResult !== null) {
  31869. return $edgeCaseResult;
  31870. }
  31871. if (Platform::isWindows()) {
  31872. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  31873. } else {
  31874. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  31875. }
  31876. $result = $this->getProcess()->execute($cmd, $output) === 0;
  31877. clearstatcache();
  31878. if ($result && !is_dir($directory)) {
  31879. return true;
  31880. }
  31881. return $this->removeDirectoryPhp($directory);
  31882. }
  31883. public function removeDirectoryAsync(string $directory)
  31884. {
  31885. $edgeCaseResult = $this->removeEdgeCases($directory);
  31886. if ($edgeCaseResult !== null) {
  31887. return \React\Promise\resolve($edgeCaseResult);
  31888. }
  31889. if (Platform::isWindows()) {
  31890. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  31891. } else {
  31892. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  31893. }
  31894. $promise = $this->getProcess()->executeAsync($cmd);
  31895. return $promise->then(function ($process) use ($directory) {
  31896. clearstatcache();
  31897. if ($process->isSuccessful()) {
  31898. if (!is_dir($directory)) {
  31899. return \React\Promise\resolve(true);
  31900. }
  31901. }
  31902. return \React\Promise\resolve($this->removeDirectoryPhp($directory));
  31903. });
  31904. }
  31905. private function removeEdgeCases(string $directory, bool $fallbackToPhp = true): ?bool
  31906. {
  31907. if ($this->isSymlinkedDirectory($directory)) {
  31908. return $this->unlinkSymlinkedDirectory($directory);
  31909. }
  31910. if ($this->isJunction($directory)) {
  31911. return $this->removeJunction($directory);
  31912. }
  31913. if (is_link($directory)) {
  31914. return unlink($directory);
  31915. }
  31916. if (!is_dir($directory) || !file_exists($directory)) {
  31917. return true;
  31918. }
  31919. if (Preg::isMatch('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  31920. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  31921. }
  31922. if (!\function_exists('proc_open') && $fallbackToPhp) {
  31923. return $this->removeDirectoryPhp($directory);
  31924. }
  31925. return null;
  31926. }
  31927. public function removeDirectoryPhp(string $directory)
  31928. {
  31929. $edgeCaseResult = $this->removeEdgeCases($directory, false);
  31930. if ($edgeCaseResult !== null) {
  31931. return $edgeCaseResult;
  31932. }
  31933. try {
  31934. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  31935. } catch (\UnexpectedValueException $e) {
  31936. clearstatcache();
  31937. usleep(100000);
  31938. if (!is_dir($directory)) {
  31939. return true;
  31940. }
  31941. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  31942. }
  31943. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  31944. foreach ($ri as $file) {
  31945. if ($file->isDir()) {
  31946. $this->rmdir($file->getPathname());
  31947. } else {
  31948. $this->unlink($file->getPathname());
  31949. }
  31950. }
  31951. unset($ri, $it, $file);
  31952. return $this->rmdir($directory);
  31953. }
  31954. public function ensureDirectoryExists(string $directory)
  31955. {
  31956. if (!is_dir($directory)) {
  31957. if (file_exists($directory)) {
  31958. throw new \RuntimeException(
  31959. $directory.' exists and is not a directory.'
  31960. );
  31961. }
  31962. if (!@mkdir($directory, 0777, true)) {
  31963. throw new \RuntimeException(
  31964. $directory.' does not exist and could not be created.'
  31965. );
  31966. }
  31967. }
  31968. }
  31969. public function unlink(string $path)
  31970. {
  31971. $unlinked = @$this->unlinkImplementation($path);
  31972. if (!$unlinked) {
  31973. if (Platform::isWindows()) {
  31974. usleep(350000);
  31975. $unlinked = @$this->unlinkImplementation($path);
  31976. }
  31977. if (!$unlinked) {
  31978. $error = error_get_last();
  31979. $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
  31980. if (Platform::isWindows()) {
  31981. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  31982. }
  31983. throw new \RuntimeException($message);
  31984. }
  31985. }
  31986. return true;
  31987. }
  31988. public function rmdir(string $path)
  31989. {
  31990. $deleted = @rmdir($path);
  31991. if (!$deleted) {
  31992. if (Platform::isWindows()) {
  31993. usleep(350000);
  31994. $deleted = @rmdir($path);
  31995. }
  31996. if (!$deleted) {
  31997. $error = error_get_last();
  31998. $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
  31999. if (Platform::isWindows()) {
  32000. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  32001. }
  32002. throw new \RuntimeException($message);
  32003. }
  32004. }
  32005. return true;
  32006. }
  32007. public function copyThenRemove(string $source, string $target)
  32008. {
  32009. $this->copy($source, $target);
  32010. if (!is_dir($source)) {
  32011. $this->unlink($source);
  32012. return;
  32013. }
  32014. $this->removeDirectoryPhp($source);
  32015. }
  32016. public function copy(string $source, string $target)
  32017. {
  32018. if (!is_dir($source)) {
  32019. return copy($source, $target);
  32020. }
  32021. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  32022. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  32023. $this->ensureDirectoryExists($target);
  32024. $result = true;
  32025. foreach ($ri as $file) {
  32026. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathname();
  32027. if ($file->isDir()) {
  32028. $this->ensureDirectoryExists($targetPath);
  32029. } else {
  32030. $result = $result && copy($file->getPathname(), $targetPath);
  32031. }
  32032. }
  32033. return $result;
  32034. }
  32035. public function rename(string $source, string $target)
  32036. {
  32037. if (true === @rename($source, $target)) {
  32038. return;
  32039. }
  32040. if (!\function_exists('proc_open')) {
  32041. $this->copyThenRemove($source, $target);
  32042. return;
  32043. }
  32044. if (Platform::isWindows()) {
  32045. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  32046. $result = $this->getProcess()->execute($command, $output);
  32047. clearstatcache();
  32048. if (0 === $result) {
  32049. $this->remove($source);
  32050. return;
  32051. }
  32052. } else {
  32053. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  32054. $result = $this->getProcess()->execute($command, $output);
  32055. clearstatcache();
  32056. if (0 === $result) {
  32057. return;
  32058. }
  32059. }
  32060. $this->copyThenRemove($source, $target);
  32061. }
  32062. public function findShortestPath(string $from, string $to, bool $directories = false)
  32063. {
  32064. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  32065. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  32066. }
  32067. $from = $this->normalizePath($from);
  32068. $to = $this->normalizePath($to);
  32069. if ($directories) {
  32070. $from = rtrim($from, '/') . '/dummy_file';
  32071. }
  32072. if (\dirname($from) === \dirname($to)) {
  32073. return './'.basename($to);
  32074. }
  32075. $commonPath = $to;
  32076. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath)) {
  32077. $commonPath = strtr(\dirname($commonPath), '\\', '/');
  32078. }
  32079. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  32080. return $to;
  32081. }
  32082. $commonPath = rtrim($commonPath, '/') . '/';
  32083. $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/');
  32084. $commonPathCode = str_repeat('../', $sourcePathDepth);
  32085. $result = $commonPathCode . substr($to, \strlen($commonPath));
  32086. if (\strlen($result) === 0) {
  32087. return './';
  32088. }
  32089. return $result;
  32090. }
  32091. public function findShortestPathCode(string $from, string $to, bool $directories = false, bool $staticCode = false)
  32092. {
  32093. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  32094. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  32095. }
  32096. $from = $this->normalizePath($from);
  32097. $to = $this->normalizePath($to);
  32098. if ($from === $to) {
  32099. return $directories ? '__DIR__' : '__FILE__';
  32100. }
  32101. $commonPath = $to;
  32102. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  32103. $commonPath = strtr(\dirname($commonPath), '\\', '/');
  32104. }
  32105. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  32106. return var_export($to, true);
  32107. }
  32108. $commonPath = rtrim($commonPath, '/') . '/';
  32109. if (strpos($to, $from.'/') === 0) {
  32110. return '__DIR__ . '.var_export((string) substr($to, \strlen($from)), true);
  32111. }
  32112. $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/') + (int) $directories;
  32113. if ($staticCode) {
  32114. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  32115. } else {
  32116. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  32117. }
  32118. $relTarget = (string) substr($to, \strlen($commonPath));
  32119. return $commonPathCode . (\strlen($relTarget) > 0 ? '.' . var_export('/' . $relTarget, true) : '');
  32120. }
  32121. public function isAbsolutePath(string $path)
  32122. {
  32123. return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
  32124. }
  32125. public function size(string $path)
  32126. {
  32127. if (!file_exists($path)) {
  32128. throw new \RuntimeException("$path does not exist.");
  32129. }
  32130. if (is_dir($path)) {
  32131. return $this->directorySize($path);
  32132. }
  32133. return (int) filesize($path);
  32134. }
  32135. public function normalizePath(string $path)
  32136. {
  32137. $parts = array();
  32138. $path = strtr($path, '\\', '/');
  32139. $prefix = '';
  32140. $absolute = '';
  32141. if (strpos($path, '//') === 0 && \strlen($path) > 2) {
  32142. $absolute = '//';
  32143. $path = substr($path, 2);
  32144. }
  32145. if (Preg::isMatch('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  32146. $prefix = $match[1];
  32147. $path = substr($path, \strlen($prefix));
  32148. }
  32149. if (strpos($path, '/') === 0) {
  32150. $absolute = '/';
  32151. $path = substr($path, 1);
  32152. }
  32153. $up = false;
  32154. foreach (explode('/', $path) as $chunk) {
  32155. if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
  32156. array_pop($parts);
  32157. $up = !(\count($parts) === 0 || '..' === end($parts));
  32158. } elseif ('.' !== $chunk && '' !== $chunk) {
  32159. $parts[] = $chunk;
  32160. $up = '..' !== $chunk;
  32161. }
  32162. }
  32163. $prefix = Preg::replaceCallback('{(^|://)[a-z]:$}i', function (array $m) { return strtoupper($m[0]); }, $prefix);
  32164. return $prefix.$absolute.implode('/', $parts);
  32165. }
  32166. public static function trimTrailingSlash(string $path)
  32167. {
  32168. if (!Preg::isMatch('{^[/\\\\]+$}', $path)) {
  32169. $path = rtrim($path, '/\\');
  32170. }
  32171. return $path;
  32172. }
  32173. public static function isLocalPath(string $path)
  32174. {
  32175. return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  32176. }
  32177. public static function getPlatformPath(string $path)
  32178. {
  32179. if (Platform::isWindows()) {
  32180. $path = Preg::replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  32181. }
  32182. return Preg::replace('{^file://}i', '', $path);
  32183. }
  32184. public static function isReadable(string $path)
  32185. {
  32186. if (is_readable($path)) {
  32187. return true;
  32188. }
  32189. if (is_file($path)) {
  32190. return false !== Silencer::call('file_get_contents', $path, false, null, 0, 1);
  32191. }
  32192. if (is_dir($path)) {
  32193. return false !== Silencer::call('opendir', $path);
  32194. }
  32195. return false;
  32196. }
  32197. protected function directorySize(string $directory)
  32198. {
  32199. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  32200. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  32201. $size = 0;
  32202. foreach ($ri as $file) {
  32203. if ($file->isFile()) {
  32204. $size += $file->getSize();
  32205. }
  32206. }
  32207. return $size;
  32208. }
  32209. protected function getProcess()
  32210. {
  32211. if (null === $this->processExecutor) {
  32212. $this->processExecutor = new ProcessExecutor();
  32213. }
  32214. return $this->processExecutor;
  32215. }
  32216. private function unlinkImplementation(string $path): bool
  32217. {
  32218. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  32219. return rmdir($path);
  32220. }
  32221. return unlink($path);
  32222. }
  32223. public function relativeSymlink(string $target, string $link)
  32224. {
  32225. if (!function_exists('symlink')) {
  32226. return false;
  32227. }
  32228. $cwd = Platform::getCwd();
  32229. $relativePath = $this->findShortestPath($link, $target);
  32230. chdir(\dirname($link));
  32231. $result = @symlink($relativePath, $link);
  32232. chdir($cwd);
  32233. return $result;
  32234. }
  32235. public function isSymlinkedDirectory(string $directory)
  32236. {
  32237. if (!is_dir($directory)) {
  32238. return false;
  32239. }
  32240. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  32241. return is_link($resolved);
  32242. }
  32243. private function unlinkSymlinkedDirectory(string $directory): bool
  32244. {
  32245. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  32246. return $this->unlink($resolved);
  32247. }
  32248. private function resolveSymlinkedDirectorySymlink(string $pathname): string
  32249. {
  32250. if (!is_dir($pathname)) {
  32251. return $pathname;
  32252. }
  32253. $resolved = rtrim($pathname, '/');
  32254. if (0 === \strlen($resolved)) {
  32255. return $pathname;
  32256. }
  32257. return $resolved;
  32258. }
  32259. public function junction(string $target, string $junction)
  32260. {
  32261. if (!Platform::isWindows()) {
  32262. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  32263. }
  32264. if (!is_dir($target)) {
  32265. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  32266. }
  32267. $cmd = sprintf(
  32268. 'mklink /J %s %s',
  32269. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  32270. ProcessExecutor::escape(realpath($target))
  32271. );
  32272. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  32273. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  32274. }
  32275. clearstatcache(true, $junction);
  32276. }
  32277. public function isJunction(string $junction)
  32278. {
  32279. if (!Platform::isWindows()) {
  32280. return false;
  32281. }
  32282. clearstatcache(true, $junction);
  32283. if (!is_dir($junction) || is_link($junction)) {
  32284. return false;
  32285. }
  32286. $stat = lstat($junction);
  32287. return is_array($stat) ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  32288. }
  32289. public function removeJunction(string $junction)
  32290. {
  32291. if (!Platform::isWindows()) {
  32292. return false;
  32293. }
  32294. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  32295. if (!$this->isJunction($junction)) {
  32296. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  32297. }
  32298. return $this->rmdir($junction);
  32299. }
  32300. public function filePutContentsIfModified(string $path, string $content)
  32301. {
  32302. $currentContent = Silencer::call('file_get_contents', $path);
  32303. if (false === $currentContent || $currentContent !== $content) {
  32304. return file_put_contents($path, $content);
  32305. }
  32306. return 0;
  32307. }
  32308. public function safeCopy(string $source, string $target)
  32309. {
  32310. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  32311. $sourceHandle = fopen($source, 'r');
  32312. assert($sourceHandle !== false, 'Could not open "'.$source.'" for reading.');
  32313. $targetHandle = fopen($target, 'w+');
  32314. assert($targetHandle !== false, 'Could not open "'.$target.'" for writing.');
  32315. stream_copy_to_stream($sourceHandle, $targetHandle);
  32316. fclose($sourceHandle);
  32317. fclose($targetHandle);
  32318. }
  32319. }
  32320. private function filesAreEqual(string $a, string $b): bool
  32321. {
  32322. if (filesize($a) !== filesize($b)) {
  32323. return false;
  32324. }
  32325. $aHandle = fopen($a, 'rb');
  32326. assert($aHandle !== false, 'Could not open "'.$a.'" for reading.');
  32327. $bHandle = fopen($b, 'rb');
  32328. assert($bHandle !== false, 'Could not open "'.$b.'" for reading.');
  32329. $result = true;
  32330. while (!feof($aHandle)) {
  32331. if (fread($aHandle, 8192) !== fread($bHandle, 8192)) {
  32332. $result = false;
  32333. break;
  32334. }
  32335. }
  32336. fclose($aHandle);
  32337. fclose($bHandle);
  32338. return $result;
  32339. }
  32340. }
  32341. <?php declare(strict_types=1);
  32342. namespace Composer\Util;
  32343. use Composer\Config;
  32344. use Composer\IO\IOInterface;
  32345. use Composer\Pcre\Preg;
  32346. class Git
  32347. {
  32348. private static $version = false;
  32349. protected $io;
  32350. protected $config;
  32351. protected $process;
  32352. protected $filesystem;
  32353. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  32354. {
  32355. $this->io = $io;
  32356. $this->config = $config;
  32357. $this->process = $process;
  32358. $this->filesystem = $fs;
  32359. }
  32360. public function runCommand(callable $commandCallable, string $url, ?string $cwd, bool $initialClone = false): void
  32361. {
  32362. $this->config->prohibitUrlByConfig($url, $this->io);
  32363. if ($initialClone) {
  32364. $origCwd = $cwd;
  32365. $cwd = null;
  32366. }
  32367. if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  32368. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  32369. }
  32370. if (!$initialClone) {
  32371. $this->process->execute('git remote -v', $output, $cwd);
  32372. if (Preg::isMatch('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  32373. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  32374. }
  32375. }
  32376. $protocols = $this->config->get('github-protocols');
  32377. if (!is_array($protocols)) {
  32378. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  32379. }
  32380. if (Preg::isMatch('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  32381. $messages = array();
  32382. foreach ($protocols as $protocol) {
  32383. if ('ssh' === $protocol) {
  32384. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  32385. } else {
  32386. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  32387. }
  32388. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  32389. return;
  32390. }
  32391. $messages[] = '- ' . $protoUrl . "\n" . Preg::replace('#^#m', ' ', $this->process->getErrorOutput());
  32392. if ($initialClone && isset($origCwd)) {
  32393. $this->filesystem->removeDirectory($origCwd);
  32394. }
  32395. }
  32396. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  32397. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  32398. }
  32399. }
  32400. $bypassSshForGitHub = Preg::isMatch('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  32401. $command = call_user_func($commandCallable, $url);
  32402. $auth = null;
  32403. $credentials = array();
  32404. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  32405. $errorMsg = $this->process->getErrorOutput();
  32406. if (Preg::isMatch('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  32407. || Preg::isMatch('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*?)(?:\.git)?$}i', $url, $match)
  32408. ) {
  32409. if (!$this->io->hasAuthentication($match[1])) {
  32410. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  32411. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  32412. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  32413. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  32414. }
  32415. }
  32416. if ($this->io->hasAuthentication($match[1])) {
  32417. $auth = $this->io->getAuthentication($match[1]);
  32418. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  32419. $command = call_user_func($commandCallable, $authUrl);
  32420. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32421. return;
  32422. }
  32423. $credentials = array(rawurlencode($auth['username']), rawurlencode($auth['password']));
  32424. $errorMsg = $this->process->getErrorOutput();
  32425. }
  32426. } elseif (Preg::isMatch('{^https://(bitbucket\.org)/(.*?)(?:\.git)?$}i', $url, $match)) {
  32427. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  32428. if (!$this->io->hasAuthentication($match[1])) {
  32429. $message = 'Enter your Bitbucket credentials to access private repos';
  32430. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  32431. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  32432. $accessToken = $bitbucketUtil->getToken();
  32433. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  32434. }
  32435. } else {
  32436. $auth = $this->io->getAuthentication($match[1]);
  32437. if ($auth['username'] !== 'x-token-auth') {
  32438. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  32439. if (!empty($accessToken)) {
  32440. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  32441. }
  32442. }
  32443. }
  32444. if ($this->io->hasAuthentication($match[1])) {
  32445. $auth = $this->io->getAuthentication($match[1]);
  32446. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  32447. $command = call_user_func($commandCallable, $authUrl);
  32448. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32449. return;
  32450. }
  32451. $credentials = array(rawurlencode($auth['username']), rawurlencode($auth['password']));
  32452. $errorMsg = $this->process->getErrorOutput();
  32453. } else {
  32454. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  32455. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  32456. $command = call_user_func($commandCallable, $sshUrl);
  32457. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32458. return;
  32459. }
  32460. $errorMsg = $this->process->getErrorOutput();
  32461. }
  32462. } elseif (
  32463. Preg::isMatch('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  32464. || Preg::isMatch('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}i', $url, $match)
  32465. ) {
  32466. if ($match[1] === 'git') {
  32467. $match[1] = 'https';
  32468. }
  32469. if (!$this->io->hasAuthentication($match[2])) {
  32470. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  32471. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  32472. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  32473. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  32474. }
  32475. }
  32476. if ($this->io->hasAuthentication($match[2])) {
  32477. $auth = $this->io->getAuthentication($match[2]);
  32478. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  32479. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  32480. } else {
  32481. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  32482. }
  32483. $command = call_user_func($commandCallable, $authUrl);
  32484. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32485. return;
  32486. }
  32487. $credentials = array(rawurlencode($auth['username']), rawurlencode($auth['password']));
  32488. $errorMsg = $this->process->getErrorOutput();
  32489. }
  32490. } elseif ($this->isAuthenticationFailure($url, $match)) {
  32491. if (strpos($match[2], '@')) {
  32492. list($authParts, $match[2]) = explode('@', $match[2], 2);
  32493. }
  32494. $storeAuth = false;
  32495. if ($this->io->hasAuthentication($match[2])) {
  32496. $auth = $this->io->getAuthentication($match[2]);
  32497. } elseif ($this->io->isInteractive()) {
  32498. $defaultUsername = null;
  32499. if (isset($authParts) && $authParts) {
  32500. if (false !== strpos($authParts, ':')) {
  32501. list($defaultUsername, ) = explode(':', $authParts, 2);
  32502. } else {
  32503. $defaultUsername = $authParts;
  32504. }
  32505. }
  32506. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  32507. $auth = array(
  32508. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  32509. 'password' => $this->io->askAndHideAnswer(' Password: '),
  32510. );
  32511. $storeAuth = $this->config->get('store-auths');
  32512. }
  32513. if (null !== $auth) {
  32514. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  32515. $command = call_user_func($commandCallable, $authUrl);
  32516. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32517. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  32518. $authHelper = new AuthHelper($this->io, $this->config);
  32519. $authHelper->storeAuth($match[2], $storeAuth);
  32520. return;
  32521. }
  32522. $credentials = array(rawurlencode($auth['username']), rawurlencode($auth['password']));
  32523. $errorMsg = $this->process->getErrorOutput();
  32524. }
  32525. }
  32526. if ($initialClone && isset($origCwd)) {
  32527. $this->filesystem->removeDirectory($origCwd);
  32528. }
  32529. if (count($credentials) > 0) {
  32530. $command = $this->maskCredentials($command, $credentials);
  32531. $errorMsg = $this->maskCredentials($errorMsg, $credentials);
  32532. }
  32533. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  32534. }
  32535. }
  32536. public function syncMirror(string $url, string $dir): bool
  32537. {
  32538. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK') && Platform::getEnv('COMPOSER_DISABLE_NETWORK') !== 'prime') {
  32539. $this->io->writeError('<warning>Aborting git mirror sync of '.$url.' as network is disabled</warning>');
  32540. return false;
  32541. }
  32542. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  32543. try {
  32544. $commandCallable = function ($url): string {
  32545. $sanitizedUrl = Preg::replace('{://([^@]+?):(.+?)@}', '://', $url);
  32546. return sprintf('git remote set-url origin -- %s && git remote update --prune origin && git remote set-url origin -- %s && git gc --auto', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  32547. };
  32548. $this->runCommand($commandCallable, $url, $dir);
  32549. } catch (\Exception $e) {
  32550. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  32551. return false;
  32552. }
  32553. return true;
  32554. }
  32555. $this->filesystem->removeDirectory($dir);
  32556. $commandCallable = function ($url) use ($dir): string {
  32557. return sprintf('git clone --mirror -- %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  32558. };
  32559. $this->runCommand($commandCallable, $url, $dir, true);
  32560. return true;
  32561. }
  32562. public function fetchRefOrSyncMirror(string $url, string $dir, string $ref): bool
  32563. {
  32564. if ($this->checkRefIsInMirror($dir, $ref)) {
  32565. return true;
  32566. }
  32567. if ($this->syncMirror($url, $dir)) {
  32568. return $this->checkRefIsInMirror($dir, $ref);
  32569. }
  32570. return false;
  32571. }
  32572. public static function getNoShowSignatureFlag(ProcessExecutor $process): string
  32573. {
  32574. $gitVersion = self::getVersion($process);
  32575. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  32576. return ' --no-show-signature';
  32577. }
  32578. return '';
  32579. }
  32580. private function checkRefIsInMirror(string $dir, string $ref): bool
  32581. {
  32582. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  32583. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  32584. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  32585. if ($exitCode === 0) {
  32586. return true;
  32587. }
  32588. }
  32589. return false;
  32590. }
  32591. private function isAuthenticationFailure(string $url, array &$match): bool
  32592. {
  32593. if (!Preg::isMatch('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  32594. return false;
  32595. }
  32596. $authFailures = array(
  32597. 'fatal: Authentication failed',
  32598. 'remote error: Invalid username or password.',
  32599. 'error: 401 Unauthorized',
  32600. 'fatal: unable to access',
  32601. 'fatal: could not read Username',
  32602. );
  32603. $errorOutput = $this->process->getErrorOutput();
  32604. foreach ($authFailures as $authFailure) {
  32605. if (strpos($errorOutput, $authFailure) !== false) {
  32606. return true;
  32607. }
  32608. }
  32609. return false;
  32610. }
  32611. public static function cleanEnv(): void
  32612. {
  32613. if (Platform::getEnv('GIT_ASKPASS') !== 'echo') {
  32614. Platform::putEnv('GIT_ASKPASS', 'echo');
  32615. }
  32616. if (Platform::getEnv('GIT_DIR')) {
  32617. Platform::clearEnv('GIT_DIR');
  32618. }
  32619. if (Platform::getEnv('GIT_WORK_TREE')) {
  32620. Platform::clearEnv('GIT_WORK_TREE');
  32621. }
  32622. if (Platform::getEnv('LANGUAGE') !== 'C') {
  32623. Platform::putEnv('LANGUAGE', 'C');
  32624. }
  32625. Platform::clearEnv('DYLD_LIBRARY_PATH');
  32626. }
  32627. public static function getGitHubDomainsRegex(Config $config): string
  32628. {
  32629. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  32630. }
  32631. public static function getGitLabDomainsRegex(Config $config): string
  32632. {
  32633. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  32634. }
  32635. private function throwException($message, string $url): void
  32636. {
  32637. clearstatcache();
  32638. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  32639. throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  32640. }
  32641. throw new \RuntimeException(Url::sanitize($message));
  32642. }
  32643. public static function getVersion(ProcessExecutor $process): ?string
  32644. {
  32645. if (false === self::$version) {
  32646. self::$version = null;
  32647. if (0 === $process->execute('git --version', $output) && Preg::isMatch('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  32648. self::$version = $matches[1];
  32649. }
  32650. }
  32651. return self::$version;
  32652. }
  32653. private function maskCredentials(string $error, array $credentials): string
  32654. {
  32655. $maskedCredentials = array();
  32656. foreach ($credentials as $credential) {
  32657. if (in_array($credential, array('private-token', 'x-token-auth', 'oauth2', 'gitlab-ci-token', 'x-oauth-basic'))) {
  32658. $maskedCredentials[] = $credential;
  32659. } elseif (strlen($credential) > 6) {
  32660. $maskedCredentials[] = substr($credential, 0, 3) . '...' . substr($credential, -3);
  32661. } elseif (strlen($credential) > 3) {
  32662. $maskedCredentials[] = substr($credential, 0, 3) . '...';
  32663. } else {
  32664. $maskedCredentials[] = 'XXX';
  32665. }
  32666. }
  32667. return str_replace($credentials, $maskedCredentials, $error);
  32668. }
  32669. }
  32670. <?php declare(strict_types=1);
  32671. namespace Composer\Util;
  32672. use Composer\Factory;
  32673. use Composer\IO\IOInterface;
  32674. use Composer\Config;
  32675. use Composer\Downloader\TransportException;
  32676. use Composer\Pcre\Preg;
  32677. class GitHub
  32678. {
  32679. protected $io;
  32680. protected $config;
  32681. protected $process;
  32682. protected $httpDownloader;
  32683. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, HttpDownloader $httpDownloader = null)
  32684. {
  32685. $this->io = $io;
  32686. $this->config = $config;
  32687. $this->process = $process ?: new ProcessExecutor($io);
  32688. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  32689. }
  32690. public function authorizeOAuth(string $originUrl): bool
  32691. {
  32692. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  32693. return false;
  32694. }
  32695. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  32696. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  32697. return true;
  32698. }
  32699. return false;
  32700. }
  32701. public function authorizeOAuthInteractively(string $originUrl, string $message = null): bool
  32702. {
  32703. if ($message) {
  32704. $this->io->writeError($message);
  32705. }
  32706. $note = 'Composer';
  32707. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  32708. $note .= ' on ' . trim($output);
  32709. }
  32710. $note .= ' ' . date('Y-m-d Hi');
  32711. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=&description=' . str_replace('%20', '+', rawurlencode($note));
  32712. $this->io->writeError(sprintf('When working with _public_ GitHub repositories only, head to %s to retrieve a token.', $url));
  32713. $this->io->writeError('This token will have read-only permission for public information only.');
  32714. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  32715. $this->io->writeError(sprintf('When you need to access _private_ GitHub repositories as well, go to %s', $url));
  32716. $this->io->writeError('Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.');
  32717. $this->io->writeError(sprintf('Tokens will be stored in plain text in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  32718. $this->io->writeError('For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth');
  32719. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  32720. if (!$token) {
  32721. $this->io->writeError('<warning>No token given, aborting.</warning>');
  32722. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  32723. return false;
  32724. }
  32725. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  32726. try {
  32727. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  32728. $this->httpDownloader->get('https://'. $apiUrl, array(
  32729. 'retry-auth-failure' => false,
  32730. ));
  32731. } catch (TransportException $e) {
  32732. if (in_array($e->getCode(), array(403, 401))) {
  32733. $this->io->writeError('<error>Invalid token provided.</error>');
  32734. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  32735. return false;
  32736. }
  32737. throw $e;
  32738. }
  32739. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  32740. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  32741. $this->io->writeError('<info>Token stored successfully.</info>');
  32742. return true;
  32743. }
  32744. public function getRateLimit(array $headers): array
  32745. {
  32746. $rateLimit = array(
  32747. 'limit' => '?',
  32748. 'reset' => '?',
  32749. );
  32750. foreach ($headers as $header) {
  32751. $header = trim($header);
  32752. if (false === strpos($header, 'X-RateLimit-')) {
  32753. continue;
  32754. }
  32755. list($type, $value) = explode(':', $header, 2);
  32756. switch ($type) {
  32757. case 'X-RateLimit-Limit':
  32758. $rateLimit['limit'] = (int) trim($value);
  32759. break;
  32760. case 'X-RateLimit-Reset':
  32761. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  32762. break;
  32763. }
  32764. }
  32765. return $rateLimit;
  32766. }
  32767. public function getSsoUrl(array $headers): ?string
  32768. {
  32769. foreach ($headers as $header) {
  32770. $header = trim($header);
  32771. if (false === stripos($header, 'x-github-sso: required')) {
  32772. continue;
  32773. }
  32774. if (Preg::isMatch('{\burl=(?P<url>[^\s;]+)}', $header, $match)) {
  32775. return $match['url'];
  32776. }
  32777. }
  32778. return null;
  32779. }
  32780. public function isRateLimited(array $headers): bool
  32781. {
  32782. foreach ($headers as $header) {
  32783. if (Preg::isMatch('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  32784. return true;
  32785. }
  32786. }
  32787. return false;
  32788. }
  32789. public function requiresSso(array $headers): bool
  32790. {
  32791. foreach ($headers as $header) {
  32792. if (Preg::isMatch('{^X-GitHub-SSO: required}i', trim($header))) {
  32793. return true;
  32794. }
  32795. }
  32796. return false;
  32797. }
  32798. }
  32799. <?php declare(strict_types=1);
  32800. namespace Composer\Util;
  32801. use Composer\IO\IOInterface;
  32802. use Composer\Config;
  32803. use Composer\Factory;
  32804. use Composer\Downloader\TransportException;
  32805. use Composer\Pcre\Preg;
  32806. class GitLab
  32807. {
  32808. protected $io;
  32809. protected $config;
  32810. protected $process;
  32811. protected $httpDownloader;
  32812. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, HttpDownloader $httpDownloader = null)
  32813. {
  32814. $this->io = $io;
  32815. $this->config = $config;
  32816. $this->process = $process ?: new ProcessExecutor($io);
  32817. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  32818. }
  32819. public function authorizeOAuth(string $originUrl): bool
  32820. {
  32821. $bcOriginUrl = Preg::replace('{:\d+}', '', $originUrl);
  32822. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  32823. return false;
  32824. }
  32825. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  32826. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  32827. return true;
  32828. }
  32829. if (0 === $this->process->execute('git config gitlab.deploytoken.user', $tokenUser) && 0 === $this->process->execute('git config gitlab.deploytoken.token', $tokenPassword)) {
  32830. $this->io->setAuthentication($originUrl, trim($tokenUser), trim($tokenPassword));
  32831. return true;
  32832. }
  32833. $authTokens = $this->config->get('gitlab-token');
  32834. if (isset($authTokens[$originUrl])) {
  32835. $token = $authTokens[$originUrl];
  32836. }
  32837. if (isset($authTokens[$bcOriginUrl])) {
  32838. $token = $authTokens[$bcOriginUrl];
  32839. }
  32840. if (isset($token)) {
  32841. $username = is_array($token) && array_key_exists("username", $token) ? $token["username"] : $token;
  32842. $password = is_array($token) && array_key_exists("token", $token) ? $token["token"] : 'private-token';
  32843. $this->io->setAuthentication($originUrl, $username, $password);
  32844. return true;
  32845. }
  32846. return false;
  32847. }
  32848. public function authorizeOAuthInteractively(string $scheme, string $originUrl, string $message = null): bool
  32849. {
  32850. if ($message) {
  32851. $this->io->writeError($message);
  32852. }
  32853. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  32854. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/-/profile/personal_access_tokens');
  32855. $attemptCounter = 0;
  32856. while ($attemptCounter++ < 5) {
  32857. try {
  32858. $response = $this->createToken($scheme, $originUrl);
  32859. } catch (TransportException $e) {
  32860. if (in_array($e->getCode(), array(403, 401))) {
  32861. if (401 === $e->getCode()) {
  32862. $response = json_decode($e->getResponse(), true);
  32863. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  32864. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  32865. } else {
  32866. $this->io->writeError('Bad credentials.');
  32867. }
  32868. } else {
  32869. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  32870. }
  32871. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  32872. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  32873. continue;
  32874. }
  32875. throw $e;
  32876. }
  32877. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  32878. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  32879. return true;
  32880. }
  32881. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  32882. }
  32883. private function createToken(string $scheme, string $originUrl): array
  32884. {
  32885. $username = $this->io->ask('Username: ');
  32886. $password = $this->io->askAndHideAnswer('Password: ');
  32887. $headers = array('Content-Type: application/x-www-form-urlencoded');
  32888. $apiUrl = $originUrl;
  32889. $data = http_build_query(array(
  32890. 'username' => $username,
  32891. 'password' => $password,
  32892. 'grant_type' => 'password',
  32893. ), '', '&');
  32894. $options = array(
  32895. 'retry-auth-failure' => false,
  32896. 'http' => array(
  32897. 'method' => 'POST',
  32898. 'header' => $headers,
  32899. 'content' => $data,
  32900. ),
  32901. );
  32902. $token = $this->httpDownloader->get($scheme.'://'.$apiUrl.'/oauth/token', $options)->decodeJson();
  32903. $this->io->writeError('Token successfully created');
  32904. return $token;
  32905. }
  32906. }
  32907. <?php declare(strict_types=1);
  32908. namespace Composer\Util;
  32909. use Composer\Config;
  32910. use Composer\IO\IOInterface;
  32911. use Composer\Pcre\Preg;
  32912. class Hg
  32913. {
  32914. private static $version = false;
  32915. private $io;
  32916. private $config;
  32917. private $process;
  32918. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  32919. {
  32920. $this->io = $io;
  32921. $this->config = $config;
  32922. $this->process = $process;
  32923. }
  32924. public function runCommand(callable $commandCallable, string $url, ?string $cwd): void
  32925. {
  32926. $this->config->prohibitUrlByConfig($url, $this->io);
  32927. $command = call_user_func($commandCallable, $url);
  32928. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32929. return;
  32930. }
  32931. if (Preg::isMatch('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  32932. $auth = $this->io->getAuthentication($match[5]);
  32933. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  32934. $command = call_user_func($commandCallable, $authenticatedUrl);
  32935. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  32936. return;
  32937. }
  32938. $error = $this->process->getErrorOutput();
  32939. } else {
  32940. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  32941. }
  32942. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  32943. }
  32944. private function throwException($message, string $url): void
  32945. {
  32946. if (null === self::getVersion($this->process)) {
  32947. throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  32948. }
  32949. throw new \RuntimeException(Url::sanitize($message));
  32950. }
  32951. public static function getVersion(ProcessExecutor $process): ?string
  32952. {
  32953. if (false === self::$version) {
  32954. self::$version = null;
  32955. if (0 === $process->execute('hg --version', $output) && Preg::isMatch('/^.+? (\d+(?:\.\d+)+)\)?\r?\n/', $output, $matches)) {
  32956. self::$version = $matches[1];
  32957. }
  32958. }
  32959. return self::$version;
  32960. }
  32961. }
  32962. <?php declare(strict_types=1);
  32963. namespace Composer\Util\Http;
  32964. use Composer\Config;
  32965. use Composer\Downloader\MaxFileSizeExceededException;
  32966. use Composer\IO\IOInterface;
  32967. use Composer\Downloader\TransportException;
  32968. use Composer\Pcre\Preg;
  32969. use Composer\Util\StreamContextFactory;
  32970. use Composer\Util\AuthHelper;
  32971. use Composer\Util\Url;
  32972. use Composer\Util\HttpDownloader;
  32973. use React\Promise\Promise;
  32974. class CurlDownloader
  32975. {
  32976. private $multiHandle;
  32977. private $shareHandle;
  32978. private $jobs = array();
  32979. private $io;
  32980. private $config;
  32981. private $authHelper;
  32982. private $selectTimeout = 5.0;
  32983. private $maxRedirects = 20;
  32984. private $maxRetries = 3;
  32985. private $proxyManager;
  32986. private $supportsSecureProxy;
  32987. protected $multiErrors = array(
  32988. CURLM_BAD_HANDLE => array('CURLM_BAD_HANDLE', 'The passed-in handle is not a valid CURLM handle.'),
  32989. CURLM_BAD_EASY_HANDLE => array('CURLM_BAD_EASY_HANDLE', "An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle."),
  32990. CURLM_OUT_OF_MEMORY => array('CURLM_OUT_OF_MEMORY', 'You are doomed.'),
  32991. CURLM_INTERNAL_ERROR => array('CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!'),
  32992. );
  32993. private static $options = array(
  32994. 'http' => array(
  32995. 'method' => CURLOPT_CUSTOMREQUEST,
  32996. 'content' => CURLOPT_POSTFIELDS,
  32997. 'header' => CURLOPT_HTTPHEADER,
  32998. 'timeout' => CURLOPT_TIMEOUT,
  32999. ),
  33000. 'ssl' => array(
  33001. 'cafile' => CURLOPT_CAINFO,
  33002. 'capath' => CURLOPT_CAPATH,
  33003. 'verify_peer' => CURLOPT_SSL_VERIFYPEER,
  33004. 'verify_peer_name' => CURLOPT_SSL_VERIFYHOST,
  33005. 'local_cert' => CURLOPT_SSLCERT,
  33006. 'local_pk' => CURLOPT_SSLKEY,
  33007. 'passphrase' => CURLOPT_SSLKEYPASSWD,
  33008. ),
  33009. );
  33010. private static $timeInfo = array(
  33011. 'total_time' => true,
  33012. 'namelookup_time' => true,
  33013. 'connect_time' => true,
  33014. 'pretransfer_time' => true,
  33015. 'starttransfer_time' => true,
  33016. 'redirect_time' => true,
  33017. );
  33018. public function __construct(IOInterface $io, Config $config, array $options = array(), bool $disableTls = false)
  33019. {
  33020. $this->io = $io;
  33021. $this->config = $config;
  33022. $this->multiHandle = $mh = curl_multi_init();
  33023. if (function_exists('curl_multi_setopt')) {
  33024. curl_multi_setopt($mh, CURLMOPT_PIPELINING, PHP_VERSION_ID >= 70400 ? 2 : 3);
  33025. if (defined('CURLMOPT_MAX_HOST_CONNECTIONS') && !defined('HHVM_VERSION')) {
  33026. curl_multi_setopt($mh, CURLMOPT_MAX_HOST_CONNECTIONS, 8);
  33027. }
  33028. }
  33029. if (function_exists('curl_share_init')) {
  33030. $this->shareHandle = $sh = curl_share_init();
  33031. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
  33032. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
  33033. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
  33034. }
  33035. $this->authHelper = new AuthHelper($io, $config);
  33036. $this->proxyManager = ProxyManager::getInstance();
  33037. $version = curl_version();
  33038. $features = $version['features'];
  33039. $this->supportsSecureProxy = defined('CURL_VERSION_HTTPS_PROXY') && ($features & CURL_VERSION_HTTPS_PROXY);
  33040. }
  33041. public function download(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null): int
  33042. {
  33043. $attributes = array();
  33044. if (isset($options['retry-auth-failure'])) {
  33045. $attributes['retryAuthFailure'] = $options['retry-auth-failure'];
  33046. unset($options['retry-auth-failure']);
  33047. }
  33048. return $this->initDownload($resolve, $reject, $origin, $url, $options, $copyTo, $attributes);
  33049. }
  33050. private function initDownload(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null, array $attributes = array()): int
  33051. {
  33052. $attributes['retryAuthFailure'] = $attributes['retryAuthFailure'] ?? true;
  33053. $attributes['redirects'] = $attributes['redirects'] ?? 0;
  33054. $attributes['retries'] = $attributes['retries'] ?? 0;
  33055. $attributes['storeAuth'] = $attributes['storeAuth'] ?? false;
  33056. $originalOptions = $options;
  33057. if (!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $url) || (false === strpos($url, '$') && false === strpos($url, '%24'))) {
  33058. $this->config->prohibitUrlByConfig($url, $this->io);
  33059. }
  33060. $curlHandle = curl_init();
  33061. $headerHandle = fopen('php://temp/maxmemory:32768', 'w+b');
  33062. if (false === $headerHandle) {
  33063. throw new \RuntimeException('Failed to open a temp stream to store curl headers');
  33064. }
  33065. if ($copyTo) {
  33066. $errorMessage = '';
  33067. set_error_handler(function ($code, $msg) use (&$errorMessage): void {
  33068. if ($errorMessage) {
  33069. $errorMessage .= "\n";
  33070. }
  33071. $errorMessage .= Preg::replace('{^fopen\(.*?\): }', '', $msg);
  33072. });
  33073. $bodyHandle = fopen($copyTo.'~', 'w+b');
  33074. restore_error_handler();
  33075. if (!$bodyHandle) {
  33076. throw new TransportException('The "'.$url.'" file could not be written to '.$copyTo.': '.$errorMessage);
  33077. }
  33078. } else {
  33079. $bodyHandle = @fopen('php://temp/maxmemory:524288', 'w+b');
  33080. }
  33081. curl_setopt($curlHandle, CURLOPT_URL, $url);
  33082. curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, false);
  33083. curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 10);
  33084. curl_setopt($curlHandle, CURLOPT_TIMEOUT, max((int) ini_get("default_socket_timeout"), 300));
  33085. curl_setopt($curlHandle, CURLOPT_WRITEHEADER, $headerHandle);
  33086. curl_setopt($curlHandle, CURLOPT_FILE, $bodyHandle);
  33087. curl_setopt($curlHandle, CURLOPT_ENCODING, "");
  33088. curl_setopt($curlHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
  33089. if (function_exists('curl_share_init')) {
  33090. curl_setopt($curlHandle, CURLOPT_SHARE, $this->shareHandle);
  33091. }
  33092. if (!isset($options['http']['header'])) {
  33093. $options['http']['header'] = array();
  33094. }
  33095. $options['http']['header'] = array_diff($options['http']['header'], array('Connection: close'));
  33096. $options['http']['header'][] = 'Connection: keep-alive';
  33097. $version = curl_version();
  33098. $features = $version['features'];
  33099. if (0 === strpos($url, 'https://') && \defined('CURL_VERSION_HTTP2') && \defined('CURL_HTTP_VERSION_2_0') && (CURL_VERSION_HTTP2 & $features)) {
  33100. curl_setopt($curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
  33101. }
  33102. $options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
  33103. $options = StreamContextFactory::initOptions($url, $options, true);
  33104. foreach (self::$options as $type => $curlOptions) {
  33105. foreach ($curlOptions as $name => $curlOption) {
  33106. if (isset($options[$type][$name])) {
  33107. if ($type === 'ssl' && $name === 'verify_peer_name') {
  33108. curl_setopt($curlHandle, $curlOption, $options[$type][$name] === true ? 2 : $options[$type][$name]);
  33109. } else {
  33110. curl_setopt($curlHandle, $curlOption, $options[$type][$name]);
  33111. }
  33112. }
  33113. }
  33114. }
  33115. $proxy = $this->proxyManager->getProxyForRequest($url);
  33116. curl_setopt($curlHandle, CURLOPT_PROXY, $proxy->getUrl());
  33117. if ($proxy->isSecure()) {
  33118. if (!$this->supportsSecureProxy) {
  33119. throw new TransportException('Connecting to a secure proxy using curl is not supported on PHP versions below 7.3.0.');
  33120. }
  33121. if (!empty($options['ssl']['cafile'])) {
  33122. curl_setopt($curlHandle, CURLOPT_PROXY_CAINFO, $options['ssl']['cafile']);
  33123. }
  33124. if (!empty($options['ssl']['capath'])) {
  33125. curl_setopt($curlHandle, CURLOPT_PROXY_CAPATH, $options['ssl']['capath']);
  33126. }
  33127. }
  33128. $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
  33129. $this->jobs[(int) $curlHandle] = array(
  33130. 'url' => $url,
  33131. 'origin' => $origin,
  33132. 'attributes' => $attributes,
  33133. 'options' => $originalOptions,
  33134. 'progress' => $progress,
  33135. 'curlHandle' => $curlHandle,
  33136. 'filename' => $copyTo,
  33137. 'headerHandle' => $headerHandle,
  33138. 'bodyHandle' => $bodyHandle,
  33139. 'resolve' => $resolve,
  33140. 'reject' => $reject,
  33141. );
  33142. $usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
  33143. $ifModified = false !== stripos(implode(',', $options['http']['header']), 'if-modified-since:') ? ' if modified' : '';
  33144. if ($attributes['redirects'] === 0 && $attributes['retries'] === 0) {
  33145. $this->io->writeError('Downloading ' . Url::sanitize($url) . $usingProxy . $ifModified, true, IOInterface::DEBUG);
  33146. }
  33147. $this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
  33148. return (int) $curlHandle;
  33149. }
  33150. public function abortRequest(int $id): void
  33151. {
  33152. if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) {
  33153. $job = $this->jobs[$id];
  33154. curl_multi_remove_handle($this->multiHandle, $job['curlHandle']);
  33155. curl_close($job['curlHandle']);
  33156. if (is_resource($job['headerHandle'])) {
  33157. fclose($job['headerHandle']);
  33158. }
  33159. if (is_resource($job['bodyHandle'])) {
  33160. fclose($job['bodyHandle']);
  33161. }
  33162. if (null !== $job['filename']) {
  33163. @unlink($job['filename'].'~');
  33164. }
  33165. unset($this->jobs[$id]);
  33166. }
  33167. }
  33168. public function tick(): void
  33169. {
  33170. static $timeoutWarning = false;
  33171. if (count($this->jobs) === 0) {
  33172. return;
  33173. }
  33174. $active = true;
  33175. $this->checkCurlResult(curl_multi_exec($this->multiHandle, $active));
  33176. if (-1 === curl_multi_select($this->multiHandle, $this->selectTimeout)) {
  33177. usleep(150);
  33178. }
  33179. while ($progress = curl_multi_info_read($this->multiHandle)) {
  33180. $curlHandle = $progress['handle'];
  33181. $result = $progress['result'];
  33182. $i = (int) $curlHandle;
  33183. if (!isset($this->jobs[$i])) {
  33184. continue;
  33185. }
  33186. $progress = curl_getinfo($curlHandle);
  33187. if (false === $progress) {
  33188. throw new \RuntimeException('Failed getting info from curl handle '.$i.' ('.$this->jobs[$i]['url'].')');
  33189. }
  33190. $job = $this->jobs[$i];
  33191. unset($this->jobs[$i]);
  33192. $error = curl_error($curlHandle);
  33193. $errno = curl_errno($curlHandle);
  33194. curl_multi_remove_handle($this->multiHandle, $curlHandle);
  33195. curl_close($curlHandle);
  33196. $headers = null;
  33197. $statusCode = null;
  33198. $response = null;
  33199. try {
  33200. if (CURLE_OK !== $errno || $error || $result !== CURLE_OK) {
  33201. $errno = $errno ?: $result;
  33202. if (!$error && function_exists('curl_strerror')) {
  33203. $error = curl_strerror($errno);
  33204. }
  33205. $progress['error_code'] = $errno;
  33206. if (
  33207. (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
  33208. && (
  33209. in_array($errno, array(7 , 16 , 92 , 6 ), true)
  33210. || ($errno === 35 && false !== strpos($error, 'Connection reset by peer'))
  33211. ) && $job['attributes']['retries'] < $this->maxRetries
  33212. ) {
  33213. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to curl error '. $errno, true, IOInterface::DEBUG);
  33214. $this->restartJob($job, $job['url'], array('retries' => $job['attributes']['retries'] + 1));
  33215. continue;
  33216. }
  33217. if ($errno === 28 && PHP_VERSION_ID >= 70300 && $progress['namelookup_time'] == 0 && !$timeoutWarning) {
  33218. $timeoutWarning = true;
  33219. $this->io->writeError('<warning>A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.</warning>');
  33220. }
  33221. throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error);
  33222. }
  33223. $statusCode = $progress['http_code'];
  33224. rewind($job['headerHandle']);
  33225. $headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle'])));
  33226. fclose($job['headerHandle']);
  33227. if ($statusCode === 0) {
  33228. throw new \LogicException('Received unexpected http status code 0 without error for '.Url::sanitize($progress['url']).': headers '.var_export($headers, true).' curl info '.var_export($progress, true));
  33229. }
  33230. if (null !== $job['filename']) {
  33231. $contents = $job['filename'].'~';
  33232. if ($statusCode >= 300) {
  33233. rewind($job['bodyHandle']);
  33234. $contents = stream_get_contents($job['bodyHandle']);
  33235. }
  33236. $response = new CurlResponse(array('url' => $progress['url']), $statusCode, $headers, $contents, $progress);
  33237. $this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
  33238. } else {
  33239. rewind($job['bodyHandle']);
  33240. $contents = stream_get_contents($job['bodyHandle']);
  33241. $response = new CurlResponse(array('url' => $progress['url']), $statusCode, $headers, $contents, $progress);
  33242. $this->io->writeError('['.$statusCode.'] '.Url::sanitize($progress['url']), true, IOInterface::DEBUG);
  33243. }
  33244. fclose($job['bodyHandle']);
  33245. if ($response->getStatusCode() >= 400 && $response->getHeader('content-type') === 'application/json') {
  33246. HttpDownloader::outputWarnings($this->io, $job['origin'], json_decode($response->getBody(), true));
  33247. }
  33248. $result = $this->isAuthenticatedRetryNeeded($job, $response);
  33249. if ($result['retry']) {
  33250. $this->restartJob($job, $job['url'], array('storeAuth' => $result['storeAuth']));
  33251. continue;
  33252. }
  33253. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $job['attributes']['redirects'] < $this->maxRedirects) {
  33254. $location = $this->handleRedirect($job, $response);
  33255. if ($location) {
  33256. $this->restartJob($job, $location, array('redirects' => $job['attributes']['redirects'] + 1));
  33257. continue;
  33258. }
  33259. }
  33260. if ($statusCode >= 400 && $statusCode <= 599) {
  33261. if (
  33262. (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
  33263. && in_array($statusCode, array(423, 425, 500, 502, 503, 504, 507, 510), true)
  33264. && $job['attributes']['retries'] < $this->maxRetries
  33265. ) {
  33266. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to status code '. $statusCode, true, IOInterface::DEBUG);
  33267. $this->restartJob($job, $job['url'], array('retries' => $job['attributes']['retries'] + 1));
  33268. continue;
  33269. }
  33270. throw $this->failResponse($job, $response, $response->getStatusMessage());
  33271. }
  33272. if ($job['attributes']['storeAuth']) {
  33273. $this->authHelper->storeAuth($job['origin'], $job['attributes']['storeAuth']);
  33274. }
  33275. if (null !== $job['filename']) {
  33276. rename($job['filename'].'~', $job['filename']);
  33277. call_user_func($job['resolve'], $response);
  33278. } else {
  33279. call_user_func($job['resolve'], $response);
  33280. }
  33281. } catch (\Exception $e) {
  33282. if ($e instanceof TransportException) {
  33283. if (null !== $headers) {
  33284. $e->setHeaders($headers);
  33285. $e->setStatusCode($statusCode);
  33286. }
  33287. if (null !== $response) {
  33288. $e->setResponse($response->getBody());
  33289. }
  33290. $e->setResponseInfo($progress);
  33291. }
  33292. $this->rejectJob($job, $e);
  33293. }
  33294. }
  33295. foreach ($this->jobs as $i => $curlHandle) {
  33296. if (!isset($this->jobs[$i])) {
  33297. continue;
  33298. }
  33299. $curlHandle = $this->jobs[$i]['curlHandle'];
  33300. $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
  33301. if ($this->jobs[$i]['progress'] !== $progress) {
  33302. $this->jobs[$i]['progress'] = $progress;
  33303. if (isset($this->jobs[$i]['options']['max_file_size'])) {
  33304. if ($this->jobs[$i]['options']['max_file_size'] < $progress['download_content_length']) {
  33305. $this->rejectJob($this->jobs[$i], new MaxFileSizeExceededException('Maximum allowed download size reached. Content-length header indicates ' . $progress['download_content_length'] . ' bytes. Allowed ' . $this->jobs[$i]['options']['max_file_size'] . ' bytes'));
  33306. }
  33307. if ($this->jobs[$i]['options']['max_file_size'] < $progress['size_download']) {
  33308. $this->rejectJob($this->jobs[$i], new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . $progress['size_download'] . ' of allowed ' . $this->jobs[$i]['options']['max_file_size'] . ' bytes'));
  33309. }
  33310. }
  33311. }
  33312. }
  33313. }
  33314. private function handleRedirect(array $job, Response $response): string
  33315. {
  33316. if ($locationHeader = $response->getHeader('location')) {
  33317. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  33318. $targetUrl = $locationHeader;
  33319. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  33320. $targetUrl = parse_url($job['url'], PHP_URL_SCHEME).':'.$locationHeader;
  33321. } elseif ('/' === $locationHeader[0]) {
  33322. $urlHost = parse_url($job['url'], PHP_URL_HOST);
  33323. $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $job['url']);
  33324. } else {
  33325. $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $job['url']);
  33326. }
  33327. }
  33328. if (!empty($targetUrl)) {
  33329. $this->io->writeError(sprintf('Following redirect (%u) %s', $job['attributes']['redirects'] + 1, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
  33330. return $targetUrl;
  33331. }
  33332. throw new TransportException('The "'.$job['url'].'" file could not be downloaded, got redirect without Location ('.$response->getStatusMessage().')');
  33333. }
  33334. private function isAuthenticatedRetryNeeded(array $job, Response $response): array
  33335. {
  33336. if (in_array($response->getStatusCode(), array(401, 403)) && $job['attributes']['retryAuthFailure']) {
  33337. $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], $response->getStatusCode(), $response->getStatusMessage(), $response->getHeaders());
  33338. if ($result['retry']) {
  33339. return $result;
  33340. }
  33341. }
  33342. $locationHeader = $response->getHeader('location');
  33343. $needsAuthRetry = false;
  33344. if (
  33345. $job['origin'] === 'bitbucket.org'
  33346. && !$this->authHelper->isPublicBitBucketDownload($job['url'])
  33347. && substr($job['url'], -4) === '.zip'
  33348. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  33349. && Preg::isMatch('{^text/html\b}i', $response->getHeader('content-type'))
  33350. ) {
  33351. $needsAuthRetry = 'Bitbucket requires authentication and it was not provided';
  33352. }
  33353. if (
  33354. $response->getStatusCode() === 404
  33355. && in_array($job['origin'], $this->config->get('gitlab-domains'), true)
  33356. && false !== strpos($job['url'], 'archive.zip')
  33357. ) {
  33358. $needsAuthRetry = 'GitLab requires authentication and it was not provided';
  33359. }
  33360. if ($needsAuthRetry) {
  33361. if ($job['attributes']['retryAuthFailure']) {
  33362. $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], 401);
  33363. if ($result['retry']) {
  33364. return $result;
  33365. }
  33366. }
  33367. throw $this->failResponse($job, $response, $needsAuthRetry);
  33368. }
  33369. return array('retry' => false, 'storeAuth' => false);
  33370. }
  33371. private function restartJob(array $job, string $url, array $attributes = array()): void
  33372. {
  33373. if (null !== $job['filename']) {
  33374. @unlink($job['filename'].'~');
  33375. }
  33376. $attributes = array_merge($job['attributes'], $attributes);
  33377. $origin = Url::getOrigin($this->config, $url);
  33378. $this->initDownload($job['resolve'], $job['reject'], $origin, $url, $job['options'], $job['filename'], $attributes);
  33379. }
  33380. private function failResponse(array $job, Response $response, string $errorMessage): TransportException
  33381. {
  33382. if (null !== $job['filename']) {
  33383. @unlink($job['filename'].'~');
  33384. }
  33385. $details = '';
  33386. if (in_array(strtolower($response->getHeader('content-type')), array('application/json', 'application/json; charset=utf-8'), true)) {
  33387. $details = ':'.PHP_EOL.substr($response->getBody(), 0, 200).(strlen($response->getBody()) > 200 ? '...' : '');
  33388. }
  33389. return new TransportException('The "'.$job['url'].'" file could not be downloaded ('.$errorMessage.')' . $details, $response->getStatusCode());
  33390. }
  33391. private function rejectJob(array $job, \Exception $e): void
  33392. {
  33393. if (is_resource($job['headerHandle'])) {
  33394. fclose($job['headerHandle']);
  33395. }
  33396. if (is_resource($job['bodyHandle'])) {
  33397. fclose($job['bodyHandle']);
  33398. }
  33399. if (null !== $job['filename']) {
  33400. @unlink($job['filename'].'~');
  33401. }
  33402. call_user_func($job['reject'], $e);
  33403. }
  33404. private function checkCurlResult(int $code): void
  33405. {
  33406. if ($code != CURLM_OK && $code != CURLM_CALL_MULTI_PERFORM) {
  33407. throw new \RuntimeException(
  33408. isset($this->multiErrors[$code])
  33409. ? "cURL error: {$code} ({$this->multiErrors[$code][0]}): cURL message: {$this->multiErrors[$code][1]}"
  33410. : 'Unexpected cURL error: ' . $code
  33411. );
  33412. }
  33413. }
  33414. }
  33415. <?php declare(strict_types=1);
  33416. namespace Composer\Util\Http;
  33417. class CurlResponse extends Response
  33418. {
  33419. private $curlInfo;
  33420. public function __construct(array $request, $code, array $headers, $body, array $curlInfo)
  33421. {
  33422. parent::__construct($request, $code, $headers, $body);
  33423. $this->curlInfo = $curlInfo;
  33424. }
  33425. public function getCurlInfo(): array
  33426. {
  33427. return $this->curlInfo;
  33428. }
  33429. }
  33430. <?php declare(strict_types=1);
  33431. namespace Composer\Util\Http;
  33432. class ProxyHelper
  33433. {
  33434. public static function getProxyData(): array
  33435. {
  33436. $httpProxy = null;
  33437. $httpsProxy = null;
  33438. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  33439. if ($env = self::getProxyEnv(array('http_proxy', 'HTTP_PROXY'), $name)) {
  33440. $httpProxy = self::checkProxy($env, $name);
  33441. }
  33442. }
  33443. if ($env = self::getProxyEnv(array('CGI_HTTP_PROXY'), $name)) {
  33444. $httpProxy = self::checkProxy($env, $name);
  33445. }
  33446. if ($env = self::getProxyEnv(array('https_proxy', 'HTTPS_PROXY'), $name)) {
  33447. $httpsProxy = self::checkProxy($env, $name);
  33448. } else {
  33449. $httpsProxy = $httpProxy;
  33450. }
  33451. $noProxy = self::getProxyEnv(array('no_proxy', 'NO_PROXY'), $name);
  33452. return array($httpProxy, $httpsProxy, $noProxy);
  33453. }
  33454. public static function getContextOptions(string $proxyUrl): array
  33455. {
  33456. $proxy = parse_url($proxyUrl);
  33457. $proxyUrl = self::formatParsedUrl($proxy, false);
  33458. $proxyUrl = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyUrl);
  33459. $options['http']['proxy'] = $proxyUrl;
  33460. if (isset($proxy['user'])) {
  33461. $auth = rawurldecode($proxy['user']);
  33462. if (isset($proxy['pass'])) {
  33463. $auth .= ':' . rawurldecode($proxy['pass']);
  33464. }
  33465. $auth = base64_encode($auth);
  33466. $options['http']['header'] = "Proxy-Authorization: Basic {$auth}";
  33467. }
  33468. return $options;
  33469. }
  33470. public static function setRequestFullUri(string $requestUrl, array &$options): void
  33471. {
  33472. if ('http' === parse_url($requestUrl, PHP_URL_SCHEME)) {
  33473. $options['http']['request_fulluri'] = true;
  33474. } else {
  33475. unset($options['http']['request_fulluri']);
  33476. }
  33477. }
  33478. private static function getProxyEnv(array $names, ?string &$name): ?string
  33479. {
  33480. foreach ($names as $name) {
  33481. if (!empty($_SERVER[$name])) {
  33482. return $_SERVER[$name];
  33483. }
  33484. }
  33485. return null;
  33486. }
  33487. private static function checkProxy(string $proxyUrl, string $envName): string
  33488. {
  33489. $error = sprintf('malformed %s url', $envName);
  33490. $proxy = parse_url($proxyUrl);
  33491. if (!isset($proxy['host'])) {
  33492. throw new \RuntimeException($error);
  33493. }
  33494. $proxyUrl = self::formatParsedUrl($proxy, true);
  33495. if (!parse_url($proxyUrl, PHP_URL_PORT)) {
  33496. throw new \RuntimeException($error);
  33497. }
  33498. return $proxyUrl;
  33499. }
  33500. private static function formatParsedUrl(array $proxy, bool $includeAuth): string
  33501. {
  33502. $proxyUrl = isset($proxy['scheme']) ? strtolower($proxy['scheme']) . '://' : '';
  33503. if ($includeAuth && isset($proxy['user'])) {
  33504. $proxyUrl .= $proxy['user'];
  33505. if (isset($proxy['pass'])) {
  33506. $proxyUrl .= ':' . $proxy['pass'];
  33507. }
  33508. $proxyUrl .= '@';
  33509. }
  33510. $proxyUrl .= $proxy['host'];
  33511. if (isset($proxy['port'])) {
  33512. $proxyUrl .= ':' . $proxy['port'];
  33513. } elseif (strpos($proxyUrl, 'http://') === 0) {
  33514. $proxyUrl .= ':80';
  33515. } elseif (strpos($proxyUrl, 'https://') === 0) {
  33516. $proxyUrl .= ':443';
  33517. }
  33518. return $proxyUrl;
  33519. }
  33520. }
  33521. <?php declare(strict_types=1);
  33522. namespace Composer\Util\Http;
  33523. use Composer\Downloader\TransportException;
  33524. use Composer\Util\NoProxyPattern;
  33525. use Composer\Util\Url;
  33526. class ProxyManager
  33527. {
  33528. private $error = null;
  33529. private $fullProxy;
  33530. private $safeProxy;
  33531. private $streams;
  33532. private $hasProxy;
  33533. private $info = null;
  33534. private $noProxyHandler = null;
  33535. private static $instance = null;
  33536. private function __construct()
  33537. {
  33538. $this->fullProxy = $this->safeProxy = array(
  33539. 'http' => null,
  33540. 'https' => null,
  33541. );
  33542. $this->streams['http'] = $this->streams['https'] = array(
  33543. 'options' => null,
  33544. );
  33545. $this->hasProxy = false;
  33546. $this->initProxyData();
  33547. }
  33548. public static function getInstance(): ProxyManager
  33549. {
  33550. if (!self::$instance) {
  33551. self::$instance = new self();
  33552. }
  33553. return self::$instance;
  33554. }
  33555. public static function reset(): void
  33556. {
  33557. self::$instance = null;
  33558. }
  33559. public function getProxyForRequest(string $requestUrl): RequestProxy
  33560. {
  33561. if ($this->error) {
  33562. throw new TransportException('Unable to use a proxy: '.$this->error);
  33563. }
  33564. $scheme = parse_url($requestUrl, PHP_URL_SCHEME) ?: 'http';
  33565. $proxyUrl = '';
  33566. $options = array();
  33567. $formattedProxyUrl = '';
  33568. if ($this->hasProxy && in_array($scheme, array('http', 'https'), true) && $this->fullProxy[$scheme]) {
  33569. if ($this->noProxy($requestUrl)) {
  33570. $formattedProxyUrl = 'excluded by no_proxy';
  33571. } else {
  33572. $proxyUrl = $this->fullProxy[$scheme];
  33573. $options = $this->streams[$scheme]['options'];
  33574. ProxyHelper::setRequestFullUri($requestUrl, $options);
  33575. $formattedProxyUrl = $this->safeProxy[$scheme];
  33576. }
  33577. }
  33578. return new RequestProxy($proxyUrl, $options, $formattedProxyUrl);
  33579. }
  33580. public function isProxying(): bool
  33581. {
  33582. return $this->hasProxy;
  33583. }
  33584. public function getFormattedProxy(): ?string
  33585. {
  33586. return $this->hasProxy ? $this->info : $this->error;
  33587. }
  33588. private function initProxyData(): void
  33589. {
  33590. try {
  33591. list($httpProxy, $httpsProxy, $noProxy) = ProxyHelper::getProxyData();
  33592. } catch (\RuntimeException $e) {
  33593. $this->error = $e->getMessage();
  33594. return;
  33595. }
  33596. $info = array();
  33597. if ($httpProxy) {
  33598. $info[] = $this->setData($httpProxy, 'http');
  33599. }
  33600. if ($httpsProxy) {
  33601. $info[] = $this->setData($httpsProxy, 'https');
  33602. }
  33603. if ($this->hasProxy) {
  33604. $this->info = implode(', ', $info);
  33605. if ($noProxy) {
  33606. $this->noProxyHandler = new NoProxyPattern($noProxy);
  33607. }
  33608. }
  33609. }
  33610. private function setData($url, $scheme): string
  33611. {
  33612. $safeProxy = Url::sanitize($url);
  33613. $this->fullProxy[$scheme] = $url;
  33614. $this->safeProxy[$scheme] = $safeProxy;
  33615. $this->streams[$scheme]['options'] = ProxyHelper::getContextOptions($url);
  33616. $this->hasProxy = true;
  33617. return sprintf('%s=%s', $scheme, $safeProxy);
  33618. }
  33619. private function noProxy(string $requestUrl): bool
  33620. {
  33621. return $this->noProxyHandler && $this->noProxyHandler->test($requestUrl);
  33622. }
  33623. }
  33624. <?php declare(strict_types=1);
  33625. namespace Composer\Util\Http;
  33626. use Composer\Util\Url;
  33627. class RequestProxy
  33628. {
  33629. private $contextOptions;
  33630. private $isSecure;
  33631. private $formattedUrl;
  33632. private $url;
  33633. public function __construct(string $url, array $contextOptions, string $formattedUrl)
  33634. {
  33635. $this->url = $url;
  33636. $this->contextOptions = $contextOptions;
  33637. $this->formattedUrl = $formattedUrl;
  33638. $this->isSecure = 0 === strpos($url, 'https://');
  33639. }
  33640. public function getContextOptions(): array
  33641. {
  33642. return $this->contextOptions;
  33643. }
  33644. public function getFormattedUrl(?string $format = ''): string
  33645. {
  33646. $result = '';
  33647. if ($this->formattedUrl) {
  33648. $format = $format ?: '%s';
  33649. $result = sprintf($format, $this->formattedUrl);
  33650. }
  33651. return $result;
  33652. }
  33653. public function getUrl(): string
  33654. {
  33655. return $this->url;
  33656. }
  33657. public function isSecure(): bool
  33658. {
  33659. return $this->isSecure;
  33660. }
  33661. }
  33662. <?php declare(strict_types=1);
  33663. namespace Composer\Util\Http;
  33664. use Composer\Json\JsonFile;
  33665. use Composer\Pcre\Preg;
  33666. use Composer\Util\HttpDownloader;
  33667. class Response
  33668. {
  33669. private $request;
  33670. private $code;
  33671. private $headers;
  33672. private $body;
  33673. public function __construct(array $request, ?int $code, array $headers, ?string $body)
  33674. {
  33675. if (!isset($request['url'])) {
  33676. throw new \LogicException('url key missing from request array');
  33677. }
  33678. $this->request = $request;
  33679. $this->code = (int) $code;
  33680. $this->headers = $headers;
  33681. $this->body = $body;
  33682. }
  33683. public function getStatusCode(): int
  33684. {
  33685. return $this->code;
  33686. }
  33687. public function getStatusMessage(): ?string
  33688. {
  33689. $value = null;
  33690. foreach ($this->headers as $header) {
  33691. if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
  33692. $value = $header;
  33693. }
  33694. }
  33695. return $value;
  33696. }
  33697. public function getHeaders(): array
  33698. {
  33699. return $this->headers;
  33700. }
  33701. public function getHeader(string $name): ?string
  33702. {
  33703. return self::findHeaderValue($this->headers, $name);
  33704. }
  33705. public function getBody(): ?string
  33706. {
  33707. return $this->body;
  33708. }
  33709. public function decodeJson()
  33710. {
  33711. return JsonFile::parseJson($this->body, $this->request['url']);
  33712. }
  33713. public function collect(): void
  33714. {
  33715. $this->request = $this->code = $this->headers = $this->body = null;
  33716. }
  33717. public static function findHeaderValue(array $headers, string $name): ?string
  33718. {
  33719. $value = null;
  33720. foreach ($headers as $header) {
  33721. if (Preg::isMatch('{^'.preg_quote($name).':\s*(.+?)\s*$}i', $header, $match)) {
  33722. $value = $match[1];
  33723. }
  33724. }
  33725. return $value;
  33726. }
  33727. }
  33728. <?php declare(strict_types=1);
  33729. namespace Composer\Util;
  33730. use Composer\Config;
  33731. use Composer\IO\IOInterface;
  33732. use Composer\Downloader\TransportException;
  33733. use Composer\Pcre\Preg;
  33734. use Composer\Util\Http\Response;
  33735. use Composer\Util\Http\CurlDownloader;
  33736. use Composer\Composer;
  33737. use Composer\Package\Version\VersionParser;
  33738. use Composer\Semver\Constraint\Constraint;
  33739. use Composer\Exception\IrrecoverableDownloadException;
  33740. use React\Promise\Promise;
  33741. use React\Promise\PromiseInterface;
  33742. class HttpDownloader
  33743. {
  33744. private const STATUS_QUEUED = 1;
  33745. private const STATUS_STARTED = 2;
  33746. private const STATUS_COMPLETED = 3;
  33747. private const STATUS_FAILED = 4;
  33748. private const STATUS_ABORTED = 5;
  33749. private $io;
  33750. private $config;
  33751. private $jobs = array();
  33752. private $options = array();
  33753. private $runningJobs = 0;
  33754. private $maxJobs = 12;
  33755. private $curl;
  33756. private $rfs;
  33757. private $idGen = 0;
  33758. private $disabled;
  33759. private $allowAsync = false;
  33760. public function __construct(IOInterface $io, Config $config, array $options = array(), bool $disableTls = false)
  33761. {
  33762. $this->io = $io;
  33763. $this->disabled = (bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK');
  33764. if ($disableTls === false) {
  33765. $this->options = StreamContextFactory::getTlsDefaults($options, $io);
  33766. }
  33767. $this->options = array_replace_recursive($this->options, $options);
  33768. $this->config = $config;
  33769. if (self::isCurlEnabled()) {
  33770. $this->curl = new CurlDownloader($io, $config, $options, $disableTls);
  33771. }
  33772. $this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls);
  33773. if (is_numeric($maxJobs = Platform::getEnv('COMPOSER_MAX_PARALLEL_HTTP'))) {
  33774. $this->maxJobs = max(1, min(50, (int) $maxJobs));
  33775. }
  33776. }
  33777. public function get(string $url, array $options = array())
  33778. {
  33779. list($job) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => null), true);
  33780. $this->wait($job['id']);
  33781. $response = $this->getResponse($job['id']);
  33782. return $response;
  33783. }
  33784. public function add(string $url, array $options = array())
  33785. {
  33786. list(, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => null));
  33787. return $promise;
  33788. }
  33789. public function copy(string $url, string $to, array $options = array())
  33790. {
  33791. list($job) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => $to), true);
  33792. $this->wait($job['id']);
  33793. return $this->getResponse($job['id']);
  33794. }
  33795. public function addCopy(string $url, string $to, array $options = array())
  33796. {
  33797. list(, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => $to));
  33798. return $promise;
  33799. }
  33800. public function getOptions()
  33801. {
  33802. return $this->options;
  33803. }
  33804. public function setOptions(array $options)
  33805. {
  33806. $this->options = array_replace_recursive($this->options, $options);
  33807. }
  33808. private function addJob(array $request, bool $sync = false): array
  33809. {
  33810. $request['options'] = array_replace_recursive($this->options, $request['options']);
  33811. $job = array(
  33812. 'id' => $this->idGen++,
  33813. 'status' => self::STATUS_QUEUED,
  33814. 'request' => $request,
  33815. 'sync' => $sync,
  33816. 'origin' => Url::getOrigin($this->config, $request['url']),
  33817. );
  33818. if (!$sync && !$this->allowAsync) {
  33819. throw new \LogicException('You must use the HttpDownloader instance which is part of a Composer\Loop instance to be able to run async http requests');
  33820. }
  33821. if (Preg::isMatch('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $request['url'], $match)) {
  33822. $this->io->setAuthentication($job['origin'], rawurldecode($match[1]), rawurldecode($match[2]));
  33823. }
  33824. $rfs = $this->rfs;
  33825. if ($this->canUseCurl($job)) {
  33826. $resolver = function ($resolve, $reject) use (&$job): void {
  33827. $job['status'] = HttpDownloader::STATUS_QUEUED;
  33828. $job['resolve'] = $resolve;
  33829. $job['reject'] = $reject;
  33830. };
  33831. } else {
  33832. $resolver = function ($resolve, $reject) use (&$job, $rfs): void {
  33833. $url = $job['request']['url'];
  33834. $options = $job['request']['options'];
  33835. $job['status'] = HttpDownloader::STATUS_STARTED;
  33836. if ($job['request']['copyTo']) {
  33837. $rfs->copy($job['origin'], $url, $job['request']['copyTo'], false , $options);
  33838. $headers = $rfs->getLastHeaders();
  33839. $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $job['request']['copyTo'].'~');
  33840. $resolve($response);
  33841. } else {
  33842. $body = $rfs->getContents($job['origin'], $url, false , $options);
  33843. $headers = $rfs->getLastHeaders();
  33844. $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $body);
  33845. $resolve($response);
  33846. }
  33847. };
  33848. }
  33849. $curl = $this->curl;
  33850. $canceler = function () use (&$job, $curl): void {
  33851. if ($job['status'] === HttpDownloader::STATUS_QUEUED) {
  33852. $job['status'] = HttpDownloader::STATUS_ABORTED;
  33853. }
  33854. if ($job['status'] !== HttpDownloader::STATUS_STARTED) {
  33855. return;
  33856. }
  33857. $job['status'] = HttpDownloader::STATUS_ABORTED;
  33858. if (isset($job['curl_id'])) {
  33859. $curl->abortRequest($job['curl_id']);
  33860. }
  33861. throw new IrrecoverableDownloadException('Download of ' . Url::sanitize($job['request']['url']) . ' canceled');
  33862. };
  33863. $promise = new Promise($resolver, $canceler);
  33864. $promise = $promise->then(function ($response) use (&$job) {
  33865. $job['status'] = HttpDownloader::STATUS_COMPLETED;
  33866. $job['response'] = $response;
  33867. $this->markJobDone();
  33868. return $response;
  33869. }, function ($e) use (&$job): void {
  33870. $job['status'] = HttpDownloader::STATUS_FAILED;
  33871. $job['exception'] = $e;
  33872. $this->markJobDone();
  33873. throw $e;
  33874. });
  33875. $this->jobs[$job['id']] = &$job;
  33876. if ($this->runningJobs < $this->maxJobs) {
  33877. $this->startJob($job['id']);
  33878. }
  33879. return array($job, $promise);
  33880. }
  33881. private function startJob(int $id): void
  33882. {
  33883. $job = &$this->jobs[$id];
  33884. if ($job['status'] !== self::STATUS_QUEUED) {
  33885. return;
  33886. }
  33887. $job['status'] = self::STATUS_STARTED;
  33888. $this->runningJobs++;
  33889. $resolve = $job['resolve'];
  33890. $reject = $job['reject'];
  33891. $url = $job['request']['url'];
  33892. $options = $job['request']['options'];
  33893. $origin = $job['origin'];
  33894. if ($this->disabled) {
  33895. if (isset($job['request']['options']['http']['header']) && false !== stripos(implode('', $job['request']['options']['http']['header']), 'if-modified-since')) {
  33896. $resolve(new Response(array('url' => $url), 304, array(), ''));
  33897. } else {
  33898. $e = new TransportException('Network disabled, request canceled: '.Url::sanitize($url), 499);
  33899. $e->setStatusCode(499);
  33900. $reject($e);
  33901. }
  33902. return;
  33903. }
  33904. try {
  33905. if ($job['request']['copyTo']) {
  33906. $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options, $job['request']['copyTo']);
  33907. } else {
  33908. $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options);
  33909. }
  33910. } catch (\Exception $exception) {
  33911. $reject($exception);
  33912. }
  33913. }
  33914. private function markJobDone(): void
  33915. {
  33916. $this->runningJobs--;
  33917. }
  33918. public function wait(?int $index = null)
  33919. {
  33920. do {
  33921. $jobCount = $this->countActiveJobs($index);
  33922. } while ($jobCount);
  33923. }
  33924. public function enableAsync(): void
  33925. {
  33926. $this->allowAsync = true;
  33927. }
  33928. public function countActiveJobs(?int $index = null): int
  33929. {
  33930. if ($this->runningJobs < $this->maxJobs) {
  33931. foreach ($this->jobs as $job) {
  33932. if ($job['status'] === self::STATUS_QUEUED && $this->runningJobs < $this->maxJobs) {
  33933. $this->startJob($job['id']);
  33934. }
  33935. }
  33936. }
  33937. if ($this->curl) {
  33938. $this->curl->tick();
  33939. }
  33940. if (null !== $index) {
  33941. return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
  33942. }
  33943. $active = 0;
  33944. foreach ($this->jobs as $job) {
  33945. if ($job['status'] < self::STATUS_COMPLETED) {
  33946. $active++;
  33947. } elseif (!$job['sync']) {
  33948. unset($this->jobs[$job['id']]);
  33949. }
  33950. }
  33951. return $active;
  33952. }
  33953. private function getResponse(int $index): Response
  33954. {
  33955. if (!isset($this->jobs[$index])) {
  33956. throw new \LogicException('Invalid request id');
  33957. }
  33958. if ($this->jobs[$index]['status'] === self::STATUS_FAILED) {
  33959. throw $this->jobs[$index]['exception'];
  33960. }
  33961. if (!isset($this->jobs[$index]['response'])) {
  33962. throw new \LogicException('Response not available yet, call wait() first');
  33963. }
  33964. $resp = $this->jobs[$index]['response'];
  33965. unset($this->jobs[$index]);
  33966. return $resp;
  33967. }
  33968. public static function outputWarnings(IOInterface $io, string $url, $data): void
  33969. {
  33970. $cleanMessage = function ($msg) use ($io) {
  33971. if (!$io->isDecorated()) {
  33972. $msg = Preg::replace('{'.chr(27).'\\[[;\d]*m}u', '', $msg);
  33973. }
  33974. return $msg;
  33975. };
  33976. foreach (array('warning', 'info') as $type) {
  33977. if (empty($data[$type])) {
  33978. continue;
  33979. }
  33980. if (!empty($data[$type . '-versions'])) {
  33981. $versionParser = new VersionParser();
  33982. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  33983. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  33984. if (!$constraint->matches($composer)) {
  33985. continue;
  33986. }
  33987. }
  33988. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($data[$type]).'</'.$type.'>');
  33989. }
  33990. foreach (array('warnings', 'infos') as $key) {
  33991. if (empty($data[$key])) {
  33992. continue;
  33993. }
  33994. $versionParser = new VersionParser();
  33995. foreach ($data[$key] as $spec) {
  33996. $type = substr($key, 0, -1);
  33997. $constraint = $versionParser->parseConstraints($spec['versions']);
  33998. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  33999. if (!$constraint->matches($composer)) {
  34000. continue;
  34001. }
  34002. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($spec['message']).'</'.$type.'>');
  34003. }
  34004. }
  34005. }
  34006. public static function getExceptionHints(\Throwable $e): ?array
  34007. {
  34008. if (!$e instanceof TransportException) {
  34009. return null;
  34010. }
  34011. if (
  34012. false !== strpos($e->getMessage(), 'Resolving timed out')
  34013. || false !== strpos($e->getMessage(), 'Could not resolve host')
  34014. ) {
  34015. Silencer::suppress();
  34016. $testConnectivity = file_get_contents('https://8.8.8.8', false, stream_context_create(array(
  34017. 'ssl' => array('verify_peer' => false),
  34018. 'http' => array('follow_location' => false, 'ignore_errors' => true),
  34019. )));
  34020. Silencer::restore();
  34021. if (false !== $testConnectivity) {
  34022. return array(
  34023. '<error>The following exception probably indicates you have misconfigured DNS resolver(s)</error>',
  34024. );
  34025. }
  34026. return array(
  34027. '<error>The following exception probably indicates you are offline or have misconfigured DNS resolver(s)</error>',
  34028. );
  34029. }
  34030. return null;
  34031. }
  34032. private function canUseCurl(array $job): bool
  34033. {
  34034. if (!$this->curl) {
  34035. return false;
  34036. }
  34037. if (!Preg::isMatch('{^https?://}i', $job['request']['url'])) {
  34038. return false;
  34039. }
  34040. if (!empty($job['request']['options']['ssl']['allow_self_signed'])) {
  34041. return false;
  34042. }
  34043. return true;
  34044. }
  34045. public static function isCurlEnabled(): bool
  34046. {
  34047. return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init');
  34048. }
  34049. }
  34050. <?php declare(strict_types=1);
  34051. namespace Composer\Util;
  34052. use Composer\XdebugHandler\XdebugHandler;
  34053. class IniHelper
  34054. {
  34055. public static function getAll(): array
  34056. {
  34057. return XdebugHandler::getAllIniFiles();
  34058. }
  34059. public static function getMessage(): string
  34060. {
  34061. $paths = self::getAll();
  34062. if (empty($paths[0])) {
  34063. array_shift($paths);
  34064. }
  34065. $ini = array_shift($paths);
  34066. if (empty($ini)) {
  34067. return 'A php.ini file does not exist. You will have to create one.';
  34068. }
  34069. if (!empty($paths)) {
  34070. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  34071. }
  34072. return 'The php.ini used by your command-line PHP is: '.$ini;
  34073. }
  34074. }
  34075. <?php declare(strict_types=1);
  34076. namespace Composer\Util;
  34077. use React\Promise\CancellablePromiseInterface;
  34078. use Symfony\Component\Console\Helper\ProgressBar;
  34079. use React\Promise\PromiseInterface;
  34080. class Loop
  34081. {
  34082. private $httpDownloader;
  34083. private $processExecutor;
  34084. private $currentPromises = array();
  34085. private $waitIndex = 0;
  34086. public function __construct(HttpDownloader $httpDownloader, ProcessExecutor $processExecutor = null)
  34087. {
  34088. $this->httpDownloader = $httpDownloader;
  34089. $this->httpDownloader->enableAsync();
  34090. $this->processExecutor = $processExecutor;
  34091. if ($this->processExecutor) {
  34092. $this->processExecutor->enableAsync();
  34093. }
  34094. }
  34095. public function getHttpDownloader(): HttpDownloader
  34096. {
  34097. return $this->httpDownloader;
  34098. }
  34099. public function getProcessExecutor(): ?ProcessExecutor
  34100. {
  34101. return $this->processExecutor;
  34102. }
  34103. public function wait(array $promises, ProgressBar $progress = null): void
  34104. {
  34105. $uncaught = null;
  34106. \React\Promise\all($promises)->then(
  34107. function (): void {
  34108. },
  34109. function ($e) use (&$uncaught): void {
  34110. $uncaught = $e;
  34111. }
  34112. );
  34113. $waitIndex = $this->waitIndex++;
  34114. $this->currentPromises[$waitIndex] = $promises;
  34115. if ($progress) {
  34116. $totalJobs = 0;
  34117. $totalJobs += $this->httpDownloader->countActiveJobs();
  34118. if ($this->processExecutor) {
  34119. $totalJobs += $this->processExecutor->countActiveJobs();
  34120. }
  34121. $progress->start($totalJobs);
  34122. }
  34123. $lastUpdate = 0;
  34124. while (true) {
  34125. $activeJobs = 0;
  34126. $activeJobs += $this->httpDownloader->countActiveJobs();
  34127. if ($this->processExecutor) {
  34128. $activeJobs += $this->processExecutor->countActiveJobs();
  34129. }
  34130. if ($progress && microtime(true) - $lastUpdate > 0.1) {
  34131. $lastUpdate = microtime(true);
  34132. $progress->setProgress($progress->getMaxSteps() - $activeJobs);
  34133. }
  34134. if (!$activeJobs) {
  34135. break;
  34136. }
  34137. }
  34138. if ($progress) {
  34139. $progress->finish();
  34140. }
  34141. unset($this->currentPromises[$waitIndex]);
  34142. if ($uncaught) {
  34143. throw $uncaught;
  34144. }
  34145. }
  34146. public function abortJobs(): void
  34147. {
  34148. foreach ($this->currentPromises as $promiseGroup) {
  34149. foreach ($promiseGroup as $promise) {
  34150. if ($promise instanceof CancellablePromiseInterface) {
  34151. $promise->cancel();
  34152. }
  34153. }
  34154. }
  34155. }
  34156. }
  34157. <?php declare(strict_types=1);
  34158. namespace Composer\Util;
  34159. @trigger_error('Composer\Util\MetadataMinifier is deprecated, use Composer\MetadataMinifier\MetadataMinifier from composer/metadata-minifier instead.', E_USER_DEPRECATED);
  34160. class MetadataMinifier extends \Composer\MetadataMinifier\MetadataMinifier
  34161. {
  34162. }
  34163. <?php declare(strict_types=1);
  34164. namespace Composer\Util;
  34165. use Composer\Pcre\Preg;
  34166. use stdClass;
  34167. class NoProxyPattern
  34168. {
  34169. protected $hostNames = array();
  34170. protected $rules = array();
  34171. protected $noproxy;
  34172. public function __construct(string $pattern)
  34173. {
  34174. $this->hostNames = Preg::split('{[\s,]+}', $pattern, -1, PREG_SPLIT_NO_EMPTY);
  34175. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  34176. }
  34177. public function test(string $url): bool
  34178. {
  34179. if ($this->noproxy) {
  34180. return true;
  34181. }
  34182. if (!$urlData = $this->getUrlData($url)) {
  34183. return false;
  34184. }
  34185. foreach ($this->hostNames as $index => $hostName) {
  34186. if ($this->match($index, $hostName, $urlData)) {
  34187. return true;
  34188. }
  34189. }
  34190. return false;
  34191. }
  34192. protected function getUrlData(string $url)
  34193. {
  34194. if (!$host = parse_url($url, PHP_URL_HOST)) {
  34195. return false;
  34196. }
  34197. $port = parse_url($url, PHP_URL_PORT);
  34198. if (empty($port)) {
  34199. switch (parse_url($url, PHP_URL_SCHEME)) {
  34200. case 'http':
  34201. $port = 80;
  34202. break;
  34203. case 'https':
  34204. $port = 443;
  34205. break;
  34206. }
  34207. }
  34208. $hostName = $host . ($port ? ':' . $port : '');
  34209. list($host, $port, $err) = $this->splitHostPort($hostName);
  34210. if ($err || !$this->ipCheckData($host, $ipdata)) {
  34211. return false;
  34212. }
  34213. return $this->makeData($host, $port, $ipdata);
  34214. }
  34215. protected function match(int $index, string $hostName, stdClass $url): bool
  34216. {
  34217. if (!$rule = $this->getRule($index, $hostName)) {
  34218. return false;
  34219. }
  34220. if ($rule->ipdata) {
  34221. if (!$url->ipdata) {
  34222. return false;
  34223. }
  34224. if ($rule->ipdata->netmask) {
  34225. return $this->matchRange($rule->ipdata, $url->ipdata);
  34226. }
  34227. $match = $rule->ipdata->ip === $url->ipdata->ip;
  34228. } else {
  34229. $haystack = substr($url->name, -strlen($rule->name));
  34230. $match = stripos($haystack, $rule->name) === 0;
  34231. }
  34232. if ($match && $rule->port) {
  34233. $match = $rule->port === $url->port;
  34234. }
  34235. return $match;
  34236. }
  34237. protected function matchRange(stdClass $network, stdClass $target): bool
  34238. {
  34239. $net = unpack('C*', $network->ip);
  34240. $mask = unpack('C*', $network->netmask);
  34241. $ip = unpack('C*', $target->ip);
  34242. if (false === $net) {
  34243. throw new \RuntimeException('Could not parse network IP '.$network->ip);
  34244. }
  34245. if (false === $mask) {
  34246. throw new \RuntimeException('Could not parse netmask '.$network->netmask);
  34247. }
  34248. if (false === $ip) {
  34249. throw new \RuntimeException('Could not parse target IP '.$target->ip);
  34250. }
  34251. for ($i = 1; $i < 17; ++$i) {
  34252. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  34253. return false;
  34254. }
  34255. }
  34256. return true;
  34257. }
  34258. private function getRule(int $index, string $hostName): ?stdClass
  34259. {
  34260. if (array_key_exists($index, $this->rules)) {
  34261. return $this->rules[$index];
  34262. }
  34263. $this->rules[$index] = null;
  34264. list($host, $port, $err) = $this->splitHostPort($hostName);
  34265. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  34266. return null;
  34267. }
  34268. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  34269. return $this->rules[$index];
  34270. }
  34271. private function ipCheckData(string $host, ?stdClass &$ipdata, bool $allowPrefix = false): bool
  34272. {
  34273. $ipdata = null;
  34274. $netmask = null;
  34275. $prefix = null;
  34276. $modified = false;
  34277. if (strpos($host, '/') !== false) {
  34278. list($host, $prefix) = explode('/', $host);
  34279. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  34280. return false;
  34281. }
  34282. $prefix = (int) $prefix;
  34283. $modified = true;
  34284. }
  34285. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  34286. return !$modified;
  34287. }
  34288. list($ip, $size) = $this->ipGetAddr($host);
  34289. if ($prefix !== null) {
  34290. if ($prefix > $size * 8) {
  34291. return false;
  34292. }
  34293. list($ip, $netmask) = $this->ipGetNetwork($ip, $size, $prefix);
  34294. }
  34295. $ipdata = $this->makeIpData($ip, $size, $netmask);
  34296. return true;
  34297. }
  34298. private function ipGetAddr(string $host): array
  34299. {
  34300. $ip = inet_pton($host);
  34301. $size = strlen($ip);
  34302. $mapped = $this->ipMapTo6($ip, $size);
  34303. return array($mapped, $size);
  34304. }
  34305. private function ipGetMask(int $prefix, int $size): string
  34306. {
  34307. $mask = '';
  34308. if ($ones = floor($prefix / 8)) {
  34309. $mask = str_repeat(chr(255), (int) $ones);
  34310. }
  34311. if ($remainder = $prefix % 8) {
  34312. $mask .= chr(0xff ^ (0xff >> $remainder));
  34313. }
  34314. $mask = str_pad($mask, $size, chr(0));
  34315. return $this->ipMapTo6($mask, $size);
  34316. }
  34317. private function ipGetNetwork(string $rangeIp, int $size, int $prefix): array
  34318. {
  34319. $netmask = $this->ipGetMask($prefix, $size);
  34320. $mask = unpack('C*', $netmask);
  34321. $ip = unpack('C*', $rangeIp);
  34322. $net = '';
  34323. if (false === $mask) {
  34324. throw new \RuntimeException('Could not parse netmask '.$netmask);
  34325. }
  34326. if (false === $ip) {
  34327. throw new \RuntimeException('Could not parse range IP '.$rangeIp);
  34328. }
  34329. for ($i = 1; $i < 17; ++$i) {
  34330. $net .= chr($ip[$i] & $mask[$i]);
  34331. }
  34332. return array($net, $netmask);
  34333. }
  34334. private function ipMapTo6(string $binary, int $size): string
  34335. {
  34336. if ($size === 4) {
  34337. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  34338. $binary = $prefix . $binary;
  34339. }
  34340. return $binary;
  34341. }
  34342. private function makeData(string $host, int $port, ?stdClass $ipdata): stdClass
  34343. {
  34344. return (object) array(
  34345. 'host' => $host,
  34346. 'name' => '.' . ltrim($host, '.'),
  34347. 'port' => $port,
  34348. 'ipdata' => $ipdata,
  34349. );
  34350. }
  34351. private function makeIpData(string $ip, int $size, ?string $netmask): stdClass
  34352. {
  34353. return (object) array(
  34354. 'ip' => $ip,
  34355. 'size' => $size,
  34356. 'netmask' => $netmask,
  34357. );
  34358. }
  34359. private function splitHostPort(string $hostName): array
  34360. {
  34361. $error = array('', '', true);
  34362. $port = 0;
  34363. $ip6 = '';
  34364. if ($hostName[0] === '[') {
  34365. $index = strpos($hostName, ']');
  34366. if (false === $index || $index < 3) {
  34367. return $error;
  34368. }
  34369. $ip6 = substr($hostName, 1, $index - 1);
  34370. $hostName = substr($hostName, $index + 1);
  34371. if (strpbrk($hostName, '[]') !== false || substr_count($hostName, ':') > 1) {
  34372. return $error;
  34373. }
  34374. }
  34375. if (substr_count($hostName, ':') === 1) {
  34376. $index = strpos($hostName, ':');
  34377. $port = substr($hostName, $index + 1);
  34378. $hostName = substr($hostName, 0, $index);
  34379. if (!$this->validateInt($port, 1, 65535)) {
  34380. return $error;
  34381. }
  34382. $port = (int) $port;
  34383. }
  34384. $host = $ip6 . $hostName;
  34385. return array($host, $port, false);
  34386. }
  34387. private function validateInt(string $int, int $min, int $max): bool
  34388. {
  34389. $options = array(
  34390. 'options' => array(
  34391. 'min_range' => $min,
  34392. 'max_range' => $max,
  34393. ),
  34394. );
  34395. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  34396. }
  34397. }
  34398. <?php declare(strict_types=1);
  34399. namespace Composer\Util;
  34400. use Composer\Package\CompletePackageInterface;
  34401. use Composer\Package\PackageInterface;
  34402. class PackageInfo
  34403. {
  34404. public static function getViewSourceUrl(PackageInterface $package): ?string
  34405. {
  34406. if ($package instanceof CompletePackageInterface && isset($package->getSupport()['source'])) {
  34407. return $package->getSupport()['source'];
  34408. }
  34409. return $package->getSourceUrl();
  34410. }
  34411. public static function getViewSourceOrHomepageUrl(PackageInterface $package): ?string
  34412. {
  34413. return self::getViewSourceUrl($package) ?? ($package instanceof CompletePackageInterface ? $package->getHomepage() : null);
  34414. }
  34415. }
  34416. <?php declare(strict_types=1);
  34417. namespace Composer\Util;
  34418. use Composer\Package\PackageInterface;
  34419. use Composer\Package\RootPackageInterface;
  34420. class PackageSorter
  34421. {
  34422. public static function sortPackages(array $packages, array $weights = array()): array
  34423. {
  34424. $usageList = array();
  34425. foreach ($packages as $package) {
  34426. $links = $package->getRequires();
  34427. if ($package instanceof RootPackageInterface) {
  34428. $links = array_merge($links, $package->getDevRequires());
  34429. }
  34430. foreach ($links as $link) {
  34431. $target = $link->getTarget();
  34432. $usageList[$target][] = $package->getName();
  34433. }
  34434. }
  34435. $computing = array();
  34436. $computed = array();
  34437. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList, $weights) {
  34438. if (isset($computed[$name])) {
  34439. return $computed[$name];
  34440. }
  34441. if (isset($computing[$name])) {
  34442. return 0;
  34443. }
  34444. $computing[$name] = true;
  34445. $weight = $weights[$name] ?? 0;
  34446. if (isset($usageList[$name])) {
  34447. foreach ($usageList[$name] as $user) {
  34448. $weight -= 1 - $computeImportance($user);
  34449. }
  34450. }
  34451. unset($computing[$name]);
  34452. $computed[$name] = $weight;
  34453. return $weight;
  34454. };
  34455. $weightedPackages = array();
  34456. foreach ($packages as $index => $package) {
  34457. $name = $package->getName();
  34458. $weight = $computeImportance($name);
  34459. $weightedPackages[] = array('name' => $name, 'weight' => $weight, 'index' => $index);
  34460. }
  34461. usort($weightedPackages, function (array $a, array $b): int {
  34462. if ($a['weight'] !== $b['weight']) {
  34463. return $a['weight'] - $b['weight'];
  34464. }
  34465. return strnatcasecmp($a['name'], $b['name']);
  34466. });
  34467. $sortedPackages = array();
  34468. foreach ($weightedPackages as $pkg) {
  34469. $sortedPackages[] = $packages[$pkg['index']];
  34470. }
  34471. return $sortedPackages;
  34472. }
  34473. }
  34474. <?php declare(strict_types=1);
  34475. namespace Composer\Util;
  34476. use Composer\IO\IOInterface;
  34477. use Composer\Pcre\Preg;
  34478. use Symfony\Component\Process\Process;
  34479. class Perforce
  34480. {
  34481. protected $path;
  34482. protected $p4Depot;
  34483. protected $p4Client;
  34484. protected $p4User;
  34485. protected $p4Password;
  34486. protected $p4Port;
  34487. protected $p4Stream;
  34488. protected $p4ClientSpec;
  34489. protected $p4DepotType;
  34490. protected $p4Branch;
  34491. protected $process;
  34492. protected $uniquePerforceClientName;
  34493. protected $windowsFlag;
  34494. protected $commandResult;
  34495. protected $io;
  34496. protected $filesystem;
  34497. public function __construct($repoConfig, string $port, string $path, ProcessExecutor $process, bool $isWindows, IOInterface $io)
  34498. {
  34499. $this->windowsFlag = $isWindows;
  34500. $this->p4Port = $port;
  34501. $this->initializePath($path);
  34502. $this->process = $process;
  34503. $this->initialize($repoConfig);
  34504. $this->io = $io;
  34505. }
  34506. public static function create($repoConfig, string $port, string $path, ProcessExecutor $process, IOInterface $io): self
  34507. {
  34508. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  34509. }
  34510. public static function checkServerExists(string $url, ProcessExecutor $processExecutor): bool
  34511. {
  34512. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $ignoredOutput);
  34513. }
  34514. public function initialize($repoConfig): void
  34515. {
  34516. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  34517. if (!$repoConfig) {
  34518. return;
  34519. }
  34520. if (isset($repoConfig['unique_perforce_client_name'])) {
  34521. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  34522. }
  34523. if (isset($repoConfig['depot'])) {
  34524. $this->p4Depot = $repoConfig['depot'];
  34525. }
  34526. if (isset($repoConfig['branch'])) {
  34527. $this->p4Branch = $repoConfig['branch'];
  34528. }
  34529. if (isset($repoConfig['p4user'])) {
  34530. $this->p4User = $repoConfig['p4user'];
  34531. } else {
  34532. $this->p4User = $this->getP4variable('P4USER');
  34533. }
  34534. if (isset($repoConfig['p4password'])) {
  34535. $this->p4Password = $repoConfig['p4password'];
  34536. }
  34537. }
  34538. public function initializeDepotAndBranch(?string $depot, ?string $branch): void
  34539. {
  34540. if (isset($depot)) {
  34541. $this->p4Depot = $depot;
  34542. }
  34543. if (isset($branch)) {
  34544. $this->p4Branch = $branch;
  34545. }
  34546. }
  34547. public function generateUniquePerforceClientName(): string
  34548. {
  34549. return gethostname() . "_" . time();
  34550. }
  34551. public function cleanupClientSpec(): void
  34552. {
  34553. $client = $this->getClient();
  34554. $task = 'client -d ' . ProcessExecutor::escape($client);
  34555. $useP4Client = false;
  34556. $command = $this->generateP4Command($task, $useP4Client);
  34557. $this->executeCommand($command);
  34558. $clientSpec = $this->getP4ClientSpec();
  34559. $fileSystem = $this->getFilesystem();
  34560. $fileSystem->remove($clientSpec);
  34561. }
  34562. protected function executeCommand($command): int
  34563. {
  34564. $this->commandResult = '';
  34565. return $this->process->execute($command, $this->commandResult);
  34566. }
  34567. public function getClient(): string
  34568. {
  34569. if (!isset($this->p4Client)) {
  34570. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  34571. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  34572. }
  34573. return $this->p4Client;
  34574. }
  34575. protected function getPath(): string
  34576. {
  34577. return $this->path;
  34578. }
  34579. public function initializePath(string $path): void
  34580. {
  34581. $this->path = $path;
  34582. $fs = $this->getFilesystem();
  34583. $fs->ensureDirectoryExists($path);
  34584. }
  34585. protected function getPort(): string
  34586. {
  34587. return $this->p4Port;
  34588. }
  34589. public function setStream(string $stream): void
  34590. {
  34591. $this->p4Stream = $stream;
  34592. $index = strrpos($stream, '/');
  34593. if ($index > 2) {
  34594. $this->p4DepotType = 'stream';
  34595. }
  34596. }
  34597. public function isStream(): bool
  34598. {
  34599. return is_string($this->p4DepotType) && (strcmp($this->p4DepotType, 'stream') === 0);
  34600. }
  34601. public function getStream(): string
  34602. {
  34603. if (!isset($this->p4Stream)) {
  34604. if ($this->isStream()) {
  34605. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  34606. } else {
  34607. $this->p4Stream = '//' . $this->p4Depot;
  34608. }
  34609. }
  34610. return $this->p4Stream;
  34611. }
  34612. public function getStreamWithoutLabel(string $stream): string
  34613. {
  34614. $index = strpos($stream, '@');
  34615. if ($index === false) {
  34616. return $stream;
  34617. }
  34618. return substr($stream, 0, $index);
  34619. }
  34620. public function getP4ClientSpec(): string
  34621. {
  34622. return $this->path . '/' . $this->getClient() . '.p4.spec';
  34623. }
  34624. public function getUser(): ?string
  34625. {
  34626. return $this->p4User;
  34627. }
  34628. public function setUser(?string $user): void
  34629. {
  34630. $this->p4User = $user;
  34631. }
  34632. public function queryP4User(): void
  34633. {
  34634. $this->getUser();
  34635. if (strlen((string) $this->p4User) > 0) {
  34636. return;
  34637. }
  34638. $this->p4User = $this->getP4variable('P4USER');
  34639. if (strlen((string) $this->p4User) > 0) {
  34640. return;
  34641. }
  34642. $this->p4User = $this->io->ask('Enter P4 User:');
  34643. if ($this->windowsFlag) {
  34644. $command = 'p4 set P4USER=' . $this->p4User;
  34645. } else {
  34646. $command = 'export P4USER=' . $this->p4User;
  34647. }
  34648. $this->executeCommand($command);
  34649. }
  34650. protected function getP4variable(string $name): ?string
  34651. {
  34652. if ($this->windowsFlag) {
  34653. $command = 'p4 set';
  34654. $this->executeCommand($command);
  34655. $result = trim($this->commandResult);
  34656. $resArray = explode(PHP_EOL, $result);
  34657. foreach ($resArray as $line) {
  34658. $fields = explode('=', $line);
  34659. if (strcmp($name, $fields[0]) == 0) {
  34660. $index = strpos($fields[1], ' ');
  34661. if ($index === false) {
  34662. $value = $fields[1];
  34663. } else {
  34664. $value = substr($fields[1], 0, $index);
  34665. }
  34666. $value = trim($value);
  34667. return $value;
  34668. }
  34669. }
  34670. return null;
  34671. }
  34672. $command = 'echo $' . $name;
  34673. $this->executeCommand($command);
  34674. $result = trim($this->commandResult);
  34675. return $result;
  34676. }
  34677. public function queryP4Password(): ?string
  34678. {
  34679. if (isset($this->p4Password)) {
  34680. return $this->p4Password;
  34681. }
  34682. $password = $this->getP4variable('P4PASSWD');
  34683. if (strlen((string) $password) <= 0) {
  34684. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  34685. }
  34686. $this->p4Password = $password;
  34687. return $password;
  34688. }
  34689. public function generateP4Command(string $command, bool $useClient = true): string
  34690. {
  34691. $p4Command = 'p4 ';
  34692. $p4Command .= '-u ' . $this->getUser() . ' ';
  34693. if ($useClient) {
  34694. $p4Command .= '-c ' . $this->getClient() . ' ';
  34695. }
  34696. $p4Command .= '-p ' . $this->getPort() . ' ' . $command;
  34697. return $p4Command;
  34698. }
  34699. public function isLoggedIn(): bool
  34700. {
  34701. $command = $this->generateP4Command('login -s', false);
  34702. $exitCode = $this->executeCommand($command);
  34703. if ($exitCode) {
  34704. $errorOutput = $this->process->getErrorOutput();
  34705. $index = strpos($errorOutput, $this->getUser());
  34706. if ($index === false) {
  34707. $index = strpos($errorOutput, 'p4');
  34708. if ($index === false) {
  34709. return false;
  34710. }
  34711. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  34712. }
  34713. throw new \Exception('Invalid user name: ' . $this->getUser());
  34714. }
  34715. return true;
  34716. }
  34717. public function connectClient(): void
  34718. {
  34719. $p4CreateClientCommand = $this->generateP4Command(
  34720. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  34721. );
  34722. $this->executeCommand($p4CreateClientCommand);
  34723. }
  34724. public function syncCodeBase(?string $sourceReference): void
  34725. {
  34726. $prevDir = Platform::getCwd();
  34727. chdir($this->path);
  34728. $p4SyncCommand = $this->generateP4Command('sync -f ');
  34729. if (null !== $sourceReference) {
  34730. $p4SyncCommand .= '@' . $sourceReference;
  34731. }
  34732. $this->executeCommand($p4SyncCommand);
  34733. chdir($prevDir);
  34734. }
  34735. public function writeClientSpecToFile($spec): void
  34736. {
  34737. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  34738. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  34739. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  34740. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  34741. fwrite($spec, 'Description:' . PHP_EOL);
  34742. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  34743. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  34744. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  34745. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  34746. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  34747. if ($this->isStream()) {
  34748. fwrite($spec, 'Stream:' . PHP_EOL);
  34749. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  34750. } else {
  34751. fwrite(
  34752. $spec,
  34753. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  34754. );
  34755. }
  34756. }
  34757. public function writeP4ClientSpec(): void
  34758. {
  34759. $clientSpec = $this->getP4ClientSpec();
  34760. $spec = fopen($clientSpec, 'w');
  34761. try {
  34762. $this->writeClientSpecToFile($spec);
  34763. } catch (\Exception $e) {
  34764. fclose($spec);
  34765. throw $e;
  34766. }
  34767. fclose($spec);
  34768. }
  34769. protected function read($pipe, $name): void
  34770. {
  34771. if (feof($pipe)) {
  34772. return;
  34773. }
  34774. $line = fgets($pipe);
  34775. while ($line !== false) {
  34776. $line = fgets($pipe);
  34777. }
  34778. }
  34779. public function windowsLogin(?string $password): int
  34780. {
  34781. $command = $this->generateP4Command(' login -a');
  34782. $process = Process::fromShellCommandline($command, null, null, $password);
  34783. return $process->run();
  34784. }
  34785. public function p4Login(): void
  34786. {
  34787. $this->queryP4User();
  34788. if (!$this->isLoggedIn()) {
  34789. $password = $this->queryP4Password();
  34790. if ($this->windowsFlag) {
  34791. $this->windowsLogin($password);
  34792. } else {
  34793. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  34794. $exitCode = $this->executeCommand($command);
  34795. if ($exitCode) {
  34796. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  34797. }
  34798. }
  34799. }
  34800. }
  34801. public function getComposerInformation(string $identifier): ?array
  34802. {
  34803. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  34804. if (!$composerFileContent) {
  34805. return null;
  34806. }
  34807. return json_decode($composerFileContent, true);
  34808. }
  34809. public function getFileContent(string $file, string $identifier): ?string
  34810. {
  34811. $path = $this->getFilePath($file, $identifier);
  34812. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  34813. $this->executeCommand($command);
  34814. $result = $this->commandResult;
  34815. if (!trim($result)) {
  34816. return null;
  34817. }
  34818. return $result;
  34819. }
  34820. public function getFilePath(string $file, string $identifier): ?string
  34821. {
  34822. $index = strpos($identifier, '@');
  34823. if ($index === false) {
  34824. return $identifier. '/' . $file;
  34825. }
  34826. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  34827. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  34828. $this->executeCommand($command);
  34829. $result = $this->commandResult;
  34830. $index2 = strpos($result, 'no such file(s).');
  34831. if ($index2 === false) {
  34832. $index3 = strpos($result, 'change');
  34833. if ($index3 !== false) {
  34834. $phrase = trim(substr($result, $index3));
  34835. $fields = explode(' ', $phrase);
  34836. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  34837. }
  34838. }
  34839. return null;
  34840. }
  34841. public function getBranches(): array
  34842. {
  34843. $possibleBranches = array();
  34844. if (!$this->isStream()) {
  34845. $possibleBranches[$this->p4Branch] = $this->getStream();
  34846. } else {
  34847. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  34848. $this->executeCommand($command);
  34849. $result = $this->commandResult;
  34850. $resArray = explode(PHP_EOL, $result);
  34851. foreach ($resArray as $line) {
  34852. $resBits = explode(' ', $line);
  34853. if (count($resBits) > 4) {
  34854. $branch = Preg::replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  34855. $possibleBranches[$branch] = $resBits[1];
  34856. }
  34857. }
  34858. }
  34859. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  34860. $this->executeCommand($command);
  34861. $result = $this->commandResult;
  34862. $resArray = explode(PHP_EOL, $result);
  34863. $lastCommit = $resArray[0];
  34864. $lastCommitArr = explode(' ', $lastCommit);
  34865. $lastCommitNum = $lastCommitArr[1];
  34866. return array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  34867. }
  34868. public function getTags(): array
  34869. {
  34870. $command = $this->generateP4Command('labels');
  34871. $this->executeCommand($command);
  34872. $result = $this->commandResult;
  34873. $resArray = explode(PHP_EOL, $result);
  34874. $tags = array();
  34875. foreach ($resArray as $line) {
  34876. if (strpos($line, 'Label') !== false) {
  34877. $fields = explode(' ', $line);
  34878. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  34879. }
  34880. }
  34881. return $tags;
  34882. }
  34883. public function checkStream(): bool
  34884. {
  34885. $command = $this->generateP4Command('depots', false);
  34886. $this->executeCommand($command);
  34887. $result = $this->commandResult;
  34888. $resArray = explode(PHP_EOL, $result);
  34889. foreach ($resArray as $line) {
  34890. if (strpos($line, 'Depot') !== false) {
  34891. $fields = explode(' ', $line);
  34892. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  34893. $this->p4DepotType = $fields[3];
  34894. return $this->isStream();
  34895. }
  34896. }
  34897. }
  34898. return false;
  34899. }
  34900. protected function getChangeList(string $reference): mixed
  34901. {
  34902. $index = strpos($reference, '@');
  34903. if ($index === false) {
  34904. return null;
  34905. }
  34906. $label = substr($reference, $index);
  34907. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  34908. $this->executeCommand($command);
  34909. $changes = $this->commandResult;
  34910. if (strpos($changes, 'Change') !== 0) {
  34911. return null;
  34912. }
  34913. $fields = explode(' ', $changes);
  34914. return $fields[1];
  34915. }
  34916. public function getCommitLogs(string $fromReference, string $toReference): mixed
  34917. {
  34918. $fromChangeList = $this->getChangeList($fromReference);
  34919. if ($fromChangeList === null) {
  34920. return null;
  34921. }
  34922. $toChangeList = $this->getChangeList($toReference);
  34923. if ($toChangeList === null) {
  34924. return null;
  34925. }
  34926. $index = strpos($fromReference, '@');
  34927. $main = substr($fromReference, 0, $index) . '/...';
  34928. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  34929. $this->executeCommand($command);
  34930. return $this->commandResult;
  34931. }
  34932. public function getFilesystem(): Filesystem
  34933. {
  34934. if (null === $this->filesystem) {
  34935. $this->filesystem = new Filesystem($this->process);
  34936. }
  34937. return $this->filesystem;
  34938. }
  34939. public function setFilesystem(Filesystem $fs): void
  34940. {
  34941. $this->filesystem = $fs;
  34942. }
  34943. }
  34944. <?php declare(strict_types=1);
  34945. namespace Composer\Util;
  34946. use Composer\Pcre\Preg;
  34947. class Platform
  34948. {
  34949. private static $isVirtualBoxGuest = null;
  34950. private static $isWindowsSubsystemForLinux = null;
  34951. public static function getCwd(bool $allowEmpty = false): string
  34952. {
  34953. $cwd = getcwd();
  34954. if (false === $cwd) {
  34955. $cwd = realpath('');
  34956. }
  34957. if (false === $cwd) {
  34958. if ($allowEmpty) {
  34959. return '';
  34960. }
  34961. throw new \RuntimeException('Could not determine the current working directory');
  34962. }
  34963. return $cwd;
  34964. }
  34965. public static function getEnv(string $name)
  34966. {
  34967. if (array_key_exists($name, $_SERVER)) {
  34968. return (string) $_SERVER[$name];
  34969. }
  34970. if (array_key_exists($name, $_ENV)) {
  34971. return (string) $_ENV[$name];
  34972. }
  34973. return getenv($name);
  34974. }
  34975. public static function putEnv(string $name, string $value): void
  34976. {
  34977. $value = (string) $value;
  34978. putenv($name . '=' . $value);
  34979. $_SERVER[$name] = $_ENV[$name] = $value;
  34980. }
  34981. public static function clearEnv(string $name): void
  34982. {
  34983. putenv($name);
  34984. unset($_SERVER[$name], $_ENV[$name]);
  34985. }
  34986. public static function expandPath(string $path): string
  34987. {
  34988. if (Preg::isMatch('#^~[\\/]#', $path)) {
  34989. return self::getUserDirectory() . substr($path, 1);
  34990. }
  34991. return Preg::replaceCallback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches): string {
  34992. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  34993. return (Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE')) . $matches['path'];
  34994. }
  34995. return Platform::getEnv($matches['var']) . $matches['path'];
  34996. }, $path);
  34997. }
  34998. public static function getUserDirectory(): string
  34999. {
  35000. if (false !== ($home = self::getEnv('HOME'))) {
  35001. return $home;
  35002. }
  35003. if (self::isWindows() && false !== ($home = self::getEnv('USERPROFILE'))) {
  35004. return $home;
  35005. }
  35006. if (\function_exists('posix_getuid') && \function_exists('posix_getpwuid')) {
  35007. $info = posix_getpwuid(posix_getuid());
  35008. return $info['dir'];
  35009. }
  35010. throw new \RuntimeException('Could not determine user directory');
  35011. }
  35012. public static function isWindowsSubsystemForLinux(): bool
  35013. {
  35014. if (null === self::$isWindowsSubsystemForLinux) {
  35015. self::$isWindowsSubsystemForLinux = false;
  35016. if (self::isWindows()) {
  35017. return self::$isWindowsSubsystemForLinux = false;
  35018. }
  35019. if (
  35020. !ini_get('open_basedir')
  35021. && is_readable('/proc/version')
  35022. && false !== stripos(Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
  35023. && !file_exists('/.dockerenv')
  35024. ) {
  35025. return self::$isWindowsSubsystemForLinux = true;
  35026. }
  35027. }
  35028. return self::$isWindowsSubsystemForLinux;
  35029. }
  35030. public static function isWindows(): bool
  35031. {
  35032. return \defined('PHP_WINDOWS_VERSION_BUILD');
  35033. }
  35034. public static function strlen(string $str): int
  35035. {
  35036. static $useMbString = null;
  35037. if (null === $useMbString) {
  35038. $useMbString = \function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  35039. }
  35040. if ($useMbString) {
  35041. return mb_strlen($str, '8bit');
  35042. }
  35043. return \strlen($str);
  35044. }
  35045. public static function isTty($fd = null): bool
  35046. {
  35047. if ($fd === null) {
  35048. $fd = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w');
  35049. }
  35050. if (in_array(strtoupper(self::getEnv('MSYSTEM') ?: ''), array('MINGW32', 'MINGW64'), true)) {
  35051. return true;
  35052. }
  35053. if (function_exists('stream_isatty')) {
  35054. return stream_isatty($fd);
  35055. }
  35056. if (function_exists('posix_isatty') && posix_isatty($fd)) {
  35057. return true;
  35058. }
  35059. $stat = @fstat($fd);
  35060. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  35061. }
  35062. public static function workaroundFilesystemIssues(): void
  35063. {
  35064. if (self::isVirtualBoxGuest()) {
  35065. usleep(200000);
  35066. }
  35067. }
  35068. private static function isVirtualBoxGuest(): bool
  35069. {
  35070. if (null === self::$isVirtualBoxGuest) {
  35071. self::$isVirtualBoxGuest = false;
  35072. if (self::isWindows()) {
  35073. return self::$isVirtualBoxGuest;
  35074. }
  35075. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  35076. $processUser = posix_getpwuid(posix_geteuid());
  35077. if ($processUser && $processUser['name'] === 'vagrant') {
  35078. return self::$isVirtualBoxGuest = true;
  35079. }
  35080. }
  35081. if (self::getEnv('COMPOSER_RUNTIME_ENV') === 'virtualbox') {
  35082. return self::$isVirtualBoxGuest = true;
  35083. }
  35084. if (defined('PHP_OS_FAMILY') && PHP_OS_FAMILY === 'Linux') {
  35085. $process = new ProcessExecutor();
  35086. try {
  35087. if (0 === $process->execute('lsmod | grep vboxguest', $ignoredOutput)) {
  35088. return self::$isVirtualBoxGuest = true;
  35089. }
  35090. } catch (\Exception $e) {
  35091. }
  35092. }
  35093. }
  35094. return self::$isVirtualBoxGuest;
  35095. }
  35096. }
  35097. <?php declare(strict_types=1);
  35098. namespace Composer\Util;
  35099. use Composer\IO\IOInterface;
  35100. use Composer\Pcre\Preg;
  35101. use Symfony\Component\Process\Process;
  35102. use Symfony\Component\Process\Exception\RuntimeException;
  35103. use React\Promise\Promise;
  35104. use React\Promise\PromiseInterface;
  35105. class ProcessExecutor
  35106. {
  35107. private const STATUS_QUEUED = 1;
  35108. private const STATUS_STARTED = 2;
  35109. private const STATUS_COMPLETED = 3;
  35110. private const STATUS_FAILED = 4;
  35111. private const STATUS_ABORTED = 5;
  35112. protected static $timeout = 300;
  35113. protected $captureOutput = false;
  35114. protected $errorOutput = '';
  35115. protected $io;
  35116. private $jobs = array();
  35117. private $runningJobs = 0;
  35118. private $maxJobs = 10;
  35119. private $idGen = 0;
  35120. private $allowAsync = false;
  35121. public function __construct(IOInterface $io = null)
  35122. {
  35123. $this->io = $io;
  35124. }
  35125. public function execute($command, &$output = null, ?string $cwd = null): int
  35126. {
  35127. if (func_num_args() > 1) {
  35128. return $this->doExecute($command, $cwd, false, $output);
  35129. }
  35130. return $this->doExecute($command, $cwd, false);
  35131. }
  35132. public function executeTty($command, ?string $cwd = null): int
  35133. {
  35134. if (Platform::isTty()) {
  35135. return $this->doExecute($command, $cwd, true);
  35136. }
  35137. return $this->doExecute($command, $cwd, false);
  35138. }
  35139. private function doExecute($command, ?string $cwd, bool $tty, &$output = null): int
  35140. {
  35141. $this->outputCommandRun($command, $cwd, false);
  35142. $this->captureOutput = func_num_args() > 3;
  35143. $this->errorOutput = '';
  35144. if (is_string($command)) {
  35145. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  35146. } else {
  35147. $process = new Process($command, $cwd, null, null, static::getTimeout());
  35148. }
  35149. if (!Platform::isWindows() && $tty) {
  35150. try {
  35151. $process->setTty(true);
  35152. } catch (RuntimeException $e) {
  35153. }
  35154. }
  35155. $callback = is_callable($output) ? $output : function (string $type, string $buffer): void {
  35156. $this->outputHandler($type, $buffer);
  35157. };
  35158. $process->run($callback);
  35159. if ($this->captureOutput && !is_callable($output)) {
  35160. $output = $process->getOutput();
  35161. }
  35162. $this->errorOutput = $process->getErrorOutput();
  35163. return $process->getExitCode();
  35164. }
  35165. public function executeAsync($command, ?string $cwd = null): PromiseInterface
  35166. {
  35167. if (!$this->allowAsync) {
  35168. throw new \LogicException('You must use the ProcessExecutor instance which is part of a Composer\Loop instance to be able to run async processes');
  35169. }
  35170. $job = array(
  35171. 'id' => $this->idGen++,
  35172. 'status' => self::STATUS_QUEUED,
  35173. 'command' => $command,
  35174. 'cwd' => $cwd,
  35175. );
  35176. $resolver = function ($resolve, $reject) use (&$job): void {
  35177. $job['status'] = ProcessExecutor::STATUS_QUEUED;
  35178. $job['resolve'] = $resolve;
  35179. $job['reject'] = $reject;
  35180. };
  35181. $canceler = function () use (&$job): void {
  35182. if ($job['status'] === ProcessExecutor::STATUS_QUEUED) {
  35183. $job['status'] = ProcessExecutor::STATUS_ABORTED;
  35184. }
  35185. if ($job['status'] !== ProcessExecutor::STATUS_STARTED) {
  35186. return;
  35187. }
  35188. $job['status'] = ProcessExecutor::STATUS_ABORTED;
  35189. try {
  35190. if (defined('SIGINT')) {
  35191. $job['process']->signal(SIGINT);
  35192. }
  35193. } catch (\Exception $e) {
  35194. }
  35195. $job['process']->stop(1);
  35196. throw new \RuntimeException('Aborted process');
  35197. };
  35198. $promise = new Promise($resolver, $canceler);
  35199. $promise = $promise->then(function () use (&$job) {
  35200. if ($job['process']->isSuccessful()) {
  35201. $job['status'] = ProcessExecutor::STATUS_COMPLETED;
  35202. } else {
  35203. $job['status'] = ProcessExecutor::STATUS_FAILED;
  35204. }
  35205. $this->markJobDone();
  35206. return $job['process'];
  35207. }, function ($e) use (&$job): void {
  35208. $job['status'] = ProcessExecutor::STATUS_FAILED;
  35209. $this->markJobDone();
  35210. throw $e;
  35211. });
  35212. $this->jobs[$job['id']] = &$job;
  35213. if ($this->runningJobs < $this->maxJobs) {
  35214. $this->startJob($job['id']);
  35215. }
  35216. return $promise;
  35217. }
  35218. protected function outputHandler(string $type, string $buffer): void
  35219. {
  35220. if ($this->captureOutput) {
  35221. return;
  35222. }
  35223. if (null === $this->io) {
  35224. echo $buffer;
  35225. return;
  35226. }
  35227. if (Process::ERR === $type) {
  35228. $this->io->writeErrorRaw($buffer, false);
  35229. } else {
  35230. $this->io->writeRaw($buffer, false);
  35231. }
  35232. }
  35233. private function startJob(int $id): void
  35234. {
  35235. $job = &$this->jobs[$id];
  35236. if ($job['status'] !== self::STATUS_QUEUED) {
  35237. return;
  35238. }
  35239. $job['status'] = self::STATUS_STARTED;
  35240. $this->runningJobs++;
  35241. $command = $job['command'];
  35242. $cwd = $job['cwd'];
  35243. $this->outputCommandRun($command, $cwd, true);
  35244. try {
  35245. if (is_string($command)) {
  35246. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  35247. } else {
  35248. $process = new Process($command, $cwd, null, null, static::getTimeout());
  35249. }
  35250. } catch (\Throwable $e) {
  35251. call_user_func($job['reject'], $e);
  35252. return;
  35253. }
  35254. $job['process'] = $process;
  35255. try {
  35256. $process->start();
  35257. } catch (\Throwable $e) {
  35258. call_user_func($job['reject'], $e);
  35259. return;
  35260. }
  35261. }
  35262. public function setMaxJobs(int $maxJobs): void
  35263. {
  35264. $this->maxJobs = $maxJobs;
  35265. }
  35266. public function resetMaxJobs(): void
  35267. {
  35268. $this->maxJobs = 10;
  35269. }
  35270. public function wait($index = null): void
  35271. {
  35272. while (true) {
  35273. if (0 === $this->countActiveJobs($index)) {
  35274. return;
  35275. }
  35276. usleep(1000);
  35277. }
  35278. }
  35279. public function enableAsync(): void
  35280. {
  35281. $this->allowAsync = true;
  35282. }
  35283. public function countActiveJobs($index = null): int
  35284. {
  35285. foreach ($this->jobs as $job) {
  35286. if ($job['status'] === self::STATUS_STARTED) {
  35287. if (!$job['process']->isRunning()) {
  35288. call_user_func($job['resolve'], $job['process']);
  35289. }
  35290. $job['process']->checkTimeout();
  35291. }
  35292. if ($this->runningJobs < $this->maxJobs) {
  35293. if ($job['status'] === self::STATUS_QUEUED) {
  35294. $this->startJob($job['id']);
  35295. }
  35296. }
  35297. }
  35298. if (null !== $index) {
  35299. return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
  35300. }
  35301. $active = 0;
  35302. foreach ($this->jobs as $job) {
  35303. if ($job['status'] < self::STATUS_COMPLETED) {
  35304. $active++;
  35305. } else {
  35306. unset($this->jobs[$job['id']]);
  35307. }
  35308. }
  35309. return $active;
  35310. }
  35311. private function markJobDone(): void
  35312. {
  35313. $this->runningJobs--;
  35314. }
  35315. public function splitLines(?string $output): array
  35316. {
  35317. $output = trim((string) $output);
  35318. return $output === '' ? array() : Preg::split('{\r?\n}', $output);
  35319. }
  35320. public function getErrorOutput(): string
  35321. {
  35322. return $this->errorOutput;
  35323. }
  35324. public static function getTimeout(): int
  35325. {
  35326. return static::$timeout;
  35327. }
  35328. public static function setTimeout(int $timeout): void
  35329. {
  35330. static::$timeout = $timeout;
  35331. }
  35332. public static function escape($argument): string
  35333. {
  35334. return self::escapeArgument($argument);
  35335. }
  35336. private function outputCommandRun($command, ?string $cwd, bool $async): void
  35337. {
  35338. if (null === $this->io || !$this->io->isDebug()) {
  35339. return;
  35340. }
  35341. $commandString = is_string($command) ? $command : implode(' ', array_map(self::class.'::escape', $command));
  35342. $safeCommand = Preg::replaceCallback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m): string {
  35343. if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
  35344. return '://***:***@';
  35345. }
  35346. if (Preg::isMatch('{^[a-f0-9]{12,}$}', $m['user'])) {
  35347. return '://***:***@';
  35348. }
  35349. return '://'.$m['user'].':***@';
  35350. }, $commandString);
  35351. $safeCommand = Preg::replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  35352. $this->io->writeError('Executing'.($async ? ' async' : '').' command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  35353. }
  35354. private static function escapeArgument($argument): string
  35355. {
  35356. if ('' === ($argument = (string) $argument)) {
  35357. return escapeshellarg($argument);
  35358. }
  35359. if (!Platform::isWindows()) {
  35360. return "'".str_replace("'", "'\\''", $argument)."'";
  35361. }
  35362. $argument = strtr($argument, "\n", ' ');
  35363. $quote = strpbrk($argument, " \t") !== false;
  35364. $argument = Preg::replace('/(\\\\*)"/', '$1$1\\"', $argument, -1, $dquotes);
  35365. $meta = $dquotes || Preg::isMatch('/%[^%]+%|![^!]+!/', $argument);
  35366. if (!$meta && !$quote) {
  35367. $quote = strpbrk($argument, '^&|<>()') !== false;
  35368. }
  35369. if ($quote) {
  35370. $argument = '"'.Preg::replace('/(\\\\*)$/', '$1$1', $argument).'"';
  35371. }
  35372. if ($meta) {
  35373. $argument = Preg::replace('/(["^&|<>()%])/', '^$1', $argument);
  35374. $argument = Preg::replace('/(!)/', '^^$1', $argument);
  35375. }
  35376. return $argument;
  35377. }
  35378. }
  35379. <?php declare(strict_types=1);
  35380. namespace Composer\Util;
  35381. use Composer\Config;
  35382. use Composer\Downloader\MaxFileSizeExceededException;
  35383. use Composer\IO\IOInterface;
  35384. use Composer\Downloader\TransportException;
  35385. use Composer\Pcre\Preg;
  35386. use Composer\Util\Http\Response;
  35387. use Composer\Util\Http\ProxyManager;
  35388. class RemoteFilesystem
  35389. {
  35390. private $io;
  35391. private $config;
  35392. private $scheme;
  35393. private $bytesMax;
  35394. private $originUrl;
  35395. private $fileUrl;
  35396. private $fileName;
  35397. private $retry = false;
  35398. private $progress;
  35399. private $lastProgress;
  35400. private $options = array();
  35401. private $disableTls = false;
  35402. private $lastHeaders;
  35403. private $storeAuth = false;
  35404. private $authHelper;
  35405. private $degradedMode = false;
  35406. private $redirects;
  35407. private $maxRedirects = 20;
  35408. private $proxyManager;
  35409. public function __construct(IOInterface $io, Config $config, array $options = array(), bool $disableTls = false, AuthHelper $authHelper = null)
  35410. {
  35411. $this->io = $io;
  35412. if ($disableTls === false) {
  35413. $this->options = StreamContextFactory::getTlsDefaults($options, $io);
  35414. } else {
  35415. $this->disableTls = true;
  35416. }
  35417. $this->options = array_replace_recursive($this->options, $options);
  35418. $this->config = $config;
  35419. $this->authHelper = $authHelper ?? new AuthHelper($io, $config);
  35420. $this->proxyManager = ProxyManager::getInstance();
  35421. }
  35422. public function copy(string $originUrl, string $fileUrl, string $fileName, bool $progress = true, array $options = array())
  35423. {
  35424. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  35425. }
  35426. public function getContents(string $originUrl, string $fileUrl, bool $progress = true, array $options = array())
  35427. {
  35428. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  35429. }
  35430. public function getOptions()
  35431. {
  35432. return $this->options;
  35433. }
  35434. public function setOptions(array $options)
  35435. {
  35436. $this->options = array_replace_recursive($this->options, $options);
  35437. }
  35438. public function isTlsDisabled()
  35439. {
  35440. return $this->disableTls === true;
  35441. }
  35442. public function getLastHeaders()
  35443. {
  35444. return $this->lastHeaders;
  35445. }
  35446. public static function findStatusCode(array $headers)
  35447. {
  35448. $value = null;
  35449. foreach ($headers as $header) {
  35450. if (Preg::isMatch('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  35451. $value = (int) $match[1];
  35452. }
  35453. }
  35454. return $value;
  35455. }
  35456. public function findStatusMessage(array $headers)
  35457. {
  35458. $value = null;
  35459. foreach ($headers as $header) {
  35460. if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
  35461. $value = $header;
  35462. }
  35463. }
  35464. return $value;
  35465. }
  35466. protected function get(string $originUrl, string $fileUrl, array $additionalOptions = array(), string $fileName = null, bool $progress = true)
  35467. {
  35468. $this->scheme = parse_url(strtr($fileUrl, '\\', '/'), PHP_URL_SCHEME);
  35469. $this->bytesMax = 0;
  35470. $this->originUrl = $originUrl;
  35471. $this->fileUrl = $fileUrl;
  35472. $this->fileName = $fileName;
  35473. $this->progress = $progress;
  35474. $this->lastProgress = null;
  35475. $retryAuthFailure = true;
  35476. $this->lastHeaders = array();
  35477. $this->redirects = 1;
  35478. $tempAdditionalOptions = $additionalOptions;
  35479. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  35480. $retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  35481. unset($tempAdditionalOptions['retry-auth-failure']);
  35482. }
  35483. $isRedirect = false;
  35484. if (isset($tempAdditionalOptions['redirects'])) {
  35485. $this->redirects = $tempAdditionalOptions['redirects'];
  35486. $isRedirect = true;
  35487. unset($tempAdditionalOptions['redirects']);
  35488. }
  35489. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  35490. unset($tempAdditionalOptions);
  35491. $origFileUrl = $fileUrl;
  35492. if (isset($options['gitlab-token'])) {
  35493. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  35494. unset($options['gitlab-token']);
  35495. }
  35496. if (isset($options['http'])) {
  35497. $options['http']['ignore_errors'] = true;
  35498. }
  35499. if ($this->degradedMode && strpos($fileUrl, 'http://repo.packagist.org/') === 0) {
  35500. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  35501. $degradedPackagist = true;
  35502. }
  35503. $maxFileSize = null;
  35504. if (isset($options['max_file_size'])) {
  35505. $maxFileSize = $options['max_file_size'];
  35506. unset($options['max_file_size']);
  35507. }
  35508. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  35509. $proxy = $this->proxyManager->getProxyForRequest($fileUrl);
  35510. $usingProxy = $proxy->getFormattedUrl(' using proxy (%s)');
  35511. $this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  35512. unset($origFileUrl, $proxy, $usingProxy);
  35513. if ((!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist)) {
  35514. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  35515. }
  35516. if ($this->progress && !$isRedirect) {
  35517. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  35518. }
  35519. $errorMessage = '';
  35520. $errorCode = 0;
  35521. $result = false;
  35522. set_error_handler(function ($code, $msg) use (&$errorMessage): bool {
  35523. if ($errorMessage) {
  35524. $errorMessage .= "\n";
  35525. }
  35526. $errorMessage .= Preg::replace('{^file_get_contents\(.*?\): }', '', $msg);
  35527. return true;
  35528. });
  35529. $http_response_header = array();
  35530. try {
  35531. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header, $maxFileSize);
  35532. if (!empty($http_response_header[0])) {
  35533. $statusCode = self::findStatusCode($http_response_header);
  35534. if ($statusCode >= 400 && Response::findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  35535. HttpDownloader::outputWarnings($this->io, $originUrl, json_decode($result, true));
  35536. }
  35537. if (in_array($statusCode, array(401, 403)) && $retryAuthFailure) {
  35538. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $http_response_header);
  35539. }
  35540. }
  35541. $contentLength = !empty($http_response_header[0]) ? Response::findHeaderValue($http_response_header, 'content-length') : null;
  35542. if ($contentLength && Platform::strlen($result) < $contentLength) {
  35543. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  35544. $e->setHeaders($http_response_header);
  35545. $e->setStatusCode(self::findStatusCode($http_response_header));
  35546. try {
  35547. $e->setResponse($this->decodeResult($result, $http_response_header));
  35548. } catch (\Exception $discarded) {
  35549. $e->setResponse($this->normalizeResult($result));
  35550. }
  35551. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  35552. throw $e;
  35553. }
  35554. } catch (\Exception $e) {
  35555. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  35556. $e->setHeaders($http_response_header);
  35557. $e->setStatusCode(self::findStatusCode($http_response_header));
  35558. }
  35559. if ($e instanceof TransportException && $result !== false) {
  35560. $e->setResponse($this->decodeResult($result, $http_response_header));
  35561. }
  35562. $result = false;
  35563. }
  35564. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  35565. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  35566. }
  35567. restore_error_handler();
  35568. if (isset($e) && !$this->retry) {
  35569. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  35570. $this->degradedMode = true;
  35571. $this->io->writeError('');
  35572. $this->io->writeError(array(
  35573. '<error>'.$e->getMessage().'</error>',
  35574. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  35575. ));
  35576. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  35577. }
  35578. throw $e;
  35579. }
  35580. $statusCode = null;
  35581. $contentType = null;
  35582. $locationHeader = null;
  35583. if (!empty($http_response_header[0])) {
  35584. $statusCode = self::findStatusCode($http_response_header);
  35585. $contentType = Response::findHeaderValue($http_response_header, 'content-type');
  35586. $locationHeader = Response::findHeaderValue($http_response_header, 'location');
  35587. }
  35588. if ($originUrl === 'bitbucket.org'
  35589. && !$this->authHelper->isPublicBitBucketDownload($fileUrl)
  35590. && substr($fileUrl, -4) === '.zip'
  35591. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  35592. && $contentType && Preg::isMatch('{^text/html\b}i', $contentType)
  35593. ) {
  35594. $result = false;
  35595. if ($retryAuthFailure) {
  35596. $this->promptAuthAndRetry(401);
  35597. }
  35598. }
  35599. if ($statusCode === 404
  35600. && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  35601. && false !== strpos($fileUrl, 'archive.zip')
  35602. ) {
  35603. $result = false;
  35604. if ($retryAuthFailure) {
  35605. $this->promptAuthAndRetry(401);
  35606. }
  35607. }
  35608. $hasFollowedRedirect = false;
  35609. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  35610. $hasFollowedRedirect = true;
  35611. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  35612. }
  35613. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  35614. if (!$this->retry) {
  35615. if ($this->progress && !$isRedirect) {
  35616. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  35617. }
  35618. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  35619. $e->setHeaders($http_response_header);
  35620. $e->setResponse($this->decodeResult($result, $http_response_header));
  35621. $e->setStatusCode($statusCode);
  35622. throw $e;
  35623. }
  35624. $result = false;
  35625. }
  35626. if ($this->progress && !$this->retry && !$isRedirect) {
  35627. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  35628. }
  35629. if ($result && extension_loaded('zlib') && strpos($fileUrl, 'http') === 0 && !$hasFollowedRedirect) {
  35630. try {
  35631. $result = $this->decodeResult($result, $http_response_header);
  35632. } catch (\Exception $e) {
  35633. if ($this->degradedMode) {
  35634. throw $e;
  35635. }
  35636. $this->degradedMode = true;
  35637. $this->io->writeError(array(
  35638. '',
  35639. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  35640. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  35641. ));
  35642. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  35643. }
  35644. }
  35645. if (false !== $result && null !== $fileName && !$isRedirect) {
  35646. if ('' === $result) {
  35647. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  35648. }
  35649. $errorMessage = '';
  35650. set_error_handler(function ($code, $msg) use (&$errorMessage): bool {
  35651. if ($errorMessage) {
  35652. $errorMessage .= "\n";
  35653. }
  35654. $errorMessage .= Preg::replace('{^file_put_contents\(.*?\): }', '', $msg);
  35655. return true;
  35656. });
  35657. $result = (bool) file_put_contents($fileName, $result);
  35658. restore_error_handler();
  35659. if (false === $result) {
  35660. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  35661. }
  35662. }
  35663. if ($this->retry) {
  35664. $this->retry = false;
  35665. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  35666. if ($this->storeAuth) {
  35667. $this->authHelper->storeAuth($this->originUrl, $this->storeAuth);
  35668. $this->storeAuth = false;
  35669. }
  35670. return $result;
  35671. }
  35672. if (false === $result) {
  35673. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  35674. if (!empty($http_response_header[0])) {
  35675. $e->setHeaders($http_response_header);
  35676. }
  35677. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  35678. $this->degradedMode = true;
  35679. $this->io->writeError('');
  35680. $this->io->writeError(array(
  35681. '<error>'.$e->getMessage().'</error>',
  35682. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  35683. ));
  35684. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  35685. }
  35686. throw $e;
  35687. }
  35688. if (!empty($http_response_header[0])) {
  35689. $this->lastHeaders = $http_response_header;
  35690. }
  35691. return $result;
  35692. }
  35693. protected function getRemoteContents(string $originUrl, string $fileUrl, $context, array &$responseHeaders = null, int $maxFileSize = null)
  35694. {
  35695. $result = false;
  35696. try {
  35697. $e = null;
  35698. if ($maxFileSize !== null) {
  35699. $result = file_get_contents($fileUrl, false, $context, 0, $maxFileSize);
  35700. } else {
  35701. $result = file_get_contents($fileUrl, false, $context);
  35702. }
  35703. } catch (\Throwable $e) {
  35704. }
  35705. if ($result !== false && $maxFileSize !== null && Platform::strlen($result) >= $maxFileSize) {
  35706. throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($result) . ' of allowed ' . $maxFileSize . ' bytes');
  35707. }
  35708. $responseHeaders = $http_response_header ?? array();
  35709. if (null !== $e) {
  35710. throw $e;
  35711. }
  35712. return $result;
  35713. }
  35714. protected function callbackGet(int $notificationCode, int $severity, ?string $message, int $messageCode, int $bytesTransferred, int $bytesMax)
  35715. {
  35716. switch ($notificationCode) {
  35717. case STREAM_NOTIFY_FAILURE:
  35718. if (400 === $messageCode) {
  35719. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  35720. }
  35721. break;
  35722. case STREAM_NOTIFY_FILE_SIZE_IS:
  35723. $this->bytesMax = $bytesMax;
  35724. break;
  35725. case STREAM_NOTIFY_PROGRESS:
  35726. if ($this->bytesMax > 0 && $this->progress) {
  35727. $progression = min(100, (int) round($bytesTransferred / $this->bytesMax * 100));
  35728. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  35729. $this->lastProgress = $progression;
  35730. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  35731. }
  35732. }
  35733. break;
  35734. default:
  35735. break;
  35736. }
  35737. }
  35738. protected function promptAuthAndRetry($httpStatus, ?string $reason = null, array $headers = array())
  35739. {
  35740. $result = $this->authHelper->promptAuthIfNeeded($this->fileUrl, $this->originUrl, $httpStatus, $reason, $headers);
  35741. $this->storeAuth = $result['storeAuth'];
  35742. $this->retry = $result['retry'];
  35743. if ($this->retry) {
  35744. throw new TransportException('RETRY');
  35745. }
  35746. }
  35747. protected function getOptionsForUrl(string $originUrl, array $additionalOptions)
  35748. {
  35749. $tlsOptions = array();
  35750. $headers = array();
  35751. if (extension_loaded('zlib')) {
  35752. $headers[] = 'Accept-Encoding: gzip';
  35753. }
  35754. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  35755. if (!$this->degradedMode) {
  35756. $options['http']['protocol_version'] = 1.1;
  35757. $headers[] = 'Connection: close';
  35758. }
  35759. $headers = $this->authHelper->addAuthenticationHeader($headers, $originUrl, $this->fileUrl);
  35760. $options['http']['follow_location'] = 0;
  35761. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  35762. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  35763. }
  35764. foreach ($headers as $header) {
  35765. $options['http']['header'][] = $header;
  35766. }
  35767. return $options;
  35768. }
  35769. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  35770. {
  35771. if ($locationHeader = Response::findHeaderValue($http_response_header, 'location')) {
  35772. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  35773. $targetUrl = $locationHeader;
  35774. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  35775. $targetUrl = $this->scheme.':'.$locationHeader;
  35776. } elseif ('/' === $locationHeader[0]) {
  35777. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  35778. $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  35779. } else {
  35780. $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  35781. }
  35782. }
  35783. if (!empty($targetUrl)) {
  35784. $this->redirects++;
  35785. $this->io->writeError('', true, IOInterface::DEBUG);
  35786. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
  35787. $additionalOptions['redirects'] = $this->redirects;
  35788. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  35789. }
  35790. if (!$this->retry) {
  35791. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  35792. $e->setHeaders($http_response_header);
  35793. $e->setResponse($this->decodeResult($result, $http_response_header));
  35794. throw $e;
  35795. }
  35796. return false;
  35797. }
  35798. private function decodeResult($result, array $http_response_header): ?string
  35799. {
  35800. if ($result && extension_loaded('zlib')) {
  35801. $contentEncoding = Response::findHeaderValue($http_response_header, 'content-encoding');
  35802. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  35803. if ($decode) {
  35804. $result = zlib_decode($result);
  35805. if ($result === false) {
  35806. throw new TransportException('Failed to decode zlib stream');
  35807. }
  35808. }
  35809. }
  35810. return $this->normalizeResult($result);
  35811. }
  35812. private function normalizeResult($result): ?string
  35813. {
  35814. if ($result === false) {
  35815. return null;
  35816. }
  35817. return $result;
  35818. }
  35819. }
  35820. <?php declare(strict_types=1);
  35821. namespace Composer\Util;
  35822. class Silencer
  35823. {
  35824. private static $stack = array();
  35825. public static function suppress(?int $mask = null): int
  35826. {
  35827. if (!isset($mask)) {
  35828. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  35829. }
  35830. $old = error_reporting();
  35831. self::$stack[] = $old;
  35832. error_reporting($old & ~$mask);
  35833. return $old;
  35834. }
  35835. public static function restore(): void
  35836. {
  35837. if (!empty(self::$stack)) {
  35838. error_reporting(array_pop(self::$stack));
  35839. }
  35840. }
  35841. public static function call(callable $callable, ...$parameters)
  35842. {
  35843. try {
  35844. self::suppress();
  35845. $result = $callable(...$parameters);
  35846. self::restore();
  35847. return $result;
  35848. } catch (\Exception $e) {
  35849. self::restore();
  35850. throw $e;
  35851. }
  35852. }
  35853. }
  35854. <?php declare(strict_types=1);
  35855. namespace Composer\Util;
  35856. use Composer\Composer;
  35857. use Composer\CaBundle\CaBundle;
  35858. use Composer\Downloader\TransportException;
  35859. use Composer\Repository\PlatformRepository;
  35860. use Composer\Util\Http\ProxyManager;
  35861. use Psr\Log\LoggerInterface;
  35862. final class StreamContextFactory
  35863. {
  35864. public static function getContext(string $url, array $defaultOptions = array(), array $defaultParams = array())
  35865. {
  35866. $options = array('http' => array(
  35867. 'follow_location' => 1,
  35868. 'max_redirects' => 20,
  35869. ));
  35870. $options = array_replace_recursive($options, self::initOptions($url, $defaultOptions));
  35871. unset($defaultOptions['http']['header']);
  35872. $options = array_replace_recursive($options, $defaultOptions);
  35873. if (isset($options['http']['header'])) {
  35874. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  35875. }
  35876. return stream_context_create($options, $defaultParams);
  35877. }
  35878. public static function initOptions(string $url, array $options, bool $forCurl = false): array
  35879. {
  35880. if (!isset($options['http']['header'])) {
  35881. $options['http']['header'] = array();
  35882. }
  35883. if (is_string($options['http']['header'])) {
  35884. $options['http']['header'] = explode("\r\n", $options['http']['header']);
  35885. }
  35886. if (!$forCurl) {
  35887. $proxy = ProxyManager::getInstance()->getProxyForRequest($url);
  35888. if ($proxyOptions = $proxy->getContextOptions()) {
  35889. $isHttpsRequest = 0 === strpos($url, 'https://');
  35890. if ($proxy->isSecure()) {
  35891. if (!extension_loaded('openssl')) {
  35892. throw new TransportException('You must enable the openssl extension to use a secure proxy.');
  35893. }
  35894. if ($isHttpsRequest) {
  35895. throw new TransportException('You must enable the curl extension to make https requests through a secure proxy.');
  35896. }
  35897. } elseif ($isHttpsRequest && !extension_loaded('openssl')) {
  35898. throw new TransportException('You must enable the openssl extension to make https requests through a proxy.');
  35899. }
  35900. if (isset($proxyOptions['http']['header'])) {
  35901. $options['http']['header'][] = $proxyOptions['http']['header'];
  35902. unset($proxyOptions['http']['header']);
  35903. }
  35904. $options = array_replace_recursive($options, $proxyOptions);
  35905. }
  35906. }
  35907. if (defined('HHVM_VERSION')) {
  35908. $phpVersion = 'HHVM ' . HHVM_VERSION;
  35909. } else {
  35910. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  35911. }
  35912. if ($forCurl) {
  35913. $curl = curl_version();
  35914. $httpVersion = 'cURL '.$curl['version'];
  35915. } else {
  35916. $httpVersion = 'streams';
  35917. }
  35918. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  35919. $platformPhpVersion = PlatformRepository::getPlatformPhpVersion();
  35920. $options['http']['header'][] = sprintf(
  35921. 'User-Agent: Composer/%s (%s; %s; %s; %s%s%s)',
  35922. Composer::getVersion(),
  35923. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  35924. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  35925. $phpVersion,
  35926. $httpVersion,
  35927. $platformPhpVersion ? '; Platform-PHP '.$platformPhpVersion : '',
  35928. Platform::getEnv('CI') ? '; CI' : ''
  35929. );
  35930. }
  35931. return $options;
  35932. }
  35933. public static function getTlsDefaults(array $options, LoggerInterface $logger = null): array
  35934. {
  35935. $ciphers = implode(':', array(
  35936. 'ECDHE-RSA-AES128-GCM-SHA256',
  35937. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  35938. 'ECDHE-RSA-AES256-GCM-SHA384',
  35939. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  35940. 'DHE-RSA-AES128-GCM-SHA256',
  35941. 'DHE-DSS-AES128-GCM-SHA256',
  35942. 'kEDH+AESGCM',
  35943. 'ECDHE-RSA-AES128-SHA256',
  35944. 'ECDHE-ECDSA-AES128-SHA256',
  35945. 'ECDHE-RSA-AES128-SHA',
  35946. 'ECDHE-ECDSA-AES128-SHA',
  35947. 'ECDHE-RSA-AES256-SHA384',
  35948. 'ECDHE-ECDSA-AES256-SHA384',
  35949. 'ECDHE-RSA-AES256-SHA',
  35950. 'ECDHE-ECDSA-AES256-SHA',
  35951. 'DHE-RSA-AES128-SHA256',
  35952. 'DHE-RSA-AES128-SHA',
  35953. 'DHE-DSS-AES128-SHA256',
  35954. 'DHE-RSA-AES256-SHA256',
  35955. 'DHE-DSS-AES256-SHA',
  35956. 'DHE-RSA-AES256-SHA',
  35957. 'AES128-GCM-SHA256',
  35958. 'AES256-GCM-SHA384',
  35959. 'AES128-SHA256',
  35960. 'AES256-SHA256',
  35961. 'AES128-SHA',
  35962. 'AES256-SHA',
  35963. 'AES',
  35964. 'CAMELLIA',
  35965. 'DES-CBC3-SHA',
  35966. '!aNULL',
  35967. '!eNULL',
  35968. '!EXPORT',
  35969. '!DES',
  35970. '!RC4',
  35971. '!MD5',
  35972. '!PSK',
  35973. '!aECDH',
  35974. '!EDH-DSS-DES-CBC3-SHA',
  35975. '!EDH-RSA-DES-CBC3-SHA',
  35976. '!KRB5-DES-CBC3-SHA',
  35977. ));
  35978. $defaults = array(
  35979. 'ssl' => array(
  35980. 'ciphers' => $ciphers,
  35981. 'verify_peer' => true,
  35982. 'verify_depth' => 7,
  35983. 'SNI_enabled' => true,
  35984. 'capture_peer_cert' => true,
  35985. ),
  35986. );
  35987. if (isset($options['ssl'])) {
  35988. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  35989. }
  35990. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  35991. $result = CaBundle::getSystemCaRootBundlePath($logger);
  35992. if (is_dir($result)) {
  35993. $defaults['ssl']['capath'] = $result;
  35994. } else {
  35995. $defaults['ssl']['cafile'] = $result;
  35996. }
  35997. }
  35998. if (isset($defaults['ssl']['cafile']) && (!Filesystem::isReadable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $logger))) {
  35999. throw new TransportException('The configured cafile was not valid or could not be read.');
  36000. }
  36001. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !Filesystem::isReadable($defaults['ssl']['capath']))) {
  36002. throw new TransportException('The configured capath was not valid or could not be read.');
  36003. }
  36004. $defaults['ssl']['disable_compression'] = true;
  36005. return $defaults;
  36006. }
  36007. private static function fixHttpHeaderField($header): array
  36008. {
  36009. if (!is_array($header)) {
  36010. $header = explode("\r\n", $header);
  36011. }
  36012. uasort($header, function ($el): int {
  36013. return stripos($el, 'content-type') === 0 ? 1 : -1;
  36014. });
  36015. return $header;
  36016. }
  36017. }
  36018. <?php declare(strict_types=1);
  36019. namespace Composer\Util;
  36020. use Composer\Config;
  36021. use Composer\IO\IOInterface;
  36022. use Composer\Pcre\Preg;
  36023. class Svn
  36024. {
  36025. private const MAX_QTY_AUTH_TRIES = 5;
  36026. protected $credentials;
  36027. protected $hasAuth;
  36028. protected $io;
  36029. protected $url;
  36030. protected $cacheCredentials = true;
  36031. protected $process;
  36032. protected $qtyAuthTries = 0;
  36033. protected $config;
  36034. private static $version;
  36035. public function __construct(string $url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  36036. {
  36037. $this->url = $url;
  36038. $this->io = $io;
  36039. $this->config = $config;
  36040. $this->process = $process ?: new ProcessExecutor($io);
  36041. }
  36042. public static function cleanEnv(): void
  36043. {
  36044. Platform::clearEnv('DYLD_LIBRARY_PATH');
  36045. }
  36046. public function execute(string $command, string $url, ?string $cwd = null, ?string $path = null, bool $verbose = false): string
  36047. {
  36048. $this->config->prohibitUrlByConfig($url, $this->io);
  36049. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  36050. }
  36051. public function executeLocal(string $command, string $path, string $cwd = null, bool $verbose = false): string
  36052. {
  36053. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  36054. }
  36055. private function executeWithAuthRetry(string $svnCommand, ?string $cwd, string $url, ?string $path, bool $verbose): ?string
  36056. {
  36057. $command = $this->getCommand($svnCommand, $url, $path);
  36058. $output = null;
  36059. $io = $this->io;
  36060. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  36061. if ($type !== 'out') {
  36062. return null;
  36063. }
  36064. if (strpos($buffer, 'Redirecting to URL ') === 0) {
  36065. return null;
  36066. }
  36067. $output .= $buffer;
  36068. if ($verbose) {
  36069. $io->writeError($buffer, false);
  36070. }
  36071. };
  36072. $status = $this->process->execute($command, $handler, $cwd);
  36073. if (0 === $status) {
  36074. return $output;
  36075. }
  36076. $errorOutput = $this->process->getErrorOutput();
  36077. $fullOutput = trim(implode("\n", array($output, $errorOutput)));
  36078. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  36079. && false === stripos($fullOutput, 'authorization failed')
  36080. && false === stripos($fullOutput, 'svn: E170001:')
  36081. && false === stripos($fullOutput, 'svn: E215004:')) {
  36082. throw new \RuntimeException($fullOutput);
  36083. }
  36084. if (!$this->hasAuth()) {
  36085. $this->doAuthDance();
  36086. }
  36087. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  36088. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  36089. }
  36090. throw new \RuntimeException(
  36091. 'wrong credentials provided ('.$fullOutput.')'
  36092. );
  36093. }
  36094. public function setCacheCredentials(bool $cacheCredentials): void
  36095. {
  36096. $this->cacheCredentials = $cacheCredentials;
  36097. }
  36098. protected function doAuthDance(): Svn
  36099. {
  36100. if (!$this->io->isInteractive()) {
  36101. throw new \RuntimeException(
  36102. 'can not ask for authentication in non interactive mode'
  36103. );
  36104. }
  36105. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  36106. $this->hasAuth = true;
  36107. $this->credentials = array(
  36108. 'username' => (string) $this->io->ask("Username: ", ''),
  36109. 'password' => (string) $this->io->askAndHideAnswer("Password: "),
  36110. );
  36111. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ");
  36112. return $this;
  36113. }
  36114. protected function getCommand(string $cmd, string $url, ?string $path = null): string
  36115. {
  36116. $cmd = sprintf(
  36117. '%s %s%s -- %s',
  36118. $cmd,
  36119. '--non-interactive ',
  36120. $this->getCredentialString(),
  36121. ProcessExecutor::escape($url)
  36122. );
  36123. if ($path) {
  36124. $cmd .= ' ' . ProcessExecutor::escape($path);
  36125. }
  36126. return $cmd;
  36127. }
  36128. protected function getCredentialString(): string
  36129. {
  36130. if (!$this->hasAuth()) {
  36131. return '';
  36132. }
  36133. return sprintf(
  36134. ' %s--username %s --password %s ',
  36135. $this->getAuthCache(),
  36136. ProcessExecutor::escape($this->getUsername()),
  36137. ProcessExecutor::escape($this->getPassword())
  36138. );
  36139. }
  36140. protected function getPassword(): string
  36141. {
  36142. if ($this->credentials === null) {
  36143. throw new \LogicException("No svn auth detected.");
  36144. }
  36145. return $this->credentials['password'];
  36146. }
  36147. protected function getUsername(): string
  36148. {
  36149. if ($this->credentials === null) {
  36150. throw new \LogicException("No svn auth detected.");
  36151. }
  36152. return $this->credentials['username'];
  36153. }
  36154. protected function hasAuth(): bool
  36155. {
  36156. if (null !== $this->hasAuth) {
  36157. return $this->hasAuth;
  36158. }
  36159. if (false === $this->createAuthFromConfig()) {
  36160. $this->createAuthFromUrl();
  36161. }
  36162. return (bool) $this->hasAuth;
  36163. }
  36164. protected function getAuthCache(): string
  36165. {
  36166. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  36167. }
  36168. private function createAuthFromConfig(): bool
  36169. {
  36170. if (!$this->config->has('http-basic')) {
  36171. return $this->hasAuth = false;
  36172. }
  36173. $authConfig = $this->config->get('http-basic');
  36174. $host = parse_url($this->url, PHP_URL_HOST);
  36175. if (isset($authConfig[$host])) {
  36176. $this->credentials = array(
  36177. 'username' => $authConfig[$host]['username'],
  36178. 'password' => $authConfig[$host]['password'],
  36179. );
  36180. return $this->hasAuth = true;
  36181. }
  36182. return $this->hasAuth = false;
  36183. }
  36184. private function createAuthFromUrl(): bool
  36185. {
  36186. $uri = parse_url($this->url);
  36187. if (empty($uri['user'])) {
  36188. return $this->hasAuth = false;
  36189. }
  36190. $this->credentials = array(
  36191. 'username' => $uri['user'],
  36192. 'password' => !empty($uri['pass']) ? $uri['pass'] : '',
  36193. );
  36194. return $this->hasAuth = true;
  36195. }
  36196. public function binaryVersion(): ?string
  36197. {
  36198. if (!self::$version) {
  36199. if (0 === $this->process->execute('svn --version', $output)) {
  36200. if (Preg::isMatch('{(\d+(?:\.\d+)+)}', $output, $match)) {
  36201. self::$version = $match[1];
  36202. }
  36203. }
  36204. }
  36205. return self::$version;
  36206. }
  36207. }
  36208. <?php declare(strict_types=1);
  36209. namespace Composer\Util;
  36210. use Composer\Downloader\DownloaderInterface;
  36211. use Composer\Package\PackageInterface;
  36212. use React\Promise\PromiseInterface;
  36213. class SyncHelper
  36214. {
  36215. public static function downloadAndInstallPackageSync(Loop $loop, DownloaderInterface $downloader, string $path, PackageInterface $package, PackageInterface $prevPackage = null): void
  36216. {
  36217. $type = $prevPackage ? 'update' : 'install';
  36218. try {
  36219. self::await($loop, $downloader->download($package, $path, $prevPackage));
  36220. self::await($loop, $downloader->prepare($type, $package, $path, $prevPackage));
  36221. if ($type === 'update') {
  36222. self::await($loop, $downloader->update($package, $prevPackage, $path));
  36223. } else {
  36224. self::await($loop, $downloader->install($package, $path));
  36225. }
  36226. } catch (\Exception $e) {
  36227. self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
  36228. throw $e;
  36229. }
  36230. self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
  36231. }
  36232. public static function await(Loop $loop, PromiseInterface $promise = null): void
  36233. {
  36234. if ($promise) {
  36235. $loop->wait(array($promise));
  36236. }
  36237. }
  36238. }
  36239. <?php declare(strict_types=1);
  36240. namespace Composer\Util;
  36241. class Tar
  36242. {
  36243. public static function getComposerJson(string $pathToArchive): ?string
  36244. {
  36245. $phar = new \PharData($pathToArchive);
  36246. if (!$phar->valid()) {
  36247. return null;
  36248. }
  36249. return self::extractComposerJsonFromFolder($phar);
  36250. }
  36251. private static function extractComposerJsonFromFolder(\PharData $phar): string
  36252. {
  36253. if (isset($phar['composer.json'])) {
  36254. return $phar['composer.json']->getContent();
  36255. }
  36256. $topLevelPaths = array();
  36257. foreach ($phar as $folderFile) {
  36258. $name = $folderFile->getBasename();
  36259. if ($folderFile->isDir()) {
  36260. $topLevelPaths[$name] = true;
  36261. if (\count($topLevelPaths) > 1) {
  36262. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  36263. }
  36264. }
  36265. }
  36266. $composerJsonPath = key($topLevelPaths).'/composer.json';
  36267. if ($topLevelPaths && isset($phar[$composerJsonPath])) {
  36268. return $phar[$composerJsonPath]->getContent();
  36269. }
  36270. throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
  36271. }
  36272. }
  36273. <?php declare(strict_types=1);
  36274. namespace Composer\Util;
  36275. use Composer\CaBundle\CaBundle;
  36276. use Composer\Pcre\Preg;
  36277. final class TlsHelper
  36278. {
  36279. public static function checkCertificateHost($certificate, string $hostname, string &$cn = null): bool
  36280. {
  36281. $names = self::getCertificateNames($certificate);
  36282. if (empty($names)) {
  36283. return false;
  36284. }
  36285. $combinedNames = array_merge($names['san'], array($names['cn']));
  36286. $hostname = strtolower($hostname);
  36287. foreach ($combinedNames as $certName) {
  36288. $matcher = self::certNameMatcher($certName);
  36289. if ($matcher && $matcher($hostname)) {
  36290. $cn = $names['cn'];
  36291. return true;
  36292. }
  36293. }
  36294. return false;
  36295. }
  36296. public static function getCertificateNames($certificate): ?array
  36297. {
  36298. if (is_array($certificate)) {
  36299. $info = $certificate;
  36300. } elseif (CaBundle::isOpensslParseSafe()) {
  36301. $info = openssl_x509_parse($certificate, false);
  36302. }
  36303. if (!isset($info['subject']['commonName'])) {
  36304. return null;
  36305. }
  36306. $commonName = strtolower($info['subject']['commonName']);
  36307. $subjectAltNames = array();
  36308. if (isset($info['extensions']['subjectAltName'])) {
  36309. $subjectAltNames = Preg::split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  36310. $subjectAltNames = array_filter(array_map(function ($name): ?string {
  36311. if (0 === strpos($name, 'DNS:')) {
  36312. return strtolower(ltrim(substr($name, 4)));
  36313. }
  36314. return null;
  36315. }, $subjectAltNames));
  36316. $subjectAltNames = array_values($subjectAltNames);
  36317. }
  36318. return array(
  36319. 'cn' => $commonName,
  36320. 'san' => $subjectAltNames,
  36321. );
  36322. }
  36323. public static function getCertificateFingerprint(string $certificate): string
  36324. {
  36325. $pubkey = openssl_get_publickey($certificate);
  36326. if ($pubkey === false) {
  36327. throw new \RuntimeException('Failed to retrieve the public key from certificate');
  36328. }
  36329. $pubkeydetails = openssl_pkey_get_details($pubkey);
  36330. $pubkeypem = $pubkeydetails['key'];
  36331. $start = '-----BEGIN PUBLIC KEY-----';
  36332. $end = '-----END PUBLIC KEY-----';
  36333. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  36334. $der = base64_decode($pemtrim);
  36335. return sha1($der);
  36336. }
  36337. public static function isOpensslParseSafe(): bool
  36338. {
  36339. return CaBundle::isOpensslParseSafe();
  36340. }
  36341. private static function certNameMatcher(string $certName): ?callable
  36342. {
  36343. $wildcards = substr_count($certName, '*');
  36344. if (0 === $wildcards) {
  36345. return function ($hostname) use ($certName): bool {
  36346. return $hostname === $certName;
  36347. };
  36348. }
  36349. if (1 === $wildcards) {
  36350. $components = explode('.', $certName);
  36351. if (3 > count($components)) {
  36352. return null;
  36353. }
  36354. $firstComponent = $components[0];
  36355. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  36356. return null;
  36357. }
  36358. $wildcardRegex = preg_quote($certName);
  36359. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  36360. $wildcardRegex = "{^{$wildcardRegex}$}";
  36361. return function ($hostname) use ($wildcardRegex): bool {
  36362. return Preg::isMatch($wildcardRegex, $hostname);
  36363. };
  36364. }
  36365. return null;
  36366. }
  36367. }
  36368. <?php declare(strict_types=1);
  36369. namespace Composer\Util;
  36370. use Composer\Config;
  36371. use Composer\Pcre\Preg;
  36372. class Url
  36373. {
  36374. public static function updateDistReference(Config $config, string $url, string $ref): string
  36375. {
  36376. $host = parse_url($url, PHP_URL_HOST);
  36377. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  36378. if (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  36379. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  36380. } elseif (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  36381. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  36382. } elseif (Preg::isMatch('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  36383. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  36384. }
  36385. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  36386. if (Preg::isMatch('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  36387. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  36388. }
  36389. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  36390. if (Preg::isMatch('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  36391. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  36392. }
  36393. } elseif (in_array($host, $config->get('github-domains'), true)) {
  36394. $url = Preg::replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  36395. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  36396. $url = Preg::replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  36397. }
  36398. return $url;
  36399. }
  36400. public static function getOrigin(Config $config, string $url): string
  36401. {
  36402. if (0 === strpos($url, 'file://')) {
  36403. return $url;
  36404. }
  36405. $origin = (string) parse_url($url, PHP_URL_HOST);
  36406. if ($port = parse_url($url, PHP_URL_PORT)) {
  36407. $origin .= ':'.$port;
  36408. }
  36409. if (strpos($origin, '.github.com') === (strlen($origin) - 11)) {
  36410. return 'github.com';
  36411. }
  36412. if ($origin === 'repo.packagist.org') {
  36413. return 'packagist.org';
  36414. }
  36415. if ($origin === '') {
  36416. $origin = $url;
  36417. }
  36418. if (
  36419. is_array($config->get('gitlab-domains'))
  36420. && false === strpos($origin, '/')
  36421. && !in_array($origin, $config->get('gitlab-domains'))
  36422. ) {
  36423. foreach ($config->get('gitlab-domains') as $gitlabDomain) {
  36424. if (0 === strpos($gitlabDomain, $origin)) {
  36425. return $gitlabDomain;
  36426. }
  36427. }
  36428. }
  36429. return $origin;
  36430. }
  36431. public static function sanitize(string $url): string
  36432. {
  36433. $url = Preg::replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  36434. $url = Preg::replaceCallback('{^(?P<prefix>[a-z0-9]+://)?(?P<user>[^:/\s@]+):(?P<password>[^@\s/]+)@}i', function ($m): string {
  36435. if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
  36436. return $m['prefix'].'***:***@';
  36437. }
  36438. return $m['prefix'].$m['user'].':***@';
  36439. }, $url);
  36440. return $url;
  36441. }
  36442. }
  36443. <?php declare(strict_types=1);
  36444. namespace Composer\Util;
  36445. class Zip
  36446. {
  36447. public static function getComposerJson(string $pathToZip): ?string
  36448. {
  36449. if (!extension_loaded('zip')) {
  36450. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  36451. }
  36452. $zip = new \ZipArchive();
  36453. if ($zip->open($pathToZip) !== true) {
  36454. return null;
  36455. }
  36456. if (0 == $zip->numFiles) {
  36457. $zip->close();
  36458. return null;
  36459. }
  36460. $foundFileIndex = self::locateFile($zip, 'composer.json');
  36461. $content = null;
  36462. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  36463. $stream = $zip->getStream($configurationFileName);
  36464. if (false !== $stream) {
  36465. $content = stream_get_contents($stream);
  36466. }
  36467. $zip->close();
  36468. return $content;
  36469. }
  36470. private static function locateFile(\ZipArchive $zip, string $filename): int
  36471. {
  36472. if (false !== ($index = $zip->locateName($filename)) && $zip->getFromIndex($index) !== false) {
  36473. return $index;
  36474. }
  36475. $topLevelPaths = array();
  36476. for ($i = 0; $i < $zip->numFiles; $i++) {
  36477. $name = $zip->getNameIndex($i);
  36478. $dirname = dirname($name);
  36479. if (strpos($name, '__MACOSX') !== false) {
  36480. continue;
  36481. }
  36482. if ($dirname === '.') {
  36483. $topLevelPaths[$name] = true;
  36484. if (\count($topLevelPaths) > 1) {
  36485. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  36486. }
  36487. continue;
  36488. }
  36489. if (false === strpos($dirname, '\\') && false === strpos($dirname, '/')) {
  36490. $topLevelPaths[$dirname.'/'] = true;
  36491. if (\count($topLevelPaths) > 1) {
  36492. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  36493. }
  36494. }
  36495. }
  36496. if ($topLevelPaths && false !== ($index = $zip->locateName(key($topLevelPaths).$filename)) && $zip->getFromIndex($index) !== false) {
  36497. return $index;
  36498. }
  36499. throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
  36500. }
  36501. }
  36502. <?php declare(strict_types=1);
  36503. use Composer\Autoload\ClassLoader;
  36504. function includeIfExists(string $file): ?ClassLoader
  36505. {
  36506. return file_exists($file) ? include $file : null;
  36507. }
  36508. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  36509. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  36510. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  36511. exit(1);
  36512. }
  36513. return $loader;
  36514. <?php
  36515. /*
  36516. * This file is part of Composer.
  36517. *
  36518. * (c) Nils Adermann <naderman@naderman.de>
  36519. * Jordi Boggiano <j.boggiano@seld.be>
  36520. *
  36521. * For the full copyright and license information, please view the LICENSE
  36522. * file that was distributed with this source code.
  36523. */
  36524. namespace Composer\Autoload;
  36525. /**
  36526. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  36527. *
  36528. * $loader = new \Composer\Autoload\ClassLoader();
  36529. *
  36530. * // register classes with namespaces
  36531. * $loader->add('Symfony\Component', __DIR__.'/component');
  36532. * $loader->add('Symfony', __DIR__.'/framework');
  36533. *
  36534. * // activate the autoloader
  36535. * $loader->register();
  36536. *
  36537. * // to enable searching the include path (eg. for PEAR packages)
  36538. * $loader->setUseIncludePath(true);
  36539. *
  36540. * In this example, if you try to use a class in the Symfony\Component
  36541. * namespace or one of its children (Symfony\Component\Console for instance),
  36542. * the autoloader will first look for the class under the component/
  36543. * directory, and it will then fallback to the framework/ directory if not
  36544. * found before giving up.
  36545. *
  36546. * This class is loosely based on the Symfony UniversalClassLoader.
  36547. *
  36548. * @author Fabien Potencier <fabien@symfony.com>
  36549. * @author Jordi Boggiano <j.boggiano@seld.be>
  36550. * @see https://www.php-fig.org/psr/psr-0/
  36551. * @see https://www.php-fig.org/psr/psr-4/
  36552. */
  36553. class ClassLoader
  36554. {
  36555. /** @var ?string */
  36556. private $vendorDir;
  36557. // PSR-4
  36558. /**
  36559. * @var array[]
  36560. * @psalm-var array<string, array<string, int>>
  36561. */
  36562. private $prefixLengthsPsr4 = array();
  36563. /**
  36564. * @var array[]
  36565. * @psalm-var array<string, array<int, string>>
  36566. */
  36567. private $prefixDirsPsr4 = array();
  36568. /**
  36569. * @var array[]
  36570. * @psalm-var array<string, string>
  36571. */
  36572. private $fallbackDirsPsr4 = array();
  36573. // PSR-0
  36574. /**
  36575. * @var array[]
  36576. * @psalm-var array<string, array<string, string[]>>
  36577. */
  36578. private $prefixesPsr0 = array();
  36579. /**
  36580. * @var array[]
  36581. * @psalm-var array<string, string>
  36582. */
  36583. private $fallbackDirsPsr0 = array();
  36584. /** @var bool */
  36585. private $useIncludePath = false;
  36586. /**
  36587. * @var string[]
  36588. * @psalm-var array<string, string>
  36589. */
  36590. private $classMap = array();
  36591. /** @var bool */
  36592. private $classMapAuthoritative = false;
  36593. /**
  36594. * @var bool[]
  36595. * @psalm-var array<string, bool>
  36596. */
  36597. private $missingClasses = array();
  36598. /** @var ?string */
  36599. private $apcuPrefix;
  36600. /**
  36601. * @var self[]
  36602. */
  36603. private static $registeredLoaders = array();
  36604. /**
  36605. * @param ?string $vendorDir
  36606. */
  36607. public function __construct($vendorDir = null)
  36608. {
  36609. $this->vendorDir = $vendorDir;
  36610. }
  36611. /**
  36612. * @return string[]
  36613. */
  36614. public function getPrefixes()
  36615. {
  36616. if (!empty($this->prefixesPsr0)) {
  36617. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  36618. }
  36619. return array();
  36620. }
  36621. /**
  36622. * @return array[]
  36623. * @psalm-return array<string, array<int, string>>
  36624. */
  36625. public function getPrefixesPsr4()
  36626. {
  36627. return $this->prefixDirsPsr4;
  36628. }
  36629. /**
  36630. * @return array[]
  36631. * @psalm-return array<string, string>
  36632. */
  36633. public function getFallbackDirs()
  36634. {
  36635. return $this->fallbackDirsPsr0;
  36636. }
  36637. /**
  36638. * @return array[]
  36639. * @psalm-return array<string, string>
  36640. */
  36641. public function getFallbackDirsPsr4()
  36642. {
  36643. return $this->fallbackDirsPsr4;
  36644. }
  36645. /**
  36646. * @return string[] Array of classname => path
  36647. * @psalm-return array<string, string>
  36648. */
  36649. public function getClassMap()
  36650. {
  36651. return $this->classMap;
  36652. }
  36653. /**
  36654. * @param string[] $classMap Class to filename map
  36655. * @psalm-param array<string, string> $classMap
  36656. *
  36657. * @return void
  36658. */
  36659. public function addClassMap(array $classMap)
  36660. {
  36661. if ($this->classMap) {
  36662. $this->classMap = array_merge($this->classMap, $classMap);
  36663. } else {
  36664. $this->classMap = $classMap;
  36665. }
  36666. }
  36667. /**
  36668. * Registers a set of PSR-0 directories for a given prefix, either
  36669. * appending or prepending to the ones previously set for this prefix.
  36670. *
  36671. * @param string $prefix The prefix
  36672. * @param string[]|string $paths The PSR-0 root directories
  36673. * @param bool $prepend Whether to prepend the directories
  36674. *
  36675. * @return void
  36676. */
  36677. public function add($prefix, $paths, $prepend = false)
  36678. {
  36679. if (!$prefix) {
  36680. if ($prepend) {
  36681. $this->fallbackDirsPsr0 = array_merge(
  36682. (array) $paths,
  36683. $this->fallbackDirsPsr0
  36684. );
  36685. } else {
  36686. $this->fallbackDirsPsr0 = array_merge(
  36687. $this->fallbackDirsPsr0,
  36688. (array) $paths
  36689. );
  36690. }
  36691. return;
  36692. }
  36693. $first = $prefix[0];
  36694. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  36695. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  36696. return;
  36697. }
  36698. if ($prepend) {
  36699. $this->prefixesPsr0[$first][$prefix] = array_merge(
  36700. (array) $paths,
  36701. $this->prefixesPsr0[$first][$prefix]
  36702. );
  36703. } else {
  36704. $this->prefixesPsr0[$first][$prefix] = array_merge(
  36705. $this->prefixesPsr0[$first][$prefix],
  36706. (array) $paths
  36707. );
  36708. }
  36709. }
  36710. /**
  36711. * Registers a set of PSR-4 directories for a given namespace, either
  36712. * appending or prepending to the ones previously set for this namespace.
  36713. *
  36714. * @param string $prefix The prefix/namespace, with trailing '\\'
  36715. * @param string[]|string $paths The PSR-4 base directories
  36716. * @param bool $prepend Whether to prepend the directories
  36717. *
  36718. * @throws \InvalidArgumentException
  36719. *
  36720. * @return void
  36721. */
  36722. public function addPsr4($prefix, $paths, $prepend = false)
  36723. {
  36724. if (!$prefix) {
  36725. // Register directories for the root namespace.
  36726. if ($prepend) {
  36727. $this->fallbackDirsPsr4 = array_merge(
  36728. (array) $paths,
  36729. $this->fallbackDirsPsr4
  36730. );
  36731. } else {
  36732. $this->fallbackDirsPsr4 = array_merge(
  36733. $this->fallbackDirsPsr4,
  36734. (array) $paths
  36735. );
  36736. }
  36737. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  36738. // Register directories for a new namespace.
  36739. $length = strlen($prefix);
  36740. if ('\\' !== $prefix[$length - 1]) {
  36741. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  36742. }
  36743. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  36744. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  36745. } elseif ($prepend) {
  36746. // Prepend directories for an already registered namespace.
  36747. $this->prefixDirsPsr4[$prefix] = array_merge(
  36748. (array) $paths,
  36749. $this->prefixDirsPsr4[$prefix]
  36750. );
  36751. } else {
  36752. // Append directories for an already registered namespace.
  36753. $this->prefixDirsPsr4[$prefix] = array_merge(
  36754. $this->prefixDirsPsr4[$prefix],
  36755. (array) $paths
  36756. );
  36757. }
  36758. }
  36759. /**
  36760. * Registers a set of PSR-0 directories for a given prefix,
  36761. * replacing any others previously set for this prefix.
  36762. *
  36763. * @param string $prefix The prefix
  36764. * @param string[]|string $paths The PSR-0 base directories
  36765. *
  36766. * @return void
  36767. */
  36768. public function set($prefix, $paths)
  36769. {
  36770. if (!$prefix) {
  36771. $this->fallbackDirsPsr0 = (array) $paths;
  36772. } else {
  36773. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  36774. }
  36775. }
  36776. /**
  36777. * Registers a set of PSR-4 directories for a given namespace,
  36778. * replacing any others previously set for this namespace.
  36779. *
  36780. * @param string $prefix The prefix/namespace, with trailing '\\'
  36781. * @param string[]|string $paths The PSR-4 base directories
  36782. *
  36783. * @throws \InvalidArgumentException
  36784. *
  36785. * @return void
  36786. */
  36787. public function setPsr4($prefix, $paths)
  36788. {
  36789. if (!$prefix) {
  36790. $this->fallbackDirsPsr4 = (array) $paths;
  36791. } else {
  36792. $length = strlen($prefix);
  36793. if ('\\' !== $prefix[$length - 1]) {
  36794. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  36795. }
  36796. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  36797. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  36798. }
  36799. }
  36800. /**
  36801. * Turns on searching the include path for class files.
  36802. *
  36803. * @param bool $useIncludePath
  36804. *
  36805. * @return void
  36806. */
  36807. public function setUseIncludePath($useIncludePath)
  36808. {
  36809. $this->useIncludePath = $useIncludePath;
  36810. }
  36811. /**
  36812. * Can be used to check if the autoloader uses the include path to check
  36813. * for classes.
  36814. *
  36815. * @return bool
  36816. */
  36817. public function getUseIncludePath()
  36818. {
  36819. return $this->useIncludePath;
  36820. }
  36821. /**
  36822. * Turns off searching the prefix and fallback directories for classes
  36823. * that have not been registered with the class map.
  36824. *
  36825. * @param bool $classMapAuthoritative
  36826. *
  36827. * @return void
  36828. */
  36829. public function setClassMapAuthoritative($classMapAuthoritative)
  36830. {
  36831. $this->classMapAuthoritative = $classMapAuthoritative;
  36832. }
  36833. /**
  36834. * Should class lookup fail if not found in the current class map?
  36835. *
  36836. * @return bool
  36837. */
  36838. public function isClassMapAuthoritative()
  36839. {
  36840. return $this->classMapAuthoritative;
  36841. }
  36842. /**
  36843. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  36844. *
  36845. * @param string|null $apcuPrefix
  36846. *
  36847. * @return void
  36848. */
  36849. public function setApcuPrefix($apcuPrefix)
  36850. {
  36851. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  36852. }
  36853. /**
  36854. * The APCu prefix in use, or null if APCu caching is not enabled.
  36855. *
  36856. * @return string|null
  36857. */
  36858. public function getApcuPrefix()
  36859. {
  36860. return $this->apcuPrefix;
  36861. }
  36862. /**
  36863. * Registers this instance as an autoloader.
  36864. *
  36865. * @param bool $prepend Whether to prepend the autoloader or not
  36866. *
  36867. * @return void
  36868. */
  36869. public function register($prepend = false)
  36870. {
  36871. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  36872. if (null === $this->vendorDir) {
  36873. return;
  36874. }
  36875. if ($prepend) {
  36876. self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
  36877. } else {
  36878. unset(self::$registeredLoaders[$this->vendorDir]);
  36879. self::$registeredLoaders[$this->vendorDir] = $this;
  36880. }
  36881. }
  36882. /**
  36883. * Unregisters this instance as an autoloader.
  36884. *
  36885. * @return void
  36886. */
  36887. public function unregister()
  36888. {
  36889. spl_autoload_unregister(array($this, 'loadClass'));
  36890. if (null !== $this->vendorDir) {
  36891. unset(self::$registeredLoaders[$this->vendorDir]);
  36892. }
  36893. }
  36894. /**
  36895. * Loads the given class or interface.
  36896. *
  36897. * @param string $class The name of the class
  36898. * @return true|null True if loaded, null otherwise
  36899. */
  36900. public function loadClass($class)
  36901. {
  36902. if ($file = $this->findFile($class)) {
  36903. includeFile($file);
  36904. return true;
  36905. }
  36906. return null;
  36907. }
  36908. /**
  36909. * Finds the path to the file where the class is defined.
  36910. *
  36911. * @param string $class The name of the class
  36912. *
  36913. * @return string|false The path if found, false otherwise
  36914. */
  36915. public function findFile($class)
  36916. {
  36917. // class map lookup
  36918. if (isset($this->classMap[$class])) {
  36919. return $this->classMap[$class];
  36920. }
  36921. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  36922. return false;
  36923. }
  36924. if (null !== $this->apcuPrefix) {
  36925. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  36926. if ($hit) {
  36927. return $file;
  36928. }
  36929. }
  36930. $file = $this->findFileWithExtension($class, '.php');
  36931. // Search for Hack files if we are running on HHVM
  36932. if (false === $file && defined('HHVM_VERSION')) {
  36933. $file = $this->findFileWithExtension($class, '.hh');
  36934. }
  36935. if (null !== $this->apcuPrefix) {
  36936. apcu_add($this->apcuPrefix.$class, $file);
  36937. }
  36938. if (false === $file) {
  36939. // Remember that this class does not exist.
  36940. $this->missingClasses[$class] = true;
  36941. }
  36942. return $file;
  36943. }
  36944. /**
  36945. * Returns the currently registered loaders indexed by their corresponding vendor directories.
  36946. *
  36947. * @return self[]
  36948. */
  36949. public static function getRegisteredLoaders()
  36950. {
  36951. return self::$registeredLoaders;
  36952. }
  36953. /**
  36954. * @param string $class
  36955. * @param string $ext
  36956. * @return string|false
  36957. */
  36958. private function findFileWithExtension($class, $ext)
  36959. {
  36960. // PSR-4 lookup
  36961. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  36962. $first = $class[0];
  36963. if (isset($this->prefixLengthsPsr4[$first])) {
  36964. $subPath = $class;
  36965. while (false !== $lastPos = strrpos($subPath, '\\')) {
  36966. $subPath = substr($subPath, 0, $lastPos);
  36967. $search = $subPath . '\\';
  36968. if (isset($this->prefixDirsPsr4[$search])) {
  36969. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  36970. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  36971. if (file_exists($file = $dir . $pathEnd)) {
  36972. return $file;
  36973. }
  36974. }
  36975. }
  36976. }
  36977. }
  36978. // PSR-4 fallback dirs
  36979. foreach ($this->fallbackDirsPsr4 as $dir) {
  36980. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  36981. return $file;
  36982. }
  36983. }
  36984. // PSR-0 lookup
  36985. if (false !== $pos = strrpos($class, '\\')) {
  36986. // namespaced class name
  36987. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  36988. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  36989. } else {
  36990. // PEAR-like class name
  36991. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  36992. }
  36993. if (isset($this->prefixesPsr0[$first])) {
  36994. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  36995. if (0 === strpos($class, $prefix)) {
  36996. foreach ($dirs as $dir) {
  36997. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  36998. return $file;
  36999. }
  37000. }
  37001. }
  37002. }
  37003. }
  37004. // PSR-0 fallback dirs
  37005. foreach ($this->fallbackDirsPsr0 as $dir) {
  37006. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  37007. return $file;
  37008. }
  37009. }
  37010. // PSR-0 include paths.
  37011. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  37012. return $file;
  37013. }
  37014. return false;
  37015. }
  37016. }
  37017. /**
  37018. * Scope isolated include.
  37019. *
  37020. * Prevents access to $this/self from included files.
  37021. *
  37022. * @param string $file
  37023. * @return void
  37024. * @private
  37025. */
  37026. function includeFile($file)
  37027. {
  37028. include $file;
  37029. }
  37030. <?php
  37031. /*
  37032. * This file is part of Composer.
  37033. *
  37034. * (c) Nils Adermann <naderman@naderman.de>
  37035. * Jordi Boggiano <j.boggiano@seld.be>
  37036. *
  37037. * For the full copyright and license information, please view the LICENSE
  37038. * file that was distributed with this source code.
  37039. */
  37040. namespace Composer;
  37041. use Composer\Autoload\ClassLoader;
  37042. use Composer\Semver\VersionParser;
  37043. /**
  37044. * This class is copied in every Composer installed project and available to all
  37045. *
  37046. * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
  37047. *
  37048. * To require its presence, you can require `composer-runtime-api ^2.0`
  37049. *
  37050. * @final
  37051. */
  37052. class InstalledVersions
  37053. {
  37054. /**
  37055. * @var mixed[]|null
  37056. * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
  37057. */
  37058. private static $installed;
  37059. /**
  37060. * @var bool|null
  37061. */
  37062. private static $canGetVendors;
  37063. /**
  37064. * @var array[]
  37065. * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
  37066. */
  37067. private static $installedByVendor = array();
  37068. /**
  37069. * Returns a list of all package names which are present, either by being installed, replaced or provided
  37070. *
  37071. * @return string[]
  37072. * @psalm-return list<string>
  37073. */
  37074. public static function getInstalledPackages()
  37075. {
  37076. $packages = array();
  37077. foreach (self::getInstalled() as $installed) {
  37078. $packages[] = array_keys($installed['versions']);
  37079. }
  37080. if (1 === \count($packages)) {
  37081. return $packages[0];
  37082. }
  37083. return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
  37084. }
  37085. /**
  37086. * Returns a list of all package names with a specific type e.g. 'library'
  37087. *
  37088. * @param string $type
  37089. * @return string[]
  37090. * @psalm-return list<string>
  37091. */
  37092. public static function getInstalledPackagesByType($type)
  37093. {
  37094. $packagesByType = array();
  37095. foreach (self::getInstalled() as $installed) {
  37096. foreach ($installed['versions'] as $name => $package) {
  37097. if (isset($package['type']) && $package['type'] === $type) {
  37098. $packagesByType[] = $name;
  37099. }
  37100. }
  37101. }
  37102. return $packagesByType;
  37103. }
  37104. /**
  37105. * Checks whether the given package is installed
  37106. *
  37107. * This also returns true if the package name is provided or replaced by another package
  37108. *
  37109. * @param string $packageName
  37110. * @param bool $includeDevRequirements
  37111. * @return bool
  37112. */
  37113. public static function isInstalled($packageName, $includeDevRequirements = true)
  37114. {
  37115. foreach (self::getInstalled() as $installed) {
  37116. if (isset($installed['versions'][$packageName])) {
  37117. return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
  37118. }
  37119. }
  37120. return false;
  37121. }
  37122. /**
  37123. * Checks whether the given package satisfies a version constraint
  37124. *
  37125. * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
  37126. *
  37127. * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
  37128. *
  37129. * @param VersionParser $parser Install composer/semver to have access to this class and functionality
  37130. * @param string $packageName
  37131. * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
  37132. * @return bool
  37133. */
  37134. public static function satisfies(VersionParser $parser, $packageName, $constraint)
  37135. {
  37136. $constraint = $parser->parseConstraints($constraint);
  37137. $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
  37138. return $provided->matches($constraint);
  37139. }
  37140. /**
  37141. * Returns a version constraint representing all the range(s) which are installed for a given package
  37142. *
  37143. * It is easier to use this via isInstalled() with the $constraint argument if you need to check
  37144. * whether a given version of a package is installed, and not just whether it exists
  37145. *
  37146. * @param string $packageName
  37147. * @return string Version constraint usable with composer/semver
  37148. */
  37149. public static function getVersionRanges($packageName)
  37150. {
  37151. foreach (self::getInstalled() as $installed) {
  37152. if (!isset($installed['versions'][$packageName])) {
  37153. continue;
  37154. }
  37155. $ranges = array();
  37156. if (isset($installed['versions'][$packageName]['pretty_version'])) {
  37157. $ranges[] = $installed['versions'][$packageName]['pretty_version'];
  37158. }
  37159. if (array_key_exists('aliases', $installed['versions'][$packageName])) {
  37160. $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
  37161. }
  37162. if (array_key_exists('replaced', $installed['versions'][$packageName])) {
  37163. $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
  37164. }
  37165. if (array_key_exists('provided', $installed['versions'][$packageName])) {
  37166. $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
  37167. }
  37168. return implode(' || ', $ranges);
  37169. }
  37170. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  37171. }
  37172. /**
  37173. * @param string $packageName
  37174. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
  37175. */
  37176. public static function getVersion($packageName)
  37177. {
  37178. foreach (self::getInstalled() as $installed) {
  37179. if (!isset($installed['versions'][$packageName])) {
  37180. continue;
  37181. }
  37182. if (!isset($installed['versions'][$packageName]['version'])) {
  37183. return null;
  37184. }
  37185. return $installed['versions'][$packageName]['version'];
  37186. }
  37187. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  37188. }
  37189. /**
  37190. * @param string $packageName
  37191. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
  37192. */
  37193. public static function getPrettyVersion($packageName)
  37194. {
  37195. foreach (self::getInstalled() as $installed) {
  37196. if (!isset($installed['versions'][$packageName])) {
  37197. continue;
  37198. }
  37199. if (!isset($installed['versions'][$packageName]['pretty_version'])) {
  37200. return null;
  37201. }
  37202. return $installed['versions'][$packageName]['pretty_version'];
  37203. }
  37204. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  37205. }
  37206. /**
  37207. * @param string $packageName
  37208. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
  37209. */
  37210. public static function getReference($packageName)
  37211. {
  37212. foreach (self::getInstalled() as $installed) {
  37213. if (!isset($installed['versions'][$packageName])) {
  37214. continue;
  37215. }
  37216. if (!isset($installed['versions'][$packageName]['reference'])) {
  37217. return null;
  37218. }
  37219. return $installed['versions'][$packageName]['reference'];
  37220. }
  37221. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  37222. }
  37223. /**
  37224. * @param string $packageName
  37225. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
  37226. */
  37227. public static function getInstallPath($packageName)
  37228. {
  37229. foreach (self::getInstalled() as $installed) {
  37230. if (!isset($installed['versions'][$packageName])) {
  37231. continue;
  37232. }
  37233. return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
  37234. }
  37235. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  37236. }
  37237. /**
  37238. * @return array
  37239. * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
  37240. */
  37241. public static function getRootPackage()
  37242. {
  37243. $installed = self::getInstalled();
  37244. return $installed[0]['root'];
  37245. }
  37246. /**
  37247. * Returns the raw installed.php data for custom implementations
  37248. *
  37249. * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
  37250. * @return array[]
  37251. * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
  37252. */
  37253. public static function getRawData()
  37254. {
  37255. @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
  37256. if (null === self::$installed) {
  37257. // only require the installed.php file if this file is loaded from its dumped location,
  37258. // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
  37259. if (substr(__DIR__, -8, 1) !== 'C') {
  37260. self::$installed = include __DIR__ . '/installed.php';
  37261. } else {
  37262. self::$installed = array();
  37263. }
  37264. }
  37265. return self::$installed;
  37266. }
  37267. /**
  37268. * Returns the raw data of all installed.php which are currently loaded for custom implementations
  37269. *
  37270. * @return array[]
  37271. * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
  37272. */
  37273. public static function getAllRawData()
  37274. {
  37275. return self::getInstalled();
  37276. }
  37277. /**
  37278. * Lets you reload the static array from another file
  37279. *
  37280. * This is only useful for complex integrations in which a project needs to use
  37281. * this class but then also needs to execute another project's autoloader in process,
  37282. * and wants to ensure both projects have access to their version of installed.php.
  37283. *
  37284. * A typical case would be PHPUnit, where it would need to make sure it reads all
  37285. * the data it needs from this class, then call reload() with
  37286. * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
  37287. * the project in which it runs can then also use this class safely, without
  37288. * interference between PHPUnit's dependencies and the project's dependencies.
  37289. *
  37290. * @param array[] $data A vendor/composer/installed.php data set
  37291. * @return void
  37292. *
  37293. * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
  37294. */
  37295. public static function reload($data)
  37296. {
  37297. self::$installed = $data;
  37298. self::$installedByVendor = array();
  37299. }
  37300. /**
  37301. * @return array[]
  37302. * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
  37303. */
  37304. private static function getInstalled()
  37305. {
  37306. if (null === self::$canGetVendors) {
  37307. self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
  37308. }
  37309. $installed = array();
  37310. if (self::$canGetVendors) {
  37311. foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
  37312. if (isset(self::$installedByVendor[$vendorDir])) {
  37313. $installed[] = self::$installedByVendor[$vendorDir];
  37314. } elseif (is_file($vendorDir.'/composer/installed.php')) {
  37315. $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
  37316. if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
  37317. self::$installed = $installed[count($installed) - 1];
  37318. }
  37319. }
  37320. }
  37321. }
  37322. if (null === self::$installed) {
  37323. // only require the installed.php file if this file is loaded from its dumped location,
  37324. // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
  37325. if (substr(__DIR__, -8, 1) !== 'C') {
  37326. self::$installed = require __DIR__ . '/installed.php';
  37327. } else {
  37328. self::$installed = array();
  37329. }
  37330. }
  37331. $installed[] = self::$installed;
  37332. return $installed;
  37333. }
  37334. }
  37335. {
  37336. "$schema": "https://json-schema.org/draft-04/schema#",
  37337. "description": "A representation of packages metadata.",
  37338. "type": "object",
  37339. "oneOf": [
  37340. { "required": [ "packages" ] },
  37341. { "required": [ "providers" ] },
  37342. { "required": [ "provider-includes", "providers-url" ] }
  37343. ],
  37344. "properties": {
  37345. "packages": {
  37346. "type": ["object", "array"],
  37347. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  37348. "additionalProperties": { "$ref": "#/definitions/versions" }
  37349. },
  37350. "providers-url": {
  37351. "type": "string",
  37352. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  37353. },
  37354. "provider-includes": {
  37355. "type": "object",
  37356. "description": "A hashmap of provider listings.",
  37357. "additionalProperties": { "$ref": "#/definitions/provider" }
  37358. },
  37359. "providers": {
  37360. "type": "object",
  37361. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  37362. "additionalProperties": { "$ref": "#/definitions/provider" }
  37363. },
  37364. "notify-batch": {
  37365. "type": "string",
  37366. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  37367. },
  37368. "search": {
  37369. "type": "string",
  37370. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  37371. },
  37372. "warning": {
  37373. "type": "string",
  37374. "description": "A message that will be output by Composer as a warning when this source is consulted."
  37375. }
  37376. },
  37377. "definitions": {
  37378. "versions": {
  37379. "type": "object",
  37380. "description": "A hashmap of versions and their metadata.",
  37381. "additionalProperties": { "$ref": "#/definitions/version" }
  37382. },
  37383. "version": {
  37384. "type": "object",
  37385. "oneOf": [
  37386. { "$ref": "#/definitions/package" },
  37387. { "$ref": "#/definitions/metapackage" }
  37388. ]
  37389. },
  37390. "package-base": {
  37391. "properties": {
  37392. "name": { "type": "string" },
  37393. "type": { "type": "string" },
  37394. "version": { "type": "string" },
  37395. "version_normalized": {
  37396. "type": "string",
  37397. "description": "Normalized version, optional but can save computational time on client side."
  37398. },
  37399. "autoload": { "type": "object" },
  37400. "require": { "type": "object" },
  37401. "replace": { "type": "object" },
  37402. "conflict": { "type": "object" },
  37403. "provide": { "type": "object" },
  37404. "time": { "type": "string" }
  37405. },
  37406. "additionalProperties": true
  37407. },
  37408. "package": {
  37409. "allOf": [
  37410. { "$ref": "#/definitions/package-base" },
  37411. {
  37412. "properties": {
  37413. "dist": { "type": "object" },
  37414. "source": { "type": "object" }
  37415. }
  37416. },
  37417. { "oneOf": [
  37418. { "required": [ "name", "version", "source" ] },
  37419. { "required": [ "name", "version", "dist" ] }
  37420. ] }
  37421. ]
  37422. },
  37423. "metapackage": {
  37424. "allOf": [
  37425. { "$ref": "#/definitions/package-base" },
  37426. {
  37427. "properties": {
  37428. "type": { "type": "string", "enum": [ "metapackage" ] }
  37429. },
  37430. "required": [ "name", "version", "type" ]
  37431. }
  37432. ]
  37433. },
  37434. "provider": {
  37435. "type": "object",
  37436. "properties": {
  37437. "sha256": {
  37438. "type": "string",
  37439. "description": "Hash value that can be used to validate the resource."
  37440. }
  37441. }
  37442. }
  37443. }
  37444. }
  37445. {
  37446. "$schema": "https://json-schema.org/draft-04/schema#",
  37447. "title": "Package",
  37448. "type": "object",
  37449. "properties": {
  37450. "name": {
  37451. "type": "string",
  37452. "description": "Package name, including 'vendor-name/' prefix.",
  37453. "pattern": "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$"
  37454. },
  37455. "description": {
  37456. "type": "string",
  37457. "description": "Short package description."
  37458. },
  37459. "license": {
  37460. "type": ["string", "array"],
  37461. "description": "License name. Or an array of license names."
  37462. },
  37463. "type": {
  37464. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  37465. "type": "string",
  37466. "pattern": "^[a-z0-9-]+$"
  37467. },
  37468. "abandoned": {
  37469. "type": ["boolean", "string"],
  37470. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  37471. },
  37472. "version": {
  37473. "type": "string",
  37474. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  37475. "pattern": "^v?\\d+(\\.\\d+){0,3}|^dev-"
  37476. },
  37477. "default-branch": {
  37478. "type": ["boolean"],
  37479. "description": "Internal use only, do not specify this in composer.json. Indicates whether this version is the default branch of the linked VCS repository. Defaults to false."
  37480. },
  37481. "non-feature-branches": {
  37482. "type": ["array"],
  37483. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  37484. "items": {
  37485. "type": "string"
  37486. }
  37487. },
  37488. "keywords": {
  37489. "type": "array",
  37490. "items": {
  37491. "type": "string",
  37492. "description": "A tag/keyword that this package relates to."
  37493. }
  37494. },
  37495. "readme": {
  37496. "type": "string",
  37497. "description": "Relative path to the readme document."
  37498. },
  37499. "time": {
  37500. "type": "string",
  37501. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  37502. },
  37503. "authors": {
  37504. "$ref": "#/definitions/authors"
  37505. },
  37506. "homepage": {
  37507. "type": "string",
  37508. "description": "Homepage URL for the project.",
  37509. "format": "uri"
  37510. },
  37511. "support": {
  37512. "type": "object",
  37513. "properties": {
  37514. "email": {
  37515. "type": "string",
  37516. "description": "Email address for support.",
  37517. "format": "email"
  37518. },
  37519. "issues": {
  37520. "type": "string",
  37521. "description": "URL to the issue tracker.",
  37522. "format": "uri"
  37523. },
  37524. "forum": {
  37525. "type": "string",
  37526. "description": "URL to the forum.",
  37527. "format": "uri"
  37528. },
  37529. "wiki": {
  37530. "type": "string",
  37531. "description": "URL to the wiki.",
  37532. "format": "uri"
  37533. },
  37534. "irc": {
  37535. "type": "string",
  37536. "description": "IRC channel for support, as irc://server/channel.",
  37537. "format": "uri"
  37538. },
  37539. "chat": {
  37540. "type": "string",
  37541. "description": "URL to the support chat.",
  37542. "format": "uri"
  37543. },
  37544. "source": {
  37545. "type": "string",
  37546. "description": "URL to browse or download the sources.",
  37547. "format": "uri"
  37548. },
  37549. "docs": {
  37550. "type": "string",
  37551. "description": "URL to the documentation.",
  37552. "format": "uri"
  37553. },
  37554. "rss": {
  37555. "type": "string",
  37556. "description": "URL to the RSS feed.",
  37557. "format": "uri"
  37558. }
  37559. }
  37560. },
  37561. "funding": {
  37562. "type": "array",
  37563. "description": "A list of options to fund the development and maintenance of the package.",
  37564. "items": {
  37565. "type": "object",
  37566. "properties": {
  37567. "type": {
  37568. "type": "string",
  37569. "description": "Type of funding or platform through which funding is possible."
  37570. },
  37571. "url": {
  37572. "type": "string",
  37573. "description": "URL to a website with details on funding and a way to fund the package.",
  37574. "format": "uri"
  37575. }
  37576. }
  37577. }
  37578. },
  37579. "source": {
  37580. "$ref": "#/definitions/source"
  37581. },
  37582. "dist": {
  37583. "$ref": "#/definitions/dist"
  37584. },
  37585. "_comment": {
  37586. "type": ["array", "string"],
  37587. "description": "A key to store comments in"
  37588. },
  37589. "require": {
  37590. "type": "object",
  37591. "description": "This is an object of package name (keys) and version constraints (values) that are required to run this package.",
  37592. "additionalProperties": {
  37593. "type": "string"
  37594. }
  37595. },
  37596. "require-dev": {
  37597. "type": "object",
  37598. "description": "This is an object of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  37599. "additionalProperties": {
  37600. "type": "string"
  37601. }
  37602. },
  37603. "replace": {
  37604. "type": "object",
  37605. "description": "This is an object of package name (keys) and version constraints (values) that can be replaced by this package.",
  37606. "additionalProperties": {
  37607. "type": "string"
  37608. }
  37609. },
  37610. "conflict": {
  37611. "type": "object",
  37612. "description": "This is an object of package name (keys) and version constraints (values) that conflict with this package.",
  37613. "additionalProperties": {
  37614. "type": "string"
  37615. }
  37616. },
  37617. "provide": {
  37618. "type": "object",
  37619. "description": "This is an object of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  37620. "additionalProperties": {
  37621. "type": "string"
  37622. }
  37623. },
  37624. "suggest": {
  37625. "type": "object",
  37626. "description": "This is an object of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  37627. "additionalProperties": {
  37628. "type": "string"
  37629. }
  37630. },
  37631. "repositories": {
  37632. "type": ["object", "array"],
  37633. "description": "A set of additional repositories where packages can be found.",
  37634. "additionalProperties": {
  37635. "anyOf": [
  37636. { "$ref": "#/definitions/repository" },
  37637. { "type": "boolean", "enum": [false] }
  37638. ]
  37639. },
  37640. "items": {
  37641. "anyOf": [
  37642. { "$ref": "#/definitions/repository" },
  37643. {
  37644. "type": "object",
  37645. "additionalProperties": { "type": "boolean", "enum": [false] },
  37646. "minProperties": 1,
  37647. "maxProperties": 1
  37648. }
  37649. ]
  37650. }
  37651. },
  37652. "minimum-stability": {
  37653. "type": ["string"],
  37654. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  37655. "enum": ["dev", "alpha", "beta", "rc", "RC", "stable"]
  37656. },
  37657. "prefer-stable": {
  37658. "type": ["boolean"],
  37659. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  37660. },
  37661. "autoload": {
  37662. "$ref": "#/definitions/autoload"
  37663. },
  37664. "autoload-dev": {
  37665. "type": "object",
  37666. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  37667. "properties": {
  37668. "psr-0": {
  37669. "type": "object",
  37670. "description": "This is an object of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  37671. "additionalProperties": {
  37672. "type": ["string", "array"],
  37673. "items": {
  37674. "type": "string"
  37675. }
  37676. }
  37677. },
  37678. "psr-4": {
  37679. "type": "object",
  37680. "description": "This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  37681. "additionalProperties": {
  37682. "type": ["string", "array"],
  37683. "items": {
  37684. "type": "string"
  37685. }
  37686. }
  37687. },
  37688. "classmap": {
  37689. "type": "array",
  37690. "description": "This is an array of paths that contain classes to be included in the class-map generation process."
  37691. },
  37692. "files": {
  37693. "type": "array",
  37694. "description": "This is an array of files that are always required on every request."
  37695. }
  37696. }
  37697. },
  37698. "target-dir": {
  37699. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  37700. "type": "string"
  37701. },
  37702. "include-path": {
  37703. "type": ["array"],
  37704. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  37705. "items": {
  37706. "type": "string"
  37707. }
  37708. },
  37709. "bin": {
  37710. "type": ["string", "array"],
  37711. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  37712. "items": {
  37713. "type": "string"
  37714. }
  37715. },
  37716. "archive": {
  37717. "type": ["object"],
  37718. "description": "Options for creating package archives for distribution.",
  37719. "properties": {
  37720. "name": {
  37721. "type": "string",
  37722. "description": "A base name for archive."
  37723. },
  37724. "exclude": {
  37725. "type": "array",
  37726. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  37727. }
  37728. }
  37729. },
  37730. "config": {
  37731. "type": "object",
  37732. "description": "Composer options.",
  37733. "properties": {
  37734. "platform": {
  37735. "type": "object",
  37736. "description": "This is an object of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  37737. "additionalProperties": {
  37738. "type": ["string", "boolean"]
  37739. }
  37740. },
  37741. "allow-plugins": {
  37742. "type": ["object", "boolean"],
  37743. "description": "This is an object of {\"pattern\": true|false} with packages which are allowed to be loaded as plugins, or true to allow all, false to allow none. Defaults to {} which prompts when an unknown plugin is added.",
  37744. "additionalProperties": {
  37745. "type": ["boolean"]
  37746. }
  37747. },
  37748. "process-timeout": {
  37749. "type": "integer",
  37750. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  37751. },
  37752. "use-include-path": {
  37753. "type": "boolean",
  37754. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  37755. },
  37756. "use-parent-dir": {
  37757. "type": ["string", "boolean"],
  37758. "description": "When running Composer in a directory where there is no composer.json, if there is one present in a directory above Composer will by default ask you whether you want to use that directory's composer.json instead. One of: true (always use parent if needed), false (never ask or use it) or \"prompt\" (ask every time), defaults to prompt."
  37759. },
  37760. "preferred-install": {
  37761. "type": ["string", "object"],
  37762. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or an object of {\"pattern\": \"preference\"}.",
  37763. "additionalProperties": {
  37764. "type": ["string"]
  37765. }
  37766. },
  37767. "notify-on-install": {
  37768. "type": "boolean",
  37769. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  37770. },
  37771. "github-protocols": {
  37772. "type": "array",
  37773. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  37774. "items": {
  37775. "type": "string"
  37776. }
  37777. },
  37778. "github-oauth": {
  37779. "type": "object",
  37780. "description": "An object of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  37781. "additionalProperties": {
  37782. "type": "string"
  37783. }
  37784. },
  37785. "gitlab-oauth": {
  37786. "type": "object",
  37787. "description": "An object of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  37788. "additionalProperties": {
  37789. "type": "string"
  37790. }
  37791. },
  37792. "gitlab-token": {
  37793. "type": "object",
  37794. "description": "An object of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  37795. "additionalProperties": {
  37796. "type": "string"
  37797. }
  37798. },
  37799. "gitlab-protocol": {
  37800. "enum": ["git", "http", "https"],
  37801. "description": "A protocol to force use of when creating a repository URL for the `source` value of the package metadata. One of `git` or `http`. By default, Composer will generate a git URL for private repositories and http one for public repos."
  37802. },
  37803. "bearer": {
  37804. "type": "object",
  37805. "description": "An object of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  37806. "additionalProperties": {
  37807. "type": "string"
  37808. }
  37809. },
  37810. "disable-tls": {
  37811. "type": "boolean",
  37812. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  37813. },
  37814. "secure-http": {
  37815. "type": "boolean",
  37816. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  37817. },
  37818. "secure-svn-domains": {
  37819. "type": "array",
  37820. "description": "A list of domains which should be trusted/marked as using a secure Subversion/SVN transport. By default svn:// protocol is seen as insecure and will throw. This is a better/safer alternative to disabling `secure-http` altogether.",
  37821. "items": {
  37822. "type": "string"
  37823. }
  37824. },
  37825. "cafile": {
  37826. "type": "string",
  37827. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  37828. },
  37829. "capath": {
  37830. "type": "string",
  37831. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  37832. },
  37833. "http-basic": {
  37834. "type": "object",
  37835. "description": "An object of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  37836. "additionalProperties": {
  37837. "type": "object",
  37838. "required": ["username", "password"],
  37839. "properties": {
  37840. "username": {
  37841. "type": "string",
  37842. "description": "The username used for HTTP Basic authentication"
  37843. },
  37844. "password": {
  37845. "type": "string",
  37846. "description": "The password used for HTTP Basic authentication"
  37847. }
  37848. }
  37849. }
  37850. },
  37851. "store-auths": {
  37852. "type": ["string", "boolean"],
  37853. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  37854. },
  37855. "vendor-dir": {
  37856. "type": "string",
  37857. "description": "The location where all packages are installed, defaults to \"vendor\"."
  37858. },
  37859. "bin-dir": {
  37860. "type": "string",
  37861. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  37862. },
  37863. "data-dir": {
  37864. "type": "string",
  37865. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  37866. },
  37867. "cache-dir": {
  37868. "type": "string",
  37869. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  37870. },
  37871. "cache-files-dir": {
  37872. "type": "string",
  37873. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  37874. },
  37875. "cache-repo-dir": {
  37876. "type": "string",
  37877. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  37878. },
  37879. "cache-vcs-dir": {
  37880. "type": "string",
  37881. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  37882. },
  37883. "cache-ttl": {
  37884. "type": "integer",
  37885. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  37886. },
  37887. "cache-files-ttl": {
  37888. "type": "integer",
  37889. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  37890. },
  37891. "cache-files-maxsize": {
  37892. "type": ["string", "integer"],
  37893. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  37894. },
  37895. "cache-read-only": {
  37896. "type": ["boolean"],
  37897. "description": "Whether to use the Composer cache in read-only mode."
  37898. },
  37899. "bin-compat": {
  37900. "enum": ["auto", "full", "proxy", "symlink"],
  37901. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed), can be \"full\" (compatible with both Windows and Unix-based systems) and \"proxy\" (only bash-style proxy)."
  37902. },
  37903. "discard-changes": {
  37904. "type": ["string", "boolean"],
  37905. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  37906. },
  37907. "autoloader-suffix": {
  37908. "type": "string",
  37909. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  37910. },
  37911. "optimize-autoloader": {
  37912. "type": "boolean",
  37913. "description": "Always optimize when dumping the autoloader."
  37914. },
  37915. "prepend-autoloader": {
  37916. "type": "boolean",
  37917. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  37918. },
  37919. "classmap-authoritative": {
  37920. "type": "boolean",
  37921. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  37922. },
  37923. "apcu-autoloader": {
  37924. "type": "boolean",
  37925. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  37926. },
  37927. "github-domains": {
  37928. "type": "array",
  37929. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  37930. "items": {
  37931. "type": "string"
  37932. }
  37933. },
  37934. "github-expose-hostname": {
  37935. "type": "boolean",
  37936. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  37937. },
  37938. "gitlab-domains": {
  37939. "type": "array",
  37940. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  37941. "items": {
  37942. "type": "string"
  37943. }
  37944. },
  37945. "bitbucket-oauth": {
  37946. "type": "object",
  37947. "description": "An object of domain name => {\"consumer-key\": \"...\", \"consumer-secret\": \"...\"}.",
  37948. "additionalProperties": {
  37949. "type": "object",
  37950. "required": ["consumer-key", "consumer-secret"],
  37951. "properties": {
  37952. "consumer-key": {
  37953. "type": "string",
  37954. "description": "The consumer-key used for OAuth authentication"
  37955. },
  37956. "consumer-secret": {
  37957. "type": "string",
  37958. "description": "The consumer-secret used for OAuth authentication"
  37959. }
  37960. }
  37961. }
  37962. },
  37963. "use-github-api": {
  37964. "type": "boolean",
  37965. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  37966. },
  37967. "archive-format": {
  37968. "type": "string",
  37969. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  37970. },
  37971. "archive-dir": {
  37972. "type": "string",
  37973. "description": "The default archive path when not provided on cli, defaults to \".\"."
  37974. },
  37975. "htaccess-protect": {
  37976. "type": "boolean",
  37977. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  37978. },
  37979. "sort-packages": {
  37980. "type": "boolean",
  37981. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  37982. },
  37983. "lock": {
  37984. "type": "boolean",
  37985. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  37986. },
  37987. "platform-check": {
  37988. "type": ["boolean", "string"],
  37989. "description": "Defaults to \"php-only\" which checks only the PHP version. Setting to true will also check the presence of required PHP extensions. If set to false, Composer will not create and require a platform_check.php file as part of the autoloader bootstrap."
  37990. }
  37991. }
  37992. },
  37993. "extra": {
  37994. "type": ["object", "array"],
  37995. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  37996. "additionalProperties": true
  37997. },
  37998. "scripts": {
  37999. "type": ["object"],
  38000. "description": "Script listeners that will be executed before/after some events.",
  38001. "properties": {
  38002. "pre-install-cmd": {
  38003. "type": ["array", "string"],
  38004. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  38005. },
  38006. "post-install-cmd": {
  38007. "type": ["array", "string"],
  38008. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  38009. },
  38010. "pre-update-cmd": {
  38011. "type": ["array", "string"],
  38012. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  38013. },
  38014. "post-update-cmd": {
  38015. "type": ["array", "string"],
  38016. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  38017. },
  38018. "pre-status-cmd": {
  38019. "type": ["array", "string"],
  38020. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  38021. },
  38022. "post-status-cmd": {
  38023. "type": ["array", "string"],
  38024. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  38025. },
  38026. "pre-package-install": {
  38027. "type": ["array", "string"],
  38028. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  38029. },
  38030. "post-package-install": {
  38031. "type": ["array", "string"],
  38032. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  38033. },
  38034. "pre-package-update": {
  38035. "type": ["array", "string"],
  38036. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  38037. },
  38038. "post-package-update": {
  38039. "type": ["array", "string"],
  38040. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  38041. },
  38042. "pre-package-uninstall": {
  38043. "type": ["array", "string"],
  38044. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  38045. },
  38046. "post-package-uninstall": {
  38047. "type": ["array", "string"],
  38048. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  38049. },
  38050. "pre-autoload-dump": {
  38051. "type": ["array", "string"],
  38052. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  38053. },
  38054. "post-autoload-dump": {
  38055. "type": ["array", "string"],
  38056. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  38057. },
  38058. "post-root-package-install": {
  38059. "type": ["array", "string"],
  38060. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  38061. },
  38062. "post-create-project-cmd": {
  38063. "type": ["array", "string"],
  38064. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  38065. }
  38066. }
  38067. },
  38068. "scripts-descriptions": {
  38069. "type": ["object"],
  38070. "description": "Descriptions for custom commands, shown in console help.",
  38071. "additionalProperties": {
  38072. "type": "string"
  38073. }
  38074. }
  38075. },
  38076. "definitions": {
  38077. "authors": {
  38078. "type": "array",
  38079. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  38080. "items": {
  38081. "type": "object",
  38082. "additionalProperties": false,
  38083. "required": [ "name"],
  38084. "properties": {
  38085. "name": {
  38086. "type": "string",
  38087. "description": "Full name of the author."
  38088. },
  38089. "email": {
  38090. "type": "string",
  38091. "description": "Email address of the author.",
  38092. "format": "email"
  38093. },
  38094. "homepage": {
  38095. "type": "string",
  38096. "description": "Homepage URL for the author.",
  38097. "format": "uri"
  38098. },
  38099. "role": {
  38100. "type": "string",
  38101. "description": "Author's role in the project."
  38102. }
  38103. }
  38104. }
  38105. },
  38106. "autoload": {
  38107. "type": "object",
  38108. "description": "Description of how the package can be autoloaded.",
  38109. "properties": {
  38110. "psr-0": {
  38111. "type": "object",
  38112. "description": "This is an object of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  38113. "additionalProperties": {
  38114. "type": ["string", "array"],
  38115. "items": {
  38116. "type": "string"
  38117. }
  38118. }
  38119. },
  38120. "psr-4": {
  38121. "type": "object",
  38122. "description": "This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  38123. "additionalProperties": {
  38124. "type": ["string", "array"],
  38125. "items": {
  38126. "type": "string"
  38127. }
  38128. }
  38129. },
  38130. "classmap": {
  38131. "type": "array",
  38132. "description": "This is an array of paths that contain classes to be included in the class-map generation process."
  38133. },
  38134. "files": {
  38135. "type": "array",
  38136. "description": "This is an array of files that are always required on every request."
  38137. },
  38138. "exclude-from-classmap": {
  38139. "type": "array",
  38140. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  38141. }
  38142. }
  38143. },
  38144. "repository": {
  38145. "type": "object",
  38146. "anyOf": [
  38147. { "$ref": "#/definitions/composer-repository" },
  38148. { "$ref": "#/definitions/vcs-repository" },
  38149. { "$ref": "#/definitions/path-repository" },
  38150. { "$ref": "#/definitions/artifact-repository" },
  38151. { "$ref": "#/definitions/pear-repository" },
  38152. { "$ref": "#/definitions/package-repository" }
  38153. ]
  38154. },
  38155. "composer-repository": {
  38156. "type": "object",
  38157. "required": ["type", "url"],
  38158. "properties": {
  38159. "type": { "type": "string", "enum": ["composer"] },
  38160. "url": { "type": "string" },
  38161. "canonical": { "type": "boolean" },
  38162. "only": {
  38163. "type": "array",
  38164. "items": {
  38165. "type": "string"
  38166. }
  38167. },
  38168. "exclude": {
  38169. "type": "array",
  38170. "items": {
  38171. "type": "string"
  38172. }
  38173. },
  38174. "options": {
  38175. "type": "object",
  38176. "additionalProperties": true
  38177. },
  38178. "allow_ssl_downgrade": { "type": "boolean" },
  38179. "force-lazy-providers": { "type": "boolean" }
  38180. }
  38181. },
  38182. "vcs-repository": {
  38183. "type": "object",
  38184. "required": ["type", "url"],
  38185. "properties": {
  38186. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "bitbucket", "git-bitbucket", "hg", "fossil", "perforce", "svn"] },
  38187. "url": { "type": "string" },
  38188. "canonical": { "type": "boolean" },
  38189. "only": {
  38190. "type": "array",
  38191. "items": {
  38192. "type": "string"
  38193. }
  38194. },
  38195. "exclude": {
  38196. "type": "array",
  38197. "items": {
  38198. "type": "string"
  38199. }
  38200. },
  38201. "no-api": { "type": "boolean" },
  38202. "secure-http": { "type": "boolean" },
  38203. "svn-cache-credentials": { "type": "boolean" },
  38204. "trunk-path": { "type": ["string", "boolean"] },
  38205. "branches-path": { "type": ["string", "boolean"] },
  38206. "tags-path": { "type": ["string", "boolean"] },
  38207. "package-path": { "type": "string" },
  38208. "depot": { "type": "string" },
  38209. "branch": { "type": "string" },
  38210. "unique_perforce_client_name": { "type": "string" },
  38211. "p4user": { "type": "string" },
  38212. "p4password": { "type": "string" }
  38213. }
  38214. },
  38215. "path-repository": {
  38216. "type": "object",
  38217. "required": ["type", "url"],
  38218. "properties": {
  38219. "type": { "type": "string", "enum": ["path"] },
  38220. "url": { "type": "string" },
  38221. "canonical": { "type": "boolean" },
  38222. "only": {
  38223. "type": "array",
  38224. "items": {
  38225. "type": "string"
  38226. }
  38227. },
  38228. "exclude": {
  38229. "type": "array",
  38230. "items": {
  38231. "type": "string"
  38232. }
  38233. },
  38234. "options": {
  38235. "type": "object",
  38236. "properties": {
  38237. "symlink": { "type": ["boolean", "null"] }
  38238. },
  38239. "additionalProperties": true
  38240. }
  38241. }
  38242. },
  38243. "artifact-repository": {
  38244. "type": "object",
  38245. "required": ["type", "url"],
  38246. "properties": {
  38247. "type": { "type": "string", "enum": ["artifact"] },
  38248. "url": { "type": "string" },
  38249. "canonical": { "type": "boolean" },
  38250. "only": {
  38251. "type": "array",
  38252. "items": {
  38253. "type": "string"
  38254. }
  38255. },
  38256. "exclude": {
  38257. "type": "array",
  38258. "items": {
  38259. "type": "string"
  38260. }
  38261. }
  38262. }
  38263. },
  38264. "pear-repository": {
  38265. "type": "object",
  38266. "required": ["type", "url"],
  38267. "properties": {
  38268. "type": { "type": "string", "enum": ["pear"] },
  38269. "url": { "type": "string" },
  38270. "canonical": { "type": "boolean" },
  38271. "only": {
  38272. "type": "array",
  38273. "items": {
  38274. "type": "string"
  38275. }
  38276. },
  38277. "exclude": {
  38278. "type": "array",
  38279. "items": {
  38280. "type": "string"
  38281. }
  38282. },
  38283. "vendor-alias": { "type": "string" }
  38284. }
  38285. },
  38286. "package-repository": {
  38287. "type": "object",
  38288. "required": ["type", "package"],
  38289. "properties": {
  38290. "type": { "type": "string", "enum": ["package"] },
  38291. "canonical": { "type": "boolean" },
  38292. "only": {
  38293. "type": "array",
  38294. "items": {
  38295. "type": "string"
  38296. }
  38297. },
  38298. "exclude": {
  38299. "type": "array",
  38300. "items": {
  38301. "type": "string"
  38302. }
  38303. },
  38304. "package": {
  38305. "oneOf": [
  38306. { "$ref": "#/definitions/inline-package" },
  38307. {
  38308. "type": "array",
  38309. "items": { "$ref": "#/definitions/inline-package" }
  38310. }
  38311. ]
  38312. }
  38313. }
  38314. },
  38315. "inline-package": {
  38316. "type": "object",
  38317. "required": ["name", "version"],
  38318. "properties": {
  38319. "name": {
  38320. "type": "string",
  38321. "description": "Package name, including 'vendor-name/' prefix."
  38322. },
  38323. "type": {
  38324. "type": "string"
  38325. },
  38326. "target-dir": {
  38327. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  38328. "type": "string"
  38329. },
  38330. "description": {
  38331. "type": "string"
  38332. },
  38333. "keywords": {
  38334. "type": "array",
  38335. "items": {
  38336. "type": "string"
  38337. }
  38338. },
  38339. "homepage": {
  38340. "type": "string",
  38341. "format": "uri"
  38342. },
  38343. "version": {
  38344. "type": "string"
  38345. },
  38346. "time": {
  38347. "type": "string"
  38348. },
  38349. "license": {
  38350. "type": [
  38351. "string",
  38352. "array"
  38353. ]
  38354. },
  38355. "authors": {
  38356. "$ref": "#/definitions/authors"
  38357. },
  38358. "require": {
  38359. "type": "object",
  38360. "additionalProperties": {
  38361. "type": "string"
  38362. }
  38363. },
  38364. "replace": {
  38365. "type": "object",
  38366. "additionalProperties": {
  38367. "type": "string"
  38368. }
  38369. },
  38370. "conflict": {
  38371. "type": "object",
  38372. "additionalProperties": {
  38373. "type": "string"
  38374. }
  38375. },
  38376. "provide": {
  38377. "type": "object",
  38378. "additionalProperties": {
  38379. "type": "string"
  38380. }
  38381. },
  38382. "require-dev": {
  38383. "type": "object",
  38384. "additionalProperties": {
  38385. "type": "string"
  38386. }
  38387. },
  38388. "suggest": {
  38389. "type": "object",
  38390. "additionalProperties": {
  38391. "type": "string"
  38392. }
  38393. },
  38394. "extra": {
  38395. "type": ["object", "array"],
  38396. "additionalProperties": true
  38397. },
  38398. "autoload": {
  38399. "$ref": "#/definitions/autoload"
  38400. },
  38401. "archive": {
  38402. "type": ["object"],
  38403. "properties": {
  38404. "exclude": {
  38405. "type": "array"
  38406. }
  38407. }
  38408. },
  38409. "bin": {
  38410. "type": ["string", "array"],
  38411. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  38412. "items": {
  38413. "type": "string"
  38414. }
  38415. },
  38416. "include-path": {
  38417. "type": ["array"],
  38418. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  38419. "items": {
  38420. "type": "string"
  38421. }
  38422. },
  38423. "source": {
  38424. "$ref": "#/definitions/source"
  38425. },
  38426. "dist": {
  38427. "$ref": "#/definitions/dist"
  38428. }
  38429. },
  38430. "additionalProperties": true
  38431. },
  38432. "source": {
  38433. "type": "object",
  38434. "required": ["type", "url", "reference"],
  38435. "properties": {
  38436. "type": {
  38437. "type": "string"
  38438. },
  38439. "url": {
  38440. "type": "string"
  38441. },
  38442. "reference": {
  38443. "type": "string"
  38444. },
  38445. "mirrors": {
  38446. "type": "array"
  38447. }
  38448. }
  38449. },
  38450. "dist": {
  38451. "type": "object",
  38452. "required": ["type", "url"],
  38453. "properties": {
  38454. "type": {
  38455. "type": "string"
  38456. },
  38457. "url": {
  38458. "type": "string"
  38459. },
  38460. "reference": {
  38461. "type": "string"
  38462. },
  38463. "shasum": {
  38464. "type": "string"
  38465. },
  38466. "mirrors": {
  38467. "type": "array"
  38468. }
  38469. }
  38470. }
  38471. }
  38472. }
  38473. <?php
  38474. if (PHP_VERSION_ID < 50600) {
  38475. echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  38476. exit(1);
  38477. }
  38478. require_once __DIR__ . '/composer/autoload_real.php';
  38479. return ComposerAutoloaderInitComposerPhar1649358995::getLoader();
  38480. <?php
  38481. namespace Composer\Autoload;
  38482. class ClassLoader
  38483. {
  38484. private $vendorDir;
  38485. private $prefixLengthsPsr4 = array();
  38486. private $prefixDirsPsr4 = array();
  38487. private $fallbackDirsPsr4 = array();
  38488. private $prefixesPsr0 = array();
  38489. private $fallbackDirsPsr0 = array();
  38490. private $useIncludePath = false;
  38491. private $classMap = array();
  38492. private $classMapAuthoritative = false;
  38493. private $missingClasses = array();
  38494. private $apcuPrefix;
  38495. private static $registeredLoaders = array();
  38496. public function __construct($vendorDir = null)
  38497. {
  38498. $this->vendorDir = $vendorDir;
  38499. }
  38500. public function getPrefixes()
  38501. {
  38502. if (!empty($this->prefixesPsr0)) {
  38503. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  38504. }
  38505. return array();
  38506. }
  38507. public function getPrefixesPsr4()
  38508. {
  38509. return $this->prefixDirsPsr4;
  38510. }
  38511. public function getFallbackDirs()
  38512. {
  38513. return $this->fallbackDirsPsr0;
  38514. }
  38515. public function getFallbackDirsPsr4()
  38516. {
  38517. return $this->fallbackDirsPsr4;
  38518. }
  38519. public function getClassMap()
  38520. {
  38521. return $this->classMap;
  38522. }
  38523. public function addClassMap(array $classMap)
  38524. {
  38525. if ($this->classMap) {
  38526. $this->classMap = array_merge($this->classMap, $classMap);
  38527. } else {
  38528. $this->classMap = $classMap;
  38529. }
  38530. }
  38531. public function add($prefix, $paths, $prepend = false)
  38532. {
  38533. if (!$prefix) {
  38534. if ($prepend) {
  38535. $this->fallbackDirsPsr0 = array_merge(
  38536. (array) $paths,
  38537. $this->fallbackDirsPsr0
  38538. );
  38539. } else {
  38540. $this->fallbackDirsPsr0 = array_merge(
  38541. $this->fallbackDirsPsr0,
  38542. (array) $paths
  38543. );
  38544. }
  38545. return;
  38546. }
  38547. $first = $prefix[0];
  38548. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  38549. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  38550. return;
  38551. }
  38552. if ($prepend) {
  38553. $this->prefixesPsr0[$first][$prefix] = array_merge(
  38554. (array) $paths,
  38555. $this->prefixesPsr0[$first][$prefix]
  38556. );
  38557. } else {
  38558. $this->prefixesPsr0[$first][$prefix] = array_merge(
  38559. $this->prefixesPsr0[$first][$prefix],
  38560. (array) $paths
  38561. );
  38562. }
  38563. }
  38564. public function addPsr4($prefix, $paths, $prepend = false)
  38565. {
  38566. if (!$prefix) {
  38567. if ($prepend) {
  38568. $this->fallbackDirsPsr4 = array_merge(
  38569. (array) $paths,
  38570. $this->fallbackDirsPsr4
  38571. );
  38572. } else {
  38573. $this->fallbackDirsPsr4 = array_merge(
  38574. $this->fallbackDirsPsr4,
  38575. (array) $paths
  38576. );
  38577. }
  38578. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  38579. $length = strlen($prefix);
  38580. if ('\\' !== $prefix[$length - 1]) {
  38581. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  38582. }
  38583. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  38584. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  38585. } elseif ($prepend) {
  38586. $this->prefixDirsPsr4[$prefix] = array_merge(
  38587. (array) $paths,
  38588. $this->prefixDirsPsr4[$prefix]
  38589. );
  38590. } else {
  38591. $this->prefixDirsPsr4[$prefix] = array_merge(
  38592. $this->prefixDirsPsr4[$prefix],
  38593. (array) $paths
  38594. );
  38595. }
  38596. }
  38597. public function set($prefix, $paths)
  38598. {
  38599. if (!$prefix) {
  38600. $this->fallbackDirsPsr0 = (array) $paths;
  38601. } else {
  38602. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  38603. }
  38604. }
  38605. public function setPsr4($prefix, $paths)
  38606. {
  38607. if (!$prefix) {
  38608. $this->fallbackDirsPsr4 = (array) $paths;
  38609. } else {
  38610. $length = strlen($prefix);
  38611. if ('\\' !== $prefix[$length - 1]) {
  38612. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  38613. }
  38614. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  38615. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  38616. }
  38617. }
  38618. public function setUseIncludePath($useIncludePath)
  38619. {
  38620. $this->useIncludePath = $useIncludePath;
  38621. }
  38622. public function getUseIncludePath()
  38623. {
  38624. return $this->useIncludePath;
  38625. }
  38626. public function setClassMapAuthoritative($classMapAuthoritative)
  38627. {
  38628. $this->classMapAuthoritative = $classMapAuthoritative;
  38629. }
  38630. public function isClassMapAuthoritative()
  38631. {
  38632. return $this->classMapAuthoritative;
  38633. }
  38634. public function setApcuPrefix($apcuPrefix)
  38635. {
  38636. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  38637. }
  38638. public function getApcuPrefix()
  38639. {
  38640. return $this->apcuPrefix;
  38641. }
  38642. public function register($prepend = false)
  38643. {
  38644. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  38645. if (null === $this->vendorDir) {
  38646. return;
  38647. }
  38648. if ($prepend) {
  38649. self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
  38650. } else {
  38651. unset(self::$registeredLoaders[$this->vendorDir]);
  38652. self::$registeredLoaders[$this->vendorDir] = $this;
  38653. }
  38654. }
  38655. public function unregister()
  38656. {
  38657. spl_autoload_unregister(array($this, 'loadClass'));
  38658. if (null !== $this->vendorDir) {
  38659. unset(self::$registeredLoaders[$this->vendorDir]);
  38660. }
  38661. }
  38662. public function loadClass($class)
  38663. {
  38664. if ($file = $this->findFile($class)) {
  38665. includeFile($file);
  38666. return true;
  38667. }
  38668. return null;
  38669. }
  38670. public function findFile($class)
  38671. {
  38672. if (isset($this->classMap[$class])) {
  38673. return $this->classMap[$class];
  38674. }
  38675. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  38676. return false;
  38677. }
  38678. if (null !== $this->apcuPrefix) {
  38679. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  38680. if ($hit) {
  38681. return $file;
  38682. }
  38683. }
  38684. $file = $this->findFileWithExtension($class, '.php');
  38685. if (false === $file && defined('HHVM_VERSION')) {
  38686. $file = $this->findFileWithExtension($class, '.hh');
  38687. }
  38688. if (null !== $this->apcuPrefix) {
  38689. apcu_add($this->apcuPrefix.$class, $file);
  38690. }
  38691. if (false === $file) {
  38692. $this->missingClasses[$class] = true;
  38693. }
  38694. return $file;
  38695. }
  38696. public static function getRegisteredLoaders()
  38697. {
  38698. return self::$registeredLoaders;
  38699. }
  38700. private function findFileWithExtension($class, $ext)
  38701. {
  38702. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  38703. $first = $class[0];
  38704. if (isset($this->prefixLengthsPsr4[$first])) {
  38705. $subPath = $class;
  38706. while (false !== $lastPos = strrpos($subPath, '\\')) {
  38707. $subPath = substr($subPath, 0, $lastPos);
  38708. $search = $subPath . '\\';
  38709. if (isset($this->prefixDirsPsr4[$search])) {
  38710. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  38711. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  38712. if (file_exists($file = $dir . $pathEnd)) {
  38713. return $file;
  38714. }
  38715. }
  38716. }
  38717. }
  38718. }
  38719. foreach ($this->fallbackDirsPsr4 as $dir) {
  38720. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  38721. return $file;
  38722. }
  38723. }
  38724. if (false !== $pos = strrpos($class, '\\')) {
  38725. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  38726. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  38727. } else {
  38728. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  38729. }
  38730. if (isset($this->prefixesPsr0[$first])) {
  38731. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  38732. if (0 === strpos($class, $prefix)) {
  38733. foreach ($dirs as $dir) {
  38734. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  38735. return $file;
  38736. }
  38737. }
  38738. }
  38739. }
  38740. }
  38741. foreach ($this->fallbackDirsPsr0 as $dir) {
  38742. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  38743. return $file;
  38744. }
  38745. }
  38746. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  38747. return $file;
  38748. }
  38749. return false;
  38750. }
  38751. }
  38752. function includeFile($file)
  38753. {
  38754. include $file;
  38755. }
  38756. <?php
  38757. namespace Composer;
  38758. use Composer\Autoload\ClassLoader;
  38759. use Composer\Semver\VersionParser;
  38760. class InstalledVersions
  38761. {
  38762. private static $installed;
  38763. private static $canGetVendors;
  38764. private static $installedByVendor = array();
  38765. public static function getInstalledPackages()
  38766. {
  38767. $packages = array();
  38768. foreach (self::getInstalled() as $installed) {
  38769. $packages[] = array_keys($installed['versions']);
  38770. }
  38771. if (1 === \count($packages)) {
  38772. return $packages[0];
  38773. }
  38774. return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
  38775. }
  38776. public static function getInstalledPackagesByType($type)
  38777. {
  38778. $packagesByType = array();
  38779. foreach (self::getInstalled() as $installed) {
  38780. foreach ($installed['versions'] as $name => $package) {
  38781. if (isset($package['type']) && $package['type'] === $type) {
  38782. $packagesByType[] = $name;
  38783. }
  38784. }
  38785. }
  38786. return $packagesByType;
  38787. }
  38788. public static function isInstalled($packageName, $includeDevRequirements = true)
  38789. {
  38790. foreach (self::getInstalled() as $installed) {
  38791. if (isset($installed['versions'][$packageName])) {
  38792. return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
  38793. }
  38794. }
  38795. return false;
  38796. }
  38797. public static function satisfies(VersionParser $parser, $packageName, $constraint)
  38798. {
  38799. $constraint = $parser->parseConstraints($constraint);
  38800. $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
  38801. return $provided->matches($constraint);
  38802. }
  38803. public static function getVersionRanges($packageName)
  38804. {
  38805. foreach (self::getInstalled() as $installed) {
  38806. if (!isset($installed['versions'][$packageName])) {
  38807. continue;
  38808. }
  38809. $ranges = array();
  38810. if (isset($installed['versions'][$packageName]['pretty_version'])) {
  38811. $ranges[] = $installed['versions'][$packageName]['pretty_version'];
  38812. }
  38813. if (array_key_exists('aliases', $installed['versions'][$packageName])) {
  38814. $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
  38815. }
  38816. if (array_key_exists('replaced', $installed['versions'][$packageName])) {
  38817. $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
  38818. }
  38819. if (array_key_exists('provided', $installed['versions'][$packageName])) {
  38820. $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
  38821. }
  38822. return implode(' || ', $ranges);
  38823. }
  38824. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  38825. }
  38826. public static function getVersion($packageName)
  38827. {
  38828. foreach (self::getInstalled() as $installed) {
  38829. if (!isset($installed['versions'][$packageName])) {
  38830. continue;
  38831. }
  38832. if (!isset($installed['versions'][$packageName]['version'])) {
  38833. return null;
  38834. }
  38835. return $installed['versions'][$packageName]['version'];
  38836. }
  38837. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  38838. }
  38839. public static function getPrettyVersion($packageName)
  38840. {
  38841. foreach (self::getInstalled() as $installed) {
  38842. if (!isset($installed['versions'][$packageName])) {
  38843. continue;
  38844. }
  38845. if (!isset($installed['versions'][$packageName]['pretty_version'])) {
  38846. return null;
  38847. }
  38848. return $installed['versions'][$packageName]['pretty_version'];
  38849. }
  38850. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  38851. }
  38852. public static function getReference($packageName)
  38853. {
  38854. foreach (self::getInstalled() as $installed) {
  38855. if (!isset($installed['versions'][$packageName])) {
  38856. continue;
  38857. }
  38858. if (!isset($installed['versions'][$packageName]['reference'])) {
  38859. return null;
  38860. }
  38861. return $installed['versions'][$packageName]['reference'];
  38862. }
  38863. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  38864. }
  38865. public static function getInstallPath($packageName)
  38866. {
  38867. foreach (self::getInstalled() as $installed) {
  38868. if (!isset($installed['versions'][$packageName])) {
  38869. continue;
  38870. }
  38871. return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
  38872. }
  38873. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  38874. }
  38875. public static function getRootPackage()
  38876. {
  38877. $installed = self::getInstalled();
  38878. return $installed[0]['root'];
  38879. }
  38880. public static function getRawData()
  38881. {
  38882. @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
  38883. if (null === self::$installed) {
  38884. if (substr(__DIR__, -8, 1) !== 'C') {
  38885. self::$installed = include __DIR__ . '/installed.php';
  38886. } else {
  38887. self::$installed = array();
  38888. }
  38889. }
  38890. return self::$installed;
  38891. }
  38892. public static function getAllRawData()
  38893. {
  38894. return self::getInstalled();
  38895. }
  38896. public static function reload($data)
  38897. {
  38898. self::$installed = $data;
  38899. self::$installedByVendor = array();
  38900. }
  38901. private static function getInstalled()
  38902. {
  38903. if (null === self::$canGetVendors) {
  38904. self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
  38905. }
  38906. $installed = array();
  38907. if (self::$canGetVendors) {
  38908. foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
  38909. if (isset(self::$installedByVendor[$vendorDir])) {
  38910. $installed[] = self::$installedByVendor[$vendorDir];
  38911. } elseif (is_file($vendorDir.'/composer/installed.php')) {
  38912. $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
  38913. if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
  38914. self::$installed = $installed[count($installed) - 1];
  38915. }
  38916. }
  38917. }
  38918. }
  38919. if (null === self::$installed) {
  38920. if (substr(__DIR__, -8, 1) !== 'C') {
  38921. self::$installed = require __DIR__ . '/installed.php';
  38922. } else {
  38923. self::$installed = array();
  38924. }
  38925. }
  38926. $installed[] = self::$installed;
  38927. return $installed;
  38928. }
  38929. }
  38930. <?php
  38931. $vendorDir = dirname(__DIR__);
  38932. $baseDir = dirname($vendorDir);
  38933. return array(
  38934. 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
  38935. 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
  38936. 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
  38937. 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
  38938. 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
  38939. 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
  38940. 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
  38941. 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
  38942. );
  38943. <?php
  38944. $vendorDir = dirname(__DIR__);
  38945. $baseDir = dirname($vendorDir);
  38946. return array(
  38947. 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
  38948. '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
  38949. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  38950. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  38951. '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
  38952. 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
  38953. '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
  38954. 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
  38955. 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
  38956. );
  38957. <?php
  38958. $vendorDir = dirname(__DIR__);
  38959. $baseDir = dirname($vendorDir);
  38960. return array(
  38961. );
  38962. <?php
  38963. $vendorDir = dirname(__DIR__);
  38964. $baseDir = dirname($vendorDir);
  38965. return array(
  38966. 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
  38967. 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
  38968. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  38969. 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
  38970. 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
  38971. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  38972. 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
  38973. 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
  38974. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  38975. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  38976. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  38977. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  38978. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  38979. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  38980. 'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
  38981. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  38982. 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
  38983. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  38984. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  38985. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  38986. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  38987. 'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
  38988. 'Composer\\MetadataMinifier\\' => array($vendorDir . '/composer/metadata-minifier/src'),
  38989. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  38990. 'Composer\\' => array($baseDir . '/src/Composer'),
  38991. );
  38992. <?php
  38993. class ComposerAutoloaderInitComposerPhar1649358995
  38994. {
  38995. private static $loader;
  38996. public static function loadClassLoader($class)
  38997. {
  38998. if ('Composer\Autoload\ClassLoader' === $class) {
  38999. require __DIR__ . '/ClassLoader.php';
  39000. }
  39001. }
  39002. public static function getLoader()
  39003. {
  39004. if (null !== self::$loader) {
  39005. return self::$loader;
  39006. }
  39007. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1649358995', 'loadClassLoader'), true, true);
  39008. self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
  39009. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1649358995', 'loadClassLoader'));
  39010. require __DIR__ . '/autoload_static.php';
  39011. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1649358995::getInitializer($loader));
  39012. $loader->register(true);
  39013. $includeFiles = \Composer\Autoload\ComposerStaticInitComposerPhar1649358995::$files;
  39014. foreach ($includeFiles as $fileIdentifier => $file) {
  39015. composerRequireComposerPhar1649358995($fileIdentifier, $file);
  39016. }
  39017. return $loader;
  39018. }
  39019. }
  39020. function composerRequireComposerPhar1649358995($fileIdentifier, $file)
  39021. {
  39022. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  39023. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  39024. require $file;
  39025. }
  39026. }
  39027. <?php
  39028. namespace Composer\Autoload;
  39029. class ComposerStaticInitComposerPhar1649358995
  39030. {
  39031. public static $files = array (
  39032. 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
  39033. '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
  39034. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  39035. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  39036. '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
  39037. 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
  39038. '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
  39039. 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
  39040. 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
  39041. );
  39042. public static $prefixLengthsPsr4 = array (
  39043. 'S' =>
  39044. array (
  39045. 'Symfony\\Polyfill\\Php80\\' => 23,
  39046. 'Symfony\\Polyfill\\Php73\\' => 23,
  39047. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  39048. 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
  39049. 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
  39050. 'Symfony\\Polyfill\\Ctype\\' => 23,
  39051. 'Symfony\\Contracts\\Service\\' => 26,
  39052. 'Symfony\\Component\\String\\' => 25,
  39053. 'Symfony\\Component\\Process\\' => 26,
  39054. 'Symfony\\Component\\Finder\\' => 25,
  39055. 'Symfony\\Component\\Filesystem\\' => 29,
  39056. 'Symfony\\Component\\Console\\' => 26,
  39057. 'Seld\\PharUtils\\' => 15,
  39058. 'Seld\\JsonLint\\' => 14,
  39059. ),
  39060. 'R' =>
  39061. array (
  39062. 'React\\Promise\\' => 14,
  39063. ),
  39064. 'P' =>
  39065. array (
  39066. 'Psr\\Log\\' => 8,
  39067. 'Psr\\Container\\' => 14,
  39068. ),
  39069. 'J' =>
  39070. array (
  39071. 'JsonSchema\\' => 11,
  39072. ),
  39073. 'C' =>
  39074. array (
  39075. 'Composer\\XdebugHandler\\' => 23,
  39076. 'Composer\\Spdx\\' => 14,
  39077. 'Composer\\Semver\\' => 16,
  39078. 'Composer\\Pcre\\' => 14,
  39079. 'Composer\\MetadataMinifier\\' => 26,
  39080. 'Composer\\CaBundle\\' => 18,
  39081. 'Composer\\' => 9,
  39082. ),
  39083. );
  39084. public static $prefixDirsPsr4 = array (
  39085. 'Symfony\\Polyfill\\Php80\\' =>
  39086. array (
  39087. 0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
  39088. ),
  39089. 'Symfony\\Polyfill\\Php73\\' =>
  39090. array (
  39091. 0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
  39092. ),
  39093. 'Symfony\\Polyfill\\Mbstring\\' =>
  39094. array (
  39095. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  39096. ),
  39097. 'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
  39098. array (
  39099. 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
  39100. ),
  39101. 'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
  39102. array (
  39103. 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
  39104. ),
  39105. 'Symfony\\Polyfill\\Ctype\\' =>
  39106. array (
  39107. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  39108. ),
  39109. 'Symfony\\Contracts\\Service\\' =>
  39110. array (
  39111. 0 => __DIR__ . '/..' . '/symfony/service-contracts',
  39112. ),
  39113. 'Symfony\\Component\\String\\' =>
  39114. array (
  39115. 0 => __DIR__ . '/..' . '/symfony/string',
  39116. ),
  39117. 'Symfony\\Component\\Process\\' =>
  39118. array (
  39119. 0 => __DIR__ . '/..' . '/symfony/process',
  39120. ),
  39121. 'Symfony\\Component\\Finder\\' =>
  39122. array (
  39123. 0 => __DIR__ . '/..' . '/symfony/finder',
  39124. ),
  39125. 'Symfony\\Component\\Filesystem\\' =>
  39126. array (
  39127. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  39128. ),
  39129. 'Symfony\\Component\\Console\\' =>
  39130. array (
  39131. 0 => __DIR__ . '/..' . '/symfony/console',
  39132. ),
  39133. 'Seld\\PharUtils\\' =>
  39134. array (
  39135. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  39136. ),
  39137. 'Seld\\JsonLint\\' =>
  39138. array (
  39139. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  39140. ),
  39141. 'React\\Promise\\' =>
  39142. array (
  39143. 0 => __DIR__ . '/..' . '/react/promise/src',
  39144. ),
  39145. 'Psr\\Log\\' =>
  39146. array (
  39147. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  39148. ),
  39149. 'Psr\\Container\\' =>
  39150. array (
  39151. 0 => __DIR__ . '/..' . '/psr/container/src',
  39152. ),
  39153. 'JsonSchema\\' =>
  39154. array (
  39155. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  39156. ),
  39157. 'Composer\\XdebugHandler\\' =>
  39158. array (
  39159. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  39160. ),
  39161. 'Composer\\Spdx\\' =>
  39162. array (
  39163. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  39164. ),
  39165. 'Composer\\Semver\\' =>
  39166. array (
  39167. 0 => __DIR__ . '/..' . '/composer/semver/src',
  39168. ),
  39169. 'Composer\\Pcre\\' =>
  39170. array (
  39171. 0 => __DIR__ . '/..' . '/composer/pcre/src',
  39172. ),
  39173. 'Composer\\MetadataMinifier\\' =>
  39174. array (
  39175. 0 => __DIR__ . '/..' . '/composer/metadata-minifier/src',
  39176. ),
  39177. 'Composer\\CaBundle\\' =>
  39178. array (
  39179. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  39180. ),
  39181. 'Composer\\' =>
  39182. array (
  39183. 0 => __DIR__ . '/../..' . '/src/Composer',
  39184. ),
  39185. );
  39186. public static $classMap = array (
  39187. 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
  39188. 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
  39189. 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
  39190. 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
  39191. 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
  39192. 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
  39193. 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
  39194. 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
  39195. );
  39196. public static function getInitializer(ClassLoader $loader)
  39197. {
  39198. return \Closure::bind(function () use ($loader) {
  39199. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1649358995::$prefixLengthsPsr4;
  39200. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1649358995::$prefixDirsPsr4;
  39201. $loader->classMap = ComposerStaticInitComposerPhar1649358995::$classMap;
  39202. }, null, ClassLoader::class);
  39203. }
  39204. }
  39205. Copyright (C) 2016 Composer
  39206. Permission is hereby granted, free of charge, to any person obtaining a copy of
  39207. this software and associated documentation files (the "Software"), to deal in
  39208. the Software without restriction, including without limitation the rights to
  39209. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  39210. of the Software, and to permit persons to whom the Software is furnished to do
  39211. so, subject to the following conditions:
  39212. The above copyright notice and this permission notice shall be included in all
  39213. copies or substantial portions of the Software.
  39214. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39215. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39216. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39217. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39218. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39219. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  39220. SOFTWARE.
  39221. ##
  39222. ## Bundle of CA Root Certificates
  39223. ##
  39224. ## Certificate data from Mozilla as of: Tue Oct 26 03:12:05 2021 GMT
  39225. ##
  39226. ## This is a bundle of X.509 certificates of public Certificate Authorities
  39227. ## (CA). These were automatically extracted from Mozilla's root certificates
  39228. ## file (certdata.txt). This file can be found in the mozilla source tree:
  39229. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  39230. ##
  39231. ## It contains the certificates in PEM format and therefore
  39232. ## can be directly used with curl / libcurl / php_curl, or with
  39233. ## an Apache+mod_ssl webserver for SSL client authentication.
  39234. ## Just configure this file as the SSLCACertificateFile.
  39235. ##
  39236. ## Conversion done with mk-ca-bundle.pl version 1.28.
  39237. ## SHA256: bb36818a81feaa4cca61101e6d6276cd09e972efcb08112dfed846918ca41d7f
  39238. ##
  39239. GlobalSign Root CA
  39240. ==================
  39241. -----BEGIN CERTIFICATE-----
  39242. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  39243. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  39244. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  39245. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  39246. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  39247. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  39248. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  39249. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  39250. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  39251. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  39252. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  39253. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  39254. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  39255. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  39256. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  39257. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  39258. -----END CERTIFICATE-----
  39259. GlobalSign Root CA - R2
  39260. =======================
  39261. -----BEGIN CERTIFICATE-----
  39262. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  39263. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  39264. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  39265. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  39266. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  39267. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  39268. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  39269. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  39270. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  39271. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  39272. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  39273. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  39274. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  39275. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  39276. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  39277. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  39278. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  39279. -----END CERTIFICATE-----
  39280. Entrust.net Premium 2048 Secure Server CA
  39281. =========================================
  39282. -----BEGIN CERTIFICATE-----
  39283. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  39284. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  39285. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  39286. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  39287. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  39288. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  39289. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  39290. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  39291. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  39292. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  39293. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  39294. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  39295. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  39296. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  39297. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  39298. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  39299. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  39300. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  39301. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  39302. -----END CERTIFICATE-----
  39303. Baltimore CyberTrust Root
  39304. =========================
  39305. -----BEGIN CERTIFICATE-----
  39306. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  39307. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  39308. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  39309. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  39310. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  39311. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  39312. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  39313. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  39314. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  39315. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  39316. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  39317. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  39318. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  39319. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  39320. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  39321. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  39322. -----END CERTIFICATE-----
  39323. Entrust Root Certification Authority
  39324. ====================================
  39325. -----BEGIN CERTIFICATE-----
  39326. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  39327. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  39328. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  39329. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  39330. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  39331. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  39332. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  39333. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  39334. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  39335. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  39336. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  39337. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  39338. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  39339. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  39340. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  39341. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  39342. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  39343. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  39344. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  39345. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  39346. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  39347. -----END CERTIFICATE-----
  39348. Comodo AAA Services root
  39349. ========================
  39350. -----BEGIN CERTIFICATE-----
  39351. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  39352. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  39353. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  39354. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  39355. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  39356. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  39357. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  39358. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  39359. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  39360. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  39361. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  39362. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  39363. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  39364. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  39365. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  39366. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  39367. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  39368. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  39369. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  39370. -----END CERTIFICATE-----
  39371. QuoVadis Root CA 2
  39372. ==================
  39373. -----BEGIN CERTIFICATE-----
  39374. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  39375. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  39376. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  39377. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  39378. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  39379. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  39380. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  39381. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  39382. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  39383. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  39384. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  39385. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  39386. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  39387. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  39388. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  39389. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  39390. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  39391. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  39392. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  39393. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  39394. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  39395. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  39396. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  39397. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  39398. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  39399. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  39400. -----END CERTIFICATE-----
  39401. QuoVadis Root CA 3
  39402. ==================
  39403. -----BEGIN CERTIFICATE-----
  39404. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  39405. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  39406. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  39407. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  39408. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  39409. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  39410. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  39411. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  39412. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  39413. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  39414. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  39415. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  39416. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  39417. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  39418. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  39419. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  39420. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  39421. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  39422. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  39423. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  39424. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  39425. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  39426. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  39427. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  39428. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  39429. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  39430. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  39431. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  39432. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  39433. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  39434. -----END CERTIFICATE-----
  39435. Security Communication Root CA
  39436. ==============================
  39437. -----BEGIN CERTIFICATE-----
  39438. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  39439. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  39440. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  39441. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  39442. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  39443. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  39444. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  39445. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  39446. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  39447. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  39448. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  39449. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  39450. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  39451. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  39452. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  39453. FL39vmwLAw==
  39454. -----END CERTIFICATE-----
  39455. XRamp Global CA Root
  39456. ====================
  39457. -----BEGIN CERTIFICATE-----
  39458. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  39459. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  39460. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  39461. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  39462. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  39463. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  39464. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  39465. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  39466. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  39467. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  39468. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  39469. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  39470. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  39471. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  39472. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  39473. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  39474. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  39475. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  39476. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  39477. -----END CERTIFICATE-----
  39478. Go Daddy Class 2 CA
  39479. ===================
  39480. -----BEGIN CERTIFICATE-----
  39481. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  39482. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  39483. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  39484. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  39485. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  39486. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  39487. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  39488. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  39489. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  39490. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  39491. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  39492. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  39493. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  39494. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  39495. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  39496. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  39497. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  39498. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  39499. vZ8=
  39500. -----END CERTIFICATE-----
  39501. Starfield Class 2 CA
  39502. ====================
  39503. -----BEGIN CERTIFICATE-----
  39504. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  39505. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  39506. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  39507. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  39508. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  39509. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  39510. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  39511. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  39512. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  39513. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  39514. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  39515. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  39516. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  39517. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  39518. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  39519. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  39520. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  39521. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  39522. QBFGmh95DmK/D5fs4C8fF5Q=
  39523. -----END CERTIFICATE-----
  39524. DigiCert Assured ID Root CA
  39525. ===========================
  39526. -----BEGIN CERTIFICATE-----
  39527. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  39528. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  39529. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  39530. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  39531. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  39532. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  39533. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  39534. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  39535. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  39536. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  39537. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  39538. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  39539. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  39540. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  39541. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  39542. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  39543. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  39544. -----END CERTIFICATE-----
  39545. DigiCert Global Root CA
  39546. =======================
  39547. -----BEGIN CERTIFICATE-----
  39548. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  39549. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  39550. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  39551. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  39552. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  39553. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  39554. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  39555. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  39556. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  39557. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  39558. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  39559. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  39560. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  39561. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  39562. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  39563. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  39564. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  39565. -----END CERTIFICATE-----
  39566. DigiCert High Assurance EV Root CA
  39567. ==================================
  39568. -----BEGIN CERTIFICATE-----
  39569. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  39570. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  39571. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  39572. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  39573. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  39574. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  39575. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  39576. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  39577. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  39578. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  39579. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  39580. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  39581. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  39582. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  39583. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  39584. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  39585. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  39586. -----END CERTIFICATE-----
  39587. SwissSign Gold CA - G2
  39588. ======================
  39589. -----BEGIN CERTIFICATE-----
  39590. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  39591. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  39592. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  39593. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  39594. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  39595. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  39596. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  39597. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  39598. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  39599. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  39600. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  39601. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  39602. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  39603. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  39604. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  39605. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  39606. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  39607. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  39608. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  39609. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  39610. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  39611. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  39612. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  39613. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  39614. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  39615. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  39616. -----END CERTIFICATE-----
  39617. SwissSign Silver CA - G2
  39618. ========================
  39619. -----BEGIN CERTIFICATE-----
  39620. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  39621. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  39622. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  39623. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  39624. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  39625. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  39626. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  39627. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  39628. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  39629. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  39630. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  39631. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  39632. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  39633. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  39634. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  39635. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  39636. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  39637. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  39638. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  39639. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  39640. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  39641. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  39642. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  39643. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  39644. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  39645. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  39646. -----END CERTIFICATE-----
  39647. SecureTrust CA
  39648. ==============
  39649. -----BEGIN CERTIFICATE-----
  39650. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  39651. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  39652. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  39653. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  39654. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  39655. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  39656. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  39657. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  39658. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  39659. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  39660. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  39661. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  39662. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  39663. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  39664. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  39665. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  39666. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  39667. -----END CERTIFICATE-----
  39668. Secure Global CA
  39669. ================
  39670. -----BEGIN CERTIFICATE-----
  39671. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  39672. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  39673. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  39674. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  39675. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  39676. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  39677. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  39678. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  39679. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  39680. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  39681. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  39682. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  39683. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  39684. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  39685. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  39686. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  39687. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  39688. -----END CERTIFICATE-----
  39689. COMODO Certification Authority
  39690. ==============================
  39691. -----BEGIN CERTIFICATE-----
  39692. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  39693. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  39694. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  39695. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  39696. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  39697. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  39698. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  39699. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  39700. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  39701. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  39702. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  39703. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  39704. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  39705. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  39706. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  39707. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  39708. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  39709. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  39710. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  39711. -----END CERTIFICATE-----
  39712. Network Solutions Certificate Authority
  39713. =======================================
  39714. -----BEGIN CERTIFICATE-----
  39715. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  39716. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  39717. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  39718. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  39719. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  39720. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  39721. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  39722. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  39723. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  39724. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  39725. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  39726. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  39727. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  39728. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  39729. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  39730. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  39731. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  39732. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  39733. -----END CERTIFICATE-----
  39734. COMODO ECC Certification Authority
  39735. ==================================
  39736. -----BEGIN CERTIFICATE-----
  39737. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  39738. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  39739. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  39740. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  39741. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  39742. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  39743. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  39744. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  39745. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  39746. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  39747. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  39748. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  39749. -----END CERTIFICATE-----
  39750. Certigna
  39751. ========
  39752. -----BEGIN CERTIFICATE-----
  39753. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  39754. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  39755. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  39756. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  39757. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  39758. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  39759. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  39760. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  39761. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  39762. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  39763. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  39764. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  39765. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  39766. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  39767. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  39768. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  39769. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  39770. -----END CERTIFICATE-----
  39771. Cybertrust Global Root
  39772. ======================
  39773. -----BEGIN CERTIFICATE-----
  39774. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  39775. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  39776. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  39777. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  39778. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  39779. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  39780. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  39781. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  39782. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  39783. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  39784. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  39785. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  39786. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  39787. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  39788. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  39789. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  39790. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  39791. -----END CERTIFICATE-----
  39792. ePKI Root Certification Authority
  39793. =================================
  39794. -----BEGIN CERTIFICATE-----
  39795. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  39796. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  39797. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  39798. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  39799. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  39800. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  39801. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  39802. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  39803. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  39804. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  39805. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  39806. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  39807. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  39808. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  39809. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  39810. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  39811. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  39812. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  39813. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  39814. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  39815. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  39816. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  39817. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  39818. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  39819. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  39820. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  39821. -----END CERTIFICATE-----
  39822. certSIGN ROOT CA
  39823. ================
  39824. -----BEGIN CERTIFICATE-----
  39825. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  39826. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  39827. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  39828. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  39829. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  39830. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  39831. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  39832. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  39833. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  39834. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  39835. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  39836. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  39837. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  39838. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  39839. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  39840. -----END CERTIFICATE-----
  39841. NetLock Arany (Class Gold) Főtanúsítvány
  39842. ========================================
  39843. -----BEGIN CERTIFICATE-----
  39844. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  39845. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  39846. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  39847. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  39848. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  39849. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  39850. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  39851. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  39852. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  39853. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  39854. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  39855. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  39856. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  39857. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  39858. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  39859. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  39860. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  39861. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  39862. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  39863. -----END CERTIFICATE-----
  39864. Hongkong Post Root CA 1
  39865. =======================
  39866. -----BEGIN CERTIFICATE-----
  39867. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  39868. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  39869. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  39870. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  39871. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  39872. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  39873. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  39874. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  39875. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  39876. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  39877. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  39878. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  39879. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  39880. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  39881. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  39882. -----END CERTIFICATE-----
  39883. SecureSign RootCA11
  39884. ===================
  39885. -----BEGIN CERTIFICATE-----
  39886. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  39887. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  39888. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  39889. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  39890. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  39891. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  39892. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  39893. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  39894. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  39895. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  39896. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  39897. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  39898. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  39899. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  39900. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  39901. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  39902. -----END CERTIFICATE-----
  39903. Microsec e-Szigno Root CA 2009
  39904. ==============================
  39905. -----BEGIN CERTIFICATE-----
  39906. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  39907. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  39908. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  39909. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  39910. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  39911. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  39912. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  39913. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  39914. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  39915. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  39916. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  39917. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  39918. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  39919. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  39920. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  39921. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  39922. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  39923. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  39924. LXpUq3DDfSJlgnCW
  39925. -----END CERTIFICATE-----
  39926. GlobalSign Root CA - R3
  39927. =======================
  39928. -----BEGIN CERTIFICATE-----
  39929. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  39930. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  39931. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  39932. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  39933. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  39934. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  39935. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  39936. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  39937. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  39938. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  39939. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  39940. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  39941. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  39942. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  39943. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  39944. kpeDMdmztcpHWD9f
  39945. -----END CERTIFICATE-----
  39946. Autoridad de Certificacion Firmaprofesional CIF A62634068
  39947. =========================================================
  39948. -----BEGIN CERTIFICATE-----
  39949. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  39950. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  39951. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  39952. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  39953. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  39954. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  39955. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  39956. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  39957. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  39958. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  39959. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  39960. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  39961. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  39962. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  39963. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  39964. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  39965. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  39966. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  39967. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  39968. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  39969. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  39970. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  39971. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  39972. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  39973. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  39974. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  39975. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  39976. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  39977. -----END CERTIFICATE-----
  39978. Izenpe.com
  39979. ==========
  39980. -----BEGIN CERTIFICATE-----
  39981. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  39982. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  39983. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  39984. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  39985. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  39986. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  39987. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  39988. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  39989. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  39990. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  39991. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  39992. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  39993. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  39994. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  39995. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  39996. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  39997. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  39998. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  39999. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  40000. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  40001. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  40002. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  40003. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  40004. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  40005. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  40006. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  40007. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  40008. -----END CERTIFICATE-----
  40009. Go Daddy Root Certificate Authority - G2
  40010. ========================================
  40011. -----BEGIN CERTIFICATE-----
  40012. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  40013. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  40014. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  40015. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  40016. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  40017. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  40018. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  40019. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  40020. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  40021. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  40022. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  40023. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  40024. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  40025. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  40026. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  40027. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  40028. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  40029. -----END CERTIFICATE-----
  40030. Starfield Root Certificate Authority - G2
  40031. =========================================
  40032. -----BEGIN CERTIFICATE-----
  40033. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  40034. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  40035. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  40036. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  40037. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  40038. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  40039. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  40040. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  40041. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  40042. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  40043. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  40044. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  40045. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  40046. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  40047. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  40048. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  40049. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  40050. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  40051. -----END CERTIFICATE-----
  40052. Starfield Services Root Certificate Authority - G2
  40053. ==================================================
  40054. -----BEGIN CERTIFICATE-----
  40055. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  40056. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  40057. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  40058. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  40059. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  40060. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  40061. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  40062. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  40063. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  40064. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  40065. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  40066. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  40067. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  40068. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  40069. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  40070. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  40071. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  40072. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  40073. -----END CERTIFICATE-----
  40074. AffirmTrust Commercial
  40075. ======================
  40076. -----BEGIN CERTIFICATE-----
  40077. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  40078. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  40079. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  40080. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  40081. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  40082. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  40083. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  40084. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  40085. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  40086. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  40087. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  40088. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  40089. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  40090. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  40091. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  40092. -----END CERTIFICATE-----
  40093. AffirmTrust Networking
  40094. ======================
  40095. -----BEGIN CERTIFICATE-----
  40096. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  40097. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  40098. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  40099. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  40100. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  40101. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  40102. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  40103. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  40104. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  40105. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  40106. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  40107. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  40108. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  40109. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  40110. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  40111. -----END CERTIFICATE-----
  40112. AffirmTrust Premium
  40113. ===================
  40114. -----BEGIN CERTIFICATE-----
  40115. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  40116. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  40117. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  40118. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  40119. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  40120. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  40121. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  40122. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  40123. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  40124. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  40125. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  40126. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  40127. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  40128. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  40129. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  40130. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  40131. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  40132. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  40133. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  40134. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  40135. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  40136. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  40137. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  40138. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  40139. -----END CERTIFICATE-----
  40140. AffirmTrust Premium ECC
  40141. =======================
  40142. -----BEGIN CERTIFICATE-----
  40143. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  40144. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  40145. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  40146. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  40147. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  40148. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  40149. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  40150. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  40151. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  40152. eQ==
  40153. -----END CERTIFICATE-----
  40154. Certum Trusted Network CA
  40155. =========================
  40156. -----BEGIN CERTIFICATE-----
  40157. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  40158. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  40159. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  40160. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  40161. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  40162. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  40163. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  40164. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  40165. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  40166. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  40167. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  40168. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  40169. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  40170. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  40171. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  40172. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  40173. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  40174. -----END CERTIFICATE-----
  40175. TWCA Root Certification Authority
  40176. =================================
  40177. -----BEGIN CERTIFICATE-----
  40178. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  40179. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  40180. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  40181. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  40182. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  40183. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  40184. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  40185. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  40186. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  40187. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  40188. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  40189. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  40190. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  40191. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  40192. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  40193. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  40194. -----END CERTIFICATE-----
  40195. Security Communication RootCA2
  40196. ==============================
  40197. -----BEGIN CERTIFICATE-----
  40198. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  40199. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  40200. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  40201. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  40202. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  40203. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  40204. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  40205. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  40206. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  40207. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  40208. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  40209. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  40210. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  40211. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  40212. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  40213. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  40214. -----END CERTIFICATE-----
  40215. EC-ACC
  40216. ======
  40217. -----BEGIN CERTIFICATE-----
  40218. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  40219. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  40220. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  40221. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  40222. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  40223. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  40224. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  40225. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  40226. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  40227. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  40228. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  40229. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  40230. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  40231. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  40232. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  40233. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  40234. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  40235. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  40236. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  40237. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  40238. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  40239. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  40240. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  40241. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  40242. 5EI=
  40243. -----END CERTIFICATE-----
  40244. Hellenic Academic and Research Institutions RootCA 2011
  40245. =======================================================
  40246. -----BEGIN CERTIFICATE-----
  40247. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  40248. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  40249. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  40250. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  40251. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  40252. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  40253. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  40254. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  40255. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  40256. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  40257. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  40258. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  40259. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  40260. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  40261. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  40262. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  40263. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  40264. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  40265. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  40266. -----END CERTIFICATE-----
  40267. Actalis Authentication Root CA
  40268. ==============================
  40269. -----BEGIN CERTIFICATE-----
  40270. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  40271. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  40272. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  40273. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  40274. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  40275. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  40276. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  40277. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  40278. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  40279. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  40280. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  40281. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  40282. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  40283. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  40284. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  40285. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  40286. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  40287. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  40288. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  40289. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  40290. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  40291. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  40292. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  40293. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  40294. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  40295. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  40296. -----END CERTIFICATE-----
  40297. Buypass Class 2 Root CA
  40298. =======================
  40299. -----BEGIN CERTIFICATE-----
  40300. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  40301. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  40302. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  40303. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  40304. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  40305. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  40306. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  40307. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  40308. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  40309. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  40310. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  40311. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  40312. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  40313. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  40314. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  40315. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  40316. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  40317. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  40318. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  40319. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  40320. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  40321. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  40322. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  40323. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  40324. rJgWVqA=
  40325. -----END CERTIFICATE-----
  40326. Buypass Class 3 Root CA
  40327. =======================
  40328. -----BEGIN CERTIFICATE-----
  40329. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  40330. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  40331. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  40332. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  40333. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  40334. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  40335. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  40336. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  40337. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  40338. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  40339. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  40340. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  40341. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  40342. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  40343. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  40344. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  40345. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  40346. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  40347. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  40348. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  40349. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  40350. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  40351. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  40352. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  40353. Cp/HuZc=
  40354. -----END CERTIFICATE-----
  40355. T-TeleSec GlobalRoot Class 3
  40356. ============================
  40357. -----BEGIN CERTIFICATE-----
  40358. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  40359. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  40360. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  40361. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  40362. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  40363. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  40364. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  40365. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  40366. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  40367. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  40368. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  40369. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  40370. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  40371. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  40372. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  40373. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  40374. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  40375. -----END CERTIFICATE-----
  40376. D-TRUST Root Class 3 CA 2 2009
  40377. ==============================
  40378. -----BEGIN CERTIFICATE-----
  40379. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  40380. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  40381. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  40382. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  40383. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  40384. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  40385. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  40386. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  40387. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  40388. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  40389. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  40390. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  40391. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  40392. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  40393. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  40394. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  40395. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  40396. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  40397. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  40398. -----END CERTIFICATE-----
  40399. D-TRUST Root Class 3 CA 2 EV 2009
  40400. =================================
  40401. -----BEGIN CERTIFICATE-----
  40402. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  40403. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  40404. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  40405. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  40406. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  40407. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  40408. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  40409. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  40410. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  40411. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  40412. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  40413. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  40414. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  40415. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  40416. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  40417. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  40418. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  40419. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  40420. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  40421. w9y4AyHqnxbxLFS1
  40422. -----END CERTIFICATE-----
  40423. CA Disig Root R2
  40424. ================
  40425. -----BEGIN CERTIFICATE-----
  40426. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  40427. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  40428. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  40429. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  40430. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  40431. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  40432. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  40433. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  40434. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  40435. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  40436. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  40437. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  40438. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  40439. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  40440. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  40441. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  40442. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  40443. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  40444. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  40445. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  40446. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  40447. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  40448. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  40449. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  40450. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  40451. -----END CERTIFICATE-----
  40452. ACCVRAIZ1
  40453. =========
  40454. -----BEGIN CERTIFICATE-----
  40455. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  40456. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  40457. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  40458. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  40459. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  40460. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  40461. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  40462. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  40463. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  40464. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  40465. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  40466. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  40467. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  40468. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  40469. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  40470. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  40471. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  40472. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  40473. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  40474. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  40475. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  40476. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  40477. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  40478. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  40479. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  40480. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  40481. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  40482. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  40483. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  40484. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  40485. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  40486. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  40487. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  40488. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  40489. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  40490. EfbRD0tVNEYqi4Y7
  40491. -----END CERTIFICATE-----
  40492. TWCA Global Root CA
  40493. ===================
  40494. -----BEGIN CERTIFICATE-----
  40495. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  40496. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  40497. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  40498. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  40499. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  40500. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  40501. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  40502. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  40503. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  40504. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  40505. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  40506. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  40507. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  40508. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  40509. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  40510. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  40511. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  40512. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  40513. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  40514. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  40515. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  40516. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  40517. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  40518. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  40519. -----END CERTIFICATE-----
  40520. TeliaSonera Root CA v1
  40521. ======================
  40522. -----BEGIN CERTIFICATE-----
  40523. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  40524. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  40525. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  40526. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  40527. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  40528. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  40529. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  40530. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  40531. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  40532. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  40533. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  40534. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  40535. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  40536. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  40537. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  40538. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  40539. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  40540. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  40541. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  40542. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  40543. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  40544. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  40545. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  40546. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  40547. -----END CERTIFICATE-----
  40548. E-Tugra Certification Authority
  40549. ===============================
  40550. -----BEGIN CERTIFICATE-----
  40551. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  40552. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  40553. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  40554. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  40555. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  40556. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  40557. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  40558. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  40559. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  40560. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  40561. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  40562. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  40563. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  40564. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  40565. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  40566. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  40567. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  40568. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  40569. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  40570. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  40571. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  40572. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  40573. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  40574. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  40575. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  40576. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  40577. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  40578. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  40579. C7TbO6Orb1wdtn7os4I07QZcJA==
  40580. -----END CERTIFICATE-----
  40581. T-TeleSec GlobalRoot Class 2
  40582. ============================
  40583. -----BEGIN CERTIFICATE-----
  40584. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  40585. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  40586. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  40587. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  40588. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  40589. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  40590. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  40591. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  40592. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  40593. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  40594. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  40595. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  40596. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  40597. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  40598. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  40599. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  40600. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  40601. -----END CERTIFICATE-----
  40602. Atos TrustedRoot 2011
  40603. =====================
  40604. -----BEGIN CERTIFICATE-----
  40605. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  40606. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  40607. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  40608. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  40609. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  40610. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  40611. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  40612. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  40613. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  40614. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  40615. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  40616. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  40617. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  40618. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  40619. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  40620. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  40621. -----END CERTIFICATE-----
  40622. QuoVadis Root CA 1 G3
  40623. =====================
  40624. -----BEGIN CERTIFICATE-----
  40625. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  40626. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  40627. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  40628. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  40629. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  40630. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  40631. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  40632. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  40633. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  40634. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  40635. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  40636. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  40637. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  40638. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  40639. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  40640. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  40641. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  40642. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  40643. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  40644. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  40645. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  40646. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  40647. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  40648. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  40649. hMJKzRwuJIczYOXD
  40650. -----END CERTIFICATE-----
  40651. QuoVadis Root CA 2 G3
  40652. =====================
  40653. -----BEGIN CERTIFICATE-----
  40654. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  40655. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  40656. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  40657. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  40658. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  40659. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  40660. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  40661. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  40662. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  40663. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  40664. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  40665. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  40666. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  40667. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  40668. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  40669. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  40670. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  40671. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  40672. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  40673. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  40674. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  40675. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  40676. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  40677. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  40678. O3jtZsSOeWmD3n+M
  40679. -----END CERTIFICATE-----
  40680. QuoVadis Root CA 3 G3
  40681. =====================
  40682. -----BEGIN CERTIFICATE-----
  40683. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  40684. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  40685. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  40686. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  40687. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  40688. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  40689. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  40690. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  40691. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  40692. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  40693. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  40694. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  40695. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  40696. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  40697. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  40698. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  40699. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  40700. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  40701. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  40702. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  40703. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  40704. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  40705. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  40706. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  40707. PpxxVJkES/1Y+Zj0
  40708. -----END CERTIFICATE-----
  40709. DigiCert Assured ID Root G2
  40710. ===========================
  40711. -----BEGIN CERTIFICATE-----
  40712. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  40713. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  40714. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  40715. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  40716. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  40717. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  40718. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  40719. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  40720. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  40721. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  40722. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  40723. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  40724. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  40725. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  40726. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  40727. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  40728. IhNzbM8m9Yop5w==
  40729. -----END CERTIFICATE-----
  40730. DigiCert Assured ID Root G3
  40731. ===========================
  40732. -----BEGIN CERTIFICATE-----
  40733. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  40734. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  40735. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  40736. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  40737. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  40738. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  40739. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  40740. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  40741. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  40742. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  40743. 1vUhZscv6pZjamVFkpUBtA==
  40744. -----END CERTIFICATE-----
  40745. DigiCert Global Root G2
  40746. =======================
  40747. -----BEGIN CERTIFICATE-----
  40748. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  40749. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  40750. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  40751. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  40752. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  40753. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  40754. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  40755. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  40756. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  40757. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  40758. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  40759. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  40760. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  40761. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  40762. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  40763. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  40764. MrY=
  40765. -----END CERTIFICATE-----
  40766. DigiCert Global Root G3
  40767. =======================
  40768. -----BEGIN CERTIFICATE-----
  40769. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  40770. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  40771. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  40772. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  40773. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  40774. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  40775. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  40776. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  40777. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  40778. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  40779. VOKa5Vt8sycX
  40780. -----END CERTIFICATE-----
  40781. DigiCert Trusted Root G4
  40782. ========================
  40783. -----BEGIN CERTIFICATE-----
  40784. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  40785. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  40786. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  40787. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  40788. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  40789. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  40790. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  40791. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  40792. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  40793. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  40794. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  40795. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  40796. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  40797. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  40798. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  40799. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  40800. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  40801. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  40802. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  40803. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  40804. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  40805. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  40806. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  40807. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  40808. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  40809. 82Z+
  40810. -----END CERTIFICATE-----
  40811. COMODO RSA Certification Authority
  40812. ==================================
  40813. -----BEGIN CERTIFICATE-----
  40814. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  40815. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  40816. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  40817. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  40818. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  40819. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  40820. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  40821. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  40822. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  40823. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  40824. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  40825. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  40826. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  40827. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  40828. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  40829. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  40830. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  40831. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  40832. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  40833. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  40834. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  40835. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  40836. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  40837. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  40838. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  40839. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  40840. LaZRfyHBNVOFBkpdn627G190
  40841. -----END CERTIFICATE-----
  40842. USERTrust RSA Certification Authority
  40843. =====================================
  40844. -----BEGIN CERTIFICATE-----
  40845. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  40846. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  40847. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  40848. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  40849. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  40850. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  40851. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  40852. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  40853. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  40854. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  40855. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  40856. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  40857. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  40858. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  40859. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  40860. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  40861. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  40862. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  40863. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  40864. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  40865. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  40866. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  40867. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  40868. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  40869. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  40870. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  40871. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  40872. -----END CERTIFICATE-----
  40873. USERTrust ECC Certification Authority
  40874. =====================================
  40875. -----BEGIN CERTIFICATE-----
  40876. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  40877. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  40878. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  40879. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  40880. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  40881. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  40882. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  40883. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  40884. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  40885. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  40886. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  40887. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  40888. -----END CERTIFICATE-----
  40889. GlobalSign ECC Root CA - R4
  40890. ===========================
  40891. -----BEGIN CERTIFICATE-----
  40892. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  40893. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  40894. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  40895. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  40896. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  40897. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  40898. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  40899. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  40900. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  40901. -----END CERTIFICATE-----
  40902. GlobalSign ECC Root CA - R5
  40903. ===========================
  40904. -----BEGIN CERTIFICATE-----
  40905. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  40906. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  40907. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  40908. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  40909. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  40910. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  40911. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  40912. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  40913. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  40914. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  40915. -----END CERTIFICATE-----
  40916. Staat der Nederlanden EV Root CA
  40917. ================================
  40918. -----BEGIN CERTIFICATE-----
  40919. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  40920. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  40921. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  40922. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  40923. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  40924. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  40925. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  40926. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  40927. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  40928. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  40929. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  40930. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  40931. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  40932. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  40933. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  40934. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  40935. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  40936. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  40937. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  40938. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  40939. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  40940. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  40941. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  40942. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  40943. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  40944. -----END CERTIFICATE-----
  40945. IdenTrust Commercial Root CA 1
  40946. ==============================
  40947. -----BEGIN CERTIFICATE-----
  40948. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  40949. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  40950. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  40951. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  40952. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  40953. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  40954. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  40955. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  40956. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  40957. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  40958. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  40959. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  40960. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  40961. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  40962. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  40963. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  40964. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  40965. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  40966. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  40967. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  40968. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  40969. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  40970. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  40971. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  40972. cGzM7vRX+Bi6hG6H
  40973. -----END CERTIFICATE-----
  40974. IdenTrust Public Sector Root CA 1
  40975. =================================
  40976. -----BEGIN CERTIFICATE-----
  40977. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  40978. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  40979. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  40980. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  40981. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  40982. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  40983. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  40984. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  40985. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  40986. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  40987. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  40988. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  40989. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  40990. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  40991. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  40992. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  40993. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  40994. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  40995. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  40996. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  40997. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  40998. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  40999. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  41000. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  41001. 3Wl9af0AVqW3rLatt8o+Ae+c
  41002. -----END CERTIFICATE-----
  41003. Entrust Root Certification Authority - G2
  41004. =========================================
  41005. -----BEGIN CERTIFICATE-----
  41006. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  41007. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  41008. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  41009. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  41010. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  41011. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  41012. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  41013. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  41014. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  41015. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  41016. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  41017. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  41018. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  41019. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  41020. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  41021. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  41022. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  41023. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  41024. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  41025. e4pIb4tF9g==
  41026. -----END CERTIFICATE-----
  41027. Entrust Root Certification Authority - EC1
  41028. ==========================================
  41029. -----BEGIN CERTIFICATE-----
  41030. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  41031. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  41032. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  41033. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  41034. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  41035. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  41036. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  41037. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  41038. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  41039. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  41040. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  41041. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  41042. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  41043. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  41044. -----END CERTIFICATE-----
  41045. CFCA EV ROOT
  41046. ============
  41047. -----BEGIN CERTIFICATE-----
  41048. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  41049. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  41050. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  41051. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  41052. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  41053. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  41054. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  41055. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  41056. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  41057. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  41058. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  41059. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  41060. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  41061. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  41062. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  41063. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  41064. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  41065. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  41066. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  41067. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  41068. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  41069. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  41070. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  41071. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  41072. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  41073. -----END CERTIFICATE-----
  41074. OISTE WISeKey Global Root GB CA
  41075. ===============================
  41076. -----BEGIN CERTIFICATE-----
  41077. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  41078. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  41079. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  41080. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  41081. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  41082. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  41083. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  41084. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  41085. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  41086. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  41087. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  41088. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  41089. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  41090. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  41091. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  41092. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  41093. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  41094. -----END CERTIFICATE-----
  41095. SZAFIR ROOT CA2
  41096. ===============
  41097. -----BEGIN CERTIFICATE-----
  41098. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  41099. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  41100. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  41101. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  41102. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  41103. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  41104. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  41105. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  41106. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  41107. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  41108. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  41109. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  41110. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  41111. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  41112. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  41113. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  41114. -----END CERTIFICATE-----
  41115. Certum Trusted Network CA 2
  41116. ===========================
  41117. -----BEGIN CERTIFICATE-----
  41118. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  41119. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  41120. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  41121. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  41122. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  41123. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  41124. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  41125. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  41126. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  41127. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  41128. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  41129. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  41130. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  41131. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  41132. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  41133. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  41134. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  41135. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  41136. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  41137. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  41138. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  41139. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  41140. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  41141. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  41142. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  41143. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  41144. zAYspsbiDrW5viSP
  41145. -----END CERTIFICATE-----
  41146. Hellenic Academic and Research Institutions RootCA 2015
  41147. =======================================================
  41148. -----BEGIN CERTIFICATE-----
  41149. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  41150. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  41151. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  41152. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  41153. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  41154. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  41155. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  41156. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  41157. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  41158. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  41159. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  41160. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  41161. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  41162. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  41163. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  41164. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  41165. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  41166. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  41167. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  41168. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  41169. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  41170. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  41171. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  41172. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  41173. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  41174. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  41175. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  41176. p/UsQu0yrbYhnr68
  41177. -----END CERTIFICATE-----
  41178. Hellenic Academic and Research Institutions ECC RootCA 2015
  41179. ===========================================================
  41180. -----BEGIN CERTIFICATE-----
  41181. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  41182. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  41183. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  41184. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  41185. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  41186. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  41187. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  41188. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  41189. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  41190. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  41191. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  41192. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  41193. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  41194. -----END CERTIFICATE-----
  41195. ISRG Root X1
  41196. ============
  41197. -----BEGIN CERTIFICATE-----
  41198. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  41199. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  41200. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  41201. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  41202. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  41203. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  41204. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  41205. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  41206. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  41207. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  41208. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  41209. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  41210. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  41211. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  41212. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  41213. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  41214. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  41215. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  41216. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  41217. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  41218. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  41219. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  41220. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  41221. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  41222. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  41223. -----END CERTIFICATE-----
  41224. AC RAIZ FNMT-RCM
  41225. ================
  41226. -----BEGIN CERTIFICATE-----
  41227. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  41228. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  41229. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  41230. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  41231. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  41232. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  41233. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  41234. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  41235. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  41236. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  41237. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  41238. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  41239. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  41240. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  41241. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  41242. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  41243. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  41244. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  41245. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  41246. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  41247. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  41248. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  41249. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  41250. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  41251. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  41252. -----END CERTIFICATE-----
  41253. Amazon Root CA 1
  41254. ================
  41255. -----BEGIN CERTIFICATE-----
  41256. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  41257. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  41258. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  41259. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  41260. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  41261. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  41262. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  41263. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  41264. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  41265. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  41266. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  41267. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  41268. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  41269. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  41270. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  41271. -----END CERTIFICATE-----
  41272. Amazon Root CA 2
  41273. ================
  41274. -----BEGIN CERTIFICATE-----
  41275. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  41276. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  41277. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  41278. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  41279. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  41280. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  41281. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  41282. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  41283. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  41284. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  41285. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  41286. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  41287. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  41288. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  41289. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  41290. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  41291. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  41292. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  41293. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  41294. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  41295. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  41296. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  41297. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  41298. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  41299. -----END CERTIFICATE-----
  41300. Amazon Root CA 3
  41301. ================
  41302. -----BEGIN CERTIFICATE-----
  41303. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  41304. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  41305. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  41306. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  41307. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  41308. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  41309. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  41310. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  41311. -----END CERTIFICATE-----
  41312. Amazon Root CA 4
  41313. ================
  41314. -----BEGIN CERTIFICATE-----
  41315. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  41316. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  41317. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  41318. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  41319. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  41320. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  41321. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  41322. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  41323. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  41324. -----END CERTIFICATE-----
  41325. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  41326. =============================================
  41327. -----BEGIN CERTIFICATE-----
  41328. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  41329. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  41330. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  41331. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  41332. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  41333. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  41334. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  41335. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  41336. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  41337. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  41338. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  41339. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  41340. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  41341. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  41342. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  41343. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  41344. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  41345. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  41346. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  41347. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  41348. -----END CERTIFICATE-----
  41349. GDCA TrustAUTH R5 ROOT
  41350. ======================
  41351. -----BEGIN CERTIFICATE-----
  41352. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  41353. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  41354. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  41355. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  41356. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  41357. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  41358. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  41359. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  41360. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  41361. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  41362. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  41363. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  41364. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  41365. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  41366. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  41367. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  41368. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  41369. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  41370. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  41371. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  41372. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  41373. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  41374. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  41375. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  41376. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  41377. -----END CERTIFICATE-----
  41378. TrustCor RootCert CA-1
  41379. ======================
  41380. -----BEGIN CERTIFICATE-----
  41381. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  41382. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  41383. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  41384. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  41385. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  41386. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  41387. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  41388. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  41389. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  41390. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  41391. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  41392. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  41393. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  41394. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  41395. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  41396. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  41397. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  41398. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  41399. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  41400. -----END CERTIFICATE-----
  41401. TrustCor RootCert CA-2
  41402. ======================
  41403. -----BEGIN CERTIFICATE-----
  41404. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  41405. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  41406. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  41407. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  41408. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  41409. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  41410. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  41411. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  41412. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  41413. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  41414. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  41415. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  41416. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  41417. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  41418. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  41419. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  41420. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  41421. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  41422. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  41423. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  41424. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  41425. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  41426. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  41427. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  41428. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  41429. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  41430. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  41431. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  41432. -----END CERTIFICATE-----
  41433. TrustCor ECA-1
  41434. ==============
  41435. -----BEGIN CERTIFICATE-----
  41436. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  41437. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  41438. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  41439. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  41440. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  41441. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  41442. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  41443. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  41444. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  41445. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  41446. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  41447. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  41448. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  41449. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  41450. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  41451. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  41452. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  41453. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  41454. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  41455. -----END CERTIFICATE-----
  41456. SSL.com Root Certification Authority RSA
  41457. ========================================
  41458. -----BEGIN CERTIFICATE-----
  41459. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  41460. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  41461. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  41462. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  41463. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  41464. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  41465. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  41466. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  41467. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  41468. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  41469. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  41470. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  41471. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  41472. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  41473. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  41474. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  41475. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  41476. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  41477. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  41478. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  41479. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  41480. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  41481. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  41482. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  41483. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  41484. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  41485. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  41486. -----END CERTIFICATE-----
  41487. SSL.com Root Certification Authority ECC
  41488. ========================================
  41489. -----BEGIN CERTIFICATE-----
  41490. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  41491. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  41492. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  41493. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  41494. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  41495. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  41496. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  41497. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  41498. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  41499. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  41500. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  41501. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  41502. -----END CERTIFICATE-----
  41503. SSL.com EV Root Certification Authority RSA R2
  41504. ==============================================
  41505. -----BEGIN CERTIFICATE-----
  41506. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  41507. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  41508. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  41509. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  41510. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  41511. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  41512. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  41513. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  41514. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  41515. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  41516. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  41517. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  41518. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  41519. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  41520. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  41521. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  41522. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  41523. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  41524. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  41525. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  41526. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  41527. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  41528. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  41529. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  41530. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  41531. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  41532. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  41533. -----END CERTIFICATE-----
  41534. SSL.com EV Root Certification Authority ECC
  41535. ===========================================
  41536. -----BEGIN CERTIFICATE-----
  41537. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  41538. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  41539. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  41540. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  41541. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  41542. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  41543. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  41544. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  41545. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  41546. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  41547. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  41548. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  41549. -----END CERTIFICATE-----
  41550. GlobalSign Root CA - R6
  41551. =======================
  41552. -----BEGIN CERTIFICATE-----
  41553. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  41554. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  41555. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  41556. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  41557. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  41558. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  41559. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  41560. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  41561. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  41562. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  41563. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  41564. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  41565. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  41566. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  41567. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  41568. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  41569. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  41570. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  41571. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  41572. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  41573. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  41574. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  41575. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  41576. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  41577. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  41578. -----END CERTIFICATE-----
  41579. OISTE WISeKey Global Root GC CA
  41580. ===============================
  41581. -----BEGIN CERTIFICATE-----
  41582. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  41583. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  41584. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  41585. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  41586. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  41587. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  41588. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  41589. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  41590. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  41591. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  41592. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  41593. -----END CERTIFICATE-----
  41594. GTS Root R1
  41595. ===========
  41596. -----BEGIN CERTIFICATE-----
  41597. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  41598. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  41599. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  41600. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  41601. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  41602. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  41603. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  41604. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  41605. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  41606. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  41607. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  41608. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  41609. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  41610. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  41611. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  41612. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  41613. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  41614. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  41615. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  41616. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  41617. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  41618. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  41619. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  41620. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  41621. CFF1pkgl
  41622. -----END CERTIFICATE-----
  41623. GTS Root R2
  41624. ===========
  41625. -----BEGIN CERTIFICATE-----
  41626. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  41627. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  41628. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  41629. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  41630. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  41631. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  41632. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  41633. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  41634. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  41635. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  41636. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  41637. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  41638. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  41639. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  41640. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  41641. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  41642. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  41643. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  41644. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  41645. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  41646. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  41647. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  41648. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  41649. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  41650. o/DUhgkC
  41651. -----END CERTIFICATE-----
  41652. GTS Root R3
  41653. ===========
  41654. -----BEGIN CERTIFICATE-----
  41655. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  41656. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  41657. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  41658. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  41659. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  41660. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  41661. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  41662. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  41663. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  41664. KaqW04MjyaR7YbPMAuhd
  41665. -----END CERTIFICATE-----
  41666. GTS Root R4
  41667. ===========
  41668. -----BEGIN CERTIFICATE-----
  41669. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  41670. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  41671. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  41672. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  41673. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  41674. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  41675. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  41676. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  41677. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  41678. zPKwTdb+mciUqXWi4w==
  41679. -----END CERTIFICATE-----
  41680. UCA Global G2 Root
  41681. ==================
  41682. -----BEGIN CERTIFICATE-----
  41683. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  41684. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  41685. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  41686. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  41687. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  41688. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  41689. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  41690. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  41691. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  41692. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  41693. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  41694. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  41695. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  41696. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  41697. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  41698. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  41699. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  41700. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  41701. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  41702. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  41703. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  41704. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  41705. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  41706. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  41707. -----END CERTIFICATE-----
  41708. UCA Extended Validation Root
  41709. ============================
  41710. -----BEGIN CERTIFICATE-----
  41711. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  41712. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  41713. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  41714. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  41715. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  41716. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  41717. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  41718. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  41719. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  41720. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  41721. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  41722. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  41723. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  41724. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  41725. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  41726. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  41727. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  41728. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  41729. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  41730. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  41731. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  41732. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  41733. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  41734. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  41735. dhh2n1ax
  41736. -----END CERTIFICATE-----
  41737. Certigna Root CA
  41738. ================
  41739. -----BEGIN CERTIFICATE-----
  41740. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  41741. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  41742. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  41743. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  41744. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  41745. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  41746. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  41747. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  41748. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  41749. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  41750. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  41751. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  41752. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  41753. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  41754. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  41755. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  41756. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  41757. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  41758. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  41759. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  41760. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  41761. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  41762. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  41763. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  41764. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  41765. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  41766. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  41767. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  41768. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  41769. -----END CERTIFICATE-----
  41770. emSign Root CA - G1
  41771. ===================
  41772. -----BEGIN CERTIFICATE-----
  41773. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  41774. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  41775. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  41776. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  41777. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  41778. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  41779. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  41780. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  41781. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  41782. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  41783. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  41784. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  41785. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  41786. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  41787. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  41788. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  41789. iN66zB+Afko=
  41790. -----END CERTIFICATE-----
  41791. emSign ECC Root CA - G3
  41792. =======================
  41793. -----BEGIN CERTIFICATE-----
  41794. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  41795. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  41796. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  41797. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  41798. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  41799. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  41800. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  41801. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  41802. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  41803. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  41804. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  41805. -----END CERTIFICATE-----
  41806. emSign Root CA - C1
  41807. ===================
  41808. -----BEGIN CERTIFICATE-----
  41809. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  41810. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  41811. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  41812. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  41813. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  41814. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  41815. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  41816. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  41817. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  41818. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  41819. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  41820. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  41821. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  41822. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  41823. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  41824. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  41825. -----END CERTIFICATE-----
  41826. emSign ECC Root CA - C3
  41827. =======================
  41828. -----BEGIN CERTIFICATE-----
  41829. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  41830. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  41831. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  41832. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  41833. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  41834. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  41835. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  41836. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  41837. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  41838. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  41839. -----END CERTIFICATE-----
  41840. Hongkong Post Root CA 3
  41841. =======================
  41842. -----BEGIN CERTIFICATE-----
  41843. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  41844. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  41845. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  41846. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  41847. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  41848. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  41849. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  41850. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  41851. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  41852. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  41853. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  41854. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  41855. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  41856. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  41857. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  41858. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  41859. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  41860. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  41861. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  41862. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  41863. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  41864. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  41865. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  41866. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  41867. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  41868. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  41869. dBb9HxEGmpv0
  41870. -----END CERTIFICATE-----
  41871. Entrust Root Certification Authority - G4
  41872. =========================================
  41873. -----BEGIN CERTIFICATE-----
  41874. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  41875. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  41876. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  41877. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  41878. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  41879. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  41880. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  41881. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  41882. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  41883. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  41884. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  41885. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  41886. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  41887. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  41888. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  41889. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  41890. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  41891. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  41892. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  41893. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  41894. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  41895. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  41896. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  41897. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  41898. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  41899. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  41900. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  41901. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  41902. kcpG2om3PVODLAgfi49T3f+sHw==
  41903. -----END CERTIFICATE-----
  41904. Microsoft ECC Root Certificate Authority 2017
  41905. =============================================
  41906. -----BEGIN CERTIFICATE-----
  41907. MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  41908. UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND
  41909. IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4
  41910. MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw
  41911. NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQ
  41912. BgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZRogPZnZH6
  41913. thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYbhGBKia/teQ87zvH2RPUB
  41914. eMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTIy5lycFIM
  41915. +Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlf
  41916. Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR
  41917. eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
  41918. -----END CERTIFICATE-----
  41919. Microsoft RSA Root Certificate Authority 2017
  41920. =============================================
  41921. -----BEGIN CERTIFICATE-----
  41922. MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG
  41923. EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg
  41924. UlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIw
  41925. NzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
  41926. MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcw
  41927. ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZNt9GkMml
  41928. 7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0ZdDMbRnMlfl7rEqUrQ7e
  41929. S0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw7
  41930. 1VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+
  41931. dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49F
  41932. yGcohJUcaDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRS
  41933. MLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVr
  41934. lMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ
  41935. 0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJ
  41936. ClTUFLkqqNfs+avNJVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYw
  41937. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC
  41938. NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og
  41939. 6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80
  41940. dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk
  41941. +ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex
  41942. /2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDy
  41943. AmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGRxpl/j8nW
  41944. ZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiAppGWSZI1b7rCoucL5mxAyE
  41945. 7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKT
  41946. c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D
  41947. 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E
  41948. -----END CERTIFICATE-----
  41949. e-Szigno Root CA 2017
  41950. =====================
  41951. -----BEGIN CERTIFICATE-----
  41952. MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw
  41953. DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt
  41954. MjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZa
  41955. Fw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UE
  41956. CgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3pp
  41957. Z25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtvxie+RJCx
  41958. s1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+HWyx7xf58etqjYzBhMA8G
  41959. A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSHERUI0arBeAyxr87GyZDv
  41960. vzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEA
  41961. tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO
  41962. svxyqltZ+efcMQ==
  41963. -----END CERTIFICATE-----
  41964. certSIGN Root CA G2
  41965. ===================
  41966. -----BEGIN CERTIFICATE-----
  41967. MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw
  41968. EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy
  41969. MDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lH
  41970. TiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  41971. ADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05
  41972. N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZuIt4Imfk
  41973. abBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhpn+Sc8CnTXPnGFiWeI8Mg
  41974. wT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKscpc/I1mbySKEwQdPzH/iV8oScLumZfNp
  41975. dWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91Qqh
  41976. ngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732
  41977. jcZZroiFDsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf
  41978. 95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlc
  41979. z8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERL
  41980. iohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
  41981. DgQWBBSCIS1mxteg4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOB
  41982. ywaK8SJJ6ejqkX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC
  41983. b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB
  41984. /AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5
  41985. 8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5
  41986. BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklW
  41987. atKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tU
  41988. Sxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZkPuXaTH4M
  41989. NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N
  41990. 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc=
  41991. -----END CERTIFICATE-----
  41992. Trustwave Global Certification Authority
  41993. ========================================
  41994. -----BEGIN CERTIFICATE-----
  41995. MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV
  41996. UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
  41997. ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
  41998. IEF1dGhvcml0eTAeFw0xNzA4MjMxOTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJV
  41999. UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
  42000. ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
  42001. IEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALldUShLPDeS0YLOvR29
  42002. zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0XznswuvCAAJWX/NKSqIk4cXGIDtiLK0thAf
  42003. LdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4Bq
  42004. stTnoApTAbqOl5F2brz81Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9o
  42005. WN0EACyW80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotPJqX+
  42006. OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1lRtzuzWniTY+HKE40
  42007. Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfwhI0Vcnyh78zyiGG69Gm7DIwLdVcE
  42008. uE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm
  42009. +9jaJXLE9gCxInm943xZYkqcBW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqj
  42010. ifLJS3tBEW1ntwiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud
  42011. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1UdDwEB/wQEAwIB
  42012. BjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W0OhUKDtkLSGm+J1WE2pIPU/H
  42013. PinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfeuyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0H
  42014. ZJDmHvUqoai7PF35owgLEQzxPy0QlG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla
  42015. 4gt5kNdXElE1GYhBaCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5R
  42016. vbbEsLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPTMaCm/zjd
  42017. zyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qequ5AvzSxnI9O4fKSTx+O
  42018. 856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxhVicGaeVyQYHTtgGJoC86cnn+OjC/QezH
  42019. Yj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu
  42020. 3R3y4G5OBVixwJAWKqQ9EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP
  42021. 29FpHOTKyeC2nOnOcXHebD8WpHk=
  42022. -----END CERTIFICATE-----
  42023. Trustwave Global ECC P256 Certification Authority
  42024. =================================================
  42025. -----BEGIN CERTIFICATE-----
  42026. MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYDVQQGEwJVUzER
  42027. MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
  42028. b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZp
  42029. Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYD
  42030. VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
  42031. dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1
  42032. NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH77bOYj
  42033. 43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoNFWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqm
  42034. P62jQzBBMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt
  42035. 0UrrdaVKEJmzsaGLSvcwCgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjz
  42036. RM4q3wghDDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7
  42037. -----END CERTIFICATE-----
  42038. Trustwave Global ECC P384 Certification Authority
  42039. =================================================
  42040. -----BEGIN CERTIFICATE-----
  42041. MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYDVQQGEwJVUzER
  42042. MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
  42043. b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZp
  42044. Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYD
  42045. VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
  42046. dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4
  42047. NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuBBAAiA2IABGvaDXU1CDFH
  42048. Ba5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJj9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr
  42049. /TklZvFe/oyujUF5nQlgziip04pt89ZF1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNV
  42050. HQ8BAf8EBQMDBwYAMB0GA1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNn
  42051. ADBkAjA3AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsCMGcl
  42052. CrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVuSw==
  42053. -----END CERTIFICATE-----
  42054. NAVER Global Root Certification Authority
  42055. =========================================
  42056. -----BEGIN CERTIFICATE-----
  42057. MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEMBQAwaTELMAkG
  42058. A1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRGT1JNIENvcnAuMTIwMAYDVQQD
  42059. DClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4
  42060. NDJaFw0zNzA4MTgyMzU5NTlaMGkxCzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVT
  42061. UyBQTEFURk9STSBDb3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlv
  42062. biBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVAiQqrDZBb
  42063. UGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH38dq6SZeWYp34+hInDEW
  42064. +j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lEHoSTGEq0n+USZGnQJoViAbbJAh2+g1G7
  42065. XNr4rRVqmfeSVPc0W+m/6imBEtRTkZazkVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2
  42066. aacp+yPOiNgSnABIqKYPszuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4
  42067. Yb8ObtoqvC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHfnZ3z
  42068. VHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaGYQ5fG8Ir4ozVu53B
  42069. A0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo0es+nPxdGoMuK8u180SdOqcXYZai
  42070. cdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3aCJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejy
  42071. YhbLgGvtPe31HzClrkvJE+2KAQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNV
  42072. HQ4EFgQU0p+I36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB
  42073. Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoNqo0hV4/GPnrK
  42074. 21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatjcu3cvuzHV+YwIHHW1xDBE1UB
  42075. jCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm+LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bx
  42076. hYTeodoS76TiEJd6eN4MUZeoIUCLhr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTg
  42077. E34h5prCy8VCZLQelHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTH
  42078. D8z7p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8piKCk5XQ
  42079. A76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLRLBT/DShycpWbXgnbiUSY
  42080. qqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oG
  42081. I/hGoiLtk/bdmuYqh7GYVPEi92tF4+KOdh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmg
  42082. kpzNNIaRkPpkUZ3+/uul9XXeifdy
  42083. -----END CERTIFICATE-----
  42084. AC RAIZ FNMT-RCM SERVIDORES SEGUROS
  42085. ===================================
  42086. -----BEGIN CERTIFICATE-----
  42087. MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQswCQYDVQQGEwJF
  42088. UzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgwFgYDVQRhDA9WQVRFUy1RMjgy
  42089. NjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1SQ00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4
  42090. MTIyMDA5MzczM1oXDTQzMTIyMDA5MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQt
  42091. UkNNMQ4wDAYDVQQLDAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNB
  42092. QyBSQUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  42093. BPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LHsbI6GA60XYyzZl2hNPk2
  42094. LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oKUm8BA06Oi6NCMEAwDwYDVR0TAQH/BAUw
  42095. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqG
  42096. SM49BAMDA2kAMGYCMQCuSuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoD
  42097. zBOQn5ICMQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJyv+c=
  42098. -----END CERTIFICATE-----
  42099. GlobalSign Root R46
  42100. ===================
  42101. -----BEGIN CERTIFICATE-----
  42102. MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUAMEYxCzAJBgNV
  42103. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJv
  42104. b3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAX
  42105. BgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIi
  42106. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08Es
  42107. CVeJOaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQGvGIFAha/
  42108. r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud316HCkD7rRlr+/fKYIje
  42109. 2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo0q3v84RLHIf8E6M6cqJaESvWJ3En7YEt
  42110. bWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSEy132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvj
  42111. K8Cd+RTyG/FWaha/LIWFzXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD4
  42112. 12lPFzYE+cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCNI/on
  42113. ccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzsx2sZy/N78CsHpdls
  42114. eVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqaByFrgY/bxFn63iLABJzjqls2k+g9
  42115. vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYD
  42116. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEM
  42117. BQADggIBAHx47PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg
  42118. JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti2kM3S+LGteWy
  42119. gxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIkpnnpHs6i58FZFZ8d4kuaPp92
  42120. CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRFFRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZm
  42121. OUdkLG5NrmJ7v2B0GbhWrJKsFjLtrWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qq
  42122. JZ4d16GLuc1CLgSkZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwye
  42123. qiv5u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP4vkYxboz
  42124. nxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6N3ec592kD3ZDZopD8p/7
  42125. DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3vouXsXgxT7PntgMTzlSdriVZzH81Xwj3
  42126. QEUxeCp6
  42127. -----END CERTIFICATE-----
  42128. GlobalSign Root E46
  42129. ===================
  42130. -----BEGIN CERTIFICATE-----
  42131. MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYxCzAJBgNVBAYT
  42132. AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJvb3Qg
  42133. RTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNV
  42134. BAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcq
  42135. hkjOPQIBBgUrgQQAIgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkB
  42136. jtjqR+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGddyXqBPCCj
  42137. QjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQxCpCPtsad0kRL
  42138. gLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZk
  42139. vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+
  42140. CAezNIm8BZ/3Hobui3A=
  42141. -----END CERTIFICATE-----
  42142. GLOBALTRUST 2020
  42143. ================
  42144. -----BEGIN CERTIFICATE-----
  42145. MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkGA1UEBhMCQVQx
  42146. IzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVT
  42147. VCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYxMDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAh
  42148. BgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAy
  42149. MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWi
  42150. D59bRatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9ZYybNpyrO
  42151. VPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3QWPKzv9pj2gOlTblzLmM
  42152. CcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPwyJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCm
  42153. fecqQjuCgGOlYx8ZzHyyZqjC0203b+J+BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKA
  42154. A1GqtH6qRNdDYfOiaxaJSaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9OR
  42155. JitHHmkHr96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj04KlG
  42156. DfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9MedKZssCz3AwyIDMvU
  42157. clOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIwq7ejMZdnrY8XD2zHc+0klGvIg5rQ
  42158. mjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUw
  42159. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1Ud
  42160. IwQYMBaAFNwuH9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA
  42161. VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJCXtzoRlgHNQIw
  42162. 4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd6IwPS3BD0IL/qMy/pJTAvoe9
  42163. iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf+I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS
  42164. 8cE54+X1+NZK3TTN+2/BT+MAi1bikvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2
  42165. HcqtbepBEX4tdJP7wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxS
  42166. vTOBTI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6CMUO+1918
  42167. oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn4rnvyOL2NSl6dPrFf4IF
  42168. YqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+IaFvowdlxfv1k7/9nR4hYJS8+hge9+6jl
  42169. gqispdNpQ80xiEmEU5LAsTkbOYMBMMTyqfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg==
  42170. -----END CERTIFICATE-----
  42171. ANF Secure Server Root CA
  42172. =========================
  42173. -----BEGIN CERTIFICATE-----
  42174. MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNVBAUTCUc2MzI4
  42175. NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lv
  42176. bjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNVBAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3Qg
  42177. Q0EwHhcNMTkwOTA0MTAwMDM4WhcNMzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEw
  42178. MQswCQYDVQQGEwJFUzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQw
  42179. EgYDVQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9vdCBDQTCC
  42180. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCjcqQZAZ2cC4Ffc0m6p6zz
  42181. BE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9qyGFOtibBTI3/TO80sh9l2Ll49a2pcbnv
  42182. T1gdpd50IJeh7WhM3pIXS7yr/2WanvtH2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcv
  42183. B2VSAKduyK9o7PQUlrZXH1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXse
  42184. zx76W0OLzc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyRp1RM
  42185. VwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQzW7i1o0TJrH93PB0j
  42186. 7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/SiOL9V8BY9KHcyi1Swr1+KuCLH5z
  42187. JTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJnLNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe
  42188. 8TZBAQIvfXOn3kLMTOmJDVb3n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVO
  42189. Hj1tyRRM4y5Bu8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj
  42190. o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAOBgNVHQ8BAf8E
  42191. BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEATh65isagmD9uw2nAalxJ
  42192. UqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzx
  42193. j6ptBZNscsdW699QIyjlRRA96Gejrw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDt
  42194. dD+4E5UGUcjohybKpFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM
  42195. 5gf0vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjqOknkJjCb
  42196. 5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ/zo1PqVUSlJZS2Db7v54
  42197. EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ92zg/LFis6ELhDtjTO0wugumDLmsx2d1H
  42198. hk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGy
  42199. g77FGr8H6lnco4g175x2MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3
  42200. r5+qPeoott7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw=
  42201. -----END CERTIFICATE-----
  42202. Certum EC-384 CA
  42203. ================
  42204. -----BEGIN CERTIFICATE-----
  42205. MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQswCQYDVQQGEwJQ
  42206. TDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
  42207. dGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2
  42208. MDcyNDU0WhcNNDMwMzI2MDcyNDU0WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERh
  42209. dGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx
  42210. GTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATEKI6rGFtq
  42211. vm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7TmFy8as10CW4kjPMIRBSqn
  42212. iBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68KjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  42213. VR0OBBYEFI0GZnQkdjrzife81r1HfS+8EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNo
  42214. ADBlAjADVS2m5hjEfO/JUG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0
  42215. QoSZ/6vnnvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k=
  42216. -----END CERTIFICATE-----
  42217. Certum Trusted Root CA
  42218. ======================
  42219. -----BEGIN CERTIFICATE-----
  42220. MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQG
  42221. EwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0g
  42222. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0Ew
  42223. HhcNMTgwMzE2MTIxMDEzWhcNNDMwMzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMY
  42224. QXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBB
  42225. dXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEB
  42226. AQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZn0EGze2jusDbCSzBfN8p
  42227. fktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/qp1x4EaTByIVcJdPTsuclzxFUl6s1wB52
  42228. HO8AU5853BSlLCIls3Jy/I2z5T4IHhQqNwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2
  42229. fJmItdUDmj0VDT06qKhF8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGt
  42230. g/BKEiJ3HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGamqi4
  42231. NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi7VdNIuJGmj8PkTQk
  42232. fVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSFytKAQd8FqKPVhJBPC/PgP5sZ0jeJ
  42233. P/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0PqafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSY
  42234. njYJdmZm/Bo/6khUHL4wvYBQv3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHK
  42235. HRzQ+8S1h9E6Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1
  42236. vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIBAEii1QAL
  42237. LtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4WxmB82M+w85bj/UvXgF2Ez8s
  42238. ALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvozMrnadyHncI013nR03e4qllY/p0m+jiGPp2K
  42239. h2RX5Rc64vmNueMzeMGQ2Ljdt4NR5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8
  42240. CYyqOhNf6DR5UMEQGfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA
  42241. 4kZf5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq0Uc9Nneo
  42242. WWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7DP78v3DSk+yshzWePS/Tj
  42243. 6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTMqJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmT
  42244. OPQD8rv7gmsHINFSH5pkAnuYZttcTVoP0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZck
  42245. bxJF0WddCajJFdr60qZfE2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
  42246. -----END CERTIFICATE-----
  42247. TunTrust Root CA
  42248. ================
  42249. -----BEGIN CERTIFICATE-----
  42250. MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQELBQAwYTELMAkG
  42251. A1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUgQ2VydGlmaWNhdGlvbiBFbGVj
  42252. dHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJvb3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQw
  42253. NDI2MDg1NzU2WjBhMQswCQYDVQQGEwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBD
  42254. ZXJ0aWZpY2F0aW9uIEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIw
  42255. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZn56eY+hz
  42256. 2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd2JQDoOw05TDENX37Jk0b
  42257. bjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgFVwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7
  42258. NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZGoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAd
  42259. gjH8KcwAWJeRTIAAHDOFli/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViW
  42260. VSHbhlnUr8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2eY8f
  42261. Tpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIbMlEsPvLfe/ZdeikZ
  42262. juXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISgjwBUFfyRbVinljvrS5YnzWuioYas
  42263. DXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwS
  42264. VXAkPcvCFDVDXSdOvsC9qnyW5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI
  42265. 04Y+oXNZtPdEITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0
  42266. 90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+zxiD2BkewhpMl
  42267. 0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYuQEkHDVneixCwSQXi/5E/S7fd
  42268. Ao74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRY
  42269. YdZ2vyJ/0Adqp2RT8JeNnYA/u8EH22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJp
  42270. adbGNjHh/PqAulxPxOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65x
  42271. xBzndFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5Xc0yGYuP
  42272. jCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7bnV2UqL1g52KAdoGDDIzM
  42273. MEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQCvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9z
  42274. ZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZHu/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3r
  42275. AZ3r2OvEhJn7wAzMMujjd9qDRIueVSjAi1jTkD5OGwDxFa2DK5o=
  42276. -----END CERTIFICATE-----
  42277. HARICA TLS RSA Root CA 2021
  42278. ===========================
  42279. -----BEGIN CERTIFICATE-----
  42280. MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBsMQswCQYDVQQG
  42281. EwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  42282. cyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0EgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUz
  42283. OFoXDTQ1MDIxMzEwNTUzN1owbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRl
  42284. bWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNB
  42285. IFJvb3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569lmwVnlskN
  42286. JLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE4VGC/6zStGndLuwRo0Xu
  42287. a2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uva9of08WRiFukiZLRgeaMOVig1mlDqa2Y
  42288. Ulhu2wr7a89o+uOkXjpFc5gH6l8Cct4MpbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K
  42289. 5FrZx40d/JiZ+yykgmvwKh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEv
  42290. dmn8kN3bLW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcYAuUR
  42291. 0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqBAGMUuTNe3QvboEUH
  42292. GjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYqE613TBoYm5EPWNgGVMWX+Ko/IIqm
  42293. haZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHrW2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQ
  42294. CPxrvrNQKlr9qEgYRtaQQJKQCoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8G
  42295. A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE
  42296. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAUX15QvWiWkKQU
  42297. EapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3f5Z2EMVGpdAgS1D0NTsY9FVq
  42298. QRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxajaH6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxD
  42299. QpSbIPDRzbLrLFPCU3hKTwSUQZqPJzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcR
  42300. j88YxeMn/ibvBZ3PzzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5
  42301. vZStjBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0/L5H9MG0
  42302. qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pTBGIBnfHAT+7hOtSLIBD6
  42303. Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79aPib8qXPMThcFarmlwDB31qlpzmq6YR/
  42304. PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YWxw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnn
  42305. kf3/W9b3raYvAwtt41dU63ZTGI0RmLo=
  42306. -----END CERTIFICATE-----
  42307. HARICA TLS ECC Root CA 2021
  42308. ===========================
  42309. -----BEGIN CERTIFICATE-----
  42310. MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQswCQYDVQQGEwJH
  42311. UjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBD
  42312. QTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoX
  42313. DTQ1MDIxMzExMDEwOVowbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWlj
  42314. IGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJv
  42315. b3QgQ0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7KKrxcm1l
  42316. AEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9YSTHMmE5gEYd103KUkE+b
  42317. ECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW
  42318. 0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAi
  42319. rcJRQO9gcS3ujwLEXQNwSaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/Qw
  42320. CZ61IygNnxS2PFOiTAZpffpskcYqSUXm7LcT4Tps
  42321. -----END CERTIFICATE-----
  42322. <?php
  42323. namespace Composer\CaBundle;
  42324. use Psr\Log\LoggerInterface;
  42325. use Symfony\Component\Process\PhpProcess;
  42326. class CaBundle
  42327. {
  42328. private static $caPath;
  42329. private static $caFileValidity = array();
  42330. private static $useOpensslParse;
  42331. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  42332. {
  42333. if (self::$caPath !== null) {
  42334. return self::$caPath;
  42335. }
  42336. $caBundlePaths = array();
  42337. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  42338. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  42339. $caBundlePaths[] = ini_get('openssl.cafile');
  42340. $caBundlePaths[] = ini_get('openssl.capath');
  42341. $otherLocations = array(
  42342. '/etc/pki/tls/certs/ca-bundle.crt',
  42343. '/etc/ssl/certs/ca-certificates.crt',
  42344. '/etc/ssl/ca-bundle.pem',
  42345. '/usr/local/share/certs/ca-root-nss.crt',
  42346. '/usr/ssl/certs/ca-bundle.crt',
  42347. '/opt/local/share/curl/curl-ca-bundle.crt',
  42348. '/usr/local/share/curl/curl-ca-bundle.crt',
  42349. '/usr/share/ssl/certs/ca-bundle.crt',
  42350. '/etc/ssl/cert.pem',
  42351. '/usr/local/etc/ssl/cert.pem',
  42352. '/usr/local/etc/openssl/cert.pem',
  42353. '/usr/local/etc/openssl@1.1/cert.pem',
  42354. );
  42355. foreach($otherLocations as $location) {
  42356. $otherLocations[] = dirname($location);
  42357. }
  42358. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  42359. foreach ($caBundlePaths as $caBundle) {
  42360. if ($caBundle && self::caFileUsable($caBundle, $logger)) {
  42361. return self::$caPath = $caBundle;
  42362. }
  42363. if ($caBundle && self::caDirUsable($caBundle, $logger)) {
  42364. return self::$caPath = $caBundle;
  42365. }
  42366. }
  42367. return self::$caPath = static::getBundledCaBundlePath();
  42368. }
  42369. public static function getBundledCaBundlePath()
  42370. {
  42371. $caBundleFile = __DIR__.'/../res/cacert.pem';
  42372. if (0 === strpos($caBundleFile, 'phar://')) {
  42373. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-');
  42374. if (false === $tempCaBundleFile) {
  42375. throw new \RuntimeException('Could not create a temporary file to store the bundled CA file');
  42376. }
  42377. file_put_contents(
  42378. $tempCaBundleFile,
  42379. file_get_contents($caBundleFile)
  42380. );
  42381. register_shutdown_function(function() use ($tempCaBundleFile) {
  42382. @unlink($tempCaBundleFile);
  42383. });
  42384. $caBundleFile = $tempCaBundleFile;
  42385. }
  42386. return $caBundleFile;
  42387. }
  42388. public static function validateCaFile($filename, LoggerInterface $logger = null)
  42389. {
  42390. static $warned = false;
  42391. if (isset(self::$caFileValidity[$filename])) {
  42392. return self::$caFileValidity[$filename];
  42393. }
  42394. $contents = file_get_contents($filename);
  42395. if (!static::isOpensslParseSafe()) {
  42396. if (!$warned && $logger) {
  42397. $logger->warning(sprintf(
  42398. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  42399. PHP_VERSION
  42400. ));
  42401. $warned = true;
  42402. }
  42403. $isValid = !empty($contents);
  42404. } elseif (is_string($contents) && strlen($contents) > 0) {
  42405. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  42406. if (null === $contents) {
  42407. $isValid = false;
  42408. } else {
  42409. $isValid = (bool) openssl_x509_parse($contents);
  42410. }
  42411. } else {
  42412. $isValid = false;
  42413. }
  42414. if ($logger) {
  42415. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  42416. }
  42417. return self::$caFileValidity[$filename] = $isValid;
  42418. }
  42419. public static function isOpensslParseSafe()
  42420. {
  42421. if (null !== self::$useOpensslParse) {
  42422. return self::$useOpensslParse;
  42423. }
  42424. if (PHP_VERSION_ID >= 50600) {
  42425. return self::$useOpensslParse = true;
  42426. }
  42427. if (
  42428. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  42429. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  42430. || PHP_VERSION_ID >= 50507
  42431. ) {
  42432. return self::$useOpensslParse = true;
  42433. }
  42434. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  42435. return self::$useOpensslParse = false;
  42436. }
  42437. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  42438. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  42439. if (preg_match($regex, PHP_VERSION, $m)) {
  42440. return ((int) $m[1]) >= $fixedVersion;
  42441. }
  42442. return false;
  42443. };
  42444. if (
  42445. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  42446. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  42447. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  42448. ) {
  42449. return self::$useOpensslParse = true;
  42450. }
  42451. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  42452. return self::$useOpensslParse = false;
  42453. }
  42454. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  42455. $script = <<<'EOT'
  42456. error_reporting(-1);
  42457. $info = openssl_x509_parse(base64_decode('%s'));
  42458. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  42459. EOT;
  42460. $script = '<'."?php\n".sprintf($script, $cert);
  42461. try {
  42462. $process = new PhpProcess($script);
  42463. $process->mustRun();
  42464. } catch (\Exception $e) {
  42465. return self::$useOpensslParse = false;
  42466. }
  42467. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  42468. $errorOutput = trim($process->getErrorOutput());
  42469. if (
  42470. is_array($output)
  42471. && count($output) === 3
  42472. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  42473. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  42474. && $output[2] === 'int(-1)'
  42475. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  42476. ) {
  42477. return self::$useOpensslParse = true;
  42478. }
  42479. return self::$useOpensslParse = false;
  42480. }
  42481. public static function reset()
  42482. {
  42483. self::$caFileValidity = array();
  42484. self::$caPath = null;
  42485. self::$useOpensslParse = null;
  42486. }
  42487. private static function getEnvVariable($name)
  42488. {
  42489. if (isset($_SERVER[$name])) {
  42490. return (string) $_SERVER[$name];
  42491. }
  42492. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  42493. return (string) $value;
  42494. }
  42495. return false;
  42496. }
  42497. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  42498. {
  42499. return $certFile
  42500. && static::isFile($certFile, $logger)
  42501. && static::isReadable($certFile, $logger)
  42502. && static::validateCaFile($certFile, $logger);
  42503. }
  42504. private static function caDirUsable($certDir, LoggerInterface $logger = null)
  42505. {
  42506. return $certDir
  42507. && static::isDir($certDir, $logger)
  42508. && static::isReadable($certDir, $logger)
  42509. && static::glob($certDir . '/*', $logger);
  42510. }
  42511. private static function isFile($certFile, LoggerInterface $logger = null)
  42512. {
  42513. $isFile = @is_file($certFile);
  42514. if (!$isFile && $logger) {
  42515. $logger->debug(sprintf('Checked CA file %s does not exist or it is not a file.', $certFile));
  42516. }
  42517. return $isFile;
  42518. }
  42519. private static function isDir($certDir, LoggerInterface $logger = null)
  42520. {
  42521. $isDir = @is_dir($certDir);
  42522. if (!$isDir && $logger) {
  42523. $logger->debug(sprintf('Checked directory %s does not exist or it is not a directory.', $certDir));
  42524. }
  42525. return $isDir;
  42526. }
  42527. private static function isReadable($certFileOrDir, LoggerInterface $logger = null)
  42528. {
  42529. $isReadable = @is_readable($certFileOrDir);
  42530. if (!$isReadable && $logger) {
  42531. $logger->debug(sprintf('Checked file or directory %s is not readable.', $certFileOrDir));
  42532. }
  42533. return $isReadable;
  42534. }
  42535. private static function glob($pattern, LoggerInterface $logger = null)
  42536. {
  42537. $certs = glob($pattern);
  42538. if ($certs === false) {
  42539. if ($logger) {
  42540. $logger->debug(sprintf("An error occurred while trying to find certificates for pattern: %s", $pattern));
  42541. }
  42542. return false;
  42543. }
  42544. if (count($certs) === 0) {
  42545. if ($logger) {
  42546. $logger->debug(sprintf("No CA files found for pattern: %s", $pattern));
  42547. }
  42548. return false;
  42549. }
  42550. return true;
  42551. }
  42552. }
  42553. <?php return array(
  42554. 'root' => array(
  42555. 'pretty_version' => '2.3.4',
  42556. 'version' => '2.3.4.0',
  42557. 'type' => 'library',
  42558. 'install_path' => __DIR__ . '/../../',
  42559. 'aliases' => array(),
  42560. 'reference' => 'b7a041319947872c4352aa8139f4b4d6dea7130f',
  42561. 'name' => 'composer/composer',
  42562. 'dev' => false,
  42563. ),
  42564. 'versions' => array(
  42565. 'composer/ca-bundle' => array(
  42566. 'pretty_version' => '1.3.1',
  42567. 'version' => '1.3.1.0',
  42568. 'type' => 'library',
  42569. 'install_path' => __DIR__ . '/./ca-bundle',
  42570. 'aliases' => array(),
  42571. 'reference' => '4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b',
  42572. 'dev_requirement' => false,
  42573. ),
  42574. 'composer/composer' => array(
  42575. 'pretty_version' => '2.3.4',
  42576. 'version' => '2.3.4.0',
  42577. 'type' => 'library',
  42578. 'install_path' => __DIR__ . '/../../',
  42579. 'aliases' => array(),
  42580. 'reference' => 'b7a041319947872c4352aa8139f4b4d6dea7130f',
  42581. 'dev_requirement' => false,
  42582. ),
  42583. 'composer/metadata-minifier' => array(
  42584. 'pretty_version' => '1.0.0',
  42585. 'version' => '1.0.0.0',
  42586. 'type' => 'library',
  42587. 'install_path' => __DIR__ . '/./metadata-minifier',
  42588. 'aliases' => array(),
  42589. 'reference' => 'c549d23829536f0d0e984aaabbf02af91f443207',
  42590. 'dev_requirement' => false,
  42591. ),
  42592. 'composer/pcre' => array(
  42593. 'pretty_version' => '2.0.0',
  42594. 'version' => '2.0.0.0',
  42595. 'type' => 'library',
  42596. 'install_path' => __DIR__ . '/./pcre',
  42597. 'aliases' => array(),
  42598. 'reference' => 'c8e9d27cfc5ed22643c19c160455b473ffd8aabe',
  42599. 'dev_requirement' => false,
  42600. ),
  42601. 'composer/semver' => array(
  42602. 'pretty_version' => '3.3.2',
  42603. 'version' => '3.3.2.0',
  42604. 'type' => 'library',
  42605. 'install_path' => __DIR__ . '/./semver',
  42606. 'aliases' => array(),
  42607. 'reference' => '3953f23262f2bff1919fc82183ad9acb13ff62c9',
  42608. 'dev_requirement' => false,
  42609. ),
  42610. 'composer/spdx-licenses' => array(
  42611. 'pretty_version' => '1.5.6',
  42612. 'version' => '1.5.6.0',
  42613. 'type' => 'library',
  42614. 'install_path' => __DIR__ . '/./spdx-licenses',
  42615. 'aliases' => array(),
  42616. 'reference' => 'a30d487169d799745ca7280bc90fdfa693536901',
  42617. 'dev_requirement' => false,
  42618. ),
  42619. 'composer/xdebug-handler' => array(
  42620. 'pretty_version' => '3.0.3',
  42621. 'version' => '3.0.3.0',
  42622. 'type' => 'library',
  42623. 'install_path' => __DIR__ . '/./xdebug-handler',
  42624. 'aliases' => array(),
  42625. 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c',
  42626. 'dev_requirement' => false,
  42627. ),
  42628. 'justinrainbow/json-schema' => array(
  42629. 'pretty_version' => '5.2.11',
  42630. 'version' => '5.2.11.0',
  42631. 'type' => 'library',
  42632. 'install_path' => __DIR__ . '/../justinrainbow/json-schema',
  42633. 'aliases' => array(),
  42634. 'reference' => '2ab6744b7296ded80f8cc4f9509abbff393399aa',
  42635. 'dev_requirement' => false,
  42636. ),
  42637. 'psr/container' => array(
  42638. 'pretty_version' => '1.1.1',
  42639. 'version' => '1.1.1.0',
  42640. 'type' => 'library',
  42641. 'install_path' => __DIR__ . '/../psr/container',
  42642. 'aliases' => array(),
  42643. 'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf',
  42644. 'dev_requirement' => false,
  42645. ),
  42646. 'psr/log' => array(
  42647. 'pretty_version' => '1.1.4',
  42648. 'version' => '1.1.4.0',
  42649. 'type' => 'library',
  42650. 'install_path' => __DIR__ . '/../psr/log',
  42651. 'aliases' => array(),
  42652. 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
  42653. 'dev_requirement' => false,
  42654. ),
  42655. 'psr/log-implementation' => array(
  42656. 'dev_requirement' => false,
  42657. 'provided' => array(
  42658. 0 => '1.0|2.0',
  42659. ),
  42660. ),
  42661. 'react/promise' => array(
  42662. 'pretty_version' => 'v2.9.0',
  42663. 'version' => '2.9.0.0',
  42664. 'type' => 'library',
  42665. 'install_path' => __DIR__ . '/../react/promise',
  42666. 'aliases' => array(),
  42667. 'reference' => '234f8fd1023c9158e2314fa9d7d0e6a83db42910',
  42668. 'dev_requirement' => false,
  42669. ),
  42670. 'seld/jsonlint' => array(
  42671. 'pretty_version' => '1.9.0',
  42672. 'version' => '1.9.0.0',
  42673. 'type' => 'library',
  42674. 'install_path' => __DIR__ . '/../seld/jsonlint',
  42675. 'aliases' => array(),
  42676. 'reference' => '4211420d25eba80712bff236a98960ef68b866b7',
  42677. 'dev_requirement' => false,
  42678. ),
  42679. 'seld/phar-utils' => array(
  42680. 'pretty_version' => '1.2.0',
  42681. 'version' => '1.2.0.0',
  42682. 'type' => 'library',
  42683. 'install_path' => __DIR__ . '/../seld/phar-utils',
  42684. 'aliases' => array(),
  42685. 'reference' => '9f3452c93ff423469c0d56450431562ca423dcee',
  42686. 'dev_requirement' => false,
  42687. ),
  42688. 'symfony/console' => array(
  42689. 'pretty_version' => 'v5.4.5',
  42690. 'version' => '5.4.5.0',
  42691. 'type' => 'library',
  42692. 'install_path' => __DIR__ . '/../symfony/console',
  42693. 'aliases' => array(),
  42694. 'reference' => 'd8111acc99876953f52fe16d4c50eb60940d49ad',
  42695. 'dev_requirement' => false,
  42696. ),
  42697. 'symfony/deprecation-contracts' => array(
  42698. 'pretty_version' => 'v2.5.0',
  42699. 'version' => '2.5.0.0',
  42700. 'type' => 'library',
  42701. 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
  42702. 'aliases' => array(),
  42703. 'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8',
  42704. 'dev_requirement' => false,
  42705. ),
  42706. 'symfony/filesystem' => array(
  42707. 'pretty_version' => 'v5.4.6',
  42708. 'version' => '5.4.6.0',
  42709. 'type' => 'library',
  42710. 'install_path' => __DIR__ . '/../symfony/filesystem',
  42711. 'aliases' => array(),
  42712. 'reference' => 'd53a45039974952af7f7ebc461ccdd4295e29440',
  42713. 'dev_requirement' => false,
  42714. ),
  42715. 'symfony/finder' => array(
  42716. 'pretty_version' => 'v5.4.3',
  42717. 'version' => '5.4.3.0',
  42718. 'type' => 'library',
  42719. 'install_path' => __DIR__ . '/../symfony/finder',
  42720. 'aliases' => array(),
  42721. 'reference' => '231313534dded84c7ecaa79d14bc5da4ccb69b7d',
  42722. 'dev_requirement' => false,
  42723. ),
  42724. 'symfony/polyfill-ctype' => array(
  42725. 'pretty_version' => 'v1.25.0',
  42726. 'version' => '1.25.0.0',
  42727. 'type' => 'library',
  42728. 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
  42729. 'aliases' => array(),
  42730. 'reference' => '30885182c981ab175d4d034db0f6f469898070ab',
  42731. 'dev_requirement' => false,
  42732. ),
  42733. 'symfony/polyfill-intl-grapheme' => array(
  42734. 'pretty_version' => 'v1.25.0',
  42735. 'version' => '1.25.0.0',
  42736. 'type' => 'library',
  42737. 'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
  42738. 'aliases' => array(),
  42739. 'reference' => '81b86b50cf841a64252b439e738e97f4a34e2783',
  42740. 'dev_requirement' => false,
  42741. ),
  42742. 'symfony/polyfill-intl-normalizer' => array(
  42743. 'pretty_version' => 'v1.25.0',
  42744. 'version' => '1.25.0.0',
  42745. 'type' => 'library',
  42746. 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
  42747. 'aliases' => array(),
  42748. 'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8',
  42749. 'dev_requirement' => false,
  42750. ),
  42751. 'symfony/polyfill-mbstring' => array(
  42752. 'pretty_version' => 'v1.25.0',
  42753. 'version' => '1.25.0.0',
  42754. 'type' => 'library',
  42755. 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
  42756. 'aliases' => array(),
  42757. 'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825',
  42758. 'dev_requirement' => false,
  42759. ),
  42760. 'symfony/polyfill-php73' => array(
  42761. 'pretty_version' => 'v1.25.0',
  42762. 'version' => '1.25.0.0',
  42763. 'type' => 'library',
  42764. 'install_path' => __DIR__ . '/../symfony/polyfill-php73',
  42765. 'aliases' => array(),
  42766. 'reference' => 'cc5db0e22b3cb4111010e48785a97f670b350ca5',
  42767. 'dev_requirement' => false,
  42768. ),
  42769. 'symfony/polyfill-php80' => array(
  42770. 'pretty_version' => 'v1.25.0',
  42771. 'version' => '1.25.0.0',
  42772. 'type' => 'library',
  42773. 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
  42774. 'aliases' => array(),
  42775. 'reference' => '4407588e0d3f1f52efb65fbe92babe41f37fe50c',
  42776. 'dev_requirement' => false,
  42777. ),
  42778. 'symfony/process' => array(
  42779. 'pretty_version' => 'v5.4.5',
  42780. 'version' => '5.4.5.0',
  42781. 'type' => 'library',
  42782. 'install_path' => __DIR__ . '/../symfony/process',
  42783. 'aliases' => array(),
  42784. 'reference' => '95440409896f90a5f85db07a32b517ecec17fa4c',
  42785. 'dev_requirement' => false,
  42786. ),
  42787. 'symfony/service-contracts' => array(
  42788. 'pretty_version' => 'v2.5.0',
  42789. 'version' => '2.5.0.0',
  42790. 'type' => 'library',
  42791. 'install_path' => __DIR__ . '/../symfony/service-contracts',
  42792. 'aliases' => array(),
  42793. 'reference' => '1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc',
  42794. 'dev_requirement' => false,
  42795. ),
  42796. 'symfony/string' => array(
  42797. 'pretty_version' => 'v5.4.3',
  42798. 'version' => '5.4.3.0',
  42799. 'type' => 'library',
  42800. 'install_path' => __DIR__ . '/../symfony/string',
  42801. 'aliases' => array(),
  42802. 'reference' => '92043b7d8383e48104e411bc9434b260dbeb5a10',
  42803. 'dev_requirement' => false,
  42804. ),
  42805. ),
  42806. );
  42807. Copyright (C) 2021 Composer
  42808. Permission is hereby granted, free of charge, to any person obtaining a copy of
  42809. this software and associated documentation files (the "Software"), to deal in
  42810. the Software without restriction, including without limitation the rights to
  42811. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  42812. of the Software, and to permit persons to whom the Software is furnished to do
  42813. so, subject to the following conditions:
  42814. The above copyright notice and this permission notice shall be included in all
  42815. copies or substantial portions of the Software.
  42816. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42817. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42818. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42819. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42820. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42821. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  42822. SOFTWARE.
  42823. <?php
  42824. namespace Composer\MetadataMinifier;
  42825. class MetadataMinifier
  42826. {
  42827. public static function expand(array $versions)
  42828. {
  42829. $expanded = array();
  42830. $expandedVersion = null;
  42831. foreach ($versions as $versionData) {
  42832. if (!$expandedVersion) {
  42833. $expandedVersion = $versionData;
  42834. $expanded[] = $expandedVersion;
  42835. continue;
  42836. }
  42837. foreach ($versionData as $key => $val) {
  42838. if ($val === '__unset') {
  42839. unset($expandedVersion[$key]);
  42840. } else {
  42841. $expandedVersion[$key] = $val;
  42842. }
  42843. }
  42844. $expanded[] = $expandedVersion;
  42845. }
  42846. return $expanded;
  42847. }
  42848. public static function minify(array $versions)
  42849. {
  42850. $minifiedVersions = array();
  42851. $lastKnownVersionData = null;
  42852. foreach ($versions as $version) {
  42853. if (!$lastKnownVersionData) {
  42854. $lastKnownVersionData = $version;
  42855. $minifiedVersions[] = $version;
  42856. continue;
  42857. }
  42858. $minifiedVersion = array();
  42859. foreach ($version as $key => $val) {
  42860. if (!isset($lastKnownVersionData[$key]) || $lastKnownVersionData[$key] !== $val) {
  42861. $minifiedVersion[$key] = $val;
  42862. $lastKnownVersionData[$key] = $val;
  42863. }
  42864. }
  42865. foreach ($lastKnownVersionData as $key => $val) {
  42866. if (!isset($version[$key])) {
  42867. $minifiedVersion[$key] = "__unset";
  42868. unset($lastKnownVersionData[$key]);
  42869. }
  42870. }
  42871. $minifiedVersions[] = $minifiedVersion;
  42872. }
  42873. return $minifiedVersions;
  42874. }
  42875. }
  42876. Copyright (C) 2021 Composer
  42877. Permission is hereby granted, free of charge, to any person obtaining a copy of
  42878. this software and associated documentation files (the "Software"), to deal in
  42879. the Software without restriction, including without limitation the rights to
  42880. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  42881. of the Software, and to permit persons to whom the Software is furnished to do
  42882. so, subject to the following conditions:
  42883. The above copyright notice and this permission notice shall be included in all
  42884. copies or substantial portions of the Software.
  42885. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42886. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42887. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42888. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42889. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42890. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  42891. SOFTWARE.
  42892. <?php
  42893. namespace Composer\Pcre;
  42894. final class MatchAllResult
  42895. {
  42896. public $matches;
  42897. public $count;
  42898. public $matched;
  42899. public function __construct($count, array $matches)
  42900. {
  42901. $this->matches = $matches;
  42902. $this->matched = (bool) $count;
  42903. $this->count = $count;
  42904. }
  42905. }
  42906. <?php
  42907. namespace Composer\Pcre;
  42908. final class MatchAllWithOffsetsResult
  42909. {
  42910. public $matches;
  42911. public $count;
  42912. public $matched;
  42913. public function __construct($count, array $matches)
  42914. {
  42915. $this->matches = $matches;
  42916. $this->matched = (bool) $count;
  42917. $this->count = $count;
  42918. }
  42919. }
  42920. <?php
  42921. namespace Composer\Pcre;
  42922. final class MatchResult
  42923. {
  42924. public $matches;
  42925. public $matched;
  42926. public function __construct($count, array $matches)
  42927. {
  42928. $this->matches = $matches;
  42929. $this->matched = (bool) $count;
  42930. }
  42931. }
  42932. <?php
  42933. namespace Composer\Pcre;
  42934. final class MatchWithOffsetsResult
  42935. {
  42936. public $matches;
  42937. public $matched;
  42938. public function __construct($count, array $matches)
  42939. {
  42940. $this->matches = $matches;
  42941. $this->matched = (bool) $count;
  42942. }
  42943. }
  42944. <?php
  42945. namespace Composer\Pcre;
  42946. class PcreException extends \RuntimeException
  42947. {
  42948. public static function fromFunction($function, $pattern)
  42949. {
  42950. $code = preg_last_error();
  42951. if (is_array($pattern)) {
  42952. $pattern = implode(', ', $pattern);
  42953. }
  42954. return new PcreException($function.'(): failed executing "'.$pattern.'": '.self::pcreLastErrorMessage($code), $code);
  42955. }
  42956. private static function pcreLastErrorMessage($code)
  42957. {
  42958. if (function_exists('preg_last_error_msg')) {
  42959. return preg_last_error_msg();
  42960. }
  42961. if (PHP_VERSION_ID < 70201 && $code === 0) {
  42962. return 'UNDEFINED_ERROR';
  42963. }
  42964. $constants = get_defined_constants(true);
  42965. if (!isset($constants['pcre'])) {
  42966. return 'UNDEFINED_ERROR';
  42967. }
  42968. foreach ($constants['pcre'] as $const => $val) {
  42969. if ($val === $code && substr($const, -6) === '_ERROR') {
  42970. return $const;
  42971. }
  42972. }
  42973. return 'UNDEFINED_ERROR';
  42974. }
  42975. }
  42976. <?php
  42977. namespace Composer\Pcre;
  42978. class Preg
  42979. {
  42980. public const ARRAY_MSG = '$subject as an array is not supported. You can use \'foreach\' instead.';
  42981. public const INVALID_TYPE_MSG = '$subject must be a string, %s given.';
  42982. public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  42983. {
  42984. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  42985. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use matchWithOffsets() instead');
  42986. }
  42987. $result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
  42988. if ($result === false) {
  42989. throw PcreException::fromFunction('preg_match', $pattern);
  42990. }
  42991. return $result;
  42992. }
  42993. public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
  42994. {
  42995. $result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
  42996. if ($result === false) {
  42997. throw PcreException::fromFunction('preg_match', $pattern);
  42998. }
  42999. return $result;
  43000. }
  43001. public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  43002. {
  43003. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  43004. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use matchAllWithOffsets() instead');
  43005. }
  43006. if (($flags & PREG_SET_ORDER) !== 0) {
  43007. throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the type of $matches');
  43008. }
  43009. $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
  43010. if ($result === false || $result === null) {
  43011. throw PcreException::fromFunction('preg_match_all', $pattern);
  43012. }
  43013. return $result;
  43014. }
  43015. public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
  43016. {
  43017. $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
  43018. if ($result === false || $result === null) {
  43019. throw PcreException::fromFunction('preg_match_all', $pattern);
  43020. }
  43021. return $result;
  43022. }
  43023. public static function replace($pattern, $replacement, $subject, int $limit = -1, int &$count = null): string
  43024. {
  43025. if (!is_scalar($subject)) {
  43026. if (is_array($subject)) {
  43027. throw new \InvalidArgumentException(static::ARRAY_MSG);
  43028. }
  43029. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  43030. }
  43031. $result = preg_replace($pattern, $replacement, $subject, $limit, $count);
  43032. if ($result === null) {
  43033. throw PcreException::fromFunction('preg_replace', $pattern);
  43034. }
  43035. return $result;
  43036. }
  43037. public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
  43038. {
  43039. if (!is_scalar($subject)) {
  43040. if (is_array($subject)) {
  43041. throw new \InvalidArgumentException(static::ARRAY_MSG);
  43042. }
  43043. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  43044. }
  43045. if (PHP_VERSION_ID >= 70400) {
  43046. $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count, $flags);
  43047. } else {
  43048. $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count);
  43049. }
  43050. if ($result === null) {
  43051. throw PcreException::fromFunction('preg_replace_callback', $pattern);
  43052. }
  43053. return $result;
  43054. }
  43055. public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int &$count = null, int $flags = 0): string
  43056. {
  43057. if (!is_scalar($subject)) {
  43058. if (is_array($subject)) {
  43059. throw new \InvalidArgumentException(static::ARRAY_MSG);
  43060. }
  43061. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  43062. }
  43063. if (PHP_VERSION_ID >= 70400) {
  43064. $result = preg_replace_callback_array($pattern, $subject, $limit, $count, $flags);
  43065. } else {
  43066. $result = preg_replace_callback_array($pattern, $subject, $limit, $count);
  43067. }
  43068. if ($result === null) {
  43069. $pattern = array_keys($pattern);
  43070. throw PcreException::fromFunction('preg_replace_callback_array', $pattern);
  43071. }
  43072. return $result;
  43073. }
  43074. public static function split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
  43075. {
  43076. if (($flags & PREG_SPLIT_OFFSET_CAPTURE) !== 0) {
  43077. throw new \InvalidArgumentException('PREG_SPLIT_OFFSET_CAPTURE is not supported as it changes the type of $matches, use splitWithOffsets() instead');
  43078. }
  43079. $result = preg_split($pattern, $subject, $limit, $flags);
  43080. if ($result === false) {
  43081. throw PcreException::fromFunction('preg_split', $pattern);
  43082. }
  43083. return $result;
  43084. }
  43085. public static function splitWithOffsets(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
  43086. {
  43087. $result = preg_split($pattern, $subject, $limit, $flags | PREG_SPLIT_OFFSET_CAPTURE);
  43088. if ($result === false) {
  43089. throw PcreException::fromFunction('preg_split', $pattern);
  43090. }
  43091. return $result;
  43092. }
  43093. public static function grep(string $pattern, array $array, int $flags = 0): array
  43094. {
  43095. $result = preg_grep($pattern, $array, $flags);
  43096. if ($result === false) {
  43097. throw PcreException::fromFunction('preg_grep', $pattern);
  43098. }
  43099. return $result;
  43100. }
  43101. public static function isMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  43102. {
  43103. return (bool) static::match($pattern, $subject, $matches, $flags, $offset);
  43104. }
  43105. public static function isMatchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  43106. {
  43107. return (bool) static::matchAll($pattern, $subject, $matches, $flags, $offset);
  43108. }
  43109. public static function isMatchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
  43110. {
  43111. return (bool) static::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
  43112. }
  43113. public static function isMatchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
  43114. {
  43115. return (bool) static::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
  43116. }
  43117. }
  43118. <?php
  43119. namespace Composer\Pcre;
  43120. class Regex
  43121. {
  43122. public static function isMatch(string $pattern, string $subject, int $offset = 0): bool
  43123. {
  43124. return (bool) Preg::match($pattern, $subject, $matches, 0, $offset);
  43125. }
  43126. public static function match(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchResult
  43127. {
  43128. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  43129. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use matchWithOffsets() instead');
  43130. }
  43131. $count = Preg::match($pattern, $subject, $matches, $flags, $offset);
  43132. return new MatchResult($count, $matches);
  43133. }
  43134. public static function matchWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchWithOffsetsResult
  43135. {
  43136. $count = Preg::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
  43137. return new MatchWithOffsetsResult($count, $matches);
  43138. }
  43139. public static function matchAll(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllResult
  43140. {
  43141. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  43142. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use matchAllWithOffsets() instead');
  43143. }
  43144. if (($flags & PREG_SET_ORDER) !== 0) {
  43145. throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the return type');
  43146. }
  43147. $count = Preg::matchAll($pattern, $subject, $matches, $flags, $offset);
  43148. return new MatchAllResult($count, $matches);
  43149. }
  43150. public static function matchAllWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllWithOffsetsResult
  43151. {
  43152. $count = Preg::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
  43153. return new MatchAllWithOffsetsResult($count, $matches);
  43154. }
  43155. public static function replace($pattern, $replacement, $subject, int $limit = -1): ReplaceResult
  43156. {
  43157. $result = Preg::replace($pattern, $replacement, $subject, $limit, $count);
  43158. return new ReplaceResult($count, $result);
  43159. }
  43160. public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0): ReplaceResult
  43161. {
  43162. $result = Preg::replaceCallback($pattern, $replacement, $subject, $limit, $count, $flags);
  43163. return new ReplaceResult($count, $result);
  43164. }
  43165. public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int $flags = 0): ReplaceResult
  43166. {
  43167. $result = Preg::replaceCallbackArray($pattern, $subject, $limit, $count, $flags);
  43168. return new ReplaceResult($count, $result);
  43169. }
  43170. }
  43171. <?php
  43172. namespace Composer\Pcre;
  43173. final class ReplaceResult
  43174. {
  43175. public $result;
  43176. public $count;
  43177. public $matched;
  43178. public function __construct($count, $result)
  43179. {
  43180. $this->count = $count;
  43181. $this->matched = (bool) $count;
  43182. $this->result = $result;
  43183. }
  43184. }
  43185. Copyright (C) 2015 Composer
  43186. Permission is hereby granted, free of charge, to any person obtaining a copy of
  43187. this software and associated documentation files (the "Software"), to deal in
  43188. the Software without restriction, including without limitation the rights to
  43189. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  43190. of the Software, and to permit persons to whom the Software is furnished to do
  43191. so, subject to the following conditions:
  43192. The above copyright notice and this permission notice shall be included in all
  43193. copies or substantial portions of the Software.
  43194. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43195. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43196. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43197. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43198. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43199. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  43200. SOFTWARE.
  43201. <?php
  43202. namespace Composer\Semver;
  43203. use Composer\Semver\Constraint\Constraint;
  43204. class Comparator
  43205. {
  43206. public static function greaterThan($version1, $version2)
  43207. {
  43208. return self::compare($version1, '>', $version2);
  43209. }
  43210. public static function greaterThanOrEqualTo($version1, $version2)
  43211. {
  43212. return self::compare($version1, '>=', $version2);
  43213. }
  43214. public static function lessThan($version1, $version2)
  43215. {
  43216. return self::compare($version1, '<', $version2);
  43217. }
  43218. public static function lessThanOrEqualTo($version1, $version2)
  43219. {
  43220. return self::compare($version1, '<=', $version2);
  43221. }
  43222. public static function equalTo($version1, $version2)
  43223. {
  43224. return self::compare($version1, '==', $version2);
  43225. }
  43226. public static function notEqualTo($version1, $version2)
  43227. {
  43228. return self::compare($version1, '!=', $version2);
  43229. }
  43230. public static function compare($version1, $operator, $version2)
  43231. {
  43232. $constraint = new Constraint($operator, $version2);
  43233. return $constraint->matchSpecific(new Constraint('==', $version1), true);
  43234. }
  43235. }
  43236. <?php
  43237. namespace Composer\Semver;
  43238. use Composer\Semver\Constraint\Constraint;
  43239. use Composer\Semver\Constraint\ConstraintInterface;
  43240. class CompilingMatcher
  43241. {
  43242. private static $compiledCheckerCache = array();
  43243. private static $resultCache = array();
  43244. private static $enabled;
  43245. private static $transOpInt = array(
  43246. Constraint::OP_EQ => Constraint::STR_OP_EQ,
  43247. Constraint::OP_LT => Constraint::STR_OP_LT,
  43248. Constraint::OP_LE => Constraint::STR_OP_LE,
  43249. Constraint::OP_GT => Constraint::STR_OP_GT,
  43250. Constraint::OP_GE => Constraint::STR_OP_GE,
  43251. Constraint::OP_NE => Constraint::STR_OP_NE,
  43252. );
  43253. public static function clear()
  43254. {
  43255. self::$resultCache = array();
  43256. self::$compiledCheckerCache = array();
  43257. }
  43258. public static function match(ConstraintInterface $constraint, $operator, $version)
  43259. {
  43260. $resultCacheKey = $operator.$constraint.';'.$version;
  43261. if (isset(self::$resultCache[$resultCacheKey])) {
  43262. return self::$resultCache[$resultCacheKey];
  43263. }
  43264. if (self::$enabled === null) {
  43265. self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true);
  43266. }
  43267. if (!self::$enabled) {
  43268. return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version));
  43269. }
  43270. $cacheKey = $operator.$constraint;
  43271. if (!isset(self::$compiledCheckerCache[$cacheKey])) {
  43272. $code = $constraint->compile($operator);
  43273. self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};');
  43274. } else {
  43275. $function = self::$compiledCheckerCache[$cacheKey];
  43276. }
  43277. return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0);
  43278. }
  43279. }
  43280. <?php
  43281. namespace Composer\Semver\Constraint;
  43282. class Bound
  43283. {
  43284. private $version;
  43285. private $isInclusive;
  43286. public function __construct($version, $isInclusive)
  43287. {
  43288. $this->version = $version;
  43289. $this->isInclusive = $isInclusive;
  43290. }
  43291. public function getVersion()
  43292. {
  43293. return $this->version;
  43294. }
  43295. public function isInclusive()
  43296. {
  43297. return $this->isInclusive;
  43298. }
  43299. public function isZero()
  43300. {
  43301. return $this->getVersion() === '0.0.0.0-dev' && $this->isInclusive();
  43302. }
  43303. public function isPositiveInfinity()
  43304. {
  43305. return $this->getVersion() === PHP_INT_MAX.'.0.0.0' && !$this->isInclusive();
  43306. }
  43307. public function compareTo(Bound $other, $operator)
  43308. {
  43309. if (!\in_array($operator, array('<', '>'), true)) {
  43310. throw new \InvalidArgumentException('Does not support any other operator other than > or <.');
  43311. }
  43312. if ($this == $other) {
  43313. return false;
  43314. }
  43315. $compareResult = version_compare($this->getVersion(), $other->getVersion());
  43316. if (0 !== $compareResult) {
  43317. return (('>' === $operator) ? 1 : -1) === $compareResult;
  43318. }
  43319. return '>' === $operator ? $other->isInclusive() : !$other->isInclusive();
  43320. }
  43321. public function __toString()
  43322. {
  43323. return sprintf(
  43324. '%s [%s]',
  43325. $this->getVersion(),
  43326. $this->isInclusive() ? 'inclusive' : 'exclusive'
  43327. );
  43328. }
  43329. public static function zero()
  43330. {
  43331. return new Bound('0.0.0.0-dev', true);
  43332. }
  43333. public static function positiveInfinity()
  43334. {
  43335. return new Bound(PHP_INT_MAX.'.0.0.0', false);
  43336. }
  43337. }
  43338. <?php
  43339. namespace Composer\Semver\Constraint;
  43340. class Constraint implements ConstraintInterface
  43341. {
  43342. const OP_EQ = 0;
  43343. const OP_LT = 1;
  43344. const OP_LE = 2;
  43345. const OP_GT = 3;
  43346. const OP_GE = 4;
  43347. const OP_NE = 5;
  43348. const STR_OP_EQ = '==';
  43349. const STR_OP_EQ_ALT = '=';
  43350. const STR_OP_LT = '<';
  43351. const STR_OP_LE = '<=';
  43352. const STR_OP_GT = '>';
  43353. const STR_OP_GE = '>=';
  43354. const STR_OP_NE = '!=';
  43355. const STR_OP_NE_ALT = '<>';
  43356. private static $transOpStr = array(
  43357. '=' => self::OP_EQ,
  43358. '==' => self::OP_EQ,
  43359. '<' => self::OP_LT,
  43360. '<=' => self::OP_LE,
  43361. '>' => self::OP_GT,
  43362. '>=' => self::OP_GE,
  43363. '<>' => self::OP_NE,
  43364. '!=' => self::OP_NE,
  43365. );
  43366. private static $transOpInt = array(
  43367. self::OP_EQ => '==',
  43368. self::OP_LT => '<',
  43369. self::OP_LE => '<=',
  43370. self::OP_GT => '>',
  43371. self::OP_GE => '>=',
  43372. self::OP_NE => '!=',
  43373. );
  43374. protected $operator;
  43375. protected $version;
  43376. protected $prettyString;
  43377. protected $lowerBound;
  43378. protected $upperBound;
  43379. public function __construct($operator, $version)
  43380. {
  43381. if (!isset(self::$transOpStr[$operator])) {
  43382. throw new \InvalidArgumentException(sprintf(
  43383. 'Invalid operator "%s" given, expected one of: %s',
  43384. $operator,
  43385. implode(', ', self::getSupportedOperators())
  43386. ));
  43387. }
  43388. $this->operator = self::$transOpStr[$operator];
  43389. $this->version = $version;
  43390. }
  43391. public function getVersion()
  43392. {
  43393. return $this->version;
  43394. }
  43395. public function getOperator()
  43396. {
  43397. return self::$transOpInt[$this->operator];
  43398. }
  43399. public function matches(ConstraintInterface $provider)
  43400. {
  43401. if ($provider instanceof self) {
  43402. return $this->matchSpecific($provider);
  43403. }
  43404. return $provider->matches($this);
  43405. }
  43406. public function setPrettyString($prettyString)
  43407. {
  43408. $this->prettyString = $prettyString;
  43409. }
  43410. public function getPrettyString()
  43411. {
  43412. if ($this->prettyString) {
  43413. return $this->prettyString;
  43414. }
  43415. return $this->__toString();
  43416. }
  43417. public static function getSupportedOperators()
  43418. {
  43419. return array_keys(self::$transOpStr);
  43420. }
  43421. public static function getOperatorConstant($operator)
  43422. {
  43423. return self::$transOpStr[$operator];
  43424. }
  43425. public function versionCompare($a, $b, $operator, $compareBranches = false)
  43426. {
  43427. if (!isset(self::$transOpStr[$operator])) {
  43428. throw new \InvalidArgumentException(sprintf(
  43429. 'Invalid operator "%s" given, expected one of: %s',
  43430. $operator,
  43431. implode(', ', self::getSupportedOperators())
  43432. ));
  43433. }
  43434. $aIsBranch = strpos($a, 'dev-') === 0;
  43435. $bIsBranch = strpos($b, 'dev-') === 0;
  43436. if ($operator === '!=' && ($aIsBranch || $bIsBranch)) {
  43437. return $a !== $b;
  43438. }
  43439. if ($aIsBranch && $bIsBranch) {
  43440. return $operator === '==' && $a === $b;
  43441. }
  43442. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  43443. return false;
  43444. }
  43445. return \version_compare($a, $b, $operator);
  43446. }
  43447. public function compile($otherOperator)
  43448. {
  43449. if (strpos($this->version, 'dev-') === 0) {
  43450. if (self::OP_EQ === $this->operator) {
  43451. if (self::OP_EQ === $otherOperator) {
  43452. return sprintf('$b && $v === %s', \var_export($this->version, true));
  43453. }
  43454. if (self::OP_NE === $otherOperator) {
  43455. return sprintf('!$b || $v !== %s', \var_export($this->version, true));
  43456. }
  43457. return 'false';
  43458. }
  43459. if (self::OP_NE === $this->operator) {
  43460. if (self::OP_EQ === $otherOperator) {
  43461. return sprintf('!$b || $v !== %s', \var_export($this->version, true));
  43462. }
  43463. if (self::OP_NE === $otherOperator) {
  43464. return 'true';
  43465. }
  43466. return '!$b';
  43467. }
  43468. return 'false';
  43469. }
  43470. if (self::OP_EQ === $this->operator) {
  43471. if (self::OP_EQ === $otherOperator) {
  43472. return sprintf('\version_compare($v, %s, \'==\')', \var_export($this->version, true));
  43473. }
  43474. if (self::OP_NE === $otherOperator) {
  43475. return sprintf('$b || \version_compare($v, %s, \'!=\')', \var_export($this->version, true));
  43476. }
  43477. return sprintf('!$b && \version_compare(%s, $v, \'%s\')', \var_export($this->version, true), self::$transOpInt[$otherOperator]);
  43478. }
  43479. if (self::OP_NE === $this->operator) {
  43480. if (self::OP_EQ === $otherOperator) {
  43481. return sprintf('$b || (!$b && \version_compare($v, %s, \'!=\'))', \var_export($this->version, true));
  43482. }
  43483. if (self::OP_NE === $otherOperator) {
  43484. return 'true';
  43485. }
  43486. return '!$b';
  43487. }
  43488. if (self::OP_LT === $this->operator || self::OP_LE === $this->operator) {
  43489. if (self::OP_LT === $otherOperator || self::OP_LE === $otherOperator) {
  43490. return '!$b';
  43491. }
  43492. } else {
  43493. if (self::OP_GT === $otherOperator || self::OP_GE === $otherOperator) {
  43494. return '!$b';
  43495. }
  43496. }
  43497. if (self::OP_NE === $otherOperator) {
  43498. return 'true';
  43499. }
  43500. $codeComparison = sprintf('\version_compare($v, %s, \'%s\')', \var_export($this->version, true), self::$transOpInt[$this->operator]);
  43501. if ($this->operator === self::OP_LE) {
  43502. if ($otherOperator === self::OP_GT) {
  43503. return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
  43504. }
  43505. } elseif ($this->operator === self::OP_GE) {
  43506. if ($otherOperator === self::OP_LT) {
  43507. return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
  43508. }
  43509. }
  43510. return sprintf('!$b && %s', $codeComparison);
  43511. }
  43512. public function matchSpecific(Constraint $provider, $compareBranches = false)
  43513. {
  43514. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  43515. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  43516. $isEqualOp = self::OP_EQ === $this->operator;
  43517. $isNonEqualOp = self::OP_NE === $this->operator;
  43518. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  43519. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  43520. if ($isNonEqualOp || $isProviderNonEqualOp) {
  43521. if ($isNonEqualOp && !$isProviderNonEqualOp && !$isProviderEqualOp && strpos($provider->version, 'dev-') === 0) {
  43522. return false;
  43523. }
  43524. if ($isProviderNonEqualOp && !$isNonEqualOp && !$isEqualOp && strpos($this->version, 'dev-') === 0) {
  43525. return false;
  43526. }
  43527. if (!$isEqualOp && !$isProviderEqualOp) {
  43528. return true;
  43529. }
  43530. return $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  43531. }
  43532. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  43533. return !(strpos($this->version, 'dev-') === 0 || strpos($provider->version, 'dev-') === 0);
  43534. }
  43535. $version1 = $isEqualOp ? $this->version : $provider->version;
  43536. $version2 = $isEqualOp ? $provider->version : $this->version;
  43537. $operator = $isEqualOp ? $provider->operator : $this->operator;
  43538. if ($this->versionCompare($version1, $version2, self::$transOpInt[$operator], $compareBranches)) {
  43539. return !(self::$transOpInt[$provider->operator] === $providerNoEqualOp
  43540. && self::$transOpInt[$this->operator] !== $noEqualOp
  43541. && \version_compare($provider->version, $this->version, '=='));
  43542. }
  43543. return false;
  43544. }
  43545. public function __toString()
  43546. {
  43547. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  43548. }
  43549. public function getLowerBound()
  43550. {
  43551. $this->extractBounds();
  43552. return $this->lowerBound;
  43553. }
  43554. public function getUpperBound()
  43555. {
  43556. $this->extractBounds();
  43557. return $this->upperBound;
  43558. }
  43559. private function extractBounds()
  43560. {
  43561. if (null !== $this->lowerBound) {
  43562. return;
  43563. }
  43564. if (strpos($this->version, 'dev-') === 0) {
  43565. $this->lowerBound = Bound::zero();
  43566. $this->upperBound = Bound::positiveInfinity();
  43567. return;
  43568. }
  43569. switch ($this->operator) {
  43570. case self::OP_EQ:
  43571. $this->lowerBound = new Bound($this->version, true);
  43572. $this->upperBound = new Bound($this->version, true);
  43573. break;
  43574. case self::OP_LT:
  43575. $this->lowerBound = Bound::zero();
  43576. $this->upperBound = new Bound($this->version, false);
  43577. break;
  43578. case self::OP_LE:
  43579. $this->lowerBound = Bound::zero();
  43580. $this->upperBound = new Bound($this->version, true);
  43581. break;
  43582. case self::OP_GT:
  43583. $this->lowerBound = new Bound($this->version, false);
  43584. $this->upperBound = Bound::positiveInfinity();
  43585. break;
  43586. case self::OP_GE:
  43587. $this->lowerBound = new Bound($this->version, true);
  43588. $this->upperBound = Bound::positiveInfinity();
  43589. break;
  43590. case self::OP_NE:
  43591. $this->lowerBound = Bound::zero();
  43592. $this->upperBound = Bound::positiveInfinity();
  43593. break;
  43594. }
  43595. }
  43596. }
  43597. <?php
  43598. namespace Composer\Semver\Constraint;
  43599. interface ConstraintInterface
  43600. {
  43601. public function matches(ConstraintInterface $provider);
  43602. public function compile($otherOperator);
  43603. public function getUpperBound();
  43604. public function getLowerBound();
  43605. public function getPrettyString();
  43606. public function setPrettyString($prettyString);
  43607. public function __toString();
  43608. }
  43609. <?php
  43610. namespace Composer\Semver\Constraint;
  43611. class MatchAllConstraint implements ConstraintInterface
  43612. {
  43613. protected $prettyString;
  43614. public function matches(ConstraintInterface $provider)
  43615. {
  43616. return true;
  43617. }
  43618. public function compile($otherOperator)
  43619. {
  43620. return 'true';
  43621. }
  43622. public function setPrettyString($prettyString)
  43623. {
  43624. $this->prettyString = $prettyString;
  43625. }
  43626. public function getPrettyString()
  43627. {
  43628. if ($this->prettyString) {
  43629. return $this->prettyString;
  43630. }
  43631. return (string) $this;
  43632. }
  43633. public function __toString()
  43634. {
  43635. return '*';
  43636. }
  43637. public function getUpperBound()
  43638. {
  43639. return Bound::positiveInfinity();
  43640. }
  43641. public function getLowerBound()
  43642. {
  43643. return Bound::zero();
  43644. }
  43645. }
  43646. <?php
  43647. namespace Composer\Semver\Constraint;
  43648. class MatchNoneConstraint implements ConstraintInterface
  43649. {
  43650. protected $prettyString;
  43651. public function matches(ConstraintInterface $provider)
  43652. {
  43653. return false;
  43654. }
  43655. public function compile($otherOperator)
  43656. {
  43657. return 'false';
  43658. }
  43659. public function setPrettyString($prettyString)
  43660. {
  43661. $this->prettyString = $prettyString;
  43662. }
  43663. public function getPrettyString()
  43664. {
  43665. if ($this->prettyString) {
  43666. return $this->prettyString;
  43667. }
  43668. return (string) $this;
  43669. }
  43670. public function __toString()
  43671. {
  43672. return '[]';
  43673. }
  43674. public function getUpperBound()
  43675. {
  43676. return new Bound('0.0.0.0-dev', false);
  43677. }
  43678. public function getLowerBound()
  43679. {
  43680. return new Bound('0.0.0.0-dev', false);
  43681. }
  43682. }
  43683. <?php
  43684. namespace Composer\Semver\Constraint;
  43685. class MultiConstraint implements ConstraintInterface
  43686. {
  43687. protected $constraints;
  43688. protected $prettyString;
  43689. protected $string;
  43690. protected $conjunctive;
  43691. protected $lowerBound;
  43692. protected $upperBound;
  43693. public function __construct(array $constraints, $conjunctive = true)
  43694. {
  43695. if (\count($constraints) < 2) {
  43696. throw new \InvalidArgumentException(
  43697. 'Must provide at least two constraints for a MultiConstraint. Use '.
  43698. 'the regular Constraint class for one constraint only or MatchAllConstraint for none. You may use '.
  43699. 'MultiConstraint::create() which optimizes and handles those cases automatically.'
  43700. );
  43701. }
  43702. $this->constraints = $constraints;
  43703. $this->conjunctive = $conjunctive;
  43704. }
  43705. public function getConstraints()
  43706. {
  43707. return $this->constraints;
  43708. }
  43709. public function isConjunctive()
  43710. {
  43711. return $this->conjunctive;
  43712. }
  43713. public function isDisjunctive()
  43714. {
  43715. return !$this->conjunctive;
  43716. }
  43717. public function compile($otherOperator)
  43718. {
  43719. $parts = array();
  43720. foreach ($this->constraints as $constraint) {
  43721. $code = $constraint->compile($otherOperator);
  43722. if ($code === 'true') {
  43723. if (!$this->conjunctive) {
  43724. return 'true';
  43725. }
  43726. } elseif ($code === 'false') {
  43727. if ($this->conjunctive) {
  43728. return 'false';
  43729. }
  43730. } else {
  43731. $parts[] = '('.$code.')';
  43732. }
  43733. }
  43734. if (!$parts) {
  43735. return $this->conjunctive ? 'true' : 'false';
  43736. }
  43737. return $this->conjunctive ? implode('&&', $parts) : implode('||', $parts);
  43738. }
  43739. public function matches(ConstraintInterface $provider)
  43740. {
  43741. if (false === $this->conjunctive) {
  43742. foreach ($this->constraints as $constraint) {
  43743. if ($provider->matches($constraint)) {
  43744. return true;
  43745. }
  43746. }
  43747. return false;
  43748. }
  43749. if ($provider instanceof MultiConstraint && $provider->isDisjunctive()) {
  43750. return $provider->matches($this);
  43751. }
  43752. foreach ($this->constraints as $constraint) {
  43753. if (!$provider->matches($constraint)) {
  43754. return false;
  43755. }
  43756. }
  43757. return true;
  43758. }
  43759. public function setPrettyString($prettyString)
  43760. {
  43761. $this->prettyString = $prettyString;
  43762. }
  43763. public function getPrettyString()
  43764. {
  43765. if ($this->prettyString) {
  43766. return $this->prettyString;
  43767. }
  43768. return (string) $this;
  43769. }
  43770. public function __toString()
  43771. {
  43772. if ($this->string !== null) {
  43773. return $this->string;
  43774. }
  43775. $constraints = array();
  43776. foreach ($this->constraints as $constraint) {
  43777. $constraints[] = (string) $constraint;
  43778. }
  43779. return $this->string = '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  43780. }
  43781. public function getLowerBound()
  43782. {
  43783. $this->extractBounds();
  43784. if (null === $this->lowerBound) {
  43785. throw new \LogicException('extractBounds should have populated the lowerBound property');
  43786. }
  43787. return $this->lowerBound;
  43788. }
  43789. public function getUpperBound()
  43790. {
  43791. $this->extractBounds();
  43792. if (null === $this->upperBound) {
  43793. throw new \LogicException('extractBounds should have populated the upperBound property');
  43794. }
  43795. return $this->upperBound;
  43796. }
  43797. public static function create(array $constraints, $conjunctive = true)
  43798. {
  43799. if (0 === \count($constraints)) {
  43800. return new MatchAllConstraint();
  43801. }
  43802. if (1 === \count($constraints)) {
  43803. return $constraints[0];
  43804. }
  43805. $optimized = self::optimizeConstraints($constraints, $conjunctive);
  43806. if ($optimized !== null) {
  43807. list($constraints, $conjunctive) = $optimized;
  43808. if (\count($constraints) === 1) {
  43809. return $constraints[0];
  43810. }
  43811. }
  43812. return new self($constraints, $conjunctive);
  43813. }
  43814. private static function optimizeConstraints(array $constraints, $conjunctive)
  43815. {
  43816. if (!$conjunctive) {
  43817. $left = $constraints[0];
  43818. $mergedConstraints = array();
  43819. $optimized = false;
  43820. for ($i = 1, $l = \count($constraints); $i < $l; $i++) {
  43821. $right = $constraints[$i];
  43822. if (
  43823. $left instanceof self
  43824. && $left->conjunctive
  43825. && $right instanceof self
  43826. && $right->conjunctive
  43827. && \count($left->constraints) === 2
  43828. && \count($right->constraints) === 2
  43829. && ($left0 = (string) $left->constraints[0])
  43830. && $left0[0] === '>' && $left0[1] === '='
  43831. && ($left1 = (string) $left->constraints[1])
  43832. && $left1[0] === '<'
  43833. && ($right0 = (string) $right->constraints[0])
  43834. && $right0[0] === '>' && $right0[1] === '='
  43835. && ($right1 = (string) $right->constraints[1])
  43836. && $right1[0] === '<'
  43837. && substr($left1, 2) === substr($right0, 3)
  43838. ) {
  43839. $optimized = true;
  43840. $left = new MultiConstraint(
  43841. array(
  43842. $left->constraints[0],
  43843. $right->constraints[1],
  43844. ),
  43845. true);
  43846. } else {
  43847. $mergedConstraints[] = $left;
  43848. $left = $right;
  43849. }
  43850. }
  43851. if ($optimized) {
  43852. $mergedConstraints[] = $left;
  43853. return array($mergedConstraints, false);
  43854. }
  43855. }
  43856. return null;
  43857. }
  43858. private function extractBounds()
  43859. {
  43860. if (null !== $this->lowerBound) {
  43861. return;
  43862. }
  43863. foreach ($this->constraints as $constraint) {
  43864. if (null === $this->lowerBound || null === $this->upperBound) {
  43865. $this->lowerBound = $constraint->getLowerBound();
  43866. $this->upperBound = $constraint->getUpperBound();
  43867. continue;
  43868. }
  43869. if ($constraint->getLowerBound()->compareTo($this->lowerBound, $this->isConjunctive() ? '>' : '<')) {
  43870. $this->lowerBound = $constraint->getLowerBound();
  43871. }
  43872. if ($constraint->getUpperBound()->compareTo($this->upperBound, $this->isConjunctive() ? '<' : '>')) {
  43873. $this->upperBound = $constraint->getUpperBound();
  43874. }
  43875. }
  43876. }
  43877. }
  43878. <?php
  43879. namespace Composer\Semver;
  43880. use Composer\Semver\Constraint\Constraint;
  43881. class Interval
  43882. {
  43883. private $start;
  43884. private $end;
  43885. public function __construct(Constraint $start, Constraint $end)
  43886. {
  43887. $this->start = $start;
  43888. $this->end = $end;
  43889. }
  43890. public function getStart()
  43891. {
  43892. return $this->start;
  43893. }
  43894. public function getEnd()
  43895. {
  43896. return $this->end;
  43897. }
  43898. public static function fromZero()
  43899. {
  43900. static $zero;
  43901. if (null === $zero) {
  43902. $zero = new Constraint('>=', '0.0.0.0-dev');
  43903. }
  43904. return $zero;
  43905. }
  43906. public static function untilPositiveInfinity()
  43907. {
  43908. static $positiveInfinity;
  43909. if (null === $positiveInfinity) {
  43910. $positiveInfinity = new Constraint('<', PHP_INT_MAX.'.0.0.0');
  43911. }
  43912. return $positiveInfinity;
  43913. }
  43914. public static function any()
  43915. {
  43916. return new self(self::fromZero(), self::untilPositiveInfinity());
  43917. }
  43918. public static function anyDev()
  43919. {
  43920. return array('names' => array(), 'exclude' => true);
  43921. }
  43922. public static function noDev()
  43923. {
  43924. return array('names' => array(), 'exclude' => false);
  43925. }
  43926. }
  43927. <?php
  43928. namespace Composer\Semver;
  43929. use Composer\Semver\Constraint\Constraint;
  43930. use Composer\Semver\Constraint\ConstraintInterface;
  43931. use Composer\Semver\Constraint\MatchAllConstraint;
  43932. use Composer\Semver\Constraint\MatchNoneConstraint;
  43933. use Composer\Semver\Constraint\MultiConstraint;
  43934. class Intervals
  43935. {
  43936. private static $intervalsCache = array();
  43937. private static $opSortOrder = array(
  43938. '>=' => -3,
  43939. '<' => -2,
  43940. '>' => 2,
  43941. '<=' => 3,
  43942. );
  43943. public static function clear()
  43944. {
  43945. self::$intervalsCache = array();
  43946. }
  43947. public static function isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint)
  43948. {
  43949. if ($constraint instanceof MatchAllConstraint) {
  43950. return true;
  43951. }
  43952. if ($candidate instanceof MatchNoneConstraint || $constraint instanceof MatchNoneConstraint) {
  43953. return false;
  43954. }
  43955. $intersectionIntervals = self::get(new MultiConstraint(array($candidate, $constraint), true));
  43956. $candidateIntervals = self::get($candidate);
  43957. if (\count($intersectionIntervals['numeric']) !== \count($candidateIntervals['numeric'])) {
  43958. return false;
  43959. }
  43960. foreach ($intersectionIntervals['numeric'] as $index => $interval) {
  43961. if (!isset($candidateIntervals['numeric'][$index])) {
  43962. return false;
  43963. }
  43964. if ((string) $candidateIntervals['numeric'][$index]->getStart() !== (string) $interval->getStart()) {
  43965. return false;
  43966. }
  43967. if ((string) $candidateIntervals['numeric'][$index]->getEnd() !== (string) $interval->getEnd()) {
  43968. return false;
  43969. }
  43970. }
  43971. if ($intersectionIntervals['branches']['exclude'] !== $candidateIntervals['branches']['exclude']) {
  43972. return false;
  43973. }
  43974. if (\count($intersectionIntervals['branches']['names']) !== \count($candidateIntervals['branches']['names'])) {
  43975. return false;
  43976. }
  43977. foreach ($intersectionIntervals['branches']['names'] as $index => $name) {
  43978. if ($name !== $candidateIntervals['branches']['names'][$index]) {
  43979. return false;
  43980. }
  43981. }
  43982. return true;
  43983. }
  43984. public static function haveIntersections(ConstraintInterface $a, ConstraintInterface $b)
  43985. {
  43986. if ($a instanceof MatchAllConstraint || $b instanceof MatchAllConstraint) {
  43987. return true;
  43988. }
  43989. if ($a instanceof MatchNoneConstraint || $b instanceof MatchNoneConstraint) {
  43990. return false;
  43991. }
  43992. $intersectionIntervals = self::generateIntervals(new MultiConstraint(array($a, $b), true), true);
  43993. return \count($intersectionIntervals['numeric']) > 0 || $intersectionIntervals['branches']['exclude'] || \count($intersectionIntervals['branches']['names']) > 0;
  43994. }
  43995. public static function compactConstraint(ConstraintInterface $constraint)
  43996. {
  43997. if (!$constraint instanceof MultiConstraint) {
  43998. return $constraint;
  43999. }
  44000. $intervals = self::generateIntervals($constraint);
  44001. $constraints = array();
  44002. $hasNumericMatchAll = false;
  44003. if (\count($intervals['numeric']) === 1 && (string) $intervals['numeric'][0]->getStart() === (string) Interval::fromZero() && (string) $intervals['numeric'][0]->getEnd() === (string) Interval::untilPositiveInfinity()) {
  44004. $constraints[] = $intervals['numeric'][0]->getStart();
  44005. $hasNumericMatchAll = true;
  44006. } else {
  44007. $unEqualConstraints = array();
  44008. for ($i = 0, $count = \count($intervals['numeric']); $i < $count; $i++) {
  44009. $interval = $intervals['numeric'][$i];
  44010. if ($interval->getEnd()->getOperator() === '<' && $i+1 < $count) {
  44011. $nextInterval = $intervals['numeric'][$i+1];
  44012. if ($interval->getEnd()->getVersion() === $nextInterval->getStart()->getVersion() && $nextInterval->getStart()->getOperator() === '>') {
  44013. if (\count($unEqualConstraints) === 0 && (string) $interval->getStart() !== (string) Interval::fromZero()) {
  44014. $unEqualConstraints[] = $interval->getStart();
  44015. }
  44016. $unEqualConstraints[] = new Constraint('!=', $interval->getEnd()->getVersion());
  44017. continue;
  44018. }
  44019. }
  44020. if (\count($unEqualConstraints) > 0) {
  44021. if ((string) $interval->getEnd() !== (string) Interval::untilPositiveInfinity()) {
  44022. $unEqualConstraints[] = $interval->getEnd();
  44023. }
  44024. if (\count($unEqualConstraints) > 1) {
  44025. $constraints[] = new MultiConstraint($unEqualConstraints, true);
  44026. } else {
  44027. $constraints[] = $unEqualConstraints[0];
  44028. }
  44029. $unEqualConstraints = array();
  44030. continue;
  44031. }
  44032. if ($interval->getStart()->getVersion() === $interval->getEnd()->getVersion() && $interval->getStart()->getOperator() === '>=' && $interval->getEnd()->getOperator() === '<=') {
  44033. $constraints[] = new Constraint('==', $interval->getStart()->getVersion());
  44034. continue;
  44035. }
  44036. if ((string) $interval->getStart() === (string) Interval::fromZero()) {
  44037. $constraints[] = $interval->getEnd();
  44038. } elseif ((string) $interval->getEnd() === (string) Interval::untilPositiveInfinity()) {
  44039. $constraints[] = $interval->getStart();
  44040. } else {
  44041. $constraints[] = new MultiConstraint(array($interval->getStart(), $interval->getEnd()), true);
  44042. }
  44043. }
  44044. }
  44045. $devConstraints = array();
  44046. if (0 === \count($intervals['branches']['names'])) {
  44047. if ($intervals['branches']['exclude']) {
  44048. if ($hasNumericMatchAll) {
  44049. return new MatchAllConstraint;
  44050. }
  44051. }
  44052. } else {
  44053. foreach ($intervals['branches']['names'] as $branchName) {
  44054. if ($intervals['branches']['exclude']) {
  44055. $devConstraints[] = new Constraint('!=', $branchName);
  44056. } else {
  44057. $devConstraints[] = new Constraint('==', $branchName);
  44058. }
  44059. }
  44060. if ($intervals['branches']['exclude']) {
  44061. if (\count($constraints) > 1) {
  44062. return new MultiConstraint(array_merge(
  44063. array(new MultiConstraint($constraints, false)),
  44064. $devConstraints
  44065. ), true);
  44066. }
  44067. if (\count($constraints) === 1 && (string)$constraints[0] === (string)Interval::fromZero()) {
  44068. if (\count($devConstraints) > 1) {
  44069. return new MultiConstraint($devConstraints, true);
  44070. }
  44071. return $devConstraints[0];
  44072. }
  44073. return new MultiConstraint(array_merge($constraints, $devConstraints), true);
  44074. }
  44075. $constraints = array_merge($constraints, $devConstraints);
  44076. }
  44077. if (\count($constraints) > 1) {
  44078. return new MultiConstraint($constraints, false);
  44079. }
  44080. if (\count($constraints) === 1) {
  44081. return $constraints[0];
  44082. }
  44083. return new MatchNoneConstraint;
  44084. }
  44085. public static function get(ConstraintInterface $constraint)
  44086. {
  44087. $key = (string) $constraint;
  44088. if (!isset(self::$intervalsCache[$key])) {
  44089. self::$intervalsCache[$key] = self::generateIntervals($constraint);
  44090. }
  44091. return self::$intervalsCache[$key];
  44092. }
  44093. private static function generateIntervals(ConstraintInterface $constraint, $stopOnFirstValidInterval = false)
  44094. {
  44095. if ($constraint instanceof MatchAllConstraint) {
  44096. return array('numeric' => array(new Interval(Interval::fromZero(), Interval::untilPositiveInfinity())), 'branches' => Interval::anyDev());
  44097. }
  44098. if ($constraint instanceof MatchNoneConstraint) {
  44099. return array('numeric' => array(), 'branches' => array('names' => array(), 'exclude' => false));
  44100. }
  44101. if ($constraint instanceof Constraint) {
  44102. return self::generateSingleConstraintIntervals($constraint);
  44103. }
  44104. if (!$constraint instanceof MultiConstraint) {
  44105. throw new \UnexpectedValueException('The constraint passed in should be an MatchAllConstraint, Constraint or MultiConstraint instance, got '.\get_class($constraint).'.');
  44106. }
  44107. $constraints = $constraint->getConstraints();
  44108. $numericGroups = array();
  44109. $constraintBranches = array();
  44110. foreach ($constraints as $c) {
  44111. $res = self::get($c);
  44112. $numericGroups[] = $res['numeric'];
  44113. $constraintBranches[] = $res['branches'];
  44114. }
  44115. if ($constraint->isDisjunctive()) {
  44116. $branches = Interval::noDev();
  44117. foreach ($constraintBranches as $b) {
  44118. if ($b['exclude']) {
  44119. if ($branches['exclude']) {
  44120. $branches['names'] = array_intersect($branches['names'], $b['names']);
  44121. } else {
  44122. $branches['exclude'] = true;
  44123. $branches['names'] = array_diff($b['names'], $branches['names']);
  44124. }
  44125. } else {
  44126. if ($branches['exclude']) {
  44127. $branches['names'] = array_diff($branches['names'], $b['names']);
  44128. } else {
  44129. $branches['names'] = array_merge($branches['names'], $b['names']);
  44130. }
  44131. }
  44132. }
  44133. } else {
  44134. $branches = Interval::anyDev();
  44135. foreach ($constraintBranches as $b) {
  44136. if ($b['exclude']) {
  44137. if ($branches['exclude']) {
  44138. $branches['names'] = array_merge($branches['names'], $b['names']);
  44139. } else {
  44140. $branches['names'] = array_diff($branches['names'], $b['names']);
  44141. }
  44142. } else {
  44143. if ($branches['exclude']) {
  44144. $branches['names'] = array_diff($b['names'], $branches['names']);
  44145. $branches['exclude'] = false;
  44146. } else {
  44147. $branches['names'] = array_intersect($branches['names'], $b['names']);
  44148. }
  44149. }
  44150. }
  44151. }
  44152. $branches['names'] = array_unique($branches['names']);
  44153. if (\count($numericGroups) === 1) {
  44154. return array('numeric' => $numericGroups[0], 'branches' => $branches);
  44155. }
  44156. $borders = array();
  44157. foreach ($numericGroups as $group) {
  44158. foreach ($group as $interval) {
  44159. $borders[] = array('version' => $interval->getStart()->getVersion(), 'operator' => $interval->getStart()->getOperator(), 'side' => 'start');
  44160. $borders[] = array('version' => $interval->getEnd()->getVersion(), 'operator' => $interval->getEnd()->getOperator(), 'side' => 'end');
  44161. }
  44162. }
  44163. $opSortOrder = self::$opSortOrder;
  44164. usort($borders, function ($a, $b) use ($opSortOrder) {
  44165. $order = version_compare($a['version'], $b['version']);
  44166. if ($order === 0) {
  44167. return $opSortOrder[$a['operator']] - $opSortOrder[$b['operator']];
  44168. }
  44169. return $order;
  44170. });
  44171. $activeIntervals = 0;
  44172. $intervals = array();
  44173. $index = 0;
  44174. $activationThreshold = $constraint->isConjunctive() ? \count($numericGroups) : 1;
  44175. $start = null;
  44176. foreach ($borders as $border) {
  44177. if ($border['side'] === 'start') {
  44178. $activeIntervals++;
  44179. } else {
  44180. $activeIntervals--;
  44181. }
  44182. if (!$start && $activeIntervals >= $activationThreshold) {
  44183. $start = new Constraint($border['operator'], $border['version']);
  44184. } elseif ($start && $activeIntervals < $activationThreshold) {
  44185. if (
  44186. version_compare($start->getVersion(), $border['version'], '=')
  44187. && (
  44188. ($start->getOperator() === '>' && $border['operator'] === '<=')
  44189. || ($start->getOperator() === '>=' && $border['operator'] === '<')
  44190. )
  44191. ) {
  44192. unset($intervals[$index]);
  44193. } else {
  44194. $intervals[$index] = new Interval($start, new Constraint($border['operator'], $border['version']));
  44195. $index++;
  44196. if ($stopOnFirstValidInterval) {
  44197. break;
  44198. }
  44199. }
  44200. $start = null;
  44201. }
  44202. }
  44203. return array('numeric' => $intervals, 'branches' => $branches);
  44204. }
  44205. private static function generateSingleConstraintIntervals(Constraint $constraint)
  44206. {
  44207. $op = $constraint->getOperator();
  44208. if (strpos($constraint->getVersion(), 'dev-') === 0) {
  44209. $intervals = array();
  44210. $branches = array('names' => array(), 'exclude' => false);
  44211. if ($op === '!=') {
  44212. $intervals[] = new Interval(Interval::fromZero(), Interval::untilPositiveInfinity());
  44213. $branches = array('names' => array($constraint->getVersion()), 'exclude' => true);
  44214. } elseif ($op === '==') {
  44215. $branches['names'][] = $constraint->getVersion();
  44216. }
  44217. return array(
  44218. 'numeric' => $intervals,
  44219. 'branches' => $branches,
  44220. );
  44221. }
  44222. if ($op[0] === '>') {
  44223. return array('numeric' => array(new Interval($constraint, Interval::untilPositiveInfinity())), 'branches' => Interval::noDev());
  44224. }
  44225. if ($op[0] === '<') {
  44226. return array('numeric' => array(new Interval(Interval::fromZero(), $constraint)), 'branches' => Interval::noDev());
  44227. }
  44228. if ($op === '!=') {
  44229. return array('numeric' => array(
  44230. new Interval(Interval::fromZero(), new Constraint('<', $constraint->getVersion())),
  44231. new Interval(new Constraint('>', $constraint->getVersion()), Interval::untilPositiveInfinity()),
  44232. ), 'branches' => Interval::anyDev());
  44233. }
  44234. return array('numeric' => array(
  44235. new Interval(new Constraint('>=', $constraint->getVersion()), new Constraint('<=', $constraint->getVersion())),
  44236. ), 'branches' => Interval::noDev());
  44237. }
  44238. }
  44239. <?php
  44240. namespace Composer\Semver;
  44241. use Composer\Semver\Constraint\Constraint;
  44242. class Semver
  44243. {
  44244. const SORT_ASC = 1;
  44245. const SORT_DESC = -1;
  44246. private static $versionParser;
  44247. public static function satisfies($version, $constraints)
  44248. {
  44249. if (null === self::$versionParser) {
  44250. self::$versionParser = new VersionParser();
  44251. }
  44252. $versionParser = self::$versionParser;
  44253. $provider = new Constraint('==', $versionParser->normalize($version));
  44254. $parsedConstraints = $versionParser->parseConstraints($constraints);
  44255. return $parsedConstraints->matches($provider);
  44256. }
  44257. public static function satisfiedBy(array $versions, $constraints)
  44258. {
  44259. $versions = array_filter($versions, function ($version) use ($constraints) {
  44260. return Semver::satisfies($version, $constraints);
  44261. });
  44262. return array_values($versions);
  44263. }
  44264. public static function sort(array $versions)
  44265. {
  44266. return self::usort($versions, self::SORT_ASC);
  44267. }
  44268. public static function rsort(array $versions)
  44269. {
  44270. return self::usort($versions, self::SORT_DESC);
  44271. }
  44272. private static function usort(array $versions, $direction)
  44273. {
  44274. if (null === self::$versionParser) {
  44275. self::$versionParser = new VersionParser();
  44276. }
  44277. $versionParser = self::$versionParser;
  44278. $normalized = array();
  44279. foreach ($versions as $key => $version) {
  44280. $normalizedVersion = $versionParser->normalize($version);
  44281. $normalizedVersion = $versionParser->normalizeDefaultBranch($normalizedVersion);
  44282. $normalized[] = array($normalizedVersion, $key);
  44283. }
  44284. usort($normalized, function (array $left, array $right) use ($direction) {
  44285. if ($left[0] === $right[0]) {
  44286. return 0;
  44287. }
  44288. if (Comparator::lessThan($left[0], $right[0])) {
  44289. return -$direction;
  44290. }
  44291. return $direction;
  44292. });
  44293. $sorted = array();
  44294. foreach ($normalized as $item) {
  44295. $sorted[] = $versions[$item[1]];
  44296. }
  44297. return $sorted;
  44298. }
  44299. }
  44300. <?php
  44301. namespace Composer\Semver;
  44302. use Composer\Semver\Constraint\ConstraintInterface;
  44303. use Composer\Semver\Constraint\MatchAllConstraint;
  44304. use Composer\Semver\Constraint\MultiConstraint;
  44305. use Composer\Semver\Constraint\Constraint;
  44306. class VersionParser
  44307. {
  44308. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  44309. private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev';
  44310. public static function parseStability($version)
  44311. {
  44312. $version = (string) preg_replace('{#.+$}', '', (string) $version);
  44313. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  44314. return 'dev';
  44315. }
  44316. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  44317. if (!empty($match[3])) {
  44318. return 'dev';
  44319. }
  44320. if (!empty($match[1])) {
  44321. if ('beta' === $match[1] || 'b' === $match[1]) {
  44322. return 'beta';
  44323. }
  44324. if ('alpha' === $match[1] || 'a' === $match[1]) {
  44325. return 'alpha';
  44326. }
  44327. if ('rc' === $match[1]) {
  44328. return 'RC';
  44329. }
  44330. }
  44331. return 'stable';
  44332. }
  44333. public static function normalizeStability($stability)
  44334. {
  44335. $stability = strtolower((string) $stability);
  44336. return $stability === 'rc' ? 'RC' : $stability;
  44337. }
  44338. public function normalize($version, $fullVersion = null)
  44339. {
  44340. $version = trim((string) $version);
  44341. $origVersion = $version;
  44342. if (null === $fullVersion) {
  44343. $fullVersion = $version;
  44344. }
  44345. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  44346. $version = $match[1];
  44347. }
  44348. if (preg_match('{@(?:' . self::$stabilitiesRegex . ')$}i', $version, $match)) {
  44349. $version = substr($version, 0, strlen($version) - strlen($match[0]));
  44350. }
  44351. if (\in_array($version, array('master', 'trunk', 'default'), true)) {
  44352. $version = 'dev-' . $version;
  44353. }
  44354. if (stripos($version, 'dev-') === 0) {
  44355. return 'dev-' . substr($version, 4);
  44356. }
  44357. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  44358. $version = $match[1];
  44359. }
  44360. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  44361. $version = $matches[1]
  44362. . (!empty($matches[2]) ? $matches[2] : '.0')
  44363. . (!empty($matches[3]) ? $matches[3] : '.0')
  44364. . (!empty($matches[4]) ? $matches[4] : '.0');
  44365. $index = 5;
  44366. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  44367. $version = preg_replace('{\D}', '.', $matches[1]);
  44368. $index = 2;
  44369. }
  44370. if (isset($index)) {
  44371. if (!empty($matches[$index])) {
  44372. if ('stable' === $matches[$index]) {
  44373. return $version;
  44374. }
  44375. $version .= '-' . $this->expandStability($matches[$index]) . (isset($matches[$index + 1]) && '' !== $matches[$index + 1] ? ltrim($matches[$index + 1], '.-') : '');
  44376. }
  44377. if (!empty($matches[$index + 2])) {
  44378. $version .= '-dev';
  44379. }
  44380. return $version;
  44381. }
  44382. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  44383. try {
  44384. $normalized = $this->normalizeBranch($match[1]);
  44385. if (strpos($normalized, 'dev-') === false) {
  44386. return $normalized;
  44387. }
  44388. } catch (\Exception $e) {
  44389. }
  44390. }
  44391. $extraMessage = '';
  44392. if (preg_match('{ +as +' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))?$}', $fullVersion)) {
  44393. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  44394. } elseif (preg_match('{^' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))? +as +}', $fullVersion)) {
  44395. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  44396. }
  44397. throw new \UnexpectedValueException('Invalid version string "' . $origVersion . '"' . $extraMessage);
  44398. }
  44399. public function parseNumericAliasPrefix($branch)
  44400. {
  44401. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', (string) $branch, $matches)) {
  44402. return $matches['version'] . '.';
  44403. }
  44404. return false;
  44405. }
  44406. public function normalizeBranch($name)
  44407. {
  44408. $name = trim((string) $name);
  44409. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  44410. $version = '';
  44411. for ($i = 1; $i < 5; ++$i) {
  44412. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  44413. }
  44414. return str_replace('x', '9999999', $version) . '-dev';
  44415. }
  44416. return 'dev-' . $name;
  44417. }
  44418. public function normalizeDefaultBranch($name)
  44419. {
  44420. if ($name === 'dev-master' || $name === 'dev-default' || $name === 'dev-trunk') {
  44421. return '9999999-dev';
  44422. }
  44423. return (string) $name;
  44424. }
  44425. public function parseConstraints($constraints)
  44426. {
  44427. $prettyConstraint = (string) $constraints;
  44428. $orConstraints = preg_split('{\s*\|\|?\s*}', trim((string) $constraints));
  44429. if (false === $orConstraints) {
  44430. throw new \RuntimeException('Failed to preg_split string: '.$constraints);
  44431. }
  44432. $orGroups = array();
  44433. foreach ($orConstraints as $constraints) {
  44434. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  44435. if (false === $andConstraints) {
  44436. throw new \RuntimeException('Failed to preg_split string: '.$constraints);
  44437. }
  44438. if (\count($andConstraints) > 1) {
  44439. $constraintObjects = array();
  44440. foreach ($andConstraints as $constraint) {
  44441. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  44442. $constraintObjects[] = $parsedConstraint;
  44443. }
  44444. }
  44445. } else {
  44446. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  44447. }
  44448. if (1 === \count($constraintObjects)) {
  44449. $constraint = $constraintObjects[0];
  44450. } else {
  44451. $constraint = new MultiConstraint($constraintObjects);
  44452. }
  44453. $orGroups[] = $constraint;
  44454. }
  44455. $constraint = MultiConstraint::create($orGroups, false);
  44456. $constraint->setPrettyString($prettyConstraint);
  44457. return $constraint;
  44458. }
  44459. private function parseConstraint($constraint)
  44460. {
  44461. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $constraint, $match)) {
  44462. $constraint = $match[1];
  44463. }
  44464. if (preg_match('{^([^,\s]*?)@(' . self::$stabilitiesRegex . ')$}i', $constraint, $match)) {
  44465. $constraint = '' !== $match[1] ? $match[1] : '*';
  44466. if ($match[2] !== 'stable') {
  44467. $stabilityModifier = $match[2];
  44468. }
  44469. }
  44470. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraint, $match)) {
  44471. $constraint = $match[1];
  44472. }
  44473. if (preg_match('{^(v)?[xX*](\.[xX*])*$}i', $constraint, $match)) {
  44474. if (!empty($match[1]) || !empty($match[2])) {
  44475. return array(new Constraint('>=', '0.0.0.0-dev'));
  44476. }
  44477. return array(new MatchAllConstraint());
  44478. }
  44479. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?(?:' . self::$modifierRegex . '|\.([xX*][.-]?dev))(?:\+[^\s]+)?';
  44480. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  44481. if (strpos($constraint, '~>') === 0) {
  44482. throw new \UnexpectedValueException(
  44483. 'Could not parse version constraint ' . $constraint . ': ' .
  44484. 'Invalid operator "~>", you probably meant to use the "~" operator'
  44485. );
  44486. }
  44487. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  44488. $position = 4;
  44489. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  44490. $position = 3;
  44491. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  44492. $position = 2;
  44493. } else {
  44494. $position = 1;
  44495. }
  44496. if (!empty($matches[8])) {
  44497. $position++;
  44498. }
  44499. $stabilitySuffix = '';
  44500. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  44501. $stabilitySuffix .= '-dev';
  44502. }
  44503. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  44504. $lowerBound = new Constraint('>=', $lowVersion);
  44505. $highPosition = max(1, $position - 1);
  44506. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  44507. $upperBound = new Constraint('<', $highVersion);
  44508. return array(
  44509. $lowerBound,
  44510. $upperBound,
  44511. );
  44512. }
  44513. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  44514. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  44515. $position = 1;
  44516. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  44517. $position = 2;
  44518. } else {
  44519. $position = 3;
  44520. }
  44521. $stabilitySuffix = '';
  44522. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  44523. $stabilitySuffix .= '-dev';
  44524. }
  44525. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  44526. $lowerBound = new Constraint('>=', $lowVersion);
  44527. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  44528. $upperBound = new Constraint('<', $highVersion);
  44529. return array(
  44530. $lowerBound,
  44531. $upperBound,
  44532. );
  44533. }
  44534. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  44535. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  44536. $position = 3;
  44537. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  44538. $position = 2;
  44539. } else {
  44540. $position = 1;
  44541. }
  44542. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  44543. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  44544. if ($lowVersion === '0.0.0.0-dev') {
  44545. return array(new Constraint('<', $highVersion));
  44546. }
  44547. return array(
  44548. new Constraint('>=', $lowVersion),
  44549. new Constraint('<', $highVersion),
  44550. );
  44551. }
  44552. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  44553. $lowStabilitySuffix = '';
  44554. if (empty($matches[6]) && empty($matches[8]) && empty($matches[9])) {
  44555. $lowStabilitySuffix = '-dev';
  44556. }
  44557. $lowVersion = $this->normalize($matches['from']);
  44558. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  44559. $empty = function ($x) {
  44560. return ($x === 0 || $x === '0') ? false : empty($x);
  44561. };
  44562. if ((!$empty($matches[12]) && !$empty($matches[13])) || !empty($matches[15]) || !empty($matches[17]) || !empty($matches[18])) {
  44563. $highVersion = $this->normalize($matches['to']);
  44564. $upperBound = new Constraint('<=', $highVersion);
  44565. } else {
  44566. $highMatch = array('', $matches[11], $matches[12], $matches[13], $matches[14]);
  44567. $this->normalize($matches['to']);
  44568. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[12]) ? 1 : 2, 1) . '-dev';
  44569. $upperBound = new Constraint('<', $highVersion);
  44570. }
  44571. return array(
  44572. $lowerBound,
  44573. $upperBound,
  44574. );
  44575. }
  44576. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  44577. try {
  44578. try {
  44579. $version = $this->normalize($matches[2]);
  44580. } catch (\UnexpectedValueException $e) {
  44581. if (substr($matches[2], -4) === '-dev' && preg_match('{^[0-9a-zA-Z-./]+$}', $matches[2])) {
  44582. $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
  44583. } else {
  44584. throw $e;
  44585. }
  44586. }
  44587. $op = $matches[1] ?: '=';
  44588. if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  44589. $version .= '-' . $stabilityModifier;
  44590. } elseif ('<' === $op || '>=' === $op) {
  44591. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  44592. if (strpos($matches[2], 'dev-') !== 0) {
  44593. $version .= '-dev';
  44594. }
  44595. }
  44596. }
  44597. return array(new Constraint($matches[1] ?: '=', $version));
  44598. } catch (\Exception $e) {
  44599. }
  44600. }
  44601. $message = 'Could not parse version constraint ' . $constraint;
  44602. if (isset($e)) {
  44603. $message .= ': ' . $e->getMessage();
  44604. }
  44605. throw new \UnexpectedValueException($message);
  44606. }
  44607. private function manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0')
  44608. {
  44609. for ($i = 4; $i > 0; --$i) {
  44610. if ($i > $position) {
  44611. $matches[$i] = $pad;
  44612. } elseif ($i === $position && $increment) {
  44613. $matches[$i] += $increment;
  44614. if ($matches[$i] < 0) {
  44615. $matches[$i] = $pad;
  44616. --$position;
  44617. if ($i === 1) {
  44618. return null;
  44619. }
  44620. }
  44621. }
  44622. }
  44623. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  44624. }
  44625. private function expandStability($stability)
  44626. {
  44627. $stability = strtolower($stability);
  44628. switch ($stability) {
  44629. case 'a':
  44630. return 'alpha';
  44631. case 'b':
  44632. return 'beta';
  44633. case 'p':
  44634. case 'pl':
  44635. return 'patch';
  44636. case 'rc':
  44637. return 'RC';
  44638. default:
  44639. return $stability;
  44640. }
  44641. }
  44642. }
  44643. Copyright (C) 2015 Composer
  44644. Permission is hereby granted, free of charge, to any person obtaining a copy of
  44645. this software and associated documentation files (the "Software"), to deal in
  44646. the Software without restriction, including without limitation the rights to
  44647. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  44648. of the Software, and to permit persons to whom the Software is furnished to do
  44649. so, subject to the following conditions:
  44650. The above copyright notice and this permission notice shall be included in all
  44651. copies or substantial portions of the Software.
  44652. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44653. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44654. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44655. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44656. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44657. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  44658. SOFTWARE.
  44659. {
  44660. "389-exception": [
  44661. "389 Directory Server Exception"
  44662. ],
  44663. "Autoconf-exception-2.0": [
  44664. "Autoconf exception 2.0"
  44665. ],
  44666. "Autoconf-exception-3.0": [
  44667. "Autoconf exception 3.0"
  44668. ],
  44669. "Bison-exception-2.2": [
  44670. "Bison exception 2.2"
  44671. ],
  44672. "Bootloader-exception": [
  44673. "Bootloader Distribution Exception"
  44674. ],
  44675. "Classpath-exception-2.0": [
  44676. "Classpath exception 2.0"
  44677. ],
  44678. "CLISP-exception-2.0": [
  44679. "CLISP exception 2.0"
  44680. ],
  44681. "DigiRule-FOSS-exception": [
  44682. "DigiRule FOSS License Exception"
  44683. ],
  44684. "eCos-exception-2.0": [
  44685. "eCos exception 2.0"
  44686. ],
  44687. "Fawkes-Runtime-exception": [
  44688. "Fawkes Runtime Exception"
  44689. ],
  44690. "FLTK-exception": [
  44691. "FLTK exception"
  44692. ],
  44693. "Font-exception-2.0": [
  44694. "Font exception 2.0"
  44695. ],
  44696. "freertos-exception-2.0": [
  44697. "FreeRTOS Exception 2.0"
  44698. ],
  44699. "GCC-exception-2.0": [
  44700. "GCC Runtime Library exception 2.0"
  44701. ],
  44702. "GCC-exception-3.1": [
  44703. "GCC Runtime Library exception 3.1"
  44704. ],
  44705. "gnu-javamail-exception": [
  44706. "GNU JavaMail exception"
  44707. ],
  44708. "GPL-3.0-linking-exception": [
  44709. "GPL-3.0 Linking Exception"
  44710. ],
  44711. "GPL-3.0-linking-source-exception": [
  44712. "GPL-3.0 Linking Exception (with Corresponding Source)"
  44713. ],
  44714. "GPL-CC-1.0": [
  44715. "GPL Cooperation Commitment 1.0"
  44716. ],
  44717. "i2p-gpl-java-exception": [
  44718. "i2p GPL+Java Exception"
  44719. ],
  44720. "LGPL-3.0-linking-exception": [
  44721. "LGPL-3.0 Linking Exception"
  44722. ],
  44723. "Libtool-exception": [
  44724. "Libtool Exception"
  44725. ],
  44726. "Linux-syscall-note": [
  44727. "Linux Syscall Note"
  44728. ],
  44729. "LLVM-exception": [
  44730. "LLVM Exception"
  44731. ],
  44732. "LZMA-exception": [
  44733. "LZMA exception"
  44734. ],
  44735. "mif-exception": [
  44736. "Macros and Inline Functions Exception"
  44737. ],
  44738. "Nokia-Qt-exception-1.1": [
  44739. "Nokia Qt LGPL exception 1.1"
  44740. ],
  44741. "OCaml-LGPL-linking-exception": [
  44742. "OCaml LGPL Linking Exception"
  44743. ],
  44744. "OCCT-exception-1.0": [
  44745. "Open CASCADE Exception 1.0"
  44746. ],
  44747. "OpenJDK-assembly-exception-1.0": [
  44748. "OpenJDK Assembly exception 1.0"
  44749. ],
  44750. "openvpn-openssl-exception": [
  44751. "OpenVPN OpenSSL Exception"
  44752. ],
  44753. "PS-or-PDF-font-exception-20170817": [
  44754. "PS/PDF font exception (2017-08-17)"
  44755. ],
  44756. "Qt-GPL-exception-1.0": [
  44757. "Qt GPL exception 1.0"
  44758. ],
  44759. "Qt-LGPL-exception-1.1": [
  44760. "Qt LGPL exception 1.1"
  44761. ],
  44762. "Qwt-exception-1.0": [
  44763. "Qwt exception 1.0"
  44764. ],
  44765. "SHL-2.0": [
  44766. "Solderpad Hardware License v2.0"
  44767. ],
  44768. "SHL-2.1": [
  44769. "Solderpad Hardware License v2.1"
  44770. ],
  44771. "Swift-exception": [
  44772. "Swift Exception"
  44773. ],
  44774. "u-boot-exception-2.0": [
  44775. "U-Boot exception 2.0"
  44776. ],
  44777. "Universal-FOSS-exception-1.0": [
  44778. "Universal FOSS Exception, Version 1.0"
  44779. ],
  44780. "WxWindows-exception-3.1": [
  44781. "WxWindows Library Exception 3.1"
  44782. ]
  44783. }{
  44784. "0BSD": [
  44785. "BSD Zero Clause License",
  44786. true,
  44787. false
  44788. ],
  44789. "AAL": [
  44790. "Attribution Assurance License",
  44791. true,
  44792. false
  44793. ],
  44794. "Abstyles": [
  44795. "Abstyles License",
  44796. false,
  44797. false
  44798. ],
  44799. "Adobe-2006": [
  44800. "Adobe Systems Incorporated Source Code License Agreement",
  44801. false,
  44802. false
  44803. ],
  44804. "Adobe-Glyph": [
  44805. "Adobe Glyph List License",
  44806. false,
  44807. false
  44808. ],
  44809. "ADSL": [
  44810. "Amazon Digital Services License",
  44811. false,
  44812. false
  44813. ],
  44814. "AFL-1.1": [
  44815. "Academic Free License v1.1",
  44816. true,
  44817. false
  44818. ],
  44819. "AFL-1.2": [
  44820. "Academic Free License v1.2",
  44821. true,
  44822. false
  44823. ],
  44824. "AFL-2.0": [
  44825. "Academic Free License v2.0",
  44826. true,
  44827. false
  44828. ],
  44829. "AFL-2.1": [
  44830. "Academic Free License v2.1",
  44831. true,
  44832. false
  44833. ],
  44834. "AFL-3.0": [
  44835. "Academic Free License v3.0",
  44836. true,
  44837. false
  44838. ],
  44839. "Afmparse": [
  44840. "Afmparse License",
  44841. false,
  44842. false
  44843. ],
  44844. "AGPL-1.0": [
  44845. "Affero General Public License v1.0",
  44846. false,
  44847. true
  44848. ],
  44849. "AGPL-1.0-only": [
  44850. "Affero General Public License v1.0 only",
  44851. false,
  44852. false
  44853. ],
  44854. "AGPL-1.0-or-later": [
  44855. "Affero General Public License v1.0 or later",
  44856. false,
  44857. false
  44858. ],
  44859. "AGPL-3.0": [
  44860. "GNU Affero General Public License v3.0",
  44861. true,
  44862. true
  44863. ],
  44864. "AGPL-3.0-only": [
  44865. "GNU Affero General Public License v3.0 only",
  44866. true,
  44867. false
  44868. ],
  44869. "AGPL-3.0-or-later": [
  44870. "GNU Affero General Public License v3.0 or later",
  44871. true,
  44872. false
  44873. ],
  44874. "Aladdin": [
  44875. "Aladdin Free Public License",
  44876. false,
  44877. false
  44878. ],
  44879. "AMDPLPA": [
  44880. "AMD's plpa_map.c License",
  44881. false,
  44882. false
  44883. ],
  44884. "AML": [
  44885. "Apple MIT License",
  44886. false,
  44887. false
  44888. ],
  44889. "AMPAS": [
  44890. "Academy of Motion Picture Arts and Sciences BSD",
  44891. false,
  44892. false
  44893. ],
  44894. "ANTLR-PD": [
  44895. "ANTLR Software Rights Notice",
  44896. false,
  44897. false
  44898. ],
  44899. "ANTLR-PD-fallback": [
  44900. "ANTLR Software Rights Notice with license fallback",
  44901. false,
  44902. false
  44903. ],
  44904. "Apache-1.0": [
  44905. "Apache License 1.0",
  44906. false,
  44907. false
  44908. ],
  44909. "Apache-1.1": [
  44910. "Apache License 1.1",
  44911. true,
  44912. false
  44913. ],
  44914. "Apache-2.0": [
  44915. "Apache License 2.0",
  44916. true,
  44917. false
  44918. ],
  44919. "APAFML": [
  44920. "Adobe Postscript AFM License",
  44921. false,
  44922. false
  44923. ],
  44924. "APL-1.0": [
  44925. "Adaptive Public License 1.0",
  44926. true,
  44927. false
  44928. ],
  44929. "APSL-1.0": [
  44930. "Apple Public Source License 1.0",
  44931. true,
  44932. false
  44933. ],
  44934. "APSL-1.1": [
  44935. "Apple Public Source License 1.1",
  44936. true,
  44937. false
  44938. ],
  44939. "APSL-1.2": [
  44940. "Apple Public Source License 1.2",
  44941. true,
  44942. false
  44943. ],
  44944. "APSL-2.0": [
  44945. "Apple Public Source License 2.0",
  44946. true,
  44947. false
  44948. ],
  44949. "Artistic-1.0": [
  44950. "Artistic License 1.0",
  44951. true,
  44952. false
  44953. ],
  44954. "Artistic-1.0-cl8": [
  44955. "Artistic License 1.0 w/clause 8",
  44956. true,
  44957. false
  44958. ],
  44959. "Artistic-1.0-Perl": [
  44960. "Artistic License 1.0 (Perl)",
  44961. true,
  44962. false
  44963. ],
  44964. "Artistic-2.0": [
  44965. "Artistic License 2.0",
  44966. true,
  44967. false
  44968. ],
  44969. "Bahyph": [
  44970. "Bahyph License",
  44971. false,
  44972. false
  44973. ],
  44974. "Barr": [
  44975. "Barr License",
  44976. false,
  44977. false
  44978. ],
  44979. "Beerware": [
  44980. "Beerware License",
  44981. false,
  44982. false
  44983. ],
  44984. "BitTorrent-1.0": [
  44985. "BitTorrent Open Source License v1.0",
  44986. false,
  44987. false
  44988. ],
  44989. "BitTorrent-1.1": [
  44990. "BitTorrent Open Source License v1.1",
  44991. false,
  44992. false
  44993. ],
  44994. "blessing": [
  44995. "SQLite Blessing",
  44996. false,
  44997. false
  44998. ],
  44999. "BlueOak-1.0.0": [
  45000. "Blue Oak Model License 1.0.0",
  45001. false,
  45002. false
  45003. ],
  45004. "Borceux": [
  45005. "Borceux license",
  45006. false,
  45007. false
  45008. ],
  45009. "BSD-1-Clause": [
  45010. "BSD 1-Clause License",
  45011. true,
  45012. false
  45013. ],
  45014. "BSD-2-Clause": [
  45015. "BSD 2-Clause \"Simplified\" License",
  45016. true,
  45017. false
  45018. ],
  45019. "BSD-2-Clause-FreeBSD": [
  45020. "BSD 2-Clause FreeBSD License",
  45021. false,
  45022. true
  45023. ],
  45024. "BSD-2-Clause-NetBSD": [
  45025. "BSD 2-Clause NetBSD License",
  45026. false,
  45027. true
  45028. ],
  45029. "BSD-2-Clause-Patent": [
  45030. "BSD-2-Clause Plus Patent License",
  45031. true,
  45032. false
  45033. ],
  45034. "BSD-2-Clause-Views": [
  45035. "BSD 2-Clause with views sentence",
  45036. false,
  45037. false
  45038. ],
  45039. "BSD-3-Clause": [
  45040. "BSD 3-Clause \"New\" or \"Revised\" License",
  45041. true,
  45042. false
  45043. ],
  45044. "BSD-3-Clause-Attribution": [
  45045. "BSD with attribution",
  45046. false,
  45047. false
  45048. ],
  45049. "BSD-3-Clause-Clear": [
  45050. "BSD 3-Clause Clear License",
  45051. false,
  45052. false
  45053. ],
  45054. "BSD-3-Clause-LBNL": [
  45055. "Lawrence Berkeley National Labs BSD variant license",
  45056. true,
  45057. false
  45058. ],
  45059. "BSD-3-Clause-Modification": [
  45060. "BSD 3-Clause Modification",
  45061. false,
  45062. false
  45063. ],
  45064. "BSD-3-Clause-No-Military-License": [
  45065. "BSD 3-Clause No Military License",
  45066. false,
  45067. false
  45068. ],
  45069. "BSD-3-Clause-No-Nuclear-License": [
  45070. "BSD 3-Clause No Nuclear License",
  45071. false,
  45072. false
  45073. ],
  45074. "BSD-3-Clause-No-Nuclear-License-2014": [
  45075. "BSD 3-Clause No Nuclear License 2014",
  45076. false,
  45077. false
  45078. ],
  45079. "BSD-3-Clause-No-Nuclear-Warranty": [
  45080. "BSD 3-Clause No Nuclear Warranty",
  45081. false,
  45082. false
  45083. ],
  45084. "BSD-3-Clause-Open-MPI": [
  45085. "BSD 3-Clause Open MPI variant",
  45086. false,
  45087. false
  45088. ],
  45089. "BSD-4-Clause": [
  45090. "BSD 4-Clause \"Original\" or \"Old\" License",
  45091. false,
  45092. false
  45093. ],
  45094. "BSD-4-Clause-Shortened": [
  45095. "BSD 4 Clause Shortened",
  45096. false,
  45097. false
  45098. ],
  45099. "BSD-4-Clause-UC": [
  45100. "BSD-4-Clause (University of California-Specific)",
  45101. false,
  45102. false
  45103. ],
  45104. "BSD-Protection": [
  45105. "BSD Protection License",
  45106. false,
  45107. false
  45108. ],
  45109. "BSD-Source-Code": [
  45110. "BSD Source Code Attribution",
  45111. false,
  45112. false
  45113. ],
  45114. "BSL-1.0": [
  45115. "Boost Software License 1.0",
  45116. true,
  45117. false
  45118. ],
  45119. "BUSL-1.1": [
  45120. "Business Source License 1.1",
  45121. false,
  45122. false
  45123. ],
  45124. "bzip2-1.0.5": [
  45125. "bzip2 and libbzip2 License v1.0.5",
  45126. false,
  45127. false
  45128. ],
  45129. "bzip2-1.0.6": [
  45130. "bzip2 and libbzip2 License v1.0.6",
  45131. false,
  45132. false
  45133. ],
  45134. "C-UDA-1.0": [
  45135. "Computational Use of Data Agreement v1.0",
  45136. false,
  45137. false
  45138. ],
  45139. "CAL-1.0": [
  45140. "Cryptographic Autonomy License 1.0",
  45141. true,
  45142. false
  45143. ],
  45144. "CAL-1.0-Combined-Work-Exception": [
  45145. "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
  45146. true,
  45147. false
  45148. ],
  45149. "Caldera": [
  45150. "Caldera License",
  45151. false,
  45152. false
  45153. ],
  45154. "CATOSL-1.1": [
  45155. "Computer Associates Trusted Open Source License 1.1",
  45156. true,
  45157. false
  45158. ],
  45159. "CC-BY-1.0": [
  45160. "Creative Commons Attribution 1.0 Generic",
  45161. false,
  45162. false
  45163. ],
  45164. "CC-BY-2.0": [
  45165. "Creative Commons Attribution 2.0 Generic",
  45166. false,
  45167. false
  45168. ],
  45169. "CC-BY-2.5": [
  45170. "Creative Commons Attribution 2.5 Generic",
  45171. false,
  45172. false
  45173. ],
  45174. "CC-BY-2.5-AU": [
  45175. "Creative Commons Attribution 2.5 Australia",
  45176. false,
  45177. false
  45178. ],
  45179. "CC-BY-3.0": [
  45180. "Creative Commons Attribution 3.0 Unported",
  45181. false,
  45182. false
  45183. ],
  45184. "CC-BY-3.0-AT": [
  45185. "Creative Commons Attribution 3.0 Austria",
  45186. false,
  45187. false
  45188. ],
  45189. "CC-BY-3.0-DE": [
  45190. "Creative Commons Attribution 3.0 Germany",
  45191. false,
  45192. false
  45193. ],
  45194. "CC-BY-3.0-NL": [
  45195. "Creative Commons Attribution 3.0 Netherlands",
  45196. false,
  45197. false
  45198. ],
  45199. "CC-BY-3.0-US": [
  45200. "Creative Commons Attribution 3.0 United States",
  45201. false,
  45202. false
  45203. ],
  45204. "CC-BY-4.0": [
  45205. "Creative Commons Attribution 4.0 International",
  45206. false,
  45207. false
  45208. ],
  45209. "CC-BY-NC-1.0": [
  45210. "Creative Commons Attribution Non Commercial 1.0 Generic",
  45211. false,
  45212. false
  45213. ],
  45214. "CC-BY-NC-2.0": [
  45215. "Creative Commons Attribution Non Commercial 2.0 Generic",
  45216. false,
  45217. false
  45218. ],
  45219. "CC-BY-NC-2.5": [
  45220. "Creative Commons Attribution Non Commercial 2.5 Generic",
  45221. false,
  45222. false
  45223. ],
  45224. "CC-BY-NC-3.0": [
  45225. "Creative Commons Attribution Non Commercial 3.0 Unported",
  45226. false,
  45227. false
  45228. ],
  45229. "CC-BY-NC-3.0-DE": [
  45230. "Creative Commons Attribution Non Commercial 3.0 Germany",
  45231. false,
  45232. false
  45233. ],
  45234. "CC-BY-NC-4.0": [
  45235. "Creative Commons Attribution Non Commercial 4.0 International",
  45236. false,
  45237. false
  45238. ],
  45239. "CC-BY-NC-ND-1.0": [
  45240. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  45241. false,
  45242. false
  45243. ],
  45244. "CC-BY-NC-ND-2.0": [
  45245. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  45246. false,
  45247. false
  45248. ],
  45249. "CC-BY-NC-ND-2.5": [
  45250. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  45251. false,
  45252. false
  45253. ],
  45254. "CC-BY-NC-ND-3.0": [
  45255. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  45256. false,
  45257. false
  45258. ],
  45259. "CC-BY-NC-ND-3.0-DE": [
  45260. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany",
  45261. false,
  45262. false
  45263. ],
  45264. "CC-BY-NC-ND-3.0-IGO": [
  45265. "Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO",
  45266. false,
  45267. false
  45268. ],
  45269. "CC-BY-NC-ND-4.0": [
  45270. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  45271. false,
  45272. false
  45273. ],
  45274. "CC-BY-NC-SA-1.0": [
  45275. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  45276. false,
  45277. false
  45278. ],
  45279. "CC-BY-NC-SA-2.0": [
  45280. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  45281. false,
  45282. false
  45283. ],
  45284. "CC-BY-NC-SA-2.0-FR": [
  45285. "Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France",
  45286. false,
  45287. false
  45288. ],
  45289. "CC-BY-NC-SA-2.0-UK": [
  45290. "Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales",
  45291. false,
  45292. false
  45293. ],
  45294. "CC-BY-NC-SA-2.5": [
  45295. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  45296. false,
  45297. false
  45298. ],
  45299. "CC-BY-NC-SA-3.0": [
  45300. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  45301. false,
  45302. false
  45303. ],
  45304. "CC-BY-NC-SA-3.0-DE": [
  45305. "Creative Commons Attribution Non Commercial Share Alike 3.0 Germany",
  45306. false,
  45307. false
  45308. ],
  45309. "CC-BY-NC-SA-3.0-IGO": [
  45310. "Creative Commons Attribution Non Commercial Share Alike 3.0 IGO",
  45311. false,
  45312. false
  45313. ],
  45314. "CC-BY-NC-SA-4.0": [
  45315. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  45316. false,
  45317. false
  45318. ],
  45319. "CC-BY-ND-1.0": [
  45320. "Creative Commons Attribution No Derivatives 1.0 Generic",
  45321. false,
  45322. false
  45323. ],
  45324. "CC-BY-ND-2.0": [
  45325. "Creative Commons Attribution No Derivatives 2.0 Generic",
  45326. false,
  45327. false
  45328. ],
  45329. "CC-BY-ND-2.5": [
  45330. "Creative Commons Attribution No Derivatives 2.5 Generic",
  45331. false,
  45332. false
  45333. ],
  45334. "CC-BY-ND-3.0": [
  45335. "Creative Commons Attribution No Derivatives 3.0 Unported",
  45336. false,
  45337. false
  45338. ],
  45339. "CC-BY-ND-3.0-DE": [
  45340. "Creative Commons Attribution No Derivatives 3.0 Germany",
  45341. false,
  45342. false
  45343. ],
  45344. "CC-BY-ND-4.0": [
  45345. "Creative Commons Attribution No Derivatives 4.0 International",
  45346. false,
  45347. false
  45348. ],
  45349. "CC-BY-SA-1.0": [
  45350. "Creative Commons Attribution Share Alike 1.0 Generic",
  45351. false,
  45352. false
  45353. ],
  45354. "CC-BY-SA-2.0": [
  45355. "Creative Commons Attribution Share Alike 2.0 Generic",
  45356. false,
  45357. false
  45358. ],
  45359. "CC-BY-SA-2.0-UK": [
  45360. "Creative Commons Attribution Share Alike 2.0 England and Wales",
  45361. false,
  45362. false
  45363. ],
  45364. "CC-BY-SA-2.1-JP": [
  45365. "Creative Commons Attribution Share Alike 2.1 Japan",
  45366. false,
  45367. false
  45368. ],
  45369. "CC-BY-SA-2.5": [
  45370. "Creative Commons Attribution Share Alike 2.5 Generic",
  45371. false,
  45372. false
  45373. ],
  45374. "CC-BY-SA-3.0": [
  45375. "Creative Commons Attribution Share Alike 3.0 Unported",
  45376. false,
  45377. false
  45378. ],
  45379. "CC-BY-SA-3.0-AT": [
  45380. "Creative Commons Attribution Share Alike 3.0 Austria",
  45381. false,
  45382. false
  45383. ],
  45384. "CC-BY-SA-3.0-DE": [
  45385. "Creative Commons Attribution Share Alike 3.0 Germany",
  45386. false,
  45387. false
  45388. ],
  45389. "CC-BY-SA-4.0": [
  45390. "Creative Commons Attribution Share Alike 4.0 International",
  45391. false,
  45392. false
  45393. ],
  45394. "CC-PDDC": [
  45395. "Creative Commons Public Domain Dedication and Certification",
  45396. false,
  45397. false
  45398. ],
  45399. "CC0-1.0": [
  45400. "Creative Commons Zero v1.0 Universal",
  45401. false,
  45402. false
  45403. ],
  45404. "CDDL-1.0": [
  45405. "Common Development and Distribution License 1.0",
  45406. true,
  45407. false
  45408. ],
  45409. "CDDL-1.1": [
  45410. "Common Development and Distribution License 1.1",
  45411. false,
  45412. false
  45413. ],
  45414. "CDL-1.0": [
  45415. "Common Documentation License 1.0",
  45416. false,
  45417. false
  45418. ],
  45419. "CDLA-Permissive-1.0": [
  45420. "Community Data License Agreement Permissive 1.0",
  45421. false,
  45422. false
  45423. ],
  45424. "CDLA-Permissive-2.0": [
  45425. "Community Data License Agreement Permissive 2.0",
  45426. false,
  45427. false
  45428. ],
  45429. "CDLA-Sharing-1.0": [
  45430. "Community Data License Agreement Sharing 1.0",
  45431. false,
  45432. false
  45433. ],
  45434. "CECILL-1.0": [
  45435. "CeCILL Free Software License Agreement v1.0",
  45436. false,
  45437. false
  45438. ],
  45439. "CECILL-1.1": [
  45440. "CeCILL Free Software License Agreement v1.1",
  45441. false,
  45442. false
  45443. ],
  45444. "CECILL-2.0": [
  45445. "CeCILL Free Software License Agreement v2.0",
  45446. false,
  45447. false
  45448. ],
  45449. "CECILL-2.1": [
  45450. "CeCILL Free Software License Agreement v2.1",
  45451. true,
  45452. false
  45453. ],
  45454. "CECILL-B": [
  45455. "CeCILL-B Free Software License Agreement",
  45456. false,
  45457. false
  45458. ],
  45459. "CECILL-C": [
  45460. "CeCILL-C Free Software License Agreement",
  45461. false,
  45462. false
  45463. ],
  45464. "CERN-OHL-1.1": [
  45465. "CERN Open Hardware Licence v1.1",
  45466. false,
  45467. false
  45468. ],
  45469. "CERN-OHL-1.2": [
  45470. "CERN Open Hardware Licence v1.2",
  45471. false,
  45472. false
  45473. ],
  45474. "CERN-OHL-P-2.0": [
  45475. "CERN Open Hardware Licence Version 2 - Permissive",
  45476. true,
  45477. false
  45478. ],
  45479. "CERN-OHL-S-2.0": [
  45480. "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
  45481. true,
  45482. false
  45483. ],
  45484. "CERN-OHL-W-2.0": [
  45485. "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
  45486. true,
  45487. false
  45488. ],
  45489. "ClArtistic": [
  45490. "Clarified Artistic License",
  45491. false,
  45492. false
  45493. ],
  45494. "CNRI-Jython": [
  45495. "CNRI Jython License",
  45496. false,
  45497. false
  45498. ],
  45499. "CNRI-Python": [
  45500. "CNRI Python License",
  45501. true,
  45502. false
  45503. ],
  45504. "CNRI-Python-GPL-Compatible": [
  45505. "CNRI Python Open Source GPL Compatible License Agreement",
  45506. false,
  45507. false
  45508. ],
  45509. "COIL-1.0": [
  45510. "Copyfree Open Innovation License",
  45511. false,
  45512. false
  45513. ],
  45514. "Community-Spec-1.0": [
  45515. "Community Specification License 1.0",
  45516. false,
  45517. false
  45518. ],
  45519. "Condor-1.1": [
  45520. "Condor Public License v1.1",
  45521. false,
  45522. false
  45523. ],
  45524. "copyleft-next-0.3.0": [
  45525. "copyleft-next 0.3.0",
  45526. false,
  45527. false
  45528. ],
  45529. "copyleft-next-0.3.1": [
  45530. "copyleft-next 0.3.1",
  45531. false,
  45532. false
  45533. ],
  45534. "CPAL-1.0": [
  45535. "Common Public Attribution License 1.0",
  45536. true,
  45537. false
  45538. ],
  45539. "CPL-1.0": [
  45540. "Common Public License 1.0",
  45541. true,
  45542. false
  45543. ],
  45544. "CPOL-1.02": [
  45545. "Code Project Open License 1.02",
  45546. false,
  45547. false
  45548. ],
  45549. "Crossword": [
  45550. "Crossword License",
  45551. false,
  45552. false
  45553. ],
  45554. "CrystalStacker": [
  45555. "CrystalStacker License",
  45556. false,
  45557. false
  45558. ],
  45559. "CUA-OPL-1.0": [
  45560. "CUA Office Public License v1.0",
  45561. true,
  45562. false
  45563. ],
  45564. "Cube": [
  45565. "Cube License",
  45566. false,
  45567. false
  45568. ],
  45569. "curl": [
  45570. "curl License",
  45571. false,
  45572. false
  45573. ],
  45574. "D-FSL-1.0": [
  45575. "Deutsche Freie Software Lizenz",
  45576. false,
  45577. false
  45578. ],
  45579. "diffmark": [
  45580. "diffmark license",
  45581. false,
  45582. false
  45583. ],
  45584. "DOC": [
  45585. "DOC License",
  45586. false,
  45587. false
  45588. ],
  45589. "Dotseqn": [
  45590. "Dotseqn License",
  45591. false,
  45592. false
  45593. ],
  45594. "DRL-1.0": [
  45595. "Detection Rule License 1.0",
  45596. false,
  45597. false
  45598. ],
  45599. "DSDP": [
  45600. "DSDP License",
  45601. false,
  45602. false
  45603. ],
  45604. "dvipdfm": [
  45605. "dvipdfm License",
  45606. false,
  45607. false
  45608. ],
  45609. "ECL-1.0": [
  45610. "Educational Community License v1.0",
  45611. true,
  45612. false
  45613. ],
  45614. "ECL-2.0": [
  45615. "Educational Community License v2.0",
  45616. true,
  45617. false
  45618. ],
  45619. "eCos-2.0": [
  45620. "eCos license version 2.0",
  45621. false,
  45622. true
  45623. ],
  45624. "EFL-1.0": [
  45625. "Eiffel Forum License v1.0",
  45626. true,
  45627. false
  45628. ],
  45629. "EFL-2.0": [
  45630. "Eiffel Forum License v2.0",
  45631. true,
  45632. false
  45633. ],
  45634. "eGenix": [
  45635. "eGenix.com Public License 1.1.0",
  45636. false,
  45637. false
  45638. ],
  45639. "Entessa": [
  45640. "Entessa Public License v1.0",
  45641. true,
  45642. false
  45643. ],
  45644. "EPICS": [
  45645. "EPICS Open License",
  45646. false,
  45647. false
  45648. ],
  45649. "EPL-1.0": [
  45650. "Eclipse Public License 1.0",
  45651. true,
  45652. false
  45653. ],
  45654. "EPL-2.0": [
  45655. "Eclipse Public License 2.0",
  45656. true,
  45657. false
  45658. ],
  45659. "ErlPL-1.1": [
  45660. "Erlang Public License v1.1",
  45661. false,
  45662. false
  45663. ],
  45664. "etalab-2.0": [
  45665. "Etalab Open License 2.0",
  45666. false,
  45667. false
  45668. ],
  45669. "EUDatagrid": [
  45670. "EU DataGrid Software License",
  45671. true,
  45672. false
  45673. ],
  45674. "EUPL-1.0": [
  45675. "European Union Public License 1.0",
  45676. false,
  45677. false
  45678. ],
  45679. "EUPL-1.1": [
  45680. "European Union Public License 1.1",
  45681. true,
  45682. false
  45683. ],
  45684. "EUPL-1.2": [
  45685. "European Union Public License 1.2",
  45686. true,
  45687. false
  45688. ],
  45689. "Eurosym": [
  45690. "Eurosym License",
  45691. false,
  45692. false
  45693. ],
  45694. "Fair": [
  45695. "Fair License",
  45696. true,
  45697. false
  45698. ],
  45699. "FDK-AAC": [
  45700. "Fraunhofer FDK AAC Codec Library",
  45701. false,
  45702. false
  45703. ],
  45704. "Frameworx-1.0": [
  45705. "Frameworx Open License 1.0",
  45706. true,
  45707. false
  45708. ],
  45709. "FreeBSD-DOC": [
  45710. "FreeBSD Documentation License",
  45711. false,
  45712. false
  45713. ],
  45714. "FreeImage": [
  45715. "FreeImage Public License v1.0",
  45716. false,
  45717. false
  45718. ],
  45719. "FSFAP": [
  45720. "FSF All Permissive License",
  45721. false,
  45722. false
  45723. ],
  45724. "FSFUL": [
  45725. "FSF Unlimited License",
  45726. false,
  45727. false
  45728. ],
  45729. "FSFULLR": [
  45730. "FSF Unlimited License (with License Retention)",
  45731. false,
  45732. false
  45733. ],
  45734. "FTL": [
  45735. "Freetype Project License",
  45736. false,
  45737. false
  45738. ],
  45739. "GD": [
  45740. "GD License",
  45741. false,
  45742. false
  45743. ],
  45744. "GFDL-1.1": [
  45745. "GNU Free Documentation License v1.1",
  45746. false,
  45747. true
  45748. ],
  45749. "GFDL-1.1-invariants-only": [
  45750. "GNU Free Documentation License v1.1 only - invariants",
  45751. false,
  45752. false
  45753. ],
  45754. "GFDL-1.1-invariants-or-later": [
  45755. "GNU Free Documentation License v1.1 or later - invariants",
  45756. false,
  45757. false
  45758. ],
  45759. "GFDL-1.1-no-invariants-only": [
  45760. "GNU Free Documentation License v1.1 only - no invariants",
  45761. false,
  45762. false
  45763. ],
  45764. "GFDL-1.1-no-invariants-or-later": [
  45765. "GNU Free Documentation License v1.1 or later - no invariants",
  45766. false,
  45767. false
  45768. ],
  45769. "GFDL-1.1-only": [
  45770. "GNU Free Documentation License v1.1 only",
  45771. false,
  45772. false
  45773. ],
  45774. "GFDL-1.1-or-later": [
  45775. "GNU Free Documentation License v1.1 or later",
  45776. false,
  45777. false
  45778. ],
  45779. "GFDL-1.2": [
  45780. "GNU Free Documentation License v1.2",
  45781. false,
  45782. true
  45783. ],
  45784. "GFDL-1.2-invariants-only": [
  45785. "GNU Free Documentation License v1.2 only - invariants",
  45786. false,
  45787. false
  45788. ],
  45789. "GFDL-1.2-invariants-or-later": [
  45790. "GNU Free Documentation License v1.2 or later - invariants",
  45791. false,
  45792. false
  45793. ],
  45794. "GFDL-1.2-no-invariants-only": [
  45795. "GNU Free Documentation License v1.2 only - no invariants",
  45796. false,
  45797. false
  45798. ],
  45799. "GFDL-1.2-no-invariants-or-later": [
  45800. "GNU Free Documentation License v1.2 or later - no invariants",
  45801. false,
  45802. false
  45803. ],
  45804. "GFDL-1.2-only": [
  45805. "GNU Free Documentation License v1.2 only",
  45806. false,
  45807. false
  45808. ],
  45809. "GFDL-1.2-or-later": [
  45810. "GNU Free Documentation License v1.2 or later",
  45811. false,
  45812. false
  45813. ],
  45814. "GFDL-1.3": [
  45815. "GNU Free Documentation License v1.3",
  45816. false,
  45817. true
  45818. ],
  45819. "GFDL-1.3-invariants-only": [
  45820. "GNU Free Documentation License v1.3 only - invariants",
  45821. false,
  45822. false
  45823. ],
  45824. "GFDL-1.3-invariants-or-later": [
  45825. "GNU Free Documentation License v1.3 or later - invariants",
  45826. false,
  45827. false
  45828. ],
  45829. "GFDL-1.3-no-invariants-only": [
  45830. "GNU Free Documentation License v1.3 only - no invariants",
  45831. false,
  45832. false
  45833. ],
  45834. "GFDL-1.3-no-invariants-or-later": [
  45835. "GNU Free Documentation License v1.3 or later - no invariants",
  45836. false,
  45837. false
  45838. ],
  45839. "GFDL-1.3-only": [
  45840. "GNU Free Documentation License v1.3 only",
  45841. false,
  45842. false
  45843. ],
  45844. "GFDL-1.3-or-later": [
  45845. "GNU Free Documentation License v1.3 or later",
  45846. false,
  45847. false
  45848. ],
  45849. "Giftware": [
  45850. "Giftware License",
  45851. false,
  45852. false
  45853. ],
  45854. "GL2PS": [
  45855. "GL2PS License",
  45856. false,
  45857. false
  45858. ],
  45859. "Glide": [
  45860. "3dfx Glide License",
  45861. false,
  45862. false
  45863. ],
  45864. "Glulxe": [
  45865. "Glulxe License",
  45866. false,
  45867. false
  45868. ],
  45869. "GLWTPL": [
  45870. "Good Luck With That Public License",
  45871. false,
  45872. false
  45873. ],
  45874. "gnuplot": [
  45875. "gnuplot License",
  45876. false,
  45877. false
  45878. ],
  45879. "GPL-1.0": [
  45880. "GNU General Public License v1.0 only",
  45881. false,
  45882. true
  45883. ],
  45884. "GPL-1.0+": [
  45885. "GNU General Public License v1.0 or later",
  45886. false,
  45887. true
  45888. ],
  45889. "GPL-1.0-only": [
  45890. "GNU General Public License v1.0 only",
  45891. false,
  45892. false
  45893. ],
  45894. "GPL-1.0-or-later": [
  45895. "GNU General Public License v1.0 or later",
  45896. false,
  45897. false
  45898. ],
  45899. "GPL-2.0": [
  45900. "GNU General Public License v2.0 only",
  45901. true,
  45902. true
  45903. ],
  45904. "GPL-2.0+": [
  45905. "GNU General Public License v2.0 or later",
  45906. true,
  45907. true
  45908. ],
  45909. "GPL-2.0-only": [
  45910. "GNU General Public License v2.0 only",
  45911. true,
  45912. false
  45913. ],
  45914. "GPL-2.0-or-later": [
  45915. "GNU General Public License v2.0 or later",
  45916. true,
  45917. false
  45918. ],
  45919. "GPL-2.0-with-autoconf-exception": [
  45920. "GNU General Public License v2.0 w/Autoconf exception",
  45921. false,
  45922. true
  45923. ],
  45924. "GPL-2.0-with-bison-exception": [
  45925. "GNU General Public License v2.0 w/Bison exception",
  45926. false,
  45927. true
  45928. ],
  45929. "GPL-2.0-with-classpath-exception": [
  45930. "GNU General Public License v2.0 w/Classpath exception",
  45931. false,
  45932. true
  45933. ],
  45934. "GPL-2.0-with-font-exception": [
  45935. "GNU General Public License v2.0 w/Font exception",
  45936. false,
  45937. true
  45938. ],
  45939. "GPL-2.0-with-GCC-exception": [
  45940. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  45941. false,
  45942. true
  45943. ],
  45944. "GPL-3.0": [
  45945. "GNU General Public License v3.0 only",
  45946. true,
  45947. true
  45948. ],
  45949. "GPL-3.0+": [
  45950. "GNU General Public License v3.0 or later",
  45951. true,
  45952. true
  45953. ],
  45954. "GPL-3.0-only": [
  45955. "GNU General Public License v3.0 only",
  45956. true,
  45957. false
  45958. ],
  45959. "GPL-3.0-or-later": [
  45960. "GNU General Public License v3.0 or later",
  45961. true,
  45962. false
  45963. ],
  45964. "GPL-3.0-with-autoconf-exception": [
  45965. "GNU General Public License v3.0 w/Autoconf exception",
  45966. false,
  45967. true
  45968. ],
  45969. "GPL-3.0-with-GCC-exception": [
  45970. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  45971. true,
  45972. true
  45973. ],
  45974. "gSOAP-1.3b": [
  45975. "gSOAP Public License v1.3b",
  45976. false,
  45977. false
  45978. ],
  45979. "HaskellReport": [
  45980. "Haskell Language Report License",
  45981. false,
  45982. false
  45983. ],
  45984. "Hippocratic-2.1": [
  45985. "Hippocratic License 2.1",
  45986. false,
  45987. false
  45988. ],
  45989. "HPND": [
  45990. "Historical Permission Notice and Disclaimer",
  45991. true,
  45992. false
  45993. ],
  45994. "HPND-sell-variant": [
  45995. "Historical Permission Notice and Disclaimer - sell variant",
  45996. false,
  45997. false
  45998. ],
  45999. "HTMLTIDY": [
  46000. "HTML Tidy License",
  46001. false,
  46002. false
  46003. ],
  46004. "IBM-pibs": [
  46005. "IBM PowerPC Initialization and Boot Software",
  46006. false,
  46007. false
  46008. ],
  46009. "ICU": [
  46010. "ICU License",
  46011. false,
  46012. false
  46013. ],
  46014. "IJG": [
  46015. "Independent JPEG Group License",
  46016. false,
  46017. false
  46018. ],
  46019. "ImageMagick": [
  46020. "ImageMagick License",
  46021. false,
  46022. false
  46023. ],
  46024. "iMatix": [
  46025. "iMatix Standard Function Library Agreement",
  46026. false,
  46027. false
  46028. ],
  46029. "Imlib2": [
  46030. "Imlib2 License",
  46031. false,
  46032. false
  46033. ],
  46034. "Info-ZIP": [
  46035. "Info-ZIP License",
  46036. false,
  46037. false
  46038. ],
  46039. "Intel": [
  46040. "Intel Open Source License",
  46041. true,
  46042. false
  46043. ],
  46044. "Intel-ACPI": [
  46045. "Intel ACPI Software License Agreement",
  46046. false,
  46047. false
  46048. ],
  46049. "Interbase-1.0": [
  46050. "Interbase Public License v1.0",
  46051. false,
  46052. false
  46053. ],
  46054. "IPA": [
  46055. "IPA Font License",
  46056. true,
  46057. false
  46058. ],
  46059. "IPL-1.0": [
  46060. "IBM Public License v1.0",
  46061. true,
  46062. false
  46063. ],
  46064. "ISC": [
  46065. "ISC License",
  46066. true,
  46067. false
  46068. ],
  46069. "JasPer-2.0": [
  46070. "JasPer License",
  46071. false,
  46072. false
  46073. ],
  46074. "JPNIC": [
  46075. "Japan Network Information Center License",
  46076. false,
  46077. false
  46078. ],
  46079. "JSON": [
  46080. "JSON License",
  46081. false,
  46082. false
  46083. ],
  46084. "LAL-1.2": [
  46085. "Licence Art Libre 1.2",
  46086. false,
  46087. false
  46088. ],
  46089. "LAL-1.3": [
  46090. "Licence Art Libre 1.3",
  46091. false,
  46092. false
  46093. ],
  46094. "Latex2e": [
  46095. "Latex2e License",
  46096. false,
  46097. false
  46098. ],
  46099. "Leptonica": [
  46100. "Leptonica License",
  46101. false,
  46102. false
  46103. ],
  46104. "LGPL-2.0": [
  46105. "GNU Library General Public License v2 only",
  46106. true,
  46107. true
  46108. ],
  46109. "LGPL-2.0+": [
  46110. "GNU Library General Public License v2 or later",
  46111. true,
  46112. true
  46113. ],
  46114. "LGPL-2.0-only": [
  46115. "GNU Library General Public License v2 only",
  46116. true,
  46117. false
  46118. ],
  46119. "LGPL-2.0-or-later": [
  46120. "GNU Library General Public License v2 or later",
  46121. true,
  46122. false
  46123. ],
  46124. "LGPL-2.1": [
  46125. "GNU Lesser General Public License v2.1 only",
  46126. true,
  46127. true
  46128. ],
  46129. "LGPL-2.1+": [
  46130. "GNU Library General Public License v2.1 or later",
  46131. true,
  46132. true
  46133. ],
  46134. "LGPL-2.1-only": [
  46135. "GNU Lesser General Public License v2.1 only",
  46136. true,
  46137. false
  46138. ],
  46139. "LGPL-2.1-or-later": [
  46140. "GNU Lesser General Public License v2.1 or later",
  46141. true,
  46142. false
  46143. ],
  46144. "LGPL-3.0": [
  46145. "GNU Lesser General Public License v3.0 only",
  46146. true,
  46147. true
  46148. ],
  46149. "LGPL-3.0+": [
  46150. "GNU Lesser General Public License v3.0 or later",
  46151. true,
  46152. true
  46153. ],
  46154. "LGPL-3.0-only": [
  46155. "GNU Lesser General Public License v3.0 only",
  46156. true,
  46157. false
  46158. ],
  46159. "LGPL-3.0-or-later": [
  46160. "GNU Lesser General Public License v3.0 or later",
  46161. true,
  46162. false
  46163. ],
  46164. "LGPLLR": [
  46165. "Lesser General Public License For Linguistic Resources",
  46166. false,
  46167. false
  46168. ],
  46169. "Libpng": [
  46170. "libpng License",
  46171. false,
  46172. false
  46173. ],
  46174. "libpng-2.0": [
  46175. "PNG Reference Library version 2",
  46176. false,
  46177. false
  46178. ],
  46179. "libselinux-1.0": [
  46180. "libselinux public domain notice",
  46181. false,
  46182. false
  46183. ],
  46184. "libtiff": [
  46185. "libtiff License",
  46186. false,
  46187. false
  46188. ],
  46189. "LiLiQ-P-1.1": [
  46190. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  46191. true,
  46192. false
  46193. ],
  46194. "LiLiQ-R-1.1": [
  46195. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  46196. true,
  46197. false
  46198. ],
  46199. "LiLiQ-Rplus-1.1": [
  46200. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  46201. true,
  46202. false
  46203. ],
  46204. "Linux-man-pages-copyleft": [
  46205. "Linux man-pages Copyleft",
  46206. false,
  46207. false
  46208. ],
  46209. "Linux-OpenIB": [
  46210. "Linux Kernel Variant of OpenIB.org license",
  46211. false,
  46212. false
  46213. ],
  46214. "LPL-1.0": [
  46215. "Lucent Public License Version 1.0",
  46216. true,
  46217. false
  46218. ],
  46219. "LPL-1.02": [
  46220. "Lucent Public License v1.02",
  46221. true,
  46222. false
  46223. ],
  46224. "LPPL-1.0": [
  46225. "LaTeX Project Public License v1.0",
  46226. false,
  46227. false
  46228. ],
  46229. "LPPL-1.1": [
  46230. "LaTeX Project Public License v1.1",
  46231. false,
  46232. false
  46233. ],
  46234. "LPPL-1.2": [
  46235. "LaTeX Project Public License v1.2",
  46236. false,
  46237. false
  46238. ],
  46239. "LPPL-1.3a": [
  46240. "LaTeX Project Public License v1.3a",
  46241. false,
  46242. false
  46243. ],
  46244. "LPPL-1.3c": [
  46245. "LaTeX Project Public License v1.3c",
  46246. true,
  46247. false
  46248. ],
  46249. "MakeIndex": [
  46250. "MakeIndex License",
  46251. false,
  46252. false
  46253. ],
  46254. "MirOS": [
  46255. "The MirOS Licence",
  46256. true,
  46257. false
  46258. ],
  46259. "MIT": [
  46260. "MIT License",
  46261. true,
  46262. false
  46263. ],
  46264. "MIT-0": [
  46265. "MIT No Attribution",
  46266. true,
  46267. false
  46268. ],
  46269. "MIT-advertising": [
  46270. "Enlightenment License (e16)",
  46271. false,
  46272. false
  46273. ],
  46274. "MIT-CMU": [
  46275. "CMU License",
  46276. false,
  46277. false
  46278. ],
  46279. "MIT-enna": [
  46280. "enna License",
  46281. false,
  46282. false
  46283. ],
  46284. "MIT-feh": [
  46285. "feh License",
  46286. false,
  46287. false
  46288. ],
  46289. "MIT-Modern-Variant": [
  46290. "MIT License Modern Variant",
  46291. true,
  46292. false
  46293. ],
  46294. "MIT-open-group": [
  46295. "MIT Open Group variant",
  46296. false,
  46297. false
  46298. ],
  46299. "MITNFA": [
  46300. "MIT +no-false-attribs license",
  46301. false,
  46302. false
  46303. ],
  46304. "Motosoto": [
  46305. "Motosoto License",
  46306. true,
  46307. false
  46308. ],
  46309. "mpich2": [
  46310. "mpich2 License",
  46311. false,
  46312. false
  46313. ],
  46314. "MPL-1.0": [
  46315. "Mozilla Public License 1.0",
  46316. true,
  46317. false
  46318. ],
  46319. "MPL-1.1": [
  46320. "Mozilla Public License 1.1",
  46321. true,
  46322. false
  46323. ],
  46324. "MPL-2.0": [
  46325. "Mozilla Public License 2.0",
  46326. true,
  46327. false
  46328. ],
  46329. "MPL-2.0-no-copyleft-exception": [
  46330. "Mozilla Public License 2.0 (no copyleft exception)",
  46331. true,
  46332. false
  46333. ],
  46334. "MS-PL": [
  46335. "Microsoft Public License",
  46336. true,
  46337. false
  46338. ],
  46339. "MS-RL": [
  46340. "Microsoft Reciprocal License",
  46341. true,
  46342. false
  46343. ],
  46344. "MTLL": [
  46345. "Matrix Template Library License",
  46346. false,
  46347. false
  46348. ],
  46349. "MulanPSL-1.0": [
  46350. "Mulan Permissive Software License, Version 1",
  46351. false,
  46352. false
  46353. ],
  46354. "MulanPSL-2.0": [
  46355. "Mulan Permissive Software License, Version 2",
  46356. true,
  46357. false
  46358. ],
  46359. "Multics": [
  46360. "Multics License",
  46361. true,
  46362. false
  46363. ],
  46364. "Mup": [
  46365. "Mup License",
  46366. false,
  46367. false
  46368. ],
  46369. "NAIST-2003": [
  46370. "Nara Institute of Science and Technology License (2003)",
  46371. false,
  46372. false
  46373. ],
  46374. "NASA-1.3": [
  46375. "NASA Open Source Agreement 1.3",
  46376. true,
  46377. false
  46378. ],
  46379. "Naumen": [
  46380. "Naumen Public License",
  46381. true,
  46382. false
  46383. ],
  46384. "NBPL-1.0": [
  46385. "Net Boolean Public License v1",
  46386. false,
  46387. false
  46388. ],
  46389. "NCGL-UK-2.0": [
  46390. "Non-Commercial Government Licence",
  46391. false,
  46392. false
  46393. ],
  46394. "NCSA": [
  46395. "University of Illinois/NCSA Open Source License",
  46396. true,
  46397. false
  46398. ],
  46399. "Net-SNMP": [
  46400. "Net-SNMP License",
  46401. false,
  46402. false
  46403. ],
  46404. "NetCDF": [
  46405. "NetCDF license",
  46406. false,
  46407. false
  46408. ],
  46409. "Newsletr": [
  46410. "Newsletr License",
  46411. false,
  46412. false
  46413. ],
  46414. "NGPL": [
  46415. "Nethack General Public License",
  46416. true,
  46417. false
  46418. ],
  46419. "NIST-PD": [
  46420. "NIST Public Domain Notice",
  46421. false,
  46422. false
  46423. ],
  46424. "NIST-PD-fallback": [
  46425. "NIST Public Domain Notice with license fallback",
  46426. false,
  46427. false
  46428. ],
  46429. "NLOD-1.0": [
  46430. "Norwegian Licence for Open Government Data (NLOD) 1.0",
  46431. false,
  46432. false
  46433. ],
  46434. "NLOD-2.0": [
  46435. "Norwegian Licence for Open Government Data (NLOD) 2.0",
  46436. false,
  46437. false
  46438. ],
  46439. "NLPL": [
  46440. "No Limit Public License",
  46441. false,
  46442. false
  46443. ],
  46444. "Nokia": [
  46445. "Nokia Open Source License",
  46446. true,
  46447. false
  46448. ],
  46449. "NOSL": [
  46450. "Netizen Open Source License",
  46451. false,
  46452. false
  46453. ],
  46454. "Noweb": [
  46455. "Noweb License",
  46456. false,
  46457. false
  46458. ],
  46459. "NPL-1.0": [
  46460. "Netscape Public License v1.0",
  46461. false,
  46462. false
  46463. ],
  46464. "NPL-1.1": [
  46465. "Netscape Public License v1.1",
  46466. false,
  46467. false
  46468. ],
  46469. "NPOSL-3.0": [
  46470. "Non-Profit Open Software License 3.0",
  46471. true,
  46472. false
  46473. ],
  46474. "NRL": [
  46475. "NRL License",
  46476. false,
  46477. false
  46478. ],
  46479. "NTP": [
  46480. "NTP License",
  46481. true,
  46482. false
  46483. ],
  46484. "NTP-0": [
  46485. "NTP No Attribution",
  46486. false,
  46487. false
  46488. ],
  46489. "Nunit": [
  46490. "Nunit License",
  46491. false,
  46492. true
  46493. ],
  46494. "O-UDA-1.0": [
  46495. "Open Use of Data Agreement v1.0",
  46496. false,
  46497. false
  46498. ],
  46499. "OCCT-PL": [
  46500. "Open CASCADE Technology Public License",
  46501. false,
  46502. false
  46503. ],
  46504. "OCLC-2.0": [
  46505. "OCLC Research Public License 2.0",
  46506. true,
  46507. false
  46508. ],
  46509. "ODbL-1.0": [
  46510. "Open Data Commons Open Database License v1.0",
  46511. false,
  46512. false
  46513. ],
  46514. "ODC-By-1.0": [
  46515. "Open Data Commons Attribution License v1.0",
  46516. false,
  46517. false
  46518. ],
  46519. "OFL-1.0": [
  46520. "SIL Open Font License 1.0",
  46521. false,
  46522. false
  46523. ],
  46524. "OFL-1.0-no-RFN": [
  46525. "SIL Open Font License 1.0 with no Reserved Font Name",
  46526. false,
  46527. false
  46528. ],
  46529. "OFL-1.0-RFN": [
  46530. "SIL Open Font License 1.0 with Reserved Font Name",
  46531. false,
  46532. false
  46533. ],
  46534. "OFL-1.1": [
  46535. "SIL Open Font License 1.1",
  46536. true,
  46537. false
  46538. ],
  46539. "OFL-1.1-no-RFN": [
  46540. "SIL Open Font License 1.1 with no Reserved Font Name",
  46541. true,
  46542. false
  46543. ],
  46544. "OFL-1.1-RFN": [
  46545. "SIL Open Font License 1.1 with Reserved Font Name",
  46546. true,
  46547. false
  46548. ],
  46549. "OGC-1.0": [
  46550. "OGC Software License, Version 1.0",
  46551. false,
  46552. false
  46553. ],
  46554. "OGDL-Taiwan-1.0": [
  46555. "Taiwan Open Government Data License, version 1.0",
  46556. false,
  46557. false
  46558. ],
  46559. "OGL-Canada-2.0": [
  46560. "Open Government Licence - Canada",
  46561. false,
  46562. false
  46563. ],
  46564. "OGL-UK-1.0": [
  46565. "Open Government Licence v1.0",
  46566. false,
  46567. false
  46568. ],
  46569. "OGL-UK-2.0": [
  46570. "Open Government Licence v2.0",
  46571. false,
  46572. false
  46573. ],
  46574. "OGL-UK-3.0": [
  46575. "Open Government Licence v3.0",
  46576. false,
  46577. false
  46578. ],
  46579. "OGTSL": [
  46580. "Open Group Test Suite License",
  46581. true,
  46582. false
  46583. ],
  46584. "OLDAP-1.1": [
  46585. "Open LDAP Public License v1.1",
  46586. false,
  46587. false
  46588. ],
  46589. "OLDAP-1.2": [
  46590. "Open LDAP Public License v1.2",
  46591. false,
  46592. false
  46593. ],
  46594. "OLDAP-1.3": [
  46595. "Open LDAP Public License v1.3",
  46596. false,
  46597. false
  46598. ],
  46599. "OLDAP-1.4": [
  46600. "Open LDAP Public License v1.4",
  46601. false,
  46602. false
  46603. ],
  46604. "OLDAP-2.0": [
  46605. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  46606. false,
  46607. false
  46608. ],
  46609. "OLDAP-2.0.1": [
  46610. "Open LDAP Public License v2.0.1",
  46611. false,
  46612. false
  46613. ],
  46614. "OLDAP-2.1": [
  46615. "Open LDAP Public License v2.1",
  46616. false,
  46617. false
  46618. ],
  46619. "OLDAP-2.2": [
  46620. "Open LDAP Public License v2.2",
  46621. false,
  46622. false
  46623. ],
  46624. "OLDAP-2.2.1": [
  46625. "Open LDAP Public License v2.2.1",
  46626. false,
  46627. false
  46628. ],
  46629. "OLDAP-2.2.2": [
  46630. "Open LDAP Public License 2.2.2",
  46631. false,
  46632. false
  46633. ],
  46634. "OLDAP-2.3": [
  46635. "Open LDAP Public License v2.3",
  46636. false,
  46637. false
  46638. ],
  46639. "OLDAP-2.4": [
  46640. "Open LDAP Public License v2.4",
  46641. false,
  46642. false
  46643. ],
  46644. "OLDAP-2.5": [
  46645. "Open LDAP Public License v2.5",
  46646. false,
  46647. false
  46648. ],
  46649. "OLDAP-2.6": [
  46650. "Open LDAP Public License v2.6",
  46651. false,
  46652. false
  46653. ],
  46654. "OLDAP-2.7": [
  46655. "Open LDAP Public License v2.7",
  46656. false,
  46657. false
  46658. ],
  46659. "OLDAP-2.8": [
  46660. "Open LDAP Public License v2.8",
  46661. true,
  46662. false
  46663. ],
  46664. "OML": [
  46665. "Open Market License",
  46666. false,
  46667. false
  46668. ],
  46669. "OpenSSL": [
  46670. "OpenSSL License",
  46671. false,
  46672. false
  46673. ],
  46674. "OPL-1.0": [
  46675. "Open Public License v1.0",
  46676. false,
  46677. false
  46678. ],
  46679. "OPUBL-1.0": [
  46680. "Open Publication License v1.0",
  46681. false,
  46682. false
  46683. ],
  46684. "OSET-PL-2.1": [
  46685. "OSET Public License version 2.1",
  46686. true,
  46687. false
  46688. ],
  46689. "OSL-1.0": [
  46690. "Open Software License 1.0",
  46691. true,
  46692. false
  46693. ],
  46694. "OSL-1.1": [
  46695. "Open Software License 1.1",
  46696. false,
  46697. false
  46698. ],
  46699. "OSL-2.0": [
  46700. "Open Software License 2.0",
  46701. true,
  46702. false
  46703. ],
  46704. "OSL-2.1": [
  46705. "Open Software License 2.1",
  46706. true,
  46707. false
  46708. ],
  46709. "OSL-3.0": [
  46710. "Open Software License 3.0",
  46711. true,
  46712. false
  46713. ],
  46714. "Parity-6.0.0": [
  46715. "The Parity Public License 6.0.0",
  46716. false,
  46717. false
  46718. ],
  46719. "Parity-7.0.0": [
  46720. "The Parity Public License 7.0.0",
  46721. false,
  46722. false
  46723. ],
  46724. "PDDL-1.0": [
  46725. "Open Data Commons Public Domain Dedication & License 1.0",
  46726. false,
  46727. false
  46728. ],
  46729. "PHP-3.0": [
  46730. "PHP License v3.0",
  46731. true,
  46732. false
  46733. ],
  46734. "PHP-3.01": [
  46735. "PHP License v3.01",
  46736. true,
  46737. false
  46738. ],
  46739. "Plexus": [
  46740. "Plexus Classworlds License",
  46741. false,
  46742. false
  46743. ],
  46744. "PolyForm-Noncommercial-1.0.0": [
  46745. "PolyForm Noncommercial License 1.0.0",
  46746. false,
  46747. false
  46748. ],
  46749. "PolyForm-Small-Business-1.0.0": [
  46750. "PolyForm Small Business License 1.0.0",
  46751. false,
  46752. false
  46753. ],
  46754. "PostgreSQL": [
  46755. "PostgreSQL License",
  46756. true,
  46757. false
  46758. ],
  46759. "PSF-2.0": [
  46760. "Python Software Foundation License 2.0",
  46761. false,
  46762. false
  46763. ],
  46764. "psfrag": [
  46765. "psfrag License",
  46766. false,
  46767. false
  46768. ],
  46769. "psutils": [
  46770. "psutils License",
  46771. false,
  46772. false
  46773. ],
  46774. "Python-2.0": [
  46775. "Python License 2.0",
  46776. true,
  46777. false
  46778. ],
  46779. "Qhull": [
  46780. "Qhull License",
  46781. false,
  46782. false
  46783. ],
  46784. "QPL-1.0": [
  46785. "Q Public License 1.0",
  46786. true,
  46787. false
  46788. ],
  46789. "Rdisc": [
  46790. "Rdisc License",
  46791. false,
  46792. false
  46793. ],
  46794. "RHeCos-1.1": [
  46795. "Red Hat eCos Public License v1.1",
  46796. false,
  46797. false
  46798. ],
  46799. "RPL-1.1": [
  46800. "Reciprocal Public License 1.1",
  46801. true,
  46802. false
  46803. ],
  46804. "RPL-1.5": [
  46805. "Reciprocal Public License 1.5",
  46806. true,
  46807. false
  46808. ],
  46809. "RPSL-1.0": [
  46810. "RealNetworks Public Source License v1.0",
  46811. true,
  46812. false
  46813. ],
  46814. "RSA-MD": [
  46815. "RSA Message-Digest License",
  46816. false,
  46817. false
  46818. ],
  46819. "RSCPL": [
  46820. "Ricoh Source Code Public License",
  46821. true,
  46822. false
  46823. ],
  46824. "Ruby": [
  46825. "Ruby License",
  46826. false,
  46827. false
  46828. ],
  46829. "SAX-PD": [
  46830. "Sax Public Domain Notice",
  46831. false,
  46832. false
  46833. ],
  46834. "Saxpath": [
  46835. "Saxpath License",
  46836. false,
  46837. false
  46838. ],
  46839. "SCEA": [
  46840. "SCEA Shared Source License",
  46841. false,
  46842. false
  46843. ],
  46844. "Sendmail": [
  46845. "Sendmail License",
  46846. false,
  46847. false
  46848. ],
  46849. "Sendmail-8.23": [
  46850. "Sendmail License 8.23",
  46851. false,
  46852. false
  46853. ],
  46854. "SGI-B-1.0": [
  46855. "SGI Free Software License B v1.0",
  46856. false,
  46857. false
  46858. ],
  46859. "SGI-B-1.1": [
  46860. "SGI Free Software License B v1.1",
  46861. false,
  46862. false
  46863. ],
  46864. "SGI-B-2.0": [
  46865. "SGI Free Software License B v2.0",
  46866. false,
  46867. false
  46868. ],
  46869. "SHL-0.5": [
  46870. "Solderpad Hardware License v0.5",
  46871. false,
  46872. false
  46873. ],
  46874. "SHL-0.51": [
  46875. "Solderpad Hardware License, Version 0.51",
  46876. false,
  46877. false
  46878. ],
  46879. "SimPL-2.0": [
  46880. "Simple Public License 2.0",
  46881. true,
  46882. false
  46883. ],
  46884. "SISSL": [
  46885. "Sun Industry Standards Source License v1.1",
  46886. true,
  46887. false
  46888. ],
  46889. "SISSL-1.2": [
  46890. "Sun Industry Standards Source License v1.2",
  46891. false,
  46892. false
  46893. ],
  46894. "Sleepycat": [
  46895. "Sleepycat License",
  46896. true,
  46897. false
  46898. ],
  46899. "SMLNJ": [
  46900. "Standard ML of New Jersey License",
  46901. false,
  46902. false
  46903. ],
  46904. "SMPPL": [
  46905. "Secure Messaging Protocol Public License",
  46906. false,
  46907. false
  46908. ],
  46909. "SNIA": [
  46910. "SNIA Public License 1.1",
  46911. false,
  46912. false
  46913. ],
  46914. "Spencer-86": [
  46915. "Spencer License 86",
  46916. false,
  46917. false
  46918. ],
  46919. "Spencer-94": [
  46920. "Spencer License 94",
  46921. false,
  46922. false
  46923. ],
  46924. "Spencer-99": [
  46925. "Spencer License 99",
  46926. false,
  46927. false
  46928. ],
  46929. "SPL-1.0": [
  46930. "Sun Public License v1.0",
  46931. true,
  46932. false
  46933. ],
  46934. "SSH-OpenSSH": [
  46935. "SSH OpenSSH license",
  46936. false,
  46937. false
  46938. ],
  46939. "SSH-short": [
  46940. "SSH short notice",
  46941. false,
  46942. false
  46943. ],
  46944. "SSPL-1.0": [
  46945. "Server Side Public License, v 1",
  46946. false,
  46947. false
  46948. ],
  46949. "StandardML-NJ": [
  46950. "Standard ML of New Jersey License",
  46951. false,
  46952. true
  46953. ],
  46954. "SugarCRM-1.1.3": [
  46955. "SugarCRM Public License v1.1.3",
  46956. false,
  46957. false
  46958. ],
  46959. "SWL": [
  46960. "Scheme Widget Library (SWL) Software License Agreement",
  46961. false,
  46962. false
  46963. ],
  46964. "TAPR-OHL-1.0": [
  46965. "TAPR Open Hardware License v1.0",
  46966. false,
  46967. false
  46968. ],
  46969. "TCL": [
  46970. "TCL/TK License",
  46971. false,
  46972. false
  46973. ],
  46974. "TCP-wrappers": [
  46975. "TCP Wrappers License",
  46976. false,
  46977. false
  46978. ],
  46979. "TMate": [
  46980. "TMate Open Source License",
  46981. false,
  46982. false
  46983. ],
  46984. "TORQUE-1.1": [
  46985. "TORQUE v2.5+ Software License v1.1",
  46986. false,
  46987. false
  46988. ],
  46989. "TOSL": [
  46990. "Trusster Open Source License",
  46991. false,
  46992. false
  46993. ],
  46994. "TU-Berlin-1.0": [
  46995. "Technische Universitaet Berlin License 1.0",
  46996. false,
  46997. false
  46998. ],
  46999. "TU-Berlin-2.0": [
  47000. "Technische Universitaet Berlin License 2.0",
  47001. false,
  47002. false
  47003. ],
  47004. "UCL-1.0": [
  47005. "Upstream Compatibility License v1.0",
  47006. true,
  47007. false
  47008. ],
  47009. "Unicode-DFS-2015": [
  47010. "Unicode License Agreement - Data Files and Software (2015)",
  47011. false,
  47012. false
  47013. ],
  47014. "Unicode-DFS-2016": [
  47015. "Unicode License Agreement - Data Files and Software (2016)",
  47016. true,
  47017. false
  47018. ],
  47019. "Unicode-TOU": [
  47020. "Unicode Terms of Use",
  47021. false,
  47022. false
  47023. ],
  47024. "Unlicense": [
  47025. "The Unlicense",
  47026. true,
  47027. false
  47028. ],
  47029. "UPL-1.0": [
  47030. "Universal Permissive License v1.0",
  47031. true,
  47032. false
  47033. ],
  47034. "Vim": [
  47035. "Vim License",
  47036. false,
  47037. false
  47038. ],
  47039. "VOSTROM": [
  47040. "VOSTROM Public License for Open Source",
  47041. false,
  47042. false
  47043. ],
  47044. "VSL-1.0": [
  47045. "Vovida Software License v1.0",
  47046. true,
  47047. false
  47048. ],
  47049. "W3C": [
  47050. "W3C Software Notice and License (2002-12-31)",
  47051. true,
  47052. false
  47053. ],
  47054. "W3C-19980720": [
  47055. "W3C Software Notice and License (1998-07-20)",
  47056. false,
  47057. false
  47058. ],
  47059. "W3C-20150513": [
  47060. "W3C Software Notice and Document License (2015-05-13)",
  47061. false,
  47062. false
  47063. ],
  47064. "Watcom-1.0": [
  47065. "Sybase Open Watcom Public License 1.0",
  47066. true,
  47067. false
  47068. ],
  47069. "Wsuipa": [
  47070. "Wsuipa License",
  47071. false,
  47072. false
  47073. ],
  47074. "WTFPL": [
  47075. "Do What The F*ck You Want To Public License",
  47076. false,
  47077. false
  47078. ],
  47079. "wxWindows": [
  47080. "wxWindows Library License",
  47081. true,
  47082. true
  47083. ],
  47084. "X11": [
  47085. "X11 License",
  47086. false,
  47087. false
  47088. ],
  47089. "Xerox": [
  47090. "Xerox License",
  47091. false,
  47092. false
  47093. ],
  47094. "XFree86-1.1": [
  47095. "XFree86 License 1.1",
  47096. false,
  47097. false
  47098. ],
  47099. "xinetd": [
  47100. "xinetd License",
  47101. false,
  47102. false
  47103. ],
  47104. "Xnet": [
  47105. "X.Net License",
  47106. true,
  47107. false
  47108. ],
  47109. "xpp": [
  47110. "XPP License",
  47111. false,
  47112. false
  47113. ],
  47114. "XSkat": [
  47115. "XSkat License",
  47116. false,
  47117. false
  47118. ],
  47119. "YPL-1.0": [
  47120. "Yahoo! Public License v1.0",
  47121. false,
  47122. false
  47123. ],
  47124. "YPL-1.1": [
  47125. "Yahoo! Public License v1.1",
  47126. false,
  47127. false
  47128. ],
  47129. "Zed": [
  47130. "Zed License",
  47131. false,
  47132. false
  47133. ],
  47134. "Zend-2.0": [
  47135. "Zend License v2.0",
  47136. false,
  47137. false
  47138. ],
  47139. "Zimbra-1.3": [
  47140. "Zimbra Public License v1.3",
  47141. false,
  47142. false
  47143. ],
  47144. "Zimbra-1.4": [
  47145. "Zimbra Public License v1.4",
  47146. false,
  47147. false
  47148. ],
  47149. "Zlib": [
  47150. "zlib License",
  47151. true,
  47152. false
  47153. ],
  47154. "zlib-acknowledgement": [
  47155. "zlib/libpng License with Acknowledgement",
  47156. false,
  47157. false
  47158. ],
  47159. "ZPL-1.1": [
  47160. "Zope Public License 1.1",
  47161. false,
  47162. false
  47163. ],
  47164. "ZPL-2.0": [
  47165. "Zope Public License 2.0",
  47166. true,
  47167. false
  47168. ],
  47169. "ZPL-2.1": [
  47170. "Zope Public License 2.1",
  47171. true,
  47172. false
  47173. ]
  47174. }<?php
  47175. namespace Composer\Spdx;
  47176. class SpdxLicenses
  47177. {
  47178. const LICENSES_FILE = 'spdx-licenses.json';
  47179. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  47180. private $licenses;
  47181. private $licensesExpression;
  47182. private $exceptions;
  47183. private $exceptionsExpression;
  47184. public function __construct()
  47185. {
  47186. $this->loadLicenses();
  47187. $this->loadExceptions();
  47188. }
  47189. public function getLicenseByIdentifier($identifier)
  47190. {
  47191. $key = strtolower($identifier);
  47192. if (!isset($this->licenses[$key])) {
  47193. return null;
  47194. }
  47195. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  47196. return array(
  47197. $name,
  47198. $isOsiApproved,
  47199. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  47200. $isDeprecatedLicenseId,
  47201. );
  47202. }
  47203. public function getLicenses()
  47204. {
  47205. return $this->licenses;
  47206. }
  47207. public function getExceptionByIdentifier($identifier)
  47208. {
  47209. $key = strtolower($identifier);
  47210. if (!isset($this->exceptions[$key])) {
  47211. return null;
  47212. }
  47213. list($identifier, $name) = $this->exceptions[$key];
  47214. return array(
  47215. $name,
  47216. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  47217. );
  47218. }
  47219. public function getIdentifierByName($name)
  47220. {
  47221. foreach ($this->licenses as $licenseData) {
  47222. if ($licenseData[1] === $name) {
  47223. return $licenseData[0];
  47224. }
  47225. }
  47226. foreach ($this->exceptions as $licenseData) {
  47227. if ($licenseData[1] === $name) {
  47228. return $licenseData[0];
  47229. }
  47230. }
  47231. return null;
  47232. }
  47233. public function isOsiApprovedByIdentifier($identifier)
  47234. {
  47235. return $this->licenses[strtolower($identifier)][2];
  47236. }
  47237. public function isDeprecatedByIdentifier($identifier)
  47238. {
  47239. return $this->licenses[strtolower($identifier)][3];
  47240. }
  47241. public function validate($license)
  47242. {
  47243. if (is_array($license)) {
  47244. $count = count($license);
  47245. if ($count !== count(array_filter($license, 'is_string'))) {
  47246. throw new \InvalidArgumentException('Array of strings expected.');
  47247. }
  47248. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  47249. }
  47250. if (!is_string($license)) {
  47251. throw new \InvalidArgumentException(sprintf(
  47252. 'Array or String expected, %s given.',
  47253. gettype($license)
  47254. ));
  47255. }
  47256. return $this->isValidLicenseString($license);
  47257. }
  47258. public static function getResourcesDir()
  47259. {
  47260. return dirname(__DIR__) . '/res';
  47261. }
  47262. private function loadLicenses()
  47263. {
  47264. if (null !== $this->licenses) {
  47265. return;
  47266. }
  47267. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  47268. if (false === $json) {
  47269. throw new \RuntimeException('Missing license file in ' . self::getResourcesDir() . '/' . self::LICENSES_FILE);
  47270. }
  47271. $this->licenses = array();
  47272. foreach (json_decode($json, true) as $identifier => $license) {
  47273. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  47274. }
  47275. }
  47276. private function loadExceptions()
  47277. {
  47278. if (null !== $this->exceptions) {
  47279. return;
  47280. }
  47281. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  47282. if (false === $json) {
  47283. throw new \RuntimeException('Missing exceptions file in ' . self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  47284. }
  47285. $this->exceptions = array();
  47286. foreach (json_decode($json, true) as $identifier => $exception) {
  47287. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  47288. }
  47289. }
  47290. private function getLicensesExpression()
  47291. {
  47292. if (null === $this->licensesExpression) {
  47293. $licenses = array_map('preg_quote', array_keys($this->licenses));
  47294. rsort($licenses);
  47295. $licenses = implode('|', $licenses);
  47296. $this->licensesExpression = $licenses;
  47297. }
  47298. return $this->licensesExpression;
  47299. }
  47300. private function getExceptionsExpression()
  47301. {
  47302. if (null === $this->exceptionsExpression) {
  47303. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  47304. rsort($exceptions);
  47305. $exceptions = implode('|', $exceptions);
  47306. $this->exceptionsExpression = $exceptions;
  47307. }
  47308. return $this->exceptionsExpression;
  47309. }
  47310. private function isValidLicenseString($license)
  47311. {
  47312. if (isset($this->licenses[strtolower($license)])) {
  47313. return true;
  47314. }
  47315. $licenses = $this->getLicensesExpression();
  47316. $exceptions = $this->getExceptionsExpression();
  47317. $regex = <<<REGEX
  47318. {
  47319. (?(DEFINE)
  47320. # idstring: 1*( ALPHA / DIGIT / - / . )
  47321. (?<idstring>[\pL\pN.-]{1,})
  47322. # license-id: taken from list
  47323. (?<licenseid>${licenses})
  47324. # license-exception-id: taken from list
  47325. (?<licenseexceptionid>${exceptions})
  47326. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  47327. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  47328. # simple-expresssion: license-id / license-id+ / license-ref
  47329. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  47330. # compound-expression: 1*(
  47331. # simple-expression /
  47332. # simple-expression WITH license-exception-id /
  47333. # compound-expression AND compound-expression /
  47334. # compound-expression OR compound-expression
  47335. # ) / ( compound-expression ) )
  47336. (?<compound_head>
  47337. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  47338. | \( \s* (?&compound_expression) \s* \)
  47339. )
  47340. (?<compound_expression>
  47341. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  47342. )
  47343. # license-expression: 1*1(simple-expression / compound-expression)
  47344. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  47345. ) # end of define
  47346. ^(NONE | NOASSERTION | (?&license_expression))$
  47347. }xi
  47348. REGEX;
  47349. $match = preg_match($regex, $license);
  47350. if (0 === $match) {
  47351. return false;
  47352. }
  47353. if (false === $match) {
  47354. throw new \RuntimeException('Regex failed to compile/run.');
  47355. }
  47356. return true;
  47357. }
  47358. }
  47359. MIT License
  47360. Copyright (c) 2017 Composer
  47361. Permission is hereby granted, free of charge, to any person obtaining a copy
  47362. of this software and associated documentation files (the "Software"), to deal
  47363. in the Software without restriction, including without limitation the rights
  47364. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47365. copies of the Software, and to permit persons to whom the Software is
  47366. furnished to do so, subject to the following conditions:
  47367. The above copyright notice and this permission notice shall be included in all
  47368. copies or substantial portions of the Software.
  47369. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47370. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47371. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47372. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47373. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47374. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47375. SOFTWARE.
  47376. <?php
  47377. declare(strict_types=1);
  47378. namespace Composer\XdebugHandler;
  47379. class PhpConfig
  47380. {
  47381. public function useOriginal(): array
  47382. {
  47383. $this->getDataAndReset();
  47384. return [];
  47385. }
  47386. public function useStandard(): array
  47387. {
  47388. $data = $this->getDataAndReset();
  47389. if ($data !== null) {
  47390. return ['-n', '-c', $data['tmpIni']];
  47391. }
  47392. return [];
  47393. }
  47394. public function usePersistent(): array
  47395. {
  47396. $data = $this->getDataAndReset();
  47397. if ($data !== null) {
  47398. $this->updateEnv('PHPRC', $data['tmpIni']);
  47399. $this->updateEnv('PHP_INI_SCAN_DIR', '');
  47400. }
  47401. return [];
  47402. }
  47403. private function getDataAndReset(): ?array
  47404. {
  47405. $data = XdebugHandler::getRestartSettings();
  47406. if ($data !== null) {
  47407. $this->updateEnv('PHPRC', $data['phprc']);
  47408. $this->updateEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  47409. }
  47410. return $data;
  47411. }
  47412. private function updateEnv(string $name, $value): void
  47413. {
  47414. Process::setEnv($name, false !== $value ? $value : null);
  47415. }
  47416. }
  47417. <?php
  47418. declare(strict_types=1);
  47419. namespace Composer\XdebugHandler;
  47420. use Composer\Pcre\Preg;
  47421. class Process
  47422. {
  47423. public static function escape(string $arg, bool $meta = true, bool $module = false): string
  47424. {
  47425. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  47426. return "'".str_replace("'", "'\\''", $arg)."'";
  47427. }
  47428. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  47429. $arg = Preg::replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  47430. if ($meta) {
  47431. $meta = $dquotes || Preg::isMatch('/%[^%]+%/', $arg);
  47432. if (!$meta) {
  47433. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  47434. } elseif ($module && !$dquotes && $quote) {
  47435. $meta = false;
  47436. }
  47437. }
  47438. if ($quote) {
  47439. $arg = '"'.(Preg::replace('/(\\\\*)$/', '$1$1', $arg)).'"';
  47440. }
  47441. if ($meta) {
  47442. $arg = Preg::replace('/(["^&|<>()%])/', '^$1', $arg);
  47443. }
  47444. return $arg;
  47445. }
  47446. public static function escapeShellCommand(array $args): string
  47447. {
  47448. $command = '';
  47449. $module = array_shift($args);
  47450. if ($module !== null) {
  47451. $command = self::escape($module, true, true);
  47452. foreach ($args as $arg) {
  47453. $command .= ' '.self::escape($arg);
  47454. }
  47455. }
  47456. return $command;
  47457. }
  47458. public static function setEnv(string $name, ?string $value = null): bool
  47459. {
  47460. $unset = null === $value;
  47461. if (!putenv($unset ? $name : $name.'='.$value)) {
  47462. return false;
  47463. }
  47464. if ($unset) {
  47465. unset($_SERVER[$name]);
  47466. } else {
  47467. $_SERVER[$name] = $value;
  47468. }
  47469. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  47470. if ($unset) {
  47471. unset($_ENV[$name]);
  47472. } else {
  47473. $_ENV[$name] = $value;
  47474. }
  47475. }
  47476. return true;
  47477. }
  47478. }
  47479. <?php
  47480. declare(strict_types=1);
  47481. namespace Composer\XdebugHandler;
  47482. use Psr\Log\LoggerInterface;
  47483. use Psr\Log\LogLevel;
  47484. class Status
  47485. {
  47486. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  47487. const CHECK = 'Check';
  47488. const ERROR = 'Error';
  47489. const INFO = 'Info';
  47490. const NORESTART = 'NoRestart';
  47491. const RESTART = 'Restart';
  47492. const RESTARTING = 'Restarting';
  47493. const RESTARTED = 'Restarted';
  47494. private $debug;
  47495. private $envAllowXdebug;
  47496. private $loaded;
  47497. private $logger;
  47498. private $modeOff;
  47499. private $time;
  47500. public function __construct(string $envAllowXdebug, bool $debug)
  47501. {
  47502. $start = getenv(self::ENV_RESTART);
  47503. Process::setEnv(self::ENV_RESTART);
  47504. $this->time = is_numeric($start) ? round((microtime(true) - $start) * 1000) : 0;
  47505. $this->envAllowXdebug = $envAllowXdebug;
  47506. $this->debug = $debug && defined('STDERR');
  47507. $this->modeOff = false;
  47508. }
  47509. public function setLogger(LoggerInterface $logger): void
  47510. {
  47511. $this->logger = $logger;
  47512. }
  47513. public function report(string $op, ?string $data): void
  47514. {
  47515. if ($this->logger !== null || $this->debug) {
  47516. $callable = [$this, 'report'.$op];
  47517. if (!is_callable($callable)) {
  47518. throw new \InvalidArgumentException('Unknown op handler: '.$op);
  47519. }
  47520. $params = $data !== null ? [$data] : [];
  47521. call_user_func_array($callable, $params);
  47522. }
  47523. }
  47524. private function output(string $text, ?string $level = null): void
  47525. {
  47526. if ($this->logger !== null) {
  47527. $this->logger->log($level !== null ? $level: LogLevel::DEBUG, $text);
  47528. }
  47529. if ($this->debug) {
  47530. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  47531. }
  47532. }
  47533. private function reportCheck(string $loaded): void
  47534. {
  47535. list($version, $mode) = explode('|', $loaded);
  47536. if ($version !== '') {
  47537. $this->loaded = '('.$version.')'.($mode !== '' ? ' xdebug.mode='.$mode : '');
  47538. }
  47539. $this->modeOff = $mode === 'off';
  47540. $this->output('Checking '.$this->envAllowXdebug);
  47541. }
  47542. private function reportError(string $error): void
  47543. {
  47544. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  47545. }
  47546. private function reportInfo(string $info): void
  47547. {
  47548. $this->output($info);
  47549. }
  47550. private function reportNoRestart(): void
  47551. {
  47552. $this->output($this->getLoadedMessage());
  47553. if ($this->loaded !== null) {
  47554. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  47555. if (!((bool) getenv($this->envAllowXdebug))) {
  47556. $text .= ' Allowed by '.($this->modeOff ? 'xdebug.mode' : 'application');
  47557. }
  47558. $this->output($text);
  47559. }
  47560. }
  47561. private function reportRestart(): void
  47562. {
  47563. $this->output($this->getLoadedMessage());
  47564. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  47565. }
  47566. private function reportRestarted(): void
  47567. {
  47568. $loaded = $this->getLoadedMessage();
  47569. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  47570. $level = $this->loaded !== null ? LogLevel::WARNING : null;
  47571. $this->output($text, $level);
  47572. }
  47573. private function reportRestarting(string $command): void
  47574. {
  47575. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  47576. $this->output($text);
  47577. $text = 'Running '.$command;
  47578. $this->output($text);
  47579. }
  47580. private function getEnvAllow(): string
  47581. {
  47582. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  47583. }
  47584. private function getLoadedMessage(): string
  47585. {
  47586. $loaded = $this->loaded !== null ? sprintf('loaded %s', $this->loaded) : 'not loaded';
  47587. return 'The Xdebug extension is '.$loaded;
  47588. }
  47589. }
  47590. <?php
  47591. declare(strict_types=1);
  47592. namespace Composer\XdebugHandler;
  47593. use Composer\Pcre\Preg;
  47594. use Psr\Log\LoggerInterface;
  47595. class XdebugHandler
  47596. {
  47597. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  47598. const SUFFIX_INIS = '_ORIGINAL_INIS';
  47599. const RESTART_ID = 'internal';
  47600. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  47601. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  47602. protected $tmpIni;
  47603. private static $inRestart;
  47604. private static $name;
  47605. private static $skipped;
  47606. private static $xdebugActive;
  47607. private static $xdebugMode;
  47608. private static $xdebugVersion;
  47609. private $cli;
  47610. private $debug;
  47611. private $envAllowXdebug;
  47612. private $envOriginalInis;
  47613. private $persistent;
  47614. private $script;
  47615. private $statusWriter;
  47616. public function __construct(string $envPrefix)
  47617. {
  47618. if ($envPrefix === '') {
  47619. throw new \RuntimeException('Invalid constructor parameter');
  47620. }
  47621. self::$name = strtoupper($envPrefix);
  47622. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  47623. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  47624. self::setXdebugDetails();
  47625. self::$inRestart = false;
  47626. if ($this->cli = PHP_SAPI === 'cli') {
  47627. $this->debug = (string) getenv(self::DEBUG);
  47628. }
  47629. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  47630. }
  47631. public function setLogger(LoggerInterface $logger): self
  47632. {
  47633. $this->statusWriter->setLogger($logger);
  47634. return $this;
  47635. }
  47636. public function setMainScript(string $script): self
  47637. {
  47638. $this->script = $script;
  47639. return $this;
  47640. }
  47641. public function setPersistent(): self
  47642. {
  47643. $this->persistent = true;
  47644. return $this;
  47645. }
  47646. public function check(): void
  47647. {
  47648. $this->notify(Status::CHECK, self::$xdebugVersion.'|'.self::$xdebugMode);
  47649. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  47650. if (!((bool) $envArgs[0]) && $this->requiresRestart(self::$xdebugActive)) {
  47651. $this->notify(Status::RESTART);
  47652. if ($this->prepareRestart()) {
  47653. $command = $this->getCommand();
  47654. $this->restart($command);
  47655. }
  47656. return;
  47657. }
  47658. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  47659. $this->notify(Status::RESTARTED);
  47660. Process::setEnv($this->envAllowXdebug);
  47661. self::$inRestart = true;
  47662. if (self::$xdebugVersion === null) {
  47663. self::$skipped = $envArgs[1];
  47664. }
  47665. $this->tryEnableSignals();
  47666. $this->setEnvRestartSettings($envArgs);
  47667. return;
  47668. }
  47669. $this->notify(Status::NORESTART);
  47670. $settings = self::getRestartSettings();
  47671. if ($settings !== null) {
  47672. $this->syncSettings($settings);
  47673. }
  47674. }
  47675. public static function getAllIniFiles(): array
  47676. {
  47677. if (self::$name !== null) {
  47678. $env = getenv(self::$name.self::SUFFIX_INIS);
  47679. if (false !== $env) {
  47680. return explode(PATH_SEPARATOR, $env);
  47681. }
  47682. }
  47683. $paths = [(string) php_ini_loaded_file()];
  47684. $scanned = php_ini_scanned_files();
  47685. if ($scanned !== false) {
  47686. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  47687. }
  47688. return $paths;
  47689. }
  47690. public static function getRestartSettings(): ?array
  47691. {
  47692. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  47693. if (count($envArgs) !== 6
  47694. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  47695. return null;
  47696. }
  47697. return [
  47698. 'tmpIni' => $envArgs[0],
  47699. 'scannedInis' => (bool) $envArgs[1],
  47700. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  47701. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  47702. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  47703. 'skipped' => $envArgs[5],
  47704. ];
  47705. }
  47706. public static function getSkippedVersion(): string
  47707. {
  47708. return (string) self::$skipped;
  47709. }
  47710. public static function isXdebugActive(): bool
  47711. {
  47712. self::setXdebugDetails();
  47713. return self::$xdebugActive;
  47714. }
  47715. protected function requiresRestart(bool $default): bool
  47716. {
  47717. return $default;
  47718. }
  47719. protected function restart(array $command): void
  47720. {
  47721. $this->doRestart($command);
  47722. }
  47723. private function doRestart(array $command): void
  47724. {
  47725. $this->tryEnableSignals();
  47726. $this->notify(Status::RESTARTING, implode(' ', $command));
  47727. if (PHP_VERSION_ID >= 70400) {
  47728. $cmd = $command;
  47729. } else {
  47730. $cmd = Process::escapeShellCommand($command);
  47731. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  47732. $cmd = '"'.$cmd.'"';
  47733. }
  47734. }
  47735. $process = proc_open($cmd, [], $pipes);
  47736. if (is_resource($process)) {
  47737. $exitCode = proc_close($process);
  47738. }
  47739. if (!isset($exitCode)) {
  47740. $this->notify(Status::ERROR, 'Unable to restart process');
  47741. $exitCode = -1;
  47742. } else {
  47743. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  47744. }
  47745. if ($this->debug === '2') {
  47746. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  47747. } else {
  47748. @unlink((string) $this->tmpIni);
  47749. }
  47750. exit($exitCode);
  47751. }
  47752. private function prepareRestart(): bool
  47753. {
  47754. $error = null;
  47755. $iniFiles = self::getAllIniFiles();
  47756. $scannedInis = count($iniFiles) > 1;
  47757. $tmpDir = sys_get_temp_dir();
  47758. if (!$this->cli) {
  47759. $error = 'Unsupported SAPI: '.PHP_SAPI;
  47760. } elseif (!$this->checkConfiguration($info)) {
  47761. $error = $info;
  47762. } elseif (!$this->checkMainScript()) {
  47763. $error = 'Unable to access main script: '.$this->script;
  47764. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  47765. $error = $error !== null ? $error : 'Unable to create temp ini file at: '.$tmpDir;
  47766. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  47767. $error = 'Unable to set environment variables';
  47768. }
  47769. if ($error !== null) {
  47770. $this->notify(Status::ERROR, $error);
  47771. }
  47772. return $error === null;
  47773. }
  47774. private function writeTmpIni(array $iniFiles, string $tmpDir, ?string &$error): bool
  47775. {
  47776. if (($tmpfile = @tempnam($tmpDir, '')) === false) {
  47777. return false;
  47778. }
  47779. $this->tmpIni = $tmpfile;
  47780. if ($iniFiles[0] === '') {
  47781. array_shift($iniFiles);
  47782. }
  47783. $content = '';
  47784. $sectionRegex = '/^\s*\[(?:PATH|HOST)\s*=/mi';
  47785. $xdebugRegex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  47786. foreach ($iniFiles as $file) {
  47787. if (($data = @file_get_contents($file)) === false) {
  47788. $error = 'Unable to read ini: '.$file;
  47789. return false;
  47790. }
  47791. if (Preg::isMatchWithOffsets($sectionRegex, $data, $matches, PREG_OFFSET_CAPTURE)) {
  47792. $data = substr($data, 0, $matches[0][1]);
  47793. }
  47794. $content .= Preg::replace($xdebugRegex, ';$1', $data).PHP_EOL;
  47795. }
  47796. $config = parse_ini_string($content);
  47797. $loaded = ini_get_all(null, false);
  47798. if (false === $config || false === $loaded) {
  47799. $error = 'Unable to parse ini data';
  47800. return false;
  47801. }
  47802. $content .= $this->mergeLoadedConfig($loaded, $config);
  47803. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  47804. return (bool) @file_put_contents($this->tmpIni, $content);
  47805. }
  47806. private function getCommand(): array
  47807. {
  47808. $php = [PHP_BINARY];
  47809. $args = array_slice($_SERVER['argv'], 1);
  47810. if (!$this->persistent) {
  47811. array_push($php, '-n', '-c', $this->tmpIni);
  47812. }
  47813. return array_merge($php, [$this->script], $args);
  47814. }
  47815. private function setEnvironment(bool $scannedInis, array $iniFiles): bool
  47816. {
  47817. $scanDir = getenv('PHP_INI_SCAN_DIR');
  47818. $phprc = getenv('PHPRC');
  47819. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  47820. return false;
  47821. }
  47822. if ($this->persistent) {
  47823. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  47824. return false;
  47825. }
  47826. }
  47827. $envArgs = [
  47828. self::RESTART_ID,
  47829. self::$xdebugVersion,
  47830. (int) $scannedInis,
  47831. false === $scanDir ? '*' : $scanDir,
  47832. false === $phprc ? '*' : $phprc,
  47833. ];
  47834. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  47835. }
  47836. private function notify(string $op, ?string $data = null): void
  47837. {
  47838. $this->statusWriter->report($op, $data);
  47839. }
  47840. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig): string
  47841. {
  47842. $content = '';
  47843. foreach ($loadedConfig as $name => $value) {
  47844. if (!is_string($value)
  47845. || strpos($name, 'xdebug') === 0
  47846. || $name === 'apc.mmap_file_mask') {
  47847. continue;
  47848. }
  47849. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  47850. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  47851. }
  47852. }
  47853. return $content;
  47854. }
  47855. private function checkMainScript(): bool
  47856. {
  47857. if ($this->script !== null) {
  47858. return file_exists($this->script) || '--' === $this->script;
  47859. }
  47860. if (file_exists($this->script = $_SERVER['argv'][0])) {
  47861. return true;
  47862. }
  47863. $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  47864. $main = end($trace);
  47865. if ($main !== false && isset($main['file'])) {
  47866. return file_exists($this->script = $main['file']);
  47867. }
  47868. return false;
  47869. }
  47870. private function setEnvRestartSettings(array $envArgs): void
  47871. {
  47872. $settings = [
  47873. php_ini_loaded_file(),
  47874. $envArgs[2],
  47875. $envArgs[3],
  47876. $envArgs[4],
  47877. getenv($this->envOriginalInis),
  47878. self::$skipped,
  47879. ];
  47880. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  47881. }
  47882. private function syncSettings(array $settings): void
  47883. {
  47884. if (false === getenv($this->envOriginalInis)) {
  47885. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  47886. }
  47887. self::$skipped = $settings['skipped'];
  47888. $this->notify(Status::INFO, 'Process called with existing restart settings');
  47889. }
  47890. private function checkConfiguration(?string &$info): bool
  47891. {
  47892. if (!function_exists('proc_open')) {
  47893. $info = 'proc_open function is disabled';
  47894. return false;
  47895. }
  47896. if (extension_loaded('uopz') && !((bool) ini_get('uopz.disable'))) {
  47897. if (function_exists('uopz_allow_exit')) {
  47898. @uopz_allow_exit(true);
  47899. } else {
  47900. $info = 'uopz extension is not compatible';
  47901. return false;
  47902. }
  47903. }
  47904. if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 70400) {
  47905. $workingDir = getcwd();
  47906. if ($workingDir === false) {
  47907. $info = 'unable to determine working directory';
  47908. return false;
  47909. }
  47910. if (0 === strpos($workingDir, '\\\\')) {
  47911. $info = 'cmd.exe does not support UNC paths: '.$workingDir;
  47912. return false;
  47913. }
  47914. }
  47915. return true;
  47916. }
  47917. private function tryEnableSignals(): void
  47918. {
  47919. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  47920. pcntl_async_signals(true);
  47921. $message = 'Async signals enabled';
  47922. if (!self::$inRestart) {
  47923. pcntl_signal(SIGINT, SIG_IGN);
  47924. } elseif (is_int(pcntl_signal_get_handler(SIGINT))) {
  47925. pcntl_signal(SIGINT, SIG_DFL);
  47926. }
  47927. }
  47928. if (!self::$inRestart && function_exists('sapi_windows_set_ctrl_handler')) {
  47929. sapi_windows_set_ctrl_handler(function ($evt) {});
  47930. }
  47931. }
  47932. private static function setXdebugDetails(): void
  47933. {
  47934. if (self::$xdebugActive !== null) {
  47935. return;
  47936. }
  47937. self::$xdebugActive = false;
  47938. if (!extension_loaded('xdebug')) {
  47939. return;
  47940. }
  47941. $version = phpversion('xdebug');
  47942. self::$xdebugVersion = $version !== false ? $version : 'unknown';
  47943. if (version_compare(self::$xdebugVersion, '3.1', '>=')) {
  47944. $modes = xdebug_info('mode');
  47945. self::$xdebugMode = count($modes) === 0 ? 'off' : implode(',', $modes);
  47946. self::$xdebugActive = self::$xdebugMode !== 'off';
  47947. return;
  47948. }
  47949. $iniMode = ini_get('xdebug.mode');
  47950. if ($iniMode === false) {
  47951. self::$xdebugActive = true;
  47952. return;
  47953. }
  47954. $envMode = (string) getenv('XDEBUG_MODE');
  47955. if ($envMode !== '') {
  47956. self::$xdebugMode = $envMode;
  47957. } else {
  47958. self::$xdebugMode = $iniMode !== '' ? $iniMode : 'off';
  47959. }
  47960. if (Preg::isMatch('/^,+$/', str_replace(' ', '', self::$xdebugMode))) {
  47961. self::$xdebugMode = 'off';
  47962. }
  47963. self::$xdebugActive = self::$xdebugMode !== 'off';
  47964. }
  47965. }
  47966. MIT License
  47967. Copyright (c) 2016
  47968. Permission is hereby granted, free of charge, to any person obtaining a copy
  47969. of this software and associated documentation files (the "Software"), to deal
  47970. in the Software without restriction, including without limitation the rights
  47971. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47972. copies of the Software, and to permit persons to whom the Software is
  47973. furnished to do so, subject to the following conditions:
  47974. The above copyright notice and this permission notice shall be included in all
  47975. copies or substantial portions of the Software.
  47976. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47977. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47978. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47979. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47980. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47981. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47982. SOFTWARE.
  47983. <?php
  47984. namespace JsonSchema\Constraints;
  47985. use JsonSchema\Entity\JsonPointer;
  47986. use JsonSchema\Exception\InvalidArgumentException;
  47987. use JsonSchema\Exception\ValidationException;
  47988. use JsonSchema\Validator;
  47989. class BaseConstraint
  47990. {
  47991. protected $errors = array();
  47992. protected $errorMask = Validator::ERROR_NONE;
  47993. protected $factory;
  47994. public function __construct(Factory $factory = null)
  47995. {
  47996. $this->factory = $factory ?: new Factory();
  47997. }
  47998. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  47999. {
  48000. $error = array(
  48001. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  48002. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  48003. 'message' => $message,
  48004. 'constraint' => $constraint,
  48005. 'context' => $this->factory->getErrorContext(),
  48006. );
  48007. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  48008. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  48009. }
  48010. if (is_array($more) && count($more) > 0) {
  48011. $error += $more;
  48012. }
  48013. $this->errors[] = $error;
  48014. $this->errorMask |= $error['context'];
  48015. }
  48016. public function addErrors(array $errors)
  48017. {
  48018. if ($errors) {
  48019. $this->errors = array_merge($this->errors, $errors);
  48020. $errorMask = &$this->errorMask;
  48021. array_walk($errors, function ($error) use (&$errorMask) {
  48022. if (isset($error['context'])) {
  48023. $errorMask |= $error['context'];
  48024. }
  48025. });
  48026. }
  48027. }
  48028. public function getErrors($errorContext = Validator::ERROR_ALL)
  48029. {
  48030. if ($errorContext === Validator::ERROR_ALL) {
  48031. return $this->errors;
  48032. }
  48033. return array_filter($this->errors, function ($error) use ($errorContext) {
  48034. if ($errorContext & $error['context']) {
  48035. return true;
  48036. }
  48037. });
  48038. }
  48039. public function numErrors($errorContext = Validator::ERROR_ALL)
  48040. {
  48041. if ($errorContext === Validator::ERROR_ALL) {
  48042. return count($this->errors);
  48043. }
  48044. return count($this->getErrors($errorContext));
  48045. }
  48046. public function isValid()
  48047. {
  48048. return !$this->getErrors();
  48049. }
  48050. public function reset()
  48051. {
  48052. $this->errors = array();
  48053. $this->errorMask = Validator::ERROR_NONE;
  48054. }
  48055. public function getErrorMask()
  48056. {
  48057. return $this->errorMask;
  48058. }
  48059. public static function arrayToObjectRecursive($array)
  48060. {
  48061. $json = json_encode($array);
  48062. if (json_last_error() !== \JSON_ERROR_NONE) {
  48063. $message = 'Unable to encode schema array as JSON';
  48064. if (function_exists('json_last_error_msg')) {
  48065. $message .= ': ' . json_last_error_msg();
  48066. }
  48067. throw new InvalidArgumentException($message);
  48068. }
  48069. return (object) json_decode($json);
  48070. }
  48071. }
  48072. <?php
  48073. namespace JsonSchema\Constraints;
  48074. use JsonSchema\Entity\JsonPointer;
  48075. class CollectionConstraint extends Constraint
  48076. {
  48077. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48078. {
  48079. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  48080. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  48081. }
  48082. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  48083. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  48084. }
  48085. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  48086. $unique = $value;
  48087. if (is_array($value) && count($value)) {
  48088. $unique = array_map(function ($e) {
  48089. return var_export($e, true);
  48090. }, $value);
  48091. }
  48092. if (count(array_unique($unique)) != count($value)) {
  48093. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  48094. }
  48095. }
  48096. if (isset($schema->items)) {
  48097. $this->validateItems($value, $schema, $path, $i);
  48098. }
  48099. }
  48100. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48101. {
  48102. if (is_object($schema->items)) {
  48103. foreach ($value as $k => &$v) {
  48104. $initErrors = $this->getErrors();
  48105. $this->checkUndefined($v, $schema->items, $path, $k);
  48106. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  48107. $secondErrors = $this->getErrors();
  48108. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48109. }
  48110. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  48111. $this->errors = $secondErrors;
  48112. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  48113. $this->errors = $initErrors;
  48114. }
  48115. }
  48116. unset($v);
  48117. } else {
  48118. foreach ($value as $k => &$v) {
  48119. if (array_key_exists($k, $schema->items)) {
  48120. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  48121. } else {
  48122. if (property_exists($schema, 'additionalItems')) {
  48123. if ($schema->additionalItems !== false) {
  48124. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48125. } else {
  48126. $this->addError(
  48127. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  48128. }
  48129. } else {
  48130. $this->checkUndefined($v, new \stdClass(), $path, $k);
  48131. }
  48132. }
  48133. }
  48134. unset($v);
  48135. if (count($value) > 0) {
  48136. for ($k = count($value); $k < count($schema->items); $k++) {
  48137. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  48138. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  48139. }
  48140. }
  48141. }
  48142. }
  48143. }
  48144. <?php
  48145. namespace JsonSchema\Constraints;
  48146. use JsonSchema\Entity\JsonPointer;
  48147. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  48148. {
  48149. protected $inlineSchemaProperty = '$schema';
  48150. const CHECK_MODE_NONE = 0x00000000;
  48151. const CHECK_MODE_NORMAL = 0x00000001;
  48152. const CHECK_MODE_TYPE_CAST = 0x00000002;
  48153. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  48154. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  48155. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  48156. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  48157. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  48158. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  48159. protected function incrementPath(JsonPointer $path = null, $i)
  48160. {
  48161. $path = $path ?: new JsonPointer('');
  48162. if ($i === null || $i === '') {
  48163. return $path;
  48164. }
  48165. $path = $path->withPropertyPaths(
  48166. array_merge(
  48167. $path->getPropertyPaths(),
  48168. array($i)
  48169. )
  48170. );
  48171. return $path;
  48172. }
  48173. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48174. {
  48175. $validator = $this->factory->createInstanceFor('collection');
  48176. $validator->check($value, $schema, $path, $i);
  48177. $this->addErrors($validator->getErrors());
  48178. }
  48179. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  48180. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  48181. {
  48182. $validator = $this->factory->createInstanceFor('object');
  48183. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  48184. $this->addErrors($validator->getErrors());
  48185. }
  48186. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48187. {
  48188. $validator = $this->factory->createInstanceFor('type');
  48189. $validator->check($value, $schema, $path, $i);
  48190. $this->addErrors($validator->getErrors());
  48191. }
  48192. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48193. {
  48194. $validator = $this->factory->createInstanceFor('undefined');
  48195. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  48196. $this->addErrors($validator->getErrors());
  48197. }
  48198. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  48199. {
  48200. $validator = $this->factory->createInstanceFor('string');
  48201. $validator->check($value, $schema, $path, $i);
  48202. $this->addErrors($validator->getErrors());
  48203. }
  48204. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  48205. {
  48206. $validator = $this->factory->createInstanceFor('number');
  48207. $validator->check($value, $schema, $path, $i);
  48208. $this->addErrors($validator->getErrors());
  48209. }
  48210. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  48211. {
  48212. $validator = $this->factory->createInstanceFor('enum');
  48213. $validator->check($value, $schema, $path, $i);
  48214. $this->addErrors($validator->getErrors());
  48215. }
  48216. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  48217. {
  48218. $validator = $this->factory->createInstanceFor('format');
  48219. $validator->check($value, $schema, $path, $i);
  48220. $this->addErrors($validator->getErrors());
  48221. }
  48222. protected function getTypeCheck()
  48223. {
  48224. return $this->factory->getTypeCheck();
  48225. }
  48226. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  48227. {
  48228. $result = array_map(
  48229. function ($path) {
  48230. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  48231. },
  48232. $pointer->getPropertyPaths()
  48233. );
  48234. return trim(implode('', $result), '.');
  48235. }
  48236. }
  48237. <?php
  48238. namespace JsonSchema\Constraints;
  48239. use JsonSchema\Entity\JsonPointer;
  48240. interface ConstraintInterface
  48241. {
  48242. public function getErrors();
  48243. public function addErrors(array $errors);
  48244. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  48245. public function isValid();
  48246. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  48247. }
  48248. <?php
  48249. namespace JsonSchema\Constraints;
  48250. use JsonSchema\Entity\JsonPointer;
  48251. class EnumConstraint extends Constraint
  48252. {
  48253. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48254. {
  48255. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  48256. return;
  48257. }
  48258. $type = gettype($element);
  48259. foreach ($schema->enum as $enum) {
  48260. $enumType = gettype($enum);
  48261. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  48262. if ((object) $element == $enum) {
  48263. return;
  48264. }
  48265. }
  48266. if ($type === gettype($enum)) {
  48267. if ($type == 'object') {
  48268. if ($element == $enum) {
  48269. return;
  48270. }
  48271. } elseif ($element === $enum) {
  48272. return;
  48273. }
  48274. }
  48275. }
  48276. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  48277. }
  48278. }
  48279. <?php
  48280. namespace JsonSchema\Constraints;
  48281. use JsonSchema\Exception\InvalidArgumentException;
  48282. use JsonSchema\SchemaStorage;
  48283. use JsonSchema\SchemaStorageInterface;
  48284. use JsonSchema\Uri\UriRetriever;
  48285. use JsonSchema\UriRetrieverInterface;
  48286. use JsonSchema\Validator;
  48287. class Factory
  48288. {
  48289. protected $schemaStorage;
  48290. protected $uriRetriever;
  48291. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  48292. private $typeCheck = array();
  48293. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  48294. protected $constraintMap = array(
  48295. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  48296. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  48297. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  48298. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  48299. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  48300. 'string' => 'JsonSchema\Constraints\StringConstraint',
  48301. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  48302. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  48303. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  48304. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  48305. 'validator' => 'JsonSchema\Validator'
  48306. );
  48307. private $instanceCache = array();
  48308. public function __construct(
  48309. SchemaStorageInterface $schemaStorage = null,
  48310. UriRetrieverInterface $uriRetriever = null,
  48311. $checkMode = Constraint::CHECK_MODE_NORMAL
  48312. ) {
  48313. $this->setConfig($checkMode);
  48314. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48315. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  48316. }
  48317. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  48318. {
  48319. $this->checkMode = $checkMode;
  48320. }
  48321. public function addConfig($options)
  48322. {
  48323. $this->checkMode |= $options;
  48324. }
  48325. public function removeConfig($options)
  48326. {
  48327. $this->checkMode &= ~$options;
  48328. }
  48329. public function getConfig($options = null)
  48330. {
  48331. if ($options === null) {
  48332. return $this->checkMode;
  48333. }
  48334. return $this->checkMode & $options;
  48335. }
  48336. public function getUriRetriever()
  48337. {
  48338. return $this->uriRetriever;
  48339. }
  48340. public function getSchemaStorage()
  48341. {
  48342. return $this->schemaStorage;
  48343. }
  48344. public function getTypeCheck()
  48345. {
  48346. if (!isset($this->typeCheck[$this->checkMode])) {
  48347. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  48348. ? new TypeCheck\LooseTypeCheck()
  48349. : new TypeCheck\StrictTypeCheck();
  48350. }
  48351. return $this->typeCheck[$this->checkMode];
  48352. }
  48353. public function setConstraintClass($name, $class)
  48354. {
  48355. if (!class_exists($class)) {
  48356. throw new InvalidArgumentException('Unknown constraint ' . $name);
  48357. }
  48358. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  48359. throw new InvalidArgumentException('Invalid class ' . $name);
  48360. }
  48361. $this->constraintMap[$name] = $class;
  48362. return $this;
  48363. }
  48364. public function createInstanceFor($constraintName)
  48365. {
  48366. if (!isset($this->constraintMap[$constraintName])) {
  48367. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  48368. }
  48369. if (!isset($this->instanceCache[$constraintName])) {
  48370. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  48371. }
  48372. return clone $this->instanceCache[$constraintName];
  48373. }
  48374. public function getErrorContext()
  48375. {
  48376. return $this->errorContext;
  48377. }
  48378. public function setErrorContext($errorContext)
  48379. {
  48380. $this->errorContext = $errorContext;
  48381. }
  48382. }
  48383. <?php
  48384. namespace JsonSchema\Constraints;
  48385. use JsonSchema\Entity\JsonPointer;
  48386. use JsonSchema\Rfc3339;
  48387. class FormatConstraint extends Constraint
  48388. {
  48389. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48390. {
  48391. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  48392. return;
  48393. }
  48394. switch ($schema->format) {
  48395. case 'date':
  48396. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  48397. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  48398. }
  48399. break;
  48400. case 'time':
  48401. if (!$this->validateDateTime($element, 'H:i:s')) {
  48402. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  48403. }
  48404. break;
  48405. case 'date-time':
  48406. if (null === Rfc3339::createFromString($element)) {
  48407. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  48408. }
  48409. break;
  48410. case 'utc-millisec':
  48411. if (!$this->validateDateTime($element, 'U')) {
  48412. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  48413. }
  48414. break;
  48415. case 'regex':
  48416. if (!$this->validateRegex($element)) {
  48417. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  48418. }
  48419. break;
  48420. case 'color':
  48421. if (!$this->validateColor($element)) {
  48422. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  48423. }
  48424. break;
  48425. case 'style':
  48426. if (!$this->validateStyle($element)) {
  48427. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  48428. }
  48429. break;
  48430. case 'phone':
  48431. if (!$this->validatePhone($element)) {
  48432. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  48433. }
  48434. break;
  48435. case 'uri':
  48436. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48437. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48438. }
  48439. break;
  48440. case 'uriref':
  48441. case 'uri-reference':
  48442. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48443. if (substr($element, 0, 2) === '//') {
  48444. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48445. } elseif (substr($element, 0, 1) === '/') {
  48446. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48447. } elseif (strlen($element)) {
  48448. $pathParts = explode('/', $element, 2);
  48449. if (strpos($pathParts[0], ':') !== false) {
  48450. $validURL = null;
  48451. } else {
  48452. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48453. }
  48454. } else {
  48455. $validURL = null;
  48456. }
  48457. if ($validURL === null) {
  48458. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48459. }
  48460. }
  48461. break;
  48462. case 'email':
  48463. $filterFlags = FILTER_NULL_ON_FAILURE;
  48464. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  48465. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  48466. }
  48467. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  48468. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  48469. }
  48470. break;
  48471. case 'ip-address':
  48472. case 'ipv4':
  48473. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  48474. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48475. }
  48476. break;
  48477. case 'ipv6':
  48478. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  48479. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48480. }
  48481. break;
  48482. case 'host-name':
  48483. case 'hostname':
  48484. if (!$this->validateHostname($element)) {
  48485. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  48486. }
  48487. break;
  48488. default:
  48489. break;
  48490. }
  48491. }
  48492. protected function validateDateTime($datetime, $format)
  48493. {
  48494. $dt = \DateTime::createFromFormat($format, $datetime);
  48495. if (!$dt) {
  48496. return false;
  48497. }
  48498. if ($datetime === $dt->format($format)) {
  48499. return true;
  48500. }
  48501. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  48502. return true;
  48503. }
  48504. return false;
  48505. }
  48506. protected function validateRegex($regex)
  48507. {
  48508. return false !== @preg_match('/' . $regex . '/u', '');
  48509. }
  48510. protected function validateColor($color)
  48511. {
  48512. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  48513. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  48514. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  48515. return true;
  48516. }
  48517. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  48518. }
  48519. protected function validateStyle($style)
  48520. {
  48521. $properties = explode(';', rtrim($style, ';'));
  48522. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  48523. return empty($invalidEntries);
  48524. }
  48525. protected function validatePhone($phone)
  48526. {
  48527. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  48528. }
  48529. protected function validateHostname($host)
  48530. {
  48531. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  48532. return preg_match($hostnameRegex, $host);
  48533. }
  48534. }
  48535. <?php
  48536. namespace JsonSchema\Constraints;
  48537. use JsonSchema\Entity\JsonPointer;
  48538. class NumberConstraint extends Constraint
  48539. {
  48540. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48541. {
  48542. if (isset($schema->exclusiveMinimum)) {
  48543. if (isset($schema->minimum)) {
  48544. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  48545. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  48546. } elseif ($element < $schema->minimum) {
  48547. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48548. }
  48549. } else {
  48550. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  48551. }
  48552. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  48553. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48554. }
  48555. if (isset($schema->exclusiveMaximum)) {
  48556. if (isset($schema->maximum)) {
  48557. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  48558. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  48559. } elseif ($element > $schema->maximum) {
  48560. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48561. }
  48562. } else {
  48563. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  48564. }
  48565. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  48566. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48567. }
  48568. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  48569. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  48570. }
  48571. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  48572. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  48573. }
  48574. $this->checkFormat($element, $schema, $path, $i);
  48575. }
  48576. private function fmod($number1, $number2)
  48577. {
  48578. $modulus = ($number1 - round($number1 / $number2) * $number2);
  48579. $precision = 0.0000000001;
  48580. if (-$precision < $modulus && $modulus < $precision) {
  48581. return 0.0;
  48582. }
  48583. return $modulus;
  48584. }
  48585. }
  48586. <?php
  48587. namespace JsonSchema\Constraints;
  48588. use JsonSchema\Entity\JsonPointer;
  48589. class ObjectConstraint extends Constraint
  48590. {
  48591. protected $appliedDefaults = array();
  48592. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  48593. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  48594. {
  48595. if ($element instanceof UndefinedConstraint) {
  48596. return;
  48597. }
  48598. $this->appliedDefaults = $appliedDefaults;
  48599. $matches = array();
  48600. if ($patternProperties) {
  48601. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  48602. }
  48603. if ($properties) {
  48604. $this->validateProperties($element, $properties, $path);
  48605. }
  48606. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  48607. }
  48608. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  48609. {
  48610. $try = array('/', '#', '+', '~', '%');
  48611. $matches = array();
  48612. foreach ($patternProperties as $pregex => $schema) {
  48613. $delimiter = '/';
  48614. foreach ($try as $delimiter) {
  48615. if (strpos($pregex, $delimiter) === false) {
  48616. break;
  48617. }
  48618. }
  48619. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  48620. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  48621. continue;
  48622. }
  48623. foreach ($element as $i => $value) {
  48624. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  48625. $matches[] = $i;
  48626. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  48627. }
  48628. }
  48629. }
  48630. return $matches;
  48631. }
  48632. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  48633. $properties = null, $additionalProp = null)
  48634. {
  48635. $this->validateMinMaxConstraint($element, $schema, $path);
  48636. foreach ($element as $i => $value) {
  48637. $definition = $this->getProperty($properties, $i);
  48638. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  48639. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  48640. }
  48641. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  48642. if ($additionalProp === true) {
  48643. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  48644. } else {
  48645. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  48646. }
  48647. }
  48648. $require = $this->getProperty($definition, 'requires');
  48649. if ($require && !$this->getProperty($element, $require)) {
  48650. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  48651. }
  48652. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  48653. if (is_object($property)) {
  48654. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  48655. }
  48656. }
  48657. }
  48658. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  48659. {
  48660. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  48661. foreach ($properties as $i => $value) {
  48662. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  48663. $definition = $this->getProperty($properties, $i);
  48664. if (is_object($definition)) {
  48665. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  48666. }
  48667. }
  48668. }
  48669. protected function &getProperty(&$element, $property, $fallback = null)
  48670. {
  48671. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  48672. return $element[$property];
  48673. } elseif (is_object($element) && property_exists($element, $property)) {
  48674. return $element->$property;
  48675. }
  48676. return $fallback;
  48677. }
  48678. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  48679. {
  48680. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  48681. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  48682. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  48683. }
  48684. }
  48685. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  48686. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  48687. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  48688. }
  48689. }
  48690. }
  48691. }
  48692. <?php
  48693. namespace JsonSchema\Constraints;
  48694. use JsonSchema\Entity\JsonPointer;
  48695. use JsonSchema\Exception\InvalidArgumentException;
  48696. use JsonSchema\Exception\InvalidSchemaException;
  48697. use JsonSchema\Exception\RuntimeException;
  48698. use JsonSchema\Validator;
  48699. class SchemaConstraint extends Constraint
  48700. {
  48701. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  48702. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48703. {
  48704. if ($schema !== null) {
  48705. $validationSchema = $schema;
  48706. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  48707. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  48708. } else {
  48709. throw new InvalidArgumentException('no schema found to verify against');
  48710. }
  48711. if (is_array($validationSchema)) {
  48712. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  48713. }
  48714. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  48715. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  48716. throw new RuntimeException('Cannot validate the schema of a non-object');
  48717. }
  48718. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  48719. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  48720. } else {
  48721. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  48722. }
  48723. $schemaStorage = $this->factory->getSchemaStorage();
  48724. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  48725. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  48726. }
  48727. $initialErrorCount = $this->numErrors();
  48728. $initialConfig = $this->factory->getConfig();
  48729. $initialContext = $this->factory->getErrorContext();
  48730. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  48731. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  48732. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  48733. try {
  48734. $this->check($validationSchema, $schemaSpec);
  48735. } catch (\Exception $e) {
  48736. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  48737. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  48738. }
  48739. }
  48740. if ($this->numErrors() > $initialErrorCount) {
  48741. $this->addError($path, 'Schema is not valid', 'schema');
  48742. }
  48743. $this->factory->setConfig($initialConfig);
  48744. $this->factory->setErrorContext($initialContext);
  48745. }
  48746. $this->checkUndefined($element, $validationSchema, $path, $i);
  48747. }
  48748. }
  48749. <?php
  48750. namespace JsonSchema\Constraints;
  48751. use JsonSchema\Entity\JsonPointer;
  48752. class StringConstraint extends Constraint
  48753. {
  48754. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48755. {
  48756. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  48757. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  48758. 'maxLength' => $schema->maxLength,
  48759. ));
  48760. }
  48761. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  48762. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  48763. 'minLength' => $schema->minLength,
  48764. ));
  48765. }
  48766. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  48767. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  48768. 'pattern' => $schema->pattern,
  48769. ));
  48770. }
  48771. $this->checkFormat($element, $schema, $path, $i);
  48772. }
  48773. private function strlen($string)
  48774. {
  48775. if (extension_loaded('mbstring')) {
  48776. return mb_strlen($string, mb_detect_encoding($string));
  48777. }
  48778. return strlen($string);
  48779. }
  48780. }
  48781. <?php
  48782. namespace JsonSchema\Constraints\TypeCheck;
  48783. class LooseTypeCheck implements TypeCheckInterface
  48784. {
  48785. public static function isObject($value)
  48786. {
  48787. return
  48788. is_object($value) ||
  48789. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  48790. }
  48791. public static function isArray($value)
  48792. {
  48793. return
  48794. is_array($value) &&
  48795. (count($value) == 0 || !self::isAssociativeArray($value));
  48796. }
  48797. public static function propertyGet($value, $property)
  48798. {
  48799. if (is_object($value)) {
  48800. return $value->{$property};
  48801. }
  48802. return $value[$property];
  48803. }
  48804. public static function propertySet(&$value, $property, $data)
  48805. {
  48806. if (is_object($value)) {
  48807. $value->{$property} = $data;
  48808. } else {
  48809. $value[$property] = $data;
  48810. }
  48811. }
  48812. public static function propertyExists($value, $property)
  48813. {
  48814. if (is_object($value)) {
  48815. return property_exists($value, $property);
  48816. }
  48817. return array_key_exists($property, $value);
  48818. }
  48819. public static function propertyCount($value)
  48820. {
  48821. if (is_object($value)) {
  48822. return count(get_object_vars($value));
  48823. }
  48824. return count($value);
  48825. }
  48826. private static function isAssociativeArray($arr)
  48827. {
  48828. return array_keys($arr) !== range(0, count($arr) - 1);
  48829. }
  48830. }
  48831. <?php
  48832. namespace JsonSchema\Constraints\TypeCheck;
  48833. class StrictTypeCheck implements TypeCheckInterface
  48834. {
  48835. public static function isObject($value)
  48836. {
  48837. return is_object($value);
  48838. }
  48839. public static function isArray($value)
  48840. {
  48841. return is_array($value);
  48842. }
  48843. public static function propertyGet($value, $property)
  48844. {
  48845. return $value->{$property};
  48846. }
  48847. public static function propertySet(&$value, $property, $data)
  48848. {
  48849. $value->{$property} = $data;
  48850. }
  48851. public static function propertyExists($value, $property)
  48852. {
  48853. return property_exists($value, $property);
  48854. }
  48855. public static function propertyCount($value)
  48856. {
  48857. if (!is_object($value)) {
  48858. return 0;
  48859. }
  48860. return count(get_object_vars($value));
  48861. }
  48862. }
  48863. <?php
  48864. namespace JsonSchema\Constraints\TypeCheck;
  48865. interface TypeCheckInterface
  48866. {
  48867. public static function isObject($value);
  48868. public static function isArray($value);
  48869. public static function propertyGet($value, $property);
  48870. public static function propertySet(&$value, $property, $data);
  48871. public static function propertyExists($value, $property);
  48872. public static function propertyCount($value);
  48873. }
  48874. <?php
  48875. namespace JsonSchema\Constraints;
  48876. use JsonSchema\Entity\JsonPointer;
  48877. use JsonSchema\Exception\InvalidArgumentException;
  48878. use UnexpectedValueException as StandardUnexpectedValueException;
  48879. class TypeConstraint extends Constraint
  48880. {
  48881. public static $wording = array(
  48882. 'integer' => 'an integer',
  48883. 'number' => 'a number',
  48884. 'boolean' => 'a boolean',
  48885. 'object' => 'an object',
  48886. 'array' => 'an array',
  48887. 'string' => 'a string',
  48888. 'null' => 'a null',
  48889. 'any' => null,
  48890. 0 => null,
  48891. );
  48892. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  48893. {
  48894. $type = isset($schema->type) ? $schema->type : null;
  48895. $isValid = false;
  48896. $wording = array();
  48897. if (is_array($type)) {
  48898. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  48899. } elseif (is_object($type)) {
  48900. $this->checkUndefined($value, $type, $path);
  48901. return;
  48902. } else {
  48903. $isValid = $this->validateType($value, $type);
  48904. }
  48905. if ($isValid === false) {
  48906. if (!is_array($type)) {
  48907. $this->validateTypeNameWording($type);
  48908. $wording[] = self::$wording[$type];
  48909. }
  48910. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  48911. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  48912. }
  48913. }
  48914. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48915. {
  48916. foreach ($type as $tp) {
  48917. if (is_object($tp)) {
  48918. if (!$isValid) {
  48919. $validator = $this->factory->createInstanceFor('type');
  48920. $subSchema = new \stdClass();
  48921. $subSchema->type = $tp;
  48922. $validator->check($value, $subSchema, $path, null);
  48923. $error = $validator->getErrors();
  48924. $isValid = !(bool) $error;
  48925. $validTypesWording[] = self::$wording['object'];
  48926. }
  48927. } else {
  48928. $this->validateTypeNameWording($tp);
  48929. $validTypesWording[] = self::$wording[$tp];
  48930. if (!$isValid) {
  48931. $isValid = $this->validateType($value, $tp);
  48932. }
  48933. }
  48934. }
  48935. }
  48936. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  48937. {
  48938. if ($listEnd === false || !isset($elements[1])) {
  48939. return implode($delimiter, $elements);
  48940. }
  48941. $lastElement = array_slice($elements, -1);
  48942. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  48943. $implodedElements = array_merge(array($firsElements), $lastElement);
  48944. return join(" $listEnd ", $implodedElements);
  48945. }
  48946. protected function validateTypeNameWording($type)
  48947. {
  48948. if (!isset(self::$wording[$type])) {
  48949. throw new StandardUnexpectedValueException(
  48950. sprintf(
  48951. 'No wording for %s available, expected wordings are: [%s]',
  48952. var_export($type, true),
  48953. implode(', ', array_filter(self::$wording)))
  48954. );
  48955. }
  48956. }
  48957. protected function validateType(&$value, $type)
  48958. {
  48959. if (!$type) {
  48960. return true;
  48961. }
  48962. if ('any' === $type) {
  48963. return true;
  48964. }
  48965. if ('object' === $type) {
  48966. return $this->getTypeCheck()->isObject($value);
  48967. }
  48968. if ('array' === $type) {
  48969. return $this->getTypeCheck()->isArray($value);
  48970. }
  48971. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  48972. if ('integer' === $type) {
  48973. if ($coerce) {
  48974. $value = $this->toInteger($value);
  48975. }
  48976. return is_int($value);
  48977. }
  48978. if ('number' === $type) {
  48979. if ($coerce) {
  48980. $value = $this->toNumber($value);
  48981. }
  48982. return is_numeric($value) && !is_string($value);
  48983. }
  48984. if ('boolean' === $type) {
  48985. if ($coerce) {
  48986. $value = $this->toBoolean($value);
  48987. }
  48988. return is_bool($value);
  48989. }
  48990. if ('string' === $type) {
  48991. return is_string($value);
  48992. }
  48993. if ('email' === $type) {
  48994. return is_string($value);
  48995. }
  48996. if ('null' === $type) {
  48997. return is_null($value);
  48998. }
  48999. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  49000. }
  49001. protected function toBoolean($value)
  49002. {
  49003. if ($value === 'true') {
  49004. return true;
  49005. }
  49006. if ($value === 'false') {
  49007. return false;
  49008. }
  49009. return $value;
  49010. }
  49011. protected function toNumber($value)
  49012. {
  49013. if (is_numeric($value)) {
  49014. return $value + 0;
  49015. }
  49016. return $value;
  49017. }
  49018. protected function toInteger($value)
  49019. {
  49020. if (is_numeric($value) && (int) $value == $value) {
  49021. return (int) $value;
  49022. }
  49023. return $value;
  49024. }
  49025. }
  49026. <?php
  49027. namespace JsonSchema\Constraints;
  49028. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  49029. use JsonSchema\Entity\JsonPointer;
  49030. use JsonSchema\Exception\ValidationException;
  49031. use JsonSchema\Uri\UriResolver;
  49032. class UndefinedConstraint extends Constraint
  49033. {
  49034. protected $appliedDefaults = array();
  49035. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  49036. {
  49037. if (is_null($schema) || !is_object($schema)) {
  49038. return;
  49039. }
  49040. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  49041. if ($fromDefault) {
  49042. $path->setFromDefault();
  49043. }
  49044. $this->validateCommonProperties($value, $schema, $path, $i);
  49045. $this->validateOfProperties($value, $schema, $path, '');
  49046. $this->validateTypes($value, $schema, $path, $i);
  49047. }
  49048. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  49049. {
  49050. if ($this->getTypeCheck()->isArray($value)) {
  49051. $this->checkArray($value, $schema, $path, $i);
  49052. }
  49053. if (LooseTypeCheck::isObject($value)) {
  49054. $this->checkObject(
  49055. $value,
  49056. $schema,
  49057. $path,
  49058. isset($schema->properties) ? $schema->properties : null,
  49059. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  49060. isset($schema->patternProperties) ? $schema->patternProperties : null,
  49061. $this->appliedDefaults
  49062. );
  49063. }
  49064. if (is_string($value)) {
  49065. $this->checkString($value, $schema, $path, $i);
  49066. }
  49067. if (is_numeric($value)) {
  49068. $this->checkNumber($value, $schema, $path, $i);
  49069. }
  49070. if (isset($schema->enum)) {
  49071. $this->checkEnum($value, $schema, $path, $i);
  49072. }
  49073. }
  49074. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  49075. {
  49076. if (isset($schema->extends)) {
  49077. if (is_string($schema->extends)) {
  49078. $schema->extends = $this->validateUri($schema, $schema->extends);
  49079. }
  49080. if (is_array($schema->extends)) {
  49081. foreach ($schema->extends as $extends) {
  49082. $this->checkUndefined($value, $extends, $path, $i);
  49083. }
  49084. } else {
  49085. $this->checkUndefined($value, $schema->extends, $path, $i);
  49086. }
  49087. }
  49088. if (!$path->fromDefault()) {
  49089. $this->applyDefaultValues($value, $schema, $path);
  49090. }
  49091. if ($this->getTypeCheck()->isObject($value)) {
  49092. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  49093. foreach ($schema->required as $required) {
  49094. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  49095. $this->addError(
  49096. $this->incrementPath($path ?: new JsonPointer(''), $required),
  49097. 'The property ' . $required . ' is required',
  49098. 'required'
  49099. );
  49100. }
  49101. }
  49102. } elseif (isset($schema->required) && !is_array($schema->required)) {
  49103. if ($schema->required && $value instanceof self) {
  49104. $propertyPaths = $path->getPropertyPaths();
  49105. $propertyName = end($propertyPaths);
  49106. $this->addError(
  49107. $path,
  49108. 'The property ' . $propertyName . ' is required',
  49109. 'required'
  49110. );
  49111. }
  49112. } else {
  49113. if ($value instanceof self) {
  49114. return;
  49115. }
  49116. }
  49117. }
  49118. if (!($value instanceof self)) {
  49119. $this->checkType($value, $schema, $path, $i);
  49120. }
  49121. if (isset($schema->disallow)) {
  49122. $initErrors = $this->getErrors();
  49123. $typeSchema = new \stdClass();
  49124. $typeSchema->type = $schema->disallow;
  49125. $this->checkType($value, $typeSchema, $path);
  49126. if (count($this->getErrors()) == count($initErrors)) {
  49127. $this->addError($path, 'Disallowed value was matched', 'disallow');
  49128. } else {
  49129. $this->errors = $initErrors;
  49130. }
  49131. }
  49132. if (isset($schema->not)) {
  49133. $initErrors = $this->getErrors();
  49134. $this->checkUndefined($value, $schema->not, $path, $i);
  49135. if (count($this->getErrors()) == count($initErrors)) {
  49136. $this->addError($path, 'Matched a schema which it should not', 'not');
  49137. } else {
  49138. $this->errors = $initErrors;
  49139. }
  49140. }
  49141. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  49142. $this->validateDependencies($value, $schema->dependencies, $path);
  49143. }
  49144. }
  49145. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  49146. {
  49147. if (!$requiredOnly) {
  49148. return true;
  49149. }
  49150. if (
  49151. $name !== null
  49152. && isset($parentSchema->required)
  49153. && is_array($parentSchema->required)
  49154. && in_array($name, $parentSchema->required)
  49155. ) {
  49156. return true;
  49157. }
  49158. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  49159. return true;
  49160. }
  49161. return false;
  49162. }
  49163. protected function applyDefaultValues(&$value, $schema, $path)
  49164. {
  49165. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  49166. return;
  49167. }
  49168. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  49169. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  49170. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  49171. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  49172. if (
  49173. !LooseTypeCheck::propertyExists($value, $currentProperty)
  49174. && property_exists($propertyDefinition, 'default')
  49175. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  49176. ) {
  49177. if (is_object($propertyDefinition->default)) {
  49178. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  49179. } else {
  49180. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  49181. }
  49182. $this->appliedDefaults[] = $currentProperty;
  49183. }
  49184. }
  49185. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  49186. $items = array();
  49187. if (LooseTypeCheck::isArray($schema->items)) {
  49188. $items = $schema->items;
  49189. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  49190. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  49191. }
  49192. foreach ($items as $currentItem => $itemDefinition) {
  49193. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  49194. if (
  49195. !array_key_exists($currentItem, $value)
  49196. && property_exists($itemDefinition, 'default')
  49197. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  49198. if (is_object($itemDefinition->default)) {
  49199. $value[$currentItem] = clone $itemDefinition->default;
  49200. } else {
  49201. $value[$currentItem] = $itemDefinition->default;
  49202. }
  49203. }
  49204. $path->setFromDefault();
  49205. }
  49206. } elseif (
  49207. $value instanceof self
  49208. && property_exists($schema, 'default')
  49209. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  49210. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  49211. $path->setFromDefault();
  49212. }
  49213. }
  49214. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  49215. {
  49216. if ($value instanceof self) {
  49217. return;
  49218. }
  49219. if (isset($schema->allOf)) {
  49220. $isValid = true;
  49221. foreach ($schema->allOf as $allOf) {
  49222. $initErrors = $this->getErrors();
  49223. $this->checkUndefined($value, $allOf, $path, $i);
  49224. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  49225. }
  49226. if (!$isValid) {
  49227. $this->addError($path, 'Failed to match all schemas', 'allOf');
  49228. }
  49229. }
  49230. if (isset($schema->anyOf)) {
  49231. $isValid = false;
  49232. $startErrors = $this->getErrors();
  49233. $caughtException = null;
  49234. foreach ($schema->anyOf as $anyOf) {
  49235. $initErrors = $this->getErrors();
  49236. try {
  49237. $this->checkUndefined($value, $anyOf, $path, $i);
  49238. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  49239. break;
  49240. }
  49241. } catch (ValidationException $e) {
  49242. $isValid = false;
  49243. }
  49244. }
  49245. if (!$isValid) {
  49246. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  49247. } else {
  49248. $this->errors = $startErrors;
  49249. }
  49250. }
  49251. if (isset($schema->oneOf)) {
  49252. $allErrors = array();
  49253. $matchedSchemas = 0;
  49254. $startErrors = $this->getErrors();
  49255. foreach ($schema->oneOf as $oneOf) {
  49256. try {
  49257. $this->errors = array();
  49258. $this->checkUndefined($value, $oneOf, $path, $i);
  49259. if (count($this->getErrors()) == 0) {
  49260. $matchedSchemas++;
  49261. }
  49262. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  49263. } catch (ValidationException $e) {
  49264. }
  49265. }
  49266. if ($matchedSchemas !== 1) {
  49267. $this->addErrors(array_merge($allErrors, $startErrors));
  49268. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  49269. } else {
  49270. $this->errors = $startErrors;
  49271. }
  49272. }
  49273. }
  49274. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  49275. {
  49276. foreach ($dependencies as $key => $dependency) {
  49277. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  49278. if (is_string($dependency)) {
  49279. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  49280. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  49281. }
  49282. } elseif (is_array($dependency)) {
  49283. foreach ($dependency as $d) {
  49284. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  49285. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  49286. }
  49287. }
  49288. } elseif (is_object($dependency)) {
  49289. $this->checkUndefined($value, $dependency, $path, $i);
  49290. }
  49291. }
  49292. }
  49293. }
  49294. protected function validateUri($schema, $schemaUri = null)
  49295. {
  49296. $resolver = new UriResolver();
  49297. $retriever = $this->factory->getUriRetriever();
  49298. $jsonSchema = null;
  49299. if ($resolver->isValid($schemaUri)) {
  49300. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  49301. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  49302. }
  49303. return $jsonSchema;
  49304. }
  49305. }
  49306. <?php
  49307. namespace JsonSchema\Entity;
  49308. use JsonSchema\Exception\InvalidArgumentException;
  49309. class JsonPointer
  49310. {
  49311. private $filename;
  49312. private $propertyPaths = array();
  49313. private $fromDefault = false;
  49314. public function __construct($value)
  49315. {
  49316. if (!is_string($value)) {
  49317. throw new InvalidArgumentException('Ref value must be a string');
  49318. }
  49319. $splitRef = explode('#', $value, 2);
  49320. $this->filename = $splitRef[0];
  49321. if (array_key_exists(1, $splitRef)) {
  49322. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  49323. }
  49324. }
  49325. private function decodePropertyPaths($propertyPathString)
  49326. {
  49327. $paths = array();
  49328. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  49329. $path = $this->decodePath($path);
  49330. if (is_string($path) && '' !== $path) {
  49331. $paths[] = $path;
  49332. }
  49333. }
  49334. return $paths;
  49335. }
  49336. private function encodePropertyPaths()
  49337. {
  49338. return array_map(
  49339. array($this, 'encodePath'),
  49340. $this->getPropertyPaths()
  49341. );
  49342. }
  49343. private function decodePath($path)
  49344. {
  49345. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  49346. }
  49347. private function encodePath($path)
  49348. {
  49349. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  49350. }
  49351. public function getFilename()
  49352. {
  49353. return $this->filename;
  49354. }
  49355. public function getPropertyPaths()
  49356. {
  49357. return $this->propertyPaths;
  49358. }
  49359. public function withPropertyPaths(array $propertyPaths)
  49360. {
  49361. $new = clone $this;
  49362. $new->propertyPaths = $propertyPaths;
  49363. return $new;
  49364. }
  49365. public function getPropertyPathAsString()
  49366. {
  49367. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  49368. }
  49369. public function __toString()
  49370. {
  49371. return $this->getFilename() . $this->getPropertyPathAsString();
  49372. }
  49373. public function setFromDefault()
  49374. {
  49375. $this->fromDefault = true;
  49376. }
  49377. public function fromDefault()
  49378. {
  49379. return $this->fromDefault;
  49380. }
  49381. }
  49382. <?php
  49383. namespace JsonSchema\Exception;
  49384. interface ExceptionInterface
  49385. {
  49386. }
  49387. <?php
  49388. namespace JsonSchema\Exception;
  49389. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  49390. {
  49391. }
  49392. <?php
  49393. namespace JsonSchema\Exception;
  49394. class InvalidConfigException extends RuntimeException
  49395. {
  49396. }
  49397. <?php
  49398. namespace JsonSchema\Exception;
  49399. class InvalidSchemaException extends RuntimeException
  49400. {
  49401. }
  49402. <?php
  49403. namespace JsonSchema\Exception;
  49404. class InvalidSchemaMediaTypeException extends RuntimeException
  49405. {
  49406. }
  49407. <?php
  49408. namespace JsonSchema\Exception;
  49409. class InvalidSourceUriException extends InvalidArgumentException
  49410. {
  49411. }
  49412. <?php
  49413. namespace JsonSchema\Exception;
  49414. class JsonDecodingException extends RuntimeException
  49415. {
  49416. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  49417. {
  49418. switch ($code) {
  49419. case JSON_ERROR_DEPTH:
  49420. $message = 'The maximum stack depth has been exceeded';
  49421. break;
  49422. case JSON_ERROR_STATE_MISMATCH:
  49423. $message = 'Invalid or malformed JSON';
  49424. break;
  49425. case JSON_ERROR_CTRL_CHAR:
  49426. $message = 'Control character error, possibly incorrectly encoded';
  49427. break;
  49428. case JSON_ERROR_UTF8:
  49429. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  49430. break;
  49431. case JSON_ERROR_SYNTAX:
  49432. $message = 'JSON syntax is malformed';
  49433. break;
  49434. default:
  49435. $message = 'Syntax error';
  49436. }
  49437. parent::__construct($message, $code, $previous);
  49438. }
  49439. }
  49440. <?php
  49441. namespace JsonSchema\Exception;
  49442. class ResourceNotFoundException extends RuntimeException
  49443. {
  49444. }
  49445. <?php
  49446. namespace JsonSchema\Exception;
  49447. class RuntimeException extends \RuntimeException implements ExceptionInterface
  49448. {
  49449. }
  49450. <?php
  49451. namespace JsonSchema\Exception;
  49452. class UnresolvableJsonPointerException extends InvalidArgumentException
  49453. {
  49454. }
  49455. <?php
  49456. namespace JsonSchema\Exception;
  49457. class UriResolverException extends RuntimeException
  49458. {
  49459. }
  49460. <?php
  49461. namespace JsonSchema\Exception;
  49462. class ValidationException extends RuntimeException
  49463. {
  49464. }
  49465. <?php
  49466. namespace JsonSchema\Iterator;
  49467. class ObjectIterator implements \Iterator, \Countable
  49468. {
  49469. private $object;
  49470. private $position = 0;
  49471. private $data = array();
  49472. private $initialized = false;
  49473. public function __construct($object)
  49474. {
  49475. $this->object = $object;
  49476. }
  49477. public function current()
  49478. {
  49479. $this->initialize();
  49480. return $this->data[$this->position];
  49481. }
  49482. public function next()
  49483. {
  49484. $this->initialize();
  49485. $this->position++;
  49486. }
  49487. public function key()
  49488. {
  49489. $this->initialize();
  49490. return $this->position;
  49491. }
  49492. public function valid()
  49493. {
  49494. $this->initialize();
  49495. return isset($this->data[$this->position]);
  49496. }
  49497. public function rewind()
  49498. {
  49499. $this->initialize();
  49500. $this->position = 0;
  49501. }
  49502. public function count()
  49503. {
  49504. $this->initialize();
  49505. return count($this->data);
  49506. }
  49507. private function initialize()
  49508. {
  49509. if (!$this->initialized) {
  49510. $this->data = $this->buildDataFromObject($this->object);
  49511. $this->initialized = true;
  49512. }
  49513. }
  49514. private function buildDataFromObject($object)
  49515. {
  49516. $result = array();
  49517. $stack = new \SplStack();
  49518. $stack->push($object);
  49519. while (!$stack->isEmpty()) {
  49520. $current = $stack->pop();
  49521. if (is_object($current)) {
  49522. array_push($result, $current);
  49523. }
  49524. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  49525. if (is_object($propertyValue) || is_array($propertyValue)) {
  49526. $stack->push($propertyValue);
  49527. }
  49528. }
  49529. }
  49530. return $result;
  49531. }
  49532. private function getDataFromItem($item)
  49533. {
  49534. if (!is_object($item) && !is_array($item)) {
  49535. return array();
  49536. }
  49537. return is_object($item) ? get_object_vars($item) : $item;
  49538. }
  49539. }
  49540. <?php
  49541. namespace JsonSchema;
  49542. class Rfc3339
  49543. {
  49544. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  49545. public static function createFromString($string)
  49546. {
  49547. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  49548. return null;
  49549. }
  49550. $dateAndTime = $matches[1];
  49551. $microseconds = $matches[2] ?: '.000000';
  49552. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  49553. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  49554. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  49555. return $dateTime ?: null;
  49556. }
  49557. }
  49558. <?php
  49559. namespace JsonSchema;
  49560. use JsonSchema\Constraints\BaseConstraint;
  49561. use JsonSchema\Entity\JsonPointer;
  49562. use JsonSchema\Exception\UnresolvableJsonPointerException;
  49563. use JsonSchema\Uri\UriResolver;
  49564. use JsonSchema\Uri\UriRetriever;
  49565. class SchemaStorage implements SchemaStorageInterface
  49566. {
  49567. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  49568. protected $uriRetriever;
  49569. protected $uriResolver;
  49570. protected $schemas = array();
  49571. public function __construct(
  49572. UriRetrieverInterface $uriRetriever = null,
  49573. UriResolverInterface $uriResolver = null
  49574. ) {
  49575. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49576. $this->uriResolver = $uriResolver ?: new UriResolver();
  49577. }
  49578. public function getUriRetriever()
  49579. {
  49580. return $this->uriRetriever;
  49581. }
  49582. public function getUriResolver()
  49583. {
  49584. return $this->uriResolver;
  49585. }
  49586. public function addSchema($id, $schema = null)
  49587. {
  49588. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  49589. $schema = $this->uriRetriever->retrieve($id);
  49590. }
  49591. if (is_array($schema)) {
  49592. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  49593. }
  49594. if (is_object($schema) && property_exists($schema, 'id')) {
  49595. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  49596. $schema->properties->id->format = 'uri-reference';
  49597. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  49598. $schema->properties->id->format = 'uri-reference';
  49599. $schema->properties->{'$ref'}->format = 'uri-reference';
  49600. }
  49601. }
  49602. $this->expandRefs($schema, $id);
  49603. $this->schemas[$id] = $schema;
  49604. }
  49605. private function expandRefs(&$schema, $base = null)
  49606. {
  49607. if (!is_object($schema)) {
  49608. if (is_array($schema)) {
  49609. foreach ($schema as &$member) {
  49610. $this->expandRefs($member, $base);
  49611. }
  49612. }
  49613. return;
  49614. }
  49615. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  49616. $base = $this->uriResolver->resolve($schema->id, $base);
  49617. }
  49618. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  49619. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  49620. $schema->{'$ref'} = (string) $refPointer;
  49621. }
  49622. foreach ($schema as &$member) {
  49623. $this->expandRefs($member, $base);
  49624. }
  49625. }
  49626. public function getSchema($id)
  49627. {
  49628. if (!array_key_exists($id, $this->schemas)) {
  49629. $this->addSchema($id);
  49630. }
  49631. return $this->schemas[$id];
  49632. }
  49633. public function resolveRef($ref)
  49634. {
  49635. $jsonPointer = new JsonPointer($ref);
  49636. $fileName = $jsonPointer->getFilename();
  49637. if (!strlen($fileName)) {
  49638. throw new UnresolvableJsonPointerException(sprintf(
  49639. "Could not resolve fragment '%s': no file is defined",
  49640. $jsonPointer->getPropertyPathAsString()
  49641. ));
  49642. }
  49643. $refSchema = $this->getSchema($fileName);
  49644. foreach ($jsonPointer->getPropertyPaths() as $path) {
  49645. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  49646. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  49647. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  49648. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  49649. } else {
  49650. throw new UnresolvableJsonPointerException(sprintf(
  49651. 'File: %s is found, but could not resolve fragment: %s',
  49652. $jsonPointer->getFilename(),
  49653. $jsonPointer->getPropertyPathAsString()
  49654. ));
  49655. }
  49656. }
  49657. return $refSchema;
  49658. }
  49659. public function resolveRefSchema($refSchema)
  49660. {
  49661. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  49662. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  49663. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  49664. unset($refSchema->{'$ref'});
  49665. }
  49666. return $refSchema;
  49667. }
  49668. }
  49669. <?php
  49670. namespace JsonSchema;
  49671. interface SchemaStorageInterface
  49672. {
  49673. public function addSchema($id, $schema = null);
  49674. public function getSchema($id);
  49675. public function resolveRef($ref);
  49676. public function resolveRefSchema($refSchema);
  49677. }
  49678. <?php
  49679. namespace JsonSchema\Uri\Retrievers;
  49680. abstract class AbstractRetriever implements UriRetrieverInterface
  49681. {
  49682. protected $contentType;
  49683. public function getContentType()
  49684. {
  49685. return $this->contentType;
  49686. }
  49687. }
  49688. <?php
  49689. namespace JsonSchema\Uri\Retrievers;
  49690. use JsonSchema\Exception\RuntimeException;
  49691. use JsonSchema\Validator;
  49692. class Curl extends AbstractRetriever
  49693. {
  49694. protected $messageBody;
  49695. public function __construct()
  49696. {
  49697. if (!function_exists('curl_init')) {
  49698. throw new RuntimeException('cURL not installed');
  49699. }
  49700. }
  49701. public function retrieve($uri)
  49702. {
  49703. $ch = curl_init();
  49704. curl_setopt($ch, CURLOPT_URL, $uri);
  49705. curl_setopt($ch, CURLOPT_HEADER, true);
  49706. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  49707. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  49708. $response = curl_exec($ch);
  49709. if (false === $response) {
  49710. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  49711. }
  49712. $this->fetchMessageBody($response);
  49713. $this->fetchContentType($response);
  49714. curl_close($ch);
  49715. return $this->messageBody;
  49716. }
  49717. private function fetchMessageBody($response)
  49718. {
  49719. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  49720. $this->messageBody = $match[1];
  49721. }
  49722. protected function fetchContentType($response)
  49723. {
  49724. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  49725. $this->contentType = trim($match[1]);
  49726. return true;
  49727. }
  49728. return false;
  49729. }
  49730. }
  49731. <?php
  49732. namespace JsonSchema\Uri\Retrievers;
  49733. use JsonSchema\Exception\ResourceNotFoundException;
  49734. class FileGetContents extends AbstractRetriever
  49735. {
  49736. protected $messageBody;
  49737. public function retrieve($uri)
  49738. {
  49739. $errorMessage = null;
  49740. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  49741. $errorMessage = $errstr;
  49742. });
  49743. $response = file_get_contents($uri);
  49744. restore_error_handler();
  49745. if ($errorMessage) {
  49746. throw new ResourceNotFoundException($errorMessage);
  49747. }
  49748. if (false === $response) {
  49749. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49750. }
  49751. if ($response == ''
  49752. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  49753. ) {
  49754. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49755. }
  49756. $this->messageBody = $response;
  49757. if (!empty($http_response_header)) {
  49758. $this->fetchContentType($http_response_header);
  49759. } else {
  49760. $this->contentType = null;
  49761. }
  49762. return $this->messageBody;
  49763. }
  49764. private function fetchContentType(array $headers)
  49765. {
  49766. foreach ($headers as $header) {
  49767. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  49768. return true;
  49769. }
  49770. }
  49771. return false;
  49772. }
  49773. protected static function getContentTypeMatchInHeader($header)
  49774. {
  49775. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  49776. return trim($match[1]);
  49777. }
  49778. return null;
  49779. }
  49780. }
  49781. <?php
  49782. namespace JsonSchema\Uri\Retrievers;
  49783. use JsonSchema\Validator;
  49784. class PredefinedArray extends AbstractRetriever
  49785. {
  49786. private $schemas;
  49787. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  49788. {
  49789. $this->schemas = $schemas;
  49790. $this->contentType = $contentType;
  49791. }
  49792. public function retrieve($uri)
  49793. {
  49794. if (!array_key_exists($uri, $this->schemas)) {
  49795. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  49796. 'The JSON schema "%s" was not found.',
  49797. $uri
  49798. ));
  49799. }
  49800. return $this->schemas[$uri];
  49801. }
  49802. }
  49803. <?php
  49804. namespace JsonSchema\Uri\Retrievers;
  49805. interface UriRetrieverInterface
  49806. {
  49807. public function retrieve($uri);
  49808. public function getContentType();
  49809. }
  49810. <?php
  49811. namespace JsonSchema\Uri;
  49812. use JsonSchema\Exception\UriResolverException;
  49813. use JsonSchema\UriResolverInterface;
  49814. class UriResolver implements UriResolverInterface
  49815. {
  49816. public function parse($uri)
  49817. {
  49818. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49819. $components = array();
  49820. if (5 < count($match)) {
  49821. $components = array(
  49822. 'scheme' => $match[2],
  49823. 'authority' => $match[4],
  49824. 'path' => $match[5]
  49825. );
  49826. }
  49827. if (7 < count($match)) {
  49828. $components['query'] = $match[7];
  49829. }
  49830. if (9 < count($match)) {
  49831. $components['fragment'] = $match[9];
  49832. }
  49833. return $components;
  49834. }
  49835. public function generate(array $components)
  49836. {
  49837. $uri = $components['scheme'] . '://'
  49838. . $components['authority']
  49839. . $components['path'];
  49840. if (array_key_exists('query', $components) && strlen($components['query'])) {
  49841. $uri .= '?' . $components['query'];
  49842. }
  49843. if (array_key_exists('fragment', $components)) {
  49844. $uri .= '#' . $components['fragment'];
  49845. }
  49846. return $uri;
  49847. }
  49848. public function resolve($uri, $baseUri = null)
  49849. {
  49850. if (
  49851. !is_null($baseUri) &&
  49852. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  49853. !preg_match('|^[^/]+://|u', $baseUri)
  49854. ) {
  49855. if (is_file($baseUri)) {
  49856. $baseUri = 'file://' . realpath($baseUri);
  49857. } elseif (is_dir($baseUri)) {
  49858. $baseUri = 'file://' . realpath($baseUri) . '/';
  49859. } else {
  49860. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  49861. }
  49862. }
  49863. if ($uri == '') {
  49864. return $baseUri;
  49865. }
  49866. $components = $this->parse($uri);
  49867. $path = $components['path'];
  49868. if (!empty($components['scheme'])) {
  49869. return $uri;
  49870. }
  49871. $baseComponents = $this->parse($baseUri);
  49872. $basePath = $baseComponents['path'];
  49873. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  49874. if (isset($components['fragment'])) {
  49875. $baseComponents['fragment'] = $components['fragment'];
  49876. }
  49877. return $this->generate($baseComponents);
  49878. }
  49879. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  49880. {
  49881. $relativePath = self::normalizePath($relativePath);
  49882. if ($relativePath == '') {
  49883. return $basePath;
  49884. }
  49885. if ($relativePath[0] == '/') {
  49886. return $relativePath;
  49887. }
  49888. $basePathSegments = explode('/', $basePath);
  49889. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  49890. $numLevelUp = strlen($match[0]) /3 + 1;
  49891. if ($numLevelUp >= count($basePathSegments)) {
  49892. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  49893. }
  49894. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  49895. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  49896. return implode('/', $basePathSegments) . '/' . $path;
  49897. }
  49898. private static function normalizePath($path)
  49899. {
  49900. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  49901. $path = preg_replace('|//|', '/', $path);
  49902. return $path;
  49903. }
  49904. public function isValid($uri)
  49905. {
  49906. $components = $this->parse($uri);
  49907. return !empty($components);
  49908. }
  49909. }
  49910. <?php
  49911. namespace JsonSchema\Uri;
  49912. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  49913. use JsonSchema\Exception\JsonDecodingException;
  49914. use JsonSchema\Exception\ResourceNotFoundException;
  49915. use JsonSchema\Uri\Retrievers\FileGetContents;
  49916. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49917. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49918. use JsonSchema\Validator;
  49919. class UriRetriever implements BaseUriRetrieverInterface
  49920. {
  49921. protected $translationMap = array(
  49922. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49923. );
  49924. protected $allowedInvalidContentTypeEndpoints = array(
  49925. 'http://json-schema.org/',
  49926. 'https://json-schema.org/'
  49927. );
  49928. protected $uriRetriever = null;
  49929. private $schemaCache = array();
  49930. public function addInvalidContentTypeEndpoint($endpoint)
  49931. {
  49932. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  49933. }
  49934. public function confirmMediaType($uriRetriever, $uri)
  49935. {
  49936. $contentType = $uriRetriever->getContentType();
  49937. if (is_null($contentType)) {
  49938. return;
  49939. }
  49940. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  49941. return;
  49942. }
  49943. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  49944. if (strpos($uri, $endpoint) === 0) {
  49945. return true;
  49946. }
  49947. }
  49948. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  49949. }
  49950. public function getUriRetriever()
  49951. {
  49952. if (is_null($this->uriRetriever)) {
  49953. $this->setUriRetriever(new FileGetContents());
  49954. }
  49955. return $this->uriRetriever;
  49956. }
  49957. public function resolvePointer($jsonSchema, $uri)
  49958. {
  49959. $resolver = new UriResolver();
  49960. $parsed = $resolver->parse($uri);
  49961. if (empty($parsed['fragment'])) {
  49962. return $jsonSchema;
  49963. }
  49964. $path = explode('/', $parsed['fragment']);
  49965. while ($path) {
  49966. $pathElement = array_shift($path);
  49967. if (!empty($pathElement)) {
  49968. $pathElement = str_replace('~1', '/', $pathElement);
  49969. $pathElement = str_replace('~0', '~', $pathElement);
  49970. if (!empty($jsonSchema->$pathElement)) {
  49971. $jsonSchema = $jsonSchema->$pathElement;
  49972. } else {
  49973. throw new ResourceNotFoundException(
  49974. 'Fragment "' . $parsed['fragment'] . '" not found'
  49975. . ' in ' . $uri
  49976. );
  49977. }
  49978. if (!is_object($jsonSchema)) {
  49979. throw new ResourceNotFoundException(
  49980. 'Fragment part "' . $pathElement . '" is no object '
  49981. . ' in ' . $uri
  49982. );
  49983. }
  49984. }
  49985. }
  49986. return $jsonSchema;
  49987. }
  49988. public function retrieve($uri, $baseUri = null, $translate = true)
  49989. {
  49990. $resolver = new UriResolver();
  49991. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  49992. $arParts = $resolver->parse($resolvedUri);
  49993. if (isset($arParts['fragment'])) {
  49994. unset($arParts['fragment']);
  49995. $fetchUri = $resolver->generate($arParts);
  49996. }
  49997. if ($translate) {
  49998. $fetchUri = $this->translate($fetchUri);
  49999. }
  50000. $jsonSchema = $this->loadSchema($fetchUri);
  50001. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  50002. if ($jsonSchema instanceof \stdClass) {
  50003. $jsonSchema->id = $resolvedUri;
  50004. }
  50005. return $jsonSchema;
  50006. }
  50007. protected function loadSchema($fetchUri)
  50008. {
  50009. if (isset($this->schemaCache[$fetchUri])) {
  50010. return $this->schemaCache[$fetchUri];
  50011. }
  50012. $uriRetriever = $this->getUriRetriever();
  50013. $contents = $this->uriRetriever->retrieve($fetchUri);
  50014. $this->confirmMediaType($uriRetriever, $fetchUri);
  50015. $jsonSchema = json_decode($contents);
  50016. if (JSON_ERROR_NONE < $error = json_last_error()) {
  50017. throw new JsonDecodingException($error);
  50018. }
  50019. $this->schemaCache[$fetchUri] = $jsonSchema;
  50020. return $jsonSchema;
  50021. }
  50022. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  50023. {
  50024. $this->uriRetriever = $uriRetriever;
  50025. return $this;
  50026. }
  50027. public function parse($uri)
  50028. {
  50029. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  50030. $components = array();
  50031. if (5 < count($match)) {
  50032. $components = array(
  50033. 'scheme' => $match[2],
  50034. 'authority' => $match[4],
  50035. 'path' => $match[5]
  50036. );
  50037. }
  50038. if (7 < count($match)) {
  50039. $components['query'] = $match[7];
  50040. }
  50041. if (9 < count($match)) {
  50042. $components['fragment'] = $match[9];
  50043. }
  50044. return $components;
  50045. }
  50046. public function generate(array $components)
  50047. {
  50048. $uri = $components['scheme'] . '://'
  50049. . $components['authority']
  50050. . $components['path'];
  50051. if (array_key_exists('query', $components)) {
  50052. $uri .= $components['query'];
  50053. }
  50054. if (array_key_exists('fragment', $components)) {
  50055. $uri .= $components['fragment'];
  50056. }
  50057. return $uri;
  50058. }
  50059. public function resolve($uri, $baseUri = null)
  50060. {
  50061. $components = $this->parse($uri);
  50062. $path = $components['path'];
  50063. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  50064. return $uri;
  50065. }
  50066. $baseComponents = $this->parse($baseUri);
  50067. $basePath = $baseComponents['path'];
  50068. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  50069. return $this->generate($baseComponents);
  50070. }
  50071. public function isValid($uri)
  50072. {
  50073. $components = $this->parse($uri);
  50074. return !empty($components);
  50075. }
  50076. public function setTranslation($from, $to)
  50077. {
  50078. $this->translationMap[$from] = $to;
  50079. }
  50080. public function translate($uri)
  50081. {
  50082. foreach ($this->translationMap as $from => $to) {
  50083. $uri = preg_replace($from, $to, $uri);
  50084. }
  50085. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  50086. return $uri;
  50087. }
  50088. }
  50089. <?php
  50090. namespace JsonSchema;
  50091. interface UriResolverInterface
  50092. {
  50093. public function resolve($uri, $baseUri = null);
  50094. }
  50095. <?php
  50096. namespace JsonSchema;
  50097. interface UriRetrieverInterface
  50098. {
  50099. public function retrieve($uri, $baseUri = null);
  50100. }
  50101. <?php
  50102. namespace JsonSchema;
  50103. use JsonSchema\Constraints\BaseConstraint;
  50104. use JsonSchema\Constraints\Constraint;
  50105. class Validator extends BaseConstraint
  50106. {
  50107. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  50108. const ERROR_NONE = 0x00000000;
  50109. const ERROR_ALL = 0xFFFFFFFF;
  50110. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  50111. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  50112. public function validate(&$value, $schema = null, $checkMode = null)
  50113. {
  50114. if (is_array($schema)) {
  50115. $schema = self::arrayToObjectRecursive($schema);
  50116. }
  50117. $initialCheckMode = $this->factory->getConfig();
  50118. if ($checkMode !== null) {
  50119. $this->factory->setConfig($checkMode);
  50120. }
  50121. if (is_object($schema) && property_exists($schema, 'id')) {
  50122. $schemaURI = $schema->id;
  50123. } else {
  50124. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  50125. }
  50126. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  50127. $validator = $this->factory->createInstanceFor('schema');
  50128. $validator->check(
  50129. $value,
  50130. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  50131. );
  50132. $this->factory->setConfig($initialCheckMode);
  50133. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  50134. return $validator->getErrorMask();
  50135. }
  50136. public function check($value, $schema)
  50137. {
  50138. return $this->validate($value, $schema);
  50139. }
  50140. public function coerce(&$value, $schema)
  50141. {
  50142. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  50143. }
  50144. }
  50145. The MIT License (MIT)
  50146. Copyright (c) 2013-2016 container-interop
  50147. Copyright (c) 2016 PHP Framework Interoperability Group
  50148. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50149. this software and associated documentation files (the "Software"), to deal in
  50150. the Software without restriction, including without limitation the rights to
  50151. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  50152. the Software, and to permit persons to whom the Software is furnished to do so,
  50153. subject to the following conditions:
  50154. The above copyright notice and this permission notice shall be included in all
  50155. copies or substantial portions of the Software.
  50156. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50157. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  50158. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  50159. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  50160. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  50161. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  50162. <?php
  50163. namespace Psr\Container;
  50164. interface ContainerExceptionInterface
  50165. {
  50166. }
  50167. <?php
  50168. declare(strict_types=1);
  50169. namespace Psr\Container;
  50170. interface ContainerInterface
  50171. {
  50172. public function get(string $id);
  50173. public function has(string $id);
  50174. }
  50175. <?php
  50176. namespace Psr\Container;
  50177. interface NotFoundExceptionInterface extends ContainerExceptionInterface
  50178. {
  50179. }
  50180. Copyright (c) 2012 PHP Framework Interoperability Group
  50181. Permission is hereby granted, free of charge, to any person obtaining a copy
  50182. of this software and associated documentation files (the "Software"), to deal
  50183. in the Software without restriction, including without limitation the rights
  50184. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50185. copies of the Software, and to permit persons to whom the Software is
  50186. furnished to do so, subject to the following conditions:
  50187. The above copyright notice and this permission notice shall be included in
  50188. all copies or substantial portions of the Software.
  50189. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50190. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50191. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50192. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50193. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50194. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  50195. THE SOFTWARE.
  50196. <?php
  50197. namespace Psr\Log;
  50198. abstract class AbstractLogger implements LoggerInterface
  50199. {
  50200. public function emergency($message, array $context = array())
  50201. {
  50202. $this->log(LogLevel::EMERGENCY, $message, $context);
  50203. }
  50204. public function alert($message, array $context = array())
  50205. {
  50206. $this->log(LogLevel::ALERT, $message, $context);
  50207. }
  50208. public function critical($message, array $context = array())
  50209. {
  50210. $this->log(LogLevel::CRITICAL, $message, $context);
  50211. }
  50212. public function error($message, array $context = array())
  50213. {
  50214. $this->log(LogLevel::ERROR, $message, $context);
  50215. }
  50216. public function warning($message, array $context = array())
  50217. {
  50218. $this->log(LogLevel::WARNING, $message, $context);
  50219. }
  50220. public function notice($message, array $context = array())
  50221. {
  50222. $this->log(LogLevel::NOTICE, $message, $context);
  50223. }
  50224. public function info($message, array $context = array())
  50225. {
  50226. $this->log(LogLevel::INFO, $message, $context);
  50227. }
  50228. public function debug($message, array $context = array())
  50229. {
  50230. $this->log(LogLevel::DEBUG, $message, $context);
  50231. }
  50232. }
  50233. <?php
  50234. namespace Psr\Log;
  50235. class InvalidArgumentException extends \InvalidArgumentException
  50236. {
  50237. }
  50238. <?php
  50239. namespace Psr\Log;
  50240. class LogLevel
  50241. {
  50242. const EMERGENCY = 'emergency';
  50243. const ALERT = 'alert';
  50244. const CRITICAL = 'critical';
  50245. const ERROR = 'error';
  50246. const WARNING = 'warning';
  50247. const NOTICE = 'notice';
  50248. const INFO = 'info';
  50249. const DEBUG = 'debug';
  50250. }
  50251. <?php
  50252. namespace Psr\Log;
  50253. interface LoggerAwareInterface
  50254. {
  50255. public function setLogger(LoggerInterface $logger);
  50256. }
  50257. <?php
  50258. namespace Psr\Log;
  50259. trait LoggerAwareTrait
  50260. {
  50261. protected $logger;
  50262. public function setLogger(LoggerInterface $logger)
  50263. {
  50264. $this->logger = $logger;
  50265. }
  50266. }
  50267. <?php
  50268. namespace Psr\Log;
  50269. interface LoggerInterface
  50270. {
  50271. public function emergency($message, array $context = array());
  50272. public function alert($message, array $context = array());
  50273. public function critical($message, array $context = array());
  50274. public function error($message, array $context = array());
  50275. public function warning($message, array $context = array());
  50276. public function notice($message, array $context = array());
  50277. public function info($message, array $context = array());
  50278. public function debug($message, array $context = array());
  50279. public function log($level, $message, array $context = array());
  50280. }
  50281. <?php
  50282. namespace Psr\Log;
  50283. trait LoggerTrait
  50284. {
  50285. public function emergency($message, array $context = array())
  50286. {
  50287. $this->log(LogLevel::EMERGENCY, $message, $context);
  50288. }
  50289. public function alert($message, array $context = array())
  50290. {
  50291. $this->log(LogLevel::ALERT, $message, $context);
  50292. }
  50293. public function critical($message, array $context = array())
  50294. {
  50295. $this->log(LogLevel::CRITICAL, $message, $context);
  50296. }
  50297. public function error($message, array $context = array())
  50298. {
  50299. $this->log(LogLevel::ERROR, $message, $context);
  50300. }
  50301. public function warning($message, array $context = array())
  50302. {
  50303. $this->log(LogLevel::WARNING, $message, $context);
  50304. }
  50305. public function notice($message, array $context = array())
  50306. {
  50307. $this->log(LogLevel::NOTICE, $message, $context);
  50308. }
  50309. public function info($message, array $context = array())
  50310. {
  50311. $this->log(LogLevel::INFO, $message, $context);
  50312. }
  50313. public function debug($message, array $context = array())
  50314. {
  50315. $this->log(LogLevel::DEBUG, $message, $context);
  50316. }
  50317. abstract public function log($level, $message, array $context = array());
  50318. }
  50319. <?php
  50320. namespace Psr\Log;
  50321. class NullLogger extends AbstractLogger
  50322. {
  50323. public function log($level, $message, array $context = array())
  50324. {
  50325. }
  50326. }
  50327. <?php
  50328. namespace Psr\Log\Test;
  50329. class DummyTest
  50330. {
  50331. public function __toString()
  50332. {
  50333. return 'DummyTest';
  50334. }
  50335. }
  50336. <?php
  50337. namespace Psr\Log\Test;
  50338. use Psr\Log\LoggerInterface;
  50339. use Psr\Log\LogLevel;
  50340. use PHPUnit\Framework\TestCase;
  50341. abstract class LoggerInterfaceTest extends TestCase
  50342. {
  50343. abstract public function getLogger();
  50344. abstract public function getLogs();
  50345. public function testImplements()
  50346. {
  50347. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  50348. }
  50349. public function testLogsAtAllLevels($level, $message)
  50350. {
  50351. $logger = $this->getLogger();
  50352. $logger->{$level}($message, array('user' => 'Bob'));
  50353. $logger->log($level, $message, array('user' => 'Bob'));
  50354. $expected = array(
  50355. $level.' message of level '.$level.' with context: Bob',
  50356. $level.' message of level '.$level.' with context: Bob',
  50357. );
  50358. $this->assertEquals($expected, $this->getLogs());
  50359. }
  50360. public function provideLevelsAndMessages()
  50361. {
  50362. return array(
  50363. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  50364. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  50365. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  50366. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  50367. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  50368. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  50369. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  50370. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  50371. );
  50372. }
  50373. public function testThrowsOnInvalidLevel()
  50374. {
  50375. $logger = $this->getLogger();
  50376. $logger->log('invalid level', 'Foo');
  50377. }
  50378. public function testContextReplacement()
  50379. {
  50380. $logger = $this->getLogger();
  50381. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  50382. $expected = array('info {Message {nothing} Bob Bar a}');
  50383. $this->assertEquals($expected, $this->getLogs());
  50384. }
  50385. public function testObjectCastToString()
  50386. {
  50387. if (method_exists($this, 'createPartialMock')) {
  50388. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  50389. } else {
  50390. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  50391. }
  50392. $dummy->expects($this->once())
  50393. ->method('__toString')
  50394. ->will($this->returnValue('DUMMY'));
  50395. $this->getLogger()->warning($dummy);
  50396. $expected = array('warning DUMMY');
  50397. $this->assertEquals($expected, $this->getLogs());
  50398. }
  50399. public function testContextCanContainAnything()
  50400. {
  50401. $closed = fopen('php://memory', 'r');
  50402. fclose($closed);
  50403. $context = array(
  50404. 'bool' => true,
  50405. 'null' => null,
  50406. 'string' => 'Foo',
  50407. 'int' => 0,
  50408. 'float' => 0.5,
  50409. 'nested' => array('with object' => new DummyTest),
  50410. 'object' => new \DateTime,
  50411. 'resource' => fopen('php://memory', 'r'),
  50412. 'closed' => $closed,
  50413. );
  50414. $this->getLogger()->warning('Crazy context data', $context);
  50415. $expected = array('warning Crazy context data');
  50416. $this->assertEquals($expected, $this->getLogs());
  50417. }
  50418. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  50419. {
  50420. $logger = $this->getLogger();
  50421. $logger->warning('Random message', array('exception' => 'oops'));
  50422. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  50423. $expected = array(
  50424. 'warning Random message',
  50425. 'critical Uncaught Exception!'
  50426. );
  50427. $this->assertEquals($expected, $this->getLogs());
  50428. }
  50429. }
  50430. <?php
  50431. namespace Psr\Log\Test;
  50432. use Psr\Log\AbstractLogger;
  50433. class TestLogger extends AbstractLogger
  50434. {
  50435. public $records = [];
  50436. public $recordsByLevel = [];
  50437. public function log($level, $message, array $context = [])
  50438. {
  50439. $record = [
  50440. 'level' => $level,
  50441. 'message' => $message,
  50442. 'context' => $context,
  50443. ];
  50444. $this->recordsByLevel[$record['level']][] = $record;
  50445. $this->records[] = $record;
  50446. }
  50447. public function hasRecords($level)
  50448. {
  50449. return isset($this->recordsByLevel[$level]);
  50450. }
  50451. public function hasRecord($record, $level)
  50452. {
  50453. if (is_string($record)) {
  50454. $record = ['message' => $record];
  50455. }
  50456. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  50457. if ($rec['message'] !== $record['message']) {
  50458. return false;
  50459. }
  50460. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  50461. return false;
  50462. }
  50463. return true;
  50464. }, $level);
  50465. }
  50466. public function hasRecordThatContains($message, $level)
  50467. {
  50468. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  50469. return strpos($rec['message'], $message) !== false;
  50470. }, $level);
  50471. }
  50472. public function hasRecordThatMatches($regex, $level)
  50473. {
  50474. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  50475. return preg_match($regex, $rec['message']) > 0;
  50476. }, $level);
  50477. }
  50478. public function hasRecordThatPasses(callable $predicate, $level)
  50479. {
  50480. if (!isset($this->recordsByLevel[$level])) {
  50481. return false;
  50482. }
  50483. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  50484. if (call_user_func($predicate, $rec, $i)) {
  50485. return true;
  50486. }
  50487. }
  50488. return false;
  50489. }
  50490. public function __call($method, $args)
  50491. {
  50492. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  50493. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  50494. $level = strtolower($matches[2]);
  50495. if (method_exists($this, $genericMethod)) {
  50496. $args[] = $level;
  50497. return call_user_func_array([$this, $genericMethod], $args);
  50498. }
  50499. }
  50500. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  50501. }
  50502. public function reset()
  50503. {
  50504. $this->records = [];
  50505. $this->recordsByLevel = [];
  50506. }
  50507. }
  50508. The MIT License (MIT)
  50509. Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden
  50510. Permission is hereby granted, free of charge, to any person
  50511. obtaining a copy of this software and associated documentation
  50512. files (the "Software"), to deal in the Software without
  50513. restriction, including without limitation the rights to use,
  50514. copy, modify, merge, publish, distribute, sublicense, and/or sell
  50515. copies of the Software, and to permit persons to whom the
  50516. Software is furnished to do so, subject to the following
  50517. conditions:
  50518. The above copyright notice and this permission notice shall be
  50519. included in all copies or substantial portions of the Software.
  50520. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  50521. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  50522. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  50523. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  50524. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  50525. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  50526. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  50527. OTHER DEALINGS IN THE SOFTWARE.
  50528. <?php
  50529. namespace React\Promise;
  50530. interface CancellablePromiseInterface extends PromiseInterface
  50531. {
  50532. public function cancel();
  50533. }
  50534. <?php
  50535. namespace React\Promise;
  50536. class CancellationQueue
  50537. {
  50538. private $started = false;
  50539. private $queue = [];
  50540. public function __invoke()
  50541. {
  50542. if ($this->started) {
  50543. return;
  50544. }
  50545. $this->started = true;
  50546. $this->drain();
  50547. }
  50548. public function enqueue($cancellable)
  50549. {
  50550. if (!\is_object($cancellable) || !\method_exists($cancellable, 'then') || !\method_exists($cancellable, 'cancel')) {
  50551. return;
  50552. }
  50553. $length = \array_push($this->queue, $cancellable);
  50554. if ($this->started && 1 === $length) {
  50555. $this->drain();
  50556. }
  50557. }
  50558. private function drain()
  50559. {
  50560. for ($i = key($this->queue); isset($this->queue[$i]); $i++) {
  50561. $cancellable = $this->queue[$i];
  50562. $exception = null;
  50563. try {
  50564. $cancellable->cancel();
  50565. } catch (\Throwable $exception) {
  50566. } catch (\Exception $exception) {
  50567. }
  50568. unset($this->queue[$i]);
  50569. if ($exception) {
  50570. throw $exception;
  50571. }
  50572. }
  50573. $this->queue = [];
  50574. }
  50575. }
  50576. <?php
  50577. namespace React\Promise;
  50578. class Deferred implements PromisorInterface
  50579. {
  50580. private $promise;
  50581. private $resolveCallback;
  50582. private $rejectCallback;
  50583. private $notifyCallback;
  50584. private $canceller;
  50585. public function __construct(callable $canceller = null)
  50586. {
  50587. $this->canceller = $canceller;
  50588. }
  50589. public function promise()
  50590. {
  50591. if (null === $this->promise) {
  50592. $this->promise = new Promise(function ($resolve, $reject, $notify) {
  50593. $this->resolveCallback = $resolve;
  50594. $this->rejectCallback = $reject;
  50595. $this->notifyCallback = $notify;
  50596. }, $this->canceller);
  50597. $this->canceller = null;
  50598. }
  50599. return $this->promise;
  50600. }
  50601. public function resolve($value = null)
  50602. {
  50603. $this->promise();
  50604. \call_user_func($this->resolveCallback, $value);
  50605. }
  50606. public function reject($reason = null)
  50607. {
  50608. $this->promise();
  50609. \call_user_func($this->rejectCallback, $reason);
  50610. }
  50611. public function notify($update = null)
  50612. {
  50613. $this->promise();
  50614. \call_user_func($this->notifyCallback, $update);
  50615. }
  50616. public function progress($update = null)
  50617. {
  50618. $this->notify($update);
  50619. }
  50620. }
  50621. <?php
  50622. namespace React\Promise\Exception;
  50623. class LengthException extends \LengthException
  50624. {
  50625. }
  50626. <?php
  50627. namespace React\Promise;
  50628. interface ExtendedPromiseInterface extends PromiseInterface
  50629. {
  50630. public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
  50631. public function otherwise(callable $onRejected);
  50632. public function always(callable $onFulfilledOrRejected);
  50633. public function progress(callable $onProgress);
  50634. }
  50635. <?php
  50636. namespace React\Promise;
  50637. class FulfilledPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
  50638. {
  50639. private $value;
  50640. public function __construct($value = null)
  50641. {
  50642. if ($value instanceof PromiseInterface) {
  50643. throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.');
  50644. }
  50645. $this->value = $value;
  50646. }
  50647. public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50648. {
  50649. if (null === $onFulfilled) {
  50650. return $this;
  50651. }
  50652. try {
  50653. return resolve($onFulfilled($this->value));
  50654. } catch (\Throwable $exception) {
  50655. return new RejectedPromise($exception);
  50656. } catch (\Exception $exception) {
  50657. return new RejectedPromise($exception);
  50658. }
  50659. }
  50660. public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50661. {
  50662. if (null === $onFulfilled) {
  50663. return;
  50664. }
  50665. $result = $onFulfilled($this->value);
  50666. if ($result instanceof ExtendedPromiseInterface) {
  50667. $result->done();
  50668. }
  50669. }
  50670. public function otherwise(callable $onRejected)
  50671. {
  50672. return $this;
  50673. }
  50674. public function always(callable $onFulfilledOrRejected)
  50675. {
  50676. return $this->then(function ($value) use ($onFulfilledOrRejected) {
  50677. return resolve($onFulfilledOrRejected())->then(function () use ($value) {
  50678. return $value;
  50679. });
  50680. });
  50681. }
  50682. public function progress(callable $onProgress)
  50683. {
  50684. return $this;
  50685. }
  50686. public function cancel()
  50687. {
  50688. }
  50689. }
  50690. <?php
  50691. namespace React\Promise;
  50692. class LazyPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
  50693. {
  50694. private $factory;
  50695. private $promise;
  50696. public function __construct(callable $factory)
  50697. {
  50698. $this->factory = $factory;
  50699. }
  50700. public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50701. {
  50702. return $this->promise()->then($onFulfilled, $onRejected, $onProgress);
  50703. }
  50704. public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50705. {
  50706. return $this->promise()->done($onFulfilled, $onRejected, $onProgress);
  50707. }
  50708. public function otherwise(callable $onRejected)
  50709. {
  50710. return $this->promise()->otherwise($onRejected);
  50711. }
  50712. public function always(callable $onFulfilledOrRejected)
  50713. {
  50714. return $this->promise()->always($onFulfilledOrRejected);
  50715. }
  50716. public function progress(callable $onProgress)
  50717. {
  50718. return $this->promise()->progress($onProgress);
  50719. }
  50720. public function cancel()
  50721. {
  50722. return $this->promise()->cancel();
  50723. }
  50724. public function promise()
  50725. {
  50726. if (null === $this->promise) {
  50727. try {
  50728. $this->promise = resolve(\call_user_func($this->factory));
  50729. } catch (\Throwable $exception) {
  50730. $this->promise = new RejectedPromise($exception);
  50731. } catch (\Exception $exception) {
  50732. $this->promise = new RejectedPromise($exception);
  50733. }
  50734. }
  50735. return $this->promise;
  50736. }
  50737. }
  50738. <?php
  50739. namespace React\Promise;
  50740. class Promise implements ExtendedPromiseInterface, CancellablePromiseInterface
  50741. {
  50742. private $canceller;
  50743. private $result;
  50744. private $handlers = [];
  50745. private $progressHandlers = [];
  50746. private $requiredCancelRequests = 0;
  50747. private $cancelRequests = 0;
  50748. public function __construct(callable $resolver, callable $canceller = null)
  50749. {
  50750. $this->canceller = $canceller;
  50751. $cb = $resolver;
  50752. $resolver = $canceller = null;
  50753. $this->call($cb);
  50754. }
  50755. public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50756. {
  50757. if (null !== $this->result) {
  50758. return $this->result->then($onFulfilled, $onRejected, $onProgress);
  50759. }
  50760. if (null === $this->canceller) {
  50761. return new static($this->resolver($onFulfilled, $onRejected, $onProgress));
  50762. }
  50763. $parent = $this;
  50764. ++$parent->requiredCancelRequests;
  50765. return new static(
  50766. $this->resolver($onFulfilled, $onRejected, $onProgress),
  50767. static function () use (&$parent) {
  50768. if (++$parent->cancelRequests >= $parent->requiredCancelRequests) {
  50769. $parent->cancel();
  50770. }
  50771. $parent = null;
  50772. }
  50773. );
  50774. }
  50775. public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50776. {
  50777. if (null !== $this->result) {
  50778. return $this->result->done($onFulfilled, $onRejected, $onProgress);
  50779. }
  50780. $this->handlers[] = static function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected) {
  50781. $promise
  50782. ->done($onFulfilled, $onRejected);
  50783. };
  50784. if ($onProgress) {
  50785. $this->progressHandlers[] = $onProgress;
  50786. }
  50787. }
  50788. public function otherwise(callable $onRejected)
  50789. {
  50790. return $this->then(null, static function ($reason) use ($onRejected) {
  50791. if (!_checkTypehint($onRejected, $reason)) {
  50792. return new RejectedPromise($reason);
  50793. }
  50794. return $onRejected($reason);
  50795. });
  50796. }
  50797. public function always(callable $onFulfilledOrRejected)
  50798. {
  50799. return $this->then(static function ($value) use ($onFulfilledOrRejected) {
  50800. return resolve($onFulfilledOrRejected())->then(function () use ($value) {
  50801. return $value;
  50802. });
  50803. }, static function ($reason) use ($onFulfilledOrRejected) {
  50804. return resolve($onFulfilledOrRejected())->then(function () use ($reason) {
  50805. return new RejectedPromise($reason);
  50806. });
  50807. });
  50808. }
  50809. public function progress(callable $onProgress)
  50810. {
  50811. return $this->then(null, null, $onProgress);
  50812. }
  50813. public function cancel()
  50814. {
  50815. if (null === $this->canceller || null !== $this->result) {
  50816. return;
  50817. }
  50818. $canceller = $this->canceller;
  50819. $this->canceller = null;
  50820. $this->call($canceller);
  50821. }
  50822. private function resolver(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50823. {
  50824. return function ($resolve, $reject, $notify) use ($onFulfilled, $onRejected, $onProgress) {
  50825. if ($onProgress) {
  50826. $progressHandler = static function ($update) use ($notify, $onProgress) {
  50827. try {
  50828. $notify($onProgress($update));
  50829. } catch (\Throwable $e) {
  50830. $notify($e);
  50831. } catch (\Exception $e) {
  50832. $notify($e);
  50833. }
  50834. };
  50835. } else {
  50836. $progressHandler = $notify;
  50837. }
  50838. $this->handlers[] = static function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
  50839. $promise
  50840. ->then($onFulfilled, $onRejected)
  50841. ->done($resolve, $reject, $progressHandler);
  50842. };
  50843. $this->progressHandlers[] = $progressHandler;
  50844. };
  50845. }
  50846. private function reject($reason = null)
  50847. {
  50848. if (null !== $this->result) {
  50849. return;
  50850. }
  50851. $this->settle(reject($reason));
  50852. }
  50853. private function settle(ExtendedPromiseInterface $promise)
  50854. {
  50855. $promise = $this->unwrap($promise);
  50856. if ($promise === $this) {
  50857. $promise = new RejectedPromise(
  50858. new \LogicException('Cannot resolve a promise with itself.')
  50859. );
  50860. }
  50861. $handlers = $this->handlers;
  50862. $this->progressHandlers = $this->handlers = [];
  50863. $this->result = $promise;
  50864. $this->canceller = null;
  50865. foreach ($handlers as $handler) {
  50866. $handler($promise);
  50867. }
  50868. }
  50869. private function unwrap($promise)
  50870. {
  50871. $promise = $this->extract($promise);
  50872. while ($promise instanceof self && null !== $promise->result) {
  50873. $promise = $this->extract($promise->result);
  50874. }
  50875. return $promise;
  50876. }
  50877. private function extract($promise)
  50878. {
  50879. if ($promise instanceof LazyPromise) {
  50880. $promise = $promise->promise();
  50881. }
  50882. return $promise;
  50883. }
  50884. private function call(callable $cb)
  50885. {
  50886. $callback = $cb;
  50887. $cb = null;
  50888. if (\is_array($callback)) {
  50889. $ref = new \ReflectionMethod($callback[0], $callback[1]);
  50890. } elseif (\is_object($callback) && !$callback instanceof \Closure) {
  50891. $ref = new \ReflectionMethod($callback, '__invoke');
  50892. } else {
  50893. $ref = new \ReflectionFunction($callback);
  50894. }
  50895. $args = $ref->getNumberOfParameters();
  50896. try {
  50897. if ($args === 0) {
  50898. $callback();
  50899. } else {
  50900. $target =& $this;
  50901. $progressHandlers =& $this->progressHandlers;
  50902. $callback(
  50903. static function ($value = null) use (&$target) {
  50904. if ($target !== null) {
  50905. $target->settle(resolve($value));
  50906. $target = null;
  50907. }
  50908. },
  50909. static function ($reason = null) use (&$target) {
  50910. if ($target !== null) {
  50911. $target->reject($reason);
  50912. $target = null;
  50913. }
  50914. },
  50915. static function ($update = null) use (&$progressHandlers) {
  50916. foreach ($progressHandlers as $handler) {
  50917. $handler($update);
  50918. }
  50919. }
  50920. );
  50921. }
  50922. } catch (\Throwable $e) {
  50923. $target = null;
  50924. $this->reject($e);
  50925. } catch (\Exception $e) {
  50926. $target = null;
  50927. $this->reject($e);
  50928. }
  50929. }
  50930. }
  50931. <?php
  50932. namespace React\Promise;
  50933. interface PromiseInterface
  50934. {
  50935. public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
  50936. }
  50937. <?php
  50938. namespace React\Promise;
  50939. interface PromisorInterface
  50940. {
  50941. public function promise();
  50942. }
  50943. <?php
  50944. namespace React\Promise;
  50945. class RejectedPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
  50946. {
  50947. private $reason;
  50948. public function __construct($reason = null)
  50949. {
  50950. if ($reason instanceof PromiseInterface) {
  50951. throw new \InvalidArgumentException('You cannot create React\Promise\RejectedPromise with a promise. Use React\Promise\reject($promiseOrValue) instead.');
  50952. }
  50953. $this->reason = $reason;
  50954. }
  50955. public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50956. {
  50957. if (null === $onRejected) {
  50958. return $this;
  50959. }
  50960. try {
  50961. return resolve($onRejected($this->reason));
  50962. } catch (\Throwable $exception) {
  50963. return new RejectedPromise($exception);
  50964. } catch (\Exception $exception) {
  50965. return new RejectedPromise($exception);
  50966. }
  50967. }
  50968. public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
  50969. {
  50970. if (null === $onRejected) {
  50971. throw UnhandledRejectionException::resolve($this->reason);
  50972. }
  50973. $result = $onRejected($this->reason);
  50974. if ($result instanceof self) {
  50975. throw UnhandledRejectionException::resolve($result->reason);
  50976. }
  50977. if ($result instanceof ExtendedPromiseInterface) {
  50978. $result->done();
  50979. }
  50980. }
  50981. public function otherwise(callable $onRejected)
  50982. {
  50983. if (!_checkTypehint($onRejected, $this->reason)) {
  50984. return $this;
  50985. }
  50986. return $this->then(null, $onRejected);
  50987. }
  50988. public function always(callable $onFulfilledOrRejected)
  50989. {
  50990. return $this->then(null, function ($reason) use ($onFulfilledOrRejected) {
  50991. return resolve($onFulfilledOrRejected())->then(function () use ($reason) {
  50992. return new RejectedPromise($reason);
  50993. });
  50994. });
  50995. }
  50996. public function progress(callable $onProgress)
  50997. {
  50998. return $this;
  50999. }
  51000. public function cancel()
  51001. {
  51002. }
  51003. }
  51004. <?php
  51005. namespace React\Promise;
  51006. class UnhandledRejectionException extends \RuntimeException
  51007. {
  51008. private $reason;
  51009. public static function resolve($reason)
  51010. {
  51011. if ($reason instanceof \Exception || $reason instanceof \Throwable) {
  51012. return $reason;
  51013. }
  51014. return new static($reason);
  51015. }
  51016. public function __construct($reason)
  51017. {
  51018. $this->reason = $reason;
  51019. $message = \sprintf('Unhandled Rejection: %s', \json_encode($reason));
  51020. parent::__construct($message, 0);
  51021. }
  51022. public function getReason()
  51023. {
  51024. return $this->reason;
  51025. }
  51026. }
  51027. <?php
  51028. namespace React\Promise;
  51029. function resolve($promiseOrValue = null)
  51030. {
  51031. if ($promiseOrValue instanceof ExtendedPromiseInterface) {
  51032. return $promiseOrValue;
  51033. }
  51034. if (\is_object($promiseOrValue) && \method_exists($promiseOrValue, 'then')) {
  51035. $canceller = null;
  51036. if (\method_exists($promiseOrValue, 'cancel')) {
  51037. $canceller = [$promiseOrValue, 'cancel'];
  51038. }
  51039. return new Promise(function ($resolve, $reject, $notify) use ($promiseOrValue) {
  51040. $promiseOrValue->then($resolve, $reject, $notify);
  51041. }, $canceller);
  51042. }
  51043. return new FulfilledPromise($promiseOrValue);
  51044. }
  51045. function reject($promiseOrValue = null)
  51046. {
  51047. if ($promiseOrValue instanceof PromiseInterface) {
  51048. return resolve($promiseOrValue)->then(function ($value) {
  51049. return new RejectedPromise($value);
  51050. });
  51051. }
  51052. return new RejectedPromise($promiseOrValue);
  51053. }
  51054. function all($promisesOrValues)
  51055. {
  51056. return map($promisesOrValues, function ($val) {
  51057. return $val;
  51058. });
  51059. }
  51060. function race($promisesOrValues)
  51061. {
  51062. $cancellationQueue = new CancellationQueue();
  51063. $cancellationQueue->enqueue($promisesOrValues);
  51064. return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $cancellationQueue) {
  51065. resolve($promisesOrValues)
  51066. ->done(function ($array) use ($cancellationQueue, $resolve, $reject, $notify) {
  51067. if (!is_array($array) || !$array) {
  51068. $resolve();
  51069. return;
  51070. }
  51071. foreach ($array as $promiseOrValue) {
  51072. $cancellationQueue->enqueue($promiseOrValue);
  51073. resolve($promiseOrValue)
  51074. ->done($resolve, $reject, $notify);
  51075. }
  51076. }, $reject, $notify);
  51077. }, $cancellationQueue);
  51078. }
  51079. function any($promisesOrValues)
  51080. {
  51081. return some($promisesOrValues, 1)
  51082. ->then(function ($val) {
  51083. return \array_shift($val);
  51084. });
  51085. }
  51086. function some($promisesOrValues, $howMany)
  51087. {
  51088. $cancellationQueue = new CancellationQueue();
  51089. $cancellationQueue->enqueue($promisesOrValues);
  51090. return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $howMany, $cancellationQueue) {
  51091. resolve($promisesOrValues)
  51092. ->done(function ($array) use ($howMany, $cancellationQueue, $resolve, $reject, $notify) {
  51093. if (!\is_array($array) || $howMany < 1) {
  51094. $resolve([]);
  51095. return;
  51096. }
  51097. $len = \count($array);
  51098. if ($len < $howMany) {
  51099. throw new Exception\LengthException(
  51100. \sprintf(
  51101. 'Input array must contain at least %d item%s but contains only %s item%s.',
  51102. $howMany,
  51103. 1 === $howMany ? '' : 's',
  51104. $len,
  51105. 1 === $len ? '' : 's'
  51106. )
  51107. );
  51108. }
  51109. $toResolve = $howMany;
  51110. $toReject = ($len - $toResolve) + 1;
  51111. $values = [];
  51112. $reasons = [];
  51113. foreach ($array as $i => $promiseOrValue) {
  51114. $fulfiller = function ($val) use ($i, &$values, &$toResolve, $toReject, $resolve) {
  51115. if ($toResolve < 1 || $toReject < 1) {
  51116. return;
  51117. }
  51118. $values[$i] = $val;
  51119. if (0 === --$toResolve) {
  51120. $resolve($values);
  51121. }
  51122. };
  51123. $rejecter = function ($reason) use ($i, &$reasons, &$toReject, $toResolve, $reject) {
  51124. if ($toResolve < 1 || $toReject < 1) {
  51125. return;
  51126. }
  51127. $reasons[$i] = $reason;
  51128. if (0 === --$toReject) {
  51129. $reject($reasons);
  51130. }
  51131. };
  51132. $cancellationQueue->enqueue($promiseOrValue);
  51133. resolve($promiseOrValue)
  51134. ->done($fulfiller, $rejecter, $notify);
  51135. }
  51136. }, $reject, $notify);
  51137. }, $cancellationQueue);
  51138. }
  51139. function map($promisesOrValues, callable $mapFunc)
  51140. {
  51141. $cancellationQueue = new CancellationQueue();
  51142. $cancellationQueue->enqueue($promisesOrValues);
  51143. return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $mapFunc, $cancellationQueue) {
  51144. resolve($promisesOrValues)
  51145. ->done(function ($array) use ($mapFunc, $cancellationQueue, $resolve, $reject, $notify) {
  51146. if (!\is_array($array) || !$array) {
  51147. $resolve([]);
  51148. return;
  51149. }
  51150. $toResolve = \count($array);
  51151. $values = [];
  51152. foreach ($array as $i => $promiseOrValue) {
  51153. $cancellationQueue->enqueue($promiseOrValue);
  51154. $values[$i] = null;
  51155. resolve($promiseOrValue)
  51156. ->then($mapFunc)
  51157. ->done(
  51158. function ($mapped) use ($i, &$values, &$toResolve, $resolve) {
  51159. $values[$i] = $mapped;
  51160. if (0 === --$toResolve) {
  51161. $resolve($values);
  51162. }
  51163. },
  51164. $reject,
  51165. $notify
  51166. );
  51167. }
  51168. }, $reject, $notify);
  51169. }, $cancellationQueue);
  51170. }
  51171. function reduce($promisesOrValues, callable $reduceFunc, $initialValue = null)
  51172. {
  51173. $cancellationQueue = new CancellationQueue();
  51174. $cancellationQueue->enqueue($promisesOrValues);
  51175. return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $reduceFunc, $initialValue, $cancellationQueue) {
  51176. resolve($promisesOrValues)
  51177. ->done(function ($array) use ($reduceFunc, $initialValue, $cancellationQueue, $resolve, $reject, $notify) {
  51178. if (!\is_array($array)) {
  51179. $array = [];
  51180. }
  51181. $total = \count($array);
  51182. $i = 0;
  51183. $wrappedReduceFunc = function ($current, $val) use ($reduceFunc, $cancellationQueue, $total, &$i) {
  51184. $cancellationQueue->enqueue($val);
  51185. return $current
  51186. ->then(function ($c) use ($reduceFunc, $total, &$i, $val) {
  51187. return resolve($val)
  51188. ->then(function ($value) use ($reduceFunc, $total, &$i, $c) {
  51189. return $reduceFunc($c, $value, $i++, $total);
  51190. });
  51191. });
  51192. };
  51193. $cancellationQueue->enqueue($initialValue);
  51194. \array_reduce($array, $wrappedReduceFunc, resolve($initialValue))
  51195. ->done($resolve, $reject, $notify);
  51196. }, $reject, $notify);
  51197. }, $cancellationQueue);
  51198. }
  51199. function _checkTypehint(callable $callback, $object)
  51200. {
  51201. if (!\is_object($object)) {
  51202. return true;
  51203. }
  51204. if (\is_array($callback)) {
  51205. $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]);
  51206. } elseif (\is_object($callback) && !$callback instanceof \Closure) {
  51207. $callbackReflection = new \ReflectionMethod($callback, '__invoke');
  51208. } else {
  51209. $callbackReflection = new \ReflectionFunction($callback);
  51210. }
  51211. $parameters = $callbackReflection->getParameters();
  51212. if (!isset($parameters[0])) {
  51213. return true;
  51214. }
  51215. $expectedException = $parameters[0];
  51216. if (\PHP_VERSION_ID < 70100 || \defined('HHVM_VERSION')) {
  51217. if (!$expectedException->getClass()) {
  51218. return true;
  51219. }
  51220. return $expectedException->getClass()->isInstance($object);
  51221. }
  51222. $type = $expectedException->getType();
  51223. $isTypeUnion = true;
  51224. $types = [];
  51225. switch (true) {
  51226. case $type === null:
  51227. break;
  51228. case $type instanceof \ReflectionNamedType:
  51229. $types = [$type];
  51230. break;
  51231. case $type instanceof \ReflectionIntersectionType:
  51232. $isTypeUnion = false;
  51233. case $type instanceof \ReflectionUnionType;
  51234. $types = $type->getTypes();
  51235. break;
  51236. default:
  51237. throw new \LogicException('Unexpected return value of ReflectionParameter::getType');
  51238. }
  51239. if (empty($types)) {
  51240. return true;
  51241. }
  51242. foreach ($types as $type) {
  51243. if (!$type instanceof \ReflectionNamedType) {
  51244. throw new \LogicException('This implementation does not support groups of intersection or union types');
  51245. }
  51246. $matches = ($type->isBuiltin() && \gettype($object) === $type->getName())
  51247. || (new \ReflectionClass($type->getName()))->isInstance($object);
  51248. if ($matches) {
  51249. if ($isTypeUnion) {
  51250. return true;
  51251. }
  51252. } else {
  51253. if (!$isTypeUnion) {
  51254. return false;
  51255. }
  51256. }
  51257. }
  51258. return $isTypeUnion ? false : true;
  51259. }
  51260. <?php
  51261. if (!\function_exists('React\Promise\resolve')) {
  51262. require __DIR__.'/functions.php';
  51263. }
  51264. Copyright (c) 2011 Jordi Boggiano
  51265. Permission is hereby granted, free of charge, to any person obtaining a copy
  51266. of this software and associated documentation files (the "Software"), to deal
  51267. in the Software without restriction, including without limitation the rights
  51268. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51269. copies of the Software, and to permit persons to whom the Software is furnished
  51270. to do so, subject to the following conditions:
  51271. The above copyright notice and this permission notice shall be included in all
  51272. copies or substantial portions of the Software.
  51273. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51274. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51275. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51276. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51277. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51278. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51279. THE SOFTWARE.
  51280. <?php
  51281. namespace Seld\JsonLint;
  51282. class DuplicateKeyException extends ParsingException
  51283. {
  51284. protected $details;
  51285. public function __construct($message, $key, array $details)
  51286. {
  51287. $details['key'] = $key;
  51288. parent::__construct($message, $details);
  51289. }
  51290. public function getKey()
  51291. {
  51292. return $this->details['key'];
  51293. }
  51294. public function getDetails()
  51295. {
  51296. return $this->details;
  51297. }
  51298. }
  51299. <?php
  51300. namespace Seld\JsonLint;
  51301. use stdClass;
  51302. class JsonParser
  51303. {
  51304. const DETECT_KEY_CONFLICTS = 1;
  51305. const ALLOW_DUPLICATE_KEYS = 2;
  51306. const PARSE_TO_ASSOC = 4;
  51307. private $lexer;
  51308. private $flags;
  51309. private $stack;
  51310. private $vstack;
  51311. private $lstack;
  51312. private $symbols = array(
  51313. 'error' => 2,
  51314. 'JSONString' => 3,
  51315. 'STRING' => 4,
  51316. 'JSONNumber' => 5,
  51317. 'NUMBER' => 6,
  51318. 'JSONNullLiteral' => 7,
  51319. 'NULL' => 8,
  51320. 'JSONBooleanLiteral' => 9,
  51321. 'TRUE' => 10,
  51322. 'FALSE' => 11,
  51323. 'JSONText' => 12,
  51324. 'JSONValue' => 13,
  51325. 'EOF' => 14,
  51326. 'JSONObject' => 15,
  51327. 'JSONArray' => 16,
  51328. '{' => 17,
  51329. '}' => 18,
  51330. 'JSONMemberList' => 19,
  51331. 'JSONMember' => 20,
  51332. ':' => 21,
  51333. ',' => 22,
  51334. '[' => 23,
  51335. ']' => 24,
  51336. 'JSONElementList' => 25,
  51337. '$accept' => 0,
  51338. '$end' => 1,
  51339. );
  51340. private $terminals_ = array(
  51341. 2 => "error",
  51342. 4 => "STRING",
  51343. 6 => "NUMBER",
  51344. 8 => "NULL",
  51345. 10 => "TRUE",
  51346. 11 => "FALSE",
  51347. 14 => "EOF",
  51348. 17 => "{",
  51349. 18 => "}",
  51350. 21 => ":",
  51351. 22 => ",",
  51352. 23 => "[",
  51353. 24 => "]",
  51354. );
  51355. private $productions_ = array(
  51356. 1 => array(3, 1),
  51357. 2 => array(5, 1),
  51358. 3 => array(7, 1),
  51359. 4 => array(9, 1),
  51360. 5 => array(9, 1),
  51361. 6 => array(12, 2),
  51362. 7 => array(13, 1),
  51363. 8 => array(13, 1),
  51364. 9 => array(13, 1),
  51365. 10 => array(13, 1),
  51366. 11 => array(13, 1),
  51367. 12 => array(13, 1),
  51368. 13 => array(15, 2),
  51369. 14 => array(15, 3),
  51370. 15 => array(20, 3),
  51371. 16 => array(19, 1),
  51372. 17 => array(19, 3),
  51373. 18 => array(16, 2),
  51374. 19 => array(16, 3),
  51375. 20 => array(25, 1),
  51376. 21 => array(25, 3)
  51377. );
  51378. private $table = array(
  51379. 0 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  51380. 1 => array( 1 => array(3)),
  51381. 2 => array( 14 => array(1,16)),
  51382. 3 => array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)),
  51383. 4 => array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)),
  51384. 5 => array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)),
  51385. 6 => array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)),
  51386. 7 => array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)),
  51387. 8 => array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)),
  51388. 9 => array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)),
  51389. 10 => array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)),
  51390. 11 => array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)),
  51391. 12 => array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)),
  51392. 13 => array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)),
  51393. 14 => array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ),
  51394. 15 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ),
  51395. 16 => array( 1 => array(2,6)),
  51396. 17 => array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)),
  51397. 18 => array( 18 => array(1,24), 22 => array(1,25)),
  51398. 19 => array( 18 => array(2,16), 22 => array(2,16)),
  51399. 20 => array( 21 => array(1,26)),
  51400. 21 => array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)),
  51401. 22 => array( 22 => array(1,28), 24 => array(1,27)),
  51402. 23 => array( 22 => array(2,20), 24 => array(2,20)),
  51403. 24 => array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)),
  51404. 25 => array( 3 => 20, 4 => array(1,12), 20 => 29 ),
  51405. 26 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  51406. 27 => array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)),
  51407. 28 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  51408. 29 => array( 18 => array(2,17), 22 => array(2,17)),
  51409. 30 => array( 18 => array(2,15), 22 => array(2,15)),
  51410. 31 => array( 22 => array(2,21), 24 => array(2,21)),
  51411. );
  51412. private $defaultActions = array(
  51413. 16 => array(2, 6)
  51414. );
  51415. public function lint($input, $flags = 0)
  51416. {
  51417. try {
  51418. $this->parse($input, $flags);
  51419. } catch (ParsingException $e) {
  51420. return $e;
  51421. }
  51422. return null;
  51423. }
  51424. public function parse($input, $flags = 0)
  51425. {
  51426. $this->failOnBOM($input);
  51427. $this->flags = $flags;
  51428. $this->stack = array(0);
  51429. $this->vstack = array(null);
  51430. $this->lstack = array();
  51431. $yytext = '';
  51432. $yylineno = 0;
  51433. $yyleng = 0;
  51434. $recovering = 0;
  51435. $this->lexer = new Lexer();
  51436. $this->lexer->setInput($input);
  51437. $yyloc = $this->lexer->yylloc;
  51438. $this->lstack[] = $yyloc;
  51439. $symbol = null;
  51440. $preErrorSymbol = null;
  51441. $action = null;
  51442. $a = null;
  51443. $r = null;
  51444. $p = null;
  51445. $len = null;
  51446. $newState = null;
  51447. $expected = null;
  51448. $errStr = null;
  51449. while (true) {
  51450. $state = $this->stack[\count($this->stack)-1];
  51451. if (isset($this->defaultActions[$state])) {
  51452. $action = $this->defaultActions[$state];
  51453. } else {
  51454. if ($symbol === null) {
  51455. $symbol = $this->lexer->lex();
  51456. }
  51457. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  51458. }
  51459. if (!$action || !$action[0]) {
  51460. assert(isset($symbol));
  51461. if (!$recovering) {
  51462. $expected = array();
  51463. foreach ($this->table[$state] as $p => $ignore) {
  51464. if (isset($this->terminals_[$p]) && $p > 2) {
  51465. $expected[] = "'" . $this->terminals_[$p] . "'";
  51466. }
  51467. }
  51468. $message = null;
  51469. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  51470. $message = "Invalid string";
  51471. if ("'" === substr($this->lexer->match, 0, 1)) {
  51472. $message .= ", it appears you used single quotes instead of double quotes";
  51473. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  51474. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  51475. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  51476. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  51477. }
  51478. }
  51479. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  51480. $errStr .= $this->lexer->showPosition() . "\n";
  51481. if ($message) {
  51482. $errStr .= $message;
  51483. } else {
  51484. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  51485. $errStr .= implode(', ', $expected);
  51486. }
  51487. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  51488. $errStr .= " - It appears you have an extra trailing comma";
  51489. }
  51490. $this->parseError($errStr, array(
  51491. 'text' => $this->lexer->match,
  51492. 'token' => isset($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  51493. 'line' => $this->lexer->yylineno,
  51494. 'loc' => $yyloc,
  51495. 'expected' => $expected,
  51496. ));
  51497. }
  51498. if ($recovering == 3) {
  51499. if ($symbol === Lexer::EOF) {
  51500. throw new ParsingException($errStr ?: 'Parsing halted.');
  51501. }
  51502. $yyleng = $this->lexer->yyleng;
  51503. $yytext = $this->lexer->yytext;
  51504. $yylineno = $this->lexer->yylineno;
  51505. $yyloc = $this->lexer->yylloc;
  51506. $symbol = $this->lexer->lex();
  51507. }
  51508. while (true) {
  51509. if (\array_key_exists(Lexer::T_ERROR, $this->table[$state])) {
  51510. break;
  51511. }
  51512. if ($state == 0) {
  51513. throw new ParsingException($errStr ?: 'Parsing halted.');
  51514. }
  51515. $this->popStack(1);
  51516. $state = $this->stack[\count($this->stack)-1];
  51517. }
  51518. $preErrorSymbol = $symbol;
  51519. $symbol = Lexer::T_ERROR;
  51520. $state = $this->stack[\count($this->stack)-1];
  51521. $action = isset($this->table[$state][Lexer::T_ERROR]) ? $this->table[$state][Lexer::T_ERROR] : false;
  51522. if ($action === false) {
  51523. throw new \LogicException('No table value found for '.$state.' => '.Lexer::T_ERROR);
  51524. }
  51525. $recovering = 3;
  51526. }
  51527. if (\is_array($action[0]) && \count($action) > 1) {
  51528. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  51529. }
  51530. switch ($action[0]) {
  51531. case 1:
  51532. assert(isset($symbol));
  51533. $this->stack[] = $symbol;
  51534. $this->vstack[] = $this->lexer->yytext;
  51535. $this->lstack[] = $this->lexer->yylloc;
  51536. $this->stack[] = $action[1];
  51537. $symbol = null;
  51538. if (!$preErrorSymbol) {
  51539. $yyleng = $this->lexer->yyleng;
  51540. $yytext = $this->lexer->yytext;
  51541. $yylineno = $this->lexer->yylineno;
  51542. $yyloc = $this->lexer->yylloc;
  51543. if ($recovering > 0) {
  51544. $recovering--;
  51545. }
  51546. } else {
  51547. $symbol = $preErrorSymbol;
  51548. $preErrorSymbol = null;
  51549. }
  51550. break;
  51551. case 2:
  51552. $len = $this->productions_[$action[1]][1];
  51553. $currentToken = $this->vstack[\count($this->vstack) - $len];
  51554. $position = array(
  51555. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  51556. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  51557. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  51558. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  51559. );
  51560. list($newToken, $actionResult) = $this->performAction($currentToken, $yytext, $yyleng, $yylineno, $action[1]);
  51561. if (!$actionResult instanceof Undefined) {
  51562. return $actionResult;
  51563. }
  51564. if ($len) {
  51565. $this->popStack($len);
  51566. }
  51567. $this->stack[] = $this->productions_[$action[1]][0];
  51568. $this->vstack[] = $newToken;
  51569. $this->lstack[] = $position;
  51570. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  51571. $this->stack[] = $newState;
  51572. break;
  51573. case 3:
  51574. return true;
  51575. }
  51576. }
  51577. }
  51578. protected function parseError($str, $hash = null)
  51579. {
  51580. throw new ParsingException($str, $hash ?: array());
  51581. }
  51582. private function performAction($currentToken, $yytext, $yyleng, $yylineno, $yystate)
  51583. {
  51584. $token = $currentToken;
  51585. $len = \count($this->vstack) - 1;
  51586. switch ($yystate) {
  51587. case 1:
  51588. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  51589. $token = $yytext;
  51590. break;
  51591. case 2:
  51592. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  51593. $token = \floatval($yytext);
  51594. } else {
  51595. $token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  51596. }
  51597. break;
  51598. case 3:
  51599. $token = null;
  51600. break;
  51601. case 4:
  51602. $token = true;
  51603. break;
  51604. case 5:
  51605. $token = false;
  51606. break;
  51607. case 6:
  51608. $token = $this->vstack[$len-1];
  51609. return array($token, $token);
  51610. case 13:
  51611. if ($this->flags & self::PARSE_TO_ASSOC) {
  51612. $token = array();
  51613. } else {
  51614. $token = new stdClass;
  51615. }
  51616. break;
  51617. case 14:
  51618. $token = $this->vstack[$len-1];
  51619. break;
  51620. case 15:
  51621. $token = array($this->vstack[$len-2], $this->vstack[$len]);
  51622. break;
  51623. case 16:
  51624. assert(\is_array($this->vstack[$len]));
  51625. if (PHP_VERSION_ID < 70100) {
  51626. $property = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
  51627. } else {
  51628. $property = $this->vstack[$len][0];
  51629. }
  51630. if ($this->flags & self::PARSE_TO_ASSOC) {
  51631. $token = array();
  51632. $token[$property] = $this->vstack[$len][1];
  51633. } else {
  51634. $token = new stdClass;
  51635. $token->$property = $this->vstack[$len][1];
  51636. }
  51637. break;
  51638. case 17:
  51639. assert(\is_array($this->vstack[$len]));
  51640. if ($this->flags & self::PARSE_TO_ASSOC) {
  51641. assert(\is_array($this->vstack[$len-2]));
  51642. $token =& $this->vstack[$len-2];
  51643. $key = $this->vstack[$len][0];
  51644. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2][$key])) {
  51645. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  51646. $errStr .= $this->lexer->showPosition() . "\n";
  51647. $errStr .= "Duplicate key: ".$this->vstack[$len][0];
  51648. throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
  51649. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2][$key])) {
  51650. $duplicateCount = 1;
  51651. do {
  51652. $duplicateKey = $key . '.' . $duplicateCount++;
  51653. } while (isset($this->vstack[$len-2][$duplicateKey]));
  51654. $key = $duplicateKey;
  51655. }
  51656. $this->vstack[$len-2][$key] = $this->vstack[$len][1];
  51657. } else {
  51658. assert($this->vstack[$len-2] instanceof stdClass);
  51659. $token = $this->vstack[$len-2];
  51660. if (PHP_VERSION_ID < 70100) {
  51661. $key = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
  51662. } else {
  51663. $key = $this->vstack[$len][0];
  51664. }
  51665. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2]->{$key})) {
  51666. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  51667. $errStr .= $this->lexer->showPosition() . "\n";
  51668. $errStr .= "Duplicate key: ".$this->vstack[$len][0];
  51669. throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
  51670. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2]->{$key})) {
  51671. $duplicateCount = 1;
  51672. do {
  51673. $duplicateKey = $key . '.' . $duplicateCount++;
  51674. } while (isset($this->vstack[$len-2]->$duplicateKey));
  51675. $key = $duplicateKey;
  51676. }
  51677. $this->vstack[$len-2]->$key = $this->vstack[$len][1];
  51678. }
  51679. break;
  51680. case 18:
  51681. $token = array();
  51682. break;
  51683. case 19:
  51684. $token = $this->vstack[$len-1];
  51685. break;
  51686. case 20:
  51687. $token = array($this->vstack[$len]);
  51688. break;
  51689. case 21:
  51690. assert(\is_array($this->vstack[$len-2]));
  51691. $this->vstack[$len-2][] = $this->vstack[$len];
  51692. $token = $this->vstack[$len-2];
  51693. break;
  51694. }
  51695. return array($token, new Undefined());
  51696. }
  51697. private function stringInterpolation($match)
  51698. {
  51699. switch ($match[0]) {
  51700. case '\\\\':
  51701. return '\\';
  51702. case '\"':
  51703. return '"';
  51704. case '\b':
  51705. return \chr(8);
  51706. case '\f':
  51707. return \chr(12);
  51708. case '\n':
  51709. return "\n";
  51710. case '\r':
  51711. return "\r";
  51712. case '\t':
  51713. return "\t";
  51714. case '\/':
  51715. return "/";
  51716. default:
  51717. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  51718. }
  51719. }
  51720. private function popStack($n)
  51721. {
  51722. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  51723. $this->vstack = \array_slice($this->vstack, 0, - $n);
  51724. $this->lstack = \array_slice($this->lstack, 0, - $n);
  51725. }
  51726. private function failOnBOM($input)
  51727. {
  51728. $bom = "\xEF\xBB\xBF";
  51729. if (substr($input, 0, 3) === $bom) {
  51730. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark");
  51731. }
  51732. }
  51733. }
  51734. <?php
  51735. namespace Seld\JsonLint;
  51736. class Lexer
  51737. {
  51738. const EOF = 1;
  51739. const T_INVALID = -1;
  51740. const T_SKIP_WHITESPACE = 0;
  51741. const T_ERROR = 2;
  51742. private $rules = array(
  51743. 0 => '/\G\s+/',
  51744. 1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  51745. 2 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  51746. 3 => '/\G\{/',
  51747. 4 => '/\G\}/',
  51748. 5 => '/\G\[/',
  51749. 6 => '/\G\]/',
  51750. 7 => '/\G,/',
  51751. 8 => '/\G:/',
  51752. 9 => '/\Gtrue\b/',
  51753. 10 => '/\Gfalse\b/',
  51754. 11 => '/\Gnull\b/',
  51755. 12 => '/\G$/',
  51756. 13 => '/\G./',
  51757. );
  51758. private $input;
  51759. private $more;
  51760. private $done;
  51761. private $offset;
  51762. public $match;
  51763. public $yylineno;
  51764. public $yyleng;
  51765. public $yytext;
  51766. public $yylloc;
  51767. public function lex()
  51768. {
  51769. do {
  51770. $symbol = $this->next();
  51771. } while ($symbol === self::T_SKIP_WHITESPACE);
  51772. return $symbol;
  51773. }
  51774. public function setInput($input)
  51775. {
  51776. $this->input = $input;
  51777. $this->more = false;
  51778. $this->done = false;
  51779. $this->offset = 0;
  51780. $this->yylineno = $this->yyleng = 0;
  51781. $this->yytext = $this->match = '';
  51782. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  51783. return $this;
  51784. }
  51785. public function showPosition()
  51786. {
  51787. $pre = str_replace("\n", '', $this->getPastInput());
  51788. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  51789. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  51790. }
  51791. public function getPastInput()
  51792. {
  51793. $pastLength = $this->offset - \strlen($this->match);
  51794. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  51795. }
  51796. public function getUpcomingInput()
  51797. {
  51798. $next = $this->match;
  51799. if (\strlen($next) < 20) {
  51800. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  51801. }
  51802. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  51803. }
  51804. public function getFullUpcomingInput()
  51805. {
  51806. $next = $this->match;
  51807. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  51808. $len = \strlen($this->input);
  51809. if ($len === $this->offset) {
  51810. $strEnd = $len;
  51811. } else {
  51812. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  51813. }
  51814. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  51815. } elseif (\strlen($next) < 20) {
  51816. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  51817. }
  51818. return $next;
  51819. }
  51820. protected function parseError($str)
  51821. {
  51822. throw new ParsingException($str);
  51823. }
  51824. private function next()
  51825. {
  51826. if ($this->done) {
  51827. return self::EOF;
  51828. }
  51829. if ($this->offset === \strlen($this->input)) {
  51830. $this->done = true;
  51831. }
  51832. $token = null;
  51833. $match = null;
  51834. $col = null;
  51835. $lines = null;
  51836. if (!$this->more) {
  51837. $this->yytext = '';
  51838. $this->match = '';
  51839. }
  51840. $rulesLen = 14;
  51841. for ($i=0; $i < $rulesLen; $i++) {
  51842. if (preg_match($this->rules[$i], $this->input, $match, 0, $this->offset)) {
  51843. $lines = explode("\n", $match[0]);
  51844. array_shift($lines);
  51845. $lineCount = \count($lines);
  51846. $this->yylineno += $lineCount;
  51847. $this->yylloc = array(
  51848. 'first_line' => $this->yylloc['last_line'],
  51849. 'last_line' => $this->yylineno+1,
  51850. 'first_column' => $this->yylloc['last_column'],
  51851. 'last_column' => $lineCount > 0 ? \strlen($lines[$lineCount - 1]) : $this->yylloc['last_column'] + \strlen($match[0]),
  51852. );
  51853. $this->yytext .= $match[0];
  51854. $this->match .= $match[0];
  51855. $this->yyleng = \strlen($this->yytext);
  51856. $this->more = false;
  51857. $this->offset += \strlen($match[0]);
  51858. return $this->performAction($i);
  51859. }
  51860. }
  51861. if ($this->offset === \strlen($this->input)) {
  51862. return self::EOF;
  51863. }
  51864. $this->parseError(
  51865. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition()
  51866. );
  51867. }
  51868. private function performAction($rule)
  51869. {
  51870. switch ($rule) {
  51871. case 0:
  51872. return self::T_SKIP_WHITESPACE;
  51873. case 1:
  51874. return 6;
  51875. case 2:
  51876. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  51877. return 4;
  51878. case 3:
  51879. return 17;
  51880. case 4:
  51881. return 18;
  51882. case 5:
  51883. return 23;
  51884. case 6:
  51885. return 24;
  51886. case 7:
  51887. return 22;
  51888. case 8:
  51889. return 21;
  51890. case 9:
  51891. return 10;
  51892. case 10:
  51893. return 11;
  51894. case 11:
  51895. return 8;
  51896. case 12:
  51897. return 14;
  51898. case 13:
  51899. return self::T_INVALID;
  51900. default:
  51901. throw new \LogicException('Unsupported rule '.$rule);
  51902. }
  51903. }
  51904. }
  51905. <?php
  51906. namespace Seld\JsonLint;
  51907. class ParsingException extends \Exception
  51908. {
  51909. protected $details;
  51910. public function __construct($message, $details = array())
  51911. {
  51912. $this->details = $details;
  51913. parent::__construct($message);
  51914. }
  51915. public function getDetails()
  51916. {
  51917. return $this->details;
  51918. }
  51919. }
  51920. <?php
  51921. namespace Seld\JsonLint;
  51922. class Undefined
  51923. {
  51924. }
  51925. Copyright (c) 2015 Jordi Boggiano
  51926. Permission is hereby granted, free of charge, to any person obtaining a copy
  51927. of this software and associated documentation files (the "Software"), to deal
  51928. in the Software without restriction, including without limitation the rights
  51929. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51930. copies of the Software, and to permit persons to whom the Software is furnished
  51931. to do so, subject to the following conditions:
  51932. The above copyright notice and this permission notice shall be included in all
  51933. copies or substantial portions of the Software.
  51934. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51935. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51936. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51937. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51938. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51939. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51940. THE SOFTWARE.
  51941. <?php
  51942. namespace Seld\PharUtils;
  51943. class Linter
  51944. {
  51945. public static function lint($path, array $excludedPaths = array())
  51946. {
  51947. $php = defined('PHP_BINARY') ? PHP_BINARY : 'php';
  51948. if ($isWindows = defined('PHP_WINDOWS_VERSION_BUILD')) {
  51949. $tmpFile = @tempnam(sys_get_temp_dir(), '');
  51950. if (!$tmpFile || !is_writable($tmpFile)) {
  51951. throw new \RuntimeException('Unable to create temp file');
  51952. }
  51953. $php = self::escapeWindowsPath($php);
  51954. $tmpFile = self::escapeWindowsPath($tmpFile);
  51955. if (PHP_VERSION_ID >= 80000) {
  51956. $format = '%s -l %s';
  51957. } else {
  51958. $format = '"%s -l %s"';
  51959. }
  51960. $command = sprintf($format, $php, $tmpFile);
  51961. } else {
  51962. $command = "'".$php."' -l";
  51963. }
  51964. $descriptorspec = array(
  51965. 0 => array('pipe', 'r'),
  51966. 1 => array('pipe', 'w'),
  51967. 2 => array('pipe', 'w')
  51968. );
  51969. $baseLen = strlen(realpath($path)) + 7 + 1;
  51970. foreach (new \RecursiveIteratorIterator(new \Phar($path)) as $file) {
  51971. if ($file->isDir()) {
  51972. continue;
  51973. }
  51974. if (substr($file, -4) === '.php') {
  51975. $filename = (string) $file;
  51976. if (in_array(substr($filename, $baseLen), $excludedPaths, true)) {
  51977. continue;
  51978. }
  51979. if ($isWindows) {
  51980. file_put_contents($tmpFile, file_get_contents($filename));
  51981. }
  51982. $process = proc_open($command, $descriptorspec, $pipes);
  51983. if (is_resource($process)) {
  51984. if (!$isWindows) {
  51985. fwrite($pipes[0], file_get_contents($filename));
  51986. }
  51987. fclose($pipes[0]);
  51988. $stdout = stream_get_contents($pipes[1]);
  51989. fclose($pipes[1]);
  51990. $stderr = stream_get_contents($pipes[2]);
  51991. fclose($pipes[2]);
  51992. $exitCode = proc_close($process);
  51993. if ($exitCode !== 0) {
  51994. if ($isWindows) {
  51995. $stderr = str_replace($tmpFile, $filename, $stderr);
  51996. }
  51997. throw new \UnexpectedValueException('Failed linting '.$file.': '.$stderr);
  51998. }
  51999. } else {
  52000. throw new \RuntimeException('Could not start linter process');
  52001. }
  52002. }
  52003. }
  52004. if ($isWindows) {
  52005. @unlink($tmpFile);
  52006. }
  52007. }
  52008. private static function escapeWindowsPath($path)
  52009. {
  52010. if (strpbrk($path, " ()") !== false) {
  52011. $path = '"'.$path.'"';
  52012. }
  52013. return $path;
  52014. }
  52015. }
  52016. <?php
  52017. namespace Seld\PharUtils;
  52018. class Timestamps
  52019. {
  52020. private $contents;
  52021. public function __construct($file)
  52022. {
  52023. $this->contents = file_get_contents($file);
  52024. }
  52025. public function updateTimestamps($timestamp = null)
  52026. {
  52027. if ($timestamp instanceof \DateTime || $timestamp instanceof \DateTimeInterface) {
  52028. $timestamp = $timestamp->getTimestamp();
  52029. } elseif (is_string($timestamp)) {
  52030. $timestamp = strtotime($timestamp);
  52031. } elseif (!is_int($timestamp)) {
  52032. $timestamp = strtotime('1984-12-24T00:00:00Z');
  52033. }
  52034. if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
  52035. throw new \RuntimeException('Could not detect the stub\'s end in the phar');
  52036. }
  52037. $pos = $match[0][1] + strlen($match[0][0]);
  52038. $stubEnd = $pos + $this->readUint($pos, 4);
  52039. $pos += 4;
  52040. $numFiles = $this->readUint($pos, 4);
  52041. $pos += 4;
  52042. $pos += 2;
  52043. $pos += 4;
  52044. $aliasLength = $this->readUint($pos, 4);
  52045. $pos += 4 + $aliasLength;
  52046. $metadataLength = $this->readUint($pos, 4);
  52047. $pos += 4 + $metadataLength;
  52048. while ($pos < $stubEnd) {
  52049. $filenameLength = $this->readUint($pos, 4);
  52050. $pos += 4 + $filenameLength;
  52051. $pos += 4;
  52052. $this->contents = substr_replace($this->contents, pack('L', $timestamp), $pos, 4);
  52053. $pos += 4*4;
  52054. $metadataLength = $this->readUint($pos, 4);
  52055. $pos += 4 + $metadataLength;
  52056. $numFiles--;
  52057. }
  52058. if ($numFiles !== 0) {
  52059. throw new \LogicException('All files were not processed, something must have gone wrong');
  52060. }
  52061. }
  52062. public function save($path, $signatureAlgo)
  52063. {
  52064. $pos = $this->determineSignatureBegin();
  52065. $algos = array(
  52066. \Phar::MD5 => 'md5',
  52067. \Phar::SHA1 => 'sha1',
  52068. \Phar::SHA256 => 'sha256',
  52069. \Phar::SHA512 => 'sha512',
  52070. );
  52071. if (!isset($algos[$signatureAlgo])) {
  52072. throw new \UnexpectedValueException('Invalid hash algorithm given: '.$signatureAlgo.' expected one of Phar::MD5, Phar::SHA1, Phar::SHA256 or Phar::SHA512');
  52073. }
  52074. $algo = $algos[$signatureAlgo];
  52075. $signature = hash($algo, substr($this->contents, 0, $pos), true)
  52076. . pack('L', $signatureAlgo)
  52077. . 'GBMB';
  52078. $this->contents = substr($this->contents, 0, $pos) . $signature;
  52079. return file_put_contents($path, $this->contents);
  52080. }
  52081. private function readUint($pos, $bytes)
  52082. {
  52083. $res = unpack('V', substr($this->contents, $pos, $bytes));
  52084. return $res[1];
  52085. }
  52086. private function determineSignatureBegin()
  52087. {
  52088. if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
  52089. throw new \RuntimeException('Could not detect the stub\'s end in the phar');
  52090. }
  52091. $pos = $match[0][1] + strlen($match[0][0]);
  52092. $manifestEnd = $pos + 4 + $this->readUint($pos, 4);
  52093. $pos += 4;
  52094. $numFiles = $this->readUint($pos, 4);
  52095. $pos += 4;
  52096. $pos += 2;
  52097. $pos += 4;
  52098. $aliasLength = $this->readUint($pos, 4);
  52099. $pos += 4 + $aliasLength;
  52100. $metadataLength = $this->readUint($pos, 4);
  52101. $pos += 4 + $metadataLength;
  52102. $compressedSizes = 0;
  52103. while (($numFiles > 0) && ($pos < $manifestEnd - 24)) {
  52104. $filenameLength = $this->readUint($pos, 4);
  52105. $pos += 4 + $filenameLength;
  52106. $pos += 2*4;
  52107. $compressedSizes += $this->readUint($pos, 4);
  52108. $pos += 3*4;
  52109. $metadataLength = $this->readUint($pos, 4);
  52110. $pos += 4 + $metadataLength;
  52111. $numFiles--;
  52112. }
  52113. if ($numFiles !== 0) {
  52114. throw new \LogicException('All files were not processed, something must have gone wrong');
  52115. }
  52116. return $manifestEnd + $compressedSizes;
  52117. }
  52118. }
  52119. <?php
  52120. namespace Symfony\Component\Console;
  52121. use Symfony\Component\Console\Command\Command;
  52122. use Symfony\Component\Console\Command\CompleteCommand;
  52123. use Symfony\Component\Console\Command\DumpCompletionCommand;
  52124. use Symfony\Component\Console\Command\HelpCommand;
  52125. use Symfony\Component\Console\Command\LazyCommand;
  52126. use Symfony\Component\Console\Command\ListCommand;
  52127. use Symfony\Component\Console\Command\SignalableCommandInterface;
  52128. use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
  52129. use Symfony\Component\Console\Completion\CompletionInput;
  52130. use Symfony\Component\Console\Completion\CompletionSuggestions;
  52131. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  52132. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  52133. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  52134. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  52135. use Symfony\Component\Console\Exception\CommandNotFoundException;
  52136. use Symfony\Component\Console\Exception\ExceptionInterface;
  52137. use Symfony\Component\Console\Exception\LogicException;
  52138. use Symfony\Component\Console\Exception\NamespaceNotFoundException;
  52139. use Symfony\Component\Console\Exception\RuntimeException;
  52140. use Symfony\Component\Console\Formatter\OutputFormatter;
  52141. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  52142. use Symfony\Component\Console\Helper\FormatterHelper;
  52143. use Symfony\Component\Console\Helper\Helper;
  52144. use Symfony\Component\Console\Helper\HelperSet;
  52145. use Symfony\Component\Console\Helper\ProcessHelper;
  52146. use Symfony\Component\Console\Helper\QuestionHelper;
  52147. use Symfony\Component\Console\Input\ArgvInput;
  52148. use Symfony\Component\Console\Input\ArrayInput;
  52149. use Symfony\Component\Console\Input\InputArgument;
  52150. use Symfony\Component\Console\Input\InputAwareInterface;
  52151. use Symfony\Component\Console\Input\InputDefinition;
  52152. use Symfony\Component\Console\Input\InputInterface;
  52153. use Symfony\Component\Console\Input\InputOption;
  52154. use Symfony\Component\Console\Output\ConsoleOutput;
  52155. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  52156. use Symfony\Component\Console\Output\OutputInterface;
  52157. use Symfony\Component\Console\SignalRegistry\SignalRegistry;
  52158. use Symfony\Component\Console\Style\SymfonyStyle;
  52159. use Symfony\Component\ErrorHandler\ErrorHandler;
  52160. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  52161. use Symfony\Contracts\Service\ResetInterface;
  52162. class Application implements ResetInterface
  52163. {
  52164. private $commands = [];
  52165. private $wantHelps = false;
  52166. private $runningCommand;
  52167. private $name;
  52168. private $version;
  52169. private $commandLoader;
  52170. private $catchExceptions = true;
  52171. private $autoExit = true;
  52172. private $definition;
  52173. private $helperSet;
  52174. private $dispatcher;
  52175. private $terminal;
  52176. private $defaultCommand;
  52177. private $singleCommand = false;
  52178. private $initialized;
  52179. private $signalRegistry;
  52180. private $signalsToDispatchEvent = [];
  52181. public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
  52182. {
  52183. $this->name = $name;
  52184. $this->version = $version;
  52185. $this->terminal = new Terminal();
  52186. $this->defaultCommand = 'list';
  52187. if (\defined('SIGINT') && SignalRegistry::isSupported()) {
  52188. $this->signalRegistry = new SignalRegistry();
  52189. $this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
  52190. }
  52191. }
  52192. public function setDispatcher(EventDispatcherInterface $dispatcher)
  52193. {
  52194. $this->dispatcher = $dispatcher;
  52195. }
  52196. public function setCommandLoader(CommandLoaderInterface $commandLoader)
  52197. {
  52198. $this->commandLoader = $commandLoader;
  52199. }
  52200. public function getSignalRegistry(): SignalRegistry
  52201. {
  52202. if (!$this->signalRegistry) {
  52203. throw new RuntimeException('Signals are not supported. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
  52204. }
  52205. return $this->signalRegistry;
  52206. }
  52207. public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
  52208. {
  52209. $this->signalsToDispatchEvent = $signalsToDispatchEvent;
  52210. }
  52211. public function run(InputInterface $input = null, OutputInterface $output = null)
  52212. {
  52213. if (\function_exists('putenv')) {
  52214. @putenv('LINES='.$this->terminal->getHeight());
  52215. @putenv('COLUMNS='.$this->terminal->getWidth());
  52216. }
  52217. if (null === $input) {
  52218. $input = new ArgvInput();
  52219. }
  52220. if (null === $output) {
  52221. $output = new ConsoleOutput();
  52222. }
  52223. $renderException = function (\Throwable $e) use ($output) {
  52224. if ($output instanceof ConsoleOutputInterface) {
  52225. $this->renderThrowable($e, $output->getErrorOutput());
  52226. } else {
  52227. $this->renderThrowable($e, $output);
  52228. }
  52229. };
  52230. if ($phpHandler = set_exception_handler($renderException)) {
  52231. restore_exception_handler();
  52232. if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
  52233. $errorHandler = true;
  52234. } elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
  52235. $phpHandler[0]->setExceptionHandler($errorHandler);
  52236. }
  52237. }
  52238. $this->configureIO($input, $output);
  52239. try {
  52240. $exitCode = $this->doRun($input, $output);
  52241. } catch (\Exception $e) {
  52242. if (!$this->catchExceptions) {
  52243. throw $e;
  52244. }
  52245. $renderException($e);
  52246. $exitCode = $e->getCode();
  52247. if (is_numeric($exitCode)) {
  52248. $exitCode = (int) $exitCode;
  52249. if (0 === $exitCode) {
  52250. $exitCode = 1;
  52251. }
  52252. } else {
  52253. $exitCode = 1;
  52254. }
  52255. } finally {
  52256. if (!$phpHandler) {
  52257. if (set_exception_handler($renderException) === $renderException) {
  52258. restore_exception_handler();
  52259. }
  52260. restore_exception_handler();
  52261. } elseif (!$errorHandler) {
  52262. $finalHandler = $phpHandler[0]->setExceptionHandler(null);
  52263. if ($finalHandler !== $renderException) {
  52264. $phpHandler[0]->setExceptionHandler($finalHandler);
  52265. }
  52266. }
  52267. }
  52268. if ($this->autoExit) {
  52269. if ($exitCode > 255) {
  52270. $exitCode = 255;
  52271. }
  52272. exit($exitCode);
  52273. }
  52274. return $exitCode;
  52275. }
  52276. public function doRun(InputInterface $input, OutputInterface $output)
  52277. {
  52278. if (true === $input->hasParameterOption(['--version', '-V'], true)) {
  52279. $output->writeln($this->getLongVersion());
  52280. return 0;
  52281. }
  52282. try {
  52283. $input->bind($this->getDefinition());
  52284. } catch (ExceptionInterface $e) {
  52285. }
  52286. $name = $this->getCommandName($input);
  52287. if (true === $input->hasParameterOption(['--help', '-h'], true)) {
  52288. if (!$name) {
  52289. $name = 'help';
  52290. $input = new ArrayInput(['command_name' => $this->defaultCommand]);
  52291. } else {
  52292. $this->wantHelps = true;
  52293. }
  52294. }
  52295. if (!$name) {
  52296. $name = $this->defaultCommand;
  52297. $definition = $this->getDefinition();
  52298. $definition->setArguments(array_merge(
  52299. $definition->getArguments(),
  52300. [
  52301. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  52302. ]
  52303. ));
  52304. }
  52305. try {
  52306. $this->runningCommand = null;
  52307. $command = $this->find($name);
  52308. } catch (\Throwable $e) {
  52309. if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
  52310. if (null !== $this->dispatcher) {
  52311. $event = new ConsoleErrorEvent($input, $output, $e);
  52312. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  52313. if (0 === $event->getExitCode()) {
  52314. return 0;
  52315. }
  52316. $e = $event->getError();
  52317. }
  52318. throw $e;
  52319. }
  52320. $alternative = $alternatives[0];
  52321. $style = new SymfonyStyle($input, $output);
  52322. $style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
  52323. if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
  52324. if (null !== $this->dispatcher) {
  52325. $event = new ConsoleErrorEvent($input, $output, $e);
  52326. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  52327. return $event->getExitCode();
  52328. }
  52329. return 1;
  52330. }
  52331. $command = $this->find($alternative);
  52332. }
  52333. if ($command instanceof LazyCommand) {
  52334. $command = $command->getCommand();
  52335. }
  52336. $this->runningCommand = $command;
  52337. $exitCode = $this->doRunCommand($command, $input, $output);
  52338. $this->runningCommand = null;
  52339. return $exitCode;
  52340. }
  52341. public function reset()
  52342. {
  52343. }
  52344. public function setHelperSet(HelperSet $helperSet)
  52345. {
  52346. $this->helperSet = $helperSet;
  52347. }
  52348. public function getHelperSet()
  52349. {
  52350. if (!$this->helperSet) {
  52351. $this->helperSet = $this->getDefaultHelperSet();
  52352. }
  52353. return $this->helperSet;
  52354. }
  52355. public function setDefinition(InputDefinition $definition)
  52356. {
  52357. $this->definition = $definition;
  52358. }
  52359. public function getDefinition()
  52360. {
  52361. if (!$this->definition) {
  52362. $this->definition = $this->getDefaultInputDefinition();
  52363. }
  52364. if ($this->singleCommand) {
  52365. $inputDefinition = $this->definition;
  52366. $inputDefinition->setArguments();
  52367. return $inputDefinition;
  52368. }
  52369. return $this->definition;
  52370. }
  52371. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  52372. {
  52373. if (
  52374. CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
  52375. && 'command' === $input->getCompletionName()
  52376. ) {
  52377. $suggestions->suggestValues(array_filter(array_map(function (Command $command) {
  52378. return $command->isHidden() ? null : $command->getName();
  52379. }, $this->all())));
  52380. return;
  52381. }
  52382. if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) {
  52383. $suggestions->suggestOptions($this->getDefinition()->getOptions());
  52384. return;
  52385. }
  52386. }
  52387. public function getHelp()
  52388. {
  52389. return $this->getLongVersion();
  52390. }
  52391. public function areExceptionsCaught()
  52392. {
  52393. return $this->catchExceptions;
  52394. }
  52395. public function setCatchExceptions(bool $boolean)
  52396. {
  52397. $this->catchExceptions = $boolean;
  52398. }
  52399. public function isAutoExitEnabled()
  52400. {
  52401. return $this->autoExit;
  52402. }
  52403. public function setAutoExit(bool $boolean)
  52404. {
  52405. $this->autoExit = $boolean;
  52406. }
  52407. public function getName()
  52408. {
  52409. return $this->name;
  52410. }
  52411. public function setName(string $name)
  52412. {
  52413. $this->name = $name;
  52414. }
  52415. public function getVersion()
  52416. {
  52417. return $this->version;
  52418. }
  52419. public function setVersion(string $version)
  52420. {
  52421. $this->version = $version;
  52422. }
  52423. public function getLongVersion()
  52424. {
  52425. if ('UNKNOWN' !== $this->getName()) {
  52426. if ('UNKNOWN' !== $this->getVersion()) {
  52427. return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
  52428. }
  52429. return $this->getName();
  52430. }
  52431. return 'Console Tool';
  52432. }
  52433. public function register(string $name)
  52434. {
  52435. return $this->add(new Command($name));
  52436. }
  52437. public function addCommands(array $commands)
  52438. {
  52439. foreach ($commands as $command) {
  52440. $this->add($command);
  52441. }
  52442. }
  52443. public function add(Command $command)
  52444. {
  52445. $this->init();
  52446. $command->setApplication($this);
  52447. if (!$command->isEnabled()) {
  52448. $command->setApplication(null);
  52449. return null;
  52450. }
  52451. if (!$command instanceof LazyCommand) {
  52452. $command->getDefinition();
  52453. }
  52454. if (!$command->getName()) {
  52455. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
  52456. }
  52457. $this->commands[$command->getName()] = $command;
  52458. foreach ($command->getAliases() as $alias) {
  52459. $this->commands[$alias] = $command;
  52460. }
  52461. return $command;
  52462. }
  52463. public function get(string $name)
  52464. {
  52465. $this->init();
  52466. if (!$this->has($name)) {
  52467. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  52468. }
  52469. if (!isset($this->commands[$name])) {
  52470. throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
  52471. }
  52472. $command = $this->commands[$name];
  52473. if ($this->wantHelps) {
  52474. $this->wantHelps = false;
  52475. $helpCommand = $this->get('help');
  52476. $helpCommand->setCommand($command);
  52477. return $helpCommand;
  52478. }
  52479. return $command;
  52480. }
  52481. public function has(string $name)
  52482. {
  52483. $this->init();
  52484. return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
  52485. }
  52486. public function getNamespaces()
  52487. {
  52488. $namespaces = [];
  52489. foreach ($this->all() as $command) {
  52490. if ($command->isHidden()) {
  52491. continue;
  52492. }
  52493. $namespaces[] = $this->extractAllNamespaces($command->getName());
  52494. foreach ($command->getAliases() as $alias) {
  52495. $namespaces[] = $this->extractAllNamespaces($alias);
  52496. }
  52497. }
  52498. return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
  52499. }
  52500. public function findNamespace(string $namespace)
  52501. {
  52502. $allNamespaces = $this->getNamespaces();
  52503. $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*';
  52504. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  52505. if (empty($namespaces)) {
  52506. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  52507. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  52508. if (1 == \count($alternatives)) {
  52509. $message .= "\n\nDid you mean this?\n ";
  52510. } else {
  52511. $message .= "\n\nDid you mean one of these?\n ";
  52512. }
  52513. $message .= implode("\n ", $alternatives);
  52514. }
  52515. throw new NamespaceNotFoundException($message, $alternatives);
  52516. }
  52517. $exact = \in_array($namespace, $namespaces, true);
  52518. if (\count($namespaces) > 1 && !$exact) {
  52519. throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  52520. }
  52521. return $exact ? $namespace : reset($namespaces);
  52522. }
  52523. public function find(string $name)
  52524. {
  52525. $this->init();
  52526. $aliases = [];
  52527. foreach ($this->commands as $command) {
  52528. foreach ($command->getAliases() as $alias) {
  52529. if (!$this->has($alias)) {
  52530. $this->commands[$alias] = $command;
  52531. }
  52532. }
  52533. }
  52534. if ($this->has($name)) {
  52535. return $this->get($name);
  52536. }
  52537. $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
  52538. $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*';
  52539. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  52540. if (empty($commands)) {
  52541. $commands = preg_grep('{^'.$expr.'}i', $allCommands);
  52542. }
  52543. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) {
  52544. if (false !== $pos = strrpos($name, ':')) {
  52545. $this->findNamespace(substr($name, 0, $pos));
  52546. }
  52547. $message = sprintf('Command "%s" is not defined.', $name);
  52548. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  52549. $alternatives = array_filter($alternatives, function ($name) {
  52550. return !$this->get($name)->isHidden();
  52551. });
  52552. if (1 == \count($alternatives)) {
  52553. $message .= "\n\nDid you mean this?\n ";
  52554. } else {
  52555. $message .= "\n\nDid you mean one of these?\n ";
  52556. }
  52557. $message .= implode("\n ", $alternatives);
  52558. }
  52559. throw new CommandNotFoundException($message, array_values($alternatives));
  52560. }
  52561. if (\count($commands) > 1) {
  52562. $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
  52563. $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
  52564. if (!$commandList[$nameOrAlias] instanceof Command) {
  52565. $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
  52566. }
  52567. $commandName = $commandList[$nameOrAlias]->getName();
  52568. $aliases[$nameOrAlias] = $commandName;
  52569. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  52570. }));
  52571. }
  52572. if (\count($commands) > 1) {
  52573. $usableWidth = $this->terminal->getWidth() - 10;
  52574. $abbrevs = array_values($commands);
  52575. $maxLen = 0;
  52576. foreach ($abbrevs as $abbrev) {
  52577. $maxLen = max(Helper::width($abbrev), $maxLen);
  52578. }
  52579. $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
  52580. if ($commandList[$cmd]->isHidden()) {
  52581. unset($commands[array_search($cmd, $commands)]);
  52582. return false;
  52583. }
  52584. $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();
  52585. return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
  52586. }, array_values($commands));
  52587. if (\count($commands) > 1) {
  52588. $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
  52589. throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
  52590. }
  52591. }
  52592. $command = $this->get(reset($commands));
  52593. if ($command->isHidden()) {
  52594. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  52595. }
  52596. return $command;
  52597. }
  52598. public function all(string $namespace = null)
  52599. {
  52600. $this->init();
  52601. if (null === $namespace) {
  52602. if (!$this->commandLoader) {
  52603. return $this->commands;
  52604. }
  52605. $commands = $this->commands;
  52606. foreach ($this->commandLoader->getNames() as $name) {
  52607. if (!isset($commands[$name]) && $this->has($name)) {
  52608. $commands[$name] = $this->get($name);
  52609. }
  52610. }
  52611. return $commands;
  52612. }
  52613. $commands = [];
  52614. foreach ($this->commands as $name => $command) {
  52615. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  52616. $commands[$name] = $command;
  52617. }
  52618. }
  52619. if ($this->commandLoader) {
  52620. foreach ($this->commandLoader->getNames() as $name) {
  52621. if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
  52622. $commands[$name] = $this->get($name);
  52623. }
  52624. }
  52625. }
  52626. return $commands;
  52627. }
  52628. public static function getAbbreviations(array $names)
  52629. {
  52630. $abbrevs = [];
  52631. foreach ($names as $name) {
  52632. for ($len = \strlen($name); $len > 0; --$len) {
  52633. $abbrev = substr($name, 0, $len);
  52634. $abbrevs[$abbrev][] = $name;
  52635. }
  52636. }
  52637. return $abbrevs;
  52638. }
  52639. public function renderThrowable(\Throwable $e, OutputInterface $output): void
  52640. {
  52641. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  52642. $this->doRenderThrowable($e, $output);
  52643. if (null !== $this->runningCommand) {
  52644. $output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
  52645. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  52646. }
  52647. }
  52648. protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
  52649. {
  52650. do {
  52651. $message = trim($e->getMessage());
  52652. if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  52653. $class = get_debug_type($e);
  52654. $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
  52655. $len = Helper::width($title);
  52656. } else {
  52657. $len = 0;
  52658. }
  52659. if (str_contains($message, "@anonymous\0")) {
  52660. $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
  52661. return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
  52662. }, $message);
  52663. }
  52664. $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
  52665. $lines = [];
  52666. foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
  52667. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  52668. $lineLength = Helper::width($line) + 4;
  52669. $lines[] = [$line, $lineLength];
  52670. $len = max($lineLength, $len);
  52671. }
  52672. }
  52673. $messages = [];
  52674. if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  52675. $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
  52676. }
  52677. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  52678. if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  52679. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::width($title))));
  52680. }
  52681. foreach ($lines as $line) {
  52682. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  52683. }
  52684. $messages[] = $emptyLine;
  52685. $messages[] = '';
  52686. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  52687. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  52688. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  52689. $trace = $e->getTrace();
  52690. array_unshift($trace, [
  52691. 'function' => '',
  52692. 'file' => $e->getFile() ?: 'n/a',
  52693. 'line' => $e->getLine() ?: 'n/a',
  52694. 'args' => [],
  52695. ]);
  52696. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  52697. $class = $trace[$i]['class'] ?? '';
  52698. $type = $trace[$i]['type'] ?? '';
  52699. $function = $trace[$i]['function'] ?? '';
  52700. $file = $trace[$i]['file'] ?? 'n/a';
  52701. $line = $trace[$i]['line'] ?? 'n/a';
  52702. $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
  52703. }
  52704. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  52705. }
  52706. } while ($e = $e->getPrevious());
  52707. }
  52708. protected function configureIO(InputInterface $input, OutputInterface $output)
  52709. {
  52710. if (true === $input->hasParameterOption(['--ansi'], true)) {
  52711. $output->setDecorated(true);
  52712. } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
  52713. $output->setDecorated(false);
  52714. }
  52715. if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
  52716. $input->setInteractive(false);
  52717. }
  52718. switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
  52719. case -1: $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); break;
  52720. case 1: $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); break;
  52721. case 2: $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); break;
  52722. case 3: $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); break;
  52723. default: $shellVerbosity = 0; break;
  52724. }
  52725. if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
  52726. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  52727. $shellVerbosity = -1;
  52728. } else {
  52729. if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
  52730. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  52731. $shellVerbosity = 3;
  52732. } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
  52733. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  52734. $shellVerbosity = 2;
  52735. } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
  52736. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  52737. $shellVerbosity = 1;
  52738. }
  52739. }
  52740. if (-1 === $shellVerbosity) {
  52741. $input->setInteractive(false);
  52742. }
  52743. if (\function_exists('putenv')) {
  52744. @putenv('SHELL_VERBOSITY='.$shellVerbosity);
  52745. }
  52746. $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
  52747. $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
  52748. }
  52749. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  52750. {
  52751. foreach ($command->getHelperSet() as $helper) {
  52752. if ($helper instanceof InputAwareInterface) {
  52753. $helper->setInput($input);
  52754. }
  52755. }
  52756. if ($command instanceof SignalableCommandInterface && ($this->signalsToDispatchEvent || $command->getSubscribedSignals())) {
  52757. if (!$this->signalRegistry) {
  52758. throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
  52759. }
  52760. if (Terminal::hasSttyAvailable()) {
  52761. $sttyMode = shell_exec('stty -g');
  52762. foreach ([\SIGINT, \SIGTERM] as $signal) {
  52763. $this->signalRegistry->register($signal, static function () use ($sttyMode) {
  52764. shell_exec('stty '.$sttyMode);
  52765. });
  52766. }
  52767. }
  52768. if ($this->dispatcher) {
  52769. foreach ($this->signalsToDispatchEvent as $signal) {
  52770. $event = new ConsoleSignalEvent($command, $input, $output, $signal);
  52771. $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) {
  52772. $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
  52773. if (!$hasNext) {
  52774. if (!\in_array($signal, [\SIGUSR1, \SIGUSR2], true)) {
  52775. exit(0);
  52776. }
  52777. }
  52778. });
  52779. }
  52780. }
  52781. foreach ($command->getSubscribedSignals() as $signal) {
  52782. $this->signalRegistry->register($signal, [$command, 'handleSignal']);
  52783. }
  52784. }
  52785. if (null === $this->dispatcher) {
  52786. return $command->run($input, $output);
  52787. }
  52788. try {
  52789. $command->mergeApplicationDefinition();
  52790. $input->bind($command->getDefinition());
  52791. } catch (ExceptionInterface $e) {
  52792. }
  52793. $event = new ConsoleCommandEvent($command, $input, $output);
  52794. $e = null;
  52795. try {
  52796. $this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);
  52797. if ($event->commandShouldRun()) {
  52798. $exitCode = $command->run($input, $output);
  52799. } else {
  52800. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  52801. }
  52802. } catch (\Throwable $e) {
  52803. $event = new ConsoleErrorEvent($input, $output, $e, $command);
  52804. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  52805. $e = $event->getError();
  52806. if (0 === $exitCode = $event->getExitCode()) {
  52807. $e = null;
  52808. }
  52809. }
  52810. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  52811. $this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
  52812. if (null !== $e) {
  52813. throw $e;
  52814. }
  52815. return $event->getExitCode();
  52816. }
  52817. protected function getCommandName(InputInterface $input)
  52818. {
  52819. return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument();
  52820. }
  52821. protected function getDefaultInputDefinition()
  52822. {
  52823. return new InputDefinition([
  52824. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  52825. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>'.$this->defaultCommand.'</info> command'),
  52826. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  52827. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  52828. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  52829. new InputOption('--ansi', '', InputOption::VALUE_NEGATABLE, 'Force (or disable --no-ansi) ANSI output', null),
  52830. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  52831. ]);
  52832. }
  52833. protected function getDefaultCommands()
  52834. {
  52835. return [new HelpCommand(), new ListCommand(), new CompleteCommand(), new DumpCompletionCommand()];
  52836. }
  52837. protected function getDefaultHelperSet()
  52838. {
  52839. return new HelperSet([
  52840. new FormatterHelper(),
  52841. new DebugFormatterHelper(),
  52842. new ProcessHelper(),
  52843. new QuestionHelper(),
  52844. ]);
  52845. }
  52846. private function getAbbreviationSuggestions(array $abbrevs): string
  52847. {
  52848. return ' '.implode("\n ", $abbrevs);
  52849. }
  52850. public function extractNamespace(string $name, int $limit = null)
  52851. {
  52852. $parts = explode(':', $name, -1);
  52853. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  52854. }
  52855. private function findAlternatives(string $name, iterable $collection): array
  52856. {
  52857. $threshold = 1e3;
  52858. $alternatives = [];
  52859. $collectionParts = [];
  52860. foreach ($collection as $item) {
  52861. $collectionParts[$item] = explode(':', $item);
  52862. }
  52863. foreach (explode(':', $name) as $i => $subname) {
  52864. foreach ($collectionParts as $collectionName => $parts) {
  52865. $exists = isset($alternatives[$collectionName]);
  52866. if (!isset($parts[$i]) && $exists) {
  52867. $alternatives[$collectionName] += $threshold;
  52868. continue;
  52869. } elseif (!isset($parts[$i])) {
  52870. continue;
  52871. }
  52872. $lev = levenshtein($subname, $parts[$i]);
  52873. if ($lev <= \strlen($subname) / 3 || '' !== $subname && str_contains($parts[$i], $subname)) {
  52874. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  52875. } elseif ($exists) {
  52876. $alternatives[$collectionName] += $threshold;
  52877. }
  52878. }
  52879. }
  52880. foreach ($collection as $item) {
  52881. $lev = levenshtein($name, $item);
  52882. if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
  52883. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  52884. }
  52885. }
  52886. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  52887. ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
  52888. return array_keys($alternatives);
  52889. }
  52890. public function setDefaultCommand(string $commandName, bool $isSingleCommand = false)
  52891. {
  52892. $this->defaultCommand = explode('|', ltrim($commandName, '|'))[0];
  52893. if ($isSingleCommand) {
  52894. $this->find($commandName);
  52895. $this->singleCommand = true;
  52896. }
  52897. return $this;
  52898. }
  52899. public function isSingleCommand(): bool
  52900. {
  52901. return $this->singleCommand;
  52902. }
  52903. private function splitStringByWidth(string $string, int $width): array
  52904. {
  52905. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  52906. return str_split($string, $width);
  52907. }
  52908. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  52909. $lines = [];
  52910. $line = '';
  52911. $offset = 0;
  52912. while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
  52913. $offset += \strlen($m[0]);
  52914. foreach (preg_split('//u', $m[0]) as $char) {
  52915. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  52916. $line .= $char;
  52917. continue;
  52918. }
  52919. $lines[] = str_pad($line, $width);
  52920. $line = $char;
  52921. }
  52922. }
  52923. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  52924. mb_convert_variables($encoding, 'utf8', $lines);
  52925. return $lines;
  52926. }
  52927. private function extractAllNamespaces(string $name): array
  52928. {
  52929. $parts = explode(':', $name, -1);
  52930. $namespaces = [];
  52931. foreach ($parts as $part) {
  52932. if (\count($namespaces)) {
  52933. $namespaces[] = end($namespaces).':'.$part;
  52934. } else {
  52935. $namespaces[] = $part;
  52936. }
  52937. }
  52938. return $namespaces;
  52939. }
  52940. private function init()
  52941. {
  52942. if ($this->initialized) {
  52943. return;
  52944. }
  52945. $this->initialized = true;
  52946. foreach ($this->getDefaultCommands() as $command) {
  52947. $this->add($command);
  52948. }
  52949. }
  52950. }
  52951. <?php
  52952. namespace Symfony\Component\Console\Attribute;
  52953. #[\Attribute(\Attribute::TARGET_CLASS)]
  52954. class AsCommand
  52955. {
  52956. public function __construct(
  52957. public string $name,
  52958. public ?string $description = null,
  52959. array $aliases = [],
  52960. bool $hidden = false,
  52961. ) {
  52962. if (!$hidden && !$aliases) {
  52963. return;
  52964. }
  52965. $name = explode('|', $name);
  52966. $name = array_merge($name, $aliases);
  52967. if ($hidden && '' !== $name[0]) {
  52968. array_unshift($name, '');
  52969. }
  52970. $this->name = implode('|', $name);
  52971. }
  52972. }
  52973. <?php
  52974. namespace Symfony\Component\Console\CI;
  52975. use Symfony\Component\Console\Output\OutputInterface;
  52976. class GithubActionReporter
  52977. {
  52978. private $output;
  52979. private const ESCAPED_DATA = [
  52980. '%' => '%25',
  52981. "\r" => '%0D',
  52982. "\n" => '%0A',
  52983. ];
  52984. private const ESCAPED_PROPERTIES = [
  52985. '%' => '%25',
  52986. "\r" => '%0D',
  52987. "\n" => '%0A',
  52988. ':' => '%3A',
  52989. ',' => '%2C',
  52990. ];
  52991. public function __construct(OutputInterface $output)
  52992. {
  52993. $this->output = $output;
  52994. }
  52995. public static function isGithubActionEnvironment(): bool
  52996. {
  52997. return false !== getenv('GITHUB_ACTIONS');
  52998. }
  52999. public function error(string $message, string $file = null, int $line = null, int $col = null): void
  53000. {
  53001. $this->log('error', $message, $file, $line, $col);
  53002. }
  53003. public function warning(string $message, string $file = null, int $line = null, int $col = null): void
  53004. {
  53005. $this->log('warning', $message, $file, $line, $col);
  53006. }
  53007. public function debug(string $message, string $file = null, int $line = null, int $col = null): void
  53008. {
  53009. $this->log('debug', $message, $file, $line, $col);
  53010. }
  53011. private function log(string $type, string $message, string $file = null, int $line = null, int $col = null): void
  53012. {
  53013. $message = strtr($message, self::ESCAPED_DATA);
  53014. if (!$file) {
  53015. $this->output->writeln(sprintf('::%s::%s', $type, $message));
  53016. return;
  53017. }
  53018. $this->output->writeln(sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message));
  53019. }
  53020. }
  53021. <?php
  53022. namespace Symfony\Component\Console;
  53023. use Symfony\Component\Console\Exception\InvalidArgumentException;
  53024. final class Color
  53025. {
  53026. private const COLORS = [
  53027. 'black' => 0,
  53028. 'red' => 1,
  53029. 'green' => 2,
  53030. 'yellow' => 3,
  53031. 'blue' => 4,
  53032. 'magenta' => 5,
  53033. 'cyan' => 6,
  53034. 'white' => 7,
  53035. 'default' => 9,
  53036. ];
  53037. private const BRIGHT_COLORS = [
  53038. 'gray' => 0,
  53039. 'bright-red' => 1,
  53040. 'bright-green' => 2,
  53041. 'bright-yellow' => 3,
  53042. 'bright-blue' => 4,
  53043. 'bright-magenta' => 5,
  53044. 'bright-cyan' => 6,
  53045. 'bright-white' => 7,
  53046. ];
  53047. private const AVAILABLE_OPTIONS = [
  53048. 'bold' => ['set' => 1, 'unset' => 22],
  53049. 'underscore' => ['set' => 4, 'unset' => 24],
  53050. 'blink' => ['set' => 5, 'unset' => 25],
  53051. 'reverse' => ['set' => 7, 'unset' => 27],
  53052. 'conceal' => ['set' => 8, 'unset' => 28],
  53053. ];
  53054. private $foreground;
  53055. private $background;
  53056. private $options = [];
  53057. public function __construct(string $foreground = '', string $background = '', array $options = [])
  53058. {
  53059. $this->foreground = $this->parseColor($foreground);
  53060. $this->background = $this->parseColor($background, true);
  53061. foreach ($options as $option) {
  53062. if (!isset(self::AVAILABLE_OPTIONS[$option])) {
  53063. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(self::AVAILABLE_OPTIONS))));
  53064. }
  53065. $this->options[$option] = self::AVAILABLE_OPTIONS[$option];
  53066. }
  53067. }
  53068. public function apply(string $text): string
  53069. {
  53070. return $this->set().$text.$this->unset();
  53071. }
  53072. public function set(): string
  53073. {
  53074. $setCodes = [];
  53075. if ('' !== $this->foreground) {
  53076. $setCodes[] = $this->foreground;
  53077. }
  53078. if ('' !== $this->background) {
  53079. $setCodes[] = $this->background;
  53080. }
  53081. foreach ($this->options as $option) {
  53082. $setCodes[] = $option['set'];
  53083. }
  53084. if (0 === \count($setCodes)) {
  53085. return '';
  53086. }
  53087. return sprintf("\033[%sm", implode(';', $setCodes));
  53088. }
  53089. public function unset(): string
  53090. {
  53091. $unsetCodes = [];
  53092. if ('' !== $this->foreground) {
  53093. $unsetCodes[] = 39;
  53094. }
  53095. if ('' !== $this->background) {
  53096. $unsetCodes[] = 49;
  53097. }
  53098. foreach ($this->options as $option) {
  53099. $unsetCodes[] = $option['unset'];
  53100. }
  53101. if (0 === \count($unsetCodes)) {
  53102. return '';
  53103. }
  53104. return sprintf("\033[%sm", implode(';', $unsetCodes));
  53105. }
  53106. private function parseColor(string $color, bool $background = false): string
  53107. {
  53108. if ('' === $color) {
  53109. return '';
  53110. }
  53111. if ('#' === $color[0]) {
  53112. $color = substr($color, 1);
  53113. if (3 === \strlen($color)) {
  53114. $color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
  53115. }
  53116. if (6 !== \strlen($color)) {
  53117. throw new InvalidArgumentException(sprintf('Invalid "%s" color.', $color));
  53118. }
  53119. return ($background ? '4' : '3').$this->convertHexColorToAnsi(hexdec($color));
  53120. }
  53121. if (isset(self::COLORS[$color])) {
  53122. return ($background ? '4' : '3').self::COLORS[$color];
  53123. }
  53124. if (isset(self::BRIGHT_COLORS[$color])) {
  53125. return ($background ? '10' : '9').self::BRIGHT_COLORS[$color];
  53126. }
  53127. throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));
  53128. }
  53129. private function convertHexColorToAnsi(int $color): string
  53130. {
  53131. $r = ($color >> 16) & 255;
  53132. $g = ($color >> 8) & 255;
  53133. $b = $color & 255;
  53134. if ('truecolor' !== getenv('COLORTERM')) {
  53135. return (string) $this->degradeHexColorToAnsi($r, $g, $b);
  53136. }
  53137. return sprintf('8;2;%d;%d;%d', $r, $g, $b);
  53138. }
  53139. private function degradeHexColorToAnsi(int $r, int $g, int $b): int
  53140. {
  53141. if (0 === round($this->getSaturation($r, $g, $b) / 50)) {
  53142. return 0;
  53143. }
  53144. return (round($b / 255) << 2) | (round($g / 255) << 1) | round($r / 255);
  53145. }
  53146. private function getSaturation(int $r, int $g, int $b): int
  53147. {
  53148. $r = $r / 255;
  53149. $g = $g / 255;
  53150. $b = $b / 255;
  53151. $v = max($r, $g, $b);
  53152. if (0 === $diff = $v - min($r, $g, $b)) {
  53153. return 0;
  53154. }
  53155. return (int) $diff * 100 / $v;
  53156. }
  53157. }
  53158. <?php
  53159. namespace Symfony\Component\Console\Command;
  53160. use Symfony\Component\Console\Application;
  53161. use Symfony\Component\Console\Attribute\AsCommand;
  53162. use Symfony\Component\Console\Completion\CompletionInput;
  53163. use Symfony\Component\Console\Completion\CompletionSuggestions;
  53164. use Symfony\Component\Console\Exception\ExceptionInterface;
  53165. use Symfony\Component\Console\Exception\InvalidArgumentException;
  53166. use Symfony\Component\Console\Exception\LogicException;
  53167. use Symfony\Component\Console\Helper\HelperSet;
  53168. use Symfony\Component\Console\Input\InputArgument;
  53169. use Symfony\Component\Console\Input\InputDefinition;
  53170. use Symfony\Component\Console\Input\InputInterface;
  53171. use Symfony\Component\Console\Input\InputOption;
  53172. use Symfony\Component\Console\Output\OutputInterface;
  53173. class Command
  53174. {
  53175. public const SUCCESS = 0;
  53176. public const FAILURE = 1;
  53177. public const INVALID = 2;
  53178. protected static $defaultName;
  53179. protected static $defaultDescription;
  53180. private $application;
  53181. private $name;
  53182. private $processTitle;
  53183. private $aliases = [];
  53184. private $definition;
  53185. private $hidden = false;
  53186. private $help = '';
  53187. private $description = '';
  53188. private $fullDefinition;
  53189. private $ignoreValidationErrors = false;
  53190. private $code;
  53191. private $synopsis = [];
  53192. private $usages = [];
  53193. private $helperSet;
  53194. public static function getDefaultName()
  53195. {
  53196. $class = static::class;
  53197. if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
  53198. return $attribute[0]->newInstance()->name;
  53199. }
  53200. $r = new \ReflectionProperty($class, 'defaultName');
  53201. return $class === $r->class ? static::$defaultName : null;
  53202. }
  53203. public static function getDefaultDescription(): ?string
  53204. {
  53205. $class = static::class;
  53206. if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
  53207. return $attribute[0]->newInstance()->description;
  53208. }
  53209. $r = new \ReflectionProperty($class, 'defaultDescription');
  53210. return $class === $r->class ? static::$defaultDescription : null;
  53211. }
  53212. public function __construct(string $name = null)
  53213. {
  53214. $this->definition = new InputDefinition();
  53215. if (null === $name && null !== $name = static::getDefaultName()) {
  53216. $aliases = explode('|', $name);
  53217. if ('' === $name = array_shift($aliases)) {
  53218. $this->setHidden(true);
  53219. $name = array_shift($aliases);
  53220. }
  53221. $this->setAliases($aliases);
  53222. }
  53223. if (null !== $name) {
  53224. $this->setName($name);
  53225. }
  53226. if ('' === $this->description) {
  53227. $this->setDescription(static::getDefaultDescription() ?? '');
  53228. }
  53229. $this->configure();
  53230. }
  53231. public function ignoreValidationErrors()
  53232. {
  53233. $this->ignoreValidationErrors = true;
  53234. }
  53235. public function setApplication(Application $application = null)
  53236. {
  53237. $this->application = $application;
  53238. if ($application) {
  53239. $this->setHelperSet($application->getHelperSet());
  53240. } else {
  53241. $this->helperSet = null;
  53242. }
  53243. $this->fullDefinition = null;
  53244. }
  53245. public function setHelperSet(HelperSet $helperSet)
  53246. {
  53247. $this->helperSet = $helperSet;
  53248. }
  53249. public function getHelperSet()
  53250. {
  53251. return $this->helperSet;
  53252. }
  53253. public function getApplication()
  53254. {
  53255. return $this->application;
  53256. }
  53257. public function isEnabled()
  53258. {
  53259. return true;
  53260. }
  53261. protected function configure()
  53262. {
  53263. }
  53264. protected function execute(InputInterface $input, OutputInterface $output)
  53265. {
  53266. throw new LogicException('You must override the execute() method in the concrete command class.');
  53267. }
  53268. protected function interact(InputInterface $input, OutputInterface $output)
  53269. {
  53270. }
  53271. protected function initialize(InputInterface $input, OutputInterface $output)
  53272. {
  53273. }
  53274. public function run(InputInterface $input, OutputInterface $output)
  53275. {
  53276. $this->mergeApplicationDefinition();
  53277. try {
  53278. $input->bind($this->getDefinition());
  53279. } catch (ExceptionInterface $e) {
  53280. if (!$this->ignoreValidationErrors) {
  53281. throw $e;
  53282. }
  53283. }
  53284. $this->initialize($input, $output);
  53285. if (null !== $this->processTitle) {
  53286. if (\function_exists('cli_set_process_title')) {
  53287. if (!@cli_set_process_title($this->processTitle)) {
  53288. if ('Darwin' === \PHP_OS) {
  53289. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  53290. } else {
  53291. cli_set_process_title($this->processTitle);
  53292. }
  53293. }
  53294. } elseif (\function_exists('setproctitle')) {
  53295. setproctitle($this->processTitle);
  53296. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  53297. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  53298. }
  53299. }
  53300. if ($input->isInteractive()) {
  53301. $this->interact($input, $output);
  53302. }
  53303. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  53304. $input->setArgument('command', $this->getName());
  53305. }
  53306. $input->validate();
  53307. if ($this->code) {
  53308. $statusCode = ($this->code)($input, $output);
  53309. } else {
  53310. $statusCode = $this->execute($input, $output);
  53311. if (!\is_int($statusCode)) {
  53312. throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
  53313. }
  53314. }
  53315. return is_numeric($statusCode) ? (int) $statusCode : 0;
  53316. }
  53317. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  53318. {
  53319. }
  53320. public function setCode(callable $code)
  53321. {
  53322. if ($code instanceof \Closure) {
  53323. $r = new \ReflectionFunction($code);
  53324. if (null === $r->getClosureThis()) {
  53325. set_error_handler(static function () {});
  53326. try {
  53327. if ($c = \Closure::bind($code, $this)) {
  53328. $code = $c;
  53329. }
  53330. } finally {
  53331. restore_error_handler();
  53332. }
  53333. }
  53334. }
  53335. $this->code = $code;
  53336. return $this;
  53337. }
  53338. public function mergeApplicationDefinition(bool $mergeArgs = true)
  53339. {
  53340. if (null === $this->application) {
  53341. return;
  53342. }
  53343. $this->fullDefinition = new InputDefinition();
  53344. $this->fullDefinition->setOptions($this->definition->getOptions());
  53345. $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
  53346. if ($mergeArgs) {
  53347. $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
  53348. $this->fullDefinition->addArguments($this->definition->getArguments());
  53349. } else {
  53350. $this->fullDefinition->setArguments($this->definition->getArguments());
  53351. }
  53352. }
  53353. public function setDefinition($definition)
  53354. {
  53355. if ($definition instanceof InputDefinition) {
  53356. $this->definition = $definition;
  53357. } else {
  53358. $this->definition->setDefinition($definition);
  53359. }
  53360. $this->fullDefinition = null;
  53361. return $this;
  53362. }
  53363. public function getDefinition()
  53364. {
  53365. return $this->fullDefinition ?? $this->getNativeDefinition();
  53366. }
  53367. public function getNativeDefinition()
  53368. {
  53369. if (null === $this->definition) {
  53370. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
  53371. }
  53372. return $this->definition;
  53373. }
  53374. public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
  53375. {
  53376. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  53377. if (null !== $this->fullDefinition) {
  53378. $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
  53379. }
  53380. return $this;
  53381. }
  53382. public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
  53383. {
  53384. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  53385. if (null !== $this->fullDefinition) {
  53386. $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  53387. }
  53388. return $this;
  53389. }
  53390. public function setName(string $name)
  53391. {
  53392. $this->validateName($name);
  53393. $this->name = $name;
  53394. return $this;
  53395. }
  53396. public function setProcessTitle(string $title)
  53397. {
  53398. $this->processTitle = $title;
  53399. return $this;
  53400. }
  53401. public function getName()
  53402. {
  53403. return $this->name;
  53404. }
  53405. public function setHidden(bool $hidden )
  53406. {
  53407. $this->hidden = $hidden;
  53408. return $this;
  53409. }
  53410. public function isHidden()
  53411. {
  53412. return $this->hidden;
  53413. }
  53414. public function setDescription(string $description)
  53415. {
  53416. $this->description = $description;
  53417. return $this;
  53418. }
  53419. public function getDescription()
  53420. {
  53421. return $this->description;
  53422. }
  53423. public function setHelp(string $help)
  53424. {
  53425. $this->help = $help;
  53426. return $this;
  53427. }
  53428. public function getHelp()
  53429. {
  53430. return $this->help;
  53431. }
  53432. public function getProcessedHelp()
  53433. {
  53434. $name = $this->name;
  53435. $isSingleCommand = $this->application && $this->application->isSingleCommand();
  53436. $placeholders = [
  53437. '%command.name%',
  53438. '%command.full_name%',
  53439. ];
  53440. $replacements = [
  53441. $name,
  53442. $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
  53443. ];
  53444. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  53445. }
  53446. public function setAliases(iterable $aliases)
  53447. {
  53448. $list = [];
  53449. foreach ($aliases as $alias) {
  53450. $this->validateName($alias);
  53451. $list[] = $alias;
  53452. }
  53453. $this->aliases = \is_array($aliases) ? $aliases : $list;
  53454. return $this;
  53455. }
  53456. public function getAliases()
  53457. {
  53458. return $this->aliases;
  53459. }
  53460. public function getSynopsis(bool $short = false)
  53461. {
  53462. $key = $short ? 'short' : 'long';
  53463. if (!isset($this->synopsis[$key])) {
  53464. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  53465. }
  53466. return $this->synopsis[$key];
  53467. }
  53468. public function addUsage(string $usage)
  53469. {
  53470. if (!str_starts_with($usage, $this->name)) {
  53471. $usage = sprintf('%s %s', $this->name, $usage);
  53472. }
  53473. $this->usages[] = $usage;
  53474. return $this;
  53475. }
  53476. public function getUsages()
  53477. {
  53478. return $this->usages;
  53479. }
  53480. public function getHelper(string $name)
  53481. {
  53482. if (null === $this->helperSet) {
  53483. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  53484. }
  53485. return $this->helperSet->get($name);
  53486. }
  53487. private function validateName(string $name)
  53488. {
  53489. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  53490. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  53491. }
  53492. }
  53493. }
  53494. <?php
  53495. namespace Symfony\Component\Console\Command;
  53496. use Symfony\Component\Console\Completion\CompletionInput;
  53497. use Symfony\Component\Console\Completion\CompletionSuggestions;
  53498. use Symfony\Component\Console\Completion\Output\BashCompletionOutput;
  53499. use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
  53500. use Symfony\Component\Console\Exception\CommandNotFoundException;
  53501. use Symfony\Component\Console\Exception\ExceptionInterface;
  53502. use Symfony\Component\Console\Input\InputInterface;
  53503. use Symfony\Component\Console\Input\InputOption;
  53504. use Symfony\Component\Console\Output\OutputInterface;
  53505. final class CompleteCommand extends Command
  53506. {
  53507. protected static $defaultName = '|_complete';
  53508. protected static $defaultDescription = 'Internal command to provide shell completion suggestions';
  53509. private $completionOutputs;
  53510. private $isDebug = false;
  53511. public function __construct(array $completionOutputs = [])
  53512. {
  53513. $this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class];
  53514. parent::__construct();
  53515. }
  53516. protected function configure(): void
  53517. {
  53518. $this
  53519. ->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("'.implode('", "', array_keys($this->completionOutputs)).'")')
  53520. ->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)')
  53521. ->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)')
  53522. ->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script')
  53523. ;
  53524. }
  53525. protected function initialize(InputInterface $input, OutputInterface $output)
  53526. {
  53527. $this->isDebug = filter_var(getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOLEAN);
  53528. }
  53529. protected function execute(InputInterface $input, OutputInterface $output): int
  53530. {
  53531. try {
  53532. $shell = $input->getOption('shell');
  53533. if (!$shell) {
  53534. throw new \RuntimeException('The "--shell" option must be set.');
  53535. }
  53536. if (!$completionOutput = $this->completionOutputs[$shell] ?? false) {
  53537. throw new \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
  53538. }
  53539. $completionInput = $this->createCompletionInput($input);
  53540. $suggestions = new CompletionSuggestions();
  53541. $this->log([
  53542. '',
  53543. '<comment>'.date('Y-m-d H:i:s').'</>',
  53544. '<info>Input:</> <comment>("|" indicates the cursor position)</>',
  53545. ' '.(string) $completionInput,
  53546. '<info>Command:</>',
  53547. ' '.(string) implode(' ', $_SERVER['argv']),
  53548. '<info>Messages:</>',
  53549. ]);
  53550. $command = $this->findCommand($completionInput, $output);
  53551. if (null === $command) {
  53552. $this->log(' No command found, completing using the Application class.');
  53553. $this->getApplication()->complete($completionInput, $suggestions);
  53554. } elseif (
  53555. $completionInput->mustSuggestArgumentValuesFor('command')
  53556. && $command->getName() !== $completionInput->getCompletionValue()
  53557. ) {
  53558. $this->log(' No command found, completing using the Application class.');
  53559. $suggestions->suggestValue($command->getName());
  53560. } else {
  53561. $command->mergeApplicationDefinition();
  53562. $completionInput->bind($command->getDefinition());
  53563. if (CompletionInput::TYPE_OPTION_NAME === $completionInput->getCompletionType()) {
  53564. $this->log(' Completing option names for the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> command.');
  53565. $suggestions->suggestOptions($command->getDefinition()->getOptions());
  53566. } else {
  53567. $this->log([
  53568. ' Completing using the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> class.',
  53569. ' Completing <comment>'.$completionInput->getCompletionType().'</> for <comment>'.$completionInput->getCompletionName().'</>',
  53570. ]);
  53571. if (null !== $compval = $completionInput->getCompletionValue()) {
  53572. $this->log(' Current value: <comment>'.$compval.'</>');
  53573. }
  53574. $command->complete($completionInput, $suggestions);
  53575. }
  53576. }
  53577. $completionOutput = new $completionOutput();
  53578. $this->log('<info>Suggestions:</>');
  53579. if ($options = $suggestions->getOptionSuggestions()) {
  53580. $this->log(' --'.implode(' --', array_map(function ($o) { return $o->getName(); }, $options)));
  53581. } elseif ($values = $suggestions->getValueSuggestions()) {
  53582. $this->log(' '.implode(' ', $values));
  53583. } else {
  53584. $this->log(' <comment>No suggestions were provided</>');
  53585. }
  53586. $completionOutput->write($suggestions, $output);
  53587. } catch (\Throwable $e) {
  53588. $this->log([
  53589. '<error>Error!</error>',
  53590. (string) $e,
  53591. ]);
  53592. if ($output->isDebug()) {
  53593. throw $e;
  53594. }
  53595. return self::FAILURE;
  53596. }
  53597. return self::SUCCESS;
  53598. }
  53599. private function createCompletionInput(InputInterface $input): CompletionInput
  53600. {
  53601. $currentIndex = $input->getOption('current');
  53602. if (!$currentIndex || !ctype_digit($currentIndex)) {
  53603. throw new \RuntimeException('The "--current" option must be set and it must be an integer.');
  53604. }
  53605. $completionInput = CompletionInput::fromTokens($input->getOption('input'), (int) $currentIndex);
  53606. try {
  53607. $completionInput->bind($this->getApplication()->getDefinition());
  53608. } catch (ExceptionInterface $e) {
  53609. }
  53610. return $completionInput;
  53611. }
  53612. private function findCommand(CompletionInput $completionInput, OutputInterface $output): ?Command
  53613. {
  53614. try {
  53615. $inputName = $completionInput->getFirstArgument();
  53616. if (null === $inputName) {
  53617. return null;
  53618. }
  53619. return $this->getApplication()->find($inputName);
  53620. } catch (CommandNotFoundException $e) {
  53621. }
  53622. return null;
  53623. }
  53624. private function log($messages): void
  53625. {
  53626. if (!$this->isDebug) {
  53627. return;
  53628. }
  53629. $commandName = basename($_SERVER['argv'][0]);
  53630. file_put_contents(sys_get_temp_dir().'/sf_'.$commandName.'.log', implode(\PHP_EOL, (array) $messages).\PHP_EOL, \FILE_APPEND);
  53631. }
  53632. }
  53633. <?php
  53634. namespace Symfony\Component\Console\Command;
  53635. use Symfony\Component\Console\Completion\CompletionInput;
  53636. use Symfony\Component\Console\Completion\CompletionSuggestions;
  53637. use Symfony\Component\Console\Input\InputArgument;
  53638. use Symfony\Component\Console\Input\InputInterface;
  53639. use Symfony\Component\Console\Input\InputOption;
  53640. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  53641. use Symfony\Component\Console\Output\OutputInterface;
  53642. use Symfony\Component\Process\Process;
  53643. final class DumpCompletionCommand extends Command
  53644. {
  53645. protected static $defaultName = 'completion';
  53646. protected static $defaultDescription = 'Dump the shell completion script';
  53647. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  53648. {
  53649. if ($input->mustSuggestArgumentValuesFor('shell')) {
  53650. $suggestions->suggestValues($this->getSupportedShells());
  53651. }
  53652. }
  53653. protected function configure()
  53654. {
  53655. $fullCommand = $_SERVER['PHP_SELF'];
  53656. $commandName = basename($fullCommand);
  53657. $fullCommand = realpath($fullCommand) ?: $fullCommand;
  53658. $this
  53659. ->setHelp(<<<EOH
  53660. The <info>%command.name%</> command dumps the shell completion script required
  53661. to use shell autocompletion (currently only bash completion is supported).
  53662. <comment>Static installation
  53663. -------------------</>
  53664. Dump the script to a global completion file and restart your shell:
  53665. <info>%command.full_name% bash | sudo tee /etc/bash_completion.d/${commandName}</>
  53666. Or dump the script to a local file and source it:
  53667. <info>%command.full_name% bash > completion.sh</>
  53668. <comment># source the file whenever you use the project</>
  53669. <info>source completion.sh</>
  53670. <comment># or add this line at the end of your "~/.bashrc" file:</>
  53671. <info>source /path/to/completion.sh</>
  53672. <comment>Dynamic installation
  53673. --------------------</>
  53674. Add this to the end of your shell configuration file (e.g. <info>"~/.bashrc"</>):
  53675. <info>eval "$(${fullCommand} completion bash)"</>
  53676. EOH
  53677. )
  53678. ->addArgument('shell', InputArgument::OPTIONAL, 'The shell type (e.g. "bash"), the value of the "$SHELL" env var will be used if this is not given')
  53679. ->addOption('debug', null, InputOption::VALUE_NONE, 'Tail the completion debug log')
  53680. ;
  53681. }
  53682. protected function execute(InputInterface $input, OutputInterface $output): int
  53683. {
  53684. $commandName = basename($_SERVER['argv'][0]);
  53685. if ($input->getOption('debug')) {
  53686. $this->tailDebugLog($commandName, $output);
  53687. return self::SUCCESS;
  53688. }
  53689. $shell = $input->getArgument('shell') ?? self::guessShell();
  53690. $completionFile = __DIR__.'/../Resources/completion.'.$shell;
  53691. if (!file_exists($completionFile)) {
  53692. $supportedShells = $this->getSupportedShells();
  53693. ($output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output)
  53694. ->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
  53695. return self::INVALID;
  53696. }
  53697. $output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], file_get_contents($completionFile)));
  53698. return self::SUCCESS;
  53699. }
  53700. private static function guessShell(): string
  53701. {
  53702. return basename($_SERVER['SHELL'] ?? '');
  53703. }
  53704. private function tailDebugLog(string $commandName, OutputInterface $output): void
  53705. {
  53706. $debugFile = sys_get_temp_dir().'/sf_'.$commandName.'.log';
  53707. if (!file_exists($debugFile)) {
  53708. touch($debugFile);
  53709. }
  53710. $process = new Process(['tail', '-f', $debugFile], null, null, null, 0);
  53711. $process->run(function (string $type, string $line) use ($output): void {
  53712. $output->write($line);
  53713. });
  53714. }
  53715. private function getSupportedShells(): array
  53716. {
  53717. return array_map(function ($f) {
  53718. return pathinfo($f, \PATHINFO_EXTENSION);
  53719. }, glob(__DIR__.'/../Resources/completion.*'));
  53720. }
  53721. }
  53722. <?php
  53723. namespace Symfony\Component\Console\Command;
  53724. use Symfony\Component\Console\Completion\CompletionInput;
  53725. use Symfony\Component\Console\Completion\CompletionSuggestions;
  53726. use Symfony\Component\Console\Descriptor\ApplicationDescription;
  53727. use Symfony\Component\Console\Helper\DescriptorHelper;
  53728. use Symfony\Component\Console\Input\InputArgument;
  53729. use Symfony\Component\Console\Input\InputInterface;
  53730. use Symfony\Component\Console\Input\InputOption;
  53731. use Symfony\Component\Console\Output\OutputInterface;
  53732. class HelpCommand extends Command
  53733. {
  53734. private $command;
  53735. protected function configure()
  53736. {
  53737. $this->ignoreValidationErrors();
  53738. $this
  53739. ->setName('help')
  53740. ->setDefinition([
  53741. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  53742. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  53743. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  53744. ])
  53745. ->setDescription('Display help for a command')
  53746. ->setHelp(<<<'EOF'
  53747. The <info>%command.name%</info> command displays help for a given command:
  53748. <info>%command.full_name% list</info>
  53749. You can also output the help in other formats by using the <comment>--format</comment> option:
  53750. <info>%command.full_name% --format=xml list</info>
  53751. To display the list of available commands, please use the <info>list</info> command.
  53752. EOF
  53753. )
  53754. ;
  53755. }
  53756. public function setCommand(Command $command)
  53757. {
  53758. $this->command = $command;
  53759. }
  53760. protected function execute(InputInterface $input, OutputInterface $output)
  53761. {
  53762. if (null === $this->command) {
  53763. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  53764. }
  53765. $helper = new DescriptorHelper();
  53766. $helper->describe($output, $this->command, [
  53767. 'format' => $input->getOption('format'),
  53768. 'raw_text' => $input->getOption('raw'),
  53769. ]);
  53770. $this->command = null;
  53771. return 0;
  53772. }
  53773. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  53774. {
  53775. if ($input->mustSuggestArgumentValuesFor('command_name')) {
  53776. $descriptor = new ApplicationDescription($this->getApplication());
  53777. $suggestions->suggestValues(array_keys($descriptor->getCommands()));
  53778. return;
  53779. }
  53780. if ($input->mustSuggestOptionValuesFor('format')) {
  53781. $helper = new DescriptorHelper();
  53782. $suggestions->suggestValues($helper->getFormats());
  53783. }
  53784. }
  53785. }
  53786. <?php
  53787. namespace Symfony\Component\Console\Command;
  53788. use Symfony\Component\Console\Application;
  53789. use Symfony\Component\Console\Completion\CompletionInput;
  53790. use Symfony\Component\Console\Completion\CompletionSuggestions;
  53791. use Symfony\Component\Console\Helper\HelperSet;
  53792. use Symfony\Component\Console\Input\InputDefinition;
  53793. use Symfony\Component\Console\Input\InputInterface;
  53794. use Symfony\Component\Console\Output\OutputInterface;
  53795. final class LazyCommand extends Command
  53796. {
  53797. private $command;
  53798. private $isEnabled;
  53799. public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
  53800. {
  53801. $this->setName($name)
  53802. ->setAliases($aliases)
  53803. ->setHidden($isHidden)
  53804. ->setDescription($description);
  53805. $this->command = $commandFactory;
  53806. $this->isEnabled = $isEnabled;
  53807. }
  53808. public function ignoreValidationErrors(): void
  53809. {
  53810. $this->getCommand()->ignoreValidationErrors();
  53811. }
  53812. public function setApplication(Application $application = null): void
  53813. {
  53814. if ($this->command instanceof parent) {
  53815. $this->command->setApplication($application);
  53816. }
  53817. parent::setApplication($application);
  53818. }
  53819. public function setHelperSet(HelperSet $helperSet): void
  53820. {
  53821. if ($this->command instanceof parent) {
  53822. $this->command->setHelperSet($helperSet);
  53823. }
  53824. parent::setHelperSet($helperSet);
  53825. }
  53826. public function isEnabled(): bool
  53827. {
  53828. return $this->isEnabled ?? $this->getCommand()->isEnabled();
  53829. }
  53830. public function run(InputInterface $input, OutputInterface $output): int
  53831. {
  53832. return $this->getCommand()->run($input, $output);
  53833. }
  53834. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  53835. {
  53836. $this->getCommand()->complete($input, $suggestions);
  53837. }
  53838. public function setCode(callable $code): self
  53839. {
  53840. $this->getCommand()->setCode($code);
  53841. return $this;
  53842. }
  53843. public function mergeApplicationDefinition(bool $mergeArgs = true): void
  53844. {
  53845. $this->getCommand()->mergeApplicationDefinition($mergeArgs);
  53846. }
  53847. public function setDefinition($definition): self
  53848. {
  53849. $this->getCommand()->setDefinition($definition);
  53850. return $this;
  53851. }
  53852. public function getDefinition(): InputDefinition
  53853. {
  53854. return $this->getCommand()->getDefinition();
  53855. }
  53856. public function getNativeDefinition(): InputDefinition
  53857. {
  53858. return $this->getCommand()->getNativeDefinition();
  53859. }
  53860. public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
  53861. {
  53862. $this->getCommand()->addArgument($name, $mode, $description, $default);
  53863. return $this;
  53864. }
  53865. public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
  53866. {
  53867. $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
  53868. return $this;
  53869. }
  53870. public function setProcessTitle(string $title): self
  53871. {
  53872. $this->getCommand()->setProcessTitle($title);
  53873. return $this;
  53874. }
  53875. public function setHelp(string $help): self
  53876. {
  53877. $this->getCommand()->setHelp($help);
  53878. return $this;
  53879. }
  53880. public function getHelp(): string
  53881. {
  53882. return $this->getCommand()->getHelp();
  53883. }
  53884. public function getProcessedHelp(): string
  53885. {
  53886. return $this->getCommand()->getProcessedHelp();
  53887. }
  53888. public function getSynopsis(bool $short = false): string
  53889. {
  53890. return $this->getCommand()->getSynopsis($short);
  53891. }
  53892. public function addUsage(string $usage): self
  53893. {
  53894. $this->getCommand()->addUsage($usage);
  53895. return $this;
  53896. }
  53897. public function getUsages(): array
  53898. {
  53899. return $this->getCommand()->getUsages();
  53900. }
  53901. public function getHelper(string $name)
  53902. {
  53903. return $this->getCommand()->getHelper($name);
  53904. }
  53905. public function getCommand(): parent
  53906. {
  53907. if (!$this->command instanceof \Closure) {
  53908. return $this->command;
  53909. }
  53910. $command = $this->command = ($this->command)();
  53911. $command->setApplication($this->getApplication());
  53912. if (null !== $this->getHelperSet()) {
  53913. $command->setHelperSet($this->getHelperSet());
  53914. }
  53915. $command->setName($this->getName())
  53916. ->setAliases($this->getAliases())
  53917. ->setHidden($this->isHidden())
  53918. ->setDescription($this->getDescription());
  53919. $command->getDefinition();
  53920. return $command;
  53921. }
  53922. }
  53923. <?php
  53924. namespace Symfony\Component\Console\Command;
  53925. use Symfony\Component\Console\Completion\CompletionInput;
  53926. use Symfony\Component\Console\Completion\CompletionSuggestions;
  53927. use Symfony\Component\Console\Descriptor\ApplicationDescription;
  53928. use Symfony\Component\Console\Helper\DescriptorHelper;
  53929. use Symfony\Component\Console\Input\InputArgument;
  53930. use Symfony\Component\Console\Input\InputInterface;
  53931. use Symfony\Component\Console\Input\InputOption;
  53932. use Symfony\Component\Console\Output\OutputInterface;
  53933. class ListCommand extends Command
  53934. {
  53935. protected function configure()
  53936. {
  53937. $this
  53938. ->setName('list')
  53939. ->setDefinition([
  53940. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  53941. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  53942. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  53943. new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
  53944. ])
  53945. ->setDescription('List commands')
  53946. ->setHelp(<<<'EOF'
  53947. The <info>%command.name%</info> command lists all commands:
  53948. <info>%command.full_name%</info>
  53949. You can also display the commands for a specific namespace:
  53950. <info>%command.full_name% test</info>
  53951. You can also output the information in other formats by using the <comment>--format</comment> option:
  53952. <info>%command.full_name% --format=xml</info>
  53953. It's also possible to get raw list of commands (useful for embedding command runner):
  53954. <info>%command.full_name% --raw</info>
  53955. EOF
  53956. )
  53957. ;
  53958. }
  53959. protected function execute(InputInterface $input, OutputInterface $output)
  53960. {
  53961. $helper = new DescriptorHelper();
  53962. $helper->describe($output, $this->getApplication(), [
  53963. 'format' => $input->getOption('format'),
  53964. 'raw_text' => $input->getOption('raw'),
  53965. 'namespace' => $input->getArgument('namespace'),
  53966. 'short' => $input->getOption('short'),
  53967. ]);
  53968. return 0;
  53969. }
  53970. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  53971. {
  53972. if ($input->mustSuggestArgumentValuesFor('namespace')) {
  53973. $descriptor = new ApplicationDescription($this->getApplication());
  53974. $suggestions->suggestValues(array_keys($descriptor->getNamespaces()));
  53975. return;
  53976. }
  53977. if ($input->mustSuggestOptionValuesFor('format')) {
  53978. $helper = new DescriptorHelper();
  53979. $suggestions->suggestValues($helper->getFormats());
  53980. }
  53981. }
  53982. }
  53983. <?php
  53984. namespace Symfony\Component\Console\Command;
  53985. use Symfony\Component\Console\Exception\LogicException;
  53986. use Symfony\Component\Lock\LockFactory;
  53987. use Symfony\Component\Lock\LockInterface;
  53988. use Symfony\Component\Lock\Store\FlockStore;
  53989. use Symfony\Component\Lock\Store\SemaphoreStore;
  53990. trait LockableTrait
  53991. {
  53992. private $lock;
  53993. private function lock(string $name = null, bool $blocking = false): bool
  53994. {
  53995. if (!class_exists(SemaphoreStore::class)) {
  53996. throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
  53997. }
  53998. if (null !== $this->lock) {
  53999. throw new LogicException('A lock is already in place.');
  54000. }
  54001. if (SemaphoreStore::isSupported()) {
  54002. $store = new SemaphoreStore();
  54003. } else {
  54004. $store = new FlockStore();
  54005. }
  54006. $this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
  54007. if (!$this->lock->acquire($blocking)) {
  54008. $this->lock = null;
  54009. return false;
  54010. }
  54011. return true;
  54012. }
  54013. private function release()
  54014. {
  54015. if ($this->lock) {
  54016. $this->lock->release();
  54017. $this->lock = null;
  54018. }
  54019. }
  54020. }
  54021. <?php
  54022. namespace Symfony\Component\Console\Command;
  54023. interface SignalableCommandInterface
  54024. {
  54025. public function getSubscribedSignals(): array;
  54026. public function handleSignal(int $signal): void;
  54027. }
  54028. <?php
  54029. namespace Symfony\Component\Console\CommandLoader;
  54030. use Symfony\Component\Console\Command\Command;
  54031. use Symfony\Component\Console\Exception\CommandNotFoundException;
  54032. interface CommandLoaderInterface
  54033. {
  54034. public function get(string $name);
  54035. public function has(string $name);
  54036. public function getNames();
  54037. }
  54038. <?php
  54039. namespace Symfony\Component\Console\CommandLoader;
  54040. use Psr\Container\ContainerInterface;
  54041. use Symfony\Component\Console\Exception\CommandNotFoundException;
  54042. class ContainerCommandLoader implements CommandLoaderInterface
  54043. {
  54044. private $container;
  54045. private $commandMap;
  54046. public function __construct(ContainerInterface $container, array $commandMap)
  54047. {
  54048. $this->container = $container;
  54049. $this->commandMap = $commandMap;
  54050. }
  54051. public function get(string $name)
  54052. {
  54053. if (!$this->has($name)) {
  54054. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  54055. }
  54056. return $this->container->get($this->commandMap[$name]);
  54057. }
  54058. public function has(string $name)
  54059. {
  54060. return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
  54061. }
  54062. public function getNames()
  54063. {
  54064. return array_keys($this->commandMap);
  54065. }
  54066. }
  54067. <?php
  54068. namespace Symfony\Component\Console\CommandLoader;
  54069. use Symfony\Component\Console\Exception\CommandNotFoundException;
  54070. class FactoryCommandLoader implements CommandLoaderInterface
  54071. {
  54072. private $factories;
  54073. public function __construct(array $factories)
  54074. {
  54075. $this->factories = $factories;
  54076. }
  54077. public function has(string $name)
  54078. {
  54079. return isset($this->factories[$name]);
  54080. }
  54081. public function get(string $name)
  54082. {
  54083. if (!isset($this->factories[$name])) {
  54084. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  54085. }
  54086. $factory = $this->factories[$name];
  54087. return $factory();
  54088. }
  54089. public function getNames()
  54090. {
  54091. return array_keys($this->factories);
  54092. }
  54093. }
  54094. <?php
  54095. namespace Symfony\Component\Console\Completion;
  54096. use Symfony\Component\Console\Exception\RuntimeException;
  54097. use Symfony\Component\Console\Input\ArgvInput;
  54098. use Symfony\Component\Console\Input\InputDefinition;
  54099. use Symfony\Component\Console\Input\InputOption;
  54100. final class CompletionInput extends ArgvInput
  54101. {
  54102. public const TYPE_ARGUMENT_VALUE = 'argument_value';
  54103. public const TYPE_OPTION_VALUE = 'option_value';
  54104. public const TYPE_OPTION_NAME = 'option_name';
  54105. public const TYPE_NONE = 'none';
  54106. private $tokens;
  54107. private $currentIndex;
  54108. private $completionType;
  54109. private $completionName = null;
  54110. private $completionValue = '';
  54111. public static function fromString(string $inputStr, int $currentIndex): self
  54112. {
  54113. preg_match_all('/(?<=^|\s)([\'"]?)(.+?)(?<!\\\\)\1(?=$|\s)/', $inputStr, $tokens);
  54114. return self::fromTokens($tokens[0], $currentIndex);
  54115. }
  54116. public static function fromTokens(array $tokens, int $currentIndex): self
  54117. {
  54118. $input = new self($tokens);
  54119. $input->tokens = $tokens;
  54120. $input->currentIndex = $currentIndex;
  54121. return $input;
  54122. }
  54123. public function bind(InputDefinition $definition): void
  54124. {
  54125. parent::bind($definition);
  54126. $relevantToken = $this->getRelevantToken();
  54127. if ('-' === $relevantToken[0]) {
  54128. [$optionToken, $optionValue] = explode('=', $relevantToken, 2) + ['', ''];
  54129. $option = $this->getOptionFromToken($optionToken);
  54130. if (null === $option && !$this->isCursorFree()) {
  54131. $this->completionType = self::TYPE_OPTION_NAME;
  54132. $this->completionValue = $relevantToken;
  54133. return;
  54134. }
  54135. if (null !== $option && $option->acceptValue()) {
  54136. $this->completionType = self::TYPE_OPTION_VALUE;
  54137. $this->completionName = $option->getName();
  54138. $this->completionValue = $optionValue ?: (!str_starts_with($optionToken, '--') ? substr($optionToken, 2) : '');
  54139. return;
  54140. }
  54141. }
  54142. $previousToken = $this->tokens[$this->currentIndex - 1];
  54143. if ('-' === $previousToken[0] && '' !== trim($previousToken, '-')) {
  54144. $previousOption = $this->getOptionFromToken($previousToken);
  54145. if (null !== $previousOption && $previousOption->acceptValue()) {
  54146. $this->completionType = self::TYPE_OPTION_VALUE;
  54147. $this->completionName = $previousOption->getName();
  54148. $this->completionValue = $relevantToken;
  54149. return;
  54150. }
  54151. }
  54152. $this->completionType = self::TYPE_ARGUMENT_VALUE;
  54153. foreach ($this->definition->getArguments() as $argumentName => $argument) {
  54154. if (!isset($this->arguments[$argumentName])) {
  54155. break;
  54156. }
  54157. $argumentValue = $this->arguments[$argumentName];
  54158. $this->completionName = $argumentName;
  54159. if (\is_array($argumentValue)) {
  54160. $this->completionValue = $argumentValue ? $argumentValue[array_key_last($argumentValue)] : null;
  54161. } else {
  54162. $this->completionValue = $argumentValue;
  54163. }
  54164. }
  54165. if ($this->currentIndex >= \count($this->tokens)) {
  54166. if (!isset($this->arguments[$argumentName]) || $this->definition->getArgument($argumentName)->isArray()) {
  54167. $this->completionName = $argumentName;
  54168. $this->completionValue = '';
  54169. } else {
  54170. $this->completionType = self::TYPE_NONE;
  54171. $this->completionName = null;
  54172. $this->completionValue = '';
  54173. }
  54174. }
  54175. }
  54176. public function getCompletionType(): string
  54177. {
  54178. return $this->completionType;
  54179. }
  54180. public function getCompletionName(): ?string
  54181. {
  54182. return $this->completionName;
  54183. }
  54184. public function getCompletionValue(): string
  54185. {
  54186. return $this->completionValue;
  54187. }
  54188. public function mustSuggestOptionValuesFor(string $optionName): bool
  54189. {
  54190. return self::TYPE_OPTION_VALUE === $this->getCompletionType() && $optionName === $this->getCompletionName();
  54191. }
  54192. public function mustSuggestArgumentValuesFor(string $argumentName): bool
  54193. {
  54194. return self::TYPE_ARGUMENT_VALUE === $this->getCompletionType() && $argumentName === $this->getCompletionName();
  54195. }
  54196. protected function parseToken(string $token, bool $parseOptions): bool
  54197. {
  54198. try {
  54199. return parent::parseToken($token, $parseOptions);
  54200. } catch (RuntimeException $e) {
  54201. }
  54202. return $parseOptions;
  54203. }
  54204. private function getOptionFromToken(string $optionToken): ?InputOption
  54205. {
  54206. $optionName = ltrim($optionToken, '-');
  54207. if (!$optionName) {
  54208. return null;
  54209. }
  54210. if ('-' === ($optionToken[1] ?? ' ')) {
  54211. return $this->definition->hasOption($optionName) ? $this->definition->getOption($optionName) : null;
  54212. }
  54213. return $this->definition->hasShortcut($optionName[0]) ? $this->definition->getOptionForShortcut($optionName[0]) : null;
  54214. }
  54215. private function getRelevantToken(): string
  54216. {
  54217. return $this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex];
  54218. }
  54219. private function isCursorFree(): bool
  54220. {
  54221. $nrOfTokens = \count($this->tokens);
  54222. if ($this->currentIndex > $nrOfTokens) {
  54223. throw new \LogicException('Current index is invalid, it must be the number of input tokens or one more.');
  54224. }
  54225. return $this->currentIndex >= $nrOfTokens;
  54226. }
  54227. public function __toString()
  54228. {
  54229. $str = '';
  54230. foreach ($this->tokens as $i => $token) {
  54231. $str .= $token;
  54232. if ($this->currentIndex === $i) {
  54233. $str .= '|';
  54234. }
  54235. $str .= ' ';
  54236. }
  54237. if ($this->currentIndex > $i) {
  54238. $str .= '|';
  54239. }
  54240. return rtrim($str);
  54241. }
  54242. }
  54243. <?php
  54244. namespace Symfony\Component\Console\Completion;
  54245. use Symfony\Component\Console\Input\InputOption;
  54246. final class CompletionSuggestions
  54247. {
  54248. private $valueSuggestions = [];
  54249. private $optionSuggestions = [];
  54250. public function suggestValue($value): self
  54251. {
  54252. $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value;
  54253. return $this;
  54254. }
  54255. public function suggestValues(array $values): self
  54256. {
  54257. foreach ($values as $value) {
  54258. $this->suggestValue($value);
  54259. }
  54260. return $this;
  54261. }
  54262. public function suggestOption(InputOption $option): self
  54263. {
  54264. $this->optionSuggestions[] = $option;
  54265. return $this;
  54266. }
  54267. public function suggestOptions(array $options): self
  54268. {
  54269. foreach ($options as $option) {
  54270. $this->suggestOption($option);
  54271. }
  54272. return $this;
  54273. }
  54274. public function getOptionSuggestions(): array
  54275. {
  54276. return $this->optionSuggestions;
  54277. }
  54278. public function getValueSuggestions(): array
  54279. {
  54280. return $this->valueSuggestions;
  54281. }
  54282. }
  54283. <?php
  54284. namespace Symfony\Component\Console\Completion\Output;
  54285. use Symfony\Component\Console\Completion\CompletionSuggestions;
  54286. use Symfony\Component\Console\Output\OutputInterface;
  54287. class BashCompletionOutput implements CompletionOutputInterface
  54288. {
  54289. public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
  54290. {
  54291. $values = $suggestions->getValueSuggestions();
  54292. foreach ($suggestions->getOptionSuggestions() as $option) {
  54293. $values[] = '--'.$option->getName();
  54294. }
  54295. $output->writeln(implode("\n", $values));
  54296. }
  54297. }
  54298. <?php
  54299. namespace Symfony\Component\Console\Completion\Output;
  54300. use Symfony\Component\Console\Completion\CompletionSuggestions;
  54301. use Symfony\Component\Console\Output\OutputInterface;
  54302. interface CompletionOutputInterface
  54303. {
  54304. public function write(CompletionSuggestions $suggestions, OutputInterface $output): void;
  54305. }
  54306. <?php
  54307. namespace Symfony\Component\Console\Completion;
  54308. class Suggestion
  54309. {
  54310. private $value;
  54311. public function __construct(string $value)
  54312. {
  54313. $this->value = $value;
  54314. }
  54315. public function getValue(): string
  54316. {
  54317. return $this->value;
  54318. }
  54319. public function __toString(): string
  54320. {
  54321. return $this->getValue();
  54322. }
  54323. }
  54324. <?php
  54325. namespace Symfony\Component\Console;
  54326. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  54327. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  54328. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  54329. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  54330. final class ConsoleEvents
  54331. {
  54332. public const COMMAND = 'console.command';
  54333. public const SIGNAL = 'console.signal';
  54334. public const TERMINATE = 'console.terminate';
  54335. public const ERROR = 'console.error';
  54336. public const ALIASES = [
  54337. ConsoleCommandEvent::class => self::COMMAND,
  54338. ConsoleErrorEvent::class => self::ERROR,
  54339. ConsoleSignalEvent::class => self::SIGNAL,
  54340. ConsoleTerminateEvent::class => self::TERMINATE,
  54341. ];
  54342. }
  54343. <?php
  54344. namespace Symfony\Component\Console;
  54345. use Symfony\Component\Console\Output\OutputInterface;
  54346. final class Cursor
  54347. {
  54348. private $output;
  54349. private $input;
  54350. public function __construct(OutputInterface $output, $input = null)
  54351. {
  54352. $this->output = $output;
  54353. $this->input = $input ?? (\defined('STDIN') ? \STDIN : fopen('php://input', 'r+'));
  54354. }
  54355. public function moveUp(int $lines = 1): self
  54356. {
  54357. $this->output->write(sprintf("\x1b[%dA", $lines));
  54358. return $this;
  54359. }
  54360. public function moveDown(int $lines = 1): self
  54361. {
  54362. $this->output->write(sprintf("\x1b[%dB", $lines));
  54363. return $this;
  54364. }
  54365. public function moveRight(int $columns = 1): self
  54366. {
  54367. $this->output->write(sprintf("\x1b[%dC", $columns));
  54368. return $this;
  54369. }
  54370. public function moveLeft(int $columns = 1): self
  54371. {
  54372. $this->output->write(sprintf("\x1b[%dD", $columns));
  54373. return $this;
  54374. }
  54375. public function moveToColumn(int $column): self
  54376. {
  54377. $this->output->write(sprintf("\x1b[%dG", $column));
  54378. return $this;
  54379. }
  54380. public function moveToPosition(int $column, int $row): self
  54381. {
  54382. $this->output->write(sprintf("\x1b[%d;%dH", $row + 1, $column));
  54383. return $this;
  54384. }
  54385. public function savePosition(): self
  54386. {
  54387. $this->output->write("\x1b7");
  54388. return $this;
  54389. }
  54390. public function restorePosition(): self
  54391. {
  54392. $this->output->write("\x1b8");
  54393. return $this;
  54394. }
  54395. public function hide(): self
  54396. {
  54397. $this->output->write("\x1b[?25l");
  54398. return $this;
  54399. }
  54400. public function show(): self
  54401. {
  54402. $this->output->write("\x1b[?25h\x1b[?0c");
  54403. return $this;
  54404. }
  54405. public function clearLine(): self
  54406. {
  54407. $this->output->write("\x1b[2K");
  54408. return $this;
  54409. }
  54410. public function clearLineAfter(): self
  54411. {
  54412. $this->output->write("\x1b[K");
  54413. return $this;
  54414. }
  54415. public function clearOutput(): self
  54416. {
  54417. $this->output->write("\x1b[0J");
  54418. return $this;
  54419. }
  54420. public function clearScreen(): self
  54421. {
  54422. $this->output->write("\x1b[2J");
  54423. return $this;
  54424. }
  54425. public function getCurrentPosition(): array
  54426. {
  54427. static $isTtySupported;
  54428. if (null === $isTtySupported && \function_exists('proc_open')) {
  54429. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
  54430. }
  54431. if (!$isTtySupported) {
  54432. return [1, 1];
  54433. }
  54434. $sttyMode = shell_exec('stty -g');
  54435. shell_exec('stty -icanon -echo');
  54436. @fwrite($this->input, "\033[6n");
  54437. $code = trim(fread($this->input, 1024));
  54438. shell_exec(sprintf('stty %s', $sttyMode));
  54439. sscanf($code, "\033[%d;%dR", $row, $col);
  54440. return [$col, $row];
  54441. }
  54442. }
  54443. <?php
  54444. namespace Symfony\Component\Console\DependencyInjection;
  54445. use Symfony\Component\Console\Command\Command;
  54446. use Symfony\Component\Console\Command\LazyCommand;
  54447. use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
  54448. use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
  54449. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  54450. use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
  54451. use Symfony\Component\DependencyInjection\ContainerBuilder;
  54452. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  54453. use Symfony\Component\DependencyInjection\Reference;
  54454. use Symfony\Component\DependencyInjection\TypedReference;
  54455. class AddConsoleCommandPass implements CompilerPassInterface
  54456. {
  54457. private $commandLoaderServiceId;
  54458. private $commandTag;
  54459. private $noPreloadTag;
  54460. private $privateTagName;
  54461. public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload', string $privateTagName = 'container.private')
  54462. {
  54463. if (0 < \func_num_args()) {
  54464. trigger_deprecation('symfony/console', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
  54465. }
  54466. $this->commandLoaderServiceId = $commandLoaderServiceId;
  54467. $this->commandTag = $commandTag;
  54468. $this->noPreloadTag = $noPreloadTag;
  54469. $this->privateTagName = $privateTagName;
  54470. }
  54471. public function process(ContainerBuilder $container)
  54472. {
  54473. $commandServices = $container->findTaggedServiceIds($this->commandTag, true);
  54474. $lazyCommandMap = [];
  54475. $lazyCommandRefs = [];
  54476. $serviceIds = [];
  54477. foreach ($commandServices as $id => $tags) {
  54478. $definition = $container->getDefinition($id);
  54479. $definition->addTag($this->noPreloadTag);
  54480. $class = $container->getParameterBag()->resolveValue($definition->getClass());
  54481. if (isset($tags[0]['command'])) {
  54482. $aliases = $tags[0]['command'];
  54483. } else {
  54484. if (!$r = $container->getReflectionClass($class)) {
  54485. throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
  54486. }
  54487. if (!$r->isSubclassOf(Command::class)) {
  54488. throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
  54489. }
  54490. $aliases = $class::getDefaultName();
  54491. }
  54492. $aliases = explode('|', $aliases ?? '');
  54493. $commandName = array_shift($aliases);
  54494. if ($isHidden = '' === $commandName) {
  54495. $commandName = array_shift($aliases);
  54496. }
  54497. if (null === $commandName) {
  54498. if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) {
  54499. $commandId = 'console.command.public_alias.'.$id;
  54500. $container->setAlias($commandId, $id)->setPublic(true);
  54501. $id = $commandId;
  54502. }
  54503. $serviceIds[] = $id;
  54504. continue;
  54505. }
  54506. $description = $tags[0]['description'] ?? null;
  54507. unset($tags[0]);
  54508. $lazyCommandMap[$commandName] = $id;
  54509. $lazyCommandRefs[$id] = new TypedReference($id, $class);
  54510. foreach ($aliases as $alias) {
  54511. $lazyCommandMap[$alias] = $id;
  54512. }
  54513. foreach ($tags as $tag) {
  54514. if (isset($tag['command'])) {
  54515. $aliases[] = $tag['command'];
  54516. $lazyCommandMap[$tag['command']] = $id;
  54517. }
  54518. $description = $description ?? $tag['description'] ?? null;
  54519. }
  54520. $definition->addMethodCall('setName', [$commandName]);
  54521. if ($aliases) {
  54522. $definition->addMethodCall('setAliases', [$aliases]);
  54523. }
  54524. if ($isHidden) {
  54525. $definition->addMethodCall('setHidden', [true]);
  54526. }
  54527. if (!$description) {
  54528. if (!$r = $container->getReflectionClass($class)) {
  54529. throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
  54530. }
  54531. if (!$r->isSubclassOf(Command::class)) {
  54532. throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
  54533. }
  54534. $description = $class::getDefaultDescription();
  54535. }
  54536. if ($description) {
  54537. $definition->addMethodCall('setDescription', [$description]);
  54538. $container->register('.'.$id.'.lazy', LazyCommand::class)
  54539. ->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]);
  54540. $lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy');
  54541. }
  54542. }
  54543. $container
  54544. ->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
  54545. ->setPublic(true)
  54546. ->addTag($this->noPreloadTag)
  54547. ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
  54548. $container->setParameter('console.command.ids', $serviceIds);
  54549. }
  54550. }
  54551. <?php
  54552. namespace Symfony\Component\Console\Descriptor;
  54553. use Symfony\Component\Console\Application;
  54554. use Symfony\Component\Console\Command\Command;
  54555. use Symfony\Component\Console\Exception\CommandNotFoundException;
  54556. class ApplicationDescription
  54557. {
  54558. public const GLOBAL_NAMESPACE = '_global';
  54559. private $application;
  54560. private $namespace;
  54561. private $showHidden;
  54562. private $namespaces;
  54563. private $commands;
  54564. private $aliases;
  54565. public function __construct(Application $application, string $namespace = null, bool $showHidden = false)
  54566. {
  54567. $this->application = $application;
  54568. $this->namespace = $namespace;
  54569. $this->showHidden = $showHidden;
  54570. }
  54571. public function getNamespaces(): array
  54572. {
  54573. if (null === $this->namespaces) {
  54574. $this->inspectApplication();
  54575. }
  54576. return $this->namespaces;
  54577. }
  54578. public function getCommands(): array
  54579. {
  54580. if (null === $this->commands) {
  54581. $this->inspectApplication();
  54582. }
  54583. return $this->commands;
  54584. }
  54585. public function getCommand(string $name): Command
  54586. {
  54587. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  54588. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  54589. }
  54590. return $this->commands[$name] ?? $this->aliases[$name];
  54591. }
  54592. private function inspectApplication()
  54593. {
  54594. $this->commands = [];
  54595. $this->namespaces = [];
  54596. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  54597. foreach ($this->sortCommands($all) as $namespace => $commands) {
  54598. $names = [];
  54599. foreach ($commands as $name => $command) {
  54600. if (!$command->getName() || (!$this->showHidden && $command->isHidden())) {
  54601. continue;
  54602. }
  54603. if ($command->getName() === $name) {
  54604. $this->commands[$name] = $command;
  54605. } else {
  54606. $this->aliases[$name] = $command;
  54607. }
  54608. $names[] = $name;
  54609. }
  54610. $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
  54611. }
  54612. }
  54613. private function sortCommands(array $commands): array
  54614. {
  54615. $namespacedCommands = [];
  54616. $globalCommands = [];
  54617. $sortedCommands = [];
  54618. foreach ($commands as $name => $command) {
  54619. $key = $this->application->extractNamespace($name, 1);
  54620. if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
  54621. $globalCommands[$name] = $command;
  54622. } else {
  54623. $namespacedCommands[$key][$name] = $command;
  54624. }
  54625. }
  54626. if ($globalCommands) {
  54627. ksort($globalCommands);
  54628. $sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
  54629. }
  54630. if ($namespacedCommands) {
  54631. ksort($namespacedCommands);
  54632. foreach ($namespacedCommands as $key => $commandsSet) {
  54633. ksort($commandsSet);
  54634. $sortedCommands[$key] = $commandsSet;
  54635. }
  54636. }
  54637. return $sortedCommands;
  54638. }
  54639. }
  54640. <?php
  54641. namespace Symfony\Component\Console\Descriptor;
  54642. use Symfony\Component\Console\Application;
  54643. use Symfony\Component\Console\Command\Command;
  54644. use Symfony\Component\Console\Exception\InvalidArgumentException;
  54645. use Symfony\Component\Console\Input\InputArgument;
  54646. use Symfony\Component\Console\Input\InputDefinition;
  54647. use Symfony\Component\Console\Input\InputOption;
  54648. use Symfony\Component\Console\Output\OutputInterface;
  54649. abstract class Descriptor implements DescriptorInterface
  54650. {
  54651. protected $output;
  54652. public function describe(OutputInterface $output, object $object, array $options = [])
  54653. {
  54654. $this->output = $output;
  54655. switch (true) {
  54656. case $object instanceof InputArgument:
  54657. $this->describeInputArgument($object, $options);
  54658. break;
  54659. case $object instanceof InputOption:
  54660. $this->describeInputOption($object, $options);
  54661. break;
  54662. case $object instanceof InputDefinition:
  54663. $this->describeInputDefinition($object, $options);
  54664. break;
  54665. case $object instanceof Command:
  54666. $this->describeCommand($object, $options);
  54667. break;
  54668. case $object instanceof Application:
  54669. $this->describeApplication($object, $options);
  54670. break;
  54671. default:
  54672. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
  54673. }
  54674. }
  54675. protected function write(string $content, bool $decorated = false)
  54676. {
  54677. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  54678. }
  54679. abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
  54680. abstract protected function describeInputOption(InputOption $option, array $options = []);
  54681. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
  54682. abstract protected function describeCommand(Command $command, array $options = []);
  54683. abstract protected function describeApplication(Application $application, array $options = []);
  54684. }
  54685. <?php
  54686. namespace Symfony\Component\Console\Descriptor;
  54687. use Symfony\Component\Console\Output\OutputInterface;
  54688. interface DescriptorInterface
  54689. {
  54690. public function describe(OutputInterface $output, object $object, array $options = []);
  54691. }
  54692. <?php
  54693. namespace Symfony\Component\Console\Descriptor;
  54694. use Symfony\Component\Console\Application;
  54695. use Symfony\Component\Console\Command\Command;
  54696. use Symfony\Component\Console\Input\InputArgument;
  54697. use Symfony\Component\Console\Input\InputDefinition;
  54698. use Symfony\Component\Console\Input\InputOption;
  54699. class JsonDescriptor extends Descriptor
  54700. {
  54701. protected function describeInputArgument(InputArgument $argument, array $options = [])
  54702. {
  54703. $this->writeData($this->getInputArgumentData($argument), $options);
  54704. }
  54705. protected function describeInputOption(InputOption $option, array $options = [])
  54706. {
  54707. $this->writeData($this->getInputOptionData($option), $options);
  54708. if ($option->isNegatable()) {
  54709. $this->writeData($this->getInputOptionData($option, true), $options);
  54710. }
  54711. }
  54712. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  54713. {
  54714. $this->writeData($this->getInputDefinitionData($definition), $options);
  54715. }
  54716. protected function describeCommand(Command $command, array $options = [])
  54717. {
  54718. $this->writeData($this->getCommandData($command, $options['short'] ?? false), $options);
  54719. }
  54720. protected function describeApplication(Application $application, array $options = [])
  54721. {
  54722. $describedNamespace = $options['namespace'] ?? null;
  54723. $description = new ApplicationDescription($application, $describedNamespace, true);
  54724. $commands = [];
  54725. foreach ($description->getCommands() as $command) {
  54726. $commands[] = $this->getCommandData($command, $options['short'] ?? false);
  54727. }
  54728. $data = [];
  54729. if ('UNKNOWN' !== $application->getName()) {
  54730. $data['application']['name'] = $application->getName();
  54731. if ('UNKNOWN' !== $application->getVersion()) {
  54732. $data['application']['version'] = $application->getVersion();
  54733. }
  54734. }
  54735. $data['commands'] = $commands;
  54736. if ($describedNamespace) {
  54737. $data['namespace'] = $describedNamespace;
  54738. } else {
  54739. $data['namespaces'] = array_values($description->getNamespaces());
  54740. }
  54741. $this->writeData($data, $options);
  54742. }
  54743. private function writeData(array $data, array $options)
  54744. {
  54745. $flags = $options['json_encoding'] ?? 0;
  54746. $this->write(json_encode($data, $flags));
  54747. }
  54748. private function getInputArgumentData(InputArgument $argument): array
  54749. {
  54750. return [
  54751. 'name' => $argument->getName(),
  54752. 'is_required' => $argument->isRequired(),
  54753. 'is_array' => $argument->isArray(),
  54754. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  54755. 'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  54756. ];
  54757. }
  54758. private function getInputOptionData(InputOption $option, bool $negated = false): array
  54759. {
  54760. return $negated ? [
  54761. 'name' => '--no-'.$option->getName(),
  54762. 'shortcut' => '',
  54763. 'accept_value' => false,
  54764. 'is_value_required' => false,
  54765. 'is_multiple' => false,
  54766. 'description' => 'Negate the "--'.$option->getName().'" option',
  54767. 'default' => false,
  54768. ] : [
  54769. 'name' => '--'.$option->getName(),
  54770. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  54771. 'accept_value' => $option->acceptValue(),
  54772. 'is_value_required' => $option->isValueRequired(),
  54773. 'is_multiple' => $option->isArray(),
  54774. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  54775. 'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  54776. ];
  54777. }
  54778. private function getInputDefinitionData(InputDefinition $definition): array
  54779. {
  54780. $inputArguments = [];
  54781. foreach ($definition->getArguments() as $name => $argument) {
  54782. $inputArguments[$name] = $this->getInputArgumentData($argument);
  54783. }
  54784. $inputOptions = [];
  54785. foreach ($definition->getOptions() as $name => $option) {
  54786. $inputOptions[$name] = $this->getInputOptionData($option);
  54787. if ($option->isNegatable()) {
  54788. $inputOptions['no-'.$name] = $this->getInputOptionData($option, true);
  54789. }
  54790. }
  54791. return ['arguments' => $inputArguments, 'options' => $inputOptions];
  54792. }
  54793. private function getCommandData(Command $command, bool $short = false): array
  54794. {
  54795. $data = [
  54796. 'name' => $command->getName(),
  54797. 'description' => $command->getDescription(),
  54798. ];
  54799. if ($short) {
  54800. $data += [
  54801. 'usage' => $command->getAliases(),
  54802. ];
  54803. } else {
  54804. $command->mergeApplicationDefinition(false);
  54805. $data += [
  54806. 'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()),
  54807. 'help' => $command->getProcessedHelp(),
  54808. 'definition' => $this->getInputDefinitionData($command->getDefinition()),
  54809. ];
  54810. }
  54811. $data['hidden'] = $command->isHidden();
  54812. return $data;
  54813. }
  54814. }
  54815. <?php
  54816. namespace Symfony\Component\Console\Descriptor;
  54817. use Symfony\Component\Console\Application;
  54818. use Symfony\Component\Console\Command\Command;
  54819. use Symfony\Component\Console\Helper\Helper;
  54820. use Symfony\Component\Console\Input\InputArgument;
  54821. use Symfony\Component\Console\Input\InputDefinition;
  54822. use Symfony\Component\Console\Input\InputOption;
  54823. use Symfony\Component\Console\Output\OutputInterface;
  54824. class MarkdownDescriptor extends Descriptor
  54825. {
  54826. public function describe(OutputInterface $output, object $object, array $options = [])
  54827. {
  54828. $decorated = $output->isDecorated();
  54829. $output->setDecorated(false);
  54830. parent::describe($output, $object, $options);
  54831. $output->setDecorated($decorated);
  54832. }
  54833. protected function write(string $content, bool $decorated = true)
  54834. {
  54835. parent::write($content, $decorated);
  54836. }
  54837. protected function describeInputArgument(InputArgument $argument, array $options = [])
  54838. {
  54839. $this->write(
  54840. '#### `'.($argument->getName() ?: '<none>')."`\n\n"
  54841. .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
  54842. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  54843. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  54844. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  54845. );
  54846. }
  54847. protected function describeInputOption(InputOption $option, array $options = [])
  54848. {
  54849. $name = '--'.$option->getName();
  54850. if ($option->isNegatable()) {
  54851. $name .= '|--no-'.$option->getName();
  54852. }
  54853. if ($option->getShortcut()) {
  54854. $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
  54855. }
  54856. $this->write(
  54857. '#### `'.$name.'`'."\n\n"
  54858. .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
  54859. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  54860. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  54861. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  54862. .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
  54863. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  54864. );
  54865. }
  54866. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  54867. {
  54868. if ($showArguments = \count($definition->getArguments()) > 0) {
  54869. $this->write('### Arguments');
  54870. foreach ($definition->getArguments() as $argument) {
  54871. $this->write("\n\n");
  54872. if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
  54873. $this->write($describeInputArgument);
  54874. }
  54875. }
  54876. }
  54877. if (\count($definition->getOptions()) > 0) {
  54878. if ($showArguments) {
  54879. $this->write("\n\n");
  54880. }
  54881. $this->write('### Options');
  54882. foreach ($definition->getOptions() as $option) {
  54883. $this->write("\n\n");
  54884. if (null !== $describeInputOption = $this->describeInputOption($option)) {
  54885. $this->write($describeInputOption);
  54886. }
  54887. }
  54888. }
  54889. }
  54890. protected function describeCommand(Command $command, array $options = [])
  54891. {
  54892. if ($options['short'] ?? false) {
  54893. $this->write(
  54894. '`'.$command->getName()."`\n"
  54895. .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
  54896. .($command->getDescription() ? $command->getDescription()."\n\n" : '')
  54897. .'### Usage'."\n\n"
  54898. .array_reduce($command->getAliases(), function ($carry, $usage) {
  54899. return $carry.'* `'.$usage.'`'."\n";
  54900. })
  54901. );
  54902. return;
  54903. }
  54904. $command->mergeApplicationDefinition(false);
  54905. $this->write(
  54906. '`'.$command->getName()."`\n"
  54907. .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
  54908. .($command->getDescription() ? $command->getDescription()."\n\n" : '')
  54909. .'### Usage'."\n\n"
  54910. .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  54911. return $carry.'* `'.$usage.'`'."\n";
  54912. })
  54913. );
  54914. if ($help = $command->getProcessedHelp()) {
  54915. $this->write("\n");
  54916. $this->write($help);
  54917. }
  54918. $definition = $command->getDefinition();
  54919. if ($definition->getOptions() || $definition->getArguments()) {
  54920. $this->write("\n\n");
  54921. $this->describeInputDefinition($definition);
  54922. }
  54923. }
  54924. protected function describeApplication(Application $application, array $options = [])
  54925. {
  54926. $describedNamespace = $options['namespace'] ?? null;
  54927. $description = new ApplicationDescription($application, $describedNamespace);
  54928. $title = $this->getApplicationTitle($application);
  54929. $this->write($title."\n".str_repeat('=', Helper::width($title)));
  54930. foreach ($description->getNamespaces() as $namespace) {
  54931. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  54932. $this->write("\n\n");
  54933. $this->write('**'.$namespace['id'].':**');
  54934. }
  54935. $this->write("\n\n");
  54936. $this->write(implode("\n", array_map(function ($commandName) use ($description) {
  54937. return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
  54938. }, $namespace['commands'])));
  54939. }
  54940. foreach ($description->getCommands() as $command) {
  54941. $this->write("\n\n");
  54942. if (null !== $describeCommand = $this->describeCommand($command, $options)) {
  54943. $this->write($describeCommand);
  54944. }
  54945. }
  54946. }
  54947. private function getApplicationTitle(Application $application): string
  54948. {
  54949. if ('UNKNOWN' !== $application->getName()) {
  54950. if ('UNKNOWN' !== $application->getVersion()) {
  54951. return sprintf('%s %s', $application->getName(), $application->getVersion());
  54952. }
  54953. return $application->getName();
  54954. }
  54955. return 'Console Tool';
  54956. }
  54957. }
  54958. <?php
  54959. namespace Symfony\Component\Console\Descriptor;
  54960. use Symfony\Component\Console\Application;
  54961. use Symfony\Component\Console\Command\Command;
  54962. use Symfony\Component\Console\Formatter\OutputFormatter;
  54963. use Symfony\Component\Console\Helper\Helper;
  54964. use Symfony\Component\Console\Input\InputArgument;
  54965. use Symfony\Component\Console\Input\InputDefinition;
  54966. use Symfony\Component\Console\Input\InputOption;
  54967. class TextDescriptor extends Descriptor
  54968. {
  54969. protected function describeInputArgument(InputArgument $argument, array $options = [])
  54970. {
  54971. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  54972. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  54973. } else {
  54974. $default = '';
  54975. }
  54976. $totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
  54977. $spacingWidth = $totalWidth - \strlen($argument->getName());
  54978. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  54979. $argument->getName(),
  54980. str_repeat(' ', $spacingWidth),
  54981. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  54982. $default
  54983. ), $options);
  54984. }
  54985. protected function describeInputOption(InputOption $option, array $options = [])
  54986. {
  54987. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  54988. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  54989. } else {
  54990. $default = '';
  54991. }
  54992. $value = '';
  54993. if ($option->acceptValue()) {
  54994. $value = '='.strtoupper($option->getName());
  54995. if ($option->isValueOptional()) {
  54996. $value = '['.$value.']';
  54997. }
  54998. }
  54999. $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
  55000. $synopsis = sprintf('%s%s',
  55001. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  55002. sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
  55003. );
  55004. $spacingWidth = $totalWidth - Helper::width($synopsis);
  55005. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  55006. $synopsis,
  55007. str_repeat(' ', $spacingWidth),
  55008. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  55009. $default,
  55010. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  55011. ), $options);
  55012. }
  55013. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  55014. {
  55015. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  55016. foreach ($definition->getArguments() as $argument) {
  55017. $totalWidth = max($totalWidth, Helper::width($argument->getName()));
  55018. }
  55019. if ($definition->getArguments()) {
  55020. $this->writeText('<comment>Arguments:</comment>', $options);
  55021. $this->writeText("\n");
  55022. foreach ($definition->getArguments() as $argument) {
  55023. $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
  55024. $this->writeText("\n");
  55025. }
  55026. }
  55027. if ($definition->getArguments() && $definition->getOptions()) {
  55028. $this->writeText("\n");
  55029. }
  55030. if ($definition->getOptions()) {
  55031. $laterOptions = [];
  55032. $this->writeText('<comment>Options:</comment>', $options);
  55033. foreach ($definition->getOptions() as $option) {
  55034. if (\strlen($option->getShortcut() ?? '') > 1) {
  55035. $laterOptions[] = $option;
  55036. continue;
  55037. }
  55038. $this->writeText("\n");
  55039. $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
  55040. }
  55041. foreach ($laterOptions as $option) {
  55042. $this->writeText("\n");
  55043. $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
  55044. }
  55045. }
  55046. }
  55047. protected function describeCommand(Command $command, array $options = [])
  55048. {
  55049. $command->mergeApplicationDefinition(false);
  55050. if ($description = $command->getDescription()) {
  55051. $this->writeText('<comment>Description:</comment>', $options);
  55052. $this->writeText("\n");
  55053. $this->writeText(' '.$description);
  55054. $this->writeText("\n\n");
  55055. }
  55056. $this->writeText('<comment>Usage:</comment>', $options);
  55057. foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
  55058. $this->writeText("\n");
  55059. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  55060. }
  55061. $this->writeText("\n");
  55062. $definition = $command->getDefinition();
  55063. if ($definition->getOptions() || $definition->getArguments()) {
  55064. $this->writeText("\n");
  55065. $this->describeInputDefinition($definition, $options);
  55066. $this->writeText("\n");
  55067. }
  55068. $help = $command->getProcessedHelp();
  55069. if ($help && $help !== $description) {
  55070. $this->writeText("\n");
  55071. $this->writeText('<comment>Help:</comment>', $options);
  55072. $this->writeText("\n");
  55073. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  55074. $this->writeText("\n");
  55075. }
  55076. }
  55077. protected function describeApplication(Application $application, array $options = [])
  55078. {
  55079. $describedNamespace = $options['namespace'] ?? null;
  55080. $description = new ApplicationDescription($application, $describedNamespace);
  55081. if (isset($options['raw_text']) && $options['raw_text']) {
  55082. $width = $this->getColumnWidth($description->getCommands());
  55083. foreach ($description->getCommands() as $command) {
  55084. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  55085. $this->writeText("\n");
  55086. }
  55087. } else {
  55088. if ('' != $help = $application->getHelp()) {
  55089. $this->writeText("$help\n\n", $options);
  55090. }
  55091. $this->writeText("<comment>Usage:</comment>\n", $options);
  55092. $this->writeText(" command [options] [arguments]\n\n", $options);
  55093. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  55094. $this->writeText("\n");
  55095. $this->writeText("\n");
  55096. $commands = $description->getCommands();
  55097. $namespaces = $description->getNamespaces();
  55098. if ($describedNamespace && $namespaces) {
  55099. $describedNamespaceInfo = reset($namespaces);
  55100. foreach ($describedNamespaceInfo['commands'] as $name) {
  55101. $commands[$name] = $description->getCommand($name);
  55102. }
  55103. }
  55104. $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
  55105. return array_intersect($namespace['commands'], array_keys($commands));
  55106. }, array_values($namespaces)))));
  55107. if ($describedNamespace) {
  55108. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  55109. } else {
  55110. $this->writeText('<comment>Available commands:</comment>', $options);
  55111. }
  55112. foreach ($namespaces as $namespace) {
  55113. $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
  55114. return isset($commands[$name]);
  55115. });
  55116. if (!$namespace['commands']) {
  55117. continue;
  55118. }
  55119. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  55120. $this->writeText("\n");
  55121. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  55122. }
  55123. foreach ($namespace['commands'] as $name) {
  55124. $this->writeText("\n");
  55125. $spacingWidth = $width - Helper::width($name);
  55126. $command = $commands[$name];
  55127. $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
  55128. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
  55129. }
  55130. }
  55131. $this->writeText("\n");
  55132. }
  55133. }
  55134. private function writeText(string $content, array $options = [])
  55135. {
  55136. $this->write(
  55137. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  55138. isset($options['raw_output']) ? !$options['raw_output'] : true
  55139. );
  55140. }
  55141. private function getCommandAliasesText(Command $command): string
  55142. {
  55143. $text = '';
  55144. $aliases = $command->getAliases();
  55145. if ($aliases) {
  55146. $text = '['.implode('|', $aliases).'] ';
  55147. }
  55148. return $text;
  55149. }
  55150. private function formatDefaultValue($default): string
  55151. {
  55152. if (\INF === $default) {
  55153. return 'INF';
  55154. }
  55155. if (\is_string($default)) {
  55156. $default = OutputFormatter::escape($default);
  55157. } elseif (\is_array($default)) {
  55158. foreach ($default as $key => $value) {
  55159. if (\is_string($value)) {
  55160. $default[$key] = OutputFormatter::escape($value);
  55161. }
  55162. }
  55163. }
  55164. return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
  55165. }
  55166. private function getColumnWidth(array $commands): int
  55167. {
  55168. $widths = [];
  55169. foreach ($commands as $command) {
  55170. if ($command instanceof Command) {
  55171. $widths[] = Helper::width($command->getName());
  55172. foreach ($command->getAliases() as $alias) {
  55173. $widths[] = Helper::width($alias);
  55174. }
  55175. } else {
  55176. $widths[] = Helper::width($command);
  55177. }
  55178. }
  55179. return $widths ? max($widths) + 2 : 0;
  55180. }
  55181. private function calculateTotalWidthForOptions(array $options): int
  55182. {
  55183. $totalWidth = 0;
  55184. foreach ($options as $option) {
  55185. $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
  55186. if ($option->isNegatable()) {
  55187. $nameLength += 6 + Helper::width($option->getName());
  55188. } elseif ($option->acceptValue()) {
  55189. $valueLength = 1 + Helper::width($option->getName());
  55190. $valueLength += $option->isValueOptional() ? 2 : 0;
  55191. $nameLength += $valueLength;
  55192. }
  55193. $totalWidth = max($totalWidth, $nameLength);
  55194. }
  55195. return $totalWidth;
  55196. }
  55197. }
  55198. <?php
  55199. namespace Symfony\Component\Console\Descriptor;
  55200. use Symfony\Component\Console\Application;
  55201. use Symfony\Component\Console\Command\Command;
  55202. use Symfony\Component\Console\Input\InputArgument;
  55203. use Symfony\Component\Console\Input\InputDefinition;
  55204. use Symfony\Component\Console\Input\InputOption;
  55205. class XmlDescriptor extends Descriptor
  55206. {
  55207. public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
  55208. {
  55209. $dom = new \DOMDocument('1.0', 'UTF-8');
  55210. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  55211. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  55212. foreach ($definition->getArguments() as $argument) {
  55213. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  55214. }
  55215. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  55216. foreach ($definition->getOptions() as $option) {
  55217. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  55218. }
  55219. return $dom;
  55220. }
  55221. public function getCommandDocument(Command $command, bool $short = false): \DOMDocument
  55222. {
  55223. $dom = new \DOMDocument('1.0', 'UTF-8');
  55224. $dom->appendChild($commandXML = $dom->createElement('command'));
  55225. $commandXML->setAttribute('id', $command->getName());
  55226. $commandXML->setAttribute('name', $command->getName());
  55227. $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);
  55228. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  55229. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  55230. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  55231. if ($short) {
  55232. foreach ($command->getAliases() as $usage) {
  55233. $usagesXML->appendChild($dom->createElement('usage', $usage));
  55234. }
  55235. } else {
  55236. $command->mergeApplicationDefinition(false);
  55237. foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
  55238. $usagesXML->appendChild($dom->createElement('usage', $usage));
  55239. }
  55240. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  55241. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  55242. $definitionXML = $this->getInputDefinitionDocument($command->getDefinition());
  55243. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  55244. }
  55245. return $dom;
  55246. }
  55247. public function getApplicationDocument(Application $application, string $namespace = null, bool $short = false): \DOMDocument
  55248. {
  55249. $dom = new \DOMDocument('1.0', 'UTF-8');
  55250. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  55251. if ('UNKNOWN' !== $application->getName()) {
  55252. $rootXml->setAttribute('name', $application->getName());
  55253. if ('UNKNOWN' !== $application->getVersion()) {
  55254. $rootXml->setAttribute('version', $application->getVersion());
  55255. }
  55256. }
  55257. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  55258. $description = new ApplicationDescription($application, $namespace, true);
  55259. if ($namespace) {
  55260. $commandsXML->setAttribute('namespace', $namespace);
  55261. }
  55262. foreach ($description->getCommands() as $command) {
  55263. $this->appendDocument($commandsXML, $this->getCommandDocument($command, $short));
  55264. }
  55265. if (!$namespace) {
  55266. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  55267. foreach ($description->getNamespaces() as $namespaceDescription) {
  55268. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  55269. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  55270. foreach ($namespaceDescription['commands'] as $name) {
  55271. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  55272. $commandXML->appendChild($dom->createTextNode($name));
  55273. }
  55274. }
  55275. }
  55276. return $dom;
  55277. }
  55278. protected function describeInputArgument(InputArgument $argument, array $options = [])
  55279. {
  55280. $this->writeDocument($this->getInputArgumentDocument($argument));
  55281. }
  55282. protected function describeInputOption(InputOption $option, array $options = [])
  55283. {
  55284. $this->writeDocument($this->getInputOptionDocument($option));
  55285. }
  55286. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  55287. {
  55288. $this->writeDocument($this->getInputDefinitionDocument($definition));
  55289. }
  55290. protected function describeCommand(Command $command, array $options = [])
  55291. {
  55292. $this->writeDocument($this->getCommandDocument($command, $options['short'] ?? false));
  55293. }
  55294. protected function describeApplication(Application $application, array $options = [])
  55295. {
  55296. $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? false));
  55297. }
  55298. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  55299. {
  55300. foreach ($importedParent->childNodes as $childNode) {
  55301. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  55302. }
  55303. }
  55304. private function writeDocument(\DOMDocument $dom)
  55305. {
  55306. $dom->formatOutput = true;
  55307. $this->write($dom->saveXML());
  55308. }
  55309. private function getInputArgumentDocument(InputArgument $argument): \DOMDocument
  55310. {
  55311. $dom = new \DOMDocument('1.0', 'UTF-8');
  55312. $dom->appendChild($objectXML = $dom->createElement('argument'));
  55313. $objectXML->setAttribute('name', $argument->getName());
  55314. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  55315. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  55316. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  55317. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  55318. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  55319. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
  55320. foreach ($defaults as $default) {
  55321. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  55322. $defaultXML->appendChild($dom->createTextNode($default));
  55323. }
  55324. return $dom;
  55325. }
  55326. private function getInputOptionDocument(InputOption $option): \DOMDocument
  55327. {
  55328. $dom = new \DOMDocument('1.0', 'UTF-8');
  55329. $dom->appendChild($objectXML = $dom->createElement('option'));
  55330. $objectXML->setAttribute('name', '--'.$option->getName());
  55331. $pos = strpos($option->getShortcut() ?? '', '|');
  55332. if (false !== $pos) {
  55333. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  55334. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  55335. } else {
  55336. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  55337. }
  55338. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  55339. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  55340. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  55341. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  55342. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  55343. if ($option->acceptValue()) {
  55344. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
  55345. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  55346. if (!empty($defaults)) {
  55347. foreach ($defaults as $default) {
  55348. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  55349. $defaultXML->appendChild($dom->createTextNode($default));
  55350. }
  55351. }
  55352. }
  55353. if ($option->isNegatable()) {
  55354. $dom->appendChild($objectXML = $dom->createElement('option'));
  55355. $objectXML->setAttribute('name', '--no-'.$option->getName());
  55356. $objectXML->setAttribute('shortcut', '');
  55357. $objectXML->setAttribute('accept_value', 0);
  55358. $objectXML->setAttribute('is_value_required', 0);
  55359. $objectXML->setAttribute('is_multiple', 0);
  55360. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  55361. $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option'));
  55362. }
  55363. return $dom;
  55364. }
  55365. }
  55366. <?php
  55367. namespace Symfony\Component\Console\Event;
  55368. final class ConsoleCommandEvent extends ConsoleEvent
  55369. {
  55370. public const RETURN_CODE_DISABLED = 113;
  55371. private $commandShouldRun = true;
  55372. public function disableCommand(): bool
  55373. {
  55374. return $this->commandShouldRun = false;
  55375. }
  55376. public function enableCommand(): bool
  55377. {
  55378. return $this->commandShouldRun = true;
  55379. }
  55380. public function commandShouldRun(): bool
  55381. {
  55382. return $this->commandShouldRun;
  55383. }
  55384. }
  55385. <?php
  55386. namespace Symfony\Component\Console\Event;
  55387. use Symfony\Component\Console\Command\Command;
  55388. use Symfony\Component\Console\Input\InputInterface;
  55389. use Symfony\Component\Console\Output\OutputInterface;
  55390. final class ConsoleErrorEvent extends ConsoleEvent
  55391. {
  55392. private $error;
  55393. private $exitCode;
  55394. public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
  55395. {
  55396. parent::__construct($command, $input, $output);
  55397. $this->error = $error;
  55398. }
  55399. public function getError(): \Throwable
  55400. {
  55401. return $this->error;
  55402. }
  55403. public function setError(\Throwable $error): void
  55404. {
  55405. $this->error = $error;
  55406. }
  55407. public function setExitCode(int $exitCode): void
  55408. {
  55409. $this->exitCode = $exitCode;
  55410. $r = new \ReflectionProperty($this->error, 'code');
  55411. $r->setAccessible(true);
  55412. $r->setValue($this->error, $this->exitCode);
  55413. }
  55414. public function getExitCode(): int
  55415. {
  55416. return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
  55417. }
  55418. }
  55419. <?php
  55420. namespace Symfony\Component\Console\Event;
  55421. use Symfony\Component\Console\Command\Command;
  55422. use Symfony\Component\Console\Input\InputInterface;
  55423. use Symfony\Component\Console\Output\OutputInterface;
  55424. use Symfony\Contracts\EventDispatcher\Event;
  55425. class ConsoleEvent extends Event
  55426. {
  55427. protected $command;
  55428. private $input;
  55429. private $output;
  55430. public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
  55431. {
  55432. $this->command = $command;
  55433. $this->input = $input;
  55434. $this->output = $output;
  55435. }
  55436. public function getCommand()
  55437. {
  55438. return $this->command;
  55439. }
  55440. public function getInput()
  55441. {
  55442. return $this->input;
  55443. }
  55444. public function getOutput()
  55445. {
  55446. return $this->output;
  55447. }
  55448. }
  55449. <?php
  55450. namespace Symfony\Component\Console\Event;
  55451. use Symfony\Component\Console\Command\Command;
  55452. use Symfony\Component\Console\Input\InputInterface;
  55453. use Symfony\Component\Console\Output\OutputInterface;
  55454. final class ConsoleSignalEvent extends ConsoleEvent
  55455. {
  55456. private $handlingSignal;
  55457. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
  55458. {
  55459. parent::__construct($command, $input, $output);
  55460. $this->handlingSignal = $handlingSignal;
  55461. }
  55462. public function getHandlingSignal(): int
  55463. {
  55464. return $this->handlingSignal;
  55465. }
  55466. }
  55467. <?php
  55468. namespace Symfony\Component\Console\Event;
  55469. use Symfony\Component\Console\Command\Command;
  55470. use Symfony\Component\Console\Input\InputInterface;
  55471. use Symfony\Component\Console\Output\OutputInterface;
  55472. final class ConsoleTerminateEvent extends ConsoleEvent
  55473. {
  55474. private $exitCode;
  55475. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
  55476. {
  55477. parent::__construct($command, $input, $output);
  55478. $this->setExitCode($exitCode);
  55479. }
  55480. public function setExitCode(int $exitCode): void
  55481. {
  55482. $this->exitCode = $exitCode;
  55483. }
  55484. public function getExitCode(): int
  55485. {
  55486. return $this->exitCode;
  55487. }
  55488. }
  55489. <?php
  55490. namespace Symfony\Component\Console\EventListener;
  55491. use Psr\Log\LoggerInterface;
  55492. use Symfony\Component\Console\ConsoleEvents;
  55493. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  55494. use Symfony\Component\Console\Event\ConsoleEvent;
  55495. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  55496. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  55497. class ErrorListener implements EventSubscriberInterface
  55498. {
  55499. private $logger;
  55500. public function __construct(LoggerInterface $logger = null)
  55501. {
  55502. $this->logger = $logger;
  55503. }
  55504. public function onConsoleError(ConsoleErrorEvent $event)
  55505. {
  55506. if (null === $this->logger) {
  55507. return;
  55508. }
  55509. $error = $event->getError();
  55510. if (!$inputString = $this->getInputString($event)) {
  55511. $this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
  55512. return;
  55513. }
  55514. $this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
  55515. }
  55516. public function onConsoleTerminate(ConsoleTerminateEvent $event)
  55517. {
  55518. if (null === $this->logger) {
  55519. return;
  55520. }
  55521. $exitCode = $event->getExitCode();
  55522. if (0 === $exitCode) {
  55523. return;
  55524. }
  55525. if (!$inputString = $this->getInputString($event)) {
  55526. $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
  55527. return;
  55528. }
  55529. $this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
  55530. }
  55531. public static function getSubscribedEvents()
  55532. {
  55533. return [
  55534. ConsoleEvents::ERROR => ['onConsoleError', -128],
  55535. ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128],
  55536. ];
  55537. }
  55538. private static function getInputString(ConsoleEvent $event): ?string
  55539. {
  55540. $commandName = $event->getCommand() ? $event->getCommand()->getName() : null;
  55541. $input = $event->getInput();
  55542. if (method_exists($input, '__toString')) {
  55543. if ($commandName) {
  55544. return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input);
  55545. }
  55546. return (string) $input;
  55547. }
  55548. return $commandName;
  55549. }
  55550. }
  55551. <?php
  55552. namespace Symfony\Component\Console\Exception;
  55553. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  55554. {
  55555. private $alternatives;
  55556. public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
  55557. {
  55558. parent::__construct($message, $code, $previous);
  55559. $this->alternatives = $alternatives;
  55560. }
  55561. public function getAlternatives()
  55562. {
  55563. return $this->alternatives;
  55564. }
  55565. }
  55566. <?php
  55567. namespace Symfony\Component\Console\Exception;
  55568. interface ExceptionInterface extends \Throwable
  55569. {
  55570. }
  55571. <?php
  55572. namespace Symfony\Component\Console\Exception;
  55573. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  55574. {
  55575. }
  55576. <?php
  55577. namespace Symfony\Component\Console\Exception;
  55578. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  55579. {
  55580. }
  55581. <?php
  55582. namespace Symfony\Component\Console\Exception;
  55583. class LogicException extends \LogicException implements ExceptionInterface
  55584. {
  55585. }
  55586. <?php
  55587. namespace Symfony\Component\Console\Exception;
  55588. class MissingInputException extends RuntimeException implements ExceptionInterface
  55589. {
  55590. }
  55591. <?php
  55592. namespace Symfony\Component\Console\Exception;
  55593. class NamespaceNotFoundException extends CommandNotFoundException
  55594. {
  55595. }
  55596. <?php
  55597. namespace Symfony\Component\Console\Exception;
  55598. class RuntimeException extends \RuntimeException implements ExceptionInterface
  55599. {
  55600. }
  55601. <?php
  55602. namespace Symfony\Component\Console\Formatter;
  55603. final class NullOutputFormatter implements OutputFormatterInterface
  55604. {
  55605. private $style;
  55606. public function format(?string $message): ?string
  55607. {
  55608. return null;
  55609. }
  55610. public function getStyle(string $name): OutputFormatterStyleInterface
  55611. {
  55612. return $this->style ?? $this->style = new NullOutputFormatterStyle();
  55613. }
  55614. public function hasStyle(string $name): bool
  55615. {
  55616. return false;
  55617. }
  55618. public function isDecorated(): bool
  55619. {
  55620. return false;
  55621. }
  55622. public function setDecorated(bool $decorated): void
  55623. {
  55624. }
  55625. public function setStyle(string $name, OutputFormatterStyleInterface $style): void
  55626. {
  55627. }
  55628. }
  55629. <?php
  55630. namespace Symfony\Component\Console\Formatter;
  55631. final class NullOutputFormatterStyle implements OutputFormatterStyleInterface
  55632. {
  55633. public function apply(string $text): string
  55634. {
  55635. return $text;
  55636. }
  55637. public function setBackground(string $color = null): void
  55638. {
  55639. }
  55640. public function setForeground(string $color = null): void
  55641. {
  55642. }
  55643. public function setOption(string $option): void
  55644. {
  55645. }
  55646. public function setOptions(array $options): void
  55647. {
  55648. }
  55649. public function unsetOption(string $option): void
  55650. {
  55651. }
  55652. }
  55653. <?php
  55654. namespace Symfony\Component\Console\Formatter;
  55655. use Symfony\Component\Console\Exception\InvalidArgumentException;
  55656. class OutputFormatter implements WrappableOutputFormatterInterface
  55657. {
  55658. private $decorated;
  55659. private $styles = [];
  55660. private $styleStack;
  55661. public function __clone()
  55662. {
  55663. $this->styleStack = clone $this->styleStack;
  55664. foreach ($this->styles as $key => $value) {
  55665. $this->styles[$key] = clone $value;
  55666. }
  55667. }
  55668. public static function escape(string $text)
  55669. {
  55670. $text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text);
  55671. return self::escapeTrailingBackslash($text);
  55672. }
  55673. public static function escapeTrailingBackslash(string $text): string
  55674. {
  55675. if (str_ends_with($text, '\\')) {
  55676. $len = \strlen($text);
  55677. $text = rtrim($text, '\\');
  55678. $text = str_replace("\0", '', $text);
  55679. $text .= str_repeat("\0", $len - \strlen($text));
  55680. }
  55681. return $text;
  55682. }
  55683. public function __construct(bool $decorated = false, array $styles = [])
  55684. {
  55685. $this->decorated = $decorated;
  55686. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  55687. $this->setStyle('info', new OutputFormatterStyle('green'));
  55688. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  55689. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  55690. foreach ($styles as $name => $style) {
  55691. $this->setStyle($name, $style);
  55692. }
  55693. $this->styleStack = new OutputFormatterStyleStack();
  55694. }
  55695. public function setDecorated(bool $decorated)
  55696. {
  55697. $this->decorated = $decorated;
  55698. }
  55699. public function isDecorated()
  55700. {
  55701. return $this->decorated;
  55702. }
  55703. public function setStyle(string $name, OutputFormatterStyleInterface $style)
  55704. {
  55705. $this->styles[strtolower($name)] = $style;
  55706. }
  55707. public function hasStyle(string $name)
  55708. {
  55709. return isset($this->styles[strtolower($name)]);
  55710. }
  55711. public function getStyle(string $name)
  55712. {
  55713. if (!$this->hasStyle($name)) {
  55714. throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
  55715. }
  55716. return $this->styles[strtolower($name)];
  55717. }
  55718. public function format(?string $message)
  55719. {
  55720. return $this->formatAndWrap($message, 0);
  55721. }
  55722. public function formatAndWrap(?string $message, int $width)
  55723. {
  55724. if (null === $message) {
  55725. return '';
  55726. }
  55727. $offset = 0;
  55728. $output = '';
  55729. $openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
  55730. $closeTagRegex = '[a-z][^<>]*+';
  55731. $currentLineLength = 0;
  55732. preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
  55733. foreach ($matches[0] as $i => $match) {
  55734. $pos = $match[1];
  55735. $text = $match[0];
  55736. if (0 != $pos && '\\' == $message[$pos - 1]) {
  55737. continue;
  55738. }
  55739. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength);
  55740. $offset = $pos + \strlen($text);
  55741. if ($open = '/' != $text[1]) {
  55742. $tag = $matches[1][$i][0];
  55743. } else {
  55744. $tag = $matches[3][$i][0] ?? '';
  55745. }
  55746. if (!$open && !$tag) {
  55747. $this->styleStack->pop();
  55748. } elseif (null === $style = $this->createStyleFromString($tag)) {
  55749. $output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
  55750. } elseif ($open) {
  55751. $this->styleStack->push($style);
  55752. } else {
  55753. $this->styleStack->pop($style);
  55754. }
  55755. }
  55756. $output .= $this->applyCurrentStyle(substr($message, $offset), $output, $width, $currentLineLength);
  55757. return strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']);
  55758. }
  55759. public function getStyleStack()
  55760. {
  55761. return $this->styleStack;
  55762. }
  55763. private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
  55764. {
  55765. if (isset($this->styles[$string])) {
  55766. return $this->styles[$string];
  55767. }
  55768. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
  55769. return null;
  55770. }
  55771. $style = new OutputFormatterStyle();
  55772. foreach ($matches as $match) {
  55773. array_shift($match);
  55774. $match[0] = strtolower($match[0]);
  55775. if ('fg' == $match[0]) {
  55776. $style->setForeground(strtolower($match[1]));
  55777. } elseif ('bg' == $match[0]) {
  55778. $style->setBackground(strtolower($match[1]));
  55779. } elseif ('href' === $match[0]) {
  55780. $url = preg_replace('{\\\\([<>])}', '$1', $match[1]);
  55781. $style->setHref($url);
  55782. } elseif ('options' === $match[0]) {
  55783. preg_match_all('([^,;]+)', strtolower($match[1]), $options);
  55784. $options = array_shift($options);
  55785. foreach ($options as $option) {
  55786. $style->setOption($option);
  55787. }
  55788. } else {
  55789. return null;
  55790. }
  55791. }
  55792. return $style;
  55793. }
  55794. private function applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength): string
  55795. {
  55796. if ('' === $text) {
  55797. return '';
  55798. }
  55799. if (!$width) {
  55800. return $this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text;
  55801. }
  55802. if (!$currentLineLength && '' !== $current) {
  55803. $text = ltrim($text);
  55804. }
  55805. if ($currentLineLength) {
  55806. $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n";
  55807. $text = substr($text, $i);
  55808. } else {
  55809. $prefix = '';
  55810. }
  55811. preg_match('~(\\n)$~', $text, $matches);
  55812. $text = $prefix.preg_replace('~([^\\n]{'.$width.'})\\ *~', "\$1\n", $text);
  55813. $text = rtrim($text, "\n").($matches[1] ?? '');
  55814. if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) {
  55815. $text = "\n".$text;
  55816. }
  55817. $lines = explode("\n", $text);
  55818. foreach ($lines as $line) {
  55819. $currentLineLength += \strlen($line);
  55820. if ($width <= $currentLineLength) {
  55821. $currentLineLength = 0;
  55822. }
  55823. }
  55824. if ($this->isDecorated()) {
  55825. foreach ($lines as $i => $line) {
  55826. $lines[$i] = $this->styleStack->getCurrent()->apply($line);
  55827. }
  55828. }
  55829. return implode("\n", $lines);
  55830. }
  55831. }
  55832. <?php
  55833. namespace Symfony\Component\Console\Formatter;
  55834. interface OutputFormatterInterface
  55835. {
  55836. public function setDecorated(bool $decorated);
  55837. public function isDecorated();
  55838. public function setStyle(string $name, OutputFormatterStyleInterface $style);
  55839. public function hasStyle(string $name);
  55840. public function getStyle(string $name);
  55841. public function format(?string $message);
  55842. }
  55843. <?php
  55844. namespace Symfony\Component\Console\Formatter;
  55845. use Symfony\Component\Console\Color;
  55846. class OutputFormatterStyle implements OutputFormatterStyleInterface
  55847. {
  55848. private $color;
  55849. private $foreground;
  55850. private $background;
  55851. private $options;
  55852. private $href;
  55853. private $handlesHrefGracefully;
  55854. public function __construct(string $foreground = null, string $background = null, array $options = [])
  55855. {
  55856. $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
  55857. }
  55858. public function setForeground(string $color = null)
  55859. {
  55860. $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
  55861. }
  55862. public function setBackground(string $color = null)
  55863. {
  55864. $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
  55865. }
  55866. public function setHref(string $url): void
  55867. {
  55868. $this->href = $url;
  55869. }
  55870. public function setOption(string $option)
  55871. {
  55872. $this->options[] = $option;
  55873. $this->color = new Color($this->foreground, $this->background, $this->options);
  55874. }
  55875. public function unsetOption(string $option)
  55876. {
  55877. $pos = array_search($option, $this->options);
  55878. if (false !== $pos) {
  55879. unset($this->options[$pos]);
  55880. }
  55881. $this->color = new Color($this->foreground, $this->background, $this->options);
  55882. }
  55883. public function setOptions(array $options)
  55884. {
  55885. $this->color = new Color($this->foreground, $this->background, $this->options = $options);
  55886. }
  55887. public function apply(string $text)
  55888. {
  55889. if (null === $this->handlesHrefGracefully) {
  55890. $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
  55891. && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
  55892. }
  55893. if (null !== $this->href && $this->handlesHrefGracefully) {
  55894. $text = "\033]8;;$this->href\033\\$text\033]8;;\033\\";
  55895. }
  55896. return $this->color->apply($text);
  55897. }
  55898. }
  55899. <?php
  55900. namespace Symfony\Component\Console\Formatter;
  55901. interface OutputFormatterStyleInterface
  55902. {
  55903. public function setForeground(string $color = null);
  55904. public function setBackground(string $color = null);
  55905. public function setOption(string $option);
  55906. public function unsetOption(string $option);
  55907. public function setOptions(array $options);
  55908. public function apply(string $text);
  55909. }
  55910. <?php
  55911. namespace Symfony\Component\Console\Formatter;
  55912. use Symfony\Component\Console\Exception\InvalidArgumentException;
  55913. use Symfony\Contracts\Service\ResetInterface;
  55914. class OutputFormatterStyleStack implements ResetInterface
  55915. {
  55916. private $styles;
  55917. private $emptyStyle;
  55918. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  55919. {
  55920. $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
  55921. $this->reset();
  55922. }
  55923. public function reset()
  55924. {
  55925. $this->styles = [];
  55926. }
  55927. public function push(OutputFormatterStyleInterface $style)
  55928. {
  55929. $this->styles[] = $style;
  55930. }
  55931. public function pop(OutputFormatterStyleInterface $style = null)
  55932. {
  55933. if (empty($this->styles)) {
  55934. return $this->emptyStyle;
  55935. }
  55936. if (null === $style) {
  55937. return array_pop($this->styles);
  55938. }
  55939. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  55940. if ($style->apply('') === $stackedStyle->apply('')) {
  55941. $this->styles = \array_slice($this->styles, 0, $index);
  55942. return $stackedStyle;
  55943. }
  55944. }
  55945. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  55946. }
  55947. public function getCurrent()
  55948. {
  55949. if (empty($this->styles)) {
  55950. return $this->emptyStyle;
  55951. }
  55952. return $this->styles[\count($this->styles) - 1];
  55953. }
  55954. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  55955. {
  55956. $this->emptyStyle = $emptyStyle;
  55957. return $this;
  55958. }
  55959. public function getEmptyStyle()
  55960. {
  55961. return $this->emptyStyle;
  55962. }
  55963. }
  55964. <?php
  55965. namespace Symfony\Component\Console\Formatter;
  55966. interface WrappableOutputFormatterInterface extends OutputFormatterInterface
  55967. {
  55968. public function formatAndWrap(?string $message, int $width);
  55969. }
  55970. <?php
  55971. namespace Symfony\Component\Console\Helper;
  55972. class DebugFormatterHelper extends Helper
  55973. {
  55974. private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
  55975. private $started = [];
  55976. private $count = -1;
  55977. public function start(string $id, string $message, string $prefix = 'RUN')
  55978. {
  55979. $this->started[$id] = ['border' => ++$this->count % \count(self::COLORS)];
  55980. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  55981. }
  55982. public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR')
  55983. {
  55984. $message = '';
  55985. if ($error) {
  55986. if (isset($this->started[$id]['out'])) {
  55987. $message .= "\n";
  55988. unset($this->started[$id]['out']);
  55989. }
  55990. if (!isset($this->started[$id]['err'])) {
  55991. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  55992. $this->started[$id]['err'] = true;
  55993. }
  55994. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  55995. } else {
  55996. if (isset($this->started[$id]['err'])) {
  55997. $message .= "\n";
  55998. unset($this->started[$id]['err']);
  55999. }
  56000. if (!isset($this->started[$id]['out'])) {
  56001. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  56002. $this->started[$id]['out'] = true;
  56003. }
  56004. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  56005. }
  56006. return $message;
  56007. }
  56008. public function stop(string $id, string $message, bool $successful, string $prefix = 'RES')
  56009. {
  56010. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  56011. if ($successful) {
  56012. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  56013. }
  56014. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  56015. unset($this->started[$id]['out'], $this->started[$id]['err']);
  56016. return $message;
  56017. }
  56018. private function getBorder(string $id): string
  56019. {
  56020. return sprintf('<bg=%s> </>', self::COLORS[$this->started[$id]['border']]);
  56021. }
  56022. public function getName()
  56023. {
  56024. return 'debug_formatter';
  56025. }
  56026. }
  56027. <?php
  56028. namespace Symfony\Component\Console\Helper;
  56029. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  56030. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  56031. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  56032. use Symfony\Component\Console\Descriptor\TextDescriptor;
  56033. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  56034. use Symfony\Component\Console\Exception\InvalidArgumentException;
  56035. use Symfony\Component\Console\Output\OutputInterface;
  56036. class DescriptorHelper extends Helper
  56037. {
  56038. private $descriptors = [];
  56039. public function __construct()
  56040. {
  56041. $this
  56042. ->register('txt', new TextDescriptor())
  56043. ->register('xml', new XmlDescriptor())
  56044. ->register('json', new JsonDescriptor())
  56045. ->register('md', new MarkdownDescriptor())
  56046. ;
  56047. }
  56048. public function describe(OutputInterface $output, ?object $object, array $options = [])
  56049. {
  56050. $options = array_merge([
  56051. 'raw_text' => false,
  56052. 'format' => 'txt',
  56053. ], $options);
  56054. if (!isset($this->descriptors[$options['format']])) {
  56055. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  56056. }
  56057. $descriptor = $this->descriptors[$options['format']];
  56058. $descriptor->describe($output, $object, $options);
  56059. }
  56060. public function register(string $format, DescriptorInterface $descriptor)
  56061. {
  56062. $this->descriptors[$format] = $descriptor;
  56063. return $this;
  56064. }
  56065. public function getName()
  56066. {
  56067. return 'descriptor';
  56068. }
  56069. public function getFormats(): array
  56070. {
  56071. return array_keys($this->descriptors);
  56072. }
  56073. }
  56074. <?php
  56075. namespace Symfony\Component\Console\Helper;
  56076. use Symfony\Component\Console\Output\OutputInterface;
  56077. use Symfony\Component\VarDumper\Cloner\ClonerInterface;
  56078. use Symfony\Component\VarDumper\Cloner\VarCloner;
  56079. use Symfony\Component\VarDumper\Dumper\CliDumper;
  56080. final class Dumper
  56081. {
  56082. private $output;
  56083. private $dumper;
  56084. private $cloner;
  56085. private $handler;
  56086. public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null)
  56087. {
  56088. $this->output = $output;
  56089. $this->dumper = $dumper;
  56090. $this->cloner = $cloner;
  56091. if (class_exists(CliDumper::class)) {
  56092. $this->handler = function ($var): string {
  56093. $dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
  56094. $dumper->setColors($this->output->isDecorated());
  56095. return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
  56096. };
  56097. } else {
  56098. $this->handler = function ($var): string {
  56099. switch (true) {
  56100. case null === $var:
  56101. return 'null';
  56102. case true === $var:
  56103. return 'true';
  56104. case false === $var:
  56105. return 'false';
  56106. case \is_string($var):
  56107. return '"'.$var.'"';
  56108. default:
  56109. return rtrim(print_r($var, true));
  56110. }
  56111. };
  56112. }
  56113. }
  56114. public function __invoke($var): string
  56115. {
  56116. return ($this->handler)($var);
  56117. }
  56118. }
  56119. <?php
  56120. namespace Symfony\Component\Console\Helper;
  56121. use Symfony\Component\Console\Formatter\OutputFormatter;
  56122. class FormatterHelper extends Helper
  56123. {
  56124. public function formatSection(string $section, string $message, string $style = 'info')
  56125. {
  56126. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  56127. }
  56128. public function formatBlock($messages, string $style, bool $large = false)
  56129. {
  56130. if (!\is_array($messages)) {
  56131. $messages = [$messages];
  56132. }
  56133. $len = 0;
  56134. $lines = [];
  56135. foreach ($messages as $message) {
  56136. $message = OutputFormatter::escape($message);
  56137. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  56138. $len = max(self::width($message) + ($large ? 4 : 2), $len);
  56139. }
  56140. $messages = $large ? [str_repeat(' ', $len)] : [];
  56141. for ($i = 0; isset($lines[$i]); ++$i) {
  56142. $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i]));
  56143. }
  56144. if ($large) {
  56145. $messages[] = str_repeat(' ', $len);
  56146. }
  56147. for ($i = 0; isset($messages[$i]); ++$i) {
  56148. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  56149. }
  56150. return implode("\n", $messages);
  56151. }
  56152. public function truncate(string $message, int $length, string $suffix = '...')
  56153. {
  56154. $computedLength = $length - self::width($suffix);
  56155. if ($computedLength > self::width($message)) {
  56156. return $message;
  56157. }
  56158. return self::substr($message, 0, $length).$suffix;
  56159. }
  56160. public function getName()
  56161. {
  56162. return 'formatter';
  56163. }
  56164. }
  56165. <?php
  56166. namespace Symfony\Component\Console\Helper;
  56167. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  56168. use Symfony\Component\String\UnicodeString;
  56169. abstract class Helper implements HelperInterface
  56170. {
  56171. protected $helperSet = null;
  56172. public function setHelperSet(HelperSet $helperSet = null)
  56173. {
  56174. $this->helperSet = $helperSet;
  56175. }
  56176. public function getHelperSet()
  56177. {
  56178. return $this->helperSet;
  56179. }
  56180. public static function strlen(?string $string)
  56181. {
  56182. trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::width() or Helper::length() instead.', __METHOD__);
  56183. return self::width($string);
  56184. }
  56185. public static function width(?string $string): int
  56186. {
  56187. $string ?? $string = '';
  56188. if (preg_match('//u', $string)) {
  56189. return (new UnicodeString($string))->width(false);
  56190. }
  56191. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  56192. return \strlen($string);
  56193. }
  56194. return mb_strwidth($string, $encoding);
  56195. }
  56196. public static function length(?string $string): int
  56197. {
  56198. $string ?? $string = '';
  56199. if (preg_match('//u', $string)) {
  56200. return (new UnicodeString($string))->length();
  56201. }
  56202. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  56203. return \strlen($string);
  56204. }
  56205. return mb_strlen($string, $encoding);
  56206. }
  56207. public static function substr(?string $string, int $from, int $length = null)
  56208. {
  56209. $string ?? $string = '';
  56210. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  56211. return substr($string, $from, $length);
  56212. }
  56213. return mb_substr($string, $from, $length, $encoding);
  56214. }
  56215. public static function formatTime($secs)
  56216. {
  56217. static $timeFormats = [
  56218. [0, '< 1 sec'],
  56219. [1, '1 sec'],
  56220. [2, 'secs', 1],
  56221. [60, '1 min'],
  56222. [120, 'mins', 60],
  56223. [3600, '1 hr'],
  56224. [7200, 'hrs', 3600],
  56225. [86400, '1 day'],
  56226. [172800, 'days', 86400],
  56227. ];
  56228. foreach ($timeFormats as $index => $format) {
  56229. if ($secs >= $format[0]) {
  56230. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  56231. || $index == \count($timeFormats) - 1
  56232. ) {
  56233. if (2 == \count($format)) {
  56234. return $format[1];
  56235. }
  56236. return floor($secs / $format[2]).' '.$format[1];
  56237. }
  56238. }
  56239. }
  56240. }
  56241. public static function formatMemory(int $memory)
  56242. {
  56243. if ($memory >= 1024 * 1024 * 1024) {
  56244. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  56245. }
  56246. if ($memory >= 1024 * 1024) {
  56247. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  56248. }
  56249. if ($memory >= 1024) {
  56250. return sprintf('%d KiB', $memory / 1024);
  56251. }
  56252. return sprintf('%d B', $memory);
  56253. }
  56254. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string)
  56255. {
  56256. trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::removeDecoration() instead.', __METHOD__);
  56257. return self::width(self::removeDecoration($formatter, $string));
  56258. }
  56259. public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
  56260. {
  56261. $isDecorated = $formatter->isDecorated();
  56262. $formatter->setDecorated(false);
  56263. $string = $formatter->format($string ?? '');
  56264. $string = preg_replace("/\033\[[^m]*m/", '', $string ?? '');
  56265. $formatter->setDecorated($isDecorated);
  56266. return $string;
  56267. }
  56268. }
  56269. <?php
  56270. namespace Symfony\Component\Console\Helper;
  56271. interface HelperInterface
  56272. {
  56273. public function setHelperSet(HelperSet $helperSet = null);
  56274. public function getHelperSet();
  56275. public function getName();
  56276. }
  56277. <?php
  56278. namespace Symfony\Component\Console\Helper;
  56279. use Symfony\Component\Console\Command\Command;
  56280. use Symfony\Component\Console\Exception\InvalidArgumentException;
  56281. class HelperSet implements \IteratorAggregate
  56282. {
  56283. private $helpers = [];
  56284. private $command;
  56285. public function __construct(array $helpers = [])
  56286. {
  56287. foreach ($helpers as $alias => $helper) {
  56288. $this->set($helper, \is_int($alias) ? null : $alias);
  56289. }
  56290. }
  56291. public function set(HelperInterface $helper, string $alias = null)
  56292. {
  56293. $this->helpers[$helper->getName()] = $helper;
  56294. if (null !== $alias) {
  56295. $this->helpers[$alias] = $helper;
  56296. }
  56297. $helper->setHelperSet($this);
  56298. }
  56299. public function has(string $name)
  56300. {
  56301. return isset($this->helpers[$name]);
  56302. }
  56303. public function get(string $name)
  56304. {
  56305. if (!$this->has($name)) {
  56306. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  56307. }
  56308. return $this->helpers[$name];
  56309. }
  56310. public function setCommand(Command $command = null)
  56311. {
  56312. trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
  56313. $this->command = $command;
  56314. }
  56315. public function getCommand()
  56316. {
  56317. trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
  56318. return $this->command;
  56319. }
  56320. #[\ReturnTypeWillChange]
  56321. public function getIterator()
  56322. {
  56323. return new \ArrayIterator($this->helpers);
  56324. }
  56325. }
  56326. <?php
  56327. namespace Symfony\Component\Console\Helper;
  56328. use Symfony\Component\Console\Input\InputAwareInterface;
  56329. use Symfony\Component\Console\Input\InputInterface;
  56330. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  56331. {
  56332. protected $input;
  56333. public function setInput(InputInterface $input)
  56334. {
  56335. $this->input = $input;
  56336. }
  56337. }
  56338. <?php
  56339. namespace Symfony\Component\Console\Helper;
  56340. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  56341. use Symfony\Component\Console\Output\OutputInterface;
  56342. use Symfony\Component\Process\Exception\ProcessFailedException;
  56343. use Symfony\Component\Process\Process;
  56344. class ProcessHelper extends Helper
  56345. {
  56346. public function run(OutputInterface $output, $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
  56347. {
  56348. if (!class_exists(Process::class)) {
  56349. throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
  56350. }
  56351. if ($output instanceof ConsoleOutputInterface) {
  56352. $output = $output->getErrorOutput();
  56353. }
  56354. $formatter = $this->getHelperSet()->get('debug_formatter');
  56355. if ($cmd instanceof Process) {
  56356. $cmd = [$cmd];
  56357. }
  56358. if (!\is_array($cmd)) {
  56359. throw new \TypeError(sprintf('The "command" argument of "%s()" must be an array or a "%s" instance, "%s" given.', __METHOD__, Process::class, get_debug_type($cmd)));
  56360. }
  56361. if (\is_string($cmd[0] ?? null)) {
  56362. $process = new Process($cmd);
  56363. $cmd = [];
  56364. } elseif (($cmd[0] ?? null) instanceof Process) {
  56365. $process = $cmd[0];
  56366. unset($cmd[0]);
  56367. } else {
  56368. throw new \InvalidArgumentException(sprintf('Invalid command provided to "%s()": the command should be an array whose first element is either the path to the binary to run or a "Process" object.', __METHOD__));
  56369. }
  56370. if ($verbosity <= $output->getVerbosity()) {
  56371. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  56372. }
  56373. if ($output->isDebug()) {
  56374. $callback = $this->wrapCallback($output, $process, $callback);
  56375. }
  56376. $process->run($callback, $cmd);
  56377. if ($verbosity <= $output->getVerbosity()) {
  56378. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  56379. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  56380. }
  56381. if (!$process->isSuccessful() && null !== $error) {
  56382. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  56383. }
  56384. return $process;
  56385. }
  56386. public function mustRun(OutputInterface $output, $cmd, string $error = null, callable $callback = null): Process
  56387. {
  56388. $process = $this->run($output, $cmd, $error, $callback);
  56389. if (!$process->isSuccessful()) {
  56390. throw new ProcessFailedException($process);
  56391. }
  56392. return $process;
  56393. }
  56394. public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable
  56395. {
  56396. if ($output instanceof ConsoleOutputInterface) {
  56397. $output = $output->getErrorOutput();
  56398. }
  56399. $formatter = $this->getHelperSet()->get('debug_formatter');
  56400. return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
  56401. $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
  56402. if (null !== $callback) {
  56403. $callback($type, $buffer);
  56404. }
  56405. };
  56406. }
  56407. private function escapeString(string $str): string
  56408. {
  56409. return str_replace('<', '\\<', $str);
  56410. }
  56411. public function getName(): string
  56412. {
  56413. return 'process';
  56414. }
  56415. }
  56416. <?php
  56417. namespace Symfony\Component\Console\Helper;
  56418. use Symfony\Component\Console\Cursor;
  56419. use Symfony\Component\Console\Exception\LogicException;
  56420. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  56421. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  56422. use Symfony\Component\Console\Output\OutputInterface;
  56423. use Symfony\Component\Console\Terminal;
  56424. final class ProgressBar
  56425. {
  56426. public const FORMAT_VERBOSE = 'verbose';
  56427. public const FORMAT_VERY_VERBOSE = 'very_verbose';
  56428. public const FORMAT_DEBUG = 'debug';
  56429. public const FORMAT_NORMAL = 'normal';
  56430. private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax';
  56431. private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
  56432. private const FORMAT_DEBUG_NOMAX = 'debug_nomax';
  56433. private const FORMAT_NORMAL_NOMAX = 'normal_nomax';
  56434. private $barWidth = 28;
  56435. private $barChar;
  56436. private $emptyBarChar = '-';
  56437. private $progressChar = '>';
  56438. private $format;
  56439. private $internalFormat;
  56440. private $redrawFreq = 1;
  56441. private $writeCount;
  56442. private $lastWriteTime;
  56443. private $minSecondsBetweenRedraws = 0;
  56444. private $maxSecondsBetweenRedraws = 1;
  56445. private $output;
  56446. private $step = 0;
  56447. private $max;
  56448. private $startTime;
  56449. private $stepWidth;
  56450. private $percent = 0.0;
  56451. private $formatLineCount;
  56452. private $messages = [];
  56453. private $overwrite = true;
  56454. private $terminal;
  56455. private $previousMessage;
  56456. private $cursor;
  56457. private static $formatters;
  56458. private static $formats;
  56459. public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25)
  56460. {
  56461. if ($output instanceof ConsoleOutputInterface) {
  56462. $output = $output->getErrorOutput();
  56463. }
  56464. $this->output = $output;
  56465. $this->setMaxSteps($max);
  56466. $this->terminal = new Terminal();
  56467. if (0 < $minSecondsBetweenRedraws) {
  56468. $this->redrawFreq = null;
  56469. $this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws;
  56470. }
  56471. if (!$this->output->isDecorated()) {
  56472. $this->overwrite = false;
  56473. $this->redrawFreq = null;
  56474. }
  56475. $this->startTime = time();
  56476. $this->cursor = new Cursor($output);
  56477. }
  56478. public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
  56479. {
  56480. if (!self::$formatters) {
  56481. self::$formatters = self::initPlaceholderFormatters();
  56482. }
  56483. self::$formatters[$name] = $callable;
  56484. }
  56485. public static function getPlaceholderFormatterDefinition(string $name): ?callable
  56486. {
  56487. if (!self::$formatters) {
  56488. self::$formatters = self::initPlaceholderFormatters();
  56489. }
  56490. return self::$formatters[$name] ?? null;
  56491. }
  56492. public static function setFormatDefinition(string $name, string $format): void
  56493. {
  56494. if (!self::$formats) {
  56495. self::$formats = self::initFormats();
  56496. }
  56497. self::$formats[$name] = $format;
  56498. }
  56499. public static function getFormatDefinition(string $name): ?string
  56500. {
  56501. if (!self::$formats) {
  56502. self::$formats = self::initFormats();
  56503. }
  56504. return self::$formats[$name] ?? null;
  56505. }
  56506. public function setMessage(string $message, string $name = 'message')
  56507. {
  56508. $this->messages[$name] = $message;
  56509. }
  56510. public function getMessage(string $name = 'message')
  56511. {
  56512. return $this->messages[$name];
  56513. }
  56514. public function getStartTime(): int
  56515. {
  56516. return $this->startTime;
  56517. }
  56518. public function getMaxSteps(): int
  56519. {
  56520. return $this->max;
  56521. }
  56522. public function getProgress(): int
  56523. {
  56524. return $this->step;
  56525. }
  56526. private function getStepWidth(): int
  56527. {
  56528. return $this->stepWidth;
  56529. }
  56530. public function getProgressPercent(): float
  56531. {
  56532. return $this->percent;
  56533. }
  56534. public function getBarOffset(): float
  56535. {
  56536. return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
  56537. }
  56538. public function getEstimated(): float
  56539. {
  56540. if (!$this->step) {
  56541. return 0;
  56542. }
  56543. return round((time() - $this->startTime) / $this->step * $this->max);
  56544. }
  56545. public function getRemaining(): float
  56546. {
  56547. if (!$this->step) {
  56548. return 0;
  56549. }
  56550. return round((time() - $this->startTime) / $this->step * ($this->max - $this->step));
  56551. }
  56552. public function setBarWidth(int $size)
  56553. {
  56554. $this->barWidth = max(1, $size);
  56555. }
  56556. public function getBarWidth(): int
  56557. {
  56558. return $this->barWidth;
  56559. }
  56560. public function setBarCharacter(string $char)
  56561. {
  56562. $this->barChar = $char;
  56563. }
  56564. public function getBarCharacter(): string
  56565. {
  56566. return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar);
  56567. }
  56568. public function setEmptyBarCharacter(string $char)
  56569. {
  56570. $this->emptyBarChar = $char;
  56571. }
  56572. public function getEmptyBarCharacter(): string
  56573. {
  56574. return $this->emptyBarChar;
  56575. }
  56576. public function setProgressCharacter(string $char)
  56577. {
  56578. $this->progressChar = $char;
  56579. }
  56580. public function getProgressCharacter(): string
  56581. {
  56582. return $this->progressChar;
  56583. }
  56584. public function setFormat(string $format)
  56585. {
  56586. $this->format = null;
  56587. $this->internalFormat = $format;
  56588. }
  56589. public function setRedrawFrequency(?int $freq)
  56590. {
  56591. $this->redrawFreq = null !== $freq ? max(1, $freq) : null;
  56592. }
  56593. public function minSecondsBetweenRedraws(float $seconds): void
  56594. {
  56595. $this->minSecondsBetweenRedraws = $seconds;
  56596. }
  56597. public function maxSecondsBetweenRedraws(float $seconds): void
  56598. {
  56599. $this->maxSecondsBetweenRedraws = $seconds;
  56600. }
  56601. public function iterate(iterable $iterable, int $max = null): iterable
  56602. {
  56603. $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
  56604. foreach ($iterable as $key => $value) {
  56605. yield $key => $value;
  56606. $this->advance();
  56607. }
  56608. $this->finish();
  56609. }
  56610. public function start(int $max = null)
  56611. {
  56612. $this->startTime = time();
  56613. $this->step = 0;
  56614. $this->percent = 0.0;
  56615. if (null !== $max) {
  56616. $this->setMaxSteps($max);
  56617. }
  56618. $this->display();
  56619. }
  56620. public function advance(int $step = 1)
  56621. {
  56622. $this->setProgress($this->step + $step);
  56623. }
  56624. public function setOverwrite(bool $overwrite)
  56625. {
  56626. $this->overwrite = $overwrite;
  56627. }
  56628. public function setProgress(int $step)
  56629. {
  56630. if ($this->max && $step > $this->max) {
  56631. $this->max = $step;
  56632. } elseif ($step < 0) {
  56633. $step = 0;
  56634. }
  56635. $redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10);
  56636. $prevPeriod = (int) ($this->step / $redrawFreq);
  56637. $currPeriod = (int) ($step / $redrawFreq);
  56638. $this->step = $step;
  56639. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  56640. $timeInterval = microtime(true) - $this->lastWriteTime;
  56641. if ($this->max === $step) {
  56642. $this->display();
  56643. return;
  56644. }
  56645. if ($timeInterval < $this->minSecondsBetweenRedraws) {
  56646. return;
  56647. }
  56648. if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) {
  56649. $this->display();
  56650. }
  56651. }
  56652. public function setMaxSteps(int $max)
  56653. {
  56654. $this->format = null;
  56655. $this->max = max(0, $max);
  56656. $this->stepWidth = $this->max ? Helper::width((string) $this->max) : 4;
  56657. }
  56658. public function finish(): void
  56659. {
  56660. if (!$this->max) {
  56661. $this->max = $this->step;
  56662. }
  56663. if ($this->step === $this->max && !$this->overwrite) {
  56664. return;
  56665. }
  56666. $this->setProgress($this->max);
  56667. }
  56668. public function display(): void
  56669. {
  56670. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  56671. return;
  56672. }
  56673. if (null === $this->format) {
  56674. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  56675. }
  56676. $this->overwrite($this->buildLine());
  56677. }
  56678. public function clear(): void
  56679. {
  56680. if (!$this->overwrite) {
  56681. return;
  56682. }
  56683. if (null === $this->format) {
  56684. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  56685. }
  56686. $this->overwrite('');
  56687. }
  56688. private function setRealFormat(string $format)
  56689. {
  56690. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  56691. $this->format = self::getFormatDefinition($format.'_nomax');
  56692. } elseif (null !== self::getFormatDefinition($format)) {
  56693. $this->format = self::getFormatDefinition($format);
  56694. } else {
  56695. $this->format = $format;
  56696. }
  56697. $this->formatLineCount = substr_count($this->format, "\n");
  56698. }
  56699. private function overwrite(string $message): void
  56700. {
  56701. if ($this->previousMessage === $message) {
  56702. return;
  56703. }
  56704. $originalMessage = $message;
  56705. if ($this->overwrite) {
  56706. if (null !== $this->previousMessage) {
  56707. if ($this->output instanceof ConsoleSectionOutput) {
  56708. $messageLines = explode("\n", $message);
  56709. $lineCount = \count($messageLines);
  56710. foreach ($messageLines as $messageLine) {
  56711. $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine));
  56712. if ($messageLineLength > $this->terminal->getWidth()) {
  56713. $lineCount += floor($messageLineLength / $this->terminal->getWidth());
  56714. }
  56715. }
  56716. $this->output->clear($lineCount);
  56717. } else {
  56718. for ($i = 0; $i < $this->formatLineCount; ++$i) {
  56719. $this->cursor->moveToColumn(1);
  56720. $this->cursor->clearLine();
  56721. $this->cursor->moveUp();
  56722. }
  56723. $this->cursor->moveToColumn(1);
  56724. $this->cursor->clearLine();
  56725. }
  56726. }
  56727. } elseif ($this->step > 0) {
  56728. $message = \PHP_EOL.$message;
  56729. }
  56730. $this->previousMessage = $originalMessage;
  56731. $this->lastWriteTime = microtime(true);
  56732. $this->output->write($message);
  56733. ++$this->writeCount;
  56734. }
  56735. private function determineBestFormat(): string
  56736. {
  56737. switch ($this->output->getVerbosity()) {
  56738. case OutputInterface::VERBOSITY_VERBOSE:
  56739. return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX;
  56740. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  56741. return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX;
  56742. case OutputInterface::VERBOSITY_DEBUG:
  56743. return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX;
  56744. default:
  56745. return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX;
  56746. }
  56747. }
  56748. private static function initPlaceholderFormatters(): array
  56749. {
  56750. return [
  56751. 'bar' => function (self $bar, OutputInterface $output) {
  56752. $completeBars = $bar->getBarOffset();
  56753. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  56754. if ($completeBars < $bar->getBarWidth()) {
  56755. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter()));
  56756. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  56757. }
  56758. return $display;
  56759. },
  56760. 'elapsed' => function (self $bar) {
  56761. return Helper::formatTime(time() - $bar->getStartTime());
  56762. },
  56763. 'remaining' => function (self $bar) {
  56764. if (!$bar->getMaxSteps()) {
  56765. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  56766. }
  56767. return Helper::formatTime($bar->getRemaining());
  56768. },
  56769. 'estimated' => function (self $bar) {
  56770. if (!$bar->getMaxSteps()) {
  56771. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  56772. }
  56773. return Helper::formatTime($bar->getEstimated());
  56774. },
  56775. 'memory' => function (self $bar) {
  56776. return Helper::formatMemory(memory_get_usage(true));
  56777. },
  56778. 'current' => function (self $bar) {
  56779. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
  56780. },
  56781. 'max' => function (self $bar) {
  56782. return $bar->getMaxSteps();
  56783. },
  56784. 'percent' => function (self $bar) {
  56785. return floor($bar->getProgressPercent() * 100);
  56786. },
  56787. ];
  56788. }
  56789. private static function initFormats(): array
  56790. {
  56791. return [
  56792. self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%',
  56793. self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]',
  56794. self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  56795. self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
  56796. self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  56797. self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
  56798. self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  56799. self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  56800. ];
  56801. }
  56802. private function buildLine(): string
  56803. {
  56804. $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
  56805. $callback = function ($matches) {
  56806. if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
  56807. $text = $formatter($this, $this->output);
  56808. } elseif (isset($this->messages[$matches[1]])) {
  56809. $text = $this->messages[$matches[1]];
  56810. } else {
  56811. return $matches[0];
  56812. }
  56813. if (isset($matches[2])) {
  56814. $text = sprintf('%'.$matches[2], $text);
  56815. }
  56816. return $text;
  56817. };
  56818. $line = preg_replace_callback($regex, $callback, $this->format);
  56819. $linesLength = array_map(function ($subLine) {
  56820. return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r")));
  56821. }, explode("\n", $line));
  56822. $linesWidth = max($linesLength);
  56823. $terminalWidth = $this->terminal->getWidth();
  56824. if ($linesWidth <= $terminalWidth) {
  56825. return $line;
  56826. }
  56827. $this->setBarWidth($this->barWidth - $linesWidth + $terminalWidth);
  56828. return preg_replace_callback($regex, $callback, $this->format);
  56829. }
  56830. }
  56831. <?php
  56832. namespace Symfony\Component\Console\Helper;
  56833. use Symfony\Component\Console\Exception\InvalidArgumentException;
  56834. use Symfony\Component\Console\Exception\LogicException;
  56835. use Symfony\Component\Console\Output\OutputInterface;
  56836. class ProgressIndicator
  56837. {
  56838. private const FORMATS = [
  56839. 'normal' => ' %indicator% %message%',
  56840. 'normal_no_ansi' => ' %message%',
  56841. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  56842. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  56843. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  56844. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  56845. ];
  56846. private $output;
  56847. private $startTime;
  56848. private $format;
  56849. private $message;
  56850. private $indicatorValues;
  56851. private $indicatorCurrent;
  56852. private $indicatorChangeInterval;
  56853. private $indicatorUpdateTime;
  56854. private $started = false;
  56855. private static $formatters;
  56856. public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
  56857. {
  56858. $this->output = $output;
  56859. if (null === $format) {
  56860. $format = $this->determineBestFormat();
  56861. }
  56862. if (null === $indicatorValues) {
  56863. $indicatorValues = ['-', '\\', '|', '/'];
  56864. }
  56865. $indicatorValues = array_values($indicatorValues);
  56866. if (2 > \count($indicatorValues)) {
  56867. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  56868. }
  56869. $this->format = self::getFormatDefinition($format);
  56870. $this->indicatorChangeInterval = $indicatorChangeInterval;
  56871. $this->indicatorValues = $indicatorValues;
  56872. $this->startTime = time();
  56873. }
  56874. public function setMessage(?string $message)
  56875. {
  56876. $this->message = $message;
  56877. $this->display();
  56878. }
  56879. public function start(string $message)
  56880. {
  56881. if ($this->started) {
  56882. throw new LogicException('Progress indicator already started.');
  56883. }
  56884. $this->message = $message;
  56885. $this->started = true;
  56886. $this->startTime = time();
  56887. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  56888. $this->indicatorCurrent = 0;
  56889. $this->display();
  56890. }
  56891. public function advance()
  56892. {
  56893. if (!$this->started) {
  56894. throw new LogicException('Progress indicator has not yet been started.');
  56895. }
  56896. if (!$this->output->isDecorated()) {
  56897. return;
  56898. }
  56899. $currentTime = $this->getCurrentTimeInMilliseconds();
  56900. if ($currentTime < $this->indicatorUpdateTime) {
  56901. return;
  56902. }
  56903. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  56904. ++$this->indicatorCurrent;
  56905. $this->display();
  56906. }
  56907. public function finish(string $message)
  56908. {
  56909. if (!$this->started) {
  56910. throw new LogicException('Progress indicator has not yet been started.');
  56911. }
  56912. $this->message = $message;
  56913. $this->display();
  56914. $this->output->writeln('');
  56915. $this->started = false;
  56916. }
  56917. public static function getFormatDefinition(string $name)
  56918. {
  56919. return self::FORMATS[$name] ?? null;
  56920. }
  56921. public static function setPlaceholderFormatterDefinition(string $name, callable $callable)
  56922. {
  56923. if (!self::$formatters) {
  56924. self::$formatters = self::initPlaceholderFormatters();
  56925. }
  56926. self::$formatters[$name] = $callable;
  56927. }
  56928. public static function getPlaceholderFormatterDefinition(string $name)
  56929. {
  56930. if (!self::$formatters) {
  56931. self::$formatters = self::initPlaceholderFormatters();
  56932. }
  56933. return self::$formatters[$name] ?? null;
  56934. }
  56935. private function display()
  56936. {
  56937. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  56938. return;
  56939. }
  56940. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
  56941. if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) {
  56942. return $formatter($this);
  56943. }
  56944. return $matches[0];
  56945. }, $this->format ?? ''));
  56946. }
  56947. private function determineBestFormat(): string
  56948. {
  56949. switch ($this->output->getVerbosity()) {
  56950. case OutputInterface::VERBOSITY_VERBOSE:
  56951. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  56952. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  56953. case OutputInterface::VERBOSITY_DEBUG:
  56954. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  56955. default:
  56956. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  56957. }
  56958. }
  56959. private function overwrite(string $message)
  56960. {
  56961. if ($this->output->isDecorated()) {
  56962. $this->output->write("\x0D\x1B[2K");
  56963. $this->output->write($message);
  56964. } else {
  56965. $this->output->writeln($message);
  56966. }
  56967. }
  56968. private function getCurrentTimeInMilliseconds(): float
  56969. {
  56970. return round(microtime(true) * 1000);
  56971. }
  56972. private static function initPlaceholderFormatters(): array
  56973. {
  56974. return [
  56975. 'indicator' => function (self $indicator) {
  56976. return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)];
  56977. },
  56978. 'message' => function (self $indicator) {
  56979. return $indicator->message;
  56980. },
  56981. 'elapsed' => function (self $indicator) {
  56982. return Helper::formatTime(time() - $indicator->startTime);
  56983. },
  56984. 'memory' => function () {
  56985. return Helper::formatMemory(memory_get_usage(true));
  56986. },
  56987. ];
  56988. }
  56989. }
  56990. <?php
  56991. namespace Symfony\Component\Console\Helper;
  56992. use Symfony\Component\Console\Cursor;
  56993. use Symfony\Component\Console\Exception\MissingInputException;
  56994. use Symfony\Component\Console\Exception\RuntimeException;
  56995. use Symfony\Component\Console\Formatter\OutputFormatter;
  56996. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  56997. use Symfony\Component\Console\Input\InputInterface;
  56998. use Symfony\Component\Console\Input\StreamableInputInterface;
  56999. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  57000. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  57001. use Symfony\Component\Console\Output\OutputInterface;
  57002. use Symfony\Component\Console\Question\ChoiceQuestion;
  57003. use Symfony\Component\Console\Question\Question;
  57004. use Symfony\Component\Console\Terminal;
  57005. use function Symfony\Component\String\s;
  57006. class QuestionHelper extends Helper
  57007. {
  57008. private $inputStream;
  57009. private static $stty = true;
  57010. private static $stdinIsInteractive;
  57011. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  57012. {
  57013. if ($output instanceof ConsoleOutputInterface) {
  57014. $output = $output->getErrorOutput();
  57015. }
  57016. if (!$input->isInteractive()) {
  57017. return $this->getDefaultAnswer($question);
  57018. }
  57019. if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
  57020. $this->inputStream = $stream;
  57021. }
  57022. try {
  57023. if (!$question->getValidator()) {
  57024. return $this->doAsk($output, $question);
  57025. }
  57026. $interviewer = function () use ($output, $question) {
  57027. return $this->doAsk($output, $question);
  57028. };
  57029. return $this->validateAttempts($interviewer, $output, $question);
  57030. } catch (MissingInputException $exception) {
  57031. $input->setInteractive(false);
  57032. if (null === $fallbackOutput = $this->getDefaultAnswer($question)) {
  57033. throw $exception;
  57034. }
  57035. return $fallbackOutput;
  57036. }
  57037. }
  57038. public function getName()
  57039. {
  57040. return 'question';
  57041. }
  57042. public static function disableStty()
  57043. {
  57044. self::$stty = false;
  57045. }
  57046. private function doAsk(OutputInterface $output, Question $question)
  57047. {
  57048. $this->writePrompt($output, $question);
  57049. $inputStream = $this->inputStream ?: \STDIN;
  57050. $autocomplete = $question->getAutocompleterCallback();
  57051. if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
  57052. $ret = false;
  57053. if ($question->isHidden()) {
  57054. try {
  57055. $hiddenResponse = $this->getHiddenResponse($output, $inputStream, $question->isTrimmable());
  57056. $ret = $question->isTrimmable() ? trim($hiddenResponse) : $hiddenResponse;
  57057. } catch (RuntimeException $e) {
  57058. if (!$question->isHiddenFallback()) {
  57059. throw $e;
  57060. }
  57061. }
  57062. }
  57063. if (false === $ret) {
  57064. $ret = $this->readInput($inputStream, $question);
  57065. if (false === $ret) {
  57066. throw new MissingInputException('Aborted.');
  57067. }
  57068. if ($question->isTrimmable()) {
  57069. $ret = trim($ret);
  57070. }
  57071. }
  57072. } else {
  57073. $autocomplete = $this->autocomplete($output, $question, $inputStream, $autocomplete);
  57074. $ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
  57075. }
  57076. if ($output instanceof ConsoleSectionOutput) {
  57077. $output->addContent($ret);
  57078. }
  57079. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  57080. if ($normalizer = $question->getNormalizer()) {
  57081. return $normalizer($ret);
  57082. }
  57083. return $ret;
  57084. }
  57085. private function getDefaultAnswer(Question $question)
  57086. {
  57087. $default = $question->getDefault();
  57088. if (null === $default) {
  57089. return $default;
  57090. }
  57091. if ($validator = $question->getValidator()) {
  57092. return \call_user_func($question->getValidator(), $default);
  57093. } elseif ($question instanceof ChoiceQuestion) {
  57094. $choices = $question->getChoices();
  57095. if (!$question->isMultiselect()) {
  57096. return $choices[$default] ?? $default;
  57097. }
  57098. $default = explode(',', $default);
  57099. foreach ($default as $k => $v) {
  57100. $v = $question->isTrimmable() ? trim($v) : $v;
  57101. $default[$k] = $choices[$v] ?? $v;
  57102. }
  57103. }
  57104. return $default;
  57105. }
  57106. protected function writePrompt(OutputInterface $output, Question $question)
  57107. {
  57108. $message = $question->getQuestion();
  57109. if ($question instanceof ChoiceQuestion) {
  57110. $output->writeln(array_merge([
  57111. $question->getQuestion(),
  57112. ], $this->formatChoiceQuestionChoices($question, 'info')));
  57113. $message = $question->getPrompt();
  57114. }
  57115. $output->write($message);
  57116. }
  57117. protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag)
  57118. {
  57119. $messages = [];
  57120. $maxWidth = max(array_map([__CLASS__, 'width'], array_keys($choices = $question->getChoices())));
  57121. foreach ($choices as $key => $value) {
  57122. $padding = str_repeat(' ', $maxWidth - self::width($key));
  57123. $messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
  57124. }
  57125. return $messages;
  57126. }
  57127. protected function writeError(OutputInterface $output, \Exception $error)
  57128. {
  57129. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  57130. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  57131. } else {
  57132. $message = '<error>'.$error->getMessage().'</error>';
  57133. }
  57134. $output->writeln($message);
  57135. }
  57136. private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string
  57137. {
  57138. $cursor = new Cursor($output, $inputStream);
  57139. $fullChoice = '';
  57140. $ret = '';
  57141. $i = 0;
  57142. $ofs = -1;
  57143. $matches = $autocomplete($ret);
  57144. $numMatches = \count($matches);
  57145. $sttyMode = shell_exec('stty -g');
  57146. $isStdin = 'php://stdin' === (stream_get_meta_data($inputStream)['uri'] ?? null);
  57147. $r = [$inputStream];
  57148. $w = [];
  57149. shell_exec('stty -icanon -echo');
  57150. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  57151. while (!feof($inputStream)) {
  57152. while ($isStdin && 0 === @stream_select($r, $w, $w, 0, 100)) {
  57153. $r = [$inputStream];
  57154. }
  57155. $c = fread($inputStream, 1);
  57156. if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
  57157. shell_exec('stty '.$sttyMode);
  57158. throw new MissingInputException('Aborted.');
  57159. } elseif ("\177" === $c) {
  57160. if (0 === $numMatches && 0 !== $i) {
  57161. --$i;
  57162. $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false));
  57163. $fullChoice = self::substr($fullChoice, 0, $i);
  57164. }
  57165. if (0 === $i) {
  57166. $ofs = -1;
  57167. $matches = $autocomplete($ret);
  57168. $numMatches = \count($matches);
  57169. } else {
  57170. $numMatches = 0;
  57171. }
  57172. $ret = self::substr($ret, 0, $i);
  57173. } elseif ("\033" === $c) {
  57174. $c .= fread($inputStream, 2);
  57175. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  57176. if ('A' === $c[2] && -1 === $ofs) {
  57177. $ofs = 0;
  57178. }
  57179. if (0 === $numMatches) {
  57180. continue;
  57181. }
  57182. $ofs += ('A' === $c[2]) ? -1 : 1;
  57183. $ofs = ($numMatches + $ofs) % $numMatches;
  57184. }
  57185. } elseif (\ord($c) < 32) {
  57186. if ("\t" === $c || "\n" === $c) {
  57187. if ($numMatches > 0 && -1 !== $ofs) {
  57188. $ret = (string) $matches[$ofs];
  57189. $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
  57190. $output->write($remainingCharacters);
  57191. $fullChoice .= $remainingCharacters;
  57192. $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
  57193. $matches = array_filter(
  57194. $autocomplete($ret),
  57195. function ($match) use ($ret) {
  57196. return '' === $ret || str_starts_with($match, $ret);
  57197. }
  57198. );
  57199. $numMatches = \count($matches);
  57200. $ofs = -1;
  57201. }
  57202. if ("\n" === $c) {
  57203. $output->write($c);
  57204. break;
  57205. }
  57206. $numMatches = 0;
  57207. }
  57208. continue;
  57209. } else {
  57210. if ("\x80" <= $c) {
  57211. $c .= fread($inputStream, ["\xC0" => 1, "\xD0" => 1, "\xE0" => 2, "\xF0" => 3][$c & "\xF0"]);
  57212. }
  57213. $output->write($c);
  57214. $ret .= $c;
  57215. $fullChoice .= $c;
  57216. ++$i;
  57217. $tempRet = $ret;
  57218. if ($question instanceof ChoiceQuestion && $question->isMultiselect()) {
  57219. $tempRet = $this->mostRecentlyEnteredValue($fullChoice);
  57220. }
  57221. $numMatches = 0;
  57222. $ofs = 0;
  57223. foreach ($autocomplete($ret) as $value) {
  57224. if (str_starts_with($value, $tempRet)) {
  57225. $matches[$numMatches++] = $value;
  57226. }
  57227. }
  57228. }
  57229. $cursor->clearLineAfter();
  57230. if ($numMatches > 0 && -1 !== $ofs) {
  57231. $cursor->savePosition();
  57232. $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)));
  57233. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>');
  57234. $cursor->restorePosition();
  57235. }
  57236. }
  57237. shell_exec('stty '.$sttyMode);
  57238. return $fullChoice;
  57239. }
  57240. private function mostRecentlyEnteredValue(string $entered): string
  57241. {
  57242. if (!str_contains($entered, ',')) {
  57243. return $entered;
  57244. }
  57245. $choices = explode(',', $entered);
  57246. if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) {
  57247. return $lastChoice;
  57248. }
  57249. return $entered;
  57250. }
  57251. private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string
  57252. {
  57253. if ('\\' === \DIRECTORY_SEPARATOR) {
  57254. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  57255. if ('phar:' === substr(__FILE__, 0, 5)) {
  57256. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  57257. copy($exe, $tmpExe);
  57258. $exe = $tmpExe;
  57259. }
  57260. $sExec = shell_exec('"'.$exe.'"');
  57261. $value = $trimmable ? rtrim($sExec) : $sExec;
  57262. $output->writeln('');
  57263. if (isset($tmpExe)) {
  57264. unlink($tmpExe);
  57265. }
  57266. return $value;
  57267. }
  57268. if (self::$stty && Terminal::hasSttyAvailable()) {
  57269. $sttyMode = shell_exec('stty -g');
  57270. shell_exec('stty -echo');
  57271. } elseif ($this->isInteractiveInput($inputStream)) {
  57272. throw new RuntimeException('Unable to hide the response.');
  57273. }
  57274. $value = fgets($inputStream, 4096);
  57275. if (self::$stty && Terminal::hasSttyAvailable()) {
  57276. shell_exec('stty '.$sttyMode);
  57277. }
  57278. if (false === $value) {
  57279. throw new MissingInputException('Aborted.');
  57280. }
  57281. if ($trimmable) {
  57282. $value = trim($value);
  57283. }
  57284. $output->writeln('');
  57285. return $value;
  57286. }
  57287. private function validateAttempts(callable $interviewer, OutputInterface $output, Question $question)
  57288. {
  57289. $error = null;
  57290. $attempts = $question->getMaxAttempts();
  57291. while (null === $attempts || $attempts--) {
  57292. if (null !== $error) {
  57293. $this->writeError($output, $error);
  57294. }
  57295. try {
  57296. return $question->getValidator()($interviewer());
  57297. } catch (RuntimeException $e) {
  57298. throw $e;
  57299. } catch (\Exception $error) {
  57300. }
  57301. }
  57302. throw $error;
  57303. }
  57304. private function isInteractiveInput($inputStream): bool
  57305. {
  57306. if ('php://stdin' !== (stream_get_meta_data($inputStream)['uri'] ?? null)) {
  57307. return false;
  57308. }
  57309. if (null !== self::$stdinIsInteractive) {
  57310. return self::$stdinIsInteractive;
  57311. }
  57312. if (\function_exists('stream_isatty')) {
  57313. return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
  57314. }
  57315. if (\function_exists('posix_isatty')) {
  57316. return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
  57317. }
  57318. if (!\function_exists('exec')) {
  57319. return self::$stdinIsInteractive = true;
  57320. }
  57321. exec('stty 2> /dev/null', $output, $status);
  57322. return self::$stdinIsInteractive = 1 !== $status;
  57323. }
  57324. private function readInput($inputStream, Question $question)
  57325. {
  57326. if (!$question->isMultiline()) {
  57327. $cp = $this->setIOCodepage();
  57328. $ret = fgets($inputStream, 4096);
  57329. return $this->resetIOCodepage($cp, $ret);
  57330. }
  57331. $multiLineStreamReader = $this->cloneInputStream($inputStream);
  57332. if (null === $multiLineStreamReader) {
  57333. return false;
  57334. }
  57335. $ret = '';
  57336. $cp = $this->setIOCodepage();
  57337. while (false !== ($char = fgetc($multiLineStreamReader))) {
  57338. if (\PHP_EOL === "{$ret}{$char}") {
  57339. break;
  57340. }
  57341. $ret .= $char;
  57342. }
  57343. return $this->resetIOCodepage($cp, $ret);
  57344. }
  57345. private function setIOCodepage(): int
  57346. {
  57347. if (\function_exists('sapi_windows_cp_set')) {
  57348. $cp = sapi_windows_cp_get();
  57349. sapi_windows_cp_set(sapi_windows_cp_get('oem'));
  57350. return $cp;
  57351. }
  57352. return 0;
  57353. }
  57354. private function resetIOCodepage(int $cp, $input)
  57355. {
  57356. if (0 !== $cp) {
  57357. sapi_windows_cp_set($cp);
  57358. if (false !== $input && '' !== $input) {
  57359. $input = sapi_windows_cp_conv(sapi_windows_cp_get('oem'), $cp, $input);
  57360. }
  57361. }
  57362. return $input;
  57363. }
  57364. private function cloneInputStream($inputStream)
  57365. {
  57366. $streamMetaData = stream_get_meta_data($inputStream);
  57367. $seekable = $streamMetaData['seekable'] ?? false;
  57368. $mode = $streamMetaData['mode'] ?? 'rb';
  57369. $uri = $streamMetaData['uri'] ?? null;
  57370. if (null === $uri) {
  57371. return null;
  57372. }
  57373. $cloneStream = fopen($uri, $mode);
  57374. if (true === $seekable && !\in_array($mode, ['r', 'rb', 'rt'])) {
  57375. $offset = ftell($inputStream);
  57376. rewind($inputStream);
  57377. stream_copy_to_stream($inputStream, $cloneStream);
  57378. fseek($inputStream, $offset);
  57379. fseek($cloneStream, $offset);
  57380. }
  57381. return $cloneStream;
  57382. }
  57383. }
  57384. <?php
  57385. namespace Symfony\Component\Console\Helper;
  57386. use Symfony\Component\Console\Formatter\OutputFormatter;
  57387. use Symfony\Component\Console\Output\OutputInterface;
  57388. use Symfony\Component\Console\Question\ChoiceQuestion;
  57389. use Symfony\Component\Console\Question\ConfirmationQuestion;
  57390. use Symfony\Component\Console\Question\Question;
  57391. use Symfony\Component\Console\Style\SymfonyStyle;
  57392. class SymfonyQuestionHelper extends QuestionHelper
  57393. {
  57394. protected function writePrompt(OutputInterface $output, Question $question)
  57395. {
  57396. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  57397. $default = $question->getDefault();
  57398. if ($question->isMultiline()) {
  57399. $text .= sprintf(' (press %s to continue)', $this->getEofShortcut());
  57400. }
  57401. switch (true) {
  57402. case null === $default:
  57403. $text = sprintf(' <info>%s</info>:', $text);
  57404. break;
  57405. case $question instanceof ConfirmationQuestion:
  57406. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  57407. break;
  57408. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  57409. $choices = $question->getChoices();
  57410. $default = explode(',', $default);
  57411. foreach ($default as $key => $value) {
  57412. $default[$key] = $choices[trim($value)];
  57413. }
  57414. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  57415. break;
  57416. case $question instanceof ChoiceQuestion:
  57417. $choices = $question->getChoices();
  57418. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
  57419. break;
  57420. default:
  57421. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  57422. }
  57423. $output->writeln($text);
  57424. $prompt = ' > ';
  57425. if ($question instanceof ChoiceQuestion) {
  57426. $output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
  57427. $prompt = $question->getPrompt();
  57428. }
  57429. $output->write($prompt);
  57430. }
  57431. protected function writeError(OutputInterface $output, \Exception $error)
  57432. {
  57433. if ($output instanceof SymfonyStyle) {
  57434. $output->newLine();
  57435. $output->error($error->getMessage());
  57436. return;
  57437. }
  57438. parent::writeError($output, $error);
  57439. }
  57440. private function getEofShortcut(): string
  57441. {
  57442. if ('Windows' === \PHP_OS_FAMILY) {
  57443. return '<comment>Ctrl+Z</comment> then <comment>Enter</comment>';
  57444. }
  57445. return '<comment>Ctrl+D</comment>';
  57446. }
  57447. }
  57448. <?php
  57449. namespace Symfony\Component\Console\Helper;
  57450. use Symfony\Component\Console\Exception\InvalidArgumentException;
  57451. use Symfony\Component\Console\Exception\RuntimeException;
  57452. use Symfony\Component\Console\Formatter\OutputFormatter;
  57453. use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface;
  57454. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  57455. use Symfony\Component\Console\Output\OutputInterface;
  57456. class Table
  57457. {
  57458. private const SEPARATOR_TOP = 0;
  57459. private const SEPARATOR_TOP_BOTTOM = 1;
  57460. private const SEPARATOR_MID = 2;
  57461. private const SEPARATOR_BOTTOM = 3;
  57462. private const BORDER_OUTSIDE = 0;
  57463. private const BORDER_INSIDE = 1;
  57464. private $headerTitle;
  57465. private $footerTitle;
  57466. private $headers = [];
  57467. private $rows = [];
  57468. private $horizontal = false;
  57469. private $effectiveColumnWidths = [];
  57470. private $numberOfColumns;
  57471. private $output;
  57472. private $style;
  57473. private $columnStyles = [];
  57474. private $columnWidths = [];
  57475. private $columnMaxWidths = [];
  57476. private static $styles;
  57477. private $rendered = false;
  57478. public function __construct(OutputInterface $output)
  57479. {
  57480. $this->output = $output;
  57481. if (!self::$styles) {
  57482. self::$styles = self::initStyles();
  57483. }
  57484. $this->setStyle('default');
  57485. }
  57486. public static function setStyleDefinition(string $name, TableStyle $style)
  57487. {
  57488. if (!self::$styles) {
  57489. self::$styles = self::initStyles();
  57490. }
  57491. self::$styles[$name] = $style;
  57492. }
  57493. public static function getStyleDefinition(string $name)
  57494. {
  57495. if (!self::$styles) {
  57496. self::$styles = self::initStyles();
  57497. }
  57498. if (isset(self::$styles[$name])) {
  57499. return self::$styles[$name];
  57500. }
  57501. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  57502. }
  57503. public function setStyle($name)
  57504. {
  57505. $this->style = $this->resolveStyle($name);
  57506. return $this;
  57507. }
  57508. public function getStyle()
  57509. {
  57510. return $this->style;
  57511. }
  57512. public function setColumnStyle(int $columnIndex, $name)
  57513. {
  57514. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  57515. return $this;
  57516. }
  57517. public function getColumnStyle(int $columnIndex)
  57518. {
  57519. return $this->columnStyles[$columnIndex] ?? $this->getStyle();
  57520. }
  57521. public function setColumnWidth(int $columnIndex, int $width)
  57522. {
  57523. $this->columnWidths[$columnIndex] = $width;
  57524. return $this;
  57525. }
  57526. public function setColumnWidths(array $widths)
  57527. {
  57528. $this->columnWidths = [];
  57529. foreach ($widths as $index => $width) {
  57530. $this->setColumnWidth($index, $width);
  57531. }
  57532. return $this;
  57533. }
  57534. public function setColumnMaxWidth(int $columnIndex, int $width): self
  57535. {
  57536. if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) {
  57537. throw new \LogicException(sprintf('Setting a maximum column width is only supported when using a "%s" formatter, got "%s".', WrappableOutputFormatterInterface::class, get_debug_type($this->output->getFormatter())));
  57538. }
  57539. $this->columnMaxWidths[$columnIndex] = $width;
  57540. return $this;
  57541. }
  57542. public function setHeaders(array $headers)
  57543. {
  57544. $headers = array_values($headers);
  57545. if (!empty($headers) && !\is_array($headers[0])) {
  57546. $headers = [$headers];
  57547. }
  57548. $this->headers = $headers;
  57549. return $this;
  57550. }
  57551. public function setRows(array $rows)
  57552. {
  57553. $this->rows = [];
  57554. return $this->addRows($rows);
  57555. }
  57556. public function addRows(array $rows)
  57557. {
  57558. foreach ($rows as $row) {
  57559. $this->addRow($row);
  57560. }
  57561. return $this;
  57562. }
  57563. public function addRow($row)
  57564. {
  57565. if ($row instanceof TableSeparator) {
  57566. $this->rows[] = $row;
  57567. return $this;
  57568. }
  57569. if (!\is_array($row)) {
  57570. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  57571. }
  57572. $this->rows[] = array_values($row);
  57573. return $this;
  57574. }
  57575. public function appendRow($row): self
  57576. {
  57577. if (!$this->output instanceof ConsoleSectionOutput) {
  57578. throw new RuntimeException(sprintf('Output should be an instance of "%s" when calling "%s".', ConsoleSectionOutput::class, __METHOD__));
  57579. }
  57580. if ($this->rendered) {
  57581. $this->output->clear($this->calculateRowCount());
  57582. }
  57583. $this->addRow($row);
  57584. $this->render();
  57585. return $this;
  57586. }
  57587. public function setRow($column, array $row)
  57588. {
  57589. $this->rows[$column] = $row;
  57590. return $this;
  57591. }
  57592. public function setHeaderTitle(?string $title): self
  57593. {
  57594. $this->headerTitle = $title;
  57595. return $this;
  57596. }
  57597. public function setFooterTitle(?string $title): self
  57598. {
  57599. $this->footerTitle = $title;
  57600. return $this;
  57601. }
  57602. public function setHorizontal(bool $horizontal = true): self
  57603. {
  57604. $this->horizontal = $horizontal;
  57605. return $this;
  57606. }
  57607. public function render()
  57608. {
  57609. $divider = new TableSeparator();
  57610. if ($this->horizontal) {
  57611. $rows = [];
  57612. foreach ($this->headers[0] ?? [] as $i => $header) {
  57613. $rows[$i] = [$header];
  57614. foreach ($this->rows as $row) {
  57615. if ($row instanceof TableSeparator) {
  57616. continue;
  57617. }
  57618. if (isset($row[$i])) {
  57619. $rows[$i][] = $row[$i];
  57620. } elseif ($rows[$i][0] instanceof TableCell && $rows[$i][0]->getColspan() >= 2) {
  57621. } else {
  57622. $rows[$i][] = null;
  57623. }
  57624. }
  57625. }
  57626. } else {
  57627. $rows = array_merge($this->headers, [$divider], $this->rows);
  57628. }
  57629. $this->calculateNumberOfColumns($rows);
  57630. $rows = $this->buildTableRows($rows);
  57631. $this->calculateColumnsWidth($rows);
  57632. $isHeader = !$this->horizontal;
  57633. $isFirstRow = $this->horizontal;
  57634. $hasTitle = (bool) $this->headerTitle;
  57635. foreach ($rows as $row) {
  57636. if ($divider === $row) {
  57637. $isHeader = false;
  57638. $isFirstRow = true;
  57639. continue;
  57640. }
  57641. if ($row instanceof TableSeparator) {
  57642. $this->renderRowSeparator();
  57643. continue;
  57644. }
  57645. if (!$row) {
  57646. continue;
  57647. }
  57648. if ($isHeader || $isFirstRow) {
  57649. $this->renderRowSeparator(
  57650. $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
  57651. $hasTitle ? $this->headerTitle : null,
  57652. $hasTitle ? $this->style->getHeaderTitleFormat() : null
  57653. );
  57654. $isFirstRow = false;
  57655. $hasTitle = false;
  57656. }
  57657. if ($this->horizontal) {
  57658. $this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
  57659. } else {
  57660. $this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
  57661. }
  57662. }
  57663. $this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());
  57664. $this->cleanup();
  57665. $this->rendered = true;
  57666. }
  57667. private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null)
  57668. {
  57669. if (0 === $count = $this->numberOfColumns) {
  57670. return;
  57671. }
  57672. $borders = $this->style->getBorderChars();
  57673. if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) {
  57674. return;
  57675. }
  57676. $crossings = $this->style->getCrossingChars();
  57677. if (self::SEPARATOR_MID === $type) {
  57678. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
  57679. } elseif (self::SEPARATOR_TOP === $type) {
  57680. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
  57681. } elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
  57682. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
  57683. } else {
  57684. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
  57685. }
  57686. $markup = $leftChar;
  57687. for ($column = 0; $column < $count; ++$column) {
  57688. $markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]);
  57689. $markup .= $column === $count - 1 ? $rightChar : $midChar;
  57690. }
  57691. if (null !== $title) {
  57692. $titleLength = Helper::width(Helper::removeDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title)));
  57693. $markupLength = Helper::width($markup);
  57694. if ($titleLength > $limit = $markupLength - 4) {
  57695. $titleLength = $limit;
  57696. $formatLength = Helper::width(Helper::removeDecoration($formatter, sprintf($titleFormat, '')));
  57697. $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
  57698. }
  57699. $titleStart = intdiv($markupLength - $titleLength, 2);
  57700. if (false === mb_detect_encoding($markup, null, true)) {
  57701. $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
  57702. } else {
  57703. $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength);
  57704. }
  57705. }
  57706. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  57707. }
  57708. private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
  57709. {
  57710. $borders = $this->style->getBorderChars();
  57711. return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]);
  57712. }
  57713. private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null)
  57714. {
  57715. $rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
  57716. $columns = $this->getRowColumns($row);
  57717. $last = \count($columns) - 1;
  57718. foreach ($columns as $i => $column) {
  57719. if ($firstCellFormat && 0 === $i) {
  57720. $rowContent .= $this->renderCell($row, $column, $firstCellFormat);
  57721. } else {
  57722. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  57723. }
  57724. $rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
  57725. }
  57726. $this->output->writeln($rowContent);
  57727. }
  57728. private function renderCell(array $row, int $column, string $cellFormat): string
  57729. {
  57730. $cell = $row[$column] ?? '';
  57731. $width = $this->effectiveColumnWidths[$column];
  57732. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  57733. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  57734. $width += $this->getColumnSeparatorWidth() + $this->effectiveColumnWidths[$nextColumn];
  57735. }
  57736. }
  57737. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  57738. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  57739. }
  57740. $style = $this->getColumnStyle($column);
  57741. if ($cell instanceof TableSeparator) {
  57742. return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
  57743. }
  57744. $width += Helper::length($cell) - Helper::length(Helper::removeDecoration($this->output->getFormatter(), $cell));
  57745. $content = sprintf($style->getCellRowContentFormat(), $cell);
  57746. $padType = $style->getPadType();
  57747. if ($cell instanceof TableCell && $cell->getStyle() instanceof TableCellStyle) {
  57748. $isNotStyledByTag = !preg_match('/^<(\w+|(\w+=[\w,]+;?)*)>.+<\/(\w+|(\w+=\w+;?)*)?>$/', $cell);
  57749. if ($isNotStyledByTag) {
  57750. $cellFormat = $cell->getStyle()->getCellFormat();
  57751. if (!\is_string($cellFormat)) {
  57752. $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';');
  57753. $cellFormat = '<'.$tag.'>%s</>';
  57754. }
  57755. if (strstr($content, '</>')) {
  57756. $content = str_replace('</>', '', $content);
  57757. $width -= 3;
  57758. }
  57759. if (strstr($content, '<fg=default;bg=default>')) {
  57760. $content = str_replace('<fg=default;bg=default>', '', $content);
  57761. $width -= \strlen('<fg=default;bg=default>');
  57762. }
  57763. }
  57764. $padType = $cell->getStyle()->getPadByAlign();
  57765. }
  57766. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $padType));
  57767. }
  57768. private function calculateNumberOfColumns(array $rows)
  57769. {
  57770. $columns = [0];
  57771. foreach ($rows as $row) {
  57772. if ($row instanceof TableSeparator) {
  57773. continue;
  57774. }
  57775. $columns[] = $this->getNumberOfColumns($row);
  57776. }
  57777. $this->numberOfColumns = max($columns);
  57778. }
  57779. private function buildTableRows(array $rows): TableRows
  57780. {
  57781. $formatter = $this->output->getFormatter();
  57782. $unmergedRows = [];
  57783. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  57784. $rows = $this->fillNextRows($rows, $rowKey);
  57785. foreach ($rows[$rowKey] as $column => $cell) {
  57786. $colspan = $cell instanceof TableCell ? $cell->getColspan() : 1;
  57787. if (isset($this->columnMaxWidths[$column]) && Helper::width(Helper::removeDecoration($formatter, $cell)) > $this->columnMaxWidths[$column]) {
  57788. $cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
  57789. }
  57790. if (!strstr($cell ?? '', "\n")) {
  57791. continue;
  57792. }
  57793. $escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
  57794. $cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
  57795. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  57796. foreach ($lines as $lineKey => $line) {
  57797. if ($colspan > 1) {
  57798. $line = new TableCell($line, ['colspan' => $colspan]);
  57799. }
  57800. if (0 === $lineKey) {
  57801. $rows[$rowKey][$column] = $line;
  57802. } else {
  57803. if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) {
  57804. $unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey);
  57805. }
  57806. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  57807. }
  57808. }
  57809. }
  57810. }
  57811. return new TableRows(function () use ($rows, $unmergedRows): \Traversable {
  57812. foreach ($rows as $rowKey => $row) {
  57813. yield $row instanceof TableSeparator ? $row : $this->fillCells($row);
  57814. if (isset($unmergedRows[$rowKey])) {
  57815. foreach ($unmergedRows[$rowKey] as $row) {
  57816. yield $row instanceof TableSeparator ? $row : $this->fillCells($row);
  57817. }
  57818. }
  57819. }
  57820. });
  57821. }
  57822. private function calculateRowCount(): int
  57823. {
  57824. $numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, [new TableSeparator()], $this->rows))));
  57825. if ($this->headers) {
  57826. ++$numberOfRows;
  57827. }
  57828. if (\count($this->rows) > 0) {
  57829. ++$numberOfRows;
  57830. }
  57831. return $numberOfRows;
  57832. }
  57833. private function fillNextRows(array $rows, int $line): array
  57834. {
  57835. $unmergedRows = [];
  57836. foreach ($rows[$line] as $column => $cell) {
  57837. if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
  57838. throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', get_debug_type($cell)));
  57839. }
  57840. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  57841. $nbLines = $cell->getRowspan() - 1;
  57842. $lines = [$cell];
  57843. if (strstr($cell, "\n")) {
  57844. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  57845. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  57846. $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
  57847. unset($lines[0]);
  57848. }
  57849. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
  57850. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  57851. $value = $lines[$unmergedRowKey - $line] ?? '';
  57852. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
  57853. if ($nbLines === $unmergedRowKey - $line) {
  57854. break;
  57855. }
  57856. }
  57857. }
  57858. }
  57859. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  57860. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  57861. foreach ($unmergedRow as $cellKey => $cell) {
  57862. array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]);
  57863. }
  57864. } else {
  57865. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  57866. foreach ($unmergedRow as $column => $cell) {
  57867. if (!empty($cell)) {
  57868. $row[$column] = $unmergedRow[$column];
  57869. }
  57870. }
  57871. array_splice($rows, $unmergedRowKey, 0, [$row]);
  57872. }
  57873. }
  57874. return $rows;
  57875. }
  57876. private function fillCells(iterable $row)
  57877. {
  57878. $newRow = [];
  57879. foreach ($row as $column => $cell) {
  57880. $newRow[] = $cell;
  57881. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  57882. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  57883. $newRow[] = '';
  57884. }
  57885. }
  57886. }
  57887. return $newRow ?: $row;
  57888. }
  57889. private function copyRow(array $rows, int $line): array
  57890. {
  57891. $row = $rows[$line];
  57892. foreach ($row as $cellKey => $cellValue) {
  57893. $row[$cellKey] = '';
  57894. if ($cellValue instanceof TableCell) {
  57895. $row[$cellKey] = new TableCell('', ['colspan' => $cellValue->getColspan()]);
  57896. }
  57897. }
  57898. return $row;
  57899. }
  57900. private function getNumberOfColumns(array $row): int
  57901. {
  57902. $columns = \count($row);
  57903. foreach ($row as $column) {
  57904. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  57905. }
  57906. return $columns;
  57907. }
  57908. private function getRowColumns(array $row): array
  57909. {
  57910. $columns = range(0, $this->numberOfColumns - 1);
  57911. foreach ($row as $cellKey => $cell) {
  57912. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  57913. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  57914. }
  57915. }
  57916. return $columns;
  57917. }
  57918. private function calculateColumnsWidth(iterable $rows)
  57919. {
  57920. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  57921. $lengths = [];
  57922. foreach ($rows as $row) {
  57923. if ($row instanceof TableSeparator) {
  57924. continue;
  57925. }
  57926. foreach ($row as $i => $cell) {
  57927. if ($cell instanceof TableCell) {
  57928. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  57929. $textLength = Helper::width($textContent);
  57930. if ($textLength > 0) {
  57931. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  57932. foreach ($contentColumns as $position => $content) {
  57933. $row[$i + $position] = $content;
  57934. }
  57935. }
  57936. }
  57937. }
  57938. $lengths[] = $this->getCellWidth($row, $column);
  57939. }
  57940. $this->effectiveColumnWidths[$column] = max($lengths) + Helper::width($this->style->getCellRowContentFormat()) - 2;
  57941. }
  57942. }
  57943. private function getColumnSeparatorWidth(): int
  57944. {
  57945. return Helper::width(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
  57946. }
  57947. private function getCellWidth(array $row, int $column): int
  57948. {
  57949. $cellWidth = 0;
  57950. if (isset($row[$column])) {
  57951. $cell = $row[$column];
  57952. $cellWidth = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $cell));
  57953. }
  57954. $columnWidth = $this->columnWidths[$column] ?? 0;
  57955. $cellWidth = max($cellWidth, $columnWidth);
  57956. return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
  57957. }
  57958. private function cleanup()
  57959. {
  57960. $this->effectiveColumnWidths = [];
  57961. $this->numberOfColumns = null;
  57962. }
  57963. private static function initStyles(): array
  57964. {
  57965. $borderless = new TableStyle();
  57966. $borderless
  57967. ->setHorizontalBorderChars('=')
  57968. ->setVerticalBorderChars(' ')
  57969. ->setDefaultCrossingChar(' ')
  57970. ;
  57971. $compact = new TableStyle();
  57972. $compact
  57973. ->setHorizontalBorderChars('')
  57974. ->setVerticalBorderChars(' ')
  57975. ->setDefaultCrossingChar('')
  57976. ->setCellRowContentFormat('%s')
  57977. ;
  57978. $styleGuide = new TableStyle();
  57979. $styleGuide
  57980. ->setHorizontalBorderChars('-')
  57981. ->setVerticalBorderChars(' ')
  57982. ->setDefaultCrossingChar(' ')
  57983. ->setCellHeaderFormat('%s')
  57984. ;
  57985. $box = (new TableStyle())
  57986. ->setHorizontalBorderChars('─')
  57987. ->setVerticalBorderChars('│')
  57988. ->setCrossingChars('┼', '┌', '┬', '�', '┤', '┘', '┴', '└', '├')
  57989. ;
  57990. $boxDouble = (new TableStyle())
  57991. ->setHorizontalBorderChars('�', '─')
  57992. ->setVerticalBorderChars('║', '│')
  57993. ->setCrossingChars('┼', '╔', '╤', '╗', '╢', '�', '╧', '╚', '╟', '╠', '╪', '╣')
  57994. ;
  57995. return [
  57996. 'default' => new TableStyle(),
  57997. 'borderless' => $borderless,
  57998. 'compact' => $compact,
  57999. 'symfony-style-guide' => $styleGuide,
  58000. 'box' => $box,
  58001. 'box-double' => $boxDouble,
  58002. ];
  58003. }
  58004. private function resolveStyle($name): TableStyle
  58005. {
  58006. if ($name instanceof TableStyle) {
  58007. return $name;
  58008. }
  58009. if (isset(self::$styles[$name])) {
  58010. return self::$styles[$name];
  58011. }
  58012. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  58013. }
  58014. }
  58015. <?php
  58016. namespace Symfony\Component\Console\Helper;
  58017. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58018. class TableCell
  58019. {
  58020. private $value;
  58021. private $options = [
  58022. 'rowspan' => 1,
  58023. 'colspan' => 1,
  58024. 'style' => null,
  58025. ];
  58026. public function __construct(string $value = '', array $options = [])
  58027. {
  58028. $this->value = $value;
  58029. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  58030. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  58031. }
  58032. if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) {
  58033. throw new InvalidArgumentException('The style option must be an instance of "TableCellStyle".');
  58034. }
  58035. $this->options = array_merge($this->options, $options);
  58036. }
  58037. public function __toString()
  58038. {
  58039. return $this->value;
  58040. }
  58041. public function getColspan()
  58042. {
  58043. return (int) $this->options['colspan'];
  58044. }
  58045. public function getRowspan()
  58046. {
  58047. return (int) $this->options['rowspan'];
  58048. }
  58049. public function getStyle(): ?TableCellStyle
  58050. {
  58051. return $this->options['style'];
  58052. }
  58053. }
  58054. <?php
  58055. namespace Symfony\Component\Console\Helper;
  58056. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58057. class TableCellStyle
  58058. {
  58059. public const DEFAULT_ALIGN = 'left';
  58060. private const TAG_OPTIONS = [
  58061. 'fg',
  58062. 'bg',
  58063. 'options',
  58064. ];
  58065. private const ALIGN_MAP = [
  58066. 'left' => \STR_PAD_RIGHT,
  58067. 'center' => \STR_PAD_BOTH,
  58068. 'right' => \STR_PAD_LEFT,
  58069. ];
  58070. private $options = [
  58071. 'fg' => 'default',
  58072. 'bg' => 'default',
  58073. 'options' => null,
  58074. 'align' => self::DEFAULT_ALIGN,
  58075. 'cellFormat' => null,
  58076. ];
  58077. public function __construct(array $options = [])
  58078. {
  58079. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  58080. throw new InvalidArgumentException(sprintf('The TableCellStyle does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  58081. }
  58082. if (isset($options['align']) && !\array_key_exists($options['align'], self::ALIGN_MAP)) {
  58083. throw new InvalidArgumentException(sprintf('Wrong align value. Value must be following: \'%s\'.', implode('\', \'', array_keys(self::ALIGN_MAP))));
  58084. }
  58085. $this->options = array_merge($this->options, $options);
  58086. }
  58087. public function getOptions(): array
  58088. {
  58089. return $this->options;
  58090. }
  58091. public function getTagOptions()
  58092. {
  58093. return array_filter(
  58094. $this->getOptions(),
  58095. function ($key) {
  58096. return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]);
  58097. },
  58098. \ARRAY_FILTER_USE_KEY
  58099. );
  58100. }
  58101. public function getPadByAlign()
  58102. {
  58103. return self::ALIGN_MAP[$this->getOptions()['align']];
  58104. }
  58105. public function getCellFormat(): ?string
  58106. {
  58107. return $this->getOptions()['cellFormat'];
  58108. }
  58109. }
  58110. <?php
  58111. namespace Symfony\Component\Console\Helper;
  58112. class TableRows implements \IteratorAggregate
  58113. {
  58114. private $generator;
  58115. public function __construct(\Closure $generator)
  58116. {
  58117. $this->generator = $generator;
  58118. }
  58119. public function getIterator(): \Traversable
  58120. {
  58121. return ($this->generator)();
  58122. }
  58123. }
  58124. <?php
  58125. namespace Symfony\Component\Console\Helper;
  58126. class TableSeparator extends TableCell
  58127. {
  58128. public function __construct(array $options = [])
  58129. {
  58130. parent::__construct('', $options);
  58131. }
  58132. }
  58133. <?php
  58134. namespace Symfony\Component\Console\Helper;
  58135. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58136. use Symfony\Component\Console\Exception\LogicException;
  58137. class TableStyle
  58138. {
  58139. private $paddingChar = ' ';
  58140. private $horizontalOutsideBorderChar = '-';
  58141. private $horizontalInsideBorderChar = '-';
  58142. private $verticalOutsideBorderChar = '|';
  58143. private $verticalInsideBorderChar = '|';
  58144. private $crossingChar = '+';
  58145. private $crossingTopRightChar = '+';
  58146. private $crossingTopMidChar = '+';
  58147. private $crossingTopLeftChar = '+';
  58148. private $crossingMidRightChar = '+';
  58149. private $crossingBottomRightChar = '+';
  58150. private $crossingBottomMidChar = '+';
  58151. private $crossingBottomLeftChar = '+';
  58152. private $crossingMidLeftChar = '+';
  58153. private $crossingTopLeftBottomChar = '+';
  58154. private $crossingTopMidBottomChar = '+';
  58155. private $crossingTopRightBottomChar = '+';
  58156. private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
  58157. private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
  58158. private $cellHeaderFormat = '<info>%s</info>';
  58159. private $cellRowFormat = '%s';
  58160. private $cellRowContentFormat = ' %s ';
  58161. private $borderFormat = '%s';
  58162. private $padType = \STR_PAD_RIGHT;
  58163. public function setPaddingChar(string $paddingChar)
  58164. {
  58165. if (!$paddingChar) {
  58166. throw new LogicException('The padding char must not be empty.');
  58167. }
  58168. $this->paddingChar = $paddingChar;
  58169. return $this;
  58170. }
  58171. public function getPaddingChar()
  58172. {
  58173. return $this->paddingChar;
  58174. }
  58175. public function setHorizontalBorderChars(string $outside, string $inside = null): self
  58176. {
  58177. $this->horizontalOutsideBorderChar = $outside;
  58178. $this->horizontalInsideBorderChar = $inside ?? $outside;
  58179. return $this;
  58180. }
  58181. public function setVerticalBorderChars(string $outside, string $inside = null): self
  58182. {
  58183. $this->verticalOutsideBorderChar = $outside;
  58184. $this->verticalInsideBorderChar = $inside ?? $outside;
  58185. return $this;
  58186. }
  58187. public function getBorderChars(): array
  58188. {
  58189. return [
  58190. $this->horizontalOutsideBorderChar,
  58191. $this->verticalOutsideBorderChar,
  58192. $this->horizontalInsideBorderChar,
  58193. $this->verticalInsideBorderChar,
  58194. ];
  58195. }
  58196. public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
  58197. {
  58198. $this->crossingChar = $cross;
  58199. $this->crossingTopLeftChar = $topLeft;
  58200. $this->crossingTopMidChar = $topMid;
  58201. $this->crossingTopRightChar = $topRight;
  58202. $this->crossingMidRightChar = $midRight;
  58203. $this->crossingBottomRightChar = $bottomRight;
  58204. $this->crossingBottomMidChar = $bottomMid;
  58205. $this->crossingBottomLeftChar = $bottomLeft;
  58206. $this->crossingMidLeftChar = $midLeft;
  58207. $this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
  58208. $this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
  58209. $this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
  58210. return $this;
  58211. }
  58212. public function setDefaultCrossingChar(string $char): self
  58213. {
  58214. return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
  58215. }
  58216. public function getCrossingChar()
  58217. {
  58218. return $this->crossingChar;
  58219. }
  58220. public function getCrossingChars(): array
  58221. {
  58222. return [
  58223. $this->crossingChar,
  58224. $this->crossingTopLeftChar,
  58225. $this->crossingTopMidChar,
  58226. $this->crossingTopRightChar,
  58227. $this->crossingMidRightChar,
  58228. $this->crossingBottomRightChar,
  58229. $this->crossingBottomMidChar,
  58230. $this->crossingBottomLeftChar,
  58231. $this->crossingMidLeftChar,
  58232. $this->crossingTopLeftBottomChar,
  58233. $this->crossingTopMidBottomChar,
  58234. $this->crossingTopRightBottomChar,
  58235. ];
  58236. }
  58237. public function setCellHeaderFormat(string $cellHeaderFormat)
  58238. {
  58239. $this->cellHeaderFormat = $cellHeaderFormat;
  58240. return $this;
  58241. }
  58242. public function getCellHeaderFormat()
  58243. {
  58244. return $this->cellHeaderFormat;
  58245. }
  58246. public function setCellRowFormat(string $cellRowFormat)
  58247. {
  58248. $this->cellRowFormat = $cellRowFormat;
  58249. return $this;
  58250. }
  58251. public function getCellRowFormat()
  58252. {
  58253. return $this->cellRowFormat;
  58254. }
  58255. public function setCellRowContentFormat(string $cellRowContentFormat)
  58256. {
  58257. $this->cellRowContentFormat = $cellRowContentFormat;
  58258. return $this;
  58259. }
  58260. public function getCellRowContentFormat()
  58261. {
  58262. return $this->cellRowContentFormat;
  58263. }
  58264. public function setBorderFormat(string $borderFormat)
  58265. {
  58266. $this->borderFormat = $borderFormat;
  58267. return $this;
  58268. }
  58269. public function getBorderFormat()
  58270. {
  58271. return $this->borderFormat;
  58272. }
  58273. public function setPadType(int $padType)
  58274. {
  58275. if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
  58276. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  58277. }
  58278. $this->padType = $padType;
  58279. return $this;
  58280. }
  58281. public function getPadType()
  58282. {
  58283. return $this->padType;
  58284. }
  58285. public function getHeaderTitleFormat(): string
  58286. {
  58287. return $this->headerTitleFormat;
  58288. }
  58289. public function setHeaderTitleFormat(string $format): self
  58290. {
  58291. $this->headerTitleFormat = $format;
  58292. return $this;
  58293. }
  58294. public function getFooterTitleFormat(): string
  58295. {
  58296. return $this->footerTitleFormat;
  58297. }
  58298. public function setFooterTitleFormat(string $format): self
  58299. {
  58300. $this->footerTitleFormat = $format;
  58301. return $this;
  58302. }
  58303. }
  58304. <?php
  58305. namespace Symfony\Component\Console\Input;
  58306. use Symfony\Component\Console\Exception\RuntimeException;
  58307. class ArgvInput extends Input
  58308. {
  58309. private $tokens;
  58310. private $parsed;
  58311. public function __construct(array $argv = null, InputDefinition $definition = null)
  58312. {
  58313. $argv = $argv ?? $_SERVER['argv'] ?? [];
  58314. array_shift($argv);
  58315. $this->tokens = $argv;
  58316. parent::__construct($definition);
  58317. }
  58318. protected function setTokens(array $tokens)
  58319. {
  58320. $this->tokens = $tokens;
  58321. }
  58322. protected function parse()
  58323. {
  58324. $parseOptions = true;
  58325. $this->parsed = $this->tokens;
  58326. while (null !== $token = array_shift($this->parsed)) {
  58327. $parseOptions = $this->parseToken($token, $parseOptions);
  58328. }
  58329. }
  58330. protected function parseToken(string $token, bool $parseOptions): bool
  58331. {
  58332. if ($parseOptions && '' == $token) {
  58333. $this->parseArgument($token);
  58334. } elseif ($parseOptions && '--' == $token) {
  58335. return false;
  58336. } elseif ($parseOptions && str_starts_with($token, '--')) {
  58337. $this->parseLongOption($token);
  58338. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  58339. $this->parseShortOption($token);
  58340. } else {
  58341. $this->parseArgument($token);
  58342. }
  58343. return $parseOptions;
  58344. }
  58345. private function parseShortOption(string $token)
  58346. {
  58347. $name = substr($token, 1);
  58348. if (\strlen($name) > 1) {
  58349. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  58350. $this->addShortOption($name[0], substr($name, 1));
  58351. } else {
  58352. $this->parseShortOptionSet($name);
  58353. }
  58354. } else {
  58355. $this->addShortOption($name, null);
  58356. }
  58357. }
  58358. private function parseShortOptionSet(string $name)
  58359. {
  58360. $len = \strlen($name);
  58361. for ($i = 0; $i < $len; ++$i) {
  58362. if (!$this->definition->hasShortcut($name[$i])) {
  58363. $encoding = mb_detect_encoding($name, null, true);
  58364. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  58365. }
  58366. $option = $this->definition->getOptionForShortcut($name[$i]);
  58367. if ($option->acceptValue()) {
  58368. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  58369. break;
  58370. } else {
  58371. $this->addLongOption($option->getName(), null);
  58372. }
  58373. }
  58374. }
  58375. private function parseLongOption(string $token)
  58376. {
  58377. $name = substr($token, 2);
  58378. if (false !== $pos = strpos($name, '=')) {
  58379. if ('' === $value = substr($name, $pos + 1)) {
  58380. array_unshift($this->parsed, $value);
  58381. }
  58382. $this->addLongOption(substr($name, 0, $pos), $value);
  58383. } else {
  58384. $this->addLongOption($name, null);
  58385. }
  58386. }
  58387. private function parseArgument(string $token)
  58388. {
  58389. $c = \count($this->arguments);
  58390. if ($this->definition->hasArgument($c)) {
  58391. $arg = $this->definition->getArgument($c);
  58392. $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
  58393. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  58394. $arg = $this->definition->getArgument($c - 1);
  58395. $this->arguments[$arg->getName()][] = $token;
  58396. } else {
  58397. $all = $this->definition->getArguments();
  58398. $symfonyCommandName = null;
  58399. if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) {
  58400. $symfonyCommandName = $this->arguments['command'] ?? null;
  58401. unset($all[$key]);
  58402. }
  58403. if (\count($all)) {
  58404. if ($symfonyCommandName) {
  58405. $message = sprintf('Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode('" "', array_keys($all)));
  58406. } else {
  58407. $message = sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)));
  58408. }
  58409. } elseif ($symfonyCommandName) {
  58410. $message = sprintf('No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token);
  58411. } else {
  58412. $message = sprintf('No arguments expected, got "%s".', $token);
  58413. }
  58414. throw new RuntimeException($message);
  58415. }
  58416. }
  58417. private function addShortOption(string $shortcut, $value)
  58418. {
  58419. if (!$this->definition->hasShortcut($shortcut)) {
  58420. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  58421. }
  58422. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  58423. }
  58424. private function addLongOption(string $name, $value)
  58425. {
  58426. if (!$this->definition->hasOption($name)) {
  58427. if (!$this->definition->hasNegation($name)) {
  58428. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  58429. }
  58430. $optionName = $this->definition->negationToName($name);
  58431. if (null !== $value) {
  58432. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  58433. }
  58434. $this->options[$optionName] = false;
  58435. return;
  58436. }
  58437. $option = $this->definition->getOption($name);
  58438. if (null !== $value && !$option->acceptValue()) {
  58439. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  58440. }
  58441. if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {
  58442. $next = array_shift($this->parsed);
  58443. if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) {
  58444. $value = $next;
  58445. } else {
  58446. array_unshift($this->parsed, $next);
  58447. }
  58448. }
  58449. if (null === $value) {
  58450. if ($option->isValueRequired()) {
  58451. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  58452. }
  58453. if (!$option->isArray() && !$option->isValueOptional()) {
  58454. $value = true;
  58455. }
  58456. }
  58457. if ($option->isArray()) {
  58458. $this->options[$name][] = $value;
  58459. } else {
  58460. $this->options[$name] = $value;
  58461. }
  58462. }
  58463. public function getFirstArgument()
  58464. {
  58465. $isOption = false;
  58466. foreach ($this->tokens as $i => $token) {
  58467. if ($token && '-' === $token[0]) {
  58468. if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
  58469. continue;
  58470. }
  58471. $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
  58472. if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {
  58473. } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
  58474. $isOption = true;
  58475. }
  58476. continue;
  58477. }
  58478. if ($isOption) {
  58479. $isOption = false;
  58480. continue;
  58481. }
  58482. return $token;
  58483. }
  58484. return null;
  58485. }
  58486. public function hasParameterOption($values, bool $onlyParams = false)
  58487. {
  58488. $values = (array) $values;
  58489. foreach ($this->tokens as $token) {
  58490. if ($onlyParams && '--' === $token) {
  58491. return false;
  58492. }
  58493. foreach ($values as $value) {
  58494. $leading = str_starts_with($value, '--') ? $value.'=' : $value;
  58495. if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
  58496. return true;
  58497. }
  58498. }
  58499. }
  58500. return false;
  58501. }
  58502. public function getParameterOption($values, $default = false, bool $onlyParams = false)
  58503. {
  58504. $values = (array) $values;
  58505. $tokens = $this->tokens;
  58506. while (0 < \count($tokens)) {
  58507. $token = array_shift($tokens);
  58508. if ($onlyParams && '--' === $token) {
  58509. return $default;
  58510. }
  58511. foreach ($values as $value) {
  58512. if ($token === $value) {
  58513. return array_shift($tokens);
  58514. }
  58515. $leading = str_starts_with($value, '--') ? $value.'=' : $value;
  58516. if ('' !== $leading && str_starts_with($token, $leading)) {
  58517. return substr($token, \strlen($leading));
  58518. }
  58519. }
  58520. }
  58521. return $default;
  58522. }
  58523. public function __toString()
  58524. {
  58525. $tokens = array_map(function ($token) {
  58526. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  58527. return $match[1].$this->escapeToken($match[2]);
  58528. }
  58529. if ($token && '-' !== $token[0]) {
  58530. return $this->escapeToken($token);
  58531. }
  58532. return $token;
  58533. }, $this->tokens);
  58534. return implode(' ', $tokens);
  58535. }
  58536. }
  58537. <?php
  58538. namespace Symfony\Component\Console\Input;
  58539. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58540. use Symfony\Component\Console\Exception\InvalidOptionException;
  58541. class ArrayInput extends Input
  58542. {
  58543. private $parameters;
  58544. public function __construct(array $parameters, InputDefinition $definition = null)
  58545. {
  58546. $this->parameters = $parameters;
  58547. parent::__construct($definition);
  58548. }
  58549. public function getFirstArgument()
  58550. {
  58551. foreach ($this->parameters as $param => $value) {
  58552. if ($param && \is_string($param) && '-' === $param[0]) {
  58553. continue;
  58554. }
  58555. return $value;
  58556. }
  58557. return null;
  58558. }
  58559. public function hasParameterOption($values, bool $onlyParams = false)
  58560. {
  58561. $values = (array) $values;
  58562. foreach ($this->parameters as $k => $v) {
  58563. if (!\is_int($k)) {
  58564. $v = $k;
  58565. }
  58566. if ($onlyParams && '--' === $v) {
  58567. return false;
  58568. }
  58569. if (\in_array($v, $values)) {
  58570. return true;
  58571. }
  58572. }
  58573. return false;
  58574. }
  58575. public function getParameterOption($values, $default = false, bool $onlyParams = false)
  58576. {
  58577. $values = (array) $values;
  58578. foreach ($this->parameters as $k => $v) {
  58579. if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) {
  58580. return $default;
  58581. }
  58582. if (\is_int($k)) {
  58583. if (\in_array($v, $values)) {
  58584. return true;
  58585. }
  58586. } elseif (\in_array($k, $values)) {
  58587. return $v;
  58588. }
  58589. }
  58590. return $default;
  58591. }
  58592. public function __toString()
  58593. {
  58594. $params = [];
  58595. foreach ($this->parameters as $param => $val) {
  58596. if ($param && \is_string($param) && '-' === $param[0]) {
  58597. $glue = ('-' === $param[1]) ? '=' : ' ';
  58598. if (\is_array($val)) {
  58599. foreach ($val as $v) {
  58600. $params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : '');
  58601. }
  58602. } else {
  58603. $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : '');
  58604. }
  58605. } else {
  58606. $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
  58607. }
  58608. }
  58609. return implode(' ', $params);
  58610. }
  58611. protected function parse()
  58612. {
  58613. foreach ($this->parameters as $key => $value) {
  58614. if ('--' === $key) {
  58615. return;
  58616. }
  58617. if (str_starts_with($key, '--')) {
  58618. $this->addLongOption(substr($key, 2), $value);
  58619. } elseif (str_starts_with($key, '-')) {
  58620. $this->addShortOption(substr($key, 1), $value);
  58621. } else {
  58622. $this->addArgument($key, $value);
  58623. }
  58624. }
  58625. }
  58626. private function addShortOption(string $shortcut, $value)
  58627. {
  58628. if (!$this->definition->hasShortcut($shortcut)) {
  58629. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  58630. }
  58631. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  58632. }
  58633. private function addLongOption(string $name, $value)
  58634. {
  58635. if (!$this->definition->hasOption($name)) {
  58636. if (!$this->definition->hasNegation($name)) {
  58637. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  58638. }
  58639. $optionName = $this->definition->negationToName($name);
  58640. $this->options[$optionName] = false;
  58641. return;
  58642. }
  58643. $option = $this->definition->getOption($name);
  58644. if (null === $value) {
  58645. if ($option->isValueRequired()) {
  58646. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  58647. }
  58648. if (!$option->isValueOptional()) {
  58649. $value = true;
  58650. }
  58651. }
  58652. $this->options[$name] = $value;
  58653. }
  58654. private function addArgument($name, $value)
  58655. {
  58656. if (!$this->definition->hasArgument($name)) {
  58657. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  58658. }
  58659. $this->arguments[$name] = $value;
  58660. }
  58661. }
  58662. <?php
  58663. namespace Symfony\Component\Console\Input;
  58664. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58665. use Symfony\Component\Console\Exception\RuntimeException;
  58666. abstract class Input implements InputInterface, StreamableInputInterface
  58667. {
  58668. protected $definition;
  58669. protected $stream;
  58670. protected $options = [];
  58671. protected $arguments = [];
  58672. protected $interactive = true;
  58673. public function __construct(InputDefinition $definition = null)
  58674. {
  58675. if (null === $definition) {
  58676. $this->definition = new InputDefinition();
  58677. } else {
  58678. $this->bind($definition);
  58679. $this->validate();
  58680. }
  58681. }
  58682. public function bind(InputDefinition $definition)
  58683. {
  58684. $this->arguments = [];
  58685. $this->options = [];
  58686. $this->definition = $definition;
  58687. $this->parse();
  58688. }
  58689. abstract protected function parse();
  58690. public function validate()
  58691. {
  58692. $definition = $this->definition;
  58693. $givenArguments = $this->arguments;
  58694. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  58695. return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  58696. });
  58697. if (\count($missingArguments) > 0) {
  58698. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  58699. }
  58700. }
  58701. public function isInteractive()
  58702. {
  58703. return $this->interactive;
  58704. }
  58705. public function setInteractive(bool $interactive)
  58706. {
  58707. $this->interactive = $interactive;
  58708. }
  58709. public function getArguments()
  58710. {
  58711. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  58712. }
  58713. public function getArgument(string $name)
  58714. {
  58715. if (!$this->definition->hasArgument($name)) {
  58716. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  58717. }
  58718. return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
  58719. }
  58720. public function setArgument(string $name, $value)
  58721. {
  58722. if (!$this->definition->hasArgument($name)) {
  58723. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  58724. }
  58725. $this->arguments[$name] = $value;
  58726. }
  58727. public function hasArgument(string $name)
  58728. {
  58729. return $this->definition->hasArgument($name);
  58730. }
  58731. public function getOptions()
  58732. {
  58733. return array_merge($this->definition->getOptionDefaults(), $this->options);
  58734. }
  58735. public function getOption(string $name)
  58736. {
  58737. if ($this->definition->hasNegation($name)) {
  58738. if (null === $value = $this->getOption($this->definition->negationToName($name))) {
  58739. return $value;
  58740. }
  58741. return !$value;
  58742. }
  58743. if (!$this->definition->hasOption($name)) {
  58744. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  58745. }
  58746. return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  58747. }
  58748. public function setOption(string $name, $value)
  58749. {
  58750. if ($this->definition->hasNegation($name)) {
  58751. $this->options[$this->definition->negationToName($name)] = !$value;
  58752. return;
  58753. } elseif (!$this->definition->hasOption($name)) {
  58754. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  58755. }
  58756. $this->options[$name] = $value;
  58757. }
  58758. public function hasOption(string $name)
  58759. {
  58760. return $this->definition->hasOption($name) || $this->definition->hasNegation($name);
  58761. }
  58762. public function escapeToken(string $token)
  58763. {
  58764. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  58765. }
  58766. public function setStream($stream)
  58767. {
  58768. $this->stream = $stream;
  58769. }
  58770. public function getStream()
  58771. {
  58772. return $this->stream;
  58773. }
  58774. }
  58775. <?php
  58776. namespace Symfony\Component\Console\Input;
  58777. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58778. use Symfony\Component\Console\Exception\LogicException;
  58779. class InputArgument
  58780. {
  58781. public const REQUIRED = 1;
  58782. public const OPTIONAL = 2;
  58783. public const IS_ARRAY = 4;
  58784. private $name;
  58785. private $mode;
  58786. private $default;
  58787. private $description;
  58788. public function __construct(string $name, int $mode = null, string $description = '', $default = null)
  58789. {
  58790. if (null === $mode) {
  58791. $mode = self::OPTIONAL;
  58792. } elseif ($mode > 7 || $mode < 1) {
  58793. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  58794. }
  58795. $this->name = $name;
  58796. $this->mode = $mode;
  58797. $this->description = $description;
  58798. $this->setDefault($default);
  58799. }
  58800. public function getName()
  58801. {
  58802. return $this->name;
  58803. }
  58804. public function isRequired()
  58805. {
  58806. return self::REQUIRED === (self::REQUIRED & $this->mode);
  58807. }
  58808. public function isArray()
  58809. {
  58810. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  58811. }
  58812. public function setDefault($default = null)
  58813. {
  58814. if (self::REQUIRED === $this->mode && null !== $default) {
  58815. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  58816. }
  58817. if ($this->isArray()) {
  58818. if (null === $default) {
  58819. $default = [];
  58820. } elseif (!\is_array($default)) {
  58821. throw new LogicException('A default value for an array argument must be an array.');
  58822. }
  58823. }
  58824. $this->default = $default;
  58825. }
  58826. public function getDefault()
  58827. {
  58828. return $this->default;
  58829. }
  58830. public function getDescription()
  58831. {
  58832. return $this->description;
  58833. }
  58834. }
  58835. <?php
  58836. namespace Symfony\Component\Console\Input;
  58837. interface InputAwareInterface
  58838. {
  58839. public function setInput(InputInterface $input);
  58840. }
  58841. <?php
  58842. namespace Symfony\Component\Console\Input;
  58843. use Symfony\Component\Console\Exception\InvalidArgumentException;
  58844. use Symfony\Component\Console\Exception\LogicException;
  58845. class InputDefinition
  58846. {
  58847. private $arguments;
  58848. private $requiredCount;
  58849. private $lastArrayArgument;
  58850. private $lastOptionalArgument;
  58851. private $options;
  58852. private $negations;
  58853. private $shortcuts;
  58854. public function __construct(array $definition = [])
  58855. {
  58856. $this->setDefinition($definition);
  58857. }
  58858. public function setDefinition(array $definition)
  58859. {
  58860. $arguments = [];
  58861. $options = [];
  58862. foreach ($definition as $item) {
  58863. if ($item instanceof InputOption) {
  58864. $options[] = $item;
  58865. } else {
  58866. $arguments[] = $item;
  58867. }
  58868. }
  58869. $this->setArguments($arguments);
  58870. $this->setOptions($options);
  58871. }
  58872. public function setArguments(array $arguments = [])
  58873. {
  58874. $this->arguments = [];
  58875. $this->requiredCount = 0;
  58876. $this->lastOptionalArgument = null;
  58877. $this->lastArrayArgument = null;
  58878. $this->addArguments($arguments);
  58879. }
  58880. public function addArguments(?array $arguments = [])
  58881. {
  58882. if (null !== $arguments) {
  58883. foreach ($arguments as $argument) {
  58884. $this->addArgument($argument);
  58885. }
  58886. }
  58887. }
  58888. public function addArgument(InputArgument $argument)
  58889. {
  58890. if (isset($this->arguments[$argument->getName()])) {
  58891. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  58892. }
  58893. if (null !== $this->lastArrayArgument) {
  58894. throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
  58895. }
  58896. if ($argument->isRequired() && null !== $this->lastOptionalArgument) {
  58897. throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
  58898. }
  58899. if ($argument->isArray()) {
  58900. $this->lastArrayArgument = $argument;
  58901. }
  58902. if ($argument->isRequired()) {
  58903. ++$this->requiredCount;
  58904. } else {
  58905. $this->lastOptionalArgument = $argument;
  58906. }
  58907. $this->arguments[$argument->getName()] = $argument;
  58908. }
  58909. public function getArgument($name)
  58910. {
  58911. if (!$this->hasArgument($name)) {
  58912. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  58913. }
  58914. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  58915. return $arguments[$name];
  58916. }
  58917. public function hasArgument($name)
  58918. {
  58919. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  58920. return isset($arguments[$name]);
  58921. }
  58922. public function getArguments()
  58923. {
  58924. return $this->arguments;
  58925. }
  58926. public function getArgumentCount()
  58927. {
  58928. return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
  58929. }
  58930. public function getArgumentRequiredCount()
  58931. {
  58932. return $this->requiredCount;
  58933. }
  58934. public function getArgumentDefaults()
  58935. {
  58936. $values = [];
  58937. foreach ($this->arguments as $argument) {
  58938. $values[$argument->getName()] = $argument->getDefault();
  58939. }
  58940. return $values;
  58941. }
  58942. public function setOptions(array $options = [])
  58943. {
  58944. $this->options = [];
  58945. $this->shortcuts = [];
  58946. $this->negations = [];
  58947. $this->addOptions($options);
  58948. }
  58949. public function addOptions(array $options = [])
  58950. {
  58951. foreach ($options as $option) {
  58952. $this->addOption($option);
  58953. }
  58954. }
  58955. public function addOption(InputOption $option)
  58956. {
  58957. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  58958. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  58959. }
  58960. if (isset($this->negations[$option->getName()])) {
  58961. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  58962. }
  58963. if ($option->getShortcut()) {
  58964. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  58965. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  58966. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  58967. }
  58968. }
  58969. }
  58970. $this->options[$option->getName()] = $option;
  58971. if ($option->getShortcut()) {
  58972. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  58973. $this->shortcuts[$shortcut] = $option->getName();
  58974. }
  58975. }
  58976. if ($option->isNegatable()) {
  58977. $negatedName = 'no-'.$option->getName();
  58978. if (isset($this->options[$negatedName])) {
  58979. throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
  58980. }
  58981. $this->negations[$negatedName] = $option->getName();
  58982. }
  58983. }
  58984. public function getOption(string $name)
  58985. {
  58986. if (!$this->hasOption($name)) {
  58987. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  58988. }
  58989. return $this->options[$name];
  58990. }
  58991. public function hasOption(string $name)
  58992. {
  58993. return isset($this->options[$name]);
  58994. }
  58995. public function getOptions()
  58996. {
  58997. return $this->options;
  58998. }
  58999. public function hasShortcut(string $name)
  59000. {
  59001. return isset($this->shortcuts[$name]);
  59002. }
  59003. public function hasNegation(string $name): bool
  59004. {
  59005. return isset($this->negations[$name]);
  59006. }
  59007. public function getOptionForShortcut(string $shortcut)
  59008. {
  59009. return $this->getOption($this->shortcutToName($shortcut));
  59010. }
  59011. public function getOptionDefaults()
  59012. {
  59013. $values = [];
  59014. foreach ($this->options as $option) {
  59015. $values[$option->getName()] = $option->getDefault();
  59016. }
  59017. return $values;
  59018. }
  59019. public function shortcutToName(string $shortcut): string
  59020. {
  59021. if (!isset($this->shortcuts[$shortcut])) {
  59022. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  59023. }
  59024. return $this->shortcuts[$shortcut];
  59025. }
  59026. public function negationToName(string $negation): string
  59027. {
  59028. if (!isset($this->negations[$negation])) {
  59029. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
  59030. }
  59031. return $this->negations[$negation];
  59032. }
  59033. public function getSynopsis(bool $short = false)
  59034. {
  59035. $elements = [];
  59036. if ($short && $this->getOptions()) {
  59037. $elements[] = '[options]';
  59038. } elseif (!$short) {
  59039. foreach ($this->getOptions() as $option) {
  59040. $value = '';
  59041. if ($option->acceptValue()) {
  59042. $value = sprintf(
  59043. ' %s%s%s',
  59044. $option->isValueOptional() ? '[' : '',
  59045. strtoupper($option->getName()),
  59046. $option->isValueOptional() ? ']' : ''
  59047. );
  59048. }
  59049. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  59050. $negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
  59051. $elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
  59052. }
  59053. }
  59054. if (\count($elements) && $this->getArguments()) {
  59055. $elements[] = '[--]';
  59056. }
  59057. $tail = '';
  59058. foreach ($this->getArguments() as $argument) {
  59059. $element = '<'.$argument->getName().'>';
  59060. if ($argument->isArray()) {
  59061. $element .= '...';
  59062. }
  59063. if (!$argument->isRequired()) {
  59064. $element = '['.$element;
  59065. $tail .= ']';
  59066. }
  59067. $elements[] = $element;
  59068. }
  59069. return implode(' ', $elements).$tail;
  59070. }
  59071. }
  59072. <?php
  59073. namespace Symfony\Component\Console\Input;
  59074. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59075. use Symfony\Component\Console\Exception\RuntimeException;
  59076. interface InputInterface
  59077. {
  59078. public function getFirstArgument();
  59079. public function hasParameterOption($values, bool $onlyParams = false);
  59080. public function getParameterOption($values, $default = false, bool $onlyParams = false);
  59081. public function bind(InputDefinition $definition);
  59082. public function validate();
  59083. public function getArguments();
  59084. public function getArgument(string $name);
  59085. public function setArgument(string $name, $value);
  59086. public function hasArgument(string $name);
  59087. public function getOptions();
  59088. public function getOption(string $name);
  59089. public function setOption(string $name, $value);
  59090. public function hasOption(string $name);
  59091. public function isInteractive();
  59092. public function setInteractive(bool $interactive);
  59093. }
  59094. <?php
  59095. namespace Symfony\Component\Console\Input;
  59096. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59097. use Symfony\Component\Console\Exception\LogicException;
  59098. class InputOption
  59099. {
  59100. public const VALUE_NONE = 1;
  59101. public const VALUE_REQUIRED = 2;
  59102. public const VALUE_OPTIONAL = 4;
  59103. public const VALUE_IS_ARRAY = 8;
  59104. public const VALUE_NEGATABLE = 16;
  59105. private $name;
  59106. private $shortcut;
  59107. private $mode;
  59108. private $default;
  59109. private $description;
  59110. public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
  59111. {
  59112. if (str_starts_with($name, '--')) {
  59113. $name = substr($name, 2);
  59114. }
  59115. if (empty($name)) {
  59116. throw new InvalidArgumentException('An option name cannot be empty.');
  59117. }
  59118. if (empty($shortcut)) {
  59119. $shortcut = null;
  59120. }
  59121. if (null !== $shortcut) {
  59122. if (\is_array($shortcut)) {
  59123. $shortcut = implode('|', $shortcut);
  59124. }
  59125. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  59126. $shortcuts = array_filter($shortcuts);
  59127. $shortcut = implode('|', $shortcuts);
  59128. if (empty($shortcut)) {
  59129. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  59130. }
  59131. }
  59132. if (null === $mode) {
  59133. $mode = self::VALUE_NONE;
  59134. } elseif ($mode >= (self::VALUE_NEGATABLE << 1) || $mode < 1) {
  59135. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  59136. }
  59137. $this->name = $name;
  59138. $this->shortcut = $shortcut;
  59139. $this->mode = $mode;
  59140. $this->description = $description;
  59141. if ($this->isArray() && !$this->acceptValue()) {
  59142. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  59143. }
  59144. if ($this->isNegatable() && $this->acceptValue()) {
  59145. throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
  59146. }
  59147. $this->setDefault($default);
  59148. }
  59149. public function getShortcut()
  59150. {
  59151. return $this->shortcut;
  59152. }
  59153. public function getName()
  59154. {
  59155. return $this->name;
  59156. }
  59157. public function acceptValue()
  59158. {
  59159. return $this->isValueRequired() || $this->isValueOptional();
  59160. }
  59161. public function isValueRequired()
  59162. {
  59163. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  59164. }
  59165. public function isValueOptional()
  59166. {
  59167. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  59168. }
  59169. public function isArray()
  59170. {
  59171. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  59172. }
  59173. public function isNegatable(): bool
  59174. {
  59175. return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
  59176. }
  59177. public function setDefault($default = null)
  59178. {
  59179. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  59180. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  59181. }
  59182. if ($this->isArray()) {
  59183. if (null === $default) {
  59184. $default = [];
  59185. } elseif (!\is_array($default)) {
  59186. throw new LogicException('A default value for an array option must be an array.');
  59187. }
  59188. }
  59189. $this->default = $this->acceptValue() || $this->isNegatable() ? $default : false;
  59190. }
  59191. public function getDefault()
  59192. {
  59193. return $this->default;
  59194. }
  59195. public function getDescription()
  59196. {
  59197. return $this->description;
  59198. }
  59199. public function equals(self $option)
  59200. {
  59201. return $option->getName() === $this->getName()
  59202. && $option->getShortcut() === $this->getShortcut()
  59203. && $option->getDefault() === $this->getDefault()
  59204. && $option->isNegatable() === $this->isNegatable()
  59205. && $option->isArray() === $this->isArray()
  59206. && $option->isValueRequired() === $this->isValueRequired()
  59207. && $option->isValueOptional() === $this->isValueOptional()
  59208. ;
  59209. }
  59210. }
  59211. <?php
  59212. namespace Symfony\Component\Console\Input;
  59213. interface StreamableInputInterface extends InputInterface
  59214. {
  59215. public function setStream($stream);
  59216. public function getStream();
  59217. }
  59218. <?php
  59219. namespace Symfony\Component\Console\Input;
  59220. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59221. class StringInput extends ArgvInput
  59222. {
  59223. public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  59224. public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
  59225. public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  59226. public function __construct(string $input)
  59227. {
  59228. parent::__construct([]);
  59229. $this->setTokens($this->tokenize($input));
  59230. }
  59231. private function tokenize(string $input): array
  59232. {
  59233. $tokens = [];
  59234. $length = \strlen($input);
  59235. $cursor = 0;
  59236. $token = null;
  59237. while ($cursor < $length) {
  59238. if ('\\' === $input[$cursor]) {
  59239. $token .= $input[++$cursor] ?? '';
  59240. ++$cursor;
  59241. continue;
  59242. }
  59243. if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
  59244. if (null !== $token) {
  59245. $tokens[] = $token;
  59246. $token = null;
  59247. }
  59248. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
  59249. $token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
  59250. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
  59251. $token .= stripcslashes(substr($match[0], 1, -1));
  59252. } elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
  59253. $token .= $match[1];
  59254. } else {
  59255. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
  59256. }
  59257. $cursor += \strlen($match[0]);
  59258. }
  59259. if (null !== $token) {
  59260. $tokens[] = $token;
  59261. }
  59262. return $tokens;
  59263. }
  59264. }
  59265. Copyright (c) 2004-2022 Fabien Potencier
  59266. Permission is hereby granted, free of charge, to any person obtaining a copy
  59267. of this software and associated documentation files (the "Software"), to deal
  59268. in the Software without restriction, including without limitation the rights
  59269. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  59270. copies of the Software, and to permit persons to whom the Software is furnished
  59271. to do so, subject to the following conditions:
  59272. The above copyright notice and this permission notice shall be included in all
  59273. copies or substantial portions of the Software.
  59274. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  59275. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  59276. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  59277. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  59278. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  59279. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  59280. THE SOFTWARE.
  59281. <?php
  59282. namespace Symfony\Component\Console\Logger;
  59283. use Psr\Log\AbstractLogger;
  59284. use Psr\Log\InvalidArgumentException;
  59285. use Psr\Log\LogLevel;
  59286. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  59287. use Symfony\Component\Console\Output\OutputInterface;
  59288. class ConsoleLogger extends AbstractLogger
  59289. {
  59290. public const INFO = 'info';
  59291. public const ERROR = 'error';
  59292. private $output;
  59293. private $verbosityLevelMap = [
  59294. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  59295. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  59296. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  59297. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  59298. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  59299. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  59300. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  59301. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  59302. ];
  59303. private $formatLevelMap = [
  59304. LogLevel::EMERGENCY => self::ERROR,
  59305. LogLevel::ALERT => self::ERROR,
  59306. LogLevel::CRITICAL => self::ERROR,
  59307. LogLevel::ERROR => self::ERROR,
  59308. LogLevel::WARNING => self::INFO,
  59309. LogLevel::NOTICE => self::INFO,
  59310. LogLevel::INFO => self::INFO,
  59311. LogLevel::DEBUG => self::INFO,
  59312. ];
  59313. private $errored = false;
  59314. public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
  59315. {
  59316. $this->output = $output;
  59317. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  59318. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  59319. }
  59320. public function log($level, $message, array $context = [])
  59321. {
  59322. if (!isset($this->verbosityLevelMap[$level])) {
  59323. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  59324. }
  59325. $output = $this->output;
  59326. if (self::ERROR === $this->formatLevelMap[$level]) {
  59327. if ($this->output instanceof ConsoleOutputInterface) {
  59328. $output = $output->getErrorOutput();
  59329. }
  59330. $this->errored = true;
  59331. }
  59332. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  59333. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]);
  59334. }
  59335. }
  59336. public function hasErrored()
  59337. {
  59338. return $this->errored;
  59339. }
  59340. private function interpolate(string $message, array $context): string
  59341. {
  59342. if (!str_contains($message, '{')) {
  59343. return $message;
  59344. }
  59345. $replacements = [];
  59346. foreach ($context as $key => $val) {
  59347. if (null === $val || is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) {
  59348. $replacements["{{$key}}"] = $val;
  59349. } elseif ($val instanceof \DateTimeInterface) {
  59350. $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
  59351. } elseif (\is_object($val)) {
  59352. $replacements["{{$key}}"] = '[object '.\get_class($val).']';
  59353. } else {
  59354. $replacements["{{$key}}"] = '['.\gettype($val).']';
  59355. }
  59356. }
  59357. return strtr($message, $replacements);
  59358. }
  59359. }
  59360. <?php
  59361. namespace Symfony\Component\Console\Output;
  59362. class BufferedOutput extends Output
  59363. {
  59364. private $buffer = '';
  59365. public function fetch()
  59366. {
  59367. $content = $this->buffer;
  59368. $this->buffer = '';
  59369. return $content;
  59370. }
  59371. protected function doWrite(string $message, bool $newline)
  59372. {
  59373. $this->buffer .= $message;
  59374. if ($newline) {
  59375. $this->buffer .= \PHP_EOL;
  59376. }
  59377. }
  59378. }
  59379. <?php
  59380. namespace Symfony\Component\Console\Output;
  59381. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59382. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  59383. {
  59384. private $stderr;
  59385. private $consoleSectionOutputs = [];
  59386. public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
  59387. {
  59388. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  59389. if (null === $formatter) {
  59390. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
  59391. return;
  59392. }
  59393. $actualDecorated = $this->isDecorated();
  59394. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  59395. if (null === $decorated) {
  59396. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  59397. }
  59398. }
  59399. public function section(): ConsoleSectionOutput
  59400. {
  59401. return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
  59402. }
  59403. public function setDecorated(bool $decorated)
  59404. {
  59405. parent::setDecorated($decorated);
  59406. $this->stderr->setDecorated($decorated);
  59407. }
  59408. public function setFormatter(OutputFormatterInterface $formatter)
  59409. {
  59410. parent::setFormatter($formatter);
  59411. $this->stderr->setFormatter($formatter);
  59412. }
  59413. public function setVerbosity(int $level)
  59414. {
  59415. parent::setVerbosity($level);
  59416. $this->stderr->setVerbosity($level);
  59417. }
  59418. public function getErrorOutput()
  59419. {
  59420. return $this->stderr;
  59421. }
  59422. public function setErrorOutput(OutputInterface $error)
  59423. {
  59424. $this->stderr = $error;
  59425. }
  59426. protected function hasStdoutSupport()
  59427. {
  59428. return false === $this->isRunningOS400();
  59429. }
  59430. protected function hasStderrSupport()
  59431. {
  59432. return false === $this->isRunningOS400();
  59433. }
  59434. private function isRunningOS400(): bool
  59435. {
  59436. $checks = [
  59437. \function_exists('php_uname') ? php_uname('s') : '',
  59438. getenv('OSTYPE'),
  59439. \PHP_OS,
  59440. ];
  59441. return false !== stripos(implode(';', $checks), 'OS400');
  59442. }
  59443. private function openOutputStream()
  59444. {
  59445. if (!$this->hasStdoutSupport()) {
  59446. return fopen('php://output', 'w');
  59447. }
  59448. return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w'));
  59449. }
  59450. private function openErrorStream()
  59451. {
  59452. if (!$this->hasStderrSupport()) {
  59453. return fopen('php://output', 'w');
  59454. }
  59455. return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w'));
  59456. }
  59457. }
  59458. <?php
  59459. namespace Symfony\Component\Console\Output;
  59460. interface ConsoleOutputInterface extends OutputInterface
  59461. {
  59462. public function getErrorOutput();
  59463. public function setErrorOutput(OutputInterface $error);
  59464. public function section(): ConsoleSectionOutput;
  59465. }
  59466. <?php
  59467. namespace Symfony\Component\Console\Output;
  59468. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59469. use Symfony\Component\Console\Helper\Helper;
  59470. use Symfony\Component\Console\Terminal;
  59471. class ConsoleSectionOutput extends StreamOutput
  59472. {
  59473. private $content = [];
  59474. private $lines = 0;
  59475. private $sections;
  59476. private $terminal;
  59477. public function __construct($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
  59478. {
  59479. parent::__construct($stream, $verbosity, $decorated, $formatter);
  59480. array_unshift($sections, $this);
  59481. $this->sections = &$sections;
  59482. $this->terminal = new Terminal();
  59483. }
  59484. public function clear(int $lines = null)
  59485. {
  59486. if (empty($this->content) || !$this->isDecorated()) {
  59487. return;
  59488. }
  59489. if ($lines) {
  59490. array_splice($this->content, -($lines * 2));
  59491. } else {
  59492. $lines = $this->lines;
  59493. $this->content = [];
  59494. }
  59495. $this->lines -= $lines;
  59496. parent::doWrite($this->popStreamContentUntilCurrentSection($lines), false);
  59497. }
  59498. public function overwrite($message)
  59499. {
  59500. $this->clear();
  59501. $this->writeln($message);
  59502. }
  59503. public function getContent(): string
  59504. {
  59505. return implode('', $this->content);
  59506. }
  59507. public function addContent(string $input)
  59508. {
  59509. foreach (explode(\PHP_EOL, $input) as $lineContent) {
  59510. $this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
  59511. $this->content[] = $lineContent;
  59512. $this->content[] = \PHP_EOL;
  59513. }
  59514. }
  59515. protected function doWrite(string $message, bool $newline)
  59516. {
  59517. if (!$this->isDecorated()) {
  59518. parent::doWrite($message, $newline);
  59519. return;
  59520. }
  59521. $erasedContent = $this->popStreamContentUntilCurrentSection();
  59522. $this->addContent($message);
  59523. parent::doWrite($message, true);
  59524. parent::doWrite($erasedContent, false);
  59525. }
  59526. private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
  59527. {
  59528. $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
  59529. $erasedContent = [];
  59530. foreach ($this->sections as $section) {
  59531. if ($section === $this) {
  59532. break;
  59533. }
  59534. $numberOfLinesToClear += $section->lines;
  59535. $erasedContent[] = $section->getContent();
  59536. }
  59537. if ($numberOfLinesToClear > 0) {
  59538. parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
  59539. parent::doWrite("\x1b[0J", false);
  59540. }
  59541. return implode('', array_reverse($erasedContent));
  59542. }
  59543. private function getDisplayLength(string $text): int
  59544. {
  59545. return Helper::width(Helper::removeDecoration($this->getFormatter(), str_replace("\t", ' ', $text)));
  59546. }
  59547. }
  59548. <?php
  59549. namespace Symfony\Component\Console\Output;
  59550. use Symfony\Component\Console\Formatter\NullOutputFormatter;
  59551. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59552. class NullOutput implements OutputInterface
  59553. {
  59554. private $formatter;
  59555. public function setFormatter(OutputFormatterInterface $formatter)
  59556. {
  59557. }
  59558. public function getFormatter()
  59559. {
  59560. if ($this->formatter) {
  59561. return $this->formatter;
  59562. }
  59563. return $this->formatter = new NullOutputFormatter();
  59564. }
  59565. public function setDecorated(bool $decorated)
  59566. {
  59567. }
  59568. public function isDecorated()
  59569. {
  59570. return false;
  59571. }
  59572. public function setVerbosity(int $level)
  59573. {
  59574. }
  59575. public function getVerbosity()
  59576. {
  59577. return self::VERBOSITY_QUIET;
  59578. }
  59579. public function isQuiet()
  59580. {
  59581. return true;
  59582. }
  59583. public function isVerbose()
  59584. {
  59585. return false;
  59586. }
  59587. public function isVeryVerbose()
  59588. {
  59589. return false;
  59590. }
  59591. public function isDebug()
  59592. {
  59593. return false;
  59594. }
  59595. public function writeln($messages, int $options = self::OUTPUT_NORMAL)
  59596. {
  59597. }
  59598. public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
  59599. {
  59600. }
  59601. }
  59602. <?php
  59603. namespace Symfony\Component\Console\Output;
  59604. use Symfony\Component\Console\Formatter\OutputFormatter;
  59605. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59606. abstract class Output implements OutputInterface
  59607. {
  59608. private $verbosity;
  59609. private $formatter;
  59610. public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
  59611. {
  59612. $this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL;
  59613. $this->formatter = $formatter ?? new OutputFormatter();
  59614. $this->formatter->setDecorated($decorated);
  59615. }
  59616. public function setFormatter(OutputFormatterInterface $formatter)
  59617. {
  59618. $this->formatter = $formatter;
  59619. }
  59620. public function getFormatter()
  59621. {
  59622. return $this->formatter;
  59623. }
  59624. public function setDecorated(bool $decorated)
  59625. {
  59626. $this->formatter->setDecorated($decorated);
  59627. }
  59628. public function isDecorated()
  59629. {
  59630. return $this->formatter->isDecorated();
  59631. }
  59632. public function setVerbosity(int $level)
  59633. {
  59634. $this->verbosity = $level;
  59635. }
  59636. public function getVerbosity()
  59637. {
  59638. return $this->verbosity;
  59639. }
  59640. public function isQuiet()
  59641. {
  59642. return self::VERBOSITY_QUIET === $this->verbosity;
  59643. }
  59644. public function isVerbose()
  59645. {
  59646. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  59647. }
  59648. public function isVeryVerbose()
  59649. {
  59650. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  59651. }
  59652. public function isDebug()
  59653. {
  59654. return self::VERBOSITY_DEBUG <= $this->verbosity;
  59655. }
  59656. public function writeln($messages, int $options = self::OUTPUT_NORMAL)
  59657. {
  59658. $this->write($messages, true, $options);
  59659. }
  59660. public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
  59661. {
  59662. if (!is_iterable($messages)) {
  59663. $messages = [$messages];
  59664. }
  59665. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  59666. $type = $types & $options ?: self::OUTPUT_NORMAL;
  59667. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  59668. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  59669. if ($verbosity > $this->getVerbosity()) {
  59670. return;
  59671. }
  59672. foreach ($messages as $message) {
  59673. switch ($type) {
  59674. case OutputInterface::OUTPUT_NORMAL:
  59675. $message = $this->formatter->format($message);
  59676. break;
  59677. case OutputInterface::OUTPUT_RAW:
  59678. break;
  59679. case OutputInterface::OUTPUT_PLAIN:
  59680. $message = strip_tags($this->formatter->format($message));
  59681. break;
  59682. }
  59683. $this->doWrite($message ?? '', $newline);
  59684. }
  59685. }
  59686. abstract protected function doWrite(string $message, bool $newline);
  59687. }
  59688. <?php
  59689. namespace Symfony\Component\Console\Output;
  59690. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59691. interface OutputInterface
  59692. {
  59693. public const VERBOSITY_QUIET = 16;
  59694. public const VERBOSITY_NORMAL = 32;
  59695. public const VERBOSITY_VERBOSE = 64;
  59696. public const VERBOSITY_VERY_VERBOSE = 128;
  59697. public const VERBOSITY_DEBUG = 256;
  59698. public const OUTPUT_NORMAL = 1;
  59699. public const OUTPUT_RAW = 2;
  59700. public const OUTPUT_PLAIN = 4;
  59701. public function write($messages, bool $newline = false, int $options = 0);
  59702. public function writeln($messages, int $options = 0);
  59703. public function setVerbosity(int $level);
  59704. public function getVerbosity();
  59705. public function isQuiet();
  59706. public function isVerbose();
  59707. public function isVeryVerbose();
  59708. public function isDebug();
  59709. public function setDecorated(bool $decorated);
  59710. public function isDecorated();
  59711. public function setFormatter(OutputFormatterInterface $formatter);
  59712. public function getFormatter();
  59713. }
  59714. <?php
  59715. namespace Symfony\Component\Console\Output;
  59716. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59717. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59718. class StreamOutput extends Output
  59719. {
  59720. private $stream;
  59721. public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
  59722. {
  59723. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  59724. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  59725. }
  59726. $this->stream = $stream;
  59727. if (null === $decorated) {
  59728. $decorated = $this->hasColorSupport();
  59729. }
  59730. parent::__construct($verbosity, $decorated, $formatter);
  59731. }
  59732. public function getStream()
  59733. {
  59734. return $this->stream;
  59735. }
  59736. protected function doWrite(string $message, bool $newline)
  59737. {
  59738. if ($newline) {
  59739. $message .= \PHP_EOL;
  59740. }
  59741. @fwrite($this->stream, $message);
  59742. fflush($this->stream);
  59743. }
  59744. protected function hasColorSupport()
  59745. {
  59746. if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
  59747. return false;
  59748. }
  59749. if ('Hyper' === getenv('TERM_PROGRAM')) {
  59750. return true;
  59751. }
  59752. if (\DIRECTORY_SEPARATOR === '\\') {
  59753. return (\function_exists('sapi_windows_vt100_support')
  59754. && @sapi_windows_vt100_support($this->stream))
  59755. || false !== getenv('ANSICON')
  59756. || 'ON' === getenv('ConEmuANSI')
  59757. || 'xterm' === getenv('TERM');
  59758. }
  59759. return stream_isatty($this->stream);
  59760. }
  59761. }
  59762. <?php
  59763. namespace Symfony\Component\Console\Output;
  59764. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59765. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  59766. class TrimmedBufferOutput extends Output
  59767. {
  59768. private $maxLength;
  59769. private $buffer = '';
  59770. public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
  59771. {
  59772. if ($maxLength <= 0) {
  59773. throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
  59774. }
  59775. parent::__construct($verbosity, $decorated, $formatter);
  59776. $this->maxLength = $maxLength;
  59777. }
  59778. public function fetch()
  59779. {
  59780. $content = $this->buffer;
  59781. $this->buffer = '';
  59782. return $content;
  59783. }
  59784. protected function doWrite(string $message, bool $newline)
  59785. {
  59786. $this->buffer .= $message;
  59787. if ($newline) {
  59788. $this->buffer .= \PHP_EOL;
  59789. }
  59790. $this->buffer = substr($this->buffer, 0 - $this->maxLength);
  59791. }
  59792. }
  59793. <?php
  59794. namespace Symfony\Component\Console\Question;
  59795. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59796. class ChoiceQuestion extends Question
  59797. {
  59798. private $choices;
  59799. private $multiselect = false;
  59800. private $prompt = ' > ';
  59801. private $errorMessage = 'Value "%s" is invalid';
  59802. public function __construct(string $question, array $choices, $default = null)
  59803. {
  59804. if (!$choices) {
  59805. throw new \LogicException('Choice question must have at least 1 choice available.');
  59806. }
  59807. parent::__construct($question, $default);
  59808. $this->choices = $choices;
  59809. $this->setValidator($this->getDefaultValidator());
  59810. $this->setAutocompleterValues($choices);
  59811. }
  59812. public function getChoices()
  59813. {
  59814. return $this->choices;
  59815. }
  59816. public function setMultiselect(bool $multiselect)
  59817. {
  59818. $this->multiselect = $multiselect;
  59819. $this->setValidator($this->getDefaultValidator());
  59820. return $this;
  59821. }
  59822. public function isMultiselect()
  59823. {
  59824. return $this->multiselect;
  59825. }
  59826. public function getPrompt()
  59827. {
  59828. return $this->prompt;
  59829. }
  59830. public function setPrompt(string $prompt)
  59831. {
  59832. $this->prompt = $prompt;
  59833. return $this;
  59834. }
  59835. public function setErrorMessage(string $errorMessage)
  59836. {
  59837. $this->errorMessage = $errorMessage;
  59838. $this->setValidator($this->getDefaultValidator());
  59839. return $this;
  59840. }
  59841. private function getDefaultValidator(): callable
  59842. {
  59843. $choices = $this->choices;
  59844. $errorMessage = $this->errorMessage;
  59845. $multiselect = $this->multiselect;
  59846. $isAssoc = $this->isAssoc($choices);
  59847. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  59848. if ($multiselect) {
  59849. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
  59850. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  59851. }
  59852. $selectedChoices = explode(',', (string) $selected);
  59853. } else {
  59854. $selectedChoices = [$selected];
  59855. }
  59856. if ($this->isTrimmable()) {
  59857. foreach ($selectedChoices as $k => $v) {
  59858. $selectedChoices[$k] = trim((string) $v);
  59859. }
  59860. }
  59861. $multiselectChoices = [];
  59862. foreach ($selectedChoices as $value) {
  59863. $results = [];
  59864. foreach ($choices as $key => $choice) {
  59865. if ($choice === $value) {
  59866. $results[] = $key;
  59867. }
  59868. }
  59869. if (\count($results) > 1) {
  59870. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
  59871. }
  59872. $result = array_search($value, $choices);
  59873. if (!$isAssoc) {
  59874. if (false !== $result) {
  59875. $result = $choices[$result];
  59876. } elseif (isset($choices[$value])) {
  59877. $result = $choices[$value];
  59878. }
  59879. } elseif (false === $result && isset($choices[$value])) {
  59880. $result = $value;
  59881. }
  59882. if (false === $result) {
  59883. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  59884. }
  59885. $multiselectChoices[] = $isAssoc ? (string) $result : $result;
  59886. }
  59887. if ($multiselect) {
  59888. return $multiselectChoices;
  59889. }
  59890. return current($multiselectChoices);
  59891. };
  59892. }
  59893. }
  59894. <?php
  59895. namespace Symfony\Component\Console\Question;
  59896. class ConfirmationQuestion extends Question
  59897. {
  59898. private $trueAnswerRegex;
  59899. public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i')
  59900. {
  59901. parent::__construct($question, $default);
  59902. $this->trueAnswerRegex = $trueAnswerRegex;
  59903. $this->setNormalizer($this->getDefaultNormalizer());
  59904. }
  59905. private function getDefaultNormalizer(): callable
  59906. {
  59907. $default = $this->getDefault();
  59908. $regex = $this->trueAnswerRegex;
  59909. return function ($answer) use ($default, $regex) {
  59910. if (\is_bool($answer)) {
  59911. return $answer;
  59912. }
  59913. $answerIsTrue = (bool) preg_match($regex, $answer);
  59914. if (false === $default) {
  59915. return $answer && $answerIsTrue;
  59916. }
  59917. return '' === $answer || $answerIsTrue;
  59918. };
  59919. }
  59920. }
  59921. <?php
  59922. namespace Symfony\Component\Console\Question;
  59923. use Symfony\Component\Console\Exception\InvalidArgumentException;
  59924. use Symfony\Component\Console\Exception\LogicException;
  59925. class Question
  59926. {
  59927. private $question;
  59928. private $attempts;
  59929. private $hidden = false;
  59930. private $hiddenFallback = true;
  59931. private $autocompleterCallback;
  59932. private $validator;
  59933. private $default;
  59934. private $normalizer;
  59935. private $trimmable = true;
  59936. private $multiline = false;
  59937. public function __construct(string $question, $default = null)
  59938. {
  59939. $this->question = $question;
  59940. $this->default = $default;
  59941. }
  59942. public function getQuestion()
  59943. {
  59944. return $this->question;
  59945. }
  59946. public function getDefault()
  59947. {
  59948. return $this->default;
  59949. }
  59950. public function isMultiline(): bool
  59951. {
  59952. return $this->multiline;
  59953. }
  59954. public function setMultiline(bool $multiline): self
  59955. {
  59956. $this->multiline = $multiline;
  59957. return $this;
  59958. }
  59959. public function isHidden()
  59960. {
  59961. return $this->hidden;
  59962. }
  59963. public function setHidden(bool $hidden)
  59964. {
  59965. if ($this->autocompleterCallback) {
  59966. throw new LogicException('A hidden question cannot use the autocompleter.');
  59967. }
  59968. $this->hidden = $hidden;
  59969. return $this;
  59970. }
  59971. public function isHiddenFallback()
  59972. {
  59973. return $this->hiddenFallback;
  59974. }
  59975. public function setHiddenFallback(bool $fallback)
  59976. {
  59977. $this->hiddenFallback = $fallback;
  59978. return $this;
  59979. }
  59980. public function getAutocompleterValues()
  59981. {
  59982. $callback = $this->getAutocompleterCallback();
  59983. return $callback ? $callback('') : null;
  59984. }
  59985. public function setAutocompleterValues(?iterable $values)
  59986. {
  59987. if (\is_array($values)) {
  59988. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  59989. $callback = static function () use ($values) {
  59990. return $values;
  59991. };
  59992. } elseif ($values instanceof \Traversable) {
  59993. $valueCache = null;
  59994. $callback = static function () use ($values, &$valueCache) {
  59995. return $valueCache ?? $valueCache = iterator_to_array($values, false);
  59996. };
  59997. } else {
  59998. $callback = null;
  59999. }
  60000. return $this->setAutocompleterCallback($callback);
  60001. }
  60002. public function getAutocompleterCallback(): ?callable
  60003. {
  60004. return $this->autocompleterCallback;
  60005. }
  60006. public function setAutocompleterCallback(callable $callback = null): self
  60007. {
  60008. if ($this->hidden && null !== $callback) {
  60009. throw new LogicException('A hidden question cannot use the autocompleter.');
  60010. }
  60011. $this->autocompleterCallback = $callback;
  60012. return $this;
  60013. }
  60014. public function setValidator(callable $validator = null)
  60015. {
  60016. $this->validator = $validator;
  60017. return $this;
  60018. }
  60019. public function getValidator()
  60020. {
  60021. return $this->validator;
  60022. }
  60023. public function setMaxAttempts(?int $attempts)
  60024. {
  60025. if (null !== $attempts && $attempts < 1) {
  60026. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  60027. }
  60028. $this->attempts = $attempts;
  60029. return $this;
  60030. }
  60031. public function getMaxAttempts()
  60032. {
  60033. return $this->attempts;
  60034. }
  60035. public function setNormalizer(callable $normalizer)
  60036. {
  60037. $this->normalizer = $normalizer;
  60038. return $this;
  60039. }
  60040. public function getNormalizer()
  60041. {
  60042. return $this->normalizer;
  60043. }
  60044. protected function isAssoc(array $array)
  60045. {
  60046. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  60047. }
  60048. public function isTrimmable(): bool
  60049. {
  60050. return $this->trimmable;
  60051. }
  60052. public function setTrimmable(bool $trimmable): self
  60053. {
  60054. $this->trimmable = $trimmable;
  60055. return $this;
  60056. }
  60057. }
  60058. MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  60059. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  60060. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  60061. ����������������� ��`.rdata����� ���
  60062. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  60063. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  60064. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  60065. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  60066. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  60067. <security>
  60068. <requestedPrivileges>
  60069. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  60070. </requestedPrivileges>
  60071. </security>
  60072. </trustInfo>
  60073. <dependency>
  60074. <dependentAssembly>
  60075. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  60076. </dependentAssembly>
  60077. </dependency>
  60078. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  60079. namespace Symfony\Component\Console\SignalRegistry;
  60080. final class SignalRegistry
  60081. {
  60082. private $signalHandlers = [];
  60083. public function __construct()
  60084. {
  60085. if (\function_exists('pcntl_async_signals')) {
  60086. pcntl_async_signals(true);
  60087. }
  60088. }
  60089. public function register(int $signal, callable $signalHandler): void
  60090. {
  60091. if (!isset($this->signalHandlers[$signal])) {
  60092. $previousCallback = pcntl_signal_get_handler($signal);
  60093. if (\is_callable($previousCallback)) {
  60094. $this->signalHandlers[$signal][] = $previousCallback;
  60095. }
  60096. }
  60097. $this->signalHandlers[$signal][] = $signalHandler;
  60098. pcntl_signal($signal, [$this, 'handle']);
  60099. }
  60100. public static function isSupported(): bool
  60101. {
  60102. if (!\function_exists('pcntl_signal')) {
  60103. return false;
  60104. }
  60105. if (\in_array('pcntl_signal', explode(',', ini_get('disable_functions')))) {
  60106. return false;
  60107. }
  60108. return true;
  60109. }
  60110. public function handle(int $signal): void
  60111. {
  60112. $count = \count($this->signalHandlers[$signal]);
  60113. foreach ($this->signalHandlers[$signal] as $i => $signalHandler) {
  60114. $hasNext = $i !== $count - 1;
  60115. $signalHandler($signal, $hasNext);
  60116. }
  60117. }
  60118. }
  60119. <?php
  60120. namespace Symfony\Component\Console;
  60121. use Symfony\Component\Console\Command\Command;
  60122. use Symfony\Component\Console\Input\InputInterface;
  60123. use Symfony\Component\Console\Output\OutputInterface;
  60124. class SingleCommandApplication extends Command
  60125. {
  60126. private $version = 'UNKNOWN';
  60127. private $autoExit = true;
  60128. private $running = false;
  60129. public function setVersion(string $version): self
  60130. {
  60131. $this->version = $version;
  60132. return $this;
  60133. }
  60134. public function setAutoExit(bool $autoExit): self
  60135. {
  60136. $this->autoExit = $autoExit;
  60137. return $this;
  60138. }
  60139. public function run(InputInterface $input = null, OutputInterface $output = null): int
  60140. {
  60141. if ($this->running) {
  60142. return parent::run($input, $output);
  60143. }
  60144. $application = new Application($this->getName() ?: 'UNKNOWN', $this->version);
  60145. $application->setAutoExit($this->autoExit);
  60146. $this->setName($_SERVER['argv'][0]);
  60147. $application->add($this);
  60148. $application->setDefaultCommand($this->getName(), true);
  60149. $this->running = true;
  60150. try {
  60151. $ret = $application->run($input, $output);
  60152. } finally {
  60153. $this->running = false;
  60154. }
  60155. return $ret ?? 1;
  60156. }
  60157. }
  60158. <?php
  60159. namespace Symfony\Component\Console\Style;
  60160. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  60161. use Symfony\Component\Console\Helper\ProgressBar;
  60162. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  60163. use Symfony\Component\Console\Output\OutputInterface;
  60164. abstract class OutputStyle implements OutputInterface, StyleInterface
  60165. {
  60166. private $output;
  60167. public function __construct(OutputInterface $output)
  60168. {
  60169. $this->output = $output;
  60170. }
  60171. public function newLine(int $count = 1)
  60172. {
  60173. $this->output->write(str_repeat(\PHP_EOL, $count));
  60174. }
  60175. public function createProgressBar(int $max = 0)
  60176. {
  60177. return new ProgressBar($this->output, $max);
  60178. }
  60179. public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
  60180. {
  60181. $this->output->write($messages, $newline, $type);
  60182. }
  60183. public function writeln($messages, int $type = self::OUTPUT_NORMAL)
  60184. {
  60185. $this->output->writeln($messages, $type);
  60186. }
  60187. public function setVerbosity(int $level)
  60188. {
  60189. $this->output->setVerbosity($level);
  60190. }
  60191. public function getVerbosity()
  60192. {
  60193. return $this->output->getVerbosity();
  60194. }
  60195. public function setDecorated(bool $decorated)
  60196. {
  60197. $this->output->setDecorated($decorated);
  60198. }
  60199. public function isDecorated()
  60200. {
  60201. return $this->output->isDecorated();
  60202. }
  60203. public function setFormatter(OutputFormatterInterface $formatter)
  60204. {
  60205. $this->output->setFormatter($formatter);
  60206. }
  60207. public function getFormatter()
  60208. {
  60209. return $this->output->getFormatter();
  60210. }
  60211. public function isQuiet()
  60212. {
  60213. return $this->output->isQuiet();
  60214. }
  60215. public function isVerbose()
  60216. {
  60217. return $this->output->isVerbose();
  60218. }
  60219. public function isVeryVerbose()
  60220. {
  60221. return $this->output->isVeryVerbose();
  60222. }
  60223. public function isDebug()
  60224. {
  60225. return $this->output->isDebug();
  60226. }
  60227. protected function getErrorOutput()
  60228. {
  60229. if (!$this->output instanceof ConsoleOutputInterface) {
  60230. return $this->output;
  60231. }
  60232. return $this->output->getErrorOutput();
  60233. }
  60234. }
  60235. <?php
  60236. namespace Symfony\Component\Console\Style;
  60237. interface StyleInterface
  60238. {
  60239. public function title(string $message);
  60240. public function section(string $message);
  60241. public function listing(array $elements);
  60242. public function text($message);
  60243. public function success($message);
  60244. public function error($message);
  60245. public function warning($message);
  60246. public function note($message);
  60247. public function caution($message);
  60248. public function table(array $headers, array $rows);
  60249. public function ask(string $question, string $default = null, callable $validator = null);
  60250. public function askHidden(string $question, callable $validator = null);
  60251. public function confirm(string $question, bool $default = true);
  60252. public function choice(string $question, array $choices, $default = null);
  60253. public function newLine(int $count = 1);
  60254. public function progressStart(int $max = 0);
  60255. public function progressAdvance(int $step = 1);
  60256. public function progressFinish();
  60257. }
  60258. <?php
  60259. namespace Symfony\Component\Console\Style;
  60260. use Symfony\Component\Console\Exception\InvalidArgumentException;
  60261. use Symfony\Component\Console\Exception\RuntimeException;
  60262. use Symfony\Component\Console\Formatter\OutputFormatter;
  60263. use Symfony\Component\Console\Helper\Helper;
  60264. use Symfony\Component\Console\Helper\ProgressBar;
  60265. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  60266. use Symfony\Component\Console\Helper\Table;
  60267. use Symfony\Component\Console\Helper\TableCell;
  60268. use Symfony\Component\Console\Helper\TableSeparator;
  60269. use Symfony\Component\Console\Input\InputInterface;
  60270. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  60271. use Symfony\Component\Console\Output\OutputInterface;
  60272. use Symfony\Component\Console\Output\TrimmedBufferOutput;
  60273. use Symfony\Component\Console\Question\ChoiceQuestion;
  60274. use Symfony\Component\Console\Question\ConfirmationQuestion;
  60275. use Symfony\Component\Console\Question\Question;
  60276. use Symfony\Component\Console\Terminal;
  60277. class SymfonyStyle extends OutputStyle
  60278. {
  60279. public const MAX_LINE_LENGTH = 120;
  60280. private $input;
  60281. private $output;
  60282. private $questionHelper;
  60283. private $progressBar;
  60284. private $lineLength;
  60285. private $bufferedOutput;
  60286. public function __construct(InputInterface $input, OutputInterface $output)
  60287. {
  60288. $this->input = $input;
  60289. $this->bufferedOutput = new TrimmedBufferOutput(\DIRECTORY_SEPARATOR === '\\' ? 4 : 2, $output->getVerbosity(), false, clone $output->getFormatter());
  60290. $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
  60291. $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  60292. parent::__construct($this->output = $output);
  60293. }
  60294. public function block($messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
  60295. {
  60296. $messages = \is_array($messages) ? array_values($messages) : [$messages];
  60297. $this->autoPrependBlock();
  60298. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
  60299. $this->newLine();
  60300. }
  60301. public function title(string $message)
  60302. {
  60303. $this->autoPrependBlock();
  60304. $this->writeln([
  60305. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  60306. sprintf('<comment>%s</>', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
  60307. ]);
  60308. $this->newLine();
  60309. }
  60310. public function section(string $message)
  60311. {
  60312. $this->autoPrependBlock();
  60313. $this->writeln([
  60314. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  60315. sprintf('<comment>%s</>', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
  60316. ]);
  60317. $this->newLine();
  60318. }
  60319. public function listing(array $elements)
  60320. {
  60321. $this->autoPrependText();
  60322. $elements = array_map(function ($element) {
  60323. return sprintf(' * %s', $element);
  60324. }, $elements);
  60325. $this->writeln($elements);
  60326. $this->newLine();
  60327. }
  60328. public function text($message)
  60329. {
  60330. $this->autoPrependText();
  60331. $messages = \is_array($message) ? array_values($message) : [$message];
  60332. foreach ($messages as $message) {
  60333. $this->writeln(sprintf(' %s', $message));
  60334. }
  60335. }
  60336. public function comment($message)
  60337. {
  60338. $this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
  60339. }
  60340. public function success($message)
  60341. {
  60342. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  60343. }
  60344. public function error($message)
  60345. {
  60346. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  60347. }
  60348. public function warning($message)
  60349. {
  60350. $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true);
  60351. }
  60352. public function note($message)
  60353. {
  60354. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  60355. }
  60356. public function info($message)
  60357. {
  60358. $this->block($message, 'INFO', 'fg=green', ' ', true);
  60359. }
  60360. public function caution($message)
  60361. {
  60362. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  60363. }
  60364. public function table(array $headers, array $rows)
  60365. {
  60366. $this->createTable()
  60367. ->setHeaders($headers)
  60368. ->setRows($rows)
  60369. ->render()
  60370. ;
  60371. $this->newLine();
  60372. }
  60373. public function horizontalTable(array $headers, array $rows)
  60374. {
  60375. $this->createTable()
  60376. ->setHorizontal(true)
  60377. ->setHeaders($headers)
  60378. ->setRows($rows)
  60379. ->render()
  60380. ;
  60381. $this->newLine();
  60382. }
  60383. public function definitionList(...$list)
  60384. {
  60385. $headers = [];
  60386. $row = [];
  60387. foreach ($list as $value) {
  60388. if ($value instanceof TableSeparator) {
  60389. $headers[] = $value;
  60390. $row[] = $value;
  60391. continue;
  60392. }
  60393. if (\is_string($value)) {
  60394. $headers[] = new TableCell($value, ['colspan' => 2]);
  60395. $row[] = null;
  60396. continue;
  60397. }
  60398. if (!\is_array($value)) {
  60399. throw new InvalidArgumentException('Value should be an array, string, or an instance of TableSeparator.');
  60400. }
  60401. $headers[] = key($value);
  60402. $row[] = current($value);
  60403. }
  60404. $this->horizontalTable($headers, [$row]);
  60405. }
  60406. public function ask(string $question, string $default = null, callable $validator = null)
  60407. {
  60408. $question = new Question($question, $default);
  60409. $question->setValidator($validator);
  60410. return $this->askQuestion($question);
  60411. }
  60412. public function askHidden(string $question, callable $validator = null)
  60413. {
  60414. $question = new Question($question);
  60415. $question->setHidden(true);
  60416. $question->setValidator($validator);
  60417. return $this->askQuestion($question);
  60418. }
  60419. public function confirm(string $question, bool $default = true)
  60420. {
  60421. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  60422. }
  60423. public function choice(string $question, array $choices, $default = null)
  60424. {
  60425. if (null !== $default) {
  60426. $values = array_flip($choices);
  60427. $default = $values[$default] ?? $default;
  60428. }
  60429. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  60430. }
  60431. public function progressStart(int $max = 0)
  60432. {
  60433. $this->progressBar = $this->createProgressBar($max);
  60434. $this->progressBar->start();
  60435. }
  60436. public function progressAdvance(int $step = 1)
  60437. {
  60438. $this->getProgressBar()->advance($step);
  60439. }
  60440. public function progressFinish()
  60441. {
  60442. $this->getProgressBar()->finish();
  60443. $this->newLine(2);
  60444. $this->progressBar = null;
  60445. }
  60446. public function createProgressBar(int $max = 0)
  60447. {
  60448. $progressBar = parent::createProgressBar($max);
  60449. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  60450. $progressBar->setEmptyBarCharacter('â–‘');
  60451. $progressBar->setProgressCharacter('');
  60452. $progressBar->setBarCharacter('â–“');
  60453. }
  60454. return $progressBar;
  60455. }
  60456. public function progressIterate(iterable $iterable, int $max = null): iterable
  60457. {
  60458. yield from $this->createProgressBar()->iterate($iterable, $max);
  60459. $this->newLine(2);
  60460. }
  60461. public function askQuestion(Question $question)
  60462. {
  60463. if ($this->input->isInteractive()) {
  60464. $this->autoPrependBlock();
  60465. }
  60466. if (!$this->questionHelper) {
  60467. $this->questionHelper = new SymfonyQuestionHelper();
  60468. }
  60469. $answer = $this->questionHelper->ask($this->input, $this, $question);
  60470. if ($this->input->isInteractive()) {
  60471. $this->newLine();
  60472. $this->bufferedOutput->write("\n");
  60473. }
  60474. return $answer;
  60475. }
  60476. public function writeln($messages, int $type = self::OUTPUT_NORMAL)
  60477. {
  60478. if (!is_iterable($messages)) {
  60479. $messages = [$messages];
  60480. }
  60481. foreach ($messages as $message) {
  60482. parent::writeln($message, $type);
  60483. $this->writeBuffer($message, true, $type);
  60484. }
  60485. }
  60486. public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
  60487. {
  60488. if (!is_iterable($messages)) {
  60489. $messages = [$messages];
  60490. }
  60491. foreach ($messages as $message) {
  60492. parent::write($message, $newline, $type);
  60493. $this->writeBuffer($message, $newline, $type);
  60494. }
  60495. }
  60496. public function newLine(int $count = 1)
  60497. {
  60498. parent::newLine($count);
  60499. $this->bufferedOutput->write(str_repeat("\n", $count));
  60500. }
  60501. public function getErrorStyle()
  60502. {
  60503. return new self($this->input, $this->getErrorOutput());
  60504. }
  60505. public function createTable(): Table
  60506. {
  60507. $output = $this->output instanceof ConsoleOutputInterface ? $this->output->section() : $this->output;
  60508. $style = clone Table::getStyleDefinition('symfony-style-guide');
  60509. $style->setCellHeaderFormat('<info>%s</info>');
  60510. return (new Table($output))->setStyle($style);
  60511. }
  60512. private function getProgressBar(): ProgressBar
  60513. {
  60514. if (!$this->progressBar) {
  60515. throw new RuntimeException('The ProgressBar is not started.');
  60516. }
  60517. return $this->progressBar;
  60518. }
  60519. private function autoPrependBlock(): void
  60520. {
  60521. $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  60522. if (!isset($chars[0])) {
  60523. $this->newLine();
  60524. return;
  60525. }
  60526. $this->newLine(2 - substr_count($chars, "\n"));
  60527. }
  60528. private function autoPrependText(): void
  60529. {
  60530. $fetched = $this->bufferedOutput->fetch();
  60531. if (!str_ends_with($fetched, "\n")) {
  60532. $this->newLine();
  60533. }
  60534. }
  60535. private function writeBuffer(string $message, bool $newLine, int $type): void
  60536. {
  60537. $this->bufferedOutput->write($message, $newLine, $type);
  60538. }
  60539. private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
  60540. {
  60541. $indentLength = 0;
  60542. $prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix));
  60543. $lines = [];
  60544. if (null !== $type) {
  60545. $type = sprintf('[%s] ', $type);
  60546. $indentLength = \strlen($type);
  60547. $lineIndentation = str_repeat(' ', $indentLength);
  60548. }
  60549. foreach ($messages as $key => $message) {
  60550. if ($escape) {
  60551. $message = OutputFormatter::escape($message);
  60552. }
  60553. $decorationLength = Helper::width($message) - Helper::width(Helper::removeDecoration($this->getFormatter(), $message));
  60554. $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
  60555. $messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
  60556. foreach ($messageLines as $messageLine) {
  60557. $lines[] = $messageLine;
  60558. }
  60559. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  60560. $lines[] = '';
  60561. }
  60562. }
  60563. $firstLineIndex = 0;
  60564. if ($padding && $this->isDecorated()) {
  60565. $firstLineIndex = 1;
  60566. array_unshift($lines, '');
  60567. $lines[] = '';
  60568. }
  60569. foreach ($lines as $i => &$line) {
  60570. if (null !== $type) {
  60571. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  60572. }
  60573. $line = $prefix.$line;
  60574. $line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0));
  60575. if ($style) {
  60576. $line = sprintf('<%s>%s</>', $style, $line);
  60577. }
  60578. }
  60579. return $lines;
  60580. }
  60581. }
  60582. <?php
  60583. namespace Symfony\Component\Console;
  60584. class Terminal
  60585. {
  60586. private static $width;
  60587. private static $height;
  60588. private static $stty;
  60589. public function getWidth()
  60590. {
  60591. $width = getenv('COLUMNS');
  60592. if (false !== $width) {
  60593. return (int) trim($width);
  60594. }
  60595. if (null === self::$width) {
  60596. self::initDimensions();
  60597. }
  60598. return self::$width ?: 80;
  60599. }
  60600. public function getHeight()
  60601. {
  60602. $height = getenv('LINES');
  60603. if (false !== $height) {
  60604. return (int) trim($height);
  60605. }
  60606. if (null === self::$height) {
  60607. self::initDimensions();
  60608. }
  60609. return self::$height ?: 50;
  60610. }
  60611. public static function hasSttyAvailable(): bool
  60612. {
  60613. if (null !== self::$stty) {
  60614. return self::$stty;
  60615. }
  60616. if (!\function_exists('exec')) {
  60617. return false;
  60618. }
  60619. exec('stty 2>&1', $output, $exitcode);
  60620. return self::$stty = 0 === $exitcode;
  60621. }
  60622. private static function initDimensions()
  60623. {
  60624. if ('\\' === \DIRECTORY_SEPARATOR) {
  60625. if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
  60626. self::$width = (int) $matches[1];
  60627. self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
  60628. } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {
  60629. self::initDimensionsUsingStty();
  60630. } elseif (null !== $dimensions = self::getConsoleMode()) {
  60631. self::$width = (int) $dimensions[0];
  60632. self::$height = (int) $dimensions[1];
  60633. }
  60634. } else {
  60635. self::initDimensionsUsingStty();
  60636. }
  60637. }
  60638. private static function hasVt100Support(): bool
  60639. {
  60640. return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));
  60641. }
  60642. private static function initDimensionsUsingStty()
  60643. {
  60644. if ($sttyString = self::getSttyColumns()) {
  60645. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  60646. self::$width = (int) $matches[2];
  60647. self::$height = (int) $matches[1];
  60648. } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  60649. self::$width = (int) $matches[2];
  60650. self::$height = (int) $matches[1];
  60651. }
  60652. }
  60653. }
  60654. private static function getConsoleMode(): ?array
  60655. {
  60656. $info = self::readFromProcess('mode CON');
  60657. if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  60658. return null;
  60659. }
  60660. return [(int) $matches[2], (int) $matches[1]];
  60661. }
  60662. private static function getSttyColumns(): ?string
  60663. {
  60664. return self::readFromProcess('stty -a | grep columns');
  60665. }
  60666. private static function readFromProcess(string $command): ?string
  60667. {
  60668. if (!\function_exists('proc_open')) {
  60669. return null;
  60670. }
  60671. $descriptorspec = [
  60672. 1 => ['pipe', 'w'],
  60673. 2 => ['pipe', 'w'],
  60674. ];
  60675. $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
  60676. if (!\is_resource($process)) {
  60677. return null;
  60678. }
  60679. $info = stream_get_contents($pipes[1]);
  60680. fclose($pipes[1]);
  60681. fclose($pipes[2]);
  60682. proc_close($process);
  60683. return $info;
  60684. }
  60685. }
  60686. <?php
  60687. namespace Symfony\Component\Console\Tester;
  60688. use Symfony\Component\Console\Application;
  60689. use Symfony\Component\Console\Input\ArrayInput;
  60690. class ApplicationTester
  60691. {
  60692. use TesterTrait;
  60693. private $application;
  60694. public function __construct(Application $application)
  60695. {
  60696. $this->application = $application;
  60697. }
  60698. public function run(array $input, array $options = [])
  60699. {
  60700. $this->input = new ArrayInput($input);
  60701. if (isset($options['interactive'])) {
  60702. $this->input->setInteractive($options['interactive']);
  60703. }
  60704. if ($this->inputs) {
  60705. $this->input->setStream(self::createStream($this->inputs));
  60706. }
  60707. $this->initOutput($options);
  60708. return $this->statusCode = $this->application->run($this->input, $this->output);
  60709. }
  60710. }
  60711. <?php
  60712. namespace Symfony\Component\Console\Tester;
  60713. use Symfony\Component\Console\Command\Command;
  60714. use Symfony\Component\Console\Completion\CompletionInput;
  60715. use Symfony\Component\Console\Completion\CompletionSuggestions;
  60716. class CommandCompletionTester
  60717. {
  60718. private $command;
  60719. public function __construct(Command $command)
  60720. {
  60721. $this->command = $command;
  60722. }
  60723. public function complete(array $input): array
  60724. {
  60725. $currentIndex = \count($input);
  60726. if ('' === end($input)) {
  60727. array_pop($input);
  60728. }
  60729. array_unshift($input, $this->command->getName());
  60730. $completionInput = CompletionInput::fromTokens($input, $currentIndex);
  60731. $completionInput->bind($this->command->getDefinition());
  60732. $suggestions = new CompletionSuggestions();
  60733. $this->command->complete($completionInput, $suggestions);
  60734. $options = [];
  60735. foreach ($suggestions->getOptionSuggestions() as $option) {
  60736. $options[] = '--'.$option->getName();
  60737. }
  60738. return array_map('strval', array_merge($options, $suggestions->getValueSuggestions()));
  60739. }
  60740. }
  60741. <?php
  60742. namespace Symfony\Component\Console\Tester;
  60743. use Symfony\Component\Console\Command\Command;
  60744. use Symfony\Component\Console\Input\ArrayInput;
  60745. class CommandTester
  60746. {
  60747. use TesterTrait;
  60748. private $command;
  60749. public function __construct(Command $command)
  60750. {
  60751. $this->command = $command;
  60752. }
  60753. public function execute(array $input, array $options = [])
  60754. {
  60755. if (!isset($input['command'])
  60756. && (null !== $application = $this->command->getApplication())
  60757. && $application->getDefinition()->hasArgument('command')
  60758. ) {
  60759. $input = array_merge(['command' => $this->command->getName()], $input);
  60760. }
  60761. $this->input = new ArrayInput($input);
  60762. $this->input->setStream(self::createStream($this->inputs));
  60763. if (isset($options['interactive'])) {
  60764. $this->input->setInteractive($options['interactive']);
  60765. }
  60766. if (!isset($options['decorated'])) {
  60767. $options['decorated'] = false;
  60768. }
  60769. $this->initOutput($options);
  60770. return $this->statusCode = $this->command->run($this->input, $this->output);
  60771. }
  60772. }
  60773. <?php
  60774. namespace Symfony\Component\Console\Tester\Constraint;
  60775. use PHPUnit\Framework\Constraint\Constraint;
  60776. use Symfony\Component\Console\Command\Command;
  60777. final class CommandIsSuccessful extends Constraint
  60778. {
  60779. public function toString(): string
  60780. {
  60781. return 'is successful';
  60782. }
  60783. protected function matches($other): bool
  60784. {
  60785. return Command::SUCCESS === $other;
  60786. }
  60787. protected function failureDescription($other): string
  60788. {
  60789. return 'the command '.$this->toString();
  60790. }
  60791. protected function additionalFailureDescription($other): string
  60792. {
  60793. $mapping = [
  60794. Command::FAILURE => 'Command failed.',
  60795. Command::INVALID => 'Command was invalid.',
  60796. ];
  60797. return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
  60798. }
  60799. }
  60800. <?php
  60801. namespace Symfony\Component\Console\Tester;
  60802. use PHPUnit\Framework\Assert;
  60803. use Symfony\Component\Console\Input\InputInterface;
  60804. use Symfony\Component\Console\Output\ConsoleOutput;
  60805. use Symfony\Component\Console\Output\OutputInterface;
  60806. use Symfony\Component\Console\Output\StreamOutput;
  60807. use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
  60808. trait TesterTrait
  60809. {
  60810. private $output;
  60811. private $inputs = [];
  60812. private $captureStreamsIndependently = false;
  60813. private $input;
  60814. private $statusCode;
  60815. public function getDisplay(bool $normalize = false)
  60816. {
  60817. if (null === $this->output) {
  60818. throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
  60819. }
  60820. rewind($this->output->getStream());
  60821. $display = stream_get_contents($this->output->getStream());
  60822. if ($normalize) {
  60823. $display = str_replace(\PHP_EOL, "\n", $display);
  60824. }
  60825. return $display;
  60826. }
  60827. public function getErrorOutput(bool $normalize = false)
  60828. {
  60829. if (!$this->captureStreamsIndependently) {
  60830. throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
  60831. }
  60832. rewind($this->output->getErrorOutput()->getStream());
  60833. $display = stream_get_contents($this->output->getErrorOutput()->getStream());
  60834. if ($normalize) {
  60835. $display = str_replace(\PHP_EOL, "\n", $display);
  60836. }
  60837. return $display;
  60838. }
  60839. public function getInput()
  60840. {
  60841. return $this->input;
  60842. }
  60843. public function getOutput()
  60844. {
  60845. return $this->output;
  60846. }
  60847. public function getStatusCode()
  60848. {
  60849. if (null === $this->statusCode) {
  60850. throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
  60851. }
  60852. return $this->statusCode;
  60853. }
  60854. public function assertCommandIsSuccessful(string $message = ''): void
  60855. {
  60856. Assert::assertThat($this->statusCode, new CommandIsSuccessful(), $message);
  60857. }
  60858. public function setInputs(array $inputs)
  60859. {
  60860. $this->inputs = $inputs;
  60861. return $this;
  60862. }
  60863. private function initOutput(array $options)
  60864. {
  60865. $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
  60866. if (!$this->captureStreamsIndependently) {
  60867. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  60868. if (isset($options['decorated'])) {
  60869. $this->output->setDecorated($options['decorated']);
  60870. }
  60871. if (isset($options['verbosity'])) {
  60872. $this->output->setVerbosity($options['verbosity']);
  60873. }
  60874. } else {
  60875. $this->output = new ConsoleOutput(
  60876. $options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
  60877. $options['decorated'] ?? null
  60878. );
  60879. $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
  60880. $errorOutput->setFormatter($this->output->getFormatter());
  60881. $errorOutput->setVerbosity($this->output->getVerbosity());
  60882. $errorOutput->setDecorated($this->output->isDecorated());
  60883. $reflectedOutput = new \ReflectionObject($this->output);
  60884. $strErrProperty = $reflectedOutput->getProperty('stderr');
  60885. $strErrProperty->setAccessible(true);
  60886. $strErrProperty->setValue($this->output, $errorOutput);
  60887. $reflectedParent = $reflectedOutput->getParentClass();
  60888. $streamProperty = $reflectedParent->getProperty('stream');
  60889. $streamProperty->setAccessible(true);
  60890. $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
  60891. }
  60892. }
  60893. private static function createStream(array $inputs)
  60894. {
  60895. $stream = fopen('php://memory', 'r+', false);
  60896. foreach ($inputs as $input) {
  60897. fwrite($stream, $input.\PHP_EOL);
  60898. }
  60899. rewind($stream);
  60900. return $stream;
  60901. }
  60902. }
  60903. Copyright (c) 2020-2021 Fabien Potencier
  60904. Permission is hereby granted, free of charge, to any person obtaining a copy
  60905. of this software and associated documentation files (the "Software"), to deal
  60906. in the Software without restriction, including without limitation the rights
  60907. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  60908. copies of the Software, and to permit persons to whom the Software is furnished
  60909. to do so, subject to the following conditions:
  60910. The above copyright notice and this permission notice shall be included in all
  60911. copies or substantial portions of the Software.
  60912. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  60913. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  60914. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  60915. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  60916. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  60917. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  60918. THE SOFTWARE.
  60919. <?php
  60920. if (!function_exists('trigger_deprecation')) {
  60921. function trigger_deprecation(string $package, string $version, string $message, ...$args): void
  60922. {
  60923. @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
  60924. }
  60925. }
  60926. <?php
  60927. namespace Symfony\Component\Filesystem\Exception;
  60928. interface ExceptionInterface extends \Throwable
  60929. {
  60930. }
  60931. <?php
  60932. namespace Symfony\Component\Filesystem\Exception;
  60933. class FileNotFoundException extends IOException
  60934. {
  60935. public function __construct(string $message = null, int $code = 0, \Throwable $previous = null, string $path = null)
  60936. {
  60937. if (null === $message) {
  60938. if (null === $path) {
  60939. $message = 'File could not be found.';
  60940. } else {
  60941. $message = sprintf('File "%s" could not be found.', $path);
  60942. }
  60943. }
  60944. parent::__construct($message, $code, $previous, $path);
  60945. }
  60946. }
  60947. <?php
  60948. namespace Symfony\Component\Filesystem\Exception;
  60949. class IOException extends \RuntimeException implements IOExceptionInterface
  60950. {
  60951. private $path;
  60952. public function __construct(string $message, int $code = 0, \Throwable $previous = null, string $path = null)
  60953. {
  60954. $this->path = $path;
  60955. parent::__construct($message, $code, $previous);
  60956. }
  60957. public function getPath()
  60958. {
  60959. return $this->path;
  60960. }
  60961. }
  60962. <?php
  60963. namespace Symfony\Component\Filesystem\Exception;
  60964. interface IOExceptionInterface extends ExceptionInterface
  60965. {
  60966. public function getPath();
  60967. }
  60968. <?php
  60969. namespace Symfony\Component\Filesystem\Exception;
  60970. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  60971. {
  60972. }
  60973. <?php
  60974. namespace Symfony\Component\Filesystem\Exception;
  60975. class RuntimeException extends \RuntimeException implements ExceptionInterface
  60976. {
  60977. }
  60978. <?php
  60979. namespace Symfony\Component\Filesystem;
  60980. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  60981. use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
  60982. use Symfony\Component\Filesystem\Exception\IOException;
  60983. class Filesystem
  60984. {
  60985. private static $lastError;
  60986. public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false)
  60987. {
  60988. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  60989. if ($originIsLocal && !is_file($originFile)) {
  60990. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  60991. }
  60992. $this->mkdir(\dirname($targetFile));
  60993. $doCopy = true;
  60994. if (!$overwriteNewerFiles && null === parse_url($originFile, \PHP_URL_HOST) && is_file($targetFile)) {
  60995. $doCopy = filemtime($originFile) > filemtime($targetFile);
  60996. }
  60997. if ($doCopy) {
  60998. if (!$source = self::box('fopen', $originFile, 'r')) {
  60999. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
  61000. }
  61001. if (!$target = self::box('fopen', $targetFile, 'w', false, stream_context_create(['ftp' => ['overwrite' => true]]))) {
  61002. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
  61003. }
  61004. $bytesCopied = stream_copy_to_stream($source, $target);
  61005. fclose($source);
  61006. fclose($target);
  61007. unset($source, $target);
  61008. if (!is_file($targetFile)) {
  61009. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  61010. }
  61011. if ($originIsLocal) {
  61012. self::box('chmod', $targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  61013. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  61014. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  61015. }
  61016. }
  61017. }
  61018. }
  61019. public function mkdir($dirs, int $mode = 0777)
  61020. {
  61021. foreach ($this->toIterable($dirs) as $dir) {
  61022. if (is_dir($dir)) {
  61023. continue;
  61024. }
  61025. if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) {
  61026. throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
  61027. }
  61028. }
  61029. }
  61030. public function exists($files)
  61031. {
  61032. $maxPathLength = \PHP_MAXPATHLEN - 2;
  61033. foreach ($this->toIterable($files) as $file) {
  61034. if (\strlen($file) > $maxPathLength) {
  61035. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  61036. }
  61037. if (!file_exists($file)) {
  61038. return false;
  61039. }
  61040. }
  61041. return true;
  61042. }
  61043. public function touch($files, int $time = null, int $atime = null)
  61044. {
  61045. foreach ($this->toIterable($files) as $file) {
  61046. if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
  61047. throw new IOException(sprintf('Failed to touch "%s": ', $file).self::$lastError, 0, null, $file);
  61048. }
  61049. }
  61050. }
  61051. public function remove($files)
  61052. {
  61053. if ($files instanceof \Traversable) {
  61054. $files = iterator_to_array($files, false);
  61055. } elseif (!\is_array($files)) {
  61056. $files = [$files];
  61057. }
  61058. self::doRemove($files, false);
  61059. }
  61060. private static function doRemove(array $files, bool $isRecursive): void
  61061. {
  61062. $files = array_reverse($files);
  61063. foreach ($files as $file) {
  61064. if (is_link($file)) {
  61065. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  61066. throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
  61067. }
  61068. } elseif (is_dir($file)) {
  61069. if (!$isRecursive) {
  61070. $tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-.'));
  61071. if (file_exists($tmpName)) {
  61072. try {
  61073. self::doRemove([$tmpName], true);
  61074. } catch (IOException $e) {
  61075. }
  61076. }
  61077. if (!file_exists($tmpName) && self::box('rename', $file, $tmpName)) {
  61078. $origFile = $file;
  61079. $file = $tmpName;
  61080. } else {
  61081. $origFile = null;
  61082. }
  61083. }
  61084. $files = new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS);
  61085. self::doRemove(iterator_to_array($files, true), true);
  61086. if (!self::box('rmdir', $file) && file_exists($file) && !$isRecursive) {
  61087. $lastError = self::$lastError;
  61088. if (null !== $origFile && self::box('rename', $file, $origFile)) {
  61089. $file = $origFile;
  61090. }
  61091. throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
  61092. }
  61093. } elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
  61094. throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
  61095. }
  61096. }
  61097. }
  61098. public function chmod($files, int $mode, int $umask = 0000, bool $recursive = false)
  61099. {
  61100. foreach ($this->toIterable($files) as $file) {
  61101. if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && !self::box('chmod', $file, $mode & ~$umask)) {
  61102. throw new IOException(sprintf('Failed to chmod file "%s": ', $file).self::$lastError, 0, null, $file);
  61103. }
  61104. if ($recursive && is_dir($file) && !is_link($file)) {
  61105. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  61106. }
  61107. }
  61108. }
  61109. public function chown($files, $user, bool $recursive = false)
  61110. {
  61111. foreach ($this->toIterable($files) as $file) {
  61112. if ($recursive && is_dir($file) && !is_link($file)) {
  61113. $this->chown(new \FilesystemIterator($file), $user, true);
  61114. }
  61115. if (is_link($file) && \function_exists('lchown')) {
  61116. if (!self::box('lchown', $file, $user)) {
  61117. throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
  61118. }
  61119. } else {
  61120. if (!self::box('chown', $file, $user)) {
  61121. throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
  61122. }
  61123. }
  61124. }
  61125. }
  61126. public function chgrp($files, $group, bool $recursive = false)
  61127. {
  61128. foreach ($this->toIterable($files) as $file) {
  61129. if ($recursive && is_dir($file) && !is_link($file)) {
  61130. $this->chgrp(new \FilesystemIterator($file), $group, true);
  61131. }
  61132. if (is_link($file) && \function_exists('lchgrp')) {
  61133. if (!self::box('lchgrp', $file, $group)) {
  61134. throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
  61135. }
  61136. } else {
  61137. if (!self::box('chgrp', $file, $group)) {
  61138. throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
  61139. }
  61140. }
  61141. }
  61142. }
  61143. public function rename(string $origin, string $target, bool $overwrite = false)
  61144. {
  61145. if (!$overwrite && $this->isReadable($target)) {
  61146. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  61147. }
  61148. if (!self::box('rename', $origin, $target)) {
  61149. if (is_dir($origin)) {
  61150. $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
  61151. $this->remove($origin);
  61152. return;
  61153. }
  61154. throw new IOException(sprintf('Cannot rename "%s" to "%s": ', $origin, $target).self::$lastError, 0, null, $target);
  61155. }
  61156. }
  61157. private function isReadable(string $filename): bool
  61158. {
  61159. $maxPathLength = \PHP_MAXPATHLEN - 2;
  61160. if (\strlen($filename) > $maxPathLength) {
  61161. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  61162. }
  61163. return is_readable($filename);
  61164. }
  61165. public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false)
  61166. {
  61167. if ('\\' === \DIRECTORY_SEPARATOR) {
  61168. $originDir = strtr($originDir, '/', '\\');
  61169. $targetDir = strtr($targetDir, '/', '\\');
  61170. if ($copyOnWindows) {
  61171. $this->mirror($originDir, $targetDir);
  61172. return;
  61173. }
  61174. }
  61175. $this->mkdir(\dirname($targetDir));
  61176. if (is_link($targetDir)) {
  61177. if (readlink($targetDir) === $originDir) {
  61178. return;
  61179. }
  61180. $this->remove($targetDir);
  61181. }
  61182. if (!self::box('symlink', $originDir, $targetDir)) {
  61183. $this->linkException($originDir, $targetDir, 'symbolic');
  61184. }
  61185. }
  61186. public function hardlink(string $originFile, $targetFiles)
  61187. {
  61188. if (!$this->exists($originFile)) {
  61189. throw new FileNotFoundException(null, 0, null, $originFile);
  61190. }
  61191. if (!is_file($originFile)) {
  61192. throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile));
  61193. }
  61194. foreach ($this->toIterable($targetFiles) as $targetFile) {
  61195. if (is_file($targetFile)) {
  61196. if (fileinode($originFile) === fileinode($targetFile)) {
  61197. continue;
  61198. }
  61199. $this->remove($targetFile);
  61200. }
  61201. if (!self::box('link', $originFile, $targetFile)) {
  61202. $this->linkException($originFile, $targetFile, 'hard');
  61203. }
  61204. }
  61205. }
  61206. private function linkException(string $origin, string $target, string $linkType)
  61207. {
  61208. if (self::$lastError) {
  61209. if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
  61210. throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
  61211. }
  61212. }
  61213. throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
  61214. }
  61215. public function readlink(string $path, bool $canonicalize = false)
  61216. {
  61217. if (!$canonicalize && !is_link($path)) {
  61218. return null;
  61219. }
  61220. if ($canonicalize) {
  61221. if (!$this->exists($path)) {
  61222. return null;
  61223. }
  61224. if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) {
  61225. $path = readlink($path);
  61226. }
  61227. return realpath($path);
  61228. }
  61229. if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
  61230. return realpath($path);
  61231. }
  61232. return readlink($path);
  61233. }
  61234. public function makePathRelative(string $endPath, string $startPath)
  61235. {
  61236. if (!$this->isAbsolutePath($startPath)) {
  61237. throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
  61238. }
  61239. if (!$this->isAbsolutePath($endPath)) {
  61240. throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
  61241. }
  61242. if ('\\' === \DIRECTORY_SEPARATOR) {
  61243. $endPath = str_replace('\\', '/', $endPath);
  61244. $startPath = str_replace('\\', '/', $startPath);
  61245. }
  61246. $splitDriveLetter = function ($path) {
  61247. return (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
  61248. ? [substr($path, 2), strtoupper($path[0])]
  61249. : [$path, null];
  61250. };
  61251. $splitPath = function ($path) {
  61252. $result = [];
  61253. foreach (explode('/', trim($path, '/')) as $segment) {
  61254. if ('..' === $segment) {
  61255. array_pop($result);
  61256. } elseif ('.' !== $segment && '' !== $segment) {
  61257. $result[] = $segment;
  61258. }
  61259. }
  61260. return $result;
  61261. };
  61262. [$endPath, $endDriveLetter] = $splitDriveLetter($endPath);
  61263. [$startPath, $startDriveLetter] = $splitDriveLetter($startPath);
  61264. $startPathArr = $splitPath($startPath);
  61265. $endPathArr = $splitPath($endPath);
  61266. if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) {
  61267. return $endDriveLetter.':/'.($endPathArr ? implode('/', $endPathArr).'/' : '');
  61268. }
  61269. $index = 0;
  61270. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  61271. ++$index;
  61272. }
  61273. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  61274. $depth = 0;
  61275. } else {
  61276. $depth = \count($startPathArr) - $index;
  61277. }
  61278. $traverser = str_repeat('../', $depth);
  61279. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  61280. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  61281. return '' === $relativePath ? './' : $relativePath;
  61282. }
  61283. public function mirror(string $originDir, string $targetDir, \Traversable $iterator = null, array $options = [])
  61284. {
  61285. $targetDir = rtrim($targetDir, '/\\');
  61286. $originDir = rtrim($originDir, '/\\');
  61287. $originDirLen = \strlen($originDir);
  61288. if (!$this->exists($originDir)) {
  61289. throw new IOException(sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir);
  61290. }
  61291. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  61292. $deleteIterator = $iterator;
  61293. if (null === $deleteIterator) {
  61294. $flags = \FilesystemIterator::SKIP_DOTS;
  61295. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  61296. }
  61297. $targetDirLen = \strlen($targetDir);
  61298. foreach ($deleteIterator as $file) {
  61299. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  61300. if (!$this->exists($origin)) {
  61301. $this->remove($file);
  61302. }
  61303. }
  61304. }
  61305. $copyOnWindows = $options['copy_on_windows'] ?? false;
  61306. if (null === $iterator) {
  61307. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  61308. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  61309. }
  61310. $this->mkdir($targetDir);
  61311. $filesCreatedWhileMirroring = [];
  61312. foreach ($iterator as $file) {
  61313. if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) {
  61314. continue;
  61315. }
  61316. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  61317. $filesCreatedWhileMirroring[$target] = true;
  61318. if (!$copyOnWindows && is_link($file)) {
  61319. $this->symlink($file->getLinkTarget(), $target);
  61320. } elseif (is_dir($file)) {
  61321. $this->mkdir($target);
  61322. } elseif (is_file($file)) {
  61323. $this->copy($file, $target, $options['override'] ?? false);
  61324. } else {
  61325. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  61326. }
  61327. }
  61328. }
  61329. public function isAbsolutePath(string $file)
  61330. {
  61331. return '' !== $file && (strspn($file, '/\\', 0, 1)
  61332. || (\strlen($file) > 3 && ctype_alpha($file[0])
  61333. && ':' === $file[1]
  61334. && strspn($file, '/\\', 2, 1)
  61335. )
  61336. || null !== parse_url($file, \PHP_URL_SCHEME)
  61337. );
  61338. }
  61339. public function tempnam(string $dir, string $prefix)
  61340. {
  61341. $suffix = \func_num_args() > 2 ? func_get_arg(2) : '';
  61342. [$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir);
  61343. if ((null === $scheme || 'file' === $scheme || 'gs' === $scheme) && '' === $suffix) {
  61344. if ($tmpFile = self::box('tempnam', $hierarchy, $prefix)) {
  61345. if (null !== $scheme && 'gs' !== $scheme) {
  61346. return $scheme.'://'.$tmpFile;
  61347. }
  61348. return $tmpFile;
  61349. }
  61350. throw new IOException('A temporary file could not be created: '.self::$lastError);
  61351. }
  61352. for ($i = 0; $i < 10; ++$i) {
  61353. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true).$suffix;
  61354. if (!$handle = self::box('fopen', $tmpFile, 'x+')) {
  61355. continue;
  61356. }
  61357. self::box('fclose', $handle);
  61358. return $tmpFile;
  61359. }
  61360. throw new IOException('A temporary file could not be created: '.self::$lastError);
  61361. }
  61362. public function dumpFile(string $filename, $content)
  61363. {
  61364. if (\is_array($content)) {
  61365. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
  61366. }
  61367. $dir = \dirname($filename);
  61368. if (!is_dir($dir)) {
  61369. $this->mkdir($dir);
  61370. }
  61371. $tmpFile = $this->tempnam($dir, basename($filename));
  61372. try {
  61373. if (false === self::box('file_put_contents', $tmpFile, $content)) {
  61374. throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
  61375. }
  61376. self::box('chmod', $tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());
  61377. $this->rename($tmpFile, $filename, true);
  61378. } finally {
  61379. if (file_exists($tmpFile)) {
  61380. self::box('unlink', $tmpFile);
  61381. }
  61382. }
  61383. }
  61384. public function appendToFile(string $filename, $content)
  61385. {
  61386. if (\is_array($content)) {
  61387. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
  61388. }
  61389. $dir = \dirname($filename);
  61390. if (!is_dir($dir)) {
  61391. $this->mkdir($dir);
  61392. }
  61393. $lock = \func_num_args() > 2 && func_get_arg(2);
  61394. if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) {
  61395. throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
  61396. }
  61397. }
  61398. private function toIterable($files): iterable
  61399. {
  61400. return is_iterable($files) ? $files : [$files];
  61401. }
  61402. private function getSchemeAndHierarchy(string $filename): array
  61403. {
  61404. $components = explode('://', $filename, 2);
  61405. return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
  61406. }
  61407. private static function box(callable $func, ...$args)
  61408. {
  61409. self::$lastError = null;
  61410. set_error_handler(__CLASS__.'::handleError');
  61411. try {
  61412. return $func(...$args);
  61413. } finally {
  61414. restore_error_handler();
  61415. }
  61416. }
  61417. public static function handleError(int $type, string $msg)
  61418. {
  61419. self::$lastError = $msg;
  61420. }
  61421. }
  61422. Copyright (c) 2004-2022 Fabien Potencier
  61423. Permission is hereby granted, free of charge, to any person obtaining a copy
  61424. of this software and associated documentation files (the "Software"), to deal
  61425. in the Software without restriction, including without limitation the rights
  61426. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  61427. copies of the Software, and to permit persons to whom the Software is furnished
  61428. to do so, subject to the following conditions:
  61429. The above copyright notice and this permission notice shall be included in all
  61430. copies or substantial portions of the Software.
  61431. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  61432. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  61433. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  61434. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  61435. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  61436. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  61437. THE SOFTWARE.
  61438. <?php
  61439. namespace Symfony\Component\Filesystem;
  61440. use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
  61441. use Symfony\Component\Filesystem\Exception\RuntimeException;
  61442. final class Path
  61443. {
  61444. private const CLEANUP_THRESHOLD = 1250;
  61445. private const CLEANUP_SIZE = 1000;
  61446. private static $buffer = [];
  61447. private static $bufferSize = 0;
  61448. public static function canonicalize(string $path): string
  61449. {
  61450. if ('' === $path) {
  61451. return '';
  61452. }
  61453. if (isset(self::$buffer[$path])) {
  61454. return self::$buffer[$path];
  61455. }
  61456. if ('~' === $path[0]) {
  61457. $path = self::getHomeDirectory().mb_substr($path, 1);
  61458. }
  61459. $path = self::normalize($path);
  61460. [$root, $pathWithoutRoot] = self::split($path);
  61461. $canonicalParts = self::findCanonicalParts($root, $pathWithoutRoot);
  61462. self::$buffer[$path] = $canonicalPath = $root.implode('/', $canonicalParts);
  61463. ++self::$bufferSize;
  61464. if (self::$bufferSize > self::CLEANUP_THRESHOLD) {
  61465. self::$buffer = \array_slice(self::$buffer, -self::CLEANUP_SIZE, null, true);
  61466. self::$bufferSize = self::CLEANUP_SIZE;
  61467. }
  61468. return $canonicalPath;
  61469. }
  61470. public static function normalize(string $path): string
  61471. {
  61472. return str_replace('\\', '/', $path);
  61473. }
  61474. public static function getDirectory(string $path): string
  61475. {
  61476. if ('' === $path) {
  61477. return '';
  61478. }
  61479. $path = self::canonicalize($path);
  61480. if (false !== ($schemeSeparatorPosition = mb_strpos($path, '://'))) {
  61481. $scheme = mb_substr($path, 0, $schemeSeparatorPosition + 3);
  61482. $path = mb_substr($path, $schemeSeparatorPosition + 3);
  61483. } else {
  61484. $scheme = '';
  61485. }
  61486. if (false === ($dirSeparatorPosition = strrpos($path, '/'))) {
  61487. return '';
  61488. }
  61489. if (0 === $dirSeparatorPosition) {
  61490. return $scheme.'/';
  61491. }
  61492. if (2 === $dirSeparatorPosition && ctype_alpha($path[0]) && ':' === $path[1]) {
  61493. return $scheme.mb_substr($path, 0, 3);
  61494. }
  61495. return $scheme.mb_substr($path, 0, $dirSeparatorPosition);
  61496. }
  61497. public static function getHomeDirectory(): string
  61498. {
  61499. if (getenv('HOME')) {
  61500. return self::canonicalize(getenv('HOME'));
  61501. }
  61502. if (getenv('HOMEDRIVE') && getenv('HOMEPATH')) {
  61503. return self::canonicalize(getenv('HOMEDRIVE').getenv('HOMEPATH'));
  61504. }
  61505. throw new RuntimeException("Cannot find the home directory path: Your environment or operating system isn't supported.");
  61506. }
  61507. public static function getRoot(string $path): string
  61508. {
  61509. if ('' === $path) {
  61510. return '';
  61511. }
  61512. if (false !== ($schemeSeparatorPosition = strpos($path, '://'))) {
  61513. $scheme = substr($path, 0, $schemeSeparatorPosition + 3);
  61514. $path = substr($path, $schemeSeparatorPosition + 3);
  61515. } else {
  61516. $scheme = '';
  61517. }
  61518. $firstCharacter = $path[0];
  61519. if ('/' === $firstCharacter || '\\' === $firstCharacter) {
  61520. return $scheme.'/';
  61521. }
  61522. $length = mb_strlen($path);
  61523. if ($length > 1 && ':' === $path[1] && ctype_alpha($firstCharacter)) {
  61524. if (2 === $length) {
  61525. return $scheme.$path.'/';
  61526. }
  61527. if ('/' === $path[2] || '\\' === $path[2]) {
  61528. return $scheme.$firstCharacter.$path[1].'/';
  61529. }
  61530. }
  61531. return '';
  61532. }
  61533. public static function getFilenameWithoutExtension(string $path, string $extension = null)
  61534. {
  61535. if ('' === $path) {
  61536. return '';
  61537. }
  61538. if (null !== $extension) {
  61539. return rtrim(basename($path, $extension), '.');
  61540. }
  61541. return pathinfo($path, \PATHINFO_FILENAME);
  61542. }
  61543. public static function getExtension(string $path, bool $forceLowerCase = false): string
  61544. {
  61545. if ('' === $path) {
  61546. return '';
  61547. }
  61548. $extension = pathinfo($path, \PATHINFO_EXTENSION);
  61549. if ($forceLowerCase) {
  61550. $extension = self::toLower($extension);
  61551. }
  61552. return $extension;
  61553. }
  61554. public static function hasExtension(string $path, $extensions = null, bool $ignoreCase = false): bool
  61555. {
  61556. if ('' === $path) {
  61557. return false;
  61558. }
  61559. $actualExtension = self::getExtension($path, $ignoreCase);
  61560. if ([] === $extensions || null === $extensions) {
  61561. return '' !== $actualExtension;
  61562. }
  61563. if (\is_string($extensions)) {
  61564. $extensions = [$extensions];
  61565. }
  61566. foreach ($extensions as $key => $extension) {
  61567. if ($ignoreCase) {
  61568. $extension = self::toLower($extension);
  61569. }
  61570. $extensions[$key] = ltrim($extension, '.');
  61571. }
  61572. return \in_array($actualExtension, $extensions, true);
  61573. }
  61574. public static function changeExtension(string $path, string $extension): string
  61575. {
  61576. if ('' === $path) {
  61577. return '';
  61578. }
  61579. $actualExtension = self::getExtension($path);
  61580. $extension = ltrim($extension, '.');
  61581. if ('/' === mb_substr($path, -1)) {
  61582. return $path;
  61583. }
  61584. if (empty($actualExtension)) {
  61585. return $path.('.' === mb_substr($path, -1) ? '' : '.').$extension;
  61586. }
  61587. return mb_substr($path, 0, -mb_strlen($actualExtension)).$extension;
  61588. }
  61589. public static function isAbsolute(string $path): bool
  61590. {
  61591. if ('' === $path) {
  61592. return false;
  61593. }
  61594. if (false !== ($schemeSeparatorPosition = mb_strpos($path, '://'))) {
  61595. $path = mb_substr($path, $schemeSeparatorPosition + 3);
  61596. }
  61597. $firstCharacter = $path[0];
  61598. if ('/' === $firstCharacter || '\\' === $firstCharacter) {
  61599. return true;
  61600. }
  61601. if (mb_strlen($path) > 1 && ctype_alpha($firstCharacter) && ':' === $path[1]) {
  61602. if (2 === mb_strlen($path)) {
  61603. return true;
  61604. }
  61605. if ('/' === $path[2] || '\\' === $path[2]) {
  61606. return true;
  61607. }
  61608. }
  61609. return false;
  61610. }
  61611. public static function isRelative(string $path): bool
  61612. {
  61613. return !self::isAbsolute($path);
  61614. }
  61615. public static function makeAbsolute(string $path, string $basePath): string
  61616. {
  61617. if ('' === $basePath) {
  61618. throw new InvalidArgumentException(sprintf('The base path must be a non-empty string. Got: "%s".', $basePath));
  61619. }
  61620. if (!self::isAbsolute($basePath)) {
  61621. throw new InvalidArgumentException(sprintf('The base path "%s" is not an absolute path.', $basePath));
  61622. }
  61623. if (self::isAbsolute($path)) {
  61624. return self::canonicalize($path);
  61625. }
  61626. if (false !== ($schemeSeparatorPosition = mb_strpos($basePath, '://'))) {
  61627. $scheme = mb_substr($basePath, 0, $schemeSeparatorPosition + 3);
  61628. $basePath = mb_substr($basePath, $schemeSeparatorPosition + 3);
  61629. } else {
  61630. $scheme = '';
  61631. }
  61632. return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
  61633. }
  61634. public static function makeRelative(string $path, string $basePath): string
  61635. {
  61636. $path = self::canonicalize($path);
  61637. $basePath = self::canonicalize($basePath);
  61638. [$root, $relativePath] = self::split($path);
  61639. [$baseRoot, $relativeBasePath] = self::split($basePath);
  61640. if ('' === $root && '' !== $baseRoot) {
  61641. if ('' === $relativeBasePath) {
  61642. $relativePath = ltrim($relativePath, './\\');
  61643. }
  61644. return $relativePath;
  61645. }
  61646. if ('' !== $root && '' === $baseRoot) {
  61647. throw new InvalidArgumentException(sprintf('The absolute path "%s" cannot be made relative to the relative path "%s". You should provide an absolute base path instead.', $path, $basePath));
  61648. }
  61649. if ($baseRoot && $root !== $baseRoot) {
  61650. throw new InvalidArgumentException(sprintf('The path "%s" cannot be made relative to "%s", because they have different roots ("%s" and "%s").', $path, $basePath, $root, $baseRoot));
  61651. }
  61652. if ('' === $relativeBasePath) {
  61653. return $relativePath;
  61654. }
  61655. $parts = explode('/', $relativePath);
  61656. $baseParts = explode('/', $relativeBasePath);
  61657. $dotDotPrefix = '';
  61658. $match = true;
  61659. foreach ($baseParts as $index => $basePart) {
  61660. if ($match && isset($parts[$index]) && $basePart === $parts[$index]) {
  61661. unset($parts[$index]);
  61662. continue;
  61663. }
  61664. $match = false;
  61665. $dotDotPrefix .= '../';
  61666. }
  61667. return rtrim($dotDotPrefix.implode('/', $parts), '/');
  61668. }
  61669. public static function isLocal(string $path): bool
  61670. {
  61671. return '' !== $path && false === mb_strpos($path, '://');
  61672. }
  61673. public static function getLongestCommonBasePath(string ...$paths): ?string
  61674. {
  61675. [$bpRoot, $basePath] = self::split(self::canonicalize(reset($paths)));
  61676. for (next($paths); null !== key($paths) && '' !== $basePath; next($paths)) {
  61677. [$root, $path] = self::split(self::canonicalize(current($paths)));
  61678. if ($root !== $bpRoot) {
  61679. return null;
  61680. }
  61681. while (true) {
  61682. if ('.' === $basePath) {
  61683. $basePath = '';
  61684. continue 2;
  61685. }
  61686. if (0 === mb_strpos($path.'/', $basePath.'/')) {
  61687. continue 2;
  61688. }
  61689. $basePath = \dirname($basePath);
  61690. }
  61691. }
  61692. return $bpRoot.$basePath;
  61693. }
  61694. public static function join(string ...$paths): string
  61695. {
  61696. $finalPath = null;
  61697. $wasScheme = false;
  61698. foreach ($paths as $path) {
  61699. if ('' === $path) {
  61700. continue;
  61701. }
  61702. if (null === $finalPath) {
  61703. $finalPath = $path;
  61704. $wasScheme = (false !== mb_strpos($path, '://'));
  61705. continue;
  61706. }
  61707. if (!\in_array(mb_substr($finalPath, -1), ['/', '\\'])) {
  61708. $finalPath .= '/';
  61709. }
  61710. $finalPath .= $wasScheme ? $path : ltrim($path, '/');
  61711. $wasScheme = false;
  61712. }
  61713. if (null === $finalPath) {
  61714. return '';
  61715. }
  61716. return self::canonicalize($finalPath);
  61717. }
  61718. public static function isBasePath(string $basePath, string $ofPath): bool
  61719. {
  61720. $basePath = self::canonicalize($basePath);
  61721. $ofPath = self::canonicalize($ofPath);
  61722. return 0 === mb_strpos($ofPath.'/', rtrim($basePath, '/').'/');
  61723. }
  61724. private static function findCanonicalParts(string $root, string $pathWithoutRoot): array
  61725. {
  61726. $parts = explode('/', $pathWithoutRoot);
  61727. $canonicalParts = [];
  61728. foreach ($parts as $part) {
  61729. if ('.' === $part || '' === $part) {
  61730. continue;
  61731. }
  61732. if ('..' === $part && \count($canonicalParts) > 0 && '..' !== $canonicalParts[\count($canonicalParts) - 1]) {
  61733. array_pop($canonicalParts);
  61734. continue;
  61735. }
  61736. if ('..' !== $part || '' === $root) {
  61737. $canonicalParts[] = $part;
  61738. }
  61739. }
  61740. return $canonicalParts;
  61741. }
  61742. private static function split(string $path): array
  61743. {
  61744. if ('' === $path) {
  61745. return ['', ''];
  61746. }
  61747. if (false !== ($schemeSeparatorPosition = mb_strpos($path, '://'))) {
  61748. $root = mb_substr($path, 0, $schemeSeparatorPosition + 3);
  61749. $path = mb_substr($path, $schemeSeparatorPosition + 3);
  61750. } else {
  61751. $root = '';
  61752. }
  61753. $length = mb_strlen($path);
  61754. if (0 === mb_strpos($path, '/')) {
  61755. $root .= '/';
  61756. $path = $length > 1 ? mb_substr($path, 1) : '';
  61757. } elseif ($length > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {
  61758. if (2 === $length) {
  61759. $root .= $path.'/';
  61760. $path = '';
  61761. } elseif ('/' === $path[2]) {
  61762. $root .= mb_substr($path, 0, 3);
  61763. $path = $length > 3 ? mb_substr($path, 3) : '';
  61764. }
  61765. }
  61766. return [$root, $path];
  61767. }
  61768. private static function toLower(string $string): string
  61769. {
  61770. if (false !== $encoding = mb_detect_encoding($string)) {
  61771. return mb_strtolower($string, $encoding);
  61772. }
  61773. return strtolower($string, $encoding);
  61774. }
  61775. private function __construct()
  61776. {
  61777. }
  61778. }
  61779. <?php
  61780. namespace Symfony\Component\Finder\Comparator;
  61781. class Comparator
  61782. {
  61783. private $target;
  61784. private $operator = '==';
  61785. public function __construct(string $target = null, string $operator = '==')
  61786. {
  61787. if (null === $target) {
  61788. trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
  61789. }
  61790. $this->target = $target;
  61791. $this->doSetOperator($operator);
  61792. }
  61793. public function getTarget()
  61794. {
  61795. if (null === $this->target) {
  61796. trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
  61797. }
  61798. return $this->target;
  61799. }
  61800. public function setTarget(string $target)
  61801. {
  61802. trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the target via the constructor instead.', __METHOD__);
  61803. $this->target = $target;
  61804. }
  61805. public function getOperator()
  61806. {
  61807. return $this->operator;
  61808. }
  61809. public function setOperator(string $operator)
  61810. {
  61811. trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the operator via the constructor instead.', __METHOD__);
  61812. $this->doSetOperator('' === $operator ? '==' : $operator);
  61813. }
  61814. public function test($test)
  61815. {
  61816. if (null === $this->target) {
  61817. trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
  61818. }
  61819. switch ($this->operator) {
  61820. case '>':
  61821. return $test > $this->target;
  61822. case '>=':
  61823. return $test >= $this->target;
  61824. case '<':
  61825. return $test < $this->target;
  61826. case '<=':
  61827. return $test <= $this->target;
  61828. case '!=':
  61829. return $test != $this->target;
  61830. }
  61831. return $test == $this->target;
  61832. }
  61833. private function doSetOperator(string $operator): void
  61834. {
  61835. if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
  61836. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  61837. }
  61838. $this->operator = $operator;
  61839. }
  61840. }
  61841. <?php
  61842. namespace Symfony\Component\Finder\Comparator;
  61843. class DateComparator extends Comparator
  61844. {
  61845. public function __construct(string $test)
  61846. {
  61847. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  61848. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  61849. }
  61850. try {
  61851. $date = new \DateTime($matches[2]);
  61852. $target = $date->format('U');
  61853. } catch (\Exception $e) {
  61854. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  61855. }
  61856. $operator = $matches[1] ?? '==';
  61857. if ('since' === $operator || 'after' === $operator) {
  61858. $operator = '>';
  61859. }
  61860. if ('until' === $operator || 'before' === $operator) {
  61861. $operator = '<';
  61862. }
  61863. parent::__construct($target, $operator);
  61864. }
  61865. }
  61866. <?php
  61867. namespace Symfony\Component\Finder\Comparator;
  61868. class NumberComparator extends Comparator
  61869. {
  61870. public function __construct(?string $test)
  61871. {
  61872. if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  61873. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
  61874. }
  61875. $target = $matches[2];
  61876. if (!is_numeric($target)) {
  61877. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  61878. }
  61879. if (isset($matches[3])) {
  61880. switch (strtolower($matches[3])) {
  61881. case 'k':
  61882. $target *= 1000;
  61883. break;
  61884. case 'ki':
  61885. $target *= 1024;
  61886. break;
  61887. case 'm':
  61888. $target *= 1000000;
  61889. break;
  61890. case 'mi':
  61891. $target *= 1024 * 1024;
  61892. break;
  61893. case 'g':
  61894. $target *= 1000000000;
  61895. break;
  61896. case 'gi':
  61897. $target *= 1024 * 1024 * 1024;
  61898. break;
  61899. }
  61900. }
  61901. parent::__construct($target, $matches[1] ?: '==');
  61902. }
  61903. }
  61904. <?php
  61905. namespace Symfony\Component\Finder\Exception;
  61906. class AccessDeniedException extends \UnexpectedValueException
  61907. {
  61908. }
  61909. <?php
  61910. namespace Symfony\Component\Finder\Exception;
  61911. class DirectoryNotFoundException extends \InvalidArgumentException
  61912. {
  61913. }
  61914. <?php
  61915. namespace Symfony\Component\Finder;
  61916. use Symfony\Component\Finder\Comparator\DateComparator;
  61917. use Symfony\Component\Finder\Comparator\NumberComparator;
  61918. use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
  61919. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  61920. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  61921. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  61922. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  61923. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  61924. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  61925. use Symfony\Component\Finder\Iterator\LazyIterator;
  61926. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  61927. use Symfony\Component\Finder\Iterator\SortableIterator;
  61928. class Finder implements \IteratorAggregate, \Countable
  61929. {
  61930. public const IGNORE_VCS_FILES = 1;
  61931. public const IGNORE_DOT_FILES = 2;
  61932. public const IGNORE_VCS_IGNORED_FILES = 4;
  61933. private $mode = 0;
  61934. private $names = [];
  61935. private $notNames = [];
  61936. private $exclude = [];
  61937. private $filters = [];
  61938. private $depths = [];
  61939. private $sizes = [];
  61940. private $followLinks = false;
  61941. private $reverseSorting = false;
  61942. private $sort = false;
  61943. private $ignore = 0;
  61944. private $dirs = [];
  61945. private $dates = [];
  61946. private $iterators = [];
  61947. private $contains = [];
  61948. private $notContains = [];
  61949. private $paths = [];
  61950. private $notPaths = [];
  61951. private $ignoreUnreadableDirs = false;
  61952. private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
  61953. public function __construct()
  61954. {
  61955. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  61956. }
  61957. public static function create()
  61958. {
  61959. return new static();
  61960. }
  61961. public function directories()
  61962. {
  61963. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  61964. return $this;
  61965. }
  61966. public function files()
  61967. {
  61968. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  61969. return $this;
  61970. }
  61971. public function depth($levels)
  61972. {
  61973. foreach ((array) $levels as $level) {
  61974. $this->depths[] = new Comparator\NumberComparator($level);
  61975. }
  61976. return $this;
  61977. }
  61978. public function date($dates)
  61979. {
  61980. foreach ((array) $dates as $date) {
  61981. $this->dates[] = new Comparator\DateComparator($date);
  61982. }
  61983. return $this;
  61984. }
  61985. public function name($patterns)
  61986. {
  61987. $this->names = array_merge($this->names, (array) $patterns);
  61988. return $this;
  61989. }
  61990. public function notName($patterns)
  61991. {
  61992. $this->notNames = array_merge($this->notNames, (array) $patterns);
  61993. return $this;
  61994. }
  61995. public function contains($patterns)
  61996. {
  61997. $this->contains = array_merge($this->contains, (array) $patterns);
  61998. return $this;
  61999. }
  62000. public function notContains($patterns)
  62001. {
  62002. $this->notContains = array_merge($this->notContains, (array) $patterns);
  62003. return $this;
  62004. }
  62005. public function path($patterns)
  62006. {
  62007. $this->paths = array_merge($this->paths, (array) $patterns);
  62008. return $this;
  62009. }
  62010. public function notPath($patterns)
  62011. {
  62012. $this->notPaths = array_merge($this->notPaths, (array) $patterns);
  62013. return $this;
  62014. }
  62015. public function size($sizes)
  62016. {
  62017. foreach ((array) $sizes as $size) {
  62018. $this->sizes[] = new Comparator\NumberComparator($size);
  62019. }
  62020. return $this;
  62021. }
  62022. public function exclude($dirs)
  62023. {
  62024. $this->exclude = array_merge($this->exclude, (array) $dirs);
  62025. return $this;
  62026. }
  62027. public function ignoreDotFiles(bool $ignoreDotFiles)
  62028. {
  62029. if ($ignoreDotFiles) {
  62030. $this->ignore |= static::IGNORE_DOT_FILES;
  62031. } else {
  62032. $this->ignore &= ~static::IGNORE_DOT_FILES;
  62033. }
  62034. return $this;
  62035. }
  62036. public function ignoreVCS(bool $ignoreVCS)
  62037. {
  62038. if ($ignoreVCS) {
  62039. $this->ignore |= static::IGNORE_VCS_FILES;
  62040. } else {
  62041. $this->ignore &= ~static::IGNORE_VCS_FILES;
  62042. }
  62043. return $this;
  62044. }
  62045. public function ignoreVCSIgnored(bool $ignoreVCSIgnored)
  62046. {
  62047. if ($ignoreVCSIgnored) {
  62048. $this->ignore |= static::IGNORE_VCS_IGNORED_FILES;
  62049. } else {
  62050. $this->ignore &= ~static::IGNORE_VCS_IGNORED_FILES;
  62051. }
  62052. return $this;
  62053. }
  62054. public static function addVCSPattern($pattern)
  62055. {
  62056. foreach ((array) $pattern as $p) {
  62057. self::$vcsPatterns[] = $p;
  62058. }
  62059. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  62060. }
  62061. public function sort(\Closure $closure)
  62062. {
  62063. $this->sort = $closure;
  62064. return $this;
  62065. }
  62066. public function sortByName(bool $useNaturalSort = false)
  62067. {
  62068. $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
  62069. return $this;
  62070. }
  62071. public function sortByType()
  62072. {
  62073. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  62074. return $this;
  62075. }
  62076. public function sortByAccessedTime()
  62077. {
  62078. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  62079. return $this;
  62080. }
  62081. public function reverseSorting()
  62082. {
  62083. $this->reverseSorting = true;
  62084. return $this;
  62085. }
  62086. public function sortByChangedTime()
  62087. {
  62088. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  62089. return $this;
  62090. }
  62091. public function sortByModifiedTime()
  62092. {
  62093. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  62094. return $this;
  62095. }
  62096. public function filter(\Closure $closure)
  62097. {
  62098. $this->filters[] = $closure;
  62099. return $this;
  62100. }
  62101. public function followLinks()
  62102. {
  62103. $this->followLinks = true;
  62104. return $this;
  62105. }
  62106. public function ignoreUnreadableDirs(bool $ignore = true)
  62107. {
  62108. $this->ignoreUnreadableDirs = $ignore;
  62109. return $this;
  62110. }
  62111. public function in($dirs)
  62112. {
  62113. $resolvedDirs = [];
  62114. foreach ((array) $dirs as $dir) {
  62115. if (is_dir($dir)) {
  62116. $resolvedDirs[] = [$this->normalizeDir($dir)];
  62117. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) {
  62118. sort($glob);
  62119. $resolvedDirs[] = array_map([$this, 'normalizeDir'], $glob);
  62120. } else {
  62121. throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
  62122. }
  62123. }
  62124. $this->dirs = array_merge($this->dirs, ...$resolvedDirs);
  62125. return $this;
  62126. }
  62127. #[\ReturnTypeWillChange]
  62128. public function getIterator()
  62129. {
  62130. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  62131. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  62132. }
  62133. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  62134. $iterator = $this->searchInDirectory($this->dirs[0]);
  62135. if ($this->sort || $this->reverseSorting) {
  62136. $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
  62137. }
  62138. return $iterator;
  62139. }
  62140. $iterator = new \AppendIterator();
  62141. foreach ($this->dirs as $dir) {
  62142. $iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) {
  62143. return $this->searchInDirectory($dir);
  62144. })));
  62145. }
  62146. foreach ($this->iterators as $it) {
  62147. $iterator->append($it);
  62148. }
  62149. if ($this->sort || $this->reverseSorting) {
  62150. $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
  62151. }
  62152. return $iterator;
  62153. }
  62154. public function append(iterable $iterator)
  62155. {
  62156. if ($iterator instanceof \IteratorAggregate) {
  62157. $this->iterators[] = $iterator->getIterator();
  62158. } elseif ($iterator instanceof \Iterator) {
  62159. $this->iterators[] = $iterator;
  62160. } elseif (is_iterable($iterator)) {
  62161. $it = new \ArrayIterator();
  62162. foreach ($iterator as $file) {
  62163. $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
  62164. $it[$file->getPathname()] = $file;
  62165. }
  62166. $this->iterators[] = $it;
  62167. } else {
  62168. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  62169. }
  62170. return $this;
  62171. }
  62172. public function hasResults()
  62173. {
  62174. foreach ($this->getIterator() as $_) {
  62175. return true;
  62176. }
  62177. return false;
  62178. }
  62179. #[\ReturnTypeWillChange]
  62180. public function count()
  62181. {
  62182. return iterator_count($this->getIterator());
  62183. }
  62184. private function searchInDirectory(string $dir): \Iterator
  62185. {
  62186. $exclude = $this->exclude;
  62187. $notPaths = $this->notPaths;
  62188. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  62189. $exclude = array_merge($exclude, self::$vcsPatterns);
  62190. }
  62191. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  62192. $notPaths[] = '#(^|/)\..+(/|$)#';
  62193. }
  62194. $minDepth = 0;
  62195. $maxDepth = \PHP_INT_MAX;
  62196. foreach ($this->depths as $comparator) {
  62197. switch ($comparator->getOperator()) {
  62198. case '>':
  62199. $minDepth = $comparator->getTarget() + 1;
  62200. break;
  62201. case '>=':
  62202. $minDepth = $comparator->getTarget();
  62203. break;
  62204. case '<':
  62205. $maxDepth = $comparator->getTarget() - 1;
  62206. break;
  62207. case '<=':
  62208. $maxDepth = $comparator->getTarget();
  62209. break;
  62210. default:
  62211. $minDepth = $maxDepth = $comparator->getTarget();
  62212. }
  62213. }
  62214. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  62215. if ($this->followLinks) {
  62216. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  62217. }
  62218. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  62219. if ($exclude) {
  62220. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude);
  62221. }
  62222. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  62223. if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) {
  62224. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  62225. }
  62226. if ($this->mode) {
  62227. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  62228. }
  62229. if ($this->names || $this->notNames) {
  62230. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  62231. }
  62232. if ($this->contains || $this->notContains) {
  62233. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  62234. }
  62235. if ($this->sizes) {
  62236. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  62237. }
  62238. if ($this->dates) {
  62239. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  62240. }
  62241. if ($this->filters) {
  62242. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  62243. }
  62244. if ($this->paths || $notPaths) {
  62245. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
  62246. }
  62247. if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) {
  62248. $iterator = new Iterator\VcsIgnoredFilterIterator($iterator, $dir);
  62249. }
  62250. return $iterator;
  62251. }
  62252. private function normalizeDir(string $dir): string
  62253. {
  62254. if ('/' === $dir) {
  62255. return $dir;
  62256. }
  62257. $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  62258. if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
  62259. $dir .= '/';
  62260. }
  62261. return $dir;
  62262. }
  62263. }
  62264. <?php
  62265. namespace Symfony\Component\Finder;
  62266. class Gitignore
  62267. {
  62268. public static function toRegex(string $gitignoreFileContent): string
  62269. {
  62270. return self::buildRegex($gitignoreFileContent, false);
  62271. }
  62272. public static function toRegexMatchingNegatedPatterns(string $gitignoreFileContent): string
  62273. {
  62274. return self::buildRegex($gitignoreFileContent, true);
  62275. }
  62276. private static function buildRegex(string $gitignoreFileContent, bool $inverted): string
  62277. {
  62278. $gitignoreFileContent = preg_replace('~(?<!\\\\)#[^\n\r]*~', '', $gitignoreFileContent);
  62279. $gitignoreLines = preg_split('~\r\n?|\n~', $gitignoreFileContent);
  62280. $res = self::lineToRegex('');
  62281. foreach ($gitignoreLines as $line) {
  62282. $line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
  62283. if ('!' === substr($line, 0, 1)) {
  62284. $line = substr($line, 1);
  62285. $isNegative = true;
  62286. } else {
  62287. $isNegative = false;
  62288. }
  62289. if ('' !== $line) {
  62290. if ($isNegative xor $inverted) {
  62291. $res = '(?!'.self::lineToRegex($line).'$)'.$res;
  62292. } else {
  62293. $res = '(?:'.$res.'|'.self::lineToRegex($line).')';
  62294. }
  62295. }
  62296. }
  62297. return '~^(?:'.$res.')~s';
  62298. }
  62299. private static function lineToRegex(string $gitignoreLine): string
  62300. {
  62301. if ('' === $gitignoreLine) {
  62302. return '$f';
  62303. }
  62304. $slashPos = strpos($gitignoreLine, '/');
  62305. if (false !== $slashPos && \strlen($gitignoreLine) - 1 !== $slashPos) {
  62306. if (0 === $slashPos) {
  62307. $gitignoreLine = substr($gitignoreLine, 1);
  62308. }
  62309. $isAbsolute = true;
  62310. } else {
  62311. $isAbsolute = false;
  62312. }
  62313. $regex = preg_quote(str_replace('\\', '', $gitignoreLine), '~');
  62314. $regex = preg_replace_callback('~\\\\\[((?:\\\\!)?)([^\[\]]*)\\\\\]~', function (array $matches): string {
  62315. return '['.('' !== $matches[1] ? '^' : '').str_replace('\\-', '-', $matches[2]).']';
  62316. }, $regex);
  62317. $regex = preg_replace('~(?:(?:\\\\\*){2,}(/?))+~', '(?:(?:(?!//).(?<!//))+$1)?', $regex);
  62318. $regex = preg_replace('~\\\\\*~', '[^/]*', $regex);
  62319. $regex = preg_replace('~\\\\\?~', '[^/]', $regex);
  62320. return ($isAbsolute ? '' : '(?:[^/]+/)*')
  62321. .$regex
  62322. .(!str_ends_with($gitignoreLine, '/') ? '(?:$|/)' : '');
  62323. }
  62324. }
  62325. <?php
  62326. namespace Symfony\Component\Finder;
  62327. class Glob
  62328. {
  62329. public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#')
  62330. {
  62331. $firstByte = true;
  62332. $escaping = false;
  62333. $inCurlies = 0;
  62334. $regex = '';
  62335. $sizeGlob = \strlen($glob);
  62336. for ($i = 0; $i < $sizeGlob; ++$i) {
  62337. $car = $glob[$i];
  62338. if ($firstByte && $strictLeadingDot && '.' !== $car) {
  62339. $regex .= '(?=[^\.])';
  62340. }
  62341. $firstByte = '/' === $car;
  62342. if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) {
  62343. $car = '[^/]++/';
  62344. if (!isset($glob[$i + 3])) {
  62345. $car .= '?';
  62346. }
  62347. if ($strictLeadingDot) {
  62348. $car = '(?=[^\.])'.$car;
  62349. }
  62350. $car = '/(?:'.$car.')*';
  62351. $i += 2 + isset($glob[$i + 3]);
  62352. if ('/' === $delimiter) {
  62353. $car = str_replace('/', '\\/', $car);
  62354. }
  62355. }
  62356. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  62357. $regex .= "\\$car";
  62358. } elseif ('*' === $car) {
  62359. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  62360. } elseif ('?' === $car) {
  62361. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  62362. } elseif ('{' === $car) {
  62363. $regex .= $escaping ? '\\{' : '(';
  62364. if (!$escaping) {
  62365. ++$inCurlies;
  62366. }
  62367. } elseif ('}' === $car && $inCurlies) {
  62368. $regex .= $escaping ? '}' : ')';
  62369. if (!$escaping) {
  62370. --$inCurlies;
  62371. }
  62372. } elseif (',' === $car && $inCurlies) {
  62373. $regex .= $escaping ? ',' : '|';
  62374. } elseif ('\\' === $car) {
  62375. if ($escaping) {
  62376. $regex .= '\\\\';
  62377. $escaping = false;
  62378. } else {
  62379. $escaping = true;
  62380. }
  62381. continue;
  62382. } else {
  62383. $regex .= $car;
  62384. }
  62385. $escaping = false;
  62386. }
  62387. return $delimiter.'^'.$regex.'$'.$delimiter;
  62388. }
  62389. }
  62390. <?php
  62391. namespace Symfony\Component\Finder\Iterator;
  62392. class CustomFilterIterator extends \FilterIterator
  62393. {
  62394. private $filters = [];
  62395. public function __construct(\Iterator $iterator, array $filters)
  62396. {
  62397. foreach ($filters as $filter) {
  62398. if (!\is_callable($filter)) {
  62399. throw new \InvalidArgumentException('Invalid PHP callback.');
  62400. }
  62401. }
  62402. $this->filters = $filters;
  62403. parent::__construct($iterator);
  62404. }
  62405. #[\ReturnTypeWillChange]
  62406. public function accept()
  62407. {
  62408. $fileinfo = $this->current();
  62409. foreach ($this->filters as $filter) {
  62410. if (false === $filter($fileinfo)) {
  62411. return false;
  62412. }
  62413. }
  62414. return true;
  62415. }
  62416. }
  62417. <?php
  62418. namespace Symfony\Component\Finder\Iterator;
  62419. use Symfony\Component\Finder\Comparator\DateComparator;
  62420. class DateRangeFilterIterator extends \FilterIterator
  62421. {
  62422. private $comparators = [];
  62423. public function __construct(\Iterator $iterator, array $comparators)
  62424. {
  62425. $this->comparators = $comparators;
  62426. parent::__construct($iterator);
  62427. }
  62428. #[\ReturnTypeWillChange]
  62429. public function accept()
  62430. {
  62431. $fileinfo = $this->current();
  62432. if (!file_exists($fileinfo->getPathname())) {
  62433. return false;
  62434. }
  62435. $filedate = $fileinfo->getMTime();
  62436. foreach ($this->comparators as $compare) {
  62437. if (!$compare->test($filedate)) {
  62438. return false;
  62439. }
  62440. }
  62441. return true;
  62442. }
  62443. }
  62444. <?php
  62445. namespace Symfony\Component\Finder\Iterator;
  62446. class DepthRangeFilterIterator extends \FilterIterator
  62447. {
  62448. private $minDepth = 0;
  62449. public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth = 0, int $maxDepth = \PHP_INT_MAX)
  62450. {
  62451. $this->minDepth = $minDepth;
  62452. $iterator->setMaxDepth(\PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  62453. parent::__construct($iterator);
  62454. }
  62455. #[\ReturnTypeWillChange]
  62456. public function accept()
  62457. {
  62458. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  62459. }
  62460. }
  62461. <?php
  62462. namespace Symfony\Component\Finder\Iterator;
  62463. class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator
  62464. {
  62465. private $iterator;
  62466. private $isRecursive;
  62467. private $excludedDirs = [];
  62468. private $excludedPattern;
  62469. public function __construct(\Iterator $iterator, array $directories)
  62470. {
  62471. $this->iterator = $iterator;
  62472. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  62473. $patterns = [];
  62474. foreach ($directories as $directory) {
  62475. $directory = rtrim($directory, '/');
  62476. if (!$this->isRecursive || str_contains($directory, '/')) {
  62477. $patterns[] = preg_quote($directory, '#');
  62478. } else {
  62479. $this->excludedDirs[$directory] = true;
  62480. }
  62481. }
  62482. if ($patterns) {
  62483. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  62484. }
  62485. parent::__construct($iterator);
  62486. }
  62487. #[\ReturnTypeWillChange]
  62488. public function accept()
  62489. {
  62490. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  62491. return false;
  62492. }
  62493. if ($this->excludedPattern) {
  62494. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  62495. $path = str_replace('\\', '/', $path);
  62496. return !preg_match($this->excludedPattern, $path);
  62497. }
  62498. return true;
  62499. }
  62500. #[\ReturnTypeWillChange]
  62501. public function hasChildren()
  62502. {
  62503. return $this->isRecursive && $this->iterator->hasChildren();
  62504. }
  62505. #[\ReturnTypeWillChange]
  62506. public function getChildren()
  62507. {
  62508. $children = new self($this->iterator->getChildren(), []);
  62509. $children->excludedDirs = $this->excludedDirs;
  62510. $children->excludedPattern = $this->excludedPattern;
  62511. return $children;
  62512. }
  62513. }
  62514. <?php
  62515. namespace Symfony\Component\Finder\Iterator;
  62516. class FileTypeFilterIterator extends \FilterIterator
  62517. {
  62518. public const ONLY_FILES = 1;
  62519. public const ONLY_DIRECTORIES = 2;
  62520. private $mode;
  62521. public function __construct(\Iterator $iterator, int $mode)
  62522. {
  62523. $this->mode = $mode;
  62524. parent::__construct($iterator);
  62525. }
  62526. #[\ReturnTypeWillChange]
  62527. public function accept()
  62528. {
  62529. $fileinfo = $this->current();
  62530. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  62531. return false;
  62532. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  62533. return false;
  62534. }
  62535. return true;
  62536. }
  62537. }
  62538. <?php
  62539. namespace Symfony\Component\Finder\Iterator;
  62540. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  62541. {
  62542. #[\ReturnTypeWillChange]
  62543. public function accept()
  62544. {
  62545. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  62546. return true;
  62547. }
  62548. $fileinfo = $this->current();
  62549. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  62550. return false;
  62551. }
  62552. $content = $fileinfo->getContents();
  62553. if (!$content) {
  62554. return false;
  62555. }
  62556. return $this->isAccepted($content);
  62557. }
  62558. protected function toRegex(string $str)
  62559. {
  62560. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  62561. }
  62562. }
  62563. <?php
  62564. namespace Symfony\Component\Finder\Iterator;
  62565. use Symfony\Component\Finder\Glob;
  62566. class FilenameFilterIterator extends MultiplePcreFilterIterator
  62567. {
  62568. #[\ReturnTypeWillChange]
  62569. public function accept()
  62570. {
  62571. return $this->isAccepted($this->current()->getFilename());
  62572. }
  62573. protected function toRegex(string $str)
  62574. {
  62575. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  62576. }
  62577. }
  62578. <?php
  62579. namespace Symfony\Component\Finder\Iterator;
  62580. class LazyIterator implements \IteratorAggregate
  62581. {
  62582. private $iteratorFactory;
  62583. public function __construct(callable $iteratorFactory)
  62584. {
  62585. $this->iteratorFactory = $iteratorFactory;
  62586. }
  62587. public function getIterator(): \Traversable
  62588. {
  62589. yield from ($this->iteratorFactory)();
  62590. }
  62591. }
  62592. <?php
  62593. namespace Symfony\Component\Finder\Iterator;
  62594. abstract class MultiplePcreFilterIterator extends \FilterIterator
  62595. {
  62596. protected $matchRegexps = [];
  62597. protected $noMatchRegexps = [];
  62598. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  62599. {
  62600. foreach ($matchPatterns as $pattern) {
  62601. $this->matchRegexps[] = $this->toRegex($pattern);
  62602. }
  62603. foreach ($noMatchPatterns as $pattern) {
  62604. $this->noMatchRegexps[] = $this->toRegex($pattern);
  62605. }
  62606. parent::__construct($iterator);
  62607. }
  62608. protected function isAccepted(string $string)
  62609. {
  62610. foreach ($this->noMatchRegexps as $regex) {
  62611. if (preg_match($regex, $string)) {
  62612. return false;
  62613. }
  62614. }
  62615. if ($this->matchRegexps) {
  62616. foreach ($this->matchRegexps as $regex) {
  62617. if (preg_match($regex, $string)) {
  62618. return true;
  62619. }
  62620. }
  62621. return false;
  62622. }
  62623. return true;
  62624. }
  62625. protected function isRegex(string $str)
  62626. {
  62627. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  62628. $start = substr($m[1], 0, 1);
  62629. $end = substr($m[1], -1);
  62630. if ($start === $end) {
  62631. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  62632. }
  62633. foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
  62634. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  62635. return true;
  62636. }
  62637. }
  62638. }
  62639. return false;
  62640. }
  62641. abstract protected function toRegex(string $str);
  62642. }
  62643. <?php
  62644. namespace Symfony\Component\Finder\Iterator;
  62645. class PathFilterIterator extends MultiplePcreFilterIterator
  62646. {
  62647. #[\ReturnTypeWillChange]
  62648. public function accept()
  62649. {
  62650. $filename = $this->current()->getRelativePathname();
  62651. if ('\\' === \DIRECTORY_SEPARATOR) {
  62652. $filename = str_replace('\\', '/', $filename);
  62653. }
  62654. return $this->isAccepted($filename);
  62655. }
  62656. protected function toRegex(string $str)
  62657. {
  62658. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  62659. }
  62660. }
  62661. <?php
  62662. namespace Symfony\Component\Finder\Iterator;
  62663. use Symfony\Component\Finder\Exception\AccessDeniedException;
  62664. use Symfony\Component\Finder\SplFileInfo;
  62665. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  62666. {
  62667. private $ignoreUnreadableDirs;
  62668. private $rewindable;
  62669. private $rootPath;
  62670. private $subPath;
  62671. private $directorySeparator = '/';
  62672. public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false)
  62673. {
  62674. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  62675. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  62676. }
  62677. parent::__construct($path, $flags);
  62678. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  62679. $this->rootPath = $path;
  62680. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  62681. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  62682. }
  62683. }
  62684. #[\ReturnTypeWillChange]
  62685. public function current()
  62686. {
  62687. if (null === $subPathname = $this->subPath) {
  62688. $subPathname = $this->subPath = $this->getSubPath();
  62689. }
  62690. if ('' !== $subPathname) {
  62691. $subPathname .= $this->directorySeparator;
  62692. }
  62693. $subPathname .= $this->getFilename();
  62694. if ('/' !== $basePath = $this->rootPath) {
  62695. $basePath .= $this->directorySeparator;
  62696. }
  62697. return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
  62698. }
  62699. #[\ReturnTypeWillChange]
  62700. public function hasChildren($allowLinks = false)
  62701. {
  62702. $hasChildren = parent::hasChildren($allowLinks);
  62703. if (!$hasChildren || !$this->ignoreUnreadableDirs) {
  62704. return $hasChildren;
  62705. }
  62706. try {
  62707. parent::getChildren();
  62708. return true;
  62709. } catch (\UnexpectedValueException $e) {
  62710. return false;
  62711. }
  62712. }
  62713. #[\ReturnTypeWillChange]
  62714. public function getChildren()
  62715. {
  62716. try {
  62717. $children = parent::getChildren();
  62718. if ($children instanceof self) {
  62719. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  62720. $children->rewindable = &$this->rewindable;
  62721. $children->rootPath = $this->rootPath;
  62722. }
  62723. return $children;
  62724. } catch (\UnexpectedValueException $e) {
  62725. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  62726. }
  62727. }
  62728. #[\ReturnTypeWillChange]
  62729. public function rewind()
  62730. {
  62731. if (false === $this->isRewindable()) {
  62732. return;
  62733. }
  62734. parent::rewind();
  62735. }
  62736. public function isRewindable()
  62737. {
  62738. if (null !== $this->rewindable) {
  62739. return $this->rewindable;
  62740. }
  62741. if (false !== $stream = @opendir($this->getPath())) {
  62742. $infos = stream_get_meta_data($stream);
  62743. closedir($stream);
  62744. if ($infos['seekable']) {
  62745. return $this->rewindable = true;
  62746. }
  62747. }
  62748. return $this->rewindable = false;
  62749. }
  62750. }
  62751. <?php
  62752. namespace Symfony\Component\Finder\Iterator;
  62753. use Symfony\Component\Finder\Comparator\NumberComparator;
  62754. class SizeRangeFilterIterator extends \FilterIterator
  62755. {
  62756. private $comparators = [];
  62757. public function __construct(\Iterator $iterator, array $comparators)
  62758. {
  62759. $this->comparators = $comparators;
  62760. parent::__construct($iterator);
  62761. }
  62762. #[\ReturnTypeWillChange]
  62763. public function accept()
  62764. {
  62765. $fileinfo = $this->current();
  62766. if (!$fileinfo->isFile()) {
  62767. return true;
  62768. }
  62769. $filesize = $fileinfo->getSize();
  62770. foreach ($this->comparators as $compare) {
  62771. if (!$compare->test($filesize)) {
  62772. return false;
  62773. }
  62774. }
  62775. return true;
  62776. }
  62777. }
  62778. <?php
  62779. namespace Symfony\Component\Finder\Iterator;
  62780. class SortableIterator implements \IteratorAggregate
  62781. {
  62782. public const SORT_BY_NONE = 0;
  62783. public const SORT_BY_NAME = 1;
  62784. public const SORT_BY_TYPE = 2;
  62785. public const SORT_BY_ACCESSED_TIME = 3;
  62786. public const SORT_BY_CHANGED_TIME = 4;
  62787. public const SORT_BY_MODIFIED_TIME = 5;
  62788. public const SORT_BY_NAME_NATURAL = 6;
  62789. private $iterator;
  62790. private $sort;
  62791. public function __construct(\Traversable $iterator, $sort, bool $reverseOrder = false)
  62792. {
  62793. $this->iterator = $iterator;
  62794. $order = $reverseOrder ? -1 : 1;
  62795. if (self::SORT_BY_NAME === $sort) {
  62796. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  62797. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  62798. };
  62799. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  62800. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  62801. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  62802. };
  62803. } elseif (self::SORT_BY_TYPE === $sort) {
  62804. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  62805. if ($a->isDir() && $b->isFile()) {
  62806. return -$order;
  62807. } elseif ($a->isFile() && $b->isDir()) {
  62808. return $order;
  62809. }
  62810. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  62811. };
  62812. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  62813. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  62814. return $order * ($a->getATime() - $b->getATime());
  62815. };
  62816. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  62817. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  62818. return $order * ($a->getCTime() - $b->getCTime());
  62819. };
  62820. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  62821. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  62822. return $order * ($a->getMTime() - $b->getMTime());
  62823. };
  62824. } elseif (self::SORT_BY_NONE === $sort) {
  62825. $this->sort = $order;
  62826. } elseif (\is_callable($sort)) {
  62827. $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort;
  62828. } else {
  62829. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  62830. }
  62831. }
  62832. #[\ReturnTypeWillChange]
  62833. public function getIterator()
  62834. {
  62835. if (1 === $this->sort) {
  62836. return $this->iterator;
  62837. }
  62838. $array = iterator_to_array($this->iterator, true);
  62839. if (-1 === $this->sort) {
  62840. $array = array_reverse($array);
  62841. } else {
  62842. uasort($array, $this->sort);
  62843. }
  62844. return new \ArrayIterator($array);
  62845. }
  62846. }
  62847. <?php
  62848. namespace Symfony\Component\Finder\Iterator;
  62849. use Symfony\Component\Finder\Gitignore;
  62850. final class VcsIgnoredFilterIterator extends \FilterIterator
  62851. {
  62852. private $baseDir;
  62853. private $gitignoreFilesCache = [];
  62854. private $ignoredPathsCache = [];
  62855. public function __construct(\Iterator $iterator, string $baseDir)
  62856. {
  62857. $this->baseDir = $this->normalizePath($baseDir);
  62858. parent::__construct($iterator);
  62859. }
  62860. public function accept(): bool
  62861. {
  62862. $file = $this->current();
  62863. $fileRealPath = $this->normalizePath($file->getRealPath());
  62864. return !$this->isIgnored($fileRealPath);
  62865. }
  62866. private function isIgnored(string $fileRealPath): bool
  62867. {
  62868. if (is_dir($fileRealPath) && !str_ends_with($fileRealPath, '/')) {
  62869. $fileRealPath .= '/';
  62870. }
  62871. if (isset($this->ignoredPathsCache[$fileRealPath])) {
  62872. return $this->ignoredPathsCache[$fileRealPath];
  62873. }
  62874. $ignored = false;
  62875. foreach ($this->parentsDirectoryDownward($fileRealPath) as $parentDirectory) {
  62876. if ($this->isIgnored($parentDirectory)) {
  62877. break;
  62878. }
  62879. $fileRelativePath = substr($fileRealPath, \strlen($parentDirectory) + 1);
  62880. if (null === $regexps = $this->readGitignoreFile("{$parentDirectory}/.gitignore")) {
  62881. continue;
  62882. }
  62883. [$exclusionRegex, $inclusionRegex] = $regexps;
  62884. if (preg_match($exclusionRegex, $fileRelativePath)) {
  62885. $ignored = true;
  62886. continue;
  62887. }
  62888. if (preg_match($inclusionRegex, $fileRelativePath)) {
  62889. $ignored = false;
  62890. }
  62891. }
  62892. return $this->ignoredPathsCache[$fileRealPath] = $ignored;
  62893. }
  62894. private function parentsDirectoryDownward(string $fileRealPath): array
  62895. {
  62896. $parentDirectories = [];
  62897. $parentDirectory = $fileRealPath;
  62898. while (true) {
  62899. $newParentDirectory = \dirname($parentDirectory);
  62900. if ($newParentDirectory === $parentDirectory) {
  62901. break;
  62902. }
  62903. $parentDirectory = $newParentDirectory;
  62904. if (0 !== strpos($parentDirectory, $this->baseDir)) {
  62905. break;
  62906. }
  62907. $parentDirectories[] = $parentDirectory;
  62908. }
  62909. return array_reverse($parentDirectories);
  62910. }
  62911. private function readGitignoreFile(string $path): ?array
  62912. {
  62913. if (\array_key_exists($path, $this->gitignoreFilesCache)) {
  62914. return $this->gitignoreFilesCache[$path];
  62915. }
  62916. if (!file_exists($path)) {
  62917. return $this->gitignoreFilesCache[$path] = null;
  62918. }
  62919. if (!is_file($path) || !is_readable($path)) {
  62920. throw new \RuntimeException("The \"ignoreVCSIgnored\" option cannot be used by the Finder as the \"{$path}\" file is not readable.");
  62921. }
  62922. $gitignoreFileContent = file_get_contents($path);
  62923. return $this->gitignoreFilesCache[$path] = [
  62924. Gitignore::toRegex($gitignoreFileContent),
  62925. Gitignore::toRegexMatchingNegatedPatterns($gitignoreFileContent),
  62926. ];
  62927. }
  62928. private function normalizePath(string $path): string
  62929. {
  62930. if ('\\' === \DIRECTORY_SEPARATOR) {
  62931. return str_replace('\\', '/', $path);
  62932. }
  62933. return $path;
  62934. }
  62935. }
  62936. Copyright (c) 2004-2022 Fabien Potencier
  62937. Permission is hereby granted, free of charge, to any person obtaining a copy
  62938. of this software and associated documentation files (the "Software"), to deal
  62939. in the Software without restriction, including without limitation the rights
  62940. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  62941. copies of the Software, and to permit persons to whom the Software is furnished
  62942. to do so, subject to the following conditions:
  62943. The above copyright notice and this permission notice shall be included in all
  62944. copies or substantial portions of the Software.
  62945. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  62946. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  62947. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  62948. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  62949. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  62950. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  62951. THE SOFTWARE.
  62952. <?php
  62953. namespace Symfony\Component\Finder;
  62954. class SplFileInfo extends \SplFileInfo
  62955. {
  62956. private $relativePath;
  62957. private $relativePathname;
  62958. public function __construct(string $file, string $relativePath, string $relativePathname)
  62959. {
  62960. parent::__construct($file);
  62961. $this->relativePath = $relativePath;
  62962. $this->relativePathname = $relativePathname;
  62963. }
  62964. public function getRelativePath()
  62965. {
  62966. return $this->relativePath;
  62967. }
  62968. public function getRelativePathname()
  62969. {
  62970. return $this->relativePathname;
  62971. }
  62972. public function getFilenameWithoutExtension(): string
  62973. {
  62974. $filename = $this->getFilename();
  62975. return pathinfo($filename, \PATHINFO_FILENAME);
  62976. }
  62977. public function getContents()
  62978. {
  62979. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  62980. try {
  62981. $content = file_get_contents($this->getPathname());
  62982. } finally {
  62983. restore_error_handler();
  62984. }
  62985. if (false === $content) {
  62986. throw new \RuntimeException($error);
  62987. }
  62988. return $content;
  62989. }
  62990. }
  62991. <?php
  62992. namespace Symfony\Polyfill\Ctype;
  62993. final class Ctype
  62994. {
  62995. public static function ctype_alnum($text)
  62996. {
  62997. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  62998. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  62999. }
  63000. public static function ctype_alpha($text)
  63001. {
  63002. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63003. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  63004. }
  63005. public static function ctype_cntrl($text)
  63006. {
  63007. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63008. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  63009. }
  63010. public static function ctype_digit($text)
  63011. {
  63012. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63013. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  63014. }
  63015. public static function ctype_graph($text)
  63016. {
  63017. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63018. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  63019. }
  63020. public static function ctype_lower($text)
  63021. {
  63022. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63023. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  63024. }
  63025. public static function ctype_print($text)
  63026. {
  63027. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63028. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  63029. }
  63030. public static function ctype_punct($text)
  63031. {
  63032. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63033. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  63034. }
  63035. public static function ctype_space($text)
  63036. {
  63037. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63038. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  63039. }
  63040. public static function ctype_upper($text)
  63041. {
  63042. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63043. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  63044. }
  63045. public static function ctype_xdigit($text)
  63046. {
  63047. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  63048. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  63049. }
  63050. private static function convert_int_to_char_for_ctype($int, $function)
  63051. {
  63052. if (!\is_int($int)) {
  63053. return $int;
  63054. }
  63055. if ($int < -128 || $int > 255) {
  63056. return (string) $int;
  63057. }
  63058. if (\PHP_VERSION_ID >= 80100) {
  63059. @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
  63060. }
  63061. if ($int < 0) {
  63062. $int += 256;
  63063. }
  63064. return \chr($int);
  63065. }
  63066. }
  63067. Copyright (c) 2018-2019 Fabien Potencier
  63068. Permission is hereby granted, free of charge, to any person obtaining a copy
  63069. of this software and associated documentation files (the "Software"), to deal
  63070. in the Software without restriction, including without limitation the rights
  63071. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  63072. copies of the Software, and to permit persons to whom the Software is furnished
  63073. to do so, subject to the following conditions:
  63074. The above copyright notice and this permission notice shall be included in all
  63075. copies or substantial portions of the Software.
  63076. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  63077. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  63078. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  63079. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  63080. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  63081. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  63082. THE SOFTWARE.
  63083. <?php
  63084. use Symfony\Polyfill\Ctype as p;
  63085. if (\PHP_VERSION_ID >= 80000) {
  63086. return require __DIR__.'/bootstrap80.php';
  63087. }
  63088. if (!function_exists('ctype_alnum')) {
  63089. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  63090. }
  63091. if (!function_exists('ctype_alpha')) {
  63092. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  63093. }
  63094. if (!function_exists('ctype_cntrl')) {
  63095. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  63096. }
  63097. if (!function_exists('ctype_digit')) {
  63098. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  63099. }
  63100. if (!function_exists('ctype_graph')) {
  63101. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  63102. }
  63103. if (!function_exists('ctype_lower')) {
  63104. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  63105. }
  63106. if (!function_exists('ctype_print')) {
  63107. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  63108. }
  63109. if (!function_exists('ctype_punct')) {
  63110. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  63111. }
  63112. if (!function_exists('ctype_space')) {
  63113. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  63114. }
  63115. if (!function_exists('ctype_upper')) {
  63116. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  63117. }
  63118. if (!function_exists('ctype_xdigit')) {
  63119. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  63120. }
  63121. <?php
  63122. use Symfony\Polyfill\Ctype as p;
  63123. if (!function_exists('ctype_alnum')) {
  63124. function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
  63125. }
  63126. if (!function_exists('ctype_alpha')) {
  63127. function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
  63128. }
  63129. if (!function_exists('ctype_cntrl')) {
  63130. function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
  63131. }
  63132. if (!function_exists('ctype_digit')) {
  63133. function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
  63134. }
  63135. if (!function_exists('ctype_graph')) {
  63136. function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
  63137. }
  63138. if (!function_exists('ctype_lower')) {
  63139. function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
  63140. }
  63141. if (!function_exists('ctype_print')) {
  63142. function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
  63143. }
  63144. if (!function_exists('ctype_punct')) {
  63145. function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
  63146. }
  63147. if (!function_exists('ctype_space')) {
  63148. function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
  63149. }
  63150. if (!function_exists('ctype_upper')) {
  63151. function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
  63152. }
  63153. if (!function_exists('ctype_xdigit')) {
  63154. function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
  63155. }
  63156. <?php
  63157. namespace Symfony\Polyfill\Intl\Grapheme;
  63158. \define('SYMFONY_GRAPHEME_CLUSTER_RX', ((float) \PCRE_VERSION < 10 ? (float) \PCRE_VERSION >= 8.32 : (float) \PCRE_VERSION >= 10.39) ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX);
  63159. final class Grapheme
  63160. {
  63161. public const GRAPHEME_CLUSTER_RX = '(?:\r\n|(?:[ -~\x{200C}\x{200D}]|[ᆨ-ᇹ]+|[ᄀ-ᅟ]*(?:[가개갸걔거게겨계고과괘괴�구궈궤귀규그긔기까깨꺄꺠꺼께껴�꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨���나내�냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴�늬니다대댜댸��뎌뎨������둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴�똬뙈뙤뚀뚜뚸뛔뛰뜌뜨���래랴�러레려례로롸뢔뢰료루뤄뤠뤼류르�리마매먀먜머메며몌모뫄뫠뫼묘무�뭬뮈뮤므믜미바배뱌뱨버베벼볘보�봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴�뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼���사새샤섀서세셔셰소솨쇄쇠쇼수숴�쉬슈스싀시싸쌔쌰��쎄쎠쎼����쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어�여예오와왜외요우워웨위유으���재쟈쟤저제져졔조좌좨죄죠주줘줴�쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴�쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체�쳬초촤쵀최쵸추춰췌취츄츠츼치카�캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴��킈키타태탸턔터테텨톄토톼퇘퇴�투퉈퉤튀튜트틔티파패���페펴����푀표푸풔풰퓌퓨프픠피하해�햬허헤혀혜호화홰회효후훠훼휘휴��히]?[ᅠ-ᆢ]+|[가-힣])[ᆨ-ᇹ]*|[ᄀ-ᅟ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])';
  63162. private const CASE_FOLD = [
  63163. ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
  63164. ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
  63165. ];
  63166. public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0)
  63167. {
  63168. if (0 > $start) {
  63169. $start = \strlen($s) + $start;
  63170. }
  63171. if (!is_scalar($s)) {
  63172. $hasError = false;
  63173. set_error_handler(function () use (&$hasError) { $hasError = true; });
  63174. $next = substr($s, $start);
  63175. restore_error_handler();
  63176. if ($hasError) {
  63177. substr($s, $start);
  63178. $s = '';
  63179. } else {
  63180. $s = $next;
  63181. }
  63182. } else {
  63183. $s = substr($s, $start);
  63184. }
  63185. $size = (int) $size;
  63186. $type = (int) $type;
  63187. $start = (int) $start;
  63188. if (\GRAPHEME_EXTR_COUNT !== $type && \GRAPHEME_EXTR_MAXBYTES !== $type && \GRAPHEME_EXTR_MAXCHARS !== $type) {
  63189. if (80000 > \PHP_VERSION_ID) {
  63190. return false;
  63191. }
  63192. throw new \ValueError('grapheme_extract(): Argument #3 ($type) must be one of GRAPHEME_EXTR_COUNT, GRAPHEME_EXTR_MAXBYTES, or GRAPHEME_EXTR_MAXCHARS');
  63193. }
  63194. if (!isset($s[0]) || 0 > $size || 0 > $start) {
  63195. return false;
  63196. }
  63197. if (0 === $size) {
  63198. return '';
  63199. }
  63200. $next = $start;
  63201. $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
  63202. if (!isset($s[1])) {
  63203. return false;
  63204. }
  63205. $i = 1;
  63206. $ret = '';
  63207. do {
  63208. if (\GRAPHEME_EXTR_COUNT === $type) {
  63209. --$size;
  63210. } elseif (\GRAPHEME_EXTR_MAXBYTES === $type) {
  63211. $size -= \strlen($s[$i]);
  63212. } else {
  63213. $size -= iconv_strlen($s[$i], 'UTF-8//IGNORE');
  63214. }
  63215. if ($size >= 0) {
  63216. $ret .= $s[$i];
  63217. }
  63218. } while (isset($s[++$i]) && $size > 0);
  63219. $next += \strlen($ret);
  63220. return $ret;
  63221. }
  63222. public static function grapheme_strlen($s)
  63223. {
  63224. preg_replace('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', '', $s, -1, $len);
  63225. return 0 === $len && '' !== $s ? null : $len;
  63226. }
  63227. public static function grapheme_substr($s, $start, $len = null)
  63228. {
  63229. if (null === $len) {
  63230. $len = 2147483647;
  63231. }
  63232. preg_match_all('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', $s, $s);
  63233. $slen = \count($s[0]);
  63234. $start = (int) $start;
  63235. if (0 > $start) {
  63236. $start += $slen;
  63237. }
  63238. if (0 > $start) {
  63239. if (\PHP_VERSION_ID < 80000) {
  63240. return false;
  63241. }
  63242. $start = 0;
  63243. }
  63244. if ($start >= $slen) {
  63245. return \PHP_VERSION_ID >= 80000 ? '' : false;
  63246. }
  63247. $rem = $slen - $start;
  63248. if (0 > $len) {
  63249. $len += $rem;
  63250. }
  63251. if (0 === $len) {
  63252. return '';
  63253. }
  63254. if (0 > $len) {
  63255. return \PHP_VERSION_ID >= 80000 ? '' : false;
  63256. }
  63257. if ($len > $rem) {
  63258. $len = $rem;
  63259. }
  63260. return implode('', \array_slice($s[0], $start, $len));
  63261. }
  63262. public static function grapheme_strpos($s, $needle, $offset = 0)
  63263. {
  63264. return self::grapheme_position($s, $needle, $offset, 0);
  63265. }
  63266. public static function grapheme_stripos($s, $needle, $offset = 0)
  63267. {
  63268. return self::grapheme_position($s, $needle, $offset, 1);
  63269. }
  63270. public static function grapheme_strrpos($s, $needle, $offset = 0)
  63271. {
  63272. return self::grapheme_position($s, $needle, $offset, 2);
  63273. }
  63274. public static function grapheme_strripos($s, $needle, $offset = 0)
  63275. {
  63276. return self::grapheme_position($s, $needle, $offset, 3);
  63277. }
  63278. public static function grapheme_stristr($s, $needle, $beforeNeedle = false)
  63279. {
  63280. return mb_stristr($s, $needle, $beforeNeedle, 'UTF-8');
  63281. }
  63282. public static function grapheme_strstr($s, $needle, $beforeNeedle = false)
  63283. {
  63284. return mb_strstr($s, $needle, $beforeNeedle, 'UTF-8');
  63285. }
  63286. private static function grapheme_position($s, $needle, $offset, $mode)
  63287. {
  63288. $needle = (string) $needle;
  63289. if (80000 > \PHP_VERSION_ID && !preg_match('/./us', $needle)) {
  63290. return false;
  63291. }
  63292. $s = (string) $s;
  63293. if (!preg_match('/./us', $s)) {
  63294. return false;
  63295. }
  63296. if ($offset > 0) {
  63297. $s = self::grapheme_substr($s, $offset);
  63298. } elseif ($offset < 0) {
  63299. if (2 > $mode) {
  63300. $offset += self::grapheme_strlen($s);
  63301. $s = self::grapheme_substr($s, $offset);
  63302. if (0 > $offset) {
  63303. $offset = 0;
  63304. }
  63305. } elseif (0 > $offset += self::grapheme_strlen($needle)) {
  63306. $s = self::grapheme_substr($s, 0, $offset);
  63307. $offset = 0;
  63308. } else {
  63309. $offset = 0;
  63310. }
  63311. }
  63312. $caseInsensitive = $mode & 1;
  63313. $reverse = $mode & 2;
  63314. if ($caseInsensitive) {
  63315. $mode = \defined('MB_CASE_FOLD_SIMPLE') ? \MB_CASE_FOLD_SIMPLE : \MB_CASE_LOWER;
  63316. $s = mb_convert_case($s, $mode, 'UTF-8');
  63317. $needle = mb_convert_case($needle, $mode, 'UTF-8');
  63318. if (!\defined('MB_CASE_FOLD_SIMPLE')) {
  63319. $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
  63320. $needle = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $needle);
  63321. }
  63322. }
  63323. if ($reverse) {
  63324. $needlePos = strrpos($s, $needle);
  63325. } else {
  63326. $needlePos = strpos($s, $needle);
  63327. }
  63328. return false !== $needlePos ? self::grapheme_strlen(substr($s, 0, $needlePos)) + $offset : false;
  63329. }
  63330. }
  63331. Copyright (c) 2015-2019 Fabien Potencier
  63332. Permission is hereby granted, free of charge, to any person obtaining a copy
  63333. of this software and associated documentation files (the "Software"), to deal
  63334. in the Software without restriction, including without limitation the rights
  63335. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  63336. copies of the Software, and to permit persons to whom the Software is furnished
  63337. to do so, subject to the following conditions:
  63338. The above copyright notice and this permission notice shall be included in all
  63339. copies or substantial portions of the Software.
  63340. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  63341. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  63342. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  63343. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  63344. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  63345. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  63346. THE SOFTWARE.
  63347. <?php
  63348. use Symfony\Polyfill\Intl\Grapheme as p;
  63349. if (extension_loaded('intl')) {
  63350. return;
  63351. }
  63352. if (\PHP_VERSION_ID >= 80000) {
  63353. return require __DIR__.'/bootstrap80.php';
  63354. }
  63355. if (!defined('GRAPHEME_EXTR_COUNT')) {
  63356. define('GRAPHEME_EXTR_COUNT', 0);
  63357. }
  63358. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  63359. define('GRAPHEME_EXTR_MAXBYTES', 1);
  63360. }
  63361. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  63362. define('GRAPHEME_EXTR_MAXCHARS', 2);
  63363. }
  63364. if (!function_exists('grapheme_extract')) {
  63365. function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); }
  63366. }
  63367. if (!function_exists('grapheme_stripos')) {
  63368. function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); }
  63369. }
  63370. if (!function_exists('grapheme_stristr')) {
  63371. function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); }
  63372. }
  63373. if (!function_exists('grapheme_strlen')) {
  63374. function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); }
  63375. }
  63376. if (!function_exists('grapheme_strpos')) {
  63377. function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); }
  63378. }
  63379. if (!function_exists('grapheme_strripos')) {
  63380. function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); }
  63381. }
  63382. if (!function_exists('grapheme_strrpos')) {
  63383. function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); }
  63384. }
  63385. if (!function_exists('grapheme_strstr')) {
  63386. function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); }
  63387. }
  63388. if (!function_exists('grapheme_substr')) {
  63389. function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); }
  63390. }
  63391. <?php
  63392. use Symfony\Polyfill\Intl\Grapheme as p;
  63393. if (!defined('GRAPHEME_EXTR_COUNT')) {
  63394. define('GRAPHEME_EXTR_COUNT', 0);
  63395. }
  63396. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  63397. define('GRAPHEME_EXTR_MAXBYTES', 1);
  63398. }
  63399. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  63400. define('GRAPHEME_EXTR_MAXCHARS', 2);
  63401. }
  63402. if (!function_exists('grapheme_extract')) {
  63403. function grapheme_extract(?string $haystack, ?int $size, ?int $type = GRAPHEME_EXTR_COUNT, ?int $offset = 0, &$next = null): string|false { return p\Grapheme::grapheme_extract((string) $haystack, (int) $size, (int) $type, (int) $offset, $next); }
  63404. }
  63405. if (!function_exists('grapheme_stripos')) {
  63406. function grapheme_stripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_stripos((string) $haystack, (string) $needle, (int) $offset); }
  63407. }
  63408. if (!function_exists('grapheme_stristr')) {
  63409. function grapheme_stristr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_stristr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  63410. }
  63411. if (!function_exists('grapheme_strlen')) {
  63412. function grapheme_strlen(?string $string): int|false|null { return p\Grapheme::grapheme_strlen((string) $string); }
  63413. }
  63414. if (!function_exists('grapheme_strpos')) {
  63415. function grapheme_strpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strpos((string) $haystack, (string) $needle, (int) $offset); }
  63416. }
  63417. if (!function_exists('grapheme_strripos')) {
  63418. function grapheme_strripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strripos((string) $haystack, (string) $needle, (int) $offset); }
  63419. }
  63420. if (!function_exists('grapheme_strrpos')) {
  63421. function grapheme_strrpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strrpos((string) $haystack, (string) $needle, (int) $offset); }
  63422. }
  63423. if (!function_exists('grapheme_strstr')) {
  63424. function grapheme_strstr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_strstr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  63425. }
  63426. if (!function_exists('grapheme_substr')) {
  63427. function grapheme_substr(?string $string, ?int $offset, ?int $length = null): string|false { return p\Grapheme::grapheme_substr((string) $string, (int) $offset, $length); }
  63428. }
  63429. Copyright (c) 2015-2019 Fabien Potencier
  63430. Permission is hereby granted, free of charge, to any person obtaining a copy
  63431. of this software and associated documentation files (the "Software"), to deal
  63432. in the Software without restriction, including without limitation the rights
  63433. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  63434. copies of the Software, and to permit persons to whom the Software is furnished
  63435. to do so, subject to the following conditions:
  63436. The above copyright notice and this permission notice shall be included in all
  63437. copies or substantial portions of the Software.
  63438. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  63439. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  63440. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  63441. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  63442. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  63443. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  63444. THE SOFTWARE.
  63445. <?php
  63446. namespace Symfony\Polyfill\Intl\Normalizer;
  63447. class Normalizer
  63448. {
  63449. public const FORM_D = \Normalizer::FORM_D;
  63450. public const FORM_KD = \Normalizer::FORM_KD;
  63451. public const FORM_C = \Normalizer::FORM_C;
  63452. public const FORM_KC = \Normalizer::FORM_KC;
  63453. public const NFD = \Normalizer::NFD;
  63454. public const NFKD = \Normalizer::NFKD;
  63455. public const NFC = \Normalizer::NFC;
  63456. public const NFKC = \Normalizer::NFKC;
  63457. private static $C;
  63458. private static $D;
  63459. private static $KD;
  63460. private static $cC;
  63461. private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  63462. private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  63463. public static function isNormalized(string $s, int $form = self::FORM_C)
  63464. {
  63465. if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) {
  63466. return false;
  63467. }
  63468. if (!isset($s[strspn($s, self::$ASCII)])) {
  63469. return true;
  63470. }
  63471. if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) {
  63472. return true;
  63473. }
  63474. return self::normalize($s, $form) === $s;
  63475. }
  63476. public static function normalize(string $s, int $form = self::FORM_C)
  63477. {
  63478. if (!preg_match('//u', $s)) {
  63479. return false;
  63480. }
  63481. switch ($form) {
  63482. case self::NFC: $C = true; $K = false; break;
  63483. case self::NFD: $C = false; $K = false; break;
  63484. case self::NFKC: $C = true; $K = true; break;
  63485. case self::NFKD: $C = false; $K = true; break;
  63486. default:
  63487. if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) {
  63488. return $s;
  63489. }
  63490. if (80000 > \PHP_VERSION_ID) {
  63491. return false;
  63492. }
  63493. throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form');
  63494. }
  63495. if ('' === $s) {
  63496. return '';
  63497. }
  63498. if ($K && null === self::$KD) {
  63499. self::$KD = self::getData('compatibilityDecomposition');
  63500. }
  63501. if (null === self::$D) {
  63502. self::$D = self::getData('canonicalDecomposition');
  63503. self::$cC = self::getData('combiningClass');
  63504. }
  63505. if (null !== $mbEncoding = (2 & (int) ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) {
  63506. mb_internal_encoding('8bit');
  63507. }
  63508. $r = self::decompose($s, $K);
  63509. if ($C) {
  63510. if (null === self::$C) {
  63511. self::$C = self::getData('canonicalComposition');
  63512. }
  63513. $r = self::recompose($r);
  63514. }
  63515. if (null !== $mbEncoding) {
  63516. mb_internal_encoding($mbEncoding);
  63517. }
  63518. return $r;
  63519. }
  63520. private static function recompose($s)
  63521. {
  63522. $ASCII = self::$ASCII;
  63523. $compMap = self::$C;
  63524. $combClass = self::$cC;
  63525. $ulenMask = self::$ulenMask;
  63526. $result = $tail = '';
  63527. $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"];
  63528. $len = \strlen($s);
  63529. $lastUchr = substr($s, 0, $i);
  63530. $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0;
  63531. while ($i < $len) {
  63532. if ($s[$i] < "\x80") {
  63533. if ($tail) {
  63534. $lastUchr .= $tail;
  63535. $tail = '';
  63536. }
  63537. if ($j = strspn($s, $ASCII, $i + 1)) {
  63538. $lastUchr .= substr($s, $i, $j);
  63539. $i += $j;
  63540. }
  63541. $result .= $lastUchr;
  63542. $lastUchr = $s[$i];
  63543. $lastUcls = 0;
  63544. ++$i;
  63545. continue;
  63546. }
  63547. $ulen = $ulenMask[$s[$i] & "\xF0"];
  63548. $uchr = substr($s, $i, $ulen);
  63549. if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr
  63550. || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr
  63551. || $lastUcls) {
  63552. $ucls = $combClass[$uchr] ?? 0;
  63553. if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) {
  63554. $lastUchr = $compMap[$lastUchr.$uchr];
  63555. } elseif ($lastUcls = $ucls) {
  63556. $tail .= $uchr;
  63557. } else {
  63558. if ($tail) {
  63559. $lastUchr .= $tail;
  63560. $tail = '';
  63561. }
  63562. $result .= $lastUchr;
  63563. $lastUchr = $uchr;
  63564. }
  63565. } else {
  63566. $L = \ord($lastUchr[2]) - 0x80;
  63567. $V = \ord($uchr[2]) - 0xA1;
  63568. $T = 0;
  63569. $uchr = substr($s, $i + $ulen, 3);
  63570. if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") {
  63571. $T = \ord($uchr[2]) - 0xA7;
  63572. 0 > $T && $T += 0x40;
  63573. $ulen += 3;
  63574. }
  63575. $L = 0xAC00 + ($L * 21 + $V) * 28 + $T;
  63576. $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F);
  63577. }
  63578. $i += $ulen;
  63579. }
  63580. return $result.$lastUchr.$tail;
  63581. }
  63582. private static function decompose($s, $c)
  63583. {
  63584. $result = '';
  63585. $ASCII = self::$ASCII;
  63586. $decompMap = self::$D;
  63587. $combClass = self::$cC;
  63588. $ulenMask = self::$ulenMask;
  63589. if ($c) {
  63590. $compatMap = self::$KD;
  63591. }
  63592. $c = [];
  63593. $i = 0;
  63594. $len = \strlen($s);
  63595. while ($i < $len) {
  63596. if ($s[$i] < "\x80") {
  63597. if ($c) {
  63598. ksort($c);
  63599. $result .= implode('', $c);
  63600. $c = [];
  63601. }
  63602. $j = 1 + strspn($s, $ASCII, $i + 1);
  63603. $result .= substr($s, $i, $j);
  63604. $i += $j;
  63605. continue;
  63606. }
  63607. $ulen = $ulenMask[$s[$i] & "\xF0"];
  63608. $uchr = substr($s, $i, $ulen);
  63609. $i += $ulen;
  63610. if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) {
  63611. if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) {
  63612. $uchr = $j;
  63613. $j = \strlen($uchr);
  63614. $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"];
  63615. if ($ulen != $j) {
  63616. $j -= $ulen;
  63617. $i -= $j;
  63618. if (0 > $i) {
  63619. $s = str_repeat(' ', -$i).$s;
  63620. $len -= $i;
  63621. $i = 0;
  63622. }
  63623. while ($j--) {
  63624. $s[$i + $j] = $uchr[$ulen + $j];
  63625. }
  63626. $uchr = substr($uchr, 0, $ulen);
  63627. }
  63628. }
  63629. if (isset($combClass[$uchr])) {
  63630. if (!isset($c[$combClass[$uchr]])) {
  63631. $c[$combClass[$uchr]] = '';
  63632. }
  63633. $c[$combClass[$uchr]] .= $uchr;
  63634. continue;
  63635. }
  63636. } else {
  63637. $uchr = unpack('C*', $uchr);
  63638. $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80;
  63639. $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588))
  63640. ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28));
  63641. if ($j %= 28) {
  63642. $uchr .= $j < 25
  63643. ? ("\xE1\x86".\chr(0xA7 + $j))
  63644. : ("\xE1\x87".\chr(0x67 + $j));
  63645. }
  63646. }
  63647. if ($c) {
  63648. ksort($c);
  63649. $result .= implode('', $c);
  63650. $c = [];
  63651. }
  63652. $result .= $uchr;
  63653. }
  63654. if ($c) {
  63655. ksort($c);
  63656. $result .= implode('', $c);
  63657. }
  63658. return $result;
  63659. }
  63660. private static function getData($file)
  63661. {
  63662. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  63663. return require $file;
  63664. }
  63665. return false;
  63666. }
  63667. }
  63668. <?php
  63669. class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer
  63670. {
  63671. public const NONE = 2;
  63672. public const FORM_D = 4;
  63673. public const FORM_KD = 8;
  63674. public const FORM_C = 16;
  63675. public const FORM_KC = 32;
  63676. public const NFD = 4;
  63677. public const NFKD = 8;
  63678. public const NFC = 16;
  63679. public const NFKC = 32;
  63680. }
  63681. <?php
  63682. return array (
  63683. 'À' => 'À',
  63684. 'A�' => '�',
  63685. 'Â' => 'Â',
  63686. 'Ã' => 'Ã',
  63687. 'Ä' => 'Ä',
  63688. 'AÌŠ' => 'Ã…',
  63689. 'Ç' => 'Ç',
  63690. 'È' => 'È',
  63691. 'E�' => 'É',
  63692. 'Ê' => 'Ê',
  63693. 'Ë' => 'Ë',
  63694. 'Ì' => 'Ì',
  63695. 'I�' => '�',
  63696. 'IÌ‚' => 'ÃŽ',
  63697. 'Ï' => '�',
  63698. 'Ñ' => 'Ñ',
  63699. 'OÌ€' => 'Ã’',
  63700. 'O�' => 'Ó',
  63701. 'Ô' => 'Ô',
  63702. 'Õ' => 'Õ',
  63703. 'Ö' => 'Ö',
  63704. 'Ù' => 'Ù',
  63705. 'U�' => 'Ú',
  63706. 'Û' => 'Û',
  63707. 'Ü' => 'Ü',
  63708. 'Y�' => '�',
  63709. 'à' => 'à',
  63710. 'a�' => 'á',
  63711. 'â' => 'â',
  63712. 'ã' => 'ã',
  63713. 'ä' => 'ä',
  63714. 'aÌŠ' => 'Ã¥',
  63715. 'ç' => 'ç',
  63716. 'è' => 'è',
  63717. 'e�' => 'é',
  63718. 'ê' => 'ê',
  63719. 'ë' => 'ë',
  63720. 'ì' => 'ì',
  63721. 'i�' => 'í',
  63722. 'î' => 'î',
  63723. 'ï' => 'ï',
  63724. 'ñ' => 'ñ',
  63725. 'ò' => 'ò',
  63726. 'o�' => 'ó',
  63727. 'ô' => 'ô',
  63728. 'õ' => 'õ',
  63729. 'ö' => 'ö',
  63730. 'ù' => 'ù',
  63731. 'u�' => 'ú',
  63732. 'û' => 'û',
  63733. 'ü' => 'ü',
  63734. 'y�' => 'ý',
  63735. 'ÿ' => 'ÿ',
  63736. 'AÌ„' => 'Ä€',
  63737. 'ā' => '�',
  63738. 'Ă' => 'Ă',
  63739. 'ă' => 'ă',
  63740. 'Ą' => 'Ą',
  63741. 'ą' => 'ą',
  63742. 'C�' => 'Ć',
  63743. 'c�' => 'ć',
  63744. 'Ĉ' => 'Ĉ',
  63745. 'ĉ' => 'ĉ',
  63746. 'Ċ' => 'Ċ',
  63747. 'ċ' => 'ċ',
  63748. 'Č' => 'Č',
  63749. 'č' => '�',
  63750. 'Ď' => 'Ď',
  63751. 'ď' => '�',
  63752. 'EÌ„' => 'Ä’',
  63753. 'ē' => 'ē',
  63754. 'Ĕ' => 'Ĕ',
  63755. 'ĕ' => 'ĕ',
  63756. 'Ė' => 'Ė',
  63757. 'ė' => 'ė',
  63758. 'Ę' => 'Ę',
  63759. 'ę' => 'ę',
  63760. 'Ě' => 'Ě',
  63761. 'ě' => 'ě',
  63762. 'Ĝ' => 'Ĝ',
  63763. 'ĝ' => '�',
  63764. 'Ğ' => 'Ğ',
  63765. 'ğ' => 'ğ',
  63766. 'Ġ' => 'Ġ',
  63767. 'ġ' => 'ġ',
  63768. 'Ģ' => 'Ģ',
  63769. 'ģ' => 'ģ',
  63770. 'Ĥ' => 'Ĥ',
  63771. 'ĥ' => 'ĥ',
  63772. 'Ĩ' => 'Ĩ',
  63773. 'ĩ' => 'ĩ',
  63774. 'Ī' => 'Ī',
  63775. 'ī' => 'ī',
  63776. 'Ĭ' => 'Ĭ',
  63777. 'ĭ' => 'ĭ',
  63778. 'Į' => 'Į',
  63779. 'į' => 'į',
  63780. 'İ' => 'İ',
  63781. 'JÌ‚' => 'Ä´',
  63782. 'ĵ' => 'ĵ',
  63783. 'Ķ' => 'Ķ',
  63784. 'ķ' => 'ķ',
  63785. 'L�' => 'Ĺ',
  63786. 'l�' => 'ĺ',
  63787. 'Ļ' => 'Ļ',
  63788. 'ļ' => 'ļ',
  63789. 'Ľ' => 'Ľ',
  63790. 'ľ' => 'ľ',
  63791. 'N�' => 'Ń',
  63792. 'n�' => 'ń',
  63793. 'Ņ' => 'Ņ',
  63794. 'ņ' => 'ņ',
  63795. 'Ň' => 'Ň',
  63796. 'ň' => 'ň',
  63797. 'Ō' => 'Ō',
  63798. 'ō' => '�',
  63799. 'Ŏ' => 'Ŏ',
  63800. 'ŏ' => '�',
  63801. 'Ő' => '�',
  63802. 'ő' => 'ő',
  63803. 'R�' => 'Ŕ',
  63804. 'r�' => 'ŕ',
  63805. 'Ŗ' => 'Ŗ',
  63806. 'ŗ' => 'ŗ',
  63807. 'Ř' => 'Ř',
  63808. 'ř' => 'ř',
  63809. 'S�' => 'Ś',
  63810. 's�' => 'ś',
  63811. 'Ŝ' => 'Ŝ',
  63812. 'ŝ' => '�',
  63813. 'Ş' => 'Ş',
  63814. 'ş' => 'ş',
  63815. 'Š' => 'Š',
  63816. 'š' => 'š',
  63817. 'Ţ' => 'Ţ',
  63818. 'ţ' => 'ţ',
  63819. 'Ť' => 'Ť',
  63820. 'ť' => 'ť',
  63821. 'Ũ' => 'Ũ',
  63822. 'ũ' => 'ũ',
  63823. 'Ū' => 'Ū',
  63824. 'ū' => 'ū',
  63825. 'Ŭ' => 'Ŭ',
  63826. 'ŭ' => 'ŭ',
  63827. 'UÌŠ' => 'Å®',
  63828. 'ů' => 'ů',
  63829. 'UÌ‹' => 'Å°',
  63830. 'ű' => 'ű',
  63831. 'Ų' => 'Ų',
  63832. 'ų' => 'ų',
  63833. 'WÌ‚' => 'Å´',
  63834. 'ŵ' => 'ŵ',
  63835. 'Ŷ' => 'Ŷ',
  63836. 'ŷ' => 'ŷ',
  63837. 'Ÿ' => 'Ÿ',
  63838. 'Z�' => 'Ź',
  63839. 'z�' => 'ź',
  63840. 'Ż' => 'Ż',
  63841. 'ż' => 'ż',
  63842. 'Ž' => 'Ž',
  63843. 'ž' => 'ž',
  63844. 'OÌ›' => 'Æ ',
  63845. 'oÌ›' => 'Æ¡',
  63846. 'Ư' => 'Ư',
  63847. 'uÌ›' => 'Æ°',
  63848. 'Ǎ' => '�',
  63849. 'ǎ' => 'ǎ',
  63850. 'Ǐ' => '�',
  63851. 'ǐ' => '�',
  63852. 'Ǒ' => 'Ǒ',
  63853. 'ǒ' => 'ǒ',
  63854. 'Ǔ' => 'Ǔ',
  63855. 'ǔ' => 'ǔ',
  63856. 'Ǖ' => 'Ǖ',
  63857. 'ǖ' => 'ǖ',
  63858. 'Ü�' => 'Ǘ',
  63859. 'ü�' => 'ǘ',
  63860. 'Ǚ' => 'Ǚ',
  63861. 'ǚ' => 'ǚ',
  63862. 'Ǜ' => 'Ǜ',
  63863. 'ǜ' => 'ǜ',
  63864. 'Ǟ' => 'Ǟ',
  63865. 'ǟ' => 'ǟ',
  63866. 'Ǡ' => 'Ǡ',
  63867. 'ǡ' => 'ǡ',
  63868. 'Ǣ' => 'Ǣ',
  63869. 'ǣ' => 'ǣ',
  63870. 'Ǧ' => 'Ǧ',
  63871. 'ǧ' => 'ǧ',
  63872. 'Ǩ' => 'Ǩ',
  63873. 'ǩ' => 'ǩ',
  63874. 'Ǫ' => 'Ǫ',
  63875. 'ǫ' => 'ǫ',
  63876. 'Ǭ' => 'Ǭ',
  63877. 'Ç«Ì„' => 'Ç­',
  63878. 'Ǯ' => 'Ǯ',
  63879. 'ǯ' => 'ǯ',
  63880. 'ǰ' => 'ǰ',
  63881. 'G�' => 'Ǵ',
  63882. 'g�' => 'ǵ',
  63883. 'Ǹ' => 'Ǹ',
  63884. 'ǹ' => 'ǹ',
  63885. 'Å�' => 'Ǻ',
  63886. 'å�' => 'ǻ',
  63887. 'Æ�' => 'Ǽ',
  63888. 'æ�' => 'ǽ',
  63889. 'Ø�' => 'Ǿ',
  63890. 'ø�' => 'ǿ',
  63891. 'A�' => 'Ȁ',
  63892. 'a�' => '�',
  63893. 'AÌ‘' => 'È‚',
  63894. 'ȃ' => 'ȃ',
  63895. 'E�' => 'Ȅ',
  63896. 'e�' => 'ȅ',
  63897. 'Ȇ' => 'Ȇ',
  63898. 'ȇ' => 'ȇ',
  63899. 'I�' => 'Ȉ',
  63900. 'i�' => 'ȉ',
  63901. 'IÌ‘' => 'ÈŠ',
  63902. 'ȋ' => 'ȋ',
  63903. 'O�' => 'Ȍ',
  63904. 'o�' => '�',
  63905. 'OÌ‘' => 'ÈŽ',
  63906. 'ȏ' => '�',
  63907. 'R�' => '�',
  63908. 'r�' => 'ȑ',
  63909. 'RÌ‘' => 'È’',
  63910. 'ȓ' => 'ȓ',
  63911. 'U�' => 'Ȕ',
  63912. 'u�' => 'ȕ',
  63913. 'UÌ‘' => 'È–',
  63914. 'ȗ' => 'ȗ',
  63915. 'Ș' => 'Ș',
  63916. 'ș' => 'ș',
  63917. 'Ț' => 'Ț',
  63918. 'ț' => 'ț',
  63919. 'Ȟ' => 'Ȟ',
  63920. 'ȟ' => 'ȟ',
  63921. 'Ȧ' => 'Ȧ',
  63922. 'ȧ' => 'ȧ',
  63923. 'Ȩ' => 'Ȩ',
  63924. 'ȩ' => 'ȩ',
  63925. 'Ȫ' => 'Ȫ',
  63926. 'ȫ' => 'ȫ',
  63927. 'Ȭ' => 'Ȭ',
  63928. 'ȭ' => 'ȭ',
  63929. 'Ȯ' => 'Ȯ',
  63930. 'ȯ' => 'ȯ',
  63931. 'Ȱ' => 'Ȱ',
  63932. 'ȱ' => 'ȱ',
  63933. 'Ȳ' => 'Ȳ',
  63934. 'ȳ' => 'ȳ',
  63935. '¨�' => '΅',
  63936. 'Α�' => 'Ά',
  63937. 'Ε�' => 'Έ',
  63938. 'Η�' => 'Ή',
  63939. 'Ι�' => 'Ί',
  63940. 'Ο�' => 'Ό',
  63941. 'Υ�' => 'Ύ',
  63942. 'Ω�' => '�',
  63943. 'ϊ�' => '�',
  63944. 'Ϊ' => 'Ϊ',
  63945. 'Ϋ' => 'Ϋ',
  63946. 'α�' => 'ά',
  63947. 'ε�' => 'έ',
  63948. 'η�' => 'ή',
  63949. 'ι�' => 'ί',
  63950. 'ϋ�' => 'ΰ',
  63951. 'ϊ' => 'ϊ',
  63952. 'ϋ' => 'ϋ',
  63953. 'ο�' => 'ό',
  63954. 'υ�' => '�',
  63955. 'ω�' => 'ώ',
  63956. 'ϒ�' => 'ϓ',
  63957. 'ϔ' => 'ϔ',
  63958. 'Ѐ' => 'Ѐ',
  63959. 'Ё' => '�',
  63960. 'Г�' => 'Ѓ',
  63961. 'Ї' => 'Ї',
  63962. 'К�' => 'Ќ',
  63963. 'Ѝ' => '�',
  63964. 'Ў' => 'Ў',
  63965. 'Й' => 'Й',
  63966. 'й' => 'й',
  63967. 'ѐ' => '�',
  63968. 'ё' => 'ё',
  63969. 'г�' => 'ѓ',
  63970. 'ї' => 'ї',
  63971. 'к�' => 'ќ',
  63972. 'ѝ' => '�',
  63973. 'ў' => 'ў',
  63974. 'Ѵ�' => 'Ѷ',
  63975. 'ѵ�' => 'ѷ',
  63976. 'Ӂ' => '�',
  63977. 'ӂ' => 'ӂ',
  63978. '�̆' => '�',
  63979. 'ӑ' => 'ӑ',
  63980. '�̈' => 'Ӓ',
  63981. 'ӓ' => 'ӓ',
  63982. 'Ӗ' => 'Ӗ',
  63983. 'ӗ' => 'ӗ',
  63984. 'Ӛ' => 'Ӛ',
  63985. 'ӛ' => 'ӛ',
  63986. 'Ӝ' => 'Ӝ',
  63987. 'ӝ' => '�',
  63988. 'Ӟ' => 'Ӟ',
  63989. 'ӟ' => 'ӟ',
  63990. 'Ӣ' => 'Ӣ',
  63991. 'ӣ' => 'ӣ',
  63992. 'Ӥ' => 'Ӥ',
  63993. 'ӥ' => 'ӥ',
  63994. 'Ӧ' => 'Ӧ',
  63995. 'ӧ' => 'ӧ',
  63996. 'Ӫ' => 'Ӫ',
  63997. 'ӫ' => 'ӫ',
  63998. 'Ӭ' => 'Ӭ',
  63999. '�̈' => 'ӭ',
  64000. 'Ӯ' => 'Ӯ',
  64001. 'ӯ' => 'ӯ',
  64002. 'Ӱ' => 'Ӱ',
  64003. 'ӱ' => 'ӱ',
  64004. 'Ӳ' => 'Ӳ',
  64005. 'ӳ' => 'ӳ',
  64006. 'Ӵ' => 'Ӵ',
  64007. 'ӵ' => 'ӵ',
  64008. 'Ӹ' => 'Ӹ',
  64009. 'ӹ' => 'ӹ',
  64010. 'آ' => 'آ',
  64011. 'أ' => 'أ',
  64012. 'ؤ' => 'ؤ',
  64013. 'إ' => 'إ',
  64014. 'ئ' => 'ئ',
  64015. 'Û•Ù”' => 'Û€',
  64016. 'Û�Ù”' => 'Û‚',
  64017. 'Û’Ù”' => 'Û“',
  64018. 'ऩ' => 'ऩ',
  64019. 'ऱ' => 'ऱ',
  64020. 'ऴ' => 'ऴ',
  64021. 'ো' => 'ো',
  64022. 'ৌ' => 'ৌ',
  64023. 'ୈ' => 'ୈ',
  64024. 'ୋ' => 'ୋ',
  64025. 'ୌ' => 'ୌ',
  64026. 'ஔ' => 'ஔ',
  64027. 'ொ' => 'ொ',
  64028. 'ோ' => 'ோ',
  64029. 'ௌ' => 'ௌ',
  64030. 'ై' => 'ై',
  64031. 'ೀ' => 'ೀ',
  64032. 'ೇ' => 'ೇ',
  64033. 'ೈ' => 'ೈ',
  64034. 'ೊ' => 'ೊ',
  64035. 'ೋ' => 'ೋ',
  64036. 'ൊ' => 'ൊ',
  64037. 'ോ' => 'ോ',
  64038. 'ൌ' => 'ൌ',
  64039. 'ේ' => 'ේ',
  64040. 'ෙ�' => 'ො',
  64041. 'ෝ' => '�',
  64042. 'ෞ' => 'ෞ',
  64043. 'ဦ' => 'ဦ',
  64044. 'ᬆ' => 'ᬆ',
  64045. 'ᬈ' => 'ᬈ',
  64046. 'ᬊ' => 'ᬊ',
  64047. 'ᬌ' => 'ᬌ',
  64048. '�ᬵ' => 'ᬎ',
  64049. 'ᬒ' => 'ᬒ',
  64050. 'ᬻ' => 'ᬻ',
  64051. 'ᬽ' => 'ᬽ',
  64052. 'ᭀ' => 'ᭀ',
  64053. 'ᭁ' => '�',
  64054. 'ᭃ' => 'ᭃ',
  64055. 'Ḁ' => 'Ḁ',
  64056. 'ḁ' => '�',
  64057. 'Ḃ' => 'Ḃ',
  64058. 'ḃ' => 'ḃ',
  64059. 'Ḅ' => 'Ḅ',
  64060. 'ḅ' => 'ḅ',
  64061. 'Ḇ' => 'Ḇ',
  64062. 'ḇ' => 'ḇ',
  64063. 'Ç�' => 'Ḉ',
  64064. 'ç�' => 'ḉ',
  64065. 'Ḋ' => 'Ḋ',
  64066. 'ḋ' => 'ḋ',
  64067. 'Ḍ' => 'Ḍ',
  64068. 'ḍ' => '�',
  64069. 'Ḏ' => 'Ḏ',
  64070. 'ḏ' => '�',
  64071. 'Ḑ' => '�',
  64072. 'ḑ' => 'ḑ',
  64073. 'Ḓ' => 'Ḓ',
  64074. 'ḓ' => 'ḓ',
  64075. 'Ḕ' => 'Ḕ',
  64076. 'ḕ' => 'ḕ',
  64077. 'Ē�' => 'Ḗ',
  64078. 'ē�' => 'ḗ',
  64079. 'Ḙ' => 'Ḙ',
  64080. 'ḙ' => 'ḙ',
  64081. 'Ḛ' => 'Ḛ',
  64082. 'ḛ' => 'ḛ',
  64083. 'Ḝ' => 'Ḝ',
  64084. 'ḝ' => '�',
  64085. 'Ḟ' => 'Ḟ',
  64086. 'ḟ' => 'ḟ',
  64087. 'Ḡ' => 'Ḡ',
  64088. 'ḡ' => 'ḡ',
  64089. 'Ḣ' => 'Ḣ',
  64090. 'ḣ' => 'ḣ',
  64091. 'Ḥ' => 'Ḥ',
  64092. 'ḥ' => 'ḥ',
  64093. 'Ḧ' => 'Ḧ',
  64094. 'ḧ' => 'ḧ',
  64095. 'Ḩ' => 'Ḩ',
  64096. 'ḩ' => 'ḩ',
  64097. 'Ḫ' => 'Ḫ',
  64098. 'ḫ' => 'ḫ',
  64099. 'Ḭ' => 'Ḭ',
  64100. 'ḭ' => 'ḭ',
  64101. '��' => 'Ḯ',
  64102. 'ï�' => 'ḯ',
  64103. 'K�' => 'Ḱ',
  64104. 'k�' => 'ḱ',
  64105. 'Ḳ' => 'Ḳ',
  64106. 'ḳ' => 'ḳ',
  64107. 'Ḵ' => 'Ḵ',
  64108. 'ḵ' => 'ḵ',
  64109. 'Ḷ' => 'Ḷ',
  64110. 'ḷ' => 'ḷ',
  64111. 'Ḹ' => 'Ḹ',
  64112. 'ḹ' => 'ḹ',
  64113. 'Ḻ' => 'Ḻ',
  64114. 'ḻ' => 'ḻ',
  64115. 'Ḽ' => 'Ḽ',
  64116. 'ḽ' => 'ḽ',
  64117. 'M�' => 'Ḿ',
  64118. 'm�' => 'ḿ',
  64119. 'Ṁ' => 'Ṁ',
  64120. 'ṁ' => '�',
  64121. 'Ṃ' => 'Ṃ',
  64122. 'ṃ' => 'ṃ',
  64123. 'Ṅ' => 'Ṅ',
  64124. 'ṅ' => 'ṅ',
  64125. 'Ṇ' => 'Ṇ',
  64126. 'ṇ' => 'ṇ',
  64127. 'Ṉ' => 'Ṉ',
  64128. 'ṉ' => 'ṉ',
  64129. 'Ṋ' => 'Ṋ',
  64130. 'ṋ' => 'ṋ',
  64131. 'Õ�' => 'Ṍ',
  64132. 'õ�' => '�',
  64133. 'Ṏ' => 'Ṏ',
  64134. 'ṏ' => '�',
  64135. 'Ṑ' => '�',
  64136. '�̀' => 'ṑ',
  64137. 'Ō�' => 'Ṓ',
  64138. '��' => 'ṓ',
  64139. 'P�' => 'Ṕ',
  64140. 'p�' => 'ṕ',
  64141. 'Ṗ' => 'Ṗ',
  64142. 'ṗ' => 'ṗ',
  64143. 'Ṙ' => 'Ṙ',
  64144. 'ṙ' => 'ṙ',
  64145. 'Ṛ' => 'Ṛ',
  64146. 'ṛ' => 'ṛ',
  64147. 'Ṝ' => 'Ṝ',
  64148. 'ṝ' => '�',
  64149. 'Ṟ' => 'Ṟ',
  64150. 'ṟ' => 'ṟ',
  64151. 'Ṡ' => 'Ṡ',
  64152. 'ṡ' => 'ṡ',
  64153. 'SÌ£' => 'á¹¢',
  64154. 'ṣ' => 'ṣ',
  64155. 'Ṥ' => 'Ṥ',
  64156. 'ṥ' => 'ṥ',
  64157. 'Ṧ' => 'Ṧ',
  64158. 'ṧ' => 'ṧ',
  64159. 'Ṩ' => 'Ṩ',
  64160. 'ṩ' => 'ṩ',
  64161. 'Ṫ' => 'Ṫ',
  64162. 'ṫ' => 'ṫ',
  64163. 'Ṭ' => 'Ṭ',
  64164. 'ṭ' => 'ṭ',
  64165. 'Ṯ' => 'Ṯ',
  64166. 'ṯ' => 'ṯ',
  64167. 'TÌ­' => 'á¹°',
  64168. 'tÌ­' => 'á¹±',
  64169. 'Ṳ' => 'Ṳ',
  64170. 'ṳ' => 'ṳ',
  64171. 'UÌ°' => 'á¹´',
  64172. 'uÌ°' => 'á¹µ',
  64173. 'Ṷ' => 'Ṷ',
  64174. 'uÌ­' => 'á¹·',
  64175. 'Ũ�' => 'Ṹ',
  64176. 'ũ�' => 'ṹ',
  64177. 'Ṻ' => 'Ṻ',
  64178. 'ṻ' => 'ṻ',
  64179. 'Ṽ' => 'Ṽ',
  64180. 'ṽ' => 'ṽ',
  64181. 'VÌ£' => 'á¹¾',
  64182. 'ṿ' => 'ṿ',
  64183. 'Ẁ' => 'Ẁ',
  64184. 'ẁ' => '�',
  64185. 'W�' => 'Ẃ',
  64186. 'w�' => 'ẃ',
  64187. 'Ẅ' => 'Ẅ',
  64188. 'ẅ' => 'ẅ',
  64189. 'Ẇ' => 'Ẇ',
  64190. 'ẇ' => 'ẇ',
  64191. 'Ẉ' => 'Ẉ',
  64192. 'ẉ' => 'ẉ',
  64193. 'Ẋ' => 'Ẋ',
  64194. 'ẋ' => 'ẋ',
  64195. 'Ẍ' => 'Ẍ',
  64196. 'ẍ' => '�',
  64197. 'Ẏ' => 'Ẏ',
  64198. 'ẏ' => '�',
  64199. 'Ẑ' => '�',
  64200. 'ẑ' => 'ẑ',
  64201. 'Ẓ' => 'Ẓ',
  64202. 'ẓ' => 'ẓ',
  64203. 'Ẕ' => 'Ẕ',
  64204. 'ẕ' => 'ẕ',
  64205. 'ẖ' => 'ẖ',
  64206. 'ẗ' => 'ẗ',
  64207. 'ẘ' => 'ẘ',
  64208. 'ẙ' => 'ẙ',
  64209. 'ẛ' => 'ẛ',
  64210. 'Ạ' => 'Ạ',
  64211. 'ạ' => 'ạ',
  64212. 'Ả' => 'Ả',
  64213. 'ả' => 'ả',
  64214. 'Â�' => 'Ấ',
  64215. 'â�' => 'ấ',
  64216. 'Ầ' => 'Ầ',
  64217. 'ầ' => 'ầ',
  64218. 'Ẩ' => 'Ẩ',
  64219. 'ẩ' => 'ẩ',
  64220. 'Ẫ' => 'Ẫ',
  64221. 'ẫ' => 'ẫ',
  64222. 'Ậ' => 'Ậ',
  64223. 'ậ' => 'ậ',
  64224. 'Ă�' => 'Ắ',
  64225. 'ă�' => 'ắ',
  64226. 'Ằ' => 'Ằ',
  64227. 'ằ' => 'ằ',
  64228. 'Ẳ' => 'Ẳ',
  64229. 'ẳ' => 'ẳ',
  64230. 'Ẵ' => 'Ẵ',
  64231. 'ẵ' => 'ẵ',
  64232. 'Ặ' => 'Ặ',
  64233. 'ặ' => 'ặ',
  64234. 'Ẹ' => 'Ẹ',
  64235. 'ẹ' => 'ẹ',
  64236. 'Ẻ' => 'Ẻ',
  64237. 'ẻ' => 'ẻ',
  64238. 'Ẽ' => 'Ẽ',
  64239. 'ẽ' => 'ẽ',
  64240. 'Ê�' => 'Ế',
  64241. 'ê�' => 'ế',
  64242. 'Ề' => 'Ề',
  64243. 'ề' => '�',
  64244. 'Ể' => 'Ể',
  64245. 'ể' => 'ể',
  64246. 'Ễ' => 'Ễ',
  64247. 'ễ' => 'ễ',
  64248. 'Ệ' => 'Ệ',
  64249. 'ệ' => 'ệ',
  64250. 'Ỉ' => 'Ỉ',
  64251. 'ỉ' => 'ỉ',
  64252. 'Ị' => 'Ị',
  64253. 'ị' => 'ị',
  64254. 'Ọ' => 'Ọ',
  64255. 'ọ' => '�',
  64256. 'Ỏ' => 'Ỏ',
  64257. 'ỏ' => '�',
  64258. 'Ô�' => '�',
  64259. 'ô�' => 'ố',
  64260. 'Ồ' => 'Ồ',
  64261. 'ồ' => 'ồ',
  64262. 'Ổ' => 'Ổ',
  64263. 'ổ' => 'ổ',
  64264. 'Ỗ' => 'Ỗ',
  64265. 'ỗ' => 'ỗ',
  64266. 'Ộ' => 'Ộ',
  64267. '�̂' => 'ộ',
  64268. 'Ơ�' => 'Ớ',
  64269. 'ơ�' => 'ớ',
  64270. 'Ờ' => 'Ờ',
  64271. 'ờ' => '�',
  64272. 'Ở' => 'Ở',
  64273. 'ở' => 'ở',
  64274. 'Ỡ' => 'Ỡ',
  64275. 'ỡ' => 'ỡ',
  64276. 'Ợ' => 'Ợ',
  64277. 'ợ' => 'ợ',
  64278. 'Ụ' => 'Ụ',
  64279. 'ụ' => 'ụ',
  64280. 'Ủ' => 'Ủ',
  64281. 'ủ' => 'ủ',
  64282. 'Ư�' => 'Ứ',
  64283. 'ư�' => 'ứ',
  64284. 'Ừ' => 'Ừ',
  64285. 'ừ' => 'ừ',
  64286. 'Ử' => 'Ử',
  64287. 'ử' => 'ử',
  64288. 'Ữ' => 'Ữ',
  64289. 'ữ' => 'ữ',
  64290. 'Ự' => 'Ự',
  64291. 'Æ°Ì£' => 'á»±',
  64292. 'Ỳ' => 'Ỳ',
  64293. 'ỳ' => 'ỳ',
  64294. 'YÌ£' => 'á»´',
  64295. 'ỵ' => 'ỵ',
  64296. 'Ỷ' => 'Ỷ',
  64297. 'ỷ' => 'ỷ',
  64298. 'Ỹ' => 'Ỹ',
  64299. 'ỹ' => 'ỹ',
  64300. 'ἀ' => 'ἀ',
  64301. 'ἁ' => '�',
  64302. 'ἂ' => 'ἂ',
  64303. '�̀' => 'ἃ',
  64304. 'ἀ�' => 'ἄ',
  64305. '��' => 'ἅ',
  64306. 'ἆ' => 'ἆ',
  64307. '�͂' => 'ἇ',
  64308. 'Ἀ' => 'Ἀ',
  64309. 'Ἁ' => 'Ἁ',
  64310. 'Ἂ' => 'Ἂ',
  64311. 'Ἃ' => 'Ἃ',
  64312. 'Ἀ�' => 'Ἄ',
  64313. 'Ἁ�' => '�',
  64314. 'Ἆ' => 'Ἆ',
  64315. 'Ἇ' => '�',
  64316. 'ἐ' => '�',
  64317. 'ἑ' => 'ἑ',
  64318. '�̀' => 'ἒ',
  64319. 'ἓ' => 'ἓ',
  64320. '��' => 'ἔ',
  64321. 'ἑ�' => 'ἕ',
  64322. 'Ἐ' => 'Ἐ',
  64323. 'Ἑ' => 'Ἑ',
  64324. 'Ἒ' => 'Ἒ',
  64325. 'Ἓ' => 'Ἓ',
  64326. 'Ἐ�' => 'Ἔ',
  64327. 'Ἑ�' => '�',
  64328. 'ἠ' => 'ἠ',
  64329. 'ἡ' => 'ἡ',
  64330. 'ἢ' => 'ἢ',
  64331. 'ἣ' => 'ἣ',
  64332. 'ἠ�' => 'ἤ',
  64333. 'ἡ�' => 'ἥ',
  64334. 'ἦ' => 'ἦ',
  64335. 'ἧ' => 'ἧ',
  64336. 'Ἠ' => 'Ἠ',
  64337. 'Ἡ' => 'Ἡ',
  64338. 'Ἢ' => 'Ἢ',
  64339. 'Ἣ' => 'Ἣ',
  64340. 'Ἠ�' => 'Ἤ',
  64341. 'Ἡ�' => 'Ἥ',
  64342. 'Ἦ' => 'Ἦ',
  64343. 'Ἧ' => 'Ἧ',
  64344. 'ἰ' => 'ἰ',
  64345. 'ἱ' => 'ἱ',
  64346. 'á¼°Ì€' => 'á¼²',
  64347. 'ἳ' => 'ἳ',
  64348. 'ἰ�' => 'ἴ',
  64349. 'ἱ�' => 'ἵ',
  64350. 'ἶ' => 'ἶ',
  64351. 'ἷ' => 'ἷ',
  64352. 'Ἰ' => 'Ἰ',
  64353. 'Ἱ' => 'Ἱ',
  64354. 'Ἲ' => 'Ἲ',
  64355. 'Ἳ' => 'Ἳ',
  64356. 'Ἰ�' => 'Ἴ',
  64357. 'Ἱ�' => 'Ἵ',
  64358. 'Ἶ' => 'Ἶ',
  64359. 'Ἷ' => 'Ἷ',
  64360. 'ὀ' => 'ὀ',
  64361. 'ὁ' => '�',
  64362. 'ὂ' => 'ὂ',
  64363. '�̀' => 'ὃ',
  64364. 'ὀ�' => 'ὄ',
  64365. '��' => 'ὅ',
  64366. 'Ὀ' => 'Ὀ',
  64367. 'Ὁ' => 'Ὁ',
  64368. 'Ὂ' => 'Ὂ',
  64369. 'Ὃ' => 'Ὃ',
  64370. 'Ὀ�' => 'Ὄ',
  64371. 'Ὁ�' => '�',
  64372. 'ὐ' => '�',
  64373. 'ὑ' => 'ὑ',
  64374. '�̀' => 'ὒ',
  64375. 'ὓ' => 'ὓ',
  64376. '��' => 'ὔ',
  64377. 'ὑ�' => 'ὕ',
  64378. '�͂' => 'ὖ',
  64379. 'ὗ' => 'ὗ',
  64380. 'Ὑ' => 'Ὑ',
  64381. 'Ὓ' => 'Ὓ',
  64382. 'Ὑ�' => '�',
  64383. 'Ὗ' => 'Ὗ',
  64384. 'ὠ' => 'ὠ',
  64385. 'ὡ' => 'ὡ',
  64386. 'ὢ' => 'ὢ',
  64387. 'ὣ' => 'ὣ',
  64388. 'ὠ�' => 'ὤ',
  64389. 'ὡ�' => 'ὥ',
  64390. 'ὦ' => 'ὦ',
  64391. 'ὧ' => 'ὧ',
  64392. 'Ὠ' => 'Ὠ',
  64393. 'Ὡ' => 'Ὡ',
  64394. 'Ὢ' => 'Ὢ',
  64395. 'Ὣ' => 'Ὣ',
  64396. 'Ὠ�' => 'Ὤ',
  64397. 'Ὡ�' => 'Ὥ',
  64398. 'Ὦ' => 'Ὦ',
  64399. 'Ὧ' => 'Ὧ',
  64400. 'ὰ' => 'ὰ',
  64401. 'ὲ' => 'ὲ',
  64402. 'ὴ' => 'ὴ',
  64403. 'ὶ' => 'ὶ',
  64404. 'ὸ' => 'ὸ',
  64405. 'ὺ' => 'ὺ',
  64406. 'ὼ' => 'ὼ',
  64407. 'ᾀ' => 'ᾀ',
  64408. '�ͅ' => '�',
  64409. 'ᾂ' => 'ᾂ',
  64410. 'ᾃ' => 'ᾃ',
  64411. 'ᾄ' => 'ᾄ',
  64412. 'á¼…Í…' => 'á¾…',
  64413. 'ᾆ' => 'ᾆ',
  64414. 'ᾇ' => 'ᾇ',
  64415. 'ᾈ' => 'ᾈ',
  64416. 'ᾉ' => 'ᾉ',
  64417. 'ᾊ' => 'ᾊ',
  64418. 'ᾋ' => 'ᾋ',
  64419. 'ᾌ' => 'ᾌ',
  64420. '�ͅ' => '�',
  64421. 'ᾎ' => 'ᾎ',
  64422. '�ͅ' => '�',
  64423. 'ᾐ' => '�',
  64424. 'ᾑ' => 'ᾑ',
  64425. 'ᾒ' => 'ᾒ',
  64426. 'ᾓ' => 'ᾓ',
  64427. 'ᾔ' => 'ᾔ',
  64428. 'ᾕ' => 'ᾕ',
  64429. 'ᾖ' => 'ᾖ',
  64430. 'ᾗ' => 'ᾗ',
  64431. 'ᾘ' => 'ᾘ',
  64432. 'ᾙ' => 'ᾙ',
  64433. 'ᾚ' => 'ᾚ',
  64434. 'ᾛ' => 'ᾛ',
  64435. 'ᾜ' => 'ᾜ',
  64436. 'ᾝ' => '�',
  64437. 'ᾞ' => 'ᾞ',
  64438. 'ᾟ' => 'ᾟ',
  64439. 'á½ Í…' => 'á¾ ',
  64440. 'ᾡ' => 'ᾡ',
  64441. 'ᾢ' => 'ᾢ',
  64442. 'ᾣ' => 'ᾣ',
  64443. 'ᾤ' => 'ᾤ',
  64444. 'ᾥ' => 'ᾥ',
  64445. 'ᾦ' => 'ᾦ',
  64446. 'ᾧ' => 'ᾧ',
  64447. 'ᾨ' => 'ᾨ',
  64448. 'ᾩ' => 'ᾩ',
  64449. 'ᾪ' => 'ᾪ',
  64450. 'ᾫ' => 'ᾫ',
  64451. 'ᾬ' => 'ᾬ',
  64452. 'á½­Í…' => 'á¾­',
  64453. 'ᾮ' => 'ᾮ',
  64454. 'ᾯ' => 'ᾯ',
  64455. 'ᾰ' => 'ᾰ',
  64456. 'ᾱ' => 'ᾱ',
  64457. 'á½°Í…' => 'á¾²',
  64458. 'ᾳ' => 'ᾳ',
  64459. 'ᾴ' => 'ᾴ',
  64460. 'ᾶ' => 'ᾶ',
  64461. 'ᾷ' => 'ᾷ',
  64462. 'Ᾰ' => 'Ᾰ',
  64463. 'Ᾱ' => 'Ᾱ',
  64464. 'Ὰ' => 'Ὰ',
  64465. 'ᾼ' => 'ᾼ',
  64466. '῁' => '�',
  64467. 'á½´Í…' => 'á¿‚',
  64468. 'ῃ' => 'ῃ',
  64469. 'ῄ' => 'ῄ',
  64470. 'ῆ' => 'ῆ',
  64471. 'ῇ' => 'ῇ',
  64472. 'Ὲ' => 'Ὲ',
  64473. 'Ὴ' => 'Ὴ',
  64474. 'ῌ' => 'ῌ',
  64475. '῍' => '�',
  64476. '᾿�' => '῎',
  64477. '῏' => '�',
  64478. 'ῐ' => '�',
  64479. 'ῑ' => 'ῑ',
  64480. 'ÏŠÌ€' => 'á¿’',
  64481. 'ῖ' => 'ῖ',
  64482. 'ÏŠÍ‚' => 'á¿—',
  64483. 'Ῐ' => 'Ῐ',
  64484. 'Ῑ' => 'Ῑ',
  64485. 'Ὶ' => 'Ὶ',
  64486. '῝' => '�',
  64487. '῾�' => '῞',
  64488. '῟' => '῟',
  64489. 'ῠ' => 'ῠ',
  64490. 'Ï…Ì„' => 'á¿¡',
  64491. 'Ï‹Ì€' => 'á¿¢',
  64492. '�̓' => 'ῤ',
  64493. '�̔' => 'ῥ',
  64494. 'ῦ' => 'ῦ',
  64495. 'ῧ' => 'ῧ',
  64496. 'Ῠ' => 'Ῠ',
  64497. 'Ῡ' => 'Ῡ',
  64498. 'Ὺ' => 'Ὺ',
  64499. 'Ῥ' => 'Ῥ',
  64500. '῭' => '῭',
  64501. 'ῲ' => 'ῲ',
  64502. 'ῳ' => 'ῳ',
  64503. 'ÏŽÍ…' => 'á¿´',
  64504. 'ῶ' => 'ῶ',
  64505. 'ῷ' => 'ῷ',
  64506. 'Ὸ' => 'Ὸ',
  64507. 'Ὼ' => 'Ὼ',
  64508. 'ῼ' => 'ῼ',
  64509. '�̸' => '↚',
  64510. '↛' => '↛',
  64511. '↮' => '↮',
  64512. '�̸' => '�',
  64513. '⇎' => '⇎',
  64514. '⇏' => '�',
  64515. '∄' => '∄',
  64516. '∉' => '∉',
  64517. '∌' => '∌',
  64518. '∤' => '∤',
  64519. '∦' => '∦',
  64520. '≁' => '�',
  64521. '≄' => '≄',
  64522. '≇' => '≇',
  64523. '≉' => '≉',
  64524. '≠' => '≠',
  64525. '≢' => '≢',
  64526. '�̸' => '≭',
  64527. '≮' => '≮',
  64528. '≯' => '≯',
  64529. '≰' => '≰',
  64530. '≱' => '≱',
  64531. '≴' => '≴',
  64532. '≵' => '≵',
  64533. '≸' => '≸',
  64534. '≹' => '≹',
  64535. '⊀' => '⊀',
  64536. '⊁' => '�',
  64537. '⊄' => '⊄',
  64538. '⊅' => '⊅',
  64539. '⊈' => '⊈',
  64540. '⊉' => '⊉',
  64541. '⊬' => '⊬',
  64542. '⊭' => '⊭',
  64543. '⊮' => '⊮',
  64544. '⊯' => '⊯',
  64545. '⋠' => '⋠',
  64546. '⋡' => '⋡',
  64547. '⋢' => '⋢',
  64548. '⋣' => '⋣',
  64549. '⋪' => '⋪',
  64550. '⋫' => '⋫',
  64551. '⋬' => '⋬',
  64552. '⋭' => '⋭',
  64553. '�゙' => '�',
  64554. '�゙' => '�',
  64555. '�゙' => '�',
  64556. '�゙' => '�',
  64557. '�゙' => '�',
  64558. '�゙' => '�',
  64559. '�゙' => '�',
  64560. '�゙' => '�',
  64561. '�゙' => '�',
  64562. '�゙' => '�',
  64563. '�゙' => '�',
  64564. '�゙' => '�',
  64565. '�゙' => '�',
  64566. '�゙' => '�',
  64567. '�゙' => '�',
  64568. '�゙' => '�',
  64569. '�゚' => '�',
  64570. '�゙' => '�',
  64571. '�゚' => '�',
  64572. '�゙' => '�',
  64573. '�゚' => '�',
  64574. '�゙' => '�',
  64575. '�゚' => '�',
  64576. '�゙' => '�',
  64577. '�゚' => '�',
  64578. '�゙' => 'ゔ',
  64579. '�゙' => 'ゞ',
  64580. 'ガ' => 'ガ',
  64581. 'ã‚­ã‚™' => 'ã‚®',
  64582. 'グ' => 'グ',
  64583. 'ゲ' => 'ゲ',
  64584. 'ゴ' => 'ゴ',
  64585. 'ザ' => 'ザ',
  64586. 'ジ' => 'ジ',
  64587. 'ズ' => 'ズ',
  64588. 'ゼ' => 'ゼ',
  64589. 'ゾ' => 'ゾ',
  64590. 'ダ' => 'ダ',
  64591. '�゙' => 'ヂ',
  64592. 'ヅ' => 'ヅ',
  64593. 'デ' => 'デ',
  64594. 'ド' => 'ド',
  64595. '�゙' => '�',
  64596. '�゚' => 'パ',
  64597. 'ビ' => 'ビ',
  64598. 'ピ' => 'ピ',
  64599. 'ブ' => 'ブ',
  64600. 'プ' => 'プ',
  64601. 'ベ' => 'ベ',
  64602. 'ペ' => 'ペ',
  64603. 'ボ' => 'ボ',
  64604. 'ポ' => '�',
  64605. 'ヴ' => 'ヴ',
  64606. 'ヷ' => 'ヷ',
  64607. 'ヸ' => 'ヸ',
  64608. 'ヹ' => 'ヹ',
  64609. 'ヺ' => 'ヺ',
  64610. 'ヾ' => 'ヾ',
  64611. '𑂚' => '𑂚',
  64612. '𑂜' => '𑂜',
  64613. '𑂫' => '𑂫',
  64614. '𑄮' => '𑄮',
  64615. '𑄯' => '𑄯',
  64616. '�𑌾' => '�',
  64617. '��' => '�',
  64618. '𑒻' => '𑒻',
  64619. '𑒼' => '𑒼',
  64620. '𑒾' => '𑒾',
  64621. '𑖺' => '𑖺',
  64622. '𑖻' => '𑖻',
  64623. '𑤸' => '𑤸',
  64624. );
  64625. <?php
  64626. return array (
  64627. 'À' => 'À',
  64628. '�' => 'A�',
  64629. 'Â' => 'Â',
  64630. 'Ã' => 'Ã',
  64631. 'Ä' => 'Ä',
  64632. 'Ã…' => 'AÌŠ',
  64633. 'Ç' => 'Ç',
  64634. 'È' => 'È',
  64635. 'É' => 'E�',
  64636. 'Ê' => 'Ê',
  64637. 'Ë' => 'Ë',
  64638. 'Ì' => 'Ì',
  64639. '�' => 'I�',
  64640. 'ÃŽ' => 'IÌ‚',
  64641. '�' => 'Ï',
  64642. 'Ñ' => 'Ñ',
  64643. 'Ã’' => 'OÌ€',
  64644. 'Ó' => 'O�',
  64645. 'Ô' => 'Ô',
  64646. 'Õ' => 'Õ',
  64647. 'Ö' => 'Ö',
  64648. 'Ù' => 'Ù',
  64649. 'Ú' => 'U�',
  64650. 'Û' => 'Û',
  64651. 'Ü' => 'Ü',
  64652. '�' => 'Y�',
  64653. 'à' => 'à',
  64654. 'á' => 'a�',
  64655. 'â' => 'â',
  64656. 'ã' => 'ã',
  64657. 'ä' => 'ä',
  64658. 'Ã¥' => 'aÌŠ',
  64659. 'ç' => 'ç',
  64660. 'è' => 'è',
  64661. 'é' => 'e�',
  64662. 'ê' => 'ê',
  64663. 'ë' => 'ë',
  64664. 'ì' => 'ì',
  64665. 'í' => 'i�',
  64666. 'î' => 'î',
  64667. 'ï' => 'ï',
  64668. 'ñ' => 'ñ',
  64669. 'ò' => 'ò',
  64670. 'ó' => 'o�',
  64671. 'ô' => 'ô',
  64672. 'õ' => 'õ',
  64673. 'ö' => 'ö',
  64674. 'ù' => 'ù',
  64675. 'ú' => 'u�',
  64676. 'û' => 'û',
  64677. 'ü' => 'ü',
  64678. 'ý' => 'y�',
  64679. 'ÿ' => 'ÿ',
  64680. 'Ä€' => 'AÌ„',
  64681. '�' => 'ā',
  64682. 'Ă' => 'Ă',
  64683. 'ă' => 'ă',
  64684. 'Ą' => 'Ą',
  64685. 'ą' => 'ą',
  64686. 'Ć' => 'C�',
  64687. 'ć' => 'c�',
  64688. 'Ĉ' => 'Ĉ',
  64689. 'ĉ' => 'ĉ',
  64690. 'Ċ' => 'Ċ',
  64691. 'ċ' => 'ċ',
  64692. 'Č' => 'Č',
  64693. '�' => 'č',
  64694. 'Ď' => 'Ď',
  64695. '�' => 'ď',
  64696. 'Ä’' => 'EÌ„',
  64697. 'ē' => 'ē',
  64698. 'Ĕ' => 'Ĕ',
  64699. 'ĕ' => 'ĕ',
  64700. 'Ė' => 'Ė',
  64701. 'ė' => 'ė',
  64702. 'Ę' => 'Ę',
  64703. 'ę' => 'ę',
  64704. 'Ě' => 'Ě',
  64705. 'ě' => 'ě',
  64706. 'Ĝ' => 'Ĝ',
  64707. '�' => 'ĝ',
  64708. 'Ğ' => 'Ğ',
  64709. 'ğ' => 'ğ',
  64710. 'Ġ' => 'Ġ',
  64711. 'ġ' => 'ġ',
  64712. 'Ģ' => 'Ģ',
  64713. 'ģ' => 'ģ',
  64714. 'Ĥ' => 'Ĥ',
  64715. 'ĥ' => 'ĥ',
  64716. 'Ĩ' => 'Ĩ',
  64717. 'ĩ' => 'ĩ',
  64718. 'Ī' => 'Ī',
  64719. 'ī' => 'ī',
  64720. 'Ĭ' => 'Ĭ',
  64721. 'ĭ' => 'ĭ',
  64722. 'Į' => 'Į',
  64723. 'į' => 'į',
  64724. 'İ' => 'İ',
  64725. 'Ä´' => 'JÌ‚',
  64726. 'ĵ' => 'ĵ',
  64727. 'Ķ' => 'Ķ',
  64728. 'ķ' => 'ķ',
  64729. 'Ĺ' => 'L�',
  64730. 'ĺ' => 'l�',
  64731. 'Ļ' => 'Ļ',
  64732. 'ļ' => 'ļ',
  64733. 'Ľ' => 'Ľ',
  64734. 'ľ' => 'ľ',
  64735. 'Ń' => 'N�',
  64736. 'ń' => 'n�',
  64737. 'Ņ' => 'Ņ',
  64738. 'ņ' => 'ņ',
  64739. 'Ň' => 'Ň',
  64740. 'ň' => 'ň',
  64741. 'Ō' => 'Ō',
  64742. '�' => 'ō',
  64743. 'Ŏ' => 'Ŏ',
  64744. '�' => 'ŏ',
  64745. '�' => 'Ő',
  64746. 'ő' => 'ő',
  64747. 'Ŕ' => 'R�',
  64748. 'ŕ' => 'r�',
  64749. 'Ŗ' => 'Ŗ',
  64750. 'ŗ' => 'ŗ',
  64751. 'Ř' => 'Ř',
  64752. 'ř' => 'ř',
  64753. 'Ś' => 'S�',
  64754. 'ś' => 's�',
  64755. 'Ŝ' => 'Ŝ',
  64756. '�' => 'ŝ',
  64757. 'Ş' => 'Ş',
  64758. 'ş' => 'ş',
  64759. 'Š' => 'Š',
  64760. 'š' => 'š',
  64761. 'Ţ' => 'Ţ',
  64762. 'ţ' => 'ţ',
  64763. 'Ť' => 'Ť',
  64764. 'ť' => 'ť',
  64765. 'Ũ' => 'Ũ',
  64766. 'ũ' => 'ũ',
  64767. 'Ū' => 'Ū',
  64768. 'ū' => 'ū',
  64769. 'Ŭ' => 'Ŭ',
  64770. 'ŭ' => 'ŭ',
  64771. 'Å®' => 'UÌŠ',
  64772. 'ů' => 'ů',
  64773. 'Å°' => 'UÌ‹',
  64774. 'ű' => 'ű',
  64775. 'Ų' => 'Ų',
  64776. 'ų' => 'ų',
  64777. 'Å´' => 'WÌ‚',
  64778. 'ŵ' => 'ŵ',
  64779. 'Ŷ' => 'Ŷ',
  64780. 'ŷ' => 'ŷ',
  64781. 'Ÿ' => 'Ÿ',
  64782. 'Ź' => 'Z�',
  64783. 'ź' => 'z�',
  64784. 'Ż' => 'Ż',
  64785. 'ż' => 'ż',
  64786. 'Ž' => 'Ž',
  64787. 'ž' => 'ž',
  64788. 'Æ ' => 'OÌ›',
  64789. 'Æ¡' => 'oÌ›',
  64790. 'Ư' => 'Ư',
  64791. 'Æ°' => 'uÌ›',
  64792. '�' => 'Ǎ',
  64793. 'ǎ' => 'ǎ',
  64794. '�' => 'Ǐ',
  64795. '�' => 'ǐ',
  64796. 'Ǒ' => 'Ǒ',
  64797. 'ǒ' => 'ǒ',
  64798. 'Ǔ' => 'Ǔ',
  64799. 'ǔ' => 'ǔ',
  64800. 'Ǖ' => 'Ǖ',
  64801. 'ǖ' => 'ǖ',
  64802. 'Ǘ' => 'Ü�',
  64803. 'ǘ' => 'ü�',
  64804. 'Ǚ' => 'Ǚ',
  64805. 'ǚ' => 'ǚ',
  64806. 'Ǜ' => 'Ǜ',
  64807. 'ǜ' => 'ǜ',
  64808. 'Ǟ' => 'Ǟ',
  64809. 'ǟ' => 'ǟ',
  64810. 'Ǡ' => 'Ǡ',
  64811. 'ǡ' => 'ǡ',
  64812. 'Ǣ' => 'Ǣ',
  64813. 'ǣ' => 'ǣ',
  64814. 'Ǧ' => 'Ǧ',
  64815. 'ǧ' => 'ǧ',
  64816. 'Ǩ' => 'Ǩ',
  64817. 'ǩ' => 'ǩ',
  64818. 'Ǫ' => 'Ǫ',
  64819. 'ǫ' => 'ǫ',
  64820. 'Ǭ' => 'Ǭ',
  64821. 'ǭ' => 'ǭ',
  64822. 'Ǯ' => 'Ǯ',
  64823. 'ǯ' => 'ǯ',
  64824. 'ǰ' => 'ǰ',
  64825. 'Ǵ' => 'G�',
  64826. 'ǵ' => 'g�',
  64827. 'Ǹ' => 'Ǹ',
  64828. 'ǹ' => 'ǹ',
  64829. 'Ǻ' => 'Å�',
  64830. 'ǻ' => 'å�',
  64831. 'Ǽ' => 'Æ�',
  64832. 'ǽ' => 'æ�',
  64833. 'Ǿ' => 'Ø�',
  64834. 'ǿ' => 'ø�',
  64835. 'Ȁ' => 'A�',
  64836. '�' => 'a�',
  64837. 'È‚' => 'AÌ‘',
  64838. 'ȃ' => 'ȃ',
  64839. 'Ȅ' => 'E�',
  64840. 'ȅ' => 'e�',
  64841. 'Ȇ' => 'Ȇ',
  64842. 'ȇ' => 'ȇ',
  64843. 'Ȉ' => 'I�',
  64844. 'ȉ' => 'i�',
  64845. 'ÈŠ' => 'IÌ‘',
  64846. 'ȋ' => 'ȋ',
  64847. 'Ȍ' => 'O�',
  64848. '�' => 'o�',
  64849. 'ÈŽ' => 'OÌ‘',
  64850. '�' => 'ȏ',
  64851. '�' => 'R�',
  64852. 'ȑ' => 'r�',
  64853. 'È’' => 'RÌ‘',
  64854. 'ȓ' => 'ȓ',
  64855. 'Ȕ' => 'U�',
  64856. 'ȕ' => 'u�',
  64857. 'È–' => 'UÌ‘',
  64858. 'ȗ' => 'ȗ',
  64859. 'Ș' => 'Ș',
  64860. 'ș' => 'ș',
  64861. 'Ț' => 'Ț',
  64862. 'ț' => 'ț',
  64863. 'Ȟ' => 'Ȟ',
  64864. 'ȟ' => 'ȟ',
  64865. 'Ȧ' => 'Ȧ',
  64866. 'ȧ' => 'ȧ',
  64867. 'Ȩ' => 'Ȩ',
  64868. 'ȩ' => 'ȩ',
  64869. 'Ȫ' => 'Ȫ',
  64870. 'ȫ' => 'ȫ',
  64871. 'Ȭ' => 'Ȭ',
  64872. 'ȭ' => 'ȭ',
  64873. 'Ȯ' => 'Ȯ',
  64874. 'ȯ' => 'ȯ',
  64875. 'Ȱ' => 'Ȱ',
  64876. 'ȱ' => 'ȱ',
  64877. 'Ȳ' => 'Ȳ',
  64878. 'ȳ' => 'ȳ',
  64879. 'Í€' => 'Ì€',
  64880. '�' => '�',
  64881. '̓' => '̓',
  64882. '̈́' => '̈�',
  64883. 'ʹ' => 'ʹ',
  64884. ';' => ';',
  64885. '΅' => '¨�',
  64886. 'Ά' => 'Α�',
  64887. '·' => '·',
  64888. 'Έ' => 'Ε�',
  64889. 'Ή' => 'Η�',
  64890. 'Ί' => 'Ι�',
  64891. 'Ό' => 'Ο�',
  64892. 'Ύ' => 'Υ�',
  64893. '�' => 'Ω�',
  64894. '�' => 'ϊ�',
  64895. 'Ϊ' => 'Ϊ',
  64896. 'Ϋ' => 'Ϋ',
  64897. 'ά' => 'α�',
  64898. 'έ' => 'ε�',
  64899. 'ή' => 'η�',
  64900. 'ί' => 'ι�',
  64901. 'ΰ' => 'ϋ�',
  64902. 'ϊ' => 'ϊ',
  64903. 'ϋ' => 'ϋ',
  64904. 'ό' => 'ο�',
  64905. '�' => 'υ�',
  64906. 'ώ' => 'ω�',
  64907. 'ϓ' => 'ϒ�',
  64908. 'ϔ' => 'ϔ',
  64909. 'Ѐ' => 'Ѐ',
  64910. '�' => 'Ё',
  64911. 'Ѓ' => 'Г�',
  64912. 'Ї' => 'Ї',
  64913. 'Ќ' => 'К�',
  64914. '�' => 'Ѝ',
  64915. 'Ў' => 'Ў',
  64916. 'Й' => 'Й',
  64917. 'й' => 'й',
  64918. '�' => 'ѐ',
  64919. 'ё' => 'ё',
  64920. 'ѓ' => 'г�',
  64921. 'ї' => 'ї',
  64922. 'ќ' => 'к�',
  64923. '�' => 'ѝ',
  64924. 'ў' => 'ў',
  64925. 'Ѷ' => 'Ѵ�',
  64926. 'ѷ' => 'ѵ�',
  64927. '�' => 'Ӂ',
  64928. 'ӂ' => 'ӂ',
  64929. '�' => '�̆',
  64930. 'ӑ' => 'ӑ',
  64931. 'Ӓ' => '�̈',
  64932. 'ӓ' => 'ӓ',
  64933. 'Ӗ' => 'Ӗ',
  64934. 'ӗ' => 'ӗ',
  64935. 'Ӛ' => 'Ӛ',
  64936. 'ӛ' => 'ӛ',
  64937. 'Ӝ' => 'Ӝ',
  64938. '�' => 'ӝ',
  64939. 'Ӟ' => 'Ӟ',
  64940. 'ӟ' => 'ӟ',
  64941. 'Ӣ' => 'Ӣ',
  64942. 'ӣ' => 'ӣ',
  64943. 'Ӥ' => 'Ӥ',
  64944. 'ӥ' => 'ӥ',
  64945. 'Ӧ' => 'Ӧ',
  64946. 'ӧ' => 'ӧ',
  64947. 'Ӫ' => 'Ӫ',
  64948. 'ӫ' => 'ӫ',
  64949. 'Ӭ' => 'Ӭ',
  64950. 'ӭ' => '�̈',
  64951. 'Ӯ' => 'Ӯ',
  64952. 'ӯ' => 'ӯ',
  64953. 'Ӱ' => 'Ӱ',
  64954. 'ӱ' => 'ӱ',
  64955. 'Ӳ' => 'Ӳ',
  64956. 'ӳ' => 'ӳ',
  64957. 'Ӵ' => 'Ӵ',
  64958. 'ӵ' => 'ӵ',
  64959. 'Ӹ' => 'Ӹ',
  64960. 'ӹ' => 'ӹ',
  64961. 'آ' => 'آ',
  64962. 'أ' => 'أ',
  64963. 'ؤ' => 'ؤ',
  64964. 'إ' => 'إ',
  64965. 'ئ' => 'ئ',
  64966. 'Û€' => 'Û•Ù”',
  64967. 'Û‚' => 'Û�Ù”',
  64968. 'Û“' => 'Û’Ù”',
  64969. 'ऩ' => 'ऩ',
  64970. 'ऱ' => 'ऱ',
  64971. 'ऴ' => 'ऴ',
  64972. 'क़' => 'क़',
  64973. 'ख़' => 'ख़',
  64974. 'ग़' => 'ग़',
  64975. 'ज़' => 'ज़',
  64976. 'ड़' => 'ड़',
  64977. '�' => 'ढ़',
  64978. 'फ़' => 'फ़',
  64979. 'य़' => 'य़',
  64980. 'ো' => 'ো',
  64981. 'ৌ' => 'ৌ',
  64982. 'ড়' => 'ড়',
  64983. '�' => 'ঢ়',
  64984. 'য়' => 'য়',
  64985. 'ਲ਼' => 'ਲ਼',
  64986. 'ਸ਼' => 'ਸ਼',
  64987. 'ਖ਼' => 'ਖ਼',
  64988. 'ਗ਼' => 'ਗ਼',
  64989. 'ਜ਼' => 'ਜ਼',
  64990. 'ਫ਼' => 'ਫ਼',
  64991. 'ୈ' => 'ୈ',
  64992. 'ୋ' => 'ୋ',
  64993. 'ୌ' => 'ୌ',
  64994. 'ଡ଼' => 'ଡ଼',
  64995. '�' => 'ଢ଼',
  64996. 'ஔ' => 'ஔ',
  64997. 'ொ' => 'ொ',
  64998. 'ோ' => 'ோ',
  64999. 'ௌ' => 'ௌ',
  65000. 'ై' => 'ై',
  65001. 'ೀ' => 'ೀ',
  65002. 'ೇ' => 'ೇ',
  65003. 'ೈ' => 'ೈ',
  65004. 'ೊ' => 'ೊ',
  65005. 'ೋ' => 'ೋ',
  65006. 'ൊ' => 'ൊ',
  65007. 'ോ' => 'ോ',
  65008. 'ൌ' => 'ൌ',
  65009. 'ේ' => 'ේ',
  65010. 'ො' => 'ෙ�',
  65011. '�' => 'ෙ�්',
  65012. 'ෞ' => 'ෞ',
  65013. 'གྷ' => 'གྷ',
  65014. '�' => 'ཌྷ',
  65015. 'དྷ' => 'དྷ',
  65016. 'བྷ' => 'བྷ',
  65017. 'ཛྷ' => 'ཛྷ',
  65018. 'ཀྵ' => 'ཀྵ',
  65019. 'ཱི' => 'ཱི',
  65020. 'ཱུ' => 'ཱུ',
  65021. 'ྲྀ' => 'ྲྀ',
  65022. 'ླྀ' => 'ླྀ',
  65023. '�' => 'ཱྀ',
  65024. 'ྒྷ' => 'ྒྷ',
  65025. '�' => 'ྜྷ',
  65026. 'ྡྷ' => 'ྡྷ',
  65027. 'ྦྷ' => 'ྦྷ',
  65028. 'ྫྷ' => 'ྫྷ',
  65029. 'ྐྵ' => '�ྵ',
  65030. 'ဦ' => 'ဦ',
  65031. 'ᬆ' => 'ᬆ',
  65032. 'ᬈ' => 'ᬈ',
  65033. 'ᬊ' => 'ᬊ',
  65034. 'ᬌ' => 'ᬌ',
  65035. 'ᬎ' => '�ᬵ',
  65036. 'ᬒ' => 'ᬒ',
  65037. 'ᬻ' => 'ᬻ',
  65038. 'ᬽ' => 'ᬽ',
  65039. 'ᭀ' => 'ᭀ',
  65040. '�' => 'ᭁ',
  65041. 'ᭃ' => 'ᭃ',
  65042. 'Ḁ' => 'Ḁ',
  65043. '�' => 'ḁ',
  65044. 'Ḃ' => 'Ḃ',
  65045. 'ḃ' => 'ḃ',
  65046. 'Ḅ' => 'Ḅ',
  65047. 'ḅ' => 'ḅ',
  65048. 'Ḇ' => 'Ḇ',
  65049. 'ḇ' => 'ḇ',
  65050. 'Ḉ' => 'Ç�',
  65051. 'ḉ' => 'ç�',
  65052. 'Ḋ' => 'Ḋ',
  65053. 'ḋ' => 'ḋ',
  65054. 'Ḍ' => 'Ḍ',
  65055. '�' => 'ḍ',
  65056. 'Ḏ' => 'Ḏ',
  65057. '�' => 'ḏ',
  65058. '�' => 'Ḑ',
  65059. 'ḑ' => 'ḑ',
  65060. 'Ḓ' => 'Ḓ',
  65061. 'ḓ' => 'ḓ',
  65062. 'Ḕ' => 'Ḕ',
  65063. 'ḕ' => 'ḕ',
  65064. 'Ḗ' => 'Ē�',
  65065. 'ḗ' => 'ē�',
  65066. 'Ḙ' => 'Ḙ',
  65067. 'ḙ' => 'ḙ',
  65068. 'Ḛ' => 'Ḛ',
  65069. 'ḛ' => 'ḛ',
  65070. 'Ḝ' => 'Ḝ',
  65071. '�' => 'ḝ',
  65072. 'Ḟ' => 'Ḟ',
  65073. 'ḟ' => 'ḟ',
  65074. 'Ḡ' => 'Ḡ',
  65075. 'ḡ' => 'ḡ',
  65076. 'Ḣ' => 'Ḣ',
  65077. 'ḣ' => 'ḣ',
  65078. 'Ḥ' => 'Ḥ',
  65079. 'ḥ' => 'ḥ',
  65080. 'Ḧ' => 'Ḧ',
  65081. 'ḧ' => 'ḧ',
  65082. 'Ḩ' => 'Ḩ',
  65083. 'ḩ' => 'ḩ',
  65084. 'Ḫ' => 'Ḫ',
  65085. 'ḫ' => 'ḫ',
  65086. 'Ḭ' => 'Ḭ',
  65087. 'ḭ' => 'ḭ',
  65088. 'Ḯ' => 'Ï�',
  65089. 'ḯ' => 'ï�',
  65090. 'Ḱ' => 'K�',
  65091. 'ḱ' => 'k�',
  65092. 'Ḳ' => 'Ḳ',
  65093. 'ḳ' => 'ḳ',
  65094. 'Ḵ' => 'Ḵ',
  65095. 'ḵ' => 'ḵ',
  65096. 'Ḷ' => 'Ḷ',
  65097. 'ḷ' => 'ḷ',
  65098. 'Ḹ' => 'Ḹ',
  65099. 'ḹ' => 'ḹ',
  65100. 'Ḻ' => 'Ḻ',
  65101. 'ḻ' => 'ḻ',
  65102. 'Ḽ' => 'Ḽ',
  65103. 'ḽ' => 'ḽ',
  65104. 'Ḿ' => 'M�',
  65105. 'ḿ' => 'm�',
  65106. 'Ṁ' => 'Ṁ',
  65107. '�' => 'ṁ',
  65108. 'Ṃ' => 'Ṃ',
  65109. 'ṃ' => 'ṃ',
  65110. 'Ṅ' => 'Ṅ',
  65111. 'ṅ' => 'ṅ',
  65112. 'Ṇ' => 'Ṇ',
  65113. 'ṇ' => 'ṇ',
  65114. 'Ṉ' => 'Ṉ',
  65115. 'ṉ' => 'ṉ',
  65116. 'Ṋ' => 'Ṋ',
  65117. 'ṋ' => 'ṋ',
  65118. 'Ṍ' => 'Õ�',
  65119. '�' => 'õ�',
  65120. 'Ṏ' => 'Ṏ',
  65121. '�' => 'ṏ',
  65122. '�' => 'Ṑ',
  65123. 'ṑ' => 'ṑ',
  65124. 'Ṓ' => 'Ō�',
  65125. 'ṓ' => 'ō�',
  65126. 'Ṕ' => 'P�',
  65127. 'ṕ' => 'p�',
  65128. 'Ṗ' => 'Ṗ',
  65129. 'ṗ' => 'ṗ',
  65130. 'Ṙ' => 'Ṙ',
  65131. 'ṙ' => 'ṙ',
  65132. 'Ṛ' => 'Ṛ',
  65133. 'ṛ' => 'ṛ',
  65134. 'Ṝ' => 'Ṝ',
  65135. '�' => 'ṝ',
  65136. 'Ṟ' => 'Ṟ',
  65137. 'ṟ' => 'ṟ',
  65138. 'Ṡ' => 'Ṡ',
  65139. 'ṡ' => 'ṡ',
  65140. 'á¹¢' => 'SÌ£',
  65141. 'ṣ' => 'ṣ',
  65142. 'Ṥ' => 'S�̇',
  65143. 'ṥ' => 's�̇',
  65144. 'Ṧ' => 'Ṧ',
  65145. 'ṧ' => 'ṧ',
  65146. 'Ṩ' => 'Ṩ',
  65147. 'ṩ' => 'ṩ',
  65148. 'Ṫ' => 'Ṫ',
  65149. 'ṫ' => 'ṫ',
  65150. 'Ṭ' => 'Ṭ',
  65151. 'ṭ' => 'ṭ',
  65152. 'Ṯ' => 'Ṯ',
  65153. 'ṯ' => 'ṯ',
  65154. 'á¹°' => 'TÌ­',
  65155. 'á¹±' => 'tÌ­',
  65156. 'Ṳ' => 'Ṳ',
  65157. 'ṳ' => 'ṳ',
  65158. 'á¹´' => 'UÌ°',
  65159. 'á¹µ' => 'uÌ°',
  65160. 'Ṷ' => 'Ṷ',
  65161. 'á¹·' => 'uÌ­',
  65162. 'Ṹ' => 'Ũ�',
  65163. 'ṹ' => 'ũ�',
  65164. 'Ṻ' => 'Ṻ',
  65165. 'ṻ' => 'ṻ',
  65166. 'Ṽ' => 'Ṽ',
  65167. 'ṽ' => 'ṽ',
  65168. 'á¹¾' => 'VÌ£',
  65169. 'ṿ' => 'ṿ',
  65170. 'Ẁ' => 'Ẁ',
  65171. '�' => 'ẁ',
  65172. 'Ẃ' => 'W�',
  65173. 'ẃ' => 'w�',
  65174. 'Ẅ' => 'Ẅ',
  65175. 'ẅ' => 'ẅ',
  65176. 'Ẇ' => 'Ẇ',
  65177. 'ẇ' => 'ẇ',
  65178. 'Ẉ' => 'Ẉ',
  65179. 'ẉ' => 'ẉ',
  65180. 'Ẋ' => 'Ẋ',
  65181. 'ẋ' => 'ẋ',
  65182. 'Ẍ' => 'Ẍ',
  65183. '�' => 'ẍ',
  65184. 'Ẏ' => 'Ẏ',
  65185. '�' => 'ẏ',
  65186. '�' => 'Ẑ',
  65187. 'ẑ' => 'ẑ',
  65188. 'Ẓ' => 'Ẓ',
  65189. 'ẓ' => 'ẓ',
  65190. 'Ẕ' => 'Ẕ',
  65191. 'ẕ' => 'ẕ',
  65192. 'ẖ' => 'ẖ',
  65193. 'ẗ' => 'ẗ',
  65194. 'ẘ' => 'ẘ',
  65195. 'ẙ' => 'ẙ',
  65196. 'ẛ' => 'ẛ',
  65197. 'Ạ' => 'Ạ',
  65198. 'ạ' => 'ạ',
  65199. 'Ả' => 'Ả',
  65200. 'ả' => 'ả',
  65201. 'Ấ' => 'Â�',
  65202. 'ấ' => 'â�',
  65203. 'Ầ' => 'Ầ',
  65204. 'ầ' => 'ầ',
  65205. 'Ẩ' => 'Ẩ',
  65206. 'ẩ' => 'ẩ',
  65207. 'Ẫ' => 'Ẫ',
  65208. 'ẫ' => 'ẫ',
  65209. 'Ậ' => 'Ậ',
  65210. 'ậ' => 'ậ',
  65211. 'Ắ' => 'Ă�',
  65212. 'ắ' => 'ă�',
  65213. 'Ằ' => 'Ằ',
  65214. 'ằ' => 'ằ',
  65215. 'Ẳ' => 'Ẳ',
  65216. 'ẳ' => 'ẳ',
  65217. 'Ẵ' => 'Ẵ',
  65218. 'ẵ' => 'ẵ',
  65219. 'Ặ' => 'Ặ',
  65220. 'ặ' => 'ặ',
  65221. 'Ẹ' => 'Ẹ',
  65222. 'ẹ' => 'ẹ',
  65223. 'Ẻ' => 'Ẻ',
  65224. 'ẻ' => 'ẻ',
  65225. 'Ẽ' => 'Ẽ',
  65226. 'ẽ' => 'ẽ',
  65227. 'Ế' => 'Ê�',
  65228. 'ế' => 'ê�',
  65229. 'Ề' => 'Ề',
  65230. '�' => 'ề',
  65231. 'Ể' => 'Ể',
  65232. 'ể' => 'ể',
  65233. 'Ễ' => 'Ễ',
  65234. 'ễ' => 'ễ',
  65235. 'Ệ' => 'Ệ',
  65236. 'ệ' => 'ệ',
  65237. 'Ỉ' => 'Ỉ',
  65238. 'ỉ' => 'ỉ',
  65239. 'Ị' => 'Ị',
  65240. 'ị' => 'ị',
  65241. 'Ọ' => 'Ọ',
  65242. '�' => 'ọ',
  65243. 'Ỏ' => 'Ỏ',
  65244. '�' => 'ỏ',
  65245. '�' => 'Ô�',
  65246. 'ố' => 'ô�',
  65247. 'á»’' => 'OÌ‚Ì€',
  65248. 'ồ' => 'ồ',
  65249. 'Ổ' => 'Ổ',
  65250. 'ổ' => 'ổ',
  65251. 'Ỗ' => 'Ỗ',
  65252. 'ỗ' => 'ỗ',
  65253. 'Ộ' => 'Ộ',
  65254. 'ộ' => 'ộ',
  65255. 'Ớ' => 'Ơ�',
  65256. 'ớ' => 'ơ�',
  65257. 'Ờ' => 'Ờ',
  65258. '�' => 'ờ',
  65259. 'Ở' => 'Ở',
  65260. 'ở' => 'ở',
  65261. 'Ỡ' => 'Ỡ',
  65262. 'ỡ' => 'ỡ',
  65263. 'Ợ' => 'Ợ',
  65264. 'ợ' => 'ợ',
  65265. 'Ụ' => 'Ụ',
  65266. 'ụ' => 'ụ',
  65267. 'Ủ' => 'Ủ',
  65268. 'ủ' => 'ủ',
  65269. 'Ứ' => 'Ư�',
  65270. 'ứ' => 'ư�',
  65271. 'Ừ' => 'Ừ',
  65272. 'ừ' => 'ừ',
  65273. 'Ử' => 'Ử',
  65274. 'ử' => 'ử',
  65275. 'Ữ' => 'Ữ',
  65276. 'ữ' => 'ữ',
  65277. 'Ự' => 'Ự',
  65278. 'ự' => 'ự',
  65279. 'Ỳ' => 'Ỳ',
  65280. 'ỳ' => 'ỳ',
  65281. 'á»´' => 'YÌ£',
  65282. 'ỵ' => 'ỵ',
  65283. 'Ỷ' => 'Ỷ',
  65284. 'ỷ' => 'ỷ',
  65285. 'Ỹ' => 'Ỹ',
  65286. 'ỹ' => 'ỹ',
  65287. 'ἀ' => 'ἀ',
  65288. '�' => 'ἁ',
  65289. 'ἂ' => 'ἂ',
  65290. 'ἃ' => 'ἃ',
  65291. 'ἄ' => 'ἀ�',
  65292. 'ἅ' => 'ἁ�',
  65293. 'ἆ' => 'ἆ',
  65294. 'ἇ' => 'ἇ',
  65295. 'Ἀ' => 'Ἀ',
  65296. 'Ἁ' => 'Ἁ',
  65297. 'Ἂ' => 'Ἂ',
  65298. 'Ἃ' => 'Ἃ',
  65299. 'Ἄ' => 'Ἀ�',
  65300. '�' => 'Ἁ�',
  65301. 'Ἆ' => 'Ἆ',
  65302. '�' => 'Ἇ',
  65303. '�' => 'ἐ',
  65304. 'ἑ' => 'ἑ',
  65305. 'ἒ' => 'ἒ',
  65306. 'ἓ' => 'ἓ',
  65307. 'ἔ' => 'ἐ�',
  65308. 'ἕ' => 'ἑ�',
  65309. 'Ἐ' => 'Ἐ',
  65310. 'Ἑ' => 'Ἑ',
  65311. 'Ἒ' => 'Ἒ',
  65312. 'Ἓ' => 'Ἓ',
  65313. 'Ἔ' => 'Ἐ�',
  65314. '�' => 'Ἑ�',
  65315. 'ἠ' => 'ἠ',
  65316. 'ἡ' => 'ἡ',
  65317. 'ἢ' => 'ἢ',
  65318. 'ἣ' => 'ἣ',
  65319. 'ἤ' => 'ἠ�',
  65320. 'ἥ' => 'ἡ�',
  65321. 'ἦ' => 'ἦ',
  65322. 'ἧ' => 'ἧ',
  65323. 'Ἠ' => 'Ἠ',
  65324. 'Ἡ' => 'Ἡ',
  65325. 'Ἢ' => 'Ἢ',
  65326. 'Ἣ' => 'Ἣ',
  65327. 'Ἤ' => 'Ἠ�',
  65328. 'Ἥ' => 'Ἡ�',
  65329. 'Ἦ' => 'Ἦ',
  65330. 'Ἧ' => 'Ἧ',
  65331. 'ἰ' => 'ἰ',
  65332. 'ἱ' => 'ἱ',
  65333. 'ἲ' => 'ἲ',
  65334. 'ἳ' => 'ἳ',
  65335. 'ἴ' => 'ἰ�',
  65336. 'ἵ' => 'ἱ�',
  65337. 'ἶ' => 'ἶ',
  65338. 'ἷ' => 'ἷ',
  65339. 'Ἰ' => 'Ἰ',
  65340. 'Ἱ' => 'Ἱ',
  65341. 'Ἲ' => 'Ἲ',
  65342. 'Ἳ' => 'Ἳ',
  65343. 'Ἴ' => 'Ἰ�',
  65344. 'Ἵ' => 'Ἱ�',
  65345. 'Ἶ' => 'Ἶ',
  65346. 'Ἷ' => 'Ἷ',
  65347. 'ὀ' => 'ὀ',
  65348. '�' => 'ὁ',
  65349. 'ὂ' => 'ὂ',
  65350. 'ὃ' => 'ὃ',
  65351. 'ὄ' => 'ὀ�',
  65352. 'ὅ' => 'ὁ�',
  65353. 'Ὀ' => 'Ὀ',
  65354. 'Ὁ' => 'Ὁ',
  65355. 'Ὂ' => 'Ὂ',
  65356. 'Ὃ' => 'Ὃ',
  65357. 'Ὄ' => 'Ὀ�',
  65358. '�' => 'Ὁ�',
  65359. '�' => 'ὐ',
  65360. 'ὑ' => 'ὑ',
  65361. 'á½’' => 'Ï…Ì“Ì€',
  65362. 'ὓ' => 'ὓ',
  65363. 'ὔ' => 'ὐ�',
  65364. 'ὕ' => 'ὑ�',
  65365. 'á½–' => 'Ï…Ì“Í‚',
  65366. 'ὗ' => 'ὗ',
  65367. 'Ὑ' => 'Ὑ',
  65368. 'Ὓ' => 'Ὓ',
  65369. '�' => 'Ὑ�',
  65370. 'Ὗ' => 'Ὗ',
  65371. 'ὠ' => 'ὠ',
  65372. 'ὡ' => 'ὡ',
  65373. 'ὢ' => 'ὢ',
  65374. 'ὣ' => 'ὣ',
  65375. 'ὤ' => 'ὠ�',
  65376. 'ὥ' => 'ὡ�',
  65377. 'ὦ' => 'ὦ',
  65378. 'ὧ' => 'ὧ',
  65379. 'Ὠ' => 'Ὠ',
  65380. 'Ὡ' => 'Ὡ',
  65381. 'Ὢ' => 'Ὢ',
  65382. 'Ὣ' => 'Ὣ',
  65383. 'Ὤ' => 'Ὠ�',
  65384. 'Ὥ' => 'Ὡ�',
  65385. 'Ὦ' => 'Ὦ',
  65386. 'Ὧ' => 'Ὧ',
  65387. 'ὰ' => 'ὰ',
  65388. 'ά' => 'α�',
  65389. 'ὲ' => 'ὲ',
  65390. 'έ' => 'ε�',
  65391. 'ὴ' => 'ὴ',
  65392. 'ή' => 'η�',
  65393. 'ὶ' => 'ὶ',
  65394. 'ί' => 'ι�',
  65395. 'ὸ' => 'ὸ',
  65396. 'ό' => 'ο�',
  65397. 'ὺ' => 'ὺ',
  65398. 'ύ' => 'υ�',
  65399. 'ὼ' => 'ὼ',
  65400. 'ώ' => 'ω�',
  65401. 'ᾀ' => 'ᾀ',
  65402. '�' => 'ᾁ',
  65403. 'ᾂ' => 'ᾂ',
  65404. 'ᾃ' => 'ᾃ',
  65405. 'ᾄ' => 'ἀ�ͅ',
  65406. 'ᾅ' => 'ἁ�ͅ',
  65407. 'ᾆ' => 'ᾆ',
  65408. 'ᾇ' => 'ᾇ',
  65409. 'ᾈ' => 'ᾈ',
  65410. 'ᾉ' => 'ᾉ',
  65411. 'ᾊ' => 'ᾊ',
  65412. 'ᾋ' => 'ᾋ',
  65413. 'ᾌ' => 'Ἀ�ͅ',
  65414. '�' => 'Ἁ�ͅ',
  65415. 'ᾎ' => 'ᾎ',
  65416. '�' => 'ᾏ',
  65417. '�' => 'ᾐ',
  65418. 'ᾑ' => 'ᾑ',
  65419. 'ᾒ' => 'ᾒ',
  65420. 'ᾓ' => 'ᾓ',
  65421. 'ᾔ' => 'ἠ�ͅ',
  65422. 'ᾕ' => 'ἡ�ͅ',
  65423. 'ᾖ' => 'ᾖ',
  65424. 'ᾗ' => 'ᾗ',
  65425. 'ᾘ' => 'ᾘ',
  65426. 'ᾙ' => 'ᾙ',
  65427. 'ᾚ' => 'ᾚ',
  65428. 'ᾛ' => 'ᾛ',
  65429. 'ᾜ' => 'Ἠ�ͅ',
  65430. '�' => 'Ἡ�ͅ',
  65431. 'ᾞ' => 'ᾞ',
  65432. 'ᾟ' => 'ᾟ',
  65433. 'ᾠ' => 'ᾠ',
  65434. 'ᾡ' => 'ᾡ',
  65435. 'ᾢ' => 'ᾢ',
  65436. 'ᾣ' => 'ᾣ',
  65437. 'ᾤ' => 'ὠ�ͅ',
  65438. 'ᾥ' => 'ὡ�ͅ',
  65439. 'ᾦ' => 'ᾦ',
  65440. 'ᾧ' => 'ᾧ',
  65441. 'ᾨ' => 'ᾨ',
  65442. 'ᾩ' => 'ᾩ',
  65443. 'ᾪ' => 'ᾪ',
  65444. 'ᾫ' => 'ᾫ',
  65445. 'ᾬ' => 'Ὠ�ͅ',
  65446. 'ᾭ' => 'Ὡ�ͅ',
  65447. 'ᾮ' => 'ᾮ',
  65448. 'ᾯ' => 'ᾯ',
  65449. 'ᾰ' => 'ᾰ',
  65450. 'ᾱ' => 'ᾱ',
  65451. 'ᾲ' => 'ᾲ',
  65452. 'ᾳ' => 'ᾳ',
  65453. 'ᾴ' => 'α�ͅ',
  65454. 'ᾶ' => 'ᾶ',
  65455. 'ᾷ' => 'ᾷ',
  65456. 'Ᾰ' => 'Ᾰ',
  65457. 'Ᾱ' => 'Ᾱ',
  65458. 'Ὰ' => 'Ὰ',
  65459. 'Ά' => 'Α�',
  65460. 'ᾼ' => 'ᾼ',
  65461. 'ι' => 'ι',
  65462. '�' => '῁',
  65463. 'ῂ' => 'ῂ',
  65464. 'ῃ' => 'ῃ',
  65465. 'ῄ' => 'η�ͅ',
  65466. 'ῆ' => 'ῆ',
  65467. 'ῇ' => 'ῇ',
  65468. 'Ὲ' => 'Ὲ',
  65469. 'Έ' => 'Ε�',
  65470. 'Ὴ' => 'Ὴ',
  65471. 'Ή' => 'Η�',
  65472. 'ῌ' => 'ῌ',
  65473. '�' => '῍',
  65474. '῎' => '᾿�',
  65475. '�' => '῏',
  65476. '�' => 'ῐ',
  65477. 'ῑ' => 'ῑ',
  65478. 'ῒ' => 'ῒ',
  65479. 'ΐ' => 'ϊ�',
  65480. 'ῖ' => 'ῖ',
  65481. 'ῗ' => 'ῗ',
  65482. 'Ῐ' => 'Ῐ',
  65483. 'Ῑ' => 'Ῑ',
  65484. 'Ὶ' => 'Ὶ',
  65485. 'Ί' => 'Ι�',
  65486. '�' => '῝',
  65487. '῞' => '῾�',
  65488. '῟' => '῟',
  65489. 'ῠ' => 'ῠ',
  65490. 'á¿¡' => 'Ï…Ì„',
  65491. 'ῢ' => 'ῢ',
  65492. 'ΰ' => 'ϋ�',
  65493. 'ῤ' => '�̓',
  65494. 'ῥ' => '�̔',
  65495. 'ῦ' => 'ῦ',
  65496. 'ῧ' => 'ῧ',
  65497. 'Ῠ' => 'Ῠ',
  65498. 'Ῡ' => 'Ῡ',
  65499. 'Ὺ' => 'Ὺ',
  65500. 'Ύ' => 'Υ�',
  65501. 'Ῥ' => 'Ῥ',
  65502. '῭' => '῭',
  65503. '΅' => '¨�',
  65504. '`' => '`',
  65505. 'ῲ' => 'ῲ',
  65506. 'ῳ' => 'ῳ',
  65507. 'ῴ' => 'ω�ͅ',
  65508. 'ῶ' => 'ῶ',
  65509. 'ῷ' => 'ῷ',
  65510. 'Ὸ' => 'Ὸ',
  65511. 'Ό' => 'Ο�',
  65512. 'Ὼ' => 'Ὼ',
  65513. 'Ώ' => 'Ω�',
  65514. 'ῼ' => 'ῼ',
  65515. '´' => '´',
  65516. ' ' => ' ',
  65517. '�' => ' ',
  65518. 'Ω' => 'Ω',
  65519. 'K' => 'K',
  65520. 'â„«' => 'AÌŠ',
  65521. '↚' => '�̸',
  65522. '↛' => '↛',
  65523. '↮' => '↮',
  65524. '�' => '�̸',
  65525. '⇎' => '⇎',
  65526. '�' => '⇏',
  65527. '∄' => '∄',
  65528. '∉' => '∉',
  65529. '∌' => '∌',
  65530. '∤' => '∤',
  65531. '∦' => '∦',
  65532. '�' => '≁',
  65533. '≄' => '≄',
  65534. '≇' => '≇',
  65535. '≉' => '≉',
  65536. '≠' => '≠',
  65537. '≢' => '≢',
  65538. '≭' => '�̸',
  65539. '≮' => '≮',
  65540. '≯' => '≯',
  65541. '≰' => '≰',
  65542. '≱' => '≱',
  65543. '≴' => '≴',
  65544. '≵' => '≵',
  65545. '≸' => '≸',
  65546. '≹' => '≹',
  65547. '⊀' => '⊀',
  65548. '�' => '⊁',
  65549. '⊄' => '⊄',
  65550. '⊅' => '⊅',
  65551. '⊈' => '⊈',
  65552. '⊉' => '⊉',
  65553. '⊬' => '⊬',
  65554. '⊭' => '⊭',
  65555. '⊮' => '⊮',
  65556. '⊯' => '⊯',
  65557. '⋠' => '⋠',
  65558. '⋡' => '⋡',
  65559. '⋢' => '⋢',
  65560. '⋣' => '⋣',
  65561. '⋪' => '⋪',
  65562. '⋫' => '⋫',
  65563. '⋬' => '⋬',
  65564. '⋭' => '⋭',
  65565. '〈' => '〈',
  65566. '〉' => '〉',
  65567. '⫝̸' => '�̸',
  65568. '�' => '�゙',
  65569. '�' => '�゙',
  65570. '�' => '�゙',
  65571. '�' => '�゙',
  65572. '�' => '�゙',
  65573. '�' => '�゙',
  65574. '�' => '�゙',
  65575. '�' => '�゙',
  65576. '�' => '�゙',
  65577. '�' => '�゙',
  65578. '�' => '�゙',
  65579. '�' => '�゙',
  65580. '�' => '�゙',
  65581. '�' => '�゙',
  65582. '�' => '�゙',
  65583. '�' => '�゙',
  65584. '�' => '�゚',
  65585. '�' => '�゙',
  65586. '�' => '�゚',
  65587. '�' => '�゙',
  65588. '�' => '�゚',
  65589. '�' => '�゙',
  65590. '�' => '�゚',
  65591. '�' => '�゙',
  65592. '�' => '�゚',
  65593. 'ゔ' => '�゙',
  65594. 'ゞ' => '�゙',
  65595. 'ガ' => 'ガ',
  65596. 'ã‚®' => 'ã‚­ã‚™',
  65597. 'グ' => 'グ',
  65598. 'ゲ' => 'ゲ',
  65599. 'ゴ' => 'ゴ',
  65600. 'ザ' => 'ザ',
  65601. 'ジ' => 'ジ',
  65602. 'ズ' => 'ズ',
  65603. 'ゼ' => 'ゼ',
  65604. 'ゾ' => 'ゾ',
  65605. 'ダ' => 'ダ',
  65606. 'ヂ' => '�゙',
  65607. 'ヅ' => 'ヅ',
  65608. 'デ' => 'デ',
  65609. 'ド' => 'ド',
  65610. '�' => '�゙',
  65611. 'パ' => '�゚',
  65612. 'ビ' => 'ビ',
  65613. 'ピ' => 'ピ',
  65614. 'ブ' => 'ブ',
  65615. 'プ' => 'プ',
  65616. 'ベ' => 'ベ',
  65617. 'ペ' => 'ペ',
  65618. 'ボ' => 'ボ',
  65619. '�' => 'ポ',
  65620. 'ヴ' => 'ヴ',
  65621. 'ヷ' => 'ヷ',
  65622. 'ヸ' => 'ヸ',
  65623. 'ヹ' => 'ヹ',
  65624. 'ヺ' => 'ヺ',
  65625. 'ヾ' => 'ヾ',
  65626. '豈' => '豈',
  65627. '�' => '更',
  65628. '車' => '車',
  65629. '賈' => '賈',
  65630. '滑' => '滑',
  65631. '串' => '串',
  65632. '句' => '�',
  65633. '龜' => '龜',
  65634. '龜' => '龜',
  65635. '契' => '契',
  65636. '金' => '金',
  65637. '喇' => '喇',
  65638. '奈' => '奈',
  65639. '�' => '懶',
  65640. '癩' => '癩',
  65641. '�' => '羅',
  65642. '�' => '蘿',
  65643. '螺' => '螺',
  65644. '裸' => '裸',
  65645. '邏' => '�',
  65646. '樂' => '樂',
  65647. '洛' => '洛',
  65648. '烙' => '烙',
  65649. '珞' => '�',
  65650. '落' => '�',
  65651. '酪' => '酪',
  65652. '駱' => '駱',
  65653. '亂' => '亂',
  65654. '卵' => '�',
  65655. '�' => '欄',
  65656. '爛' => '爛',
  65657. '蘭' => '蘭',
  65658. '鸞' => '鸞',
  65659. '嵐' => '�',
  65660. '濫' => '濫',
  65661. '藍' => '�',
  65662. '襤' => '襤',
  65663. '拉' => '拉',
  65664. '臘' => '臘',
  65665. '蠟' => '蠟',
  65666. '廊' => '廊',
  65667. '朗' => '朗',
  65668. '浪' => '浪',
  65669. '狼' => '狼',
  65670. '郎' => '郎',
  65671. '來' => '來',
  65672. '冷' => '冷',
  65673. '勞' => '勞',
  65674. '擄' => '擄',
  65675. '櫓' => '櫓',
  65676. '爐' => '�',
  65677. '盧' => '盧',
  65678. '老' => '�',
  65679. '蘆' => '蘆',
  65680. '虜' => '虜',
  65681. '路' => '路',
  65682. '露' => '露',
  65683. '魯' => '魯',
  65684. '鷺' => '鷺',
  65685. '碌' => '碌',
  65686. '祿' => '祿',
  65687. '綠' => '綠',
  65688. '菉' => '�',
  65689. '錄' => '錄',
  65690. '鹿' => '鹿',
  65691. '�' => '論',
  65692. '壟' => '壟',
  65693. '弄' => '弄',
  65694. '籠' => '籠',
  65695. '聾' => '�',
  65696. '牢' => '牢',
  65697. '磊' => '磊',
  65698. '賂' => '賂',
  65699. '雷' => '雷',
  65700. '壘' => '壘',
  65701. '屢' => '屢',
  65702. '樓' => '樓',
  65703. '�' => '淚',
  65704. '漏' => '�',
  65705. '�' => '累',
  65706. '�' => '縷',
  65707. '陋' => '陋',
  65708. '勒' => '勒',
  65709. '肋' => '肋',
  65710. '凜' => '凜',
  65711. '凌' => '凌',
  65712. '稜' => '稜',
  65713. '綾' => '綾',
  65714. '菱' => '�',
  65715. '陵' => '陵',
  65716. '讀' => '讀',
  65717. '拏' => '�',
  65718. '樂' => '樂',
  65719. '�' => '諾',
  65720. '丹' => '丹',
  65721. '寧' => '寧',
  65722. '怒' => '怒',
  65723. '率' => '率',
  65724. '異' => '異',
  65725. '北' => '北',
  65726. '磻' => '磻',
  65727. '便' => '便',
  65728. '復' => '復',
  65729. '不' => '�',
  65730. '泌' => '泌',
  65731. '數' => '數',
  65732. '索' => '索',
  65733. '參' => '�',
  65734. '塞' => '塞',
  65735. '省' => '�',
  65736. '葉' => '葉',
  65737. '說' => '說',
  65738. '殺' => '殺',
  65739. '辰' => '辰',
  65740. '沈' => '沈',
  65741. '拾' => '拾',
  65742. '若' => '若',
  65743. '掠' => '掠',
  65744. '略' => '略',
  65745. '亮' => '亮',
  65746. '兩' => '兩',
  65747. '凉' => '凉',
  65748. '梁' => '�',
  65749. '糧' => '糧',
  65750. '良' => '良',
  65751. '諒' => '諒',
  65752. '量' => '�',
  65753. '勵' => '勵',
  65754. '呂' => '呂',
  65755. '�' => '女',
  65756. '廬' => '廬',
  65757. '旅' => '旅',
  65758. '濾' => '濾',
  65759. '礪' => '礪',
  65760. '閭' => '閭',
  65761. '驪' => '驪',
  65762. '麗' => '麗',
  65763. '黎' => '黎',
  65764. '力' => '力',
  65765. '曆' => '曆',
  65766. '歷' => '歷',
  65767. '�' => '轢',
  65768. '年' => '年',
  65769. '�' => '�',
  65770. '�' => '戀',
  65771. '撚' => '撚',
  65772. '漣' => '漣',
  65773. '煉' => '煉',
  65774. '璉' => '璉',
  65775. '秊' => '秊',
  65776. '練' => '練',
  65777. '聯' => '�',
  65778. '輦' => '輦',
  65779. '蓮' => '蓮',
  65780. '連' => '連',
  65781. '鍊' => '�',
  65782. '列' => '列',
  65783. '�' => '劣',
  65784. '咽' => '咽',
  65785. '烈' => '烈',
  65786. '裂' => '裂',
  65787. '說' => '說',
  65788. '廉' => '廉',
  65789. '念' => '念',
  65790. '捻' => '�',
  65791. '殮' => '殮',
  65792. '簾' => '簾',
  65793. '獵' => '�',
  65794. '令' => '令',
  65795. '囹' => '囹',
  65796. '寧' => '寧',
  65797. '嶺' => '嶺',
  65798. '怜' => '怜',
  65799. '玲' => '玲',
  65800. '瑩' => '瑩',
  65801. '羚' => '羚',
  65802. '聆' => '�',
  65803. '鈴' => '鈴',
  65804. '零' => '零',
  65805. '靈' => '�',
  65806. '領' => '領',
  65807. '例' => '例',
  65808. '禮' => '禮',
  65809. '醴' => '醴',
  65810. '隸' => '隸',
  65811. '惡' => '惡',
  65812. '了' => '了',
  65813. '僚' => '僚',
  65814. '寮' => '寮',
  65815. '尿' => '尿',
  65816. '料' => '料',
  65817. '樂' => '樂',
  65818. '燎' => '燎',
  65819. '�' => '療',
  65820. '蓼' => '蓼',
  65821. '遼' => '�',
  65822. '龍' => '�',
  65823. '暈' => '暈',
  65824. '阮' => '阮',
  65825. '劉' => '劉',
  65826. '杻' => '�',
  65827. '柳' => '柳',
  65828. '流' => '�',
  65829. '溜' => '溜',
  65830. '琉' => '�',
  65831. '�' => '留',
  65832. '硫' => '硫',
  65833. '�' => '�',
  65834. '�' => '類',
  65835. '六' => '六',
  65836. '戮' => '戮',
  65837. '陸' => '陸',
  65838. '倫' => '倫',
  65839. '崙' => '崙',
  65840. '淪' => '淪',
  65841. '輪' => '輪',
  65842. '律' => '律',
  65843. '慄' => '慄',
  65844. '栗' => '栗',
  65845. '率' => '率',
  65846. '隆' => '隆',
  65847. '�' => '利',
  65848. '吏' => '�',
  65849. '履' => '履',
  65850. '易' => '易',
  65851. '李' => '�',
  65852. '梨' => '梨',
  65853. '泥' => '泥',
  65854. '理' => '�',
  65855. '痢' => '痢',
  65856. '罹' => '罹',
  65857. '裏' => '�',
  65858. '裡' => '裡',
  65859. '里' => '里',
  65860. '離' => '離',
  65861. '匿' => '匿',
  65862. '溺' => '溺',
  65863. '吝' => '�',
  65864. '燐' => '�',
  65865. '璘' => '璘',
  65866. '藺' => '藺',
  65867. '隣' => '隣',
  65868. '鱗' => '鱗',
  65869. '麟' => '麟',
  65870. '林' => '林',
  65871. '淋' => '淋',
  65872. '臨' => '臨',
  65873. '立' => '立',
  65874. '笠' => '笠',
  65875. '粒' => '粒',
  65876. '狀' => '狀',
  65877. '炙' => '炙',
  65878. '識' => '識',
  65879. '什' => '什',
  65880. '茶' => '茶',
  65881. '刺' => '刺',
  65882. '切' => '切',
  65883. '�' => '度',
  65884. '拓' => '拓',
  65885. '糖' => '糖',
  65886. '宅' => '宅',
  65887. '洞' => '洞',
  65888. '暴' => '暴',
  65889. '輻' => '輻',
  65890. '行' => '行',
  65891. '降' => '�',
  65892. '見' => '見',
  65893. '廓' => '廓',
  65894. '兀' => '兀',
  65895. '�' => '嗀',
  65896. '�' => '塚',
  65897. '晴' => '晴',
  65898. '凞' => '凞',
  65899. '猪' => '猪',
  65900. '益' => '益',
  65901. '礼' => '礼',
  65902. '神' => '神',
  65903. '祥' => '祥',
  65904. '福' => '�',
  65905. '靖' => '�',
  65906. '�' => '精',
  65907. '羽' => '羽',
  65908. '蘒' => '蘒',
  65909. '諸' => '諸',
  65910. '逸' => '逸',
  65911. '都' => '都',
  65912. '飯' => '飯',
  65913. '飼' => '飼',
  65914. '館' => '館',
  65915. '鶴' => '鶴',
  65916. '郞' => '郞',
  65917. '隷' => '隷',
  65918. '侮' => '侮',
  65919. '僧' => '僧',
  65920. '免' => '�',
  65921. '勉' => '勉',
  65922. '勤' => '勤',
  65923. '卑' => '�',
  65924. '喝' => '�',
  65925. '嘆' => '嘆',
  65926. '器' => '器',
  65927. '塀' => '塀',
  65928. '墨' => '墨',
  65929. '層' => '層',
  65930. '屮' => '屮',
  65931. '悔' => '悔',
  65932. '慨' => '慨',
  65933. '憎' => '憎',
  65934. '懲' => '懲',
  65935. '�' => '�',
  65936. 'ï©‚' => 'æ—¢',
  65937. '暑' => '暑',
  65938. '梅' => '梅',
  65939. 'ï©…' => 'æµ·',
  65940. '渚' => '渚',
  65941. '漢' => '漢',
  65942. '煮' => '煮',
  65943. '爫' => '爫',
  65944. '琢' => '�',
  65945. '碑' => '碑',
  65946. '社' => '社',
  65947. '�' => '祉',
  65948. '祈' => '祈',
  65949. '�' => '�',
  65950. '�' => '祖',
  65951. '祝' => '�',
  65952. '禍' => '�',
  65953. '禎' => '禎',
  65954. 'ï©”' => 'ç©€',
  65955. '突' => '�',
  65956. '節' => '節',
  65957. 'ï©—' => 'ç·´',
  65958. '縉' => '縉',
  65959. '繁' => '�',
  65960. 'ï©š' => 'ç½²',
  65961. '者' => '者',
  65962. '臭' => '臭',
  65963. '�' => '艹',
  65964. '艹' => '艹',
  65965. 'ï©Ÿ' => 'è‘—',
  65966. '褐' => '�',
  65967. '視' => '視',
  65968. '謁' => '�',
  65969. '謹' => '謹',
  65970. '賓' => '賓',
  65971. 'ï©¥' => 'è´ˆ',
  65972. '辶' => '辶',
  65973. '逸' => '逸',
  65974. '難' => '難',
  65975. '響' => '響',
  65976. '頻' => '頻',
  65977. '恵' => '�',
  65978. '𤋮' => '𤋮',
  65979. '舘' => '舘',
  65980. '並' => '並',
  65981. '况' => '况',
  65982. '全' => '全',
  65983. '侀' => '侀',
  65984. 'ï©´' => 'å……',
  65985. '冀' => '冀',
  65986. '勇' => '勇',
  65987. '勺' => '勺',
  65988. '喝' => '�',
  65989. '啕' => '啕',
  65990. '喙' => '喙',
  65991. 'ï©»' => 'å—¢',
  65992. '塚' => '塚',
  65993. '墳' => '墳',
  65994. '奄' => '奄',
  65995. '奔' => '奔',
  65996. '婢' => '婢',
  65997. '�' => '嬨',
  65998. '廒' => '廒',
  65999. '廙' => '廙',
  66000. '彩' => '彩',
  66001. '徭' => '徭',
  66002. '惘' => '惘',
  66003. '慎' => '慎',
  66004. '愈' => '愈',
  66005. '憎' => '憎',
  66006. '慠' => '慠',
  66007. '懲' => '懲',
  66008. '戴' => '戴',
  66009. '�' => '�',
  66010. '搜' => '�',
  66011. '�' => '摒',
  66012. '�' => '敖',
  66013. '晴' => '晴',
  66014. '朗' => '朗',
  66015. '望' => '望',
  66016. '杖' => '�',
  66017. '歹' => '歹',
  66018. '殺' => '殺',
  66019. '流' => '�',
  66020. '滛' => '滛',
  66021. '滋' => '滋',
  66022. '漢' => '漢',
  66023. '瀞' => '瀞',
  66024. '煮' => '煮',
  66025. '�' => '瞧',
  66026. '爵' => '爵',
  66027. '犯' => '犯',
  66028. '猪' => '猪',
  66029. '瑱' => '瑱',
  66030. '甆' => '甆',
  66031. '画' => '画',
  66032. '瘝' => '�',
  66033. '瘟' => '瘟',
  66034. '益' => '益',
  66035. '盛' => '盛',
  66036. '直' => '直',
  66037. '睊' => '�',
  66038. '着' => '�',
  66039. '磌' => '磌',
  66040. '窱' => '窱',
  66041. '節' => '節',
  66042. '类' => '类',
  66043. '絛' => '絛',
  66044. '練' => '練',
  66045. '缾' => '缾',
  66046. '者' => '者',
  66047. '荒' => '�',
  66048. '華' => '�',
  66049. '蝹' => '�',
  66050. '襁' => '�',
  66051. '覆' => '覆',
  66052. '視' => '視',
  66053. '調' => '調',
  66054. '諸' => '諸',
  66055. '請' => '請',
  66056. '謁' => '�',
  66057. '諾' => '諾',
  66058. '諭' => '諭',
  66059. '謹' => '謹',
  66060. '變' => '變',
  66061. '�' => '贈',
  66062. '輸' => '輸',
  66063. '遲' => '�',
  66064. '醙' => '醙',
  66065. '鉶' => '鉶',
  66066. '陼' => '陼',
  66067. '難' => '難',
  66068. '靖' => '�',
  66069. '韛' => '韛',
  66070. '響' => '響',
  66071. 'ï«‹' => 'é ‹',
  66072. '頻' => '頻',
  66073. '�' => '鬒',
  66074. '龜' => '龜',
  66075. '�' => '𢡊',
  66076. '�' => '𢡄',
  66077. '𣏕' => '�',
  66078. '㮝' => '�',
  66079. '䀘' => '䀘',
  66080. '䀹' => '䀹',
  66081. '𥉉' => '𥉉',
  66082. '𥳐' => '�',
  66083. '𧻓' => '𧻓',
  66084. '齃' => '齃',
  66085. '龎' => '龎',
  66086. '�' => 'יִ',
  66087. 'ײַ' => 'ײַ',
  66088. 'שׁ' => 'ש�',
  66089. 'שׂ' => 'שׂ',
  66090. 'שּׁ' => 'שּ�',
  66091. 'שּׂ' => 'שּׂ',
  66092. 'אַ' => '�ַ',
  66093. 'אָ' => '�ָ',
  66094. 'אּ' => '�ּ',
  66095. 'בּ' => 'בּ',
  66096. 'גּ' => 'גּ',
  66097. 'דּ' => 'דּ',
  66098. 'הּ' => 'הּ',
  66099. 'וּ' => 'וּ',
  66100. 'זּ' => 'זּ',
  66101. 'טּ' => 'טּ',
  66102. 'יּ' => 'יּ',
  66103. 'ךּ' => 'ךּ',
  66104. 'כּ' => 'כּ',
  66105. 'לּ' => 'לּ',
  66106. 'מּ' => 'מּ',
  66107. 'ï­€' => '× Ö¼',
  66108. '�' => 'סּ',
  66109. 'ï­ƒ' => '×£Ö¼',
  66110. 'פּ' => 'פּ',
  66111. 'צּ' => 'צּ',
  66112. 'קּ' => 'קּ',
  66113. 'רּ' => 'רּ',
  66114. 'שּ' => 'שּ',
  66115. 'תּ' => 'תּ',
  66116. 'וֹ' => 'וֹ',
  66117. 'בֿ' => 'בֿ',
  66118. 'ï­�' => '×›Ö¿',
  66119. 'פֿ' => 'פֿ',
  66120. '𑂚' => '𑂚',
  66121. '𑂜' => '𑂜',
  66122. '𑂫' => '𑂫',
  66123. '𑄮' => '𑄮',
  66124. '𑄯' => '𑄯',
  66125. '�' => '�𑌾',
  66126. '�' => '��',
  66127. '𑒻' => '𑒻',
  66128. '𑒼' => '𑒼',
  66129. '𑒾' => '𑒾',
  66130. '𑖺' => '𑖺',
  66131. '𑖻' => '𑖻',
  66132. '𑤸' => '𑤸',
  66133. '�' => '��',
  66134. '�' => '��',
  66135. '�' => '���',
  66136. '�' => '���',
  66137. '�' => '���',
  66138. '�' => '���',
  66139. '�' => '���',
  66140. '�' => '��',
  66141. '�' => '��',
  66142. '�' => '���',
  66143. '�' => '���',
  66144. '�' => '���',
  66145. '�' => '���',
  66146. '丽' => '丽',
  66147. '�' => '丸',
  66148. '乁' => '�',
  66149. '𠄢' => '𠄢',
  66150. '你' => '你',
  66151. '侮' => '侮',
  66152. '侻' => '侻',
  66153. '倂' => '倂',
  66154. '偺' => '�',
  66155. '備' => '備',
  66156. '僧' => '僧',
  66157. '像' => '�',
  66158. '㒞' => '㒞',
  66159. '�' => '𠘺',
  66160. '免' => '�',
  66161. '�' => '兔',
  66162. '�' => '兤',
  66163. '具' => '具',
  66164. '𠔜' => '𠔜',
  66165. '㒹' => '㒹',
  66166. '內' => '內',
  66167. '再' => '�',
  66168. '𠕋' => '𠕋',
  66169. '冗' => '冗',
  66170. '冤' => '冤',
  66171. '仌' => '仌',
  66172. '冬' => '冬',
  66173. '况' => '况',
  66174. '𩇟' => '𩇟',
  66175. '�' => '凵',
  66176. '刃' => '刃',
  66177. '㓟' => '㓟',
  66178. '刻' => '刻',
  66179. '剆' => '剆',
  66180. '割' => '割',
  66181. '剷' => '剷',
  66182. '㔕' => '㔕',
  66183. '勇' => '勇',
  66184. '勉' => '勉',
  66185. '勤' => '勤',
  66186. '勺' => '勺',
  66187. '包' => '包',
  66188. '匆' => '匆',
  66189. '北' => '北',
  66190. '卉' => '�',
  66191. '卑' => '�',
  66192. '博' => '�',
  66193. '即' => '�',
  66194. '卽' => '�',
  66195. '卿' => '�',
  66196. '卿' => '�',
  66197. '卿' => '�',
  66198. '𠨬' => '𠨬',
  66199. '灰' => '�',
  66200. '及' => '�',
  66201. '叟' => '�',
  66202. '𠭣' => '𠭣',
  66203. '叫' => '�',
  66204. '叱' => '�',
  66205. '吆' => '�',
  66206. '咞' => '咞',
  66207. '吸' => '�',
  66208. '呈' => '呈',
  66209. '周' => '周',
  66210. '咢' => '咢',
  66211. '�' => '哶',
  66212. '唐' => '�',
  66213. '啓' => '啓',
  66214. '啣' => '啣',
  66215. '善' => '善',
  66216. '善' => '善',
  66217. '喙' => '喙',
  66218. '喫' => '喫',
  66219. '喳' => '喳',
  66220. '嗂' => '嗂',
  66221. '圖' => '圖',
  66222. '嘆' => '嘆',
  66223. '�' => '圗',
  66224. '噑' => '噑',
  66225. '�' => '噴',
  66226. '�' => '切',
  66227. '壮' => '壮',
  66228. '城' => '城',
  66229. '埴' => '埴',
  66230. '堍' => '�',
  66231. '型' => '型',
  66232. '堲' => '堲',
  66233. '報' => '報',
  66234. '墬' => '墬',
  66235. '𡓤' => '𡓤',
  66236. '売' => '売',
  66237. '壷' => '壷',
  66238. '夆' => '夆',
  66239. '�' => '多',
  66240. '夢' => '夢',
  66241. '奢' => '奢',
  66242. '𡚨' => '𡚨',
  66243. '𡛪' => '𡛪',
  66244. '姬' => '姬',
  66245. '娛' => '娛',
  66246. '娧' => '娧',
  66247. '姘' => '姘',
  66248. '婦' => '婦',
  66249. '㛮' => '㛮',
  66250. '㛼' => '㛼',
  66251. '嬈' => '嬈',
  66252. '嬾' => '嬾',
  66253. '嬾' => '嬾',
  66254. '𡧈' => '𡧈',
  66255. '寃' => '寃',
  66256. '寘' => '寘',
  66257. '寧' => '寧',
  66258. '寳' => '寳',
  66259. '𡬘' => '𡬘',
  66260. '寿' => '寿',
  66261. '将' => '将',
  66262. '当' => '当',
  66263. '尢' => '尢',
  66264. '㞁' => '�',
  66265. '屠' => '屠',
  66266. '屮' => '屮',
  66267. '峀' => '峀',
  66268. '岍' => '�',
  66269. '𡷤' => '𡷤',
  66270. '嵃' => '嵃',
  66271. '𡷦' => '𡷦',
  66272. '嵮' => '嵮',
  66273. '嵫' => '嵫',
  66274. '嵼' => '嵼',
  66275. '�' => '巡',
  66276. '巢' => '巢',
  66277. '㠯' => '㠯',
  66278. '巽' => '巽',
  66279. '帨' => '帨',
  66280. '帽' => '帽',
  66281. '幩' => '幩',
  66282. '㡢' => '㡢',
  66283. '𢆃' => '𢆃',
  66284. '㡼' => '㡼',
  66285. '庰' => '庰',
  66286. '庳' => '庳',
  66287. '�' => '庶',
  66288. '廊' => '廊',
  66289. '�' => '𪎒',
  66290. '�' => '廾',
  66291. '𢌱' => '𢌱',
  66292. '𢌱' => '𢌱',
  66293. '舁' => '�',
  66294. '弢' => '弢',
  66295. '弢' => '弢',
  66296. '㣇' => '㣇',
  66297. '𣊸' => '𣊸',
  66298. '𦇚' => '𦇚',
  66299. '形' => '形',
  66300. '彫' => '彫',
  66301. '㣣' => '㣣',
  66302. '徚' => '徚',
  66303. '�' => '�',
  66304. '志' => '志',
  66305. '忹' => '忹',
  66306. '悁' => '�',
  66307. '㤺' => '㤺',
  66308. '㤜' => '㤜',
  66309. '悔' => '悔',
  66310. '𢛔' => '𢛔',
  66311. '惇' => '惇',
  66312. '慈' => '慈',
  66313. '慌' => '慌',
  66314. '慎' => '慎',
  66315. '慌' => '慌',
  66316. '慺' => '慺',
  66317. '憎' => '憎',
  66318. '憲' => '憲',
  66319. '憤' => '憤',
  66320. '憯' => '憯',
  66321. '懞' => '懞',
  66322. '懲' => '懲',
  66323. '懶' => '懶',
  66324. '成' => '�',
  66325. '戛' => '戛',
  66326. '扝' => '�',
  66327. '抱' => '抱',
  66328. '拔' => '拔',
  66329. '捐' => '�',
  66330. '𢬌' => '𢬌',
  66331. '挽' => '挽',
  66332. '拼' => '拼',
  66333. '捨' => '�',
  66334. '掃' => '掃',
  66335. '揤' => '�',
  66336. '𢯱' => '𢯱',
  66337. '搢' => '�',
  66338. '揅' => '�',
  66339. '�' => '掩',
  66340. '㨮' => '㨮',
  66341. '摩' => '摩',
  66342. '摾' => '摾',
  66343. '撝' => '�',
  66344. '摷' => '摷',
  66345. '㩬' => '㩬',
  66346. '敏' => '�',
  66347. '敬' => '敬',
  66348. '𣀊' => '𣀊',
  66349. '旣' => '旣',
  66350. '書' => '書',
  66351. '�' => '晉',
  66352. '㬙' => '㬙',
  66353. '�' => '暑',
  66354. '�' => '㬈',
  66355. '㫤' => '㫤',
  66356. '冒' => '冒',
  66357. '冕' => '冕',
  66358. '最' => '最',
  66359. '暜' => '暜',
  66360. '肭' => '肭',
  66361. '䏙' => '�',
  66362. '朗' => '朗',
  66363. '望' => '望',
  66364. '朡' => '朡',
  66365. '杞' => '�',
  66366. '杓' => '�',
  66367. '�' => '�',
  66368. '㭉' => '㭉',
  66369. '柺' => '柺',
  66370. '枅' => '枅',
  66371. '桒' => '桒',
  66372. '梅' => '梅',
  66373. '𣑭' => '𣑭',
  66374. '梎' => '梎',
  66375. '栟' => '栟',
  66376. '椔' => '椔',
  66377. '㮝' => '�',
  66378. '楂' => '楂',
  66379. '榣' => '榣',
  66380. '槪' => '槪',
  66381. '檨' => '檨',
  66382. '𣚣' => '𣚣',
  66383. '櫛' => '櫛',
  66384. '㰘' => '㰘',
  66385. '次' => '次',
  66386. '𣢧' => '𣢧',
  66387. '歔' => '歔',
  66388. '㱎' => '㱎',
  66389. '歲' => '歲',
  66390. '殟' => '殟',
  66391. '殺' => '殺',
  66392. '殻' => '殻',
  66393. '𣪍' => '�',
  66394. '𡴋' => '𡴋',
  66395. '𣫺' => '𣫺',
  66396. '汎' => '汎',
  66397. '𣲼' => '𣲼',
  66398. '沿' => '沿',
  66399. '泍' => '�',
  66400. '汧' => '汧',
  66401. '洖' => '洖',
  66402. '派' => '派',
  66403. '�' => '海',
  66404. '流' => '�',
  66405. '浩' => '浩',
  66406. '浸' => '浸',
  66407. '涅' => '涅',
  66408. '𣴞' => '𣴞',
  66409. '洴' => '洴',
  66410. '港' => '港',
  66411. '湮' => '湮',
  66412. '㴳' => '㴳',
  66413. '滋' => '滋',
  66414. '滇' => '滇',
  66415. '�' => '𣻑',
  66416. '淹' => '淹',
  66417. '�' => '潮',
  66418. '�' => '𣽞',
  66419. '𣾎' => '𣾎',
  66420. '濆' => '濆',
  66421. '瀹' => '瀹',
  66422. '瀞' => '瀞',
  66423. '瀛' => '瀛',
  66424. '㶖' => '㶖',
  66425. '灊' => '�',
  66426. '災' => '�',
  66427. '灷' => '�',
  66428. '炭' => '炭',
  66429. '𠔥' => '𠔥',
  66430. '煅' => '煅',
  66431. '�' => '𤉣',
  66432. '熜' => '熜',
  66433. '𤎫' => '𤎫',
  66434. '爨' => '爨',
  66435. '爵' => '爵',
  66436. '牐' => '�',
  66437. '𤘈' => '𤘈',
  66438. '犀' => '犀',
  66439. '犕' => '犕',
  66440. '𤜵' => '𤜵',
  66441. '𤠔' => '𤠔',
  66442. '獺' => '�',
  66443. '王' => '王',
  66444. '㺬' => '㺬',
  66445. '玥' => '玥',
  66446. '㺸' => '㺸',
  66447. '㺸' => '㺸',
  66448. '瑇' => '瑇',
  66449. '瑜' => '瑜',
  66450. '瑱' => '瑱',
  66451. '璅' => '璅',
  66452. '瓊' => '瓊',
  66453. '㼛' => '㼛',
  66454. '甤' => '甤',
  66455. '𤰶' => '𤰶',
  66456. '甾' => '甾',
  66457. '𤲒' => '𤲒',
  66458. '異' => '異',
  66459. '𢆟' => '𢆟',
  66460. '瘐' => '�',
  66461. '𤾡' => '𤾡',
  66462. '𤾸' => '𤾸',
  66463. '𥁄' => '�',
  66464. '㿼' => '㿼',
  66465. '䀈' => '䀈',
  66466. '直' => '直',
  66467. '�' => '𥃳',
  66468. '𥃲' => '𥃲',
  66469. '𥄙' => '𥄙',
  66470. '𥄳' => '𥄳',
  66471. '眞' => '眞',
  66472. '真' => '真',
  66473. '真' => '真',
  66474. '睊' => '�',
  66475. '䀹' => '䀹',
  66476. '瞋' => '瞋',
  66477. '䁆' => '�',
  66478. '䂖' => '䂖',
  66479. '�' => '�',
  66480. '硎' => '硎',
  66481. '�' => '碌',
  66482. '�' => '磌',
  66483. '䃣' => '䃣',
  66484. '𥘦' => '𥘦',
  66485. '祖' => '祖',
  66486. '𥚚' => '𥚚',
  66487. '𥛅' => '𥛅',
  66488. '福' => '�',
  66489. '秫' => '秫',
  66490. '䄯' => '䄯',
  66491. '穀' => '穀',
  66492. '穊' => '穊',
  66493. '穏' => '�',
  66494. '𥥼' => '𥥼',
  66495. '�' => '𥪧',
  66496. '𥪧' => '𥪧',
  66497. '竮' => '竮',
  66498. '䈂' => '䈂',
  66499. '𥮫' => '𥮫',
  66500. '篆' => '篆',
  66501. '築' => '築',
  66502. '䈧' => '䈧',
  66503. '𥲀' => '𥲀',
  66504. '糒' => '糒',
  66505. '䊠' => '䊠',
  66506. '糨' => '糨',
  66507. '糣' => '糣',
  66508. '紀' => '紀',
  66509. '𥾆' => '𥾆',
  66510. '絣' => '絣',
  66511. '䌁' => '�',
  66512. '緇' => '緇',
  66513. '縂' => '縂',
  66514. '繅' => '繅',
  66515. '䌴' => '䌴',
  66516. '𦈨' => '𦈨',
  66517. '𦉇' => '𦉇',
  66518. '䍙' => '�',
  66519. '𦋙' => '𦋙',
  66520. '罺' => '罺',
  66521. '𦌾' => '𦌾',
  66522. '羕' => '羕',
  66523. '翺' => '翺',
  66524. '者' => '者',
  66525. '𦓚' => '𦓚',
  66526. '𦔣' => '𦔣',
  66527. '聠' => '�',
  66528. '𦖨' => '𦖨',
  66529. '聰' => '�',
  66530. '𣍟' => '�',
  66531. '�' => '�',
  66532. '育' => '育',
  66533. '脃' => '脃',
  66534. '䐋' => '�',
  66535. '脾' => '脾',
  66536. '媵' => '媵',
  66537. '𦞧' => '𦞧',
  66538. '𦞵' => '𦞵',
  66539. '𣎓' => '𣎓',
  66540. '𣎜' => '𣎜',
  66541. '舁' => '�',
  66542. '舄' => '舄',
  66543. '�' => '辞',
  66544. '䑫' => '䑫',
  66545. '�' => '芑',
  66546. '�' => '芋',
  66547. '芝' => '�',
  66548. '劳' => '劳',
  66549. '花' => '花',
  66550. '芳' => '芳',
  66551. '芽' => '芽',
  66552. '苦' => '苦',
  66553. '𦬼' => '𦬼',
  66554. '若' => '若',
  66555. '茝' => '�',
  66556. '荣' => '�',
  66557. '莭' => '莭',
  66558. '茣' => '茣',
  66559. '�' => '莽',
  66560. '菧' => '�',
  66561. '著' => '著',
  66562. '荓' => '�',
  66563. '菊' => '�',
  66564. '菌' => '�',
  66565. '菜' => '�',
  66566. '𦰶' => '𦰶',
  66567. '𦵫' => '𦵫',
  66568. '𦳕' => '𦳕',
  66569. '䔫' => '䔫',
  66570. '蓱' => '蓱',
  66571. '蓳' => '蓳',
  66572. '蔖' => '蔖',
  66573. '𧏊' => '�',
  66574. '蕤' => '蕤',
  66575. '𦼬' => '𦼬',
  66576. '䕝' => '�',
  66577. '䕡' => '䕡',
  66578. '𦾱' => '𦾱',
  66579. '𧃒' => '𧃒',
  66580. '䕫' => '䕫',
  66581. '虐' => '�',
  66582. '虜' => '虜',
  66583. '虧' => '虧',
  66584. '虩' => '虩',
  66585. '蚩' => '蚩',
  66586. '蚈' => '蚈',
  66587. '蜎' => '蜎',
  66588. '蛢' => '蛢',
  66589. '蝹' => '�',
  66590. '蜨' => '蜨',
  66591. '蝫' => '�',
  66592. '螆' => '螆',
  66593. '䗗' => '䗗',
  66594. '蟡' => '蟡',
  66595. '�' => '�',
  66596. '䗹' => '䗹',
  66597. '衠' => '衠',
  66598. '衣' => '衣',
  66599. '𧙧' => '𧙧',
  66600. '裗' => '裗',
  66601. '裞' => '裞',
  66602. '䘵' => '䘵',
  66603. '裺' => '裺',
  66604. '㒻' => '㒻',
  66605. '𧢮' => '𧢮',
  66606. '𧥦' => '𧥦',
  66607. '�' => '䚾',
  66608. '䛇' => '䛇',
  66609. '�' => '誠',
  66610. '�' => '諭',
  66611. '變' => '變',
  66612. '豕' => '豕',
  66613. '𧲨' => '𧲨',
  66614. '貫' => '貫',
  66615. '賁' => '�',
  66616. '贛' => '贛',
  66617. '起' => '起',
  66618. '𧼯' => '𧼯',
  66619. '𠠄' => '𠠄',
  66620. '跋' => '跋',
  66621. '趼' => '趼',
  66622. '跰' => '跰',
  66623. '�' => '𠣞',
  66624. '軔' => '軔',
  66625. '輸' => '輸',
  66626. '𨗒' => '𨗒',
  66627. '𨗭' => '𨗭',
  66628. '邔' => '邔',
  66629. '郱' => '郱',
  66630. '鄑' => '鄑',
  66631. '𨜮' => '𨜮',
  66632. '鄛' => '鄛',
  66633. '鈸' => '鈸',
  66634. '鋗' => '鋗',
  66635. '鋘' => '鋘',
  66636. '鉼' => '鉼',
  66637. '鏹' => '�',
  66638. '鐕' => '�',
  66639. '𨯺' => '𨯺',
  66640. '開' => '開',
  66641. '䦕' => '䦕',
  66642. '閷' => '閷',
  66643. '𨵷' => '𨵷',
  66644. '䧦' => '䧦',
  66645. '雃' => '雃',
  66646. '嶲' => '嶲',
  66647. '霣' => '霣',
  66648. '𩅅' => '𩅅',
  66649. '𩈚' => '𩈚',
  66650. '䩮' => '䩮',
  66651. '䩶' => '䩶',
  66652. '韠' => '韠',
  66653. '𩐊' => '�',
  66654. '䪲' => '䪲',
  66655. '𩒖' => '𩒖',
  66656. '頋' => '頋',
  66657. '頋' => '頋',
  66658. '頩' => '頩',
  66659. '�' => '𩖶',
  66660. '飢' => '飢',
  66661. '䬳' => '䬳',
  66662. '餩' => '餩',
  66663. '馧' => '馧',
  66664. '駂' => '駂',
  66665. '駾' => '駾',
  66666. '䯎' => '䯎',
  66667. '𩬰' => '𩬰',
  66668. '鬒' => '鬒',
  66669. '鱀' => '鱀',
  66670. '鳽' => '鳽',
  66671. '�' => '䳎',
  66672. '䳭' => '䳭',
  66673. '�' => '鵧',
  66674. '�' => '𪃎',
  66675. '䳸' => '䳸',
  66676. '𪄅' => '𪄅',
  66677. '𪈎' => '𪈎',
  66678. '𪊑' => '𪊑',
  66679. '麻' => '麻',
  66680. '䵖' => '䵖',
  66681. '黹' => '黹',
  66682. '黾' => '黾',
  66683. '鼅' => '鼅',
  66684. '鼏' => '�',
  66685. '鼖' => '鼖',
  66686. '鼻' => '鼻',
  66687. '�' => '𪘀',
  66688. );
  66689. <?php
  66690. return array (
  66691. 'Ì€' => 230,
  66692. '�' => 230,
  66693. 'Ì‚' => 230,
  66694. '̃' => 230,
  66695. 'Ì„' => 230,
  66696. 'Ì…' => 230,
  66697. '̆' => 230,
  66698. '̇' => 230,
  66699. '̈' => 230,
  66700. '̉' => 230,
  66701. 'ÌŠ' => 230,
  66702. 'Ì‹' => 230,
  66703. '̌' => 230,
  66704. '�' => 230,
  66705. 'ÌŽ' => 230,
  66706. '�' => 230,
  66707. '�' => 230,
  66708. 'Ì‘' => 230,
  66709. 'Ì’' => 230,
  66710. 'Ì“' => 230,
  66711. 'Ì”' => 230,
  66712. 'Ì•' => 232,
  66713. 'Ì–' => 220,
  66714. 'Ì—' => 220,
  66715. '̘' => 220,
  66716. 'Ì™' => 220,
  66717. 'Ìš' => 232,
  66718. 'Ì›' => 216,
  66719. '̜' => 220,
  66720. '�' => 220,
  66721. 'Ìž' => 220,
  66722. 'ÌŸ' => 220,
  66723. 'Ì ' => 220,
  66724. 'Ì¡' => 202,
  66725. 'Ì¢' => 202,
  66726. 'Ì£' => 220,
  66727. '̤' => 220,
  66728. 'Ì¥' => 220,
  66729. '̦' => 220,
  66730. '̧' => 202,
  66731. '̨' => 202,
  66732. 'Ì©' => 220,
  66733. '̪' => 220,
  66734. 'Ì«' => 220,
  66735. '̬' => 220,
  66736. 'Ì­' => 220,
  66737. 'Ì®' => 220,
  66738. '̯' => 220,
  66739. 'Ì°' => 220,
  66740. '̱' => 220,
  66741. '̲' => 220,
  66742. '̳' => 220,
  66743. 'Ì´' => 1,
  66744. '̵' => 1,
  66745. '̶' => 1,
  66746. 'Ì·' => 1,
  66747. '̸' => 1,
  66748. '̹' => 220,
  66749. '̺' => 220,
  66750. 'Ì»' => 220,
  66751. '̼' => 220,
  66752. '̽' => 230,
  66753. '̾' => 230,
  66754. 'Ì¿' => 230,
  66755. 'Í€' => 230,
  66756. '�' => 230,
  66757. 'Í‚' => 230,
  66758. '̓' => 230,
  66759. 'Í„' => 230,
  66760. 'Í…' => 240,
  66761. '͆' => 230,
  66762. '͇' => 220,
  66763. '͈' => 220,
  66764. '͉' => 220,
  66765. 'ÍŠ' => 230,
  66766. 'Í‹' => 230,
  66767. '͌' => 230,
  66768. '�' => 220,
  66769. 'ÍŽ' => 220,
  66770. '�' => 230,
  66771. 'Í‘' => 230,
  66772. 'Í’' => 230,
  66773. 'Í“' => 220,
  66774. 'Í”' => 220,
  66775. 'Í•' => 220,
  66776. 'Í–' => 220,
  66777. 'Í—' => 230,
  66778. '͘' => 232,
  66779. 'Í™' => 220,
  66780. 'Íš' => 220,
  66781. 'Í›' => 230,
  66782. '͜' => 233,
  66783. '�' => 234,
  66784. 'Íž' => 234,
  66785. 'ÍŸ' => 233,
  66786. 'Í ' => 234,
  66787. 'Í¡' => 234,
  66788. 'Í¢' => 233,
  66789. 'Í£' => 230,
  66790. 'ͤ' => 230,
  66791. 'Í¥' => 230,
  66792. 'ͦ' => 230,
  66793. 'ͧ' => 230,
  66794. 'ͨ' => 230,
  66795. 'Í©' => 230,
  66796. 'ͪ' => 230,
  66797. 'Í«' => 230,
  66798. 'ͬ' => 230,
  66799. 'Í­' => 230,
  66800. 'Í®' => 230,
  66801. 'ͯ' => 230,
  66802. 'Òƒ' => 230,
  66803. 'Ò„' => 230,
  66804. 'Ò…' => 230,
  66805. 'Ò†' => 230,
  66806. 'Ò‡' => 230,
  66807. 'Ö‘' => 220,
  66808. 'Ö’' => 230,
  66809. 'Ö“' => 230,
  66810. 'Ö”' => 230,
  66811. 'Ö•' => 230,
  66812. 'Ö–' => 220,
  66813. 'Ö—' => 230,
  66814. 'Ö˜' => 230,
  66815. 'Ö™' => 230,
  66816. 'Öš' => 222,
  66817. 'Ö›' => 220,
  66818. '֜' => 230,
  66819. 'Ö�' => 230,
  66820. 'Öž' => 230,
  66821. 'ÖŸ' => 230,
  66822. 'Ö ' => 230,
  66823. 'Ö¡' => 230,
  66824. 'Ö¢' => 220,
  66825. 'Ö£' => 220,
  66826. 'Ö¤' => 220,
  66827. 'Ö¥' => 220,
  66828. 'Ö¦' => 220,
  66829. 'Ö§' => 220,
  66830. 'Ö¨' => 230,
  66831. 'Ö©' => 230,
  66832. 'Öª' => 220,
  66833. 'Ö«' => 230,
  66834. 'Ö¬' => 230,
  66835. 'Ö­' => 222,
  66836. 'Ö®' => 228,
  66837. 'Ö¯' => 230,
  66838. 'Ö°' => 10,
  66839. 'Ö±' => 11,
  66840. 'Ö²' => 12,
  66841. 'Ö³' => 13,
  66842. 'Ö´' => 14,
  66843. 'Öµ' => 15,
  66844. 'Ö¶' => 16,
  66845. 'Ö·' => 17,
  66846. 'Ö¸' => 18,
  66847. 'Ö¹' => 19,
  66848. 'Öº' => 19,
  66849. 'Ö»' => 20,
  66850. 'Ö¼' => 21,
  66851. 'Ö½' => 22,
  66852. 'Ö¿' => 23,
  66853. '�' => 24,
  66854. 'ׂ' => 25,
  66855. 'ׄ' => 230,
  66856. '×…' => 220,
  66857. 'ׇ' => 18,
  66858. '�' => 230,
  66859. 'Ø‘' => 230,
  66860. 'Ø’' => 230,
  66861. 'Ø“' => 230,
  66862. 'Ø”' => 230,
  66863. 'Ø•' => 230,
  66864. 'Ø–' => 230,
  66865. 'Ø—' => 230,
  66866. 'ؘ' => 30,
  66867. 'Ø™' => 31,
  66868. 'Øš' => 32,
  66869. 'Ù‹' => 27,
  66870. 'ٌ' => 28,
  66871. 'Ù�' => 29,
  66872. 'ÙŽ' => 30,
  66873. 'Ù�' => 31,
  66874. 'Ù�' => 32,
  66875. 'Ù‘' => 33,
  66876. 'Ù’' => 34,
  66877. 'Ù“' => 230,
  66878. 'Ù”' => 230,
  66879. 'Ù•' => 220,
  66880. 'Ù–' => 220,
  66881. 'Ù—' => 230,
  66882. 'Ù˜' => 230,
  66883. 'Ù™' => 230,
  66884. 'Ùš' => 230,
  66885. 'Ù›' => 230,
  66886. 'ٜ' => 220,
  66887. 'Ù�' => 230,
  66888. 'Ùž' => 230,
  66889. 'ÙŸ' => 220,
  66890. 'Ù°' => 35,
  66891. 'Û–' => 230,
  66892. 'Û—' => 230,
  66893. 'Û˜' => 230,
  66894. 'Û™' => 230,
  66895. 'Ûš' => 230,
  66896. 'Û›' => 230,
  66897. 'ۜ' => 230,
  66898. 'ÛŸ' => 230,
  66899. 'Û ' => 230,
  66900. 'Û¡' => 230,
  66901. 'Û¢' => 230,
  66902. 'Û£' => 220,
  66903. 'Û¤' => 230,
  66904. 'Û§' => 230,
  66905. 'Û¨' => 230,
  66906. 'Ûª' => 220,
  66907. 'Û«' => 230,
  66908. 'Û¬' => 230,
  66909. 'Û­' => 220,
  66910. 'Ü‘' => 36,
  66911. 'Ü°' => 230,
  66912. 'ܱ' => 220,
  66913. 'ܲ' => 230,
  66914. 'ܳ' => 230,
  66915. 'Ü´' => 220,
  66916. 'ܵ' => 230,
  66917. 'ܶ' => 230,
  66918. 'Ü·' => 220,
  66919. 'ܸ' => 220,
  66920. 'ܹ' => 220,
  66921. 'ܺ' => 230,
  66922. 'Ü»' => 220,
  66923. 'ܼ' => 220,
  66924. 'ܽ' => 230,
  66925. 'ܾ' => 220,
  66926. 'Ü¿' => 230,
  66927. 'Ý€' => 230,
  66928. '�' => 230,
  66929. 'Ý‚' => 220,
  66930. '݃' => 230,
  66931. 'Ý„' => 220,
  66932. 'Ý…' => 230,
  66933. '݆' => 220,
  66934. '݇' => 230,
  66935. '݈' => 220,
  66936. '݉' => 230,
  66937. 'ÝŠ' => 230,
  66938. 'ß«' => 230,
  66939. '߬' => 230,
  66940. 'ß­' => 230,
  66941. 'ß®' => 230,
  66942. '߯' => 230,
  66943. 'ß°' => 230,
  66944. 'ß±' => 230,
  66945. 'ß²' => 220,
  66946. 'ß³' => 230,
  66947. 'ß½' => 220,
  66948. 'à –' => 230,
  66949. 'à —' => 230,
  66950. 'à ˜' => 230,
  66951. 'à ™' => 230,
  66952. 'à ›' => 230,
  66953. 'ࠜ' => 230,
  66954. 'à �' => 230,
  66955. 'à ž' => 230,
  66956. 'à Ÿ' => 230,
  66957. 'à  ' => 230,
  66958. 'à ¡' => 230,
  66959. 'à ¢' => 230,
  66960. 'à £' => 230,
  66961. 'à ¥' => 230,
  66962. 'à ¦' => 230,
  66963. 'à §' => 230,
  66964. 'à ©' => 230,
  66965. 'à ª' => 230,
  66966. 'à «' => 230,
  66967. 'à ¬' => 230,
  66968. 'à ­' => 230,
  66969. 'à¡™' => 220,
  66970. 'à¡š' => 220,
  66971. 'à¡›' => 220,
  66972. '࣓' => 220,
  66973. 'ࣔ' => 230,
  66974. 'ࣕ' => 230,
  66975. 'ࣖ' => 230,
  66976. 'ࣗ' => 230,
  66977. 'ࣘ' => 230,
  66978. 'ࣙ' => 230,
  66979. 'ࣚ' => 230,
  66980. 'ࣛ' => 230,
  66981. 'ࣜ' => 230,
  66982. '�' => 230,
  66983. 'ࣞ' => 230,
  66984. 'ࣟ' => 230,
  66985. '࣠' => 230,
  66986. '࣡' => 230,
  66987. 'ࣣ' => 220,
  66988. 'ࣤ' => 230,
  66989. 'ࣥ' => 230,
  66990. 'ࣦ' => 220,
  66991. 'ࣧ' => 230,
  66992. 'ࣨ' => 230,
  66993. 'ࣩ' => 220,
  66994. '࣪' => 230,
  66995. '࣫' => 230,
  66996. '࣬' => 230,
  66997. '࣭' => 220,
  66998. '࣮' => 220,
  66999. '࣯' => 220,
  67000. 'ࣰ' => 27,
  67001. 'ࣱ' => 28,
  67002. 'ࣲ' => 29,
  67003. 'ࣳ' => 230,
  67004. 'ࣴ' => 230,
  67005. 'ࣵ' => 230,
  67006. 'ࣶ' => 220,
  67007. 'ࣷ' => 230,
  67008. 'ࣸ' => 230,
  67009. 'ࣹ' => 220,
  67010. 'ࣺ' => 220,
  67011. 'ࣻ' => 230,
  67012. 'ࣼ' => 230,
  67013. 'ࣽ' => 230,
  67014. 'ࣾ' => 230,
  67015. 'ࣿ' => 230,
  67016. '़' => 7,
  67017. '�' => 9,
  67018. '॑' => 230,
  67019. '॒' => 220,
  67020. '॓' => 230,
  67021. '॔' => 230,
  67022. '়' => 7,
  67023. '�' => 9,
  67024. '৾' => 230,
  67025. '਼' => 7,
  67026. '�' => 9,
  67027. '઼' => 7,
  67028. '�' => 9,
  67029. '଼' => 7,
  67030. 'à­�' => 9,
  67031. '�' => 9,
  67032. '�' => 9,
  67033. 'ౕ' => 84,
  67034. 'à±–' => 91,
  67035. '಼' => 7,
  67036. '�' => 9,
  67037. 'à´»' => 9,
  67038. 'à´¼' => 9,
  67039. '�' => 9,
  67040. 'à·Š' => 9,
  67041. 'ุ' => 103,
  67042. 'ู' => 103,
  67043. 'ฺ' => 9,
  67044. '่' => 107,
  67045. '้' => 107,
  67046. '๊' => 107,
  67047. '๋' => 107,
  67048. 'ຸ' => 118,
  67049. 'ູ' => 118,
  67050. '຺' => 9,
  67051. '່' => 122,
  67052. '້' => 122,
  67053. '໊' => 122,
  67054. '໋' => 122,
  67055. '༘' => 220,
  67056. '༙' => 220,
  67057. '༵' => 220,
  67058. '༷' => 220,
  67059. '༹' => 216,
  67060. 'ཱ' => 129,
  67061. 'ི' => 130,
  67062. 'ུ' => 132,
  67063. 'ེ' => 130,
  67064. 'ཻ' => 130,
  67065. 'ོ' => 130,
  67066. 'ཽ' => 130,
  67067. 'ྀ' => 130,
  67068. 'ྂ' => 230,
  67069. 'ྃ' => 230,
  67070. '྄' => 9,
  67071. '྆' => 230,
  67072. '྇' => 230,
  67073. '࿆' => 220,
  67074. '့' => 7,
  67075. '္' => 9,
  67076. '်' => 9,
  67077. '�' => 220,
  67078. '�' => 230,
  67079. '�' => 230,
  67080. '�' => 230,
  67081. '᜔' => 9,
  67082. '᜴' => 9,
  67083. '្' => 9,
  67084. '�' => 230,
  67085. 'ᢩ' => 228,
  67086. '᤹' => 222,
  67087. '᤺' => 230,
  67088. '᤻' => 220,
  67089. 'ᨗ' => 230,
  67090. 'ᨘ' => 220,
  67091. 'á© ' => 9,
  67092. '᩵' => 230,
  67093. '᩶' => 230,
  67094. 'á©·' => 230,
  67095. '᩸' => 230,
  67096. '᩹' => 230,
  67097. '᩺' => 230,
  67098. 'á©»' => 230,
  67099. '᩼' => 230,
  67100. 'á©¿' => 220,
  67101. '᪰' => 230,
  67102. '᪱' => 230,
  67103. '᪲' => 230,
  67104. '᪳' => 230,
  67105. '᪴' => 230,
  67106. '᪵' => 220,
  67107. '᪶' => 220,
  67108. '᪷' => 220,
  67109. '᪸' => 220,
  67110. '᪹' => 220,
  67111. '᪺' => 220,
  67112. '᪻' => 230,
  67113. '᪼' => 230,
  67114. '᪽' => 220,
  67115. 'ᪿ' => 220,
  67116. 'á«€' => 220,
  67117. '᬴' => 7,
  67118. 'á­„' => 9,
  67119. 'á­«' => 230,
  67120. 'á­¬' => 220,
  67121. 'á­­' => 230,
  67122. 'á­®' => 230,
  67123. 'á­¯' => 230,
  67124. 'á­°' => 230,
  67125. 'á­±' => 230,
  67126. 'á­²' => 230,
  67127. 'á­³' => 230,
  67128. '᮪' => 9,
  67129. '᮫' => 9,
  67130. '᯦' => 7,
  67131. '᯲' => 9,
  67132. '᯳' => 9,
  67133. 'á°·' => 7,
  67134. '�' => 230,
  67135. '᳑' => 230,
  67136. 'á³’' => 230,
  67137. 'á³”' => 1,
  67138. '᳕' => 220,
  67139. 'á³–' => 220,
  67140. 'á³—' => 220,
  67141. '᳘' => 220,
  67142. 'á³™' => 220,
  67143. '᳚' => 230,
  67144. 'á³›' => 230,
  67145. '᳜' => 220,
  67146. '�' => 220,
  67147. '᳞' => 220,
  67148. '᳟' => 220,
  67149. 'á³ ' => 230,
  67150. 'á³¢' => 1,
  67151. 'á³£' => 1,
  67152. '᳤' => 1,
  67153. 'á³¥' => 1,
  67154. '᳦' => 1,
  67155. '᳧' => 1,
  67156. '᳨' => 1,
  67157. 'á³­' => 220,
  67158. 'á³´' => 230,
  67159. '᳸' => 230,
  67160. 'á³¹' => 230,
  67161. 'á·€' => 230,
  67162. 'á·�' => 230,
  67163. 'á·‚' => 220,
  67164. 'á·ƒ' => 230,
  67165. 'á·„' => 230,
  67166. 'á·…' => 230,
  67167. 'á·†' => 230,
  67168. 'á·‡' => 230,
  67169. 'á·ˆ' => 230,
  67170. 'á·‰' => 230,
  67171. 'á·Š' => 220,
  67172. 'á·‹' => 230,
  67173. '᷌' => 230,
  67174. 'á·�' => 234,
  67175. 'á·Ž' => 214,
  67176. 'á·�' => 220,
  67177. 'á·�' => 202,
  67178. 'á·‘' => 230,
  67179. 'á·’' => 230,
  67180. 'á·“' => 230,
  67181. 'á·”' => 230,
  67182. 'á·•' => 230,
  67183. 'á·–' => 230,
  67184. 'á·—' => 230,
  67185. 'á·˜' => 230,
  67186. 'á·™' => 230,
  67187. 'á·š' => 230,
  67188. 'á·›' => 230,
  67189. 'ᷜ' => 230,
  67190. 'á·�' => 230,
  67191. 'á·ž' => 230,
  67192. 'á·Ÿ' => 230,
  67193. 'á· ' => 230,
  67194. 'á·¡' => 230,
  67195. 'á·¢' => 230,
  67196. 'á·£' => 230,
  67197. 'á·¤' => 230,
  67198. 'á·¥' => 230,
  67199. 'á·¦' => 230,
  67200. 'á·§' => 230,
  67201. 'á·¨' => 230,
  67202. 'á·©' => 230,
  67203. 'á·ª' => 230,
  67204. 'á·«' => 230,
  67205. 'á·¬' => 230,
  67206. 'á·­' => 230,
  67207. 'á·®' => 230,
  67208. 'á·¯' => 230,
  67209. 'á·°' => 230,
  67210. 'á·±' => 230,
  67211. 'á·²' => 230,
  67212. 'á·³' => 230,
  67213. 'á·´' => 230,
  67214. 'á·µ' => 230,
  67215. 'á·¶' => 232,
  67216. 'á··' => 228,
  67217. 'á·¸' => 228,
  67218. 'á·¹' => 220,
  67219. 'á·»' => 230,
  67220. 'á·¼' => 233,
  67221. 'á·½' => 220,
  67222. 'á·¾' => 230,
  67223. 'á·¿' => 220,
  67224. '�' => 230,
  67225. '⃑' => 230,
  67226. '⃒' => 1,
  67227. '⃓' => 1,
  67228. '⃔' => 230,
  67229. '⃕' => 230,
  67230. '⃖' => 230,
  67231. '⃗' => 230,
  67232. '⃘' => 1,
  67233. '⃙' => 1,
  67234. '⃚' => 1,
  67235. '⃛' => 230,
  67236. '⃜' => 230,
  67237. '⃡' => 230,
  67238. '⃥' => 1,
  67239. '⃦' => 1,
  67240. '⃧' => 230,
  67241. '⃨' => 220,
  67242. '⃩' => 230,
  67243. '⃪' => 1,
  67244. '⃫' => 1,
  67245. '⃬' => 220,
  67246. '⃭' => 220,
  67247. '⃮' => 220,
  67248. '⃯' => 220,
  67249. '⃰' => 230,
  67250. '⳯' => 230,
  67251. 'â³°' => 230,
  67252. 'â³±' => 230,
  67253. '⵿' => 9,
  67254. 'â· ' => 230,
  67255. 'â·¡' => 230,
  67256. 'â·¢' => 230,
  67257. 'â·£' => 230,
  67258. 'â·¤' => 230,
  67259. 'â·¥' => 230,
  67260. 'â·¦' => 230,
  67261. 'â·§' => 230,
  67262. 'â·¨' => 230,
  67263. 'â·©' => 230,
  67264. 'â·ª' => 230,
  67265. 'â·«' => 230,
  67266. 'â·¬' => 230,
  67267. 'â·­' => 230,
  67268. 'â·®' => 230,
  67269. 'â·¯' => 230,
  67270. 'â·°' => 230,
  67271. 'â·±' => 230,
  67272. 'â·²' => 230,
  67273. 'â·³' => 230,
  67274. 'â·´' => 230,
  67275. 'â·µ' => 230,
  67276. 'â·¶' => 230,
  67277. 'â··' => 230,
  67278. 'â·¸' => 230,
  67279. 'â·¹' => 230,
  67280. 'â·º' => 230,
  67281. 'â·»' => 230,
  67282. 'â·¼' => 230,
  67283. 'â·½' => 230,
  67284. 'â·¾' => 230,
  67285. 'â·¿' => 230,
  67286. '〪' => 218,
  67287. '〫' => 228,
  67288. '〬' => 232,
  67289. '〭' => 222,
  67290. '〮' => 224,
  67291. '〯' => 224,
  67292. 'ã‚™' => 8,
  67293. 'ã‚š' => 8,
  67294. '꙯' => 230,
  67295. 'ê™´' => 230,
  67296. 'ꙵ' => 230,
  67297. 'ꙶ' => 230,
  67298. 'ê™·' => 230,
  67299. 'ꙸ' => 230,
  67300. 'ꙹ' => 230,
  67301. 'ꙺ' => 230,
  67302. 'ê™»' => 230,
  67303. '꙼' => 230,
  67304. '꙽' => 230,
  67305. 'êšž' => 230,
  67306. 'ꚟ' => 230,
  67307. 'ê›°' => 230,
  67308. 'ê›±' => 230,
  67309. 'ê †' => 9,
  67310. 'ê ¬' => 9,
  67311. '꣄' => 9,
  67312. '꣠' => 230,
  67313. '꣡' => 230,
  67314. '꣢' => 230,
  67315. '꣣' => 230,
  67316. '꣤' => 230,
  67317. '꣥' => 230,
  67318. '꣦' => 230,
  67319. '꣧' => 230,
  67320. '꣨' => 230,
  67321. '꣩' => 230,
  67322. '꣪' => 230,
  67323. '꣫' => 230,
  67324. '꣬' => 230,
  67325. '꣭' => 230,
  67326. '꣮' => 230,
  67327. '꣯' => 230,
  67328. '꣰' => 230,
  67329. '꣱' => 230,
  67330. '꤫' => 220,
  67331. '꤬' => 220,
  67332. '꤭' => 220,
  67333. '꥓' => 9,
  67334. '꦳' => 7,
  67335. '꧀' => 9,
  67336. 'ꪰ' => 230,
  67337. 'ꪲ' => 230,
  67338. 'ꪳ' => 230,
  67339. 'ꪴ' => 220,
  67340. 'ꪷ' => 230,
  67341. 'ꪸ' => 230,
  67342. 'ꪾ' => 230,
  67343. '꪿' => 230,
  67344. '�' => 230,
  67345. '꫶' => 9,
  67346. '꯭' => 9,
  67347. 'ﬞ' => 26,
  67348. '︠' => 230,
  67349. '︡' => 230,
  67350. '︢' => 230,
  67351. '︣' => 230,
  67352. '︤' => 230,
  67353. '︥' => 230,
  67354. '︦' => 230,
  67355. '︧' => 220,
  67356. '︨' => 220,
  67357. '︩' => 220,
  67358. '︪' => 220,
  67359. '︫' => 220,
  67360. '︬' => 220,
  67361. '︭' => 220,
  67362. '︮' => 230,
  67363. '︯' => 230,
  67364. '�' => 220,
  67365. '�' => 220,
  67366. '�' => 230,
  67367. '�' => 230,
  67368. '�' => 230,
  67369. '�' => 230,
  67370. '�' => 230,
  67371. '�' => 220,
  67372. '�' => 230,
  67373. '�' => 230,
  67374. '�' => 1,
  67375. '�' => 220,
  67376. '�' => 9,
  67377. '�' => 230,
  67378. '�' => 220,
  67379. '�' => 230,
  67380. '�' => 230,
  67381. '�' => 230,
  67382. '�' => 230,
  67383. '�' => 230,
  67384. '�' => 230,
  67385. '�' => 220,
  67386. '�' => 220,
  67387. '�' => 230,
  67388. '�' => 230,
  67389. '�' => 230,
  67390. '�' => 220,
  67391. '�' => 230,
  67392. '�' => 220,
  67393. '�' => 220,
  67394. '�' => 220,
  67395. '�' => 220,
  67396. '�' => 9,
  67397. '�' => 9,
  67398. 'ð‘‚¹' => 9,
  67399. '𑂺' => 7,
  67400. 'ð‘„€' => 230,
  67401. '�' => 230,
  67402. 'ð‘„‚' => 230,
  67403. 'ð‘„³' => 9,
  67404. 'ð‘„´' => 9,
  67405. 'ð‘…³' => 7,
  67406. '𑇀' => 9,
  67407. '𑇊' => 7,
  67408. '𑈵' => 9,
  67409. '𑈶' => 7,
  67410. 'ð‘‹©' => 7,
  67411. '𑋪' => 9,
  67412. '𑌻' => 7,
  67413. '𑌼' => 7,
  67414. '�' => 9,
  67415. '�' => 230,
  67416. '�' => 230,
  67417. '�' => 230,
  67418. '�' => 230,
  67419. '�' => 230,
  67420. '�' => 230,
  67421. '�' => 230,
  67422. '�' => 230,
  67423. '�' => 230,
  67424. '�' => 230,
  67425. '�' => 230,
  67426. '�' => 230,
  67427. 'ð‘‘‚' => 9,
  67428. '𑑆' => 7,
  67429. 'ð‘‘ž' => 230,
  67430. 'ð‘“‚' => 9,
  67431. '𑓃' => 7,
  67432. 'ð‘–¿' => 9,
  67433. 'ð‘—€' => 7,
  67434. '𑘿' => 9,
  67435. '𑚶' => 9,
  67436. 'ð‘š·' => 7,
  67437. '𑜫' => 9,
  67438. 'ð‘ ¹' => 9,
  67439. 'ð‘ º' => 7,
  67440. '𑤽' => 9,
  67441. '𑤾' => 9,
  67442. '𑥃' => 7,
  67443. '𑧠' => 9,
  67444. '𑨴' => 9,
  67445. '𑩇' => 9,
  67446. '𑪙' => 9,
  67447. 'ð‘°¿' => 9,
  67448. '𑵂' => 7,
  67449. '𑵄' => 9,
  67450. '𑵅' => 9,
  67451. '𑶗' => 9,
  67452. 'ð–«°' => 1,
  67453. 'ð–«±' => 1,
  67454. 'ð–«²' => 1,
  67455. 'ð–«³' => 1,
  67456. 'ð–«´' => 1,
  67457. 'ð–¬°' => 230,
  67458. '𖬱' => 230,
  67459. '𖬲' => 230,
  67460. '𖬳' => 230,
  67461. 'ð–¬´' => 230,
  67462. '𖬵' => 230,
  67463. '𖬶' => 230,
  67464. 'ð–¿°' => 6,
  67465. 'ð–¿±' => 6,
  67466. '𛲞' => 1,
  67467. '�' => 216,
  67468. '�' => 216,
  67469. '�' => 1,
  67470. '�' => 1,
  67471. '�' => 1,
  67472. '�' => 226,
  67473. '�' => 216,
  67474. '�' => 216,
  67475. '�' => 216,
  67476. '�' => 216,
  67477. '�' => 216,
  67478. '�' => 220,
  67479. '�' => 220,
  67480. '�' => 220,
  67481. '�' => 220,
  67482. '�' => 220,
  67483. '�' => 220,
  67484. '�' => 220,
  67485. '�' => 220,
  67486. '�' => 230,
  67487. '�' => 230,
  67488. '�' => 230,
  67489. '�' => 230,
  67490. '�' => 230,
  67491. '�' => 220,
  67492. '�' => 220,
  67493. '�' => 230,
  67494. '�' => 230,
  67495. '�' => 230,
  67496. '�' => 230,
  67497. '�' => 230,
  67498. '�' => 230,
  67499. '�' => 230,
  67500. '𞀀' => 230,
  67501. '�' => 230,
  67502. '𞀂' => 230,
  67503. '𞀃' => 230,
  67504. '𞀄' => 230,
  67505. '𞀅' => 230,
  67506. '𞀆' => 230,
  67507. '𞀈' => 230,
  67508. '𞀉' => 230,
  67509. '𞀊' => 230,
  67510. '𞀋' => 230,
  67511. '𞀌' => 230,
  67512. '�' => 230,
  67513. '𞀎' => 230,
  67514. '�' => 230,
  67515. '�' => 230,
  67516. '𞀑' => 230,
  67517. '𞀒' => 230,
  67518. '𞀓' => 230,
  67519. '𞀔' => 230,
  67520. '𞀕' => 230,
  67521. '𞀖' => 230,
  67522. '𞀗' => 230,
  67523. '𞀘' => 230,
  67524. '𞀛' => 230,
  67525. '𞀜' => 230,
  67526. '�' => 230,
  67527. '𞀞' => 230,
  67528. '𞀟' => 230,
  67529. '𞀠' => 230,
  67530. '𞀡' => 230,
  67531. '𞀣' => 230,
  67532. '𞀤' => 230,
  67533. '𞀦' => 230,
  67534. '𞀧' => 230,
  67535. '𞀨' => 230,
  67536. '𞀩' => 230,
  67537. '𞀪' => 230,
  67538. 'ðž„°' => 230,
  67539. '𞄱' => 230,
  67540. '𞄲' => 230,
  67541. '𞄳' => 230,
  67542. 'ðž„´' => 230,
  67543. '𞄵' => 230,
  67544. '𞄶' => 230,
  67545. '𞋬' => 230,
  67546. 'ðž‹­' => 230,
  67547. 'ðž‹®' => 230,
  67548. '𞋯' => 230,
  67549. '�' => 220,
  67550. '𞣑' => 220,
  67551. '𞣒' => 220,
  67552. '𞣓' => 220,
  67553. '𞣔' => 220,
  67554. '𞣕' => 220,
  67555. '𞣖' => 220,
  67556. '𞥄' => 230,
  67557. '𞥅' => 230,
  67558. '𞥆' => 230,
  67559. '𞥇' => 230,
  67560. '𞥈' => 230,
  67561. '𞥉' => 230,
  67562. '𞥊' => 7,
  67563. );
  67564. <?php
  67565. return array (
  67566. ' ' => ' ',
  67567. '¨' => ' ̈',
  67568. 'ª' => 'a',
  67569. '¯' => ' ̄',
  67570. '²' => '2',
  67571. '³' => '3',
  67572. '´' => ' �',
  67573. 'µ' => 'μ',
  67574. '¸' => ' ̧',
  67575. '¹' => '1',
  67576. 'º' => 'o',
  67577. '¼' => '1�4',
  67578. '½' => '1�2',
  67579. '¾' => '3�4',
  67580. 'IJ' => 'IJ',
  67581. 'ij' => 'ij',
  67582. 'Ŀ' => 'L·',
  67583. 'ŀ' => 'l·',
  67584. 'ʼn' => 'ʼn',
  67585. 'Å¿' => 's',
  67586. 'DŽ' => 'DŽ',
  67587. 'Dž' => 'Dž',
  67588. 'dž' => 'dž',
  67589. 'LJ' => 'LJ',
  67590. 'Lj' => 'Lj',
  67591. 'lj' => 'lj',
  67592. 'ÇŠ' => 'NJ',
  67593. 'Ç‹' => 'Nj',
  67594. 'nj' => 'nj',
  67595. 'DZ' => 'DZ',
  67596. 'Dz' => 'Dz',
  67597. 'dz' => 'dz',
  67598. 'Ê°' => 'h',
  67599. 'ʱ' => 'ɦ',
  67600. 'ʲ' => 'j',
  67601. 'ʳ' => 'r',
  67602. 'ʴ' => 'ɹ',
  67603. 'ʵ' => 'ɻ',
  67604. 'ʶ' => '�',
  67605. 'Ê·' => 'w',
  67606. 'ʸ' => 'y',
  67607. '˘' => ' ̆',
  67608. '˙' => ' ̇',
  67609. 'Ëš' => ' ÌŠ',
  67610. '˛' => ' ̨',
  67611. '˜' => ' ̃',
  67612. '�' => ' ̋',
  67613. 'Ë ' => 'É£',
  67614. 'Ë¡' => 'l',
  67615. 'Ë¢' => 's',
  67616. 'Ë£' => 'x',
  67617. 'ˤ' => 'ʕ',
  67618. 'ͺ' => ' ͅ',
  67619. '΄' => ' �',
  67620. '΅' => ' ̈�',
  67621. '�' => 'β',
  67622. 'ϑ' => 'θ',
  67623. 'Ï’' => 'Î¥',
  67624. 'ϓ' => 'Υ�',
  67625. 'ϔ' => 'Ϋ',
  67626. 'ϕ' => 'φ',
  67627. 'Ï–' => 'Ï€',
  67628. 'ϰ' => 'κ',
  67629. 'ϱ' => '�',
  67630. 'ϲ' => 'ς',
  67631. 'ϴ' => 'Θ',
  67632. 'ϵ' => 'ε',
  67633. 'Ϲ' => 'Σ',
  67634. 'Ö‡' => 'Õ¥Ö‚',
  67635. 'ٵ' => 'اٴ',
  67636. 'ٶ' => 'وٴ',
  67637. 'Ù·' => 'Û‡Ù´',
  67638. 'ٸ' => 'يٴ',
  67639. 'ำ' => '�า',
  67640. 'ຳ' => '�າ',
  67641. 'ໜ' => 'ຫນ',
  67642. '�' => 'ຫມ',
  67643. '༌' => '་',
  67644. 'ཷ' => 'ྲཱྀ',
  67645. 'ཹ' => 'ླཱྀ',
  67646. 'ჼ' => 'ნ',
  67647. 'á´¬' => 'A',
  67648. 'ᴭ' => 'Æ',
  67649. 'á´®' => 'B',
  67650. 'á´°' => 'D',
  67651. 'á´±' => 'E',
  67652. 'á´²' => 'ÆŽ',
  67653. 'á´³' => 'G',
  67654. 'á´´' => 'H',
  67655. 'á´µ' => 'I',
  67656. 'á´¶' => 'J',
  67657. 'á´·' => 'K',
  67658. 'á´¸' => 'L',
  67659. 'á´¹' => 'M',
  67660. 'á´º' => 'N',
  67661. 'á´¼' => 'O',
  67662. 'á´½' => 'È¢',
  67663. 'á´¾' => 'P',
  67664. 'á´¿' => 'R',
  67665. 'áµ€' => 'T',
  67666. '�' => 'U',
  67667. 'ᵂ' => 'W',
  67668. 'ᵃ' => 'a',
  67669. 'ᵄ' => '�',
  67670. 'áµ…' => 'É‘',
  67671. 'ᵆ' => 'ᴂ',
  67672. 'ᵇ' => 'b',
  67673. 'ᵈ' => 'd',
  67674. 'ᵉ' => 'e',
  67675. 'ᵊ' => 'ə',
  67676. 'ᵋ' => 'ɛ',
  67677. 'ᵌ' => 'ɜ',
  67678. '�' => 'g',
  67679. '�' => 'k',
  67680. '�' => 'm',
  67681. 'ᵑ' => 'ŋ',
  67682. 'áµ’' => 'o',
  67683. 'ᵓ' => 'ɔ',
  67684. 'áµ”' => 'á´–',
  67685. 'ᵕ' => 'ᴗ',
  67686. 'áµ–' => 'p',
  67687. 'áµ—' => 't',
  67688. 'ᵘ' => 'u',
  67689. 'áµ™' => 'á´�',
  67690. 'ᵚ' => 'ɯ',
  67691. 'áµ›' => 'v',
  67692. 'ᵜ' => 'ᴥ',
  67693. '�' => 'β',
  67694. 'ᵞ' => 'γ',
  67695. 'ᵟ' => 'δ',
  67696. 'ᵠ' => 'φ',
  67697. 'ᵡ' => 'χ',
  67698. 'áµ¢' => 'i',
  67699. 'áµ£' => 'r',
  67700. 'ᵤ' => 'u',
  67701. 'áµ¥' => 'v',
  67702. 'ᵦ' => 'β',
  67703. 'ᵧ' => 'γ',
  67704. 'ᵨ' => '�',
  67705. 'ᵩ' => 'φ',
  67706. 'ᵪ' => 'χ',
  67707. 'ᵸ' => 'н',
  67708. 'ᶛ' => 'ɒ',
  67709. 'ᶜ' => 'c',
  67710. '�' => 'ɕ',
  67711. 'ᶞ' => 'ð',
  67712. 'ᶟ' => 'ɜ',
  67713. 'ᶠ' => 'f',
  67714. 'ᶡ' => 'ɟ',
  67715. 'ᶢ' => 'ɡ',
  67716. 'ᶣ' => 'ɥ',
  67717. 'ᶤ' => 'ɨ',
  67718. 'ᶥ' => 'ɩ',
  67719. 'ᶦ' => 'ɪ',
  67720. 'ᶧ' => 'ᵻ',
  67721. 'ᶨ' => '�',
  67722. 'ᶩ' => 'ɭ',
  67723. 'ᶪ' => 'ᶅ',
  67724. 'ᶫ' => 'ʟ',
  67725. 'ᶬ' => 'ɱ',
  67726. 'ᶭ' => 'ɰ',
  67727. 'ᶮ' => 'ɲ',
  67728. 'ᶯ' => 'ɳ',
  67729. 'ᶰ' => 'ɴ',
  67730. 'ᶱ' => 'ɵ',
  67731. 'ᶲ' => 'ɸ',
  67732. 'ᶳ' => 'ʂ',
  67733. 'ᶴ' => 'ʃ',
  67734. 'ᶵ' => 'ƫ',
  67735. 'ᶶ' => 'ʉ',
  67736. 'ᶷ' => 'ʊ',
  67737. 'ᶸ' => 'ᴜ',
  67738. 'ᶹ' => 'ʋ',
  67739. 'ᶺ' => 'ʌ',
  67740. 'ᶻ' => 'z',
  67741. 'ᶼ' => '�',
  67742. 'ᶽ' => 'ʑ',
  67743. 'ᶾ' => 'ʒ',
  67744. 'ᶿ' => 'θ',
  67745. 'ẚ' => 'aʾ',
  67746. 'ẛ' => 'ṡ',
  67747. 'á¾½' => ' Ì“',
  67748. '᾿' => ' ̓',
  67749. 'á¿€' => ' Í‚',
  67750. '�' => ' ̈͂',
  67751. '�' => ' ̓̀',
  67752. '῎' => ' ̓�',
  67753. '�' => ' ̓͂',
  67754. '�' => ' ̔̀',
  67755. '῞' => ' ̔�',
  67756. '῟' => ' ̔͂',
  67757. '῭' => ' ̈̀',
  67758. '΅' => ' ̈�',
  67759. '´' => ' �',
  67760. '῾' => ' ̔',
  67761. ' ' => ' ',
  67762. '�' => ' ',
  67763. ' ' => ' ',
  67764. ' ' => ' ',
  67765. ' ' => ' ',
  67766. ' ' => ' ',
  67767. ' ' => ' ',
  67768. ' ' => ' ',
  67769. ' ' => ' ',
  67770. ' ' => ' ',
  67771. ' ' => ' ',
  67772. '‑' => '�',
  67773. '‗' => ' ̳',
  67774. '․' => '.',
  67775. '‥' => '..',
  67776. '…' => '...',
  67777. ' ' => ' ',
  67778. '″' => '′′',
  67779. '‴' => '′′′',
  67780. '‶' => '‵‵',
  67781. '‷' => '‵‵‵',
  67782. '‼' => '!!',
  67783. '‾' => ' ̅',
  67784. '�' => '??',
  67785. '�' => '?!',
  67786. '�' => '!?',
  67787. '�' => '′′′′',
  67788. '�' => ' ',
  67789. '�' => '0',
  67790. '�' => 'i',
  67791. '�' => '4',
  67792. '�' => '5',
  67793. '�' => '6',
  67794. '�' => '7',
  67795. '�' => '8',
  67796. '�' => '9',
  67797. '�' => '+',
  67798. '�' => '−',
  67799. '�' => '=',
  67800. '�' => '(',
  67801. '�' => ')',
  67802. '�' => 'n',
  67803. 'â‚€' => '0',
  67804. '�' => '1',
  67805. 'â‚‚' => '2',
  67806. '₃' => '3',
  67807. 'â‚„' => '4',
  67808. 'â‚…' => '5',
  67809. '₆' => '6',
  67810. '₇' => '7',
  67811. '₈' => '8',
  67812. '₉' => '9',
  67813. 'â‚Š' => '+',
  67814. '₋' => '−',
  67815. '₌' => '=',
  67816. '�' => '(',
  67817. 'â‚Ž' => ')',
  67818. '�' => 'a',
  67819. 'â‚‘' => 'e',
  67820. 'â‚’' => 'o',
  67821. 'â‚“' => 'x',
  67822. 'â‚”' => 'É™',
  67823. 'â‚•' => 'h',
  67824. 'â‚–' => 'k',
  67825. 'â‚—' => 'l',
  67826. 'ₘ' => 'm',
  67827. 'â‚™' => 'n',
  67828. 'â‚š' => 'p',
  67829. 'â‚›' => 's',
  67830. 'ₜ' => 't',
  67831. '₨' => 'Rs',
  67832. 'â„€' => 'a/c',
  67833. '�' => 'a/s',
  67834. 'â„‚' => 'C',
  67835. '℃' => '°C',
  67836. 'â„…' => 'c/o',
  67837. '℆' => 'c/u',
  67838. 'ℇ' => '�',
  67839. '℉' => '°F',
  67840. 'â„Š' => 'g',
  67841. 'â„‹' => 'H',
  67842. 'ℌ' => 'H',
  67843. '�' => 'H',
  67844. 'â„Ž' => 'h',
  67845. '�' => 'ħ',
  67846. '�' => 'I',
  67847. 'â„‘' => 'I',
  67848. 'â„’' => 'L',
  67849. 'â„“' => 'l',
  67850. 'â„•' => 'N',
  67851. 'â„–' => 'No',
  67852. 'â„™' => 'P',
  67853. 'â„š' => 'Q',
  67854. 'â„›' => 'R',
  67855. 'ℜ' => 'R',
  67856. '�' => 'R',
  67857. 'â„ ' => 'SM',
  67858. 'â„¡' => 'TEL',
  67859. 'â„¢' => 'TM',
  67860. 'ℤ' => 'Z',
  67861. 'ℨ' => 'Z',
  67862. 'ℬ' => 'B',
  67863. 'â„­' => 'C',
  67864. 'ℯ' => 'e',
  67865. 'â„°' => 'E',
  67866. 'ℱ' => 'F',
  67867. 'ℳ' => 'M',
  67868. 'â„´' => 'o',
  67869. 'ℵ' => '�',
  67870. 'ℶ' => 'ב',
  67871. 'â„·' => '×’',
  67872. 'ℸ' => 'ד',
  67873. 'ℹ' => 'i',
  67874. 'â„»' => 'FAX',
  67875. 'ℼ' => 'π',
  67876. 'ℽ' => 'γ',
  67877. 'ℾ' => 'Γ',
  67878. 'ℿ' => 'Π',
  67879. '⅀' => '∑',
  67880. 'â……' => 'D',
  67881. 'â…†' => 'd',
  67882. 'â…‡' => 'e',
  67883. 'â…ˆ' => 'i',
  67884. 'â…‰' => 'j',
  67885. '�' => '1�7',
  67886. '⅑' => '1�9',
  67887. '⅒' => '1�10',
  67888. '⅓' => '1�3',
  67889. '⅔' => '2�3',
  67890. '⅕' => '1�5',
  67891. '⅖' => '2�5',
  67892. '⅗' => '3�5',
  67893. '⅘' => '4�5',
  67894. '⅙' => '1�6',
  67895. '⅚' => '5�6',
  67896. '⅛' => '1�8',
  67897. '⅜' => '3�8',
  67898. '�' => '5�8',
  67899. '⅞' => '7�8',
  67900. '⅟' => '1�',
  67901. 'â… ' => 'I',
  67902. 'â…¡' => 'II',
  67903. 'â…¢' => 'III',
  67904. 'â…£' => 'IV',
  67905. 'â…¤' => 'V',
  67906. 'â…¥' => 'VI',
  67907. 'â…¦' => 'VII',
  67908. 'â…§' => 'VIII',
  67909. 'â…¨' => 'IX',
  67910. 'â…©' => 'X',
  67911. 'â…ª' => 'XI',
  67912. 'â…«' => 'XII',
  67913. 'â…¬' => 'L',
  67914. 'â…­' => 'C',
  67915. 'â…®' => 'D',
  67916. 'â…¯' => 'M',
  67917. 'â…°' => 'i',
  67918. 'â…±' => 'ii',
  67919. 'â…²' => 'iii',
  67920. 'â…³' => 'iv',
  67921. 'â…´' => 'v',
  67922. 'â…µ' => 'vi',
  67923. 'â…¶' => 'vii',
  67924. 'â…·' => 'viii',
  67925. 'â…¸' => 'ix',
  67926. 'â…¹' => 'x',
  67927. 'â…º' => 'xi',
  67928. 'â…»' => 'xii',
  67929. 'â…¼' => 'l',
  67930. 'â…½' => 'c',
  67931. 'â…¾' => 'd',
  67932. 'â…¿' => 'm',
  67933. '↉' => '0�3',
  67934. '∬' => '∫∫',
  67935. '∭' => '∫∫∫',
  67936. '∯' => '∮∮',
  67937. '∰' => '∮∮∮',
  67938. 'â‘ ' => '1',
  67939. 'â‘¡' => '2',
  67940. 'â‘¢' => '3',
  67941. 'â‘£' => '4',
  67942. '⑤' => '5',
  67943. 'â‘¥' => '6',
  67944. '⑦' => '7',
  67945. '⑧' => '8',
  67946. '⑨' => '9',
  67947. 'â‘©' => '10',
  67948. '⑪' => '11',
  67949. 'â‘«' => '12',
  67950. '⑬' => '13',
  67951. 'â‘­' => '14',
  67952. 'â‘®' => '15',
  67953. '⑯' => '16',
  67954. 'â‘°' => '17',
  67955. '⑱' => '18',
  67956. '⑲' => '19',
  67957. '⑳' => '20',
  67958. 'â‘´' => '(1)',
  67959. '⑵' => '(2)',
  67960. '⑶' => '(3)',
  67961. 'â‘·' => '(4)',
  67962. '⑸' => '(5)',
  67963. '⑹' => '(6)',
  67964. '⑺' => '(7)',
  67965. 'â‘»' => '(8)',
  67966. '⑼' => '(9)',
  67967. '⑽' => '(10)',
  67968. '⑾' => '(11)',
  67969. 'â‘¿' => '(12)',
  67970. 'â’€' => '(13)',
  67971. 'â’�' => '(14)',
  67972. 'â’‚' => '(15)',
  67973. 'â’ƒ' => '(16)',
  67974. 'â’„' => '(17)',
  67975. 'â’…' => '(18)',
  67976. 'â’†' => '(19)',
  67977. 'â’‡' => '(20)',
  67978. 'â’ˆ' => '1.',
  67979. 'â’‰' => '2.',
  67980. 'â’Š' => '3.',
  67981. 'â’‹' => '4.',
  67982. '⒌' => '5.',
  67983. 'â’�' => '6.',
  67984. 'â’Ž' => '7.',
  67985. 'â’�' => '8.',
  67986. 'â’�' => '9.',
  67987. 'â’‘' => '10.',
  67988. 'â’’' => '11.',
  67989. 'â’“' => '12.',
  67990. 'â’”' => '13.',
  67991. 'â’•' => '14.',
  67992. 'â’–' => '15.',
  67993. 'â’—' => '16.',
  67994. 'â’˜' => '17.',
  67995. 'â’™' => '18.',
  67996. 'â’š' => '19.',
  67997. 'â’›' => '20.',
  67998. '⒜' => '(a)',
  67999. 'â’�' => '(b)',
  68000. 'â’ž' => '(c)',
  68001. 'â’Ÿ' => '(d)',
  68002. 'â’ ' => '(e)',
  68003. 'â’¡' => '(f)',
  68004. 'â’¢' => '(g)',
  68005. 'â’£' => '(h)',
  68006. 'â’¤' => '(i)',
  68007. 'â’¥' => '(j)',
  68008. 'â’¦' => '(k)',
  68009. 'â’§' => '(l)',
  68010. 'â’¨' => '(m)',
  68011. 'â’©' => '(n)',
  68012. 'â’ª' => '(o)',
  68013. 'â’«' => '(p)',
  68014. 'â’¬' => '(q)',
  68015. 'â’­' => '(r)',
  68016. 'â’®' => '(s)',
  68017. 'â’¯' => '(t)',
  68018. 'â’°' => '(u)',
  68019. 'â’±' => '(v)',
  68020. 'â’²' => '(w)',
  68021. 'â’³' => '(x)',
  68022. 'â’´' => '(y)',
  68023. 'â’µ' => '(z)',
  68024. 'â’¶' => 'A',
  68025. 'â’·' => 'B',
  68026. 'â’¸' => 'C',
  68027. 'â’¹' => 'D',
  68028. 'â’º' => 'E',
  68029. 'â’»' => 'F',
  68030. 'â’¼' => 'G',
  68031. 'â’½' => 'H',
  68032. 'â’¾' => 'I',
  68033. 'â’¿' => 'J',
  68034. 'â“€' => 'K',
  68035. '�' => 'L',
  68036. 'â“‚' => 'M',
  68037. 'Ⓝ' => 'N',
  68038. 'â“„' => 'O',
  68039. 'â“…' => 'P',
  68040. 'Ⓠ' => 'Q',
  68041. 'Ⓡ' => 'R',
  68042. 'Ⓢ' => 'S',
  68043. 'Ⓣ' => 'T',
  68044. 'â“Š' => 'U',
  68045. 'â“‹' => 'V',
  68046. 'Ⓦ' => 'W',
  68047. '�' => 'X',
  68048. 'â“Ž' => 'Y',
  68049. '�' => 'Z',
  68050. '�' => 'a',
  68051. 'â“‘' => 'b',
  68052. 'â“’' => 'c',
  68053. 'â““' => 'd',
  68054. 'â“”' => 'e',
  68055. 'â“•' => 'f',
  68056. 'â“–' => 'g',
  68057. 'â“—' => 'h',
  68058. 'ⓘ' => 'i',
  68059. 'â“™' => 'j',
  68060. 'â“š' => 'k',
  68061. 'â“›' => 'l',
  68062. 'ⓜ' => 'm',
  68063. '�' => 'n',
  68064. 'â“ž' => 'o',
  68065. 'â“Ÿ' => 'p',
  68066. 'â“ ' => 'q',
  68067. 'â“¡' => 'r',
  68068. 'â“¢' => 's',
  68069. 'â“£' => 't',
  68070. 'ⓤ' => 'u',
  68071. 'â“¥' => 'v',
  68072. 'ⓦ' => 'w',
  68073. 'ⓧ' => 'x',
  68074. 'ⓨ' => 'y',
  68075. 'â“©' => 'z',
  68076. '⓪' => '0',
  68077. '⨌' => '∫∫∫∫',
  68078. 'â©´' => '::=',
  68079. '⩵' => '==',
  68080. '⩶' => '===',
  68081. 'â±¼' => 'j',
  68082. 'â±½' => 'V',
  68083. 'ⵯ' => 'ⵡ',
  68084. '⺟' => '�',
  68085. '⻳' => '龟',
  68086. '⼀' => '一',
  68087. '�' => '丨',
  68088. '⼂' => '丶',
  68089. '⼃' => '丿',
  68090. '⼄' => '乙',
  68091. '⼅' => '亅',
  68092. '⼆' => '二',
  68093. '⼇' => '亠',
  68094. '⼈' => '人',
  68095. '⼉' => '儿',
  68096. '⼊' => '入',
  68097. '⼋' => '八',
  68098. '⼌' => '冂',
  68099. '�' => '冖',
  68100. '⼎' => '冫',
  68101. '�' => '几',
  68102. '�' => '凵',
  68103. '⼑' => '刀',
  68104. '⼒' => '力',
  68105. '⼓' => '勹',
  68106. '⼔' => '匕',
  68107. '⼕' => '匚',
  68108. '⼖' => '匸',
  68109. '⼗' => '�',
  68110. '⼘' => '�',
  68111. '⼙' => '�',
  68112. '⼚' => '厂',
  68113. '⼛' => '厶',
  68114. '⼜' => '�',
  68115. '�' => '�',
  68116. '⼞' => '囗',
  68117. '⼟' => '土',
  68118. '⼠' => '士',
  68119. '⼡' => '夂',
  68120. '⼢' => '夊',
  68121. '⼣' => '夕',
  68122. '⼤' => '大',
  68123. '⼥' => '女',
  68124. '⼦' => '�',
  68125. '⼧' => '宀',
  68126. '⼨' => '寸',
  68127. '⼩' => '�',
  68128. '⼪' => '尢',
  68129. '⼫' => '尸',
  68130. '⼬' => '屮',
  68131. 'â¼­' => 'å±±',
  68132. 'â¼®' => 'å·›',
  68133. '⼯' => '工',
  68134. 'â¼°' => 'å·±',
  68135. 'â¼±' => 'å·¾',
  68136. 'â¼²' => 'å¹²',
  68137. '⼳' => '幺',
  68138. '⼴' => '广',
  68139. 'â¼µ' => 'å»´',
  68140. '⼶' => '廾',
  68141. '⼷' => '弋',
  68142. '⼸' => '弓',
  68143. '⼹' => '�',
  68144. '⼺' => '彡',
  68145. 'â¼»' => 'å½³',
  68146. '⼼' => '心',
  68147. '⼽' => '戈',
  68148. '⼾' => '戶',
  68149. '⼿' => '手',
  68150. '⽀' => '支',
  68151. '�' => '攴',
  68152. '⽂' => '文',
  68153. '⽃' => '斗',
  68154. '⽄' => '斤',
  68155. 'â½…' => 'æ–¹',
  68156. '⽆' => '无',
  68157. '⽇' => '日',
  68158. '⽈' => '曰',
  68159. '⽉' => '月',
  68160. '⽊' => '木',
  68161. '⽋' => '欠',
  68162. '⽌' => '止',
  68163. '�' => '歹',
  68164. '⽎' => '殳',
  68165. '�' => '毋',
  68166. '�' => '比',
  68167. '⽑' => '毛',
  68168. 'â½’' => 'æ°�',
  68169. '⽓' => '气',
  68170. 'â½”' => 'æ°´',
  68171. '⽕' => '�',
  68172. '⽖' => '爪',
  68173. '⽗' => '父',
  68174. '⽘' => '爻',
  68175. '⽙' => '爿',
  68176. '⽚' => '片',
  68177. '⽛' => '牙',
  68178. '⽜' => '牛',
  68179. '�' => '犬',
  68180. '⽞' => '玄',
  68181. '⽟' => '玉',
  68182. '⽠' => '瓜',
  68183. '⽡' => '瓦',
  68184. '⽢' => '甘',
  68185. '⽣' => '生',
  68186. '⽤' => '用',
  68187. 'â½¥' => 'ç”°',
  68188. '⽦' => '疋',
  68189. '⽧' => '疒',
  68190. '⽨' => '癶',
  68191. '⽩' => '白',
  68192. '⽪' => '皮',
  68193. '⽫' => '皿',
  68194. '⽬' => '目',
  68195. '⽭' => '矛',
  68196. '⽮' => '矢',
  68197. '⽯' => '石',
  68198. '⽰' => '示',
  68199. '⽱' => '禸',
  68200. '⽲' => '禾',
  68201. 'â½³' => 'ç©´',
  68202. 'â½´' => 'ç«‹',
  68203. '⽵' => '竹',
  68204. '⽶' => '米',
  68205. '⽷' => '糸',
  68206. '⽸' => '缶',
  68207. '⽹' => '网',
  68208. '⽺' => '羊',
  68209. 'â½»' => 'ç¾½',
  68210. '⽼' => '�',
  68211. '⽽' => '而',
  68212. '⽾' => '耒',
  68213. '⽿' => '耳',
  68214. '⾀' => '�',
  68215. '�' => '肉',
  68216. '⾂' => '臣',
  68217. '⾃' => '自',
  68218. '⾄' => '至',
  68219. '⾅' => '臼',
  68220. '⾆' => '舌',
  68221. '⾇' => '舛',
  68222. '⾈' => '舟',
  68223. '⾉' => '艮',
  68224. '⾊' => '色',
  68225. '⾋' => '艸',
  68226. '⾌' => '�',
  68227. '�' => '虫',
  68228. '⾎' => '血',
  68229. '�' => '行',
  68230. '�' => '衣',
  68231. '⾑' => '襾',
  68232. '⾒' => '見',
  68233. '⾓' => '角',
  68234. '⾔' => '言',
  68235. '⾕' => '谷',
  68236. '⾖' => '豆',
  68237. '⾗' => '豕',
  68238. '⾘' => '豸',
  68239. '⾙' => '�',
  68240. '⾚' => '赤',
  68241. 'â¾›' => 'èµ°',
  68242. '⾜' => '足',
  68243. '�' => '身',
  68244. '⾞' => '車',
  68245. '⾟' => '辛',
  68246. 'â¾ ' => 'è¾°',
  68247. '⾡' => '辵',
  68248. 'â¾¢' => 'é‚‘',
  68249. 'â¾£' => 'é…‰',
  68250. '⾤' => '釆',
  68251. '⾥' => '里',
  68252. '⾦' => '金',
  68253. '⾧' => '長',
  68254. '⾨' => '門',
  68255. '⾩' => '阜',
  68256. '⾪' => '隶',
  68257. '⾫' => '隹',
  68258. '⾬' => '雨',
  68259. '⾭' => '�',
  68260. '⾮' => '�',
  68261. '⾯' => '�',
  68262. '⾰' => '�',
  68263. '⾱' => '韋',
  68264. '⾲' => '韭',
  68265. '⾳' => '音',
  68266. 'â¾´' => 'é �',
  68267. '⾵' => '風',
  68268. '⾶' => '飛',
  68269. '⾷' => '食',
  68270. '⾸' => '首',
  68271. '⾹' => '香',
  68272. '⾺' => '馬',
  68273. '⾻' => '骨',
  68274. '⾼' => '高',
  68275. 'â¾½' => 'é«Ÿ',
  68276. '⾾' => '鬥',
  68277. '⾿' => '鬯',
  68278. '⿀' => '鬲',
  68279. '�' => '鬼',
  68280. 'â¿‚' => 'é­š',
  68281. '⿃' => '鳥',
  68282. 'â¿„' => 'é¹µ',
  68283. '⿅' => '鹿',
  68284. '⿆' => '麥',
  68285. '⿇' => '麻',
  68286. '⿈' => '黃',
  68287. '⿉' => '�',
  68288. '⿊' => '黑',
  68289. '⿋' => '黹',
  68290. '⿌' => '黽',
  68291. '�' => '鼎',
  68292. '⿎' => '鼓',
  68293. '�' => '鼠',
  68294. '�' => '鼻',
  68295. '⿑' => '齊',
  68296. 'â¿’' => 'é½’',
  68297. '⿓' => '�',
  68298. '⿔' => '龜',
  68299. 'â¿•' => 'é¾ ',
  68300. ' ' => ' ',
  68301. '〶' => '〒',
  68302. '〸' => '�',
  68303. '〹' => '�',
  68304. '〺' => '�',
  68305. 'ã‚›' => ' ã‚™',
  68306. '゜' => ' ゚',
  68307. 'ゟ' => 'より',
  68308. 'ヿ' => 'コト',
  68309. 'ㄱ' => 'ᄀ',
  68310. 'ㄲ' => '�',
  68311. 'ㄳ' => 'ᆪ',
  68312. 'ã„´' => 'á„‚',
  68313. 'ㄵ' => 'ᆬ',
  68314. 'ㄶ' => 'ᆭ',
  68315. 'ㄷ' => 'ᄃ',
  68316. 'ㄸ' => 'ᄄ',
  68317. 'ㄹ' => 'ᄅ',
  68318. 'ㄺ' => 'ᆰ',
  68319. 'ㄻ' => 'ᆱ',
  68320. 'ㄼ' => 'ᆲ',
  68321. 'ㄽ' => 'ᆳ',
  68322. 'ㄾ' => 'ᆴ',
  68323. 'ㄿ' => 'ᆵ',
  68324. 'ã…€' => 'á„š',
  68325. '�' => 'ᄆ',
  68326. 'ㅂ' => 'ᄇ',
  68327. 'ㅃ' => 'ᄈ',
  68328. 'ã…„' => 'á„¡',
  68329. 'ㅅ' => 'ᄉ',
  68330. 'ã…†' => 'á„Š',
  68331. 'ã…‡' => 'á„‹',
  68332. 'ㅈ' => 'ᄌ',
  68333. 'ㅉ' => '�',
  68334. 'ã…Š' => 'á„Ž',
  68335. 'ㅋ' => '�',
  68336. 'ㅌ' => '�',
  68337. 'ã…�' => 'á„‘',
  68338. 'ã…Ž' => 'á„’',
  68339. 'ã…�' => 'á…¡',
  68340. 'ã…�' => 'á…¢',
  68341. 'ã…‘' => 'á…£',
  68342. 'ã…’' => 'á…¤',
  68343. 'ã…“' => 'á…¥',
  68344. 'ã…”' => 'á…¦',
  68345. 'ã…•' => 'á…§',
  68346. 'ã…–' => 'á…¨',
  68347. 'ã…—' => 'á…©',
  68348. 'ã…˜' => 'á…ª',
  68349. 'ã…™' => 'á…«',
  68350. 'ã…š' => 'á…¬',
  68351. 'ã…›' => 'á…­',
  68352. 'ㅜ' => 'ᅮ',
  68353. 'ã…�' => 'á…¯',
  68354. 'ã…ž' => 'á…°',
  68355. 'ã…Ÿ' => 'á…±',
  68356. 'ã… ' => 'á…²',
  68357. 'ã…¡' => 'á…³',
  68358. 'ã…¢' => 'á…´',
  68359. 'ã…£' => 'á…µ',
  68360. 'ã…¤' => 'á… ',
  68361. 'ã…¥' => 'á„”',
  68362. 'ã…¦' => 'á„•',
  68363. 'ㅧ' => 'ᇇ',
  68364. 'ㅨ' => 'ᇈ',
  68365. 'ㅩ' => 'ᇌ',
  68366. 'ㅪ' => 'ᇎ',
  68367. 'ㅫ' => 'ᇓ',
  68368. 'ㅬ' => 'ᇗ',
  68369. 'ㅭ' => 'ᇙ',
  68370. 'ㅮ' => 'ᄜ',
  68371. 'ㅯ' => '�',
  68372. 'ㅰ' => 'ᇟ',
  68373. 'ㅱ' => '�',
  68374. 'ã…²' => 'á„ž',
  68375. 'ã…³' => 'á„ ',
  68376. 'ã…´' => 'á„¢',
  68377. 'ã…µ' => 'á„£',
  68378. 'ㅶ' => 'ᄧ',
  68379. 'ã…·' => 'á„©',
  68380. 'ã…¸' => 'á„«',
  68381. 'ㅹ' => 'ᄬ',
  68382. 'ã…º' => 'á„­',
  68383. 'ã…»' => 'á„®',
  68384. 'ㅼ' => 'ᄯ',
  68385. 'ㅽ' => 'ᄲ',
  68386. 'ㅾ' => 'ᄶ',
  68387. 'ã…¿' => 'á…€',
  68388. 'ㆀ' => 'ᅇ',
  68389. '�' => 'ᅌ',
  68390. 'ㆂ' => 'ᇱ',
  68391. 'ㆃ' => 'ᇲ',
  68392. 'ㆄ' => 'ᅗ',
  68393. 'ㆅ' => 'ᅘ',
  68394. 'ㆆ' => 'ᅙ',
  68395. 'ㆇ' => 'ᆄ',
  68396. 'ㆈ' => 'ᆅ',
  68397. 'ㆉ' => 'ᆈ',
  68398. 'ㆊ' => 'ᆑ',
  68399. 'ㆋ' => 'ᆒ',
  68400. 'ㆌ' => 'ᆔ',
  68401. '�' => 'ᆞ',
  68402. 'ㆎ' => 'ᆡ',
  68403. '㆒' => '一',
  68404. '㆓' => '二',
  68405. '㆔' => '三',
  68406. '㆕' => '四',
  68407. '㆖' => '上',
  68408. '㆗' => '中',
  68409. '㆘' => '下',
  68410. '㆙' => '甲',
  68411. '㆚' => '乙',
  68412. '㆛' => '丙',
  68413. '㆜' => '�',
  68414. '�' => '天',
  68415. '㆞' => '地',
  68416. '㆟' => '人',
  68417. '㈀' => '(ᄀ)',
  68418. '�' => '(ᄂ)',
  68419. '㈂' => '(ᄃ)',
  68420. '㈃' => '(ᄅ)',
  68421. '㈄' => '(ᄆ)',
  68422. '㈅' => '(ᄇ)',
  68423. '㈆' => '(ᄉ)',
  68424. '㈇' => '(ᄋ)',
  68425. '㈈' => '(ᄌ)',
  68426. '㈉' => '(ᄎ)',
  68427. '㈊' => '(�)',
  68428. '㈋' => '(�)',
  68429. '㈌' => '(ᄑ)',
  68430. '�' => '(ᄒ)',
  68431. '㈎' => '(가)',
  68432. '�' => '(나)',
  68433. '�' => '(다)',
  68434. '㈑' => '(라)',
  68435. '㈒' => '(마)',
  68436. '㈓' => '(바)',
  68437. '㈔' => '(사)',
  68438. '㈕' => '(아)',
  68439. '㈖' => '(자)',
  68440. '㈗' => '(차)',
  68441. '㈘' => '(�ᅡ)',
  68442. '㈙' => '(�ᅡ)',
  68443. '㈚' => '(파)',
  68444. '㈛' => '(하)',
  68445. '㈜' => '(주)',
  68446. '�' => '(오전)',
  68447. '㈞' => '(오후)',
  68448. '㈠' => '(一)',
  68449. '㈡' => '(二)',
  68450. '㈢' => '(三)',
  68451. '㈣' => '(四)',
  68452. '㈤' => '(五)',
  68453. '㈥' => '(六)',
  68454. '㈦' => '(七)',
  68455. '㈧' => '(八)',
  68456. '㈨' => '(�)',
  68457. '㈩' => '(�)',
  68458. '㈪' => '(月)',
  68459. '㈫' => '(�)',
  68460. '㈬' => '(水)',
  68461. '㈭' => '(木)',
  68462. '㈮' => '(金)',
  68463. '㈯' => '(土)',
  68464. '㈰' => '(日)',
  68465. '㈱' => '(株)',
  68466. '㈲' => '(有)',
  68467. '㈳' => '(社)',
  68468. '㈴' => '(�)',
  68469. '㈵' => '(特)',
  68470. '㈶' => '(財)',
  68471. '㈷' => '(�)',
  68472. '㈸' => '(労)',
  68473. '㈹' => '(代)',
  68474. '㈺' => '(呼)',
  68475. '㈻' => '(学)',
  68476. '㈼' => '(監)',
  68477. '㈽' => '(�)',
  68478. '㈾' => '(資)',
  68479. '㈿' => '(�)',
  68480. '㉀' => '(祭)',
  68481. '�' => '(休)',
  68482. '㉂' => '(自)',
  68483. '㉃' => '(至)',
  68484. '㉄' => '�',
  68485. '㉅' => '幼',
  68486. '㉆' => '文',
  68487. '㉇' => '�',
  68488. '�' => 'PTE',
  68489. '㉑' => '21',
  68490. '㉒' => '22',
  68491. '㉓' => '23',
  68492. '㉔' => '24',
  68493. '㉕' => '25',
  68494. '㉖' => '26',
  68495. '㉗' => '27',
  68496. '㉘' => '28',
  68497. '㉙' => '29',
  68498. '㉚' => '30',
  68499. '㉛' => '31',
  68500. '㉜' => '32',
  68501. '�' => '33',
  68502. '㉞' => '34',
  68503. '㉟' => '35',
  68504. '㉠' => 'ᄀ',
  68505. '㉡' => 'ᄂ',
  68506. '㉢' => 'ᄃ',
  68507. '㉣' => 'ᄅ',
  68508. '㉤' => 'ᄆ',
  68509. '㉥' => 'ᄇ',
  68510. '㉦' => 'ᄉ',
  68511. '㉧' => 'ᄋ',
  68512. '㉨' => 'ᄌ',
  68513. '㉩' => 'ᄎ',
  68514. '㉪' => '�',
  68515. '㉫' => '�',
  68516. '㉬' => 'ᄑ',
  68517. '㉭' => 'ᄒ',
  68518. '㉮' => '가',
  68519. '㉯' => '나',
  68520. '㉰' => '다',
  68521. '㉱' => '라',
  68522. '㉲' => '마',
  68523. '㉳' => '바',
  68524. '㉴' => '사',
  68525. '㉵' => '아',
  68526. '㉶' => '자',
  68527. '㉷' => '차',
  68528. '㉸' => '�ᅡ',
  68529. '㉹' => '�ᅡ',
  68530. '㉺' => '파',
  68531. '㉻' => '하',
  68532. '㉼' => '참고',
  68533. '㉽' => '주의',
  68534. '㉾' => '우',
  68535. '㊀' => '一',
  68536. '�' => '二',
  68537. '㊂' => '三',
  68538. '㊃' => '四',
  68539. '㊄' => '五',
  68540. '㊅' => '六',
  68541. '㊆' => '七',
  68542. '㊇' => '八',
  68543. '㊈' => '�',
  68544. '㊉' => '�',
  68545. '㊊' => '月',
  68546. '㊋' => '�',
  68547. '㊌' => '水',
  68548. '�' => '木',
  68549. '㊎' => '金',
  68550. '�' => '土',
  68551. '�' => '日',
  68552. '㊑' => '株',
  68553. '㊒' => '有',
  68554. '㊓' => '社',
  68555. '㊔' => '�',
  68556. '㊕' => '特',
  68557. '㊖' => '財',
  68558. '㊗' => '�',
  68559. '㊘' => '労',
  68560. '㊙' => '秘',
  68561. '㊚' => '男',
  68562. '㊛' => '女',
  68563. '㊜' => '�',
  68564. '�' => '優',
  68565. '㊞' => '�',
  68566. '㊟' => '注',
  68567. '㊠' => '項',
  68568. '㊡' => '休',
  68569. '㊢' => '写',
  68570. '㊣' => '正',
  68571. '㊤' => '上',
  68572. '㊥' => '中',
  68573. '㊦' => '下',
  68574. '㊧' => '左',
  68575. '㊨' => '�',
  68576. '㊩' => '医',
  68577. '㊪' => '宗',
  68578. '㊫' => '学',
  68579. '㊬' => '監',
  68580. '㊭' => '�',
  68581. '㊮' => '資',
  68582. '㊯' => '�',
  68583. '㊰' => '夜',
  68584. '㊱' => '36',
  68585. '㊲' => '37',
  68586. '㊳' => '38',
  68587. '㊴' => '39',
  68588. '㊵' => '40',
  68589. '㊶' => '41',
  68590. '㊷' => '42',
  68591. '㊸' => '43',
  68592. '㊹' => '44',
  68593. '㊺' => '45',
  68594. '㊻' => '46',
  68595. '㊼' => '47',
  68596. '㊽' => '48',
  68597. '㊾' => '49',
  68598. '㊿' => '50',
  68599. '㋀' => '1月',
  68600. '�' => '2月',
  68601. '㋂' => '3月',
  68602. '㋃' => '4月',
  68603. '㋄' => '5月',
  68604. '㋅' => '6月',
  68605. '㋆' => '7月',
  68606. '㋇' => '8月',
  68607. '㋈' => '9月',
  68608. '㋉' => '10月',
  68609. '㋊' => '11月',
  68610. '㋋' => '12月',
  68611. '㋌' => 'Hg',
  68612. '�' => 'erg',
  68613. 'ã‹Ž' => 'eV',
  68614. '�' => 'LTD',
  68615. '�' => 'ア',
  68616. '㋑' => 'イ',
  68617. '㋒' => 'ウ',
  68618. '㋓' => 'エ',
  68619. '㋔' => 'オ',
  68620. 'ã‹•' => 'ã‚«',
  68621. 'ã‹–' => 'ã‚­',
  68622. '㋗' => 'ク',
  68623. '㋘' => 'ケ',
  68624. '㋙' => 'コ',
  68625. '㋚' => 'サ',
  68626. 'ã‹›' => 'ã‚·',
  68627. '㋜' => 'ス',
  68628. '�' => 'セ',
  68629. '㋞' => 'ソ',
  68630. 'ã‹Ÿ' => 'ã‚¿',
  68631. '㋠' => '�',
  68632. '㋡' => 'ツ',
  68633. '㋢' => 'テ',
  68634. '㋣' => 'ト',
  68635. '㋤' => 'ナ',
  68636. '㋥' => 'ニ',
  68637. '㋦' => 'ヌ',
  68638. '㋧' => '�',
  68639. '㋨' => 'ノ',
  68640. '㋩' => '�',
  68641. '㋪' => 'ヒ',
  68642. '㋫' => 'フ',
  68643. '㋬' => 'ヘ',
  68644. '㋭' => 'ホ',
  68645. '㋮' => 'マ',
  68646. '㋯' => 'ミ',
  68647. '㋰' => 'ム',
  68648. '㋱' => 'メ',
  68649. '㋲' => 'モ',
  68650. '㋳' => 'ヤ',
  68651. '㋴' => 'ユ',
  68652. '㋵' => 'ヨ',
  68653. '㋶' => 'ラ',
  68654. '㋷' => 'リ',
  68655. '㋸' => 'ル',
  68656. '㋹' => 'レ',
  68657. '㋺' => 'ロ',
  68658. '㋻' => 'ワ',
  68659. '㋼' => 'ヰ',
  68660. '㋽' => 'ヱ',
  68661. '㋾' => 'ヲ',
  68662. '㋿' => '令和',
  68663. '㌀' => 'ア�゚ート',
  68664. '�' => 'アルファ',
  68665. '㌂' => 'アンペア',
  68666. '㌃' => 'アール',
  68667. '㌄' => 'イニング',
  68668. '㌅' => 'イン�',
  68669. '㌆' => 'ウォン',
  68670. '㌇' => 'エスクード',
  68671. '㌈' => 'エーカー',
  68672. '㌉' => 'オンス',
  68673. '㌊' => 'オーム',
  68674. '㌋' => 'カイリ',
  68675. '㌌' => 'カラット',
  68676. '�' => 'カロリー',
  68677. '㌎' => 'ガロン',
  68678. '�' => 'ガンマ',
  68679. '�' => 'ギガ',
  68680. '㌑' => 'ギニー',
  68681. '㌒' => 'キュリー',
  68682. '㌓' => 'ギルダー',
  68683. '㌔' => 'キロ',
  68684. '㌕' => 'キログラム',
  68685. '㌖' => 'キロメートル',
  68686. '㌗' => 'キロワット',
  68687. '㌘' => 'グラム',
  68688. '㌙' => 'グラムトン',
  68689. '㌚' => 'クルゼイロ',
  68690. '㌛' => 'クロー�',
  68691. '㌜' => 'ケース',
  68692. '�' => 'コルナ',
  68693. '㌞' => 'コーポ',
  68694. '㌟' => 'サイクル',
  68695. '㌠' => 'サン�ーム',
  68696. '㌡' => 'シリング',
  68697. '㌢' => 'セン�',
  68698. '㌣' => 'セント',
  68699. '㌤' => 'ダース',
  68700. '㌥' => 'デシ',
  68701. '㌦' => 'ドル',
  68702. '㌧' => 'トン',
  68703. '㌨' => 'ナノ',
  68704. '㌩' => 'ノット',
  68705. '㌪' => '�イツ',
  68706. '㌫' => '�゚ーセント',
  68707. '㌬' => '�゚ーツ',
  68708. '㌭' => '�゙ーレル',
  68709. '㌮' => 'ピアストル',
  68710. '㌯' => 'ピクル',
  68711. '㌰' => 'ピコ',
  68712. '㌱' => 'ビル',
  68713. '㌲' => 'ファラッド',
  68714. '㌳' => 'フィート',
  68715. '㌴' => 'ブッシェル',
  68716. '㌵' => 'フラン',
  68717. '㌶' => 'ヘクタール',
  68718. '㌷' => 'ペソ',
  68719. '㌸' => 'ペニヒ',
  68720. '㌹' => 'ヘルツ',
  68721. '㌺' => 'ペンス',
  68722. '㌻' => 'ページ',
  68723. '㌼' => 'ベータ',
  68724. '㌽' => 'ポイント',
  68725. '㌾' => 'ボルト',
  68726. '㌿' => 'ホン',
  68727. '�' => 'ポンド',
  68728. '�' => 'ホール',
  68729. '�' => 'ホーン',
  68730. '�' => 'マイクロ',
  68731. '�' => 'マイル',
  68732. '�' => 'マッ�',
  68733. '�' => 'マルク',
  68734. '�' => 'マンション',
  68735. '�' => 'ミクロン',
  68736. '�' => 'ミリ',
  68737. '�' => 'ミリ�゙ール',
  68738. '�' => 'メガ',
  68739. '�' => 'メガトン',
  68740. '�' => 'メートル',
  68741. '�' => 'ヤード',
  68742. '�' => 'ヤール',
  68743. '�' => 'ユアン',
  68744. '�' => 'リットル',
  68745. '�' => 'リラ',
  68746. '�' => 'ルピー',
  68747. '�' => 'ルーブル',
  68748. '�' => 'レム',
  68749. '�' => 'レントゲン',
  68750. '�' => 'ワット',
  68751. '�' => '0点',
  68752. '�' => '1点',
  68753. '�' => '2点',
  68754. '�' => '3点',
  68755. '�' => '4点',
  68756. '�' => '5点',
  68757. '�' => '6点',
  68758. '�' => '7点',
  68759. '�' => '8点',
  68760. '�' => '9点',
  68761. '�' => '10点',
  68762. '�' => '11点',
  68763. '�' => '12点',
  68764. '�' => '13点',
  68765. '�' => '14点',
  68766. '�' => '15点',
  68767. '�' => '16点',
  68768. '�' => '17点',
  68769. '�' => '18点',
  68770. '�' => '19点',
  68771. '�' => '20点',
  68772. '�' => '21点',
  68773. '�' => '22点',
  68774. '�' => '23点',
  68775. '�' => '24点',
  68776. '�' => 'hPa',
  68777. '�' => 'da',
  68778. '�' => 'AU',
  68779. '�' => 'bar',
  68780. '�' => 'oV',
  68781. '�' => 'pc',
  68782. '�' => 'dm',
  68783. '�' => 'dm2',
  68784. '�' => 'dm3',
  68785. '�' => 'IU',
  68786. '�' => '平�',
  68787. '�' => '昭和',
  68788. '�' => '大正',
  68789. '�' => '明治',
  68790. '�' => '株�会社',
  68791. '㎀' => 'pA',
  68792. '�' => 'nA',
  68793. '㎂' => 'μA',
  68794. '㎃' => 'mA',
  68795. '㎄' => 'kA',
  68796. '㎅' => 'KB',
  68797. '㎆' => 'MB',
  68798. '㎇' => 'GB',
  68799. '㎈' => 'cal',
  68800. '㎉' => 'kcal',
  68801. '㎊' => 'pF',
  68802. '㎋' => 'nF',
  68803. '㎌' => 'μF',
  68804. '�' => 'μg',
  68805. '㎎' => 'mg',
  68806. '�' => 'kg',
  68807. '�' => 'Hz',
  68808. '㎑' => 'kHz',
  68809. '㎒' => 'MHz',
  68810. '㎓' => 'GHz',
  68811. '㎔' => 'THz',
  68812. '㎕' => 'μl',
  68813. '㎖' => 'ml',
  68814. '㎗' => 'dl',
  68815. '㎘' => 'kl',
  68816. '㎙' => 'fm',
  68817. '㎚' => 'nm',
  68818. '㎛' => 'μm',
  68819. '㎜' => 'mm',
  68820. '�' => 'cm',
  68821. '㎞' => 'km',
  68822. '㎟' => 'mm2',
  68823. '㎠' => 'cm2',
  68824. '㎡' => 'm2',
  68825. '㎢' => 'km2',
  68826. '㎣' => 'mm3',
  68827. '㎤' => 'cm3',
  68828. '㎥' => 'm3',
  68829. '㎦' => 'km3',
  68830. '㎧' => 'm∕s',
  68831. '㎨' => 'm∕s2',
  68832. '㎩' => 'Pa',
  68833. '㎪' => 'kPa',
  68834. '㎫' => 'MPa',
  68835. '㎬' => 'GPa',
  68836. '㎭' => 'rad',
  68837. '㎮' => 'rad∕s',
  68838. '㎯' => 'rad∕s2',
  68839. '㎰' => 'ps',
  68840. '㎱' => 'ns',
  68841. '㎲' => 'μs',
  68842. '㎳' => 'ms',
  68843. '㎴' => 'pV',
  68844. '㎵' => 'nV',
  68845. '㎶' => 'μV',
  68846. '㎷' => 'mV',
  68847. '㎸' => 'kV',
  68848. '㎹' => 'MV',
  68849. '㎺' => 'pW',
  68850. '㎻' => 'nW',
  68851. '㎼' => 'μW',
  68852. '㎽' => 'mW',
  68853. '㎾' => 'kW',
  68854. '㎿' => 'MW',
  68855. '�' => 'kΩ',
  68856. '�' => 'MΩ',
  68857. '�' => 'a.m.',
  68858. '�' => 'Bq',
  68859. '�' => 'cc',
  68860. '�' => 'cd',
  68861. '�' => 'C∕kg',
  68862. '�' => 'Co.',
  68863. '�' => 'dB',
  68864. '�' => 'Gy',
  68865. '�' => 'ha',
  68866. '�' => 'HP',
  68867. '�' => 'in',
  68868. '�' => 'KK',
  68869. '�' => 'KM',
  68870. '�' => 'kt',
  68871. '�' => 'lm',
  68872. '�' => 'ln',
  68873. '�' => 'log',
  68874. '�' => 'lx',
  68875. '�' => 'mb',
  68876. '�' => 'mil',
  68877. '�' => 'mol',
  68878. '�' => 'PH',
  68879. '�' => 'p.m.',
  68880. '�' => 'PPM',
  68881. '�' => 'PR',
  68882. '�' => 'sr',
  68883. '�' => 'Sv',
  68884. '�' => 'Wb',
  68885. '�' => 'V∕m',
  68886. '�' => 'A∕m',
  68887. '�' => '1日',
  68888. '�' => '2日',
  68889. '�' => '3日',
  68890. '�' => '4日',
  68891. '�' => '5日',
  68892. '�' => '6日',
  68893. '�' => '7日',
  68894. '�' => '8日',
  68895. '�' => '9日',
  68896. '�' => '10日',
  68897. '�' => '11日',
  68898. '�' => '12日',
  68899. '�' => '13日',
  68900. '�' => '14日',
  68901. '�' => '15日',
  68902. '�' => '16日',
  68903. '�' => '17日',
  68904. '�' => '18日',
  68905. '�' => '19日',
  68906. '�' => '20日',
  68907. '�' => '21日',
  68908. '�' => '22日',
  68909. '�' => '23日',
  68910. '�' => '24日',
  68911. '�' => '25日',
  68912. '�' => '26日',
  68913. '�' => '27日',
  68914. '�' => '28日',
  68915. '�' => '29日',
  68916. '�' => '30日',
  68917. '�' => '31日',
  68918. '�' => 'gal',
  68919. 'ꚜ' => 'ъ',
  68920. '�' => 'ь',
  68921. '�' => '�',
  68922. 'ꟸ' => 'Ħ',
  68923. 'ꟹ' => 'œ',
  68924. 'ꭜ' => 'ꜧ',
  68925. '�' => 'ꬷ',
  68926. 'ê­ž' => 'É«',
  68927. 'ê­Ÿ' => 'ê­’',
  68928. 'ꭩ' => '�',
  68929. 'ff' => 'ff',
  68930. '�' => 'fi',
  68931. 'fl' => 'fl',
  68932. 'ffi' => 'ffi',
  68933. 'ffl' => 'ffl',
  68934. 'ſt' => 'st',
  68935. 'st' => 'st',
  68936. 'ﬓ' => 'մն',
  68937. 'ﬔ' => 'մե',
  68938. 'ﬕ' => 'մի',
  68939. 'ﬖ' => 'վն',
  68940. 'ﬗ' => 'մխ',
  68941. 'ﬠ' => 'ע',
  68942. 'ﬡ' => '�',
  68943. 'ﬢ' => 'ד',
  68944. 'ﬣ' => 'ה',
  68945. 'ﬤ' => 'כ',
  68946. 'ﬥ' => 'ל',
  68947. 'ﬦ' => '�',
  68948. 'ﬧ' => 'ר',
  68949. 'ﬨ' => 'ת',
  68950. '﬩' => '+',
  68951. '�' => '�ל',
  68952. 'ï­�' => 'Ù±',
  68953. 'ï­‘' => 'Ù±',
  68954. 'ï­’' => 'Ù»',
  68955. 'ï­“' => 'Ù»',
  68956. 'ï­”' => 'Ù»',
  68957. 'ï­•' => 'Ù»',
  68958. 'ï­–' => 'Ù¾',
  68959. 'ï­—' => 'Ù¾',
  68960. 'ï­˜' => 'Ù¾',
  68961. 'ï­™' => 'Ù¾',
  68962. 'ï­š' => 'Ú€',
  68963. 'ï­›' => 'Ú€',
  68964. 'ﭜ' => 'ڀ',
  68965. 'ï­�' => 'Ú€',
  68966. 'ï­ž' => 'Ùº',
  68967. 'ï­Ÿ' => 'Ùº',
  68968. 'ï­ ' => 'Ùº',
  68969. 'ï­¡' => 'Ùº',
  68970. 'ï­¢' => 'Ù¿',
  68971. 'ï­£' => 'Ù¿',
  68972. 'ï­¤' => 'Ù¿',
  68973. 'ï­¥' => 'Ù¿',
  68974. 'ï­¦' => 'Ù¹',
  68975. 'ï­§' => 'Ù¹',
  68976. 'ï­¨' => 'Ù¹',
  68977. 'ï­©' => 'Ù¹',
  68978. 'ï­ª' => 'Ú¤',
  68979. 'ï­«' => 'Ú¤',
  68980. 'ï­¬' => 'Ú¤',
  68981. 'ï­­' => 'Ú¤',
  68982. 'ï­®' => 'Ú¦',
  68983. 'ï­¯' => 'Ú¦',
  68984. 'ï­°' => 'Ú¦',
  68985. 'ï­±' => 'Ú¦',
  68986. 'ï­²' => 'Ú„',
  68987. 'ï­³' => 'Ú„',
  68988. 'ï­´' => 'Ú„',
  68989. 'ï­µ' => 'Ú„',
  68990. 'ï­¶' => 'Úƒ',
  68991. 'ï­·' => 'Úƒ',
  68992. 'ï­¸' => 'Úƒ',
  68993. 'ï­¹' => 'Úƒ',
  68994. 'ï­º' => 'Ú†',
  68995. 'ï­»' => 'Ú†',
  68996. 'ï­¼' => 'Ú†',
  68997. 'ï­½' => 'Ú†',
  68998. 'ï­¾' => 'Ú‡',
  68999. 'ï­¿' => 'Ú‡',
  69000. 'ﮀ' => 'ڇ',
  69001. '�' => 'ڇ',
  69002. 'ﮂ' => '�',
  69003. 'ﮃ' => '�',
  69004. 'ﮄ' => 'ڌ',
  69005. 'ﮅ' => 'ڌ',
  69006. 'ﮆ' => 'ڎ',
  69007. 'ﮇ' => 'ڎ',
  69008. 'ﮈ' => 'ڈ',
  69009. 'ﮉ' => 'ڈ',
  69010. 'ﮊ' => 'ژ',
  69011. 'ﮋ' => 'ژ',
  69012. 'ﮌ' => 'ڑ',
  69013. '�' => 'ڑ',
  69014. 'ﮎ' => 'ک',
  69015. '�' => 'ک',
  69016. '�' => 'ک',
  69017. 'ﮑ' => 'ک',
  69018. 'ï®’' => 'Ú¯',
  69019. 'ﮓ' => 'گ',
  69020. 'ï®”' => 'Ú¯',
  69021. 'ﮕ' => 'گ',
  69022. 'ï®–' => 'Ú³',
  69023. 'ï®—' => 'Ú³',
  69024. 'ﮘ' => 'ڳ',
  69025. 'ï®™' => 'Ú³',
  69026. 'ﮚ' => 'ڱ',
  69027. 'ï®›' => 'Ú±',
  69028. 'ﮜ' => 'ڱ',
  69029. '�' => 'ڱ',
  69030. 'ﮞ' => 'ں',
  69031. 'ﮟ' => 'ں',
  69032. 'ï® ' => 'Ú»',
  69033. 'ﮡ' => 'ڻ',
  69034. 'ﮢ' => 'ڻ',
  69035. 'ﮣ' => 'ڻ',
  69036. 'ﮤ' => 'ۀ',
  69037. 'ﮥ' => 'ۀ',
  69038. 'ﮦ' => '�',
  69039. 'ﮧ' => '�',
  69040. 'ﮨ' => '�',
  69041. 'ﮩ' => '�',
  69042. 'ﮪ' => 'ھ',
  69043. 'ﮫ' => 'ھ',
  69044. 'ﮬ' => 'ھ',
  69045. 'ï®­' => 'Ú¾',
  69046. 'ï®®' => 'Û’',
  69047. 'ﮯ' => 'ے',
  69048. 'ï®°' => 'Û’Ù”',
  69049. 'ï®±' => 'Û’Ù”',
  69050. 'ﯓ' => 'ڭ',
  69051. 'ﯔ' => 'ڭ',
  69052. 'ﯕ' => 'ڭ',
  69053. 'ﯖ' => 'ڭ',
  69054. 'ﯗ' => 'ۇ',
  69055. 'ﯘ' => 'ۇ',
  69056. 'ﯙ' => 'ۆ',
  69057. 'ﯚ' => 'ۆ',
  69058. 'ﯛ' => 'ۈ',
  69059. 'ﯜ' => 'ۈ',
  69060. '�' => 'ۇٴ',
  69061. 'ﯞ' => 'ۋ',
  69062. 'ﯟ' => 'ۋ',
  69063. 'ﯠ' => 'ۅ',
  69064. 'ﯡ' => 'ۅ',
  69065. 'ﯢ' => 'ۉ',
  69066. 'ﯣ' => 'ۉ',
  69067. 'ﯤ' => '�',
  69068. 'ﯥ' => '�',
  69069. 'ﯦ' => '�',
  69070. 'ﯧ' => '�',
  69071. 'ﯨ' => 'ى',
  69072. 'ﯩ' => 'ى',
  69073. 'ﯪ' => 'ئا',
  69074. 'ﯫ' => 'ئا',
  69075. 'ﯬ' => 'ئە',
  69076. 'ﯭ' => 'ئە',
  69077. 'ﯮ' => 'ئو',
  69078. 'ﯯ' => 'ئو',
  69079. 'ﯰ' => 'ئۇ',
  69080. 'ﯱ' => 'ئۇ',
  69081. 'ﯲ' => 'ئۆ',
  69082. 'ﯳ' => 'ئۆ',
  69083. 'ﯴ' => 'ئۈ',
  69084. 'ﯵ' => 'ئۈ',
  69085. 'ﯶ' => 'ئ�',
  69086. 'ﯷ' => 'ئ�',
  69087. 'ﯸ' => 'ئ�',
  69088. 'ﯹ' => 'ئى',
  69089. 'ﯺ' => 'ئى',
  69090. 'ﯻ' => 'ئى',
  69091. 'ﯼ' => 'ی',
  69092. 'ﯽ' => 'ی',
  69093. 'ﯾ' => 'ی',
  69094. 'ﯿ' => 'ی',
  69095. 'ﰀ' => 'ئج',
  69096. '�' => 'ئح',
  69097. 'ï°‚' => 'ÙŠÙ”Ù…',
  69098. 'ï°ƒ' => 'ÙŠÙ”Ù‰',
  69099. 'ï°„' => 'ÙŠÙ”ÙŠ',
  69100. 'ﰅ' => 'بج',
  69101. 'ﰆ' => 'بح',
  69102. 'ﰇ' => 'بخ',
  69103. 'ﰈ' => 'بم',
  69104. 'ﰉ' => 'بى',
  69105. 'ﰊ' => 'بي',
  69106. 'ﰋ' => 'تج',
  69107. 'ﰌ' => 'تح',
  69108. '�' => 'تخ',
  69109. 'ﰎ' => 'تم',
  69110. '�' => 'تى',
  69111. '�' => 'تي',
  69112. 'ﰑ' => 'ثج',
  69113. 'ﰒ' => 'ثم',
  69114. 'ﰓ' => 'ثى',
  69115. 'ﰔ' => 'ثي',
  69116. 'ﰕ' => 'جح',
  69117. 'ﰖ' => 'جم',
  69118. 'ﰗ' => 'حج',
  69119. 'ﰘ' => 'حم',
  69120. 'ﰙ' => 'خج',
  69121. 'ﰚ' => 'خح',
  69122. 'ﰛ' => 'خم',
  69123. 'ﰜ' => 'سج',
  69124. '�' => 'سح',
  69125. 'ﰞ' => 'سخ',
  69126. 'ﰟ' => 'سم',
  69127. 'ﰠ' => 'صح',
  69128. 'ﰡ' => 'صم',
  69129. 'ﰢ' => 'ضج',
  69130. 'ﰣ' => 'ضح',
  69131. 'ﰤ' => 'ضخ',
  69132. 'ﰥ' => 'ضم',
  69133. 'ﰦ' => 'طح',
  69134. 'ﰧ' => 'طم',
  69135. 'ﰨ' => 'ظم',
  69136. 'ﰩ' => 'عج',
  69137. 'ﰪ' => 'عم',
  69138. 'ﰫ' => 'غج',
  69139. 'ﰬ' => 'غم',
  69140. 'ﰭ' => '�ج',
  69141. 'ﰮ' => '�ح',
  69142. 'ﰯ' => '�خ',
  69143. 'ﰰ' => '�م',
  69144. 'ﰱ' => '�ى',
  69145. 'ﰲ' => '�ي',
  69146. 'ﰳ' => 'قح',
  69147. 'ﰴ' => 'قم',
  69148. 'ﰵ' => 'قى',
  69149. 'ﰶ' => 'قي',
  69150. 'ﰷ' => 'كا',
  69151. 'ﰸ' => 'كج',
  69152. 'ﰹ' => 'كح',
  69153. 'ﰺ' => 'كخ',
  69154. 'ﰻ' => 'كل',
  69155. 'ﰼ' => 'كم',
  69156. 'ﰽ' => 'كى',
  69157. 'ﰾ' => 'كي',
  69158. 'ﰿ' => 'لج',
  69159. 'ﱀ' => 'لح',
  69160. '�' => 'لخ',
  69161. 'ﱂ' => 'لم',
  69162. 'ﱃ' => 'لى',
  69163. 'ﱄ' => 'لي',
  69164. 'ﱅ' => 'مج',
  69165. 'ﱆ' => 'مح',
  69166. 'ﱇ' => 'مخ',
  69167. 'ﱈ' => 'مم',
  69168. 'ﱉ' => 'مى',
  69169. 'ﱊ' => 'مي',
  69170. 'ﱋ' => 'نج',
  69171. 'ﱌ' => 'نح',
  69172. '�' => 'نخ',
  69173. 'ﱎ' => 'نم',
  69174. '�' => 'نى',
  69175. '�' => 'ني',
  69176. 'ﱑ' => 'هج',
  69177. 'ﱒ' => 'هم',
  69178. 'ﱓ' => 'هى',
  69179. 'ﱔ' => 'هي',
  69180. 'ﱕ' => 'يج',
  69181. 'ﱖ' => 'يح',
  69182. 'ﱗ' => 'يخ',
  69183. 'ﱘ' => 'يم',
  69184. 'ﱙ' => 'يى',
  69185. 'ﱚ' => 'يي',
  69186. 'ﱛ' => 'ذٰ',
  69187. 'ﱜ' => 'رٰ',
  69188. '�' => 'ىٰ',
  69189. 'ﱞ' => ' ٌّ',
  69190. 'ﱟ' => ' �ّ',
  69191. 'ï± ' => ' ÙŽÙ‘',
  69192. 'ﱡ' => ' �ّ',
  69193. 'ﱢ' => ' �ّ',
  69194. 'ﱣ' => ' ّٰ',
  69195. 'ﱤ' => 'ئر',
  69196. 'ﱥ' => 'ئز',
  69197. 'ﱦ' => 'ئم',
  69198. 'ﱧ' => 'ئن',
  69199. 'ﱨ' => 'ئى',
  69200. 'ﱩ' => 'ئي',
  69201. 'ﱪ' => 'بر',
  69202. 'ﱫ' => 'بز',
  69203. 'ﱬ' => 'بم',
  69204. 'ﱭ' => 'بن',
  69205. 'ﱮ' => 'بى',
  69206. 'ﱯ' => 'بي',
  69207. 'ﱰ' => 'تر',
  69208. 'ﱱ' => 'تز',
  69209. 'ﱲ' => 'تم',
  69210. 'ﱳ' => 'تن',
  69211. 'ﱴ' => 'تى',
  69212. 'ﱵ' => 'تي',
  69213. 'ﱶ' => 'ثر',
  69214. 'ﱷ' => 'ثز',
  69215. 'ﱸ' => 'ثم',
  69216. 'ﱹ' => 'ثن',
  69217. 'ﱺ' => 'ثى',
  69218. 'ﱻ' => 'ثي',
  69219. 'ﱼ' => '�ى',
  69220. 'ﱽ' => '�ي',
  69221. 'ﱾ' => 'قى',
  69222. 'ﱿ' => 'قي',
  69223. 'ﲀ' => 'كا',
  69224. '�' => 'كل',
  69225. 'ﲂ' => 'كم',
  69226. 'ﲃ' => 'كى',
  69227. 'ﲄ' => 'كي',
  69228. 'ﲅ' => 'لم',
  69229. 'ﲆ' => 'لى',
  69230. 'ﲇ' => 'لي',
  69231. 'ﲈ' => 'ما',
  69232. 'ﲉ' => 'مم',
  69233. 'ﲊ' => 'نر',
  69234. 'ﲋ' => 'نز',
  69235. 'ﲌ' => 'نم',
  69236. '�' => 'نن',
  69237. 'ﲎ' => 'نى',
  69238. '�' => 'ني',
  69239. '�' => 'ىٰ',
  69240. 'ﲑ' => 'ير',
  69241. 'ﲒ' => 'يز',
  69242. 'ﲓ' => 'يم',
  69243. 'ﲔ' => 'ين',
  69244. 'ﲕ' => 'يى',
  69245. 'ﲖ' => 'يي',
  69246. 'ﲗ' => 'ئج',
  69247. 'ﲘ' => 'ئح',
  69248. 'ﲙ' => 'ئخ',
  69249. 'ﲚ' => 'ئم',
  69250. 'ï²›' => 'ÙŠÙ”Ù‡',
  69251. 'ﲜ' => 'بج',
  69252. '�' => 'بح',
  69253. 'ﲞ' => 'بخ',
  69254. 'ﲟ' => 'بم',
  69255. 'ﲠ' => 'به',
  69256. 'ﲡ' => 'تج',
  69257. 'ﲢ' => 'تح',
  69258. 'ﲣ' => 'تخ',
  69259. 'ﲤ' => 'تم',
  69260. 'ﲥ' => 'ته',
  69261. 'ﲦ' => 'ثم',
  69262. 'ﲧ' => 'جح',
  69263. 'ﲨ' => 'جم',
  69264. 'ﲩ' => 'حج',
  69265. 'ﲪ' => 'حم',
  69266. 'ﲫ' => 'خج',
  69267. 'ﲬ' => 'خم',
  69268. 'ﲭ' => 'سج',
  69269. 'ﲮ' => 'سح',
  69270. 'ﲯ' => 'سخ',
  69271. 'ﲰ' => 'سم',
  69272. 'ﲱ' => 'صح',
  69273. 'ﲲ' => 'صخ',
  69274. 'ﲳ' => 'صم',
  69275. 'ﲴ' => 'ضج',
  69276. 'ﲵ' => 'ضح',
  69277. 'ﲶ' => 'ضخ',
  69278. 'ﲷ' => 'ضم',
  69279. 'ﲸ' => 'طح',
  69280. 'ﲹ' => 'ظم',
  69281. 'ﲺ' => 'عج',
  69282. 'ﲻ' => 'عم',
  69283. 'ﲼ' => 'غج',
  69284. 'ﲽ' => 'غم',
  69285. 'ﲾ' => '�ج',
  69286. 'ﲿ' => '�ح',
  69287. 'ﳀ' => '�خ',
  69288. '�' => '�م',
  69289. 'ﳂ' => 'قح',
  69290. 'ﳃ' => 'قم',
  69291. 'ﳄ' => 'كج',
  69292. 'ﳅ' => 'كح',
  69293. 'ﳆ' => 'كخ',
  69294. 'ﳇ' => 'كل',
  69295. 'ﳈ' => 'كم',
  69296. 'ﳉ' => 'لج',
  69297. 'ﳊ' => 'لح',
  69298. 'ﳋ' => 'لخ',
  69299. 'ﳌ' => 'لم',
  69300. '�' => 'له',
  69301. 'ﳎ' => 'مج',
  69302. '�' => 'مح',
  69303. '�' => 'مخ',
  69304. 'ﳑ' => 'مم',
  69305. 'ﳒ' => 'نج',
  69306. 'ﳓ' => 'نح',
  69307. 'ﳔ' => 'نخ',
  69308. 'ﳕ' => 'نم',
  69309. 'ﳖ' => 'نه',
  69310. 'ﳗ' => 'هج',
  69311. 'ﳘ' => 'هم',
  69312. 'ﳙ' => 'هٰ',
  69313. 'ﳚ' => 'يج',
  69314. 'ﳛ' => 'يح',
  69315. 'ﳜ' => 'يخ',
  69316. '�' => 'يم',
  69317. 'ﳞ' => 'يه',
  69318. 'ﳟ' => 'ئم',
  69319. 'ï³ ' => 'ÙŠÙ”Ù‡',
  69320. 'ﳡ' => 'بم',
  69321. 'ﳢ' => 'به',
  69322. 'ﳣ' => 'تم',
  69323. 'ﳤ' => 'ته',
  69324. 'ﳥ' => 'ثم',
  69325. 'ﳦ' => 'ثه',
  69326. 'ﳧ' => 'سم',
  69327. 'ﳨ' => 'سه',
  69328. 'ﳩ' => 'شم',
  69329. 'ﳪ' => 'شه',
  69330. 'ﳫ' => 'كل',
  69331. 'ﳬ' => 'كم',
  69332. 'ﳭ' => 'لم',
  69333. 'ﳮ' => 'نم',
  69334. 'ﳯ' => 'نه',
  69335. 'ﳰ' => 'يم',
  69336. 'ﳱ' => 'يه',
  69337. 'ï³²' => 'Ù€ÙŽÙ‘',
  69338. 'ﳳ' => 'ـ�ّ',
  69339. 'ﳴ' => 'ـ�ّ',
  69340. 'ﳵ' => 'طى',
  69341. 'ﳶ' => 'طي',
  69342. 'ﳷ' => 'عى',
  69343. 'ﳸ' => 'عي',
  69344. 'ﳹ' => 'غى',
  69345. 'ﳺ' => 'غي',
  69346. 'ﳻ' => 'سى',
  69347. 'ﳼ' => 'سي',
  69348. 'ﳽ' => 'شى',
  69349. 'ﳾ' => 'شي',
  69350. 'ﳿ' => 'حى',
  69351. 'ﴀ' => 'حي',
  69352. '�' => 'جى',
  69353. 'ﴂ' => 'جي',
  69354. 'ﴃ' => 'خى',
  69355. 'ﴄ' => 'خي',
  69356. 'ﴅ' => 'صى',
  69357. 'ﴆ' => 'صي',
  69358. 'ﴇ' => 'ضى',
  69359. 'ﴈ' => 'ضي',
  69360. 'ﴉ' => 'شج',
  69361. 'ﴊ' => 'شح',
  69362. 'ﴋ' => 'شخ',
  69363. 'ﴌ' => 'شم',
  69364. '�' => 'شر',
  69365. 'ﴎ' => 'سر',
  69366. '�' => 'صر',
  69367. '�' => 'ضر',
  69368. 'ﴑ' => 'طى',
  69369. 'ﴒ' => 'طي',
  69370. 'ﴓ' => 'عى',
  69371. 'ﴔ' => 'عي',
  69372. 'ﴕ' => 'غى',
  69373. 'ﴖ' => 'غي',
  69374. 'ﴗ' => 'سى',
  69375. 'ﴘ' => 'سي',
  69376. 'ﴙ' => 'شى',
  69377. 'ﴚ' => 'شي',
  69378. 'ﴛ' => 'حى',
  69379. 'ﴜ' => 'حي',
  69380. '�' => 'جى',
  69381. 'ﴞ' => 'جي',
  69382. 'ﴟ' => 'خى',
  69383. 'ﴠ' => 'خي',
  69384. 'ﴡ' => 'صى',
  69385. 'ﴢ' => 'صي',
  69386. 'ﴣ' => 'ضى',
  69387. 'ﴤ' => 'ضي',
  69388. 'ﴥ' => 'شج',
  69389. 'ﴦ' => 'شح',
  69390. 'ﴧ' => 'شخ',
  69391. 'ﴨ' => 'شم',
  69392. 'ﴩ' => 'شر',
  69393. 'ﴪ' => 'سر',
  69394. 'ﴫ' => 'صر',
  69395. 'ﴬ' => 'ضر',
  69396. 'ﴭ' => 'شج',
  69397. 'ﴮ' => 'شح',
  69398. 'ﴯ' => 'شخ',
  69399. 'ﴰ' => 'شم',
  69400. 'ﴱ' => 'سه',
  69401. 'ﴲ' => 'شه',
  69402. 'ﴳ' => 'طم',
  69403. 'ﴴ' => 'سج',
  69404. 'ﴵ' => 'سح',
  69405. 'ﴶ' => 'سخ',
  69406. 'ﴷ' => 'شج',
  69407. 'ﴸ' => 'شح',
  69408. 'ﴹ' => 'شخ',
  69409. 'ﴺ' => 'طم',
  69410. 'ﴻ' => 'ظم',
  69411. 'ﴼ' => 'اً',
  69412. 'ﴽ' => 'اً',
  69413. '�' => 'تجم',
  69414. 'ﵑ' => 'تحج',
  69415. 'ﵒ' => 'تحج',
  69416. 'ﵓ' => 'تحم',
  69417. 'ﵔ' => 'تخم',
  69418. 'ﵕ' => 'تمج',
  69419. 'ﵖ' => 'تمح',
  69420. 'ﵗ' => 'تمخ',
  69421. 'ﵘ' => 'جمح',
  69422. 'ﵙ' => 'جمح',
  69423. 'ﵚ' => 'حمي',
  69424. 'ﵛ' => 'حمى',
  69425. 'ﵜ' => 'سحج',
  69426. '�' => 'سجح',
  69427. 'ﵞ' => 'سجى',
  69428. 'ﵟ' => 'سمح',
  69429. 'ﵠ' => 'سمح',
  69430. 'ﵡ' => 'سمج',
  69431. 'ﵢ' => 'سمم',
  69432. 'ﵣ' => 'سمم',
  69433. 'ﵤ' => 'صحح',
  69434. 'ﵥ' => 'صحح',
  69435. 'ﵦ' => 'صمم',
  69436. 'ﵧ' => 'شحم',
  69437. 'ﵨ' => 'شحم',
  69438. 'ﵩ' => 'شجي',
  69439. 'ﵪ' => 'شمخ',
  69440. 'ﵫ' => 'شمخ',
  69441. 'ﵬ' => 'شمم',
  69442. 'ﵭ' => 'شمم',
  69443. 'ﵮ' => 'ضحى',
  69444. 'ﵯ' => 'ضخم',
  69445. 'ﵰ' => 'ضخم',
  69446. 'ﵱ' => 'طمح',
  69447. 'ﵲ' => 'طمح',
  69448. 'ﵳ' => 'طمم',
  69449. 'ﵴ' => 'طمي',
  69450. 'ﵵ' => 'عجم',
  69451. 'ﵶ' => 'عمم',
  69452. 'ﵷ' => 'عمم',
  69453. 'ﵸ' => 'عمى',
  69454. 'ﵹ' => 'غمم',
  69455. 'ﵺ' => 'غمي',
  69456. 'ﵻ' => 'غمى',
  69457. 'ﵼ' => '�خم',
  69458. 'ﵽ' => '�خم',
  69459. 'ﵾ' => 'قمح',
  69460. 'ﵿ' => 'قمم',
  69461. 'ﶀ' => 'لحم',
  69462. '�' => 'لحي',
  69463. 'ﶂ' => 'لحى',
  69464. 'ﶃ' => 'لجج',
  69465. 'ﶄ' => 'لجج',
  69466. 'ﶅ' => 'لخم',
  69467. 'ﶆ' => 'لخم',
  69468. 'ﶇ' => 'لمح',
  69469. 'ﶈ' => 'لمح',
  69470. 'ﶉ' => 'محج',
  69471. 'ﶊ' => 'محم',
  69472. 'ﶋ' => 'محي',
  69473. 'ﶌ' => 'مجح',
  69474. '�' => 'مجم',
  69475. 'ﶎ' => 'مخج',
  69476. '�' => 'مخم',
  69477. 'ﶒ' => 'مجخ',
  69478. 'ﶓ' => 'همج',
  69479. 'ﶔ' => 'همم',
  69480. 'ﶕ' => 'نحم',
  69481. 'ﶖ' => 'نحى',
  69482. 'ﶗ' => 'نجم',
  69483. 'ﶘ' => 'نجم',
  69484. 'ﶙ' => 'نجى',
  69485. 'ﶚ' => 'نمي',
  69486. 'ﶛ' => 'نمى',
  69487. 'ﶜ' => 'يمم',
  69488. '�' => 'يمم',
  69489. 'ﶞ' => 'بخي',
  69490. 'ﶟ' => 'تجي',
  69491. 'ﶠ' => 'تجى',
  69492. 'ﶡ' => 'تخي',
  69493. 'ﶢ' => 'تخى',
  69494. 'ﶣ' => 'تمي',
  69495. 'ﶤ' => 'تمى',
  69496. 'ﶥ' => 'جمي',
  69497. 'ﶦ' => 'جحى',
  69498. 'ﶧ' => 'جمى',
  69499. 'ﶨ' => 'سخى',
  69500. 'ﶩ' => 'صحي',
  69501. 'ﶪ' => 'شحي',
  69502. 'ﶫ' => 'ضحي',
  69503. 'ﶬ' => 'لجي',
  69504. 'ﶭ' => 'لمي',
  69505. 'ﶮ' => 'يحي',
  69506. 'ﶯ' => 'يجي',
  69507. 'ﶰ' => 'يمي',
  69508. 'ﶱ' => 'ممي',
  69509. 'ﶲ' => 'قمي',
  69510. 'ﶳ' => 'نحي',
  69511. 'ﶴ' => 'قمح',
  69512. 'ﶵ' => 'لحم',
  69513. 'ﶶ' => 'عمي',
  69514. 'ﶷ' => 'كمي',
  69515. 'ﶸ' => 'نجح',
  69516. 'ﶹ' => 'مخي',
  69517. 'ﶺ' => 'لجم',
  69518. 'ﶻ' => 'كمم',
  69519. 'ﶼ' => 'لجم',
  69520. 'ﶽ' => 'نجح',
  69521. 'ﶾ' => 'جحي',
  69522. 'ﶿ' => 'حجي',
  69523. 'ﷀ' => 'مجي',
  69524. '�' => '�مي',
  69525. 'ﷂ' => 'بحي',
  69526. 'ﷃ' => 'كمم',
  69527. 'ﷄ' => 'عجم',
  69528. 'ﷅ' => 'صمم',
  69529. 'ﷆ' => 'سخي',
  69530. 'ﷇ' => 'نجي',
  69531. 'ﷰ' => 'صلے',
  69532. 'ﷱ' => 'قلے',
  69533. 'ﷲ' => 'الله',
  69534. 'ﷳ' => 'اكبر',
  69535. 'ﷴ' => 'محمد',
  69536. 'ﷵ' => 'صلعم',
  69537. 'ﷶ' => 'رسول',
  69538. 'ﷷ' => 'عليه',
  69539. 'ﷸ' => 'وسلم',
  69540. 'ﷹ' => 'صلى',
  69541. 'ﷺ' => 'صلى الله عليه وسلم',
  69542. 'ﷻ' => 'جل جلاله',
  69543. '﷼' => 'ریال',
  69544. '�' => ',',
  69545. '︑' => '�',
  69546. '︒' => '。',
  69547. '︓' => ':',
  69548. '︔' => ';',
  69549. '︕' => '!',
  69550. '︖' => '?',
  69551. '︗' => '〖',
  69552. '︘' => '〗',
  69553. '︙' => '...',
  69554. '︰' => '..',
  69555. '︱' => '—',
  69556. '︲' => '–',
  69557. '︳' => '_',
  69558. '︴' => '_',
  69559. '︵' => '(',
  69560. '︶' => ')',
  69561. '︷' => '{',
  69562. '︸' => '}',
  69563. '︹' => '〔',
  69564. '︺' => '〕',
  69565. '︻' => '�',
  69566. '︼' => '】',
  69567. '︽' => '《',
  69568. '︾' => '》',
  69569. '︿' => '〈',
  69570. '﹀' => '〉',
  69571. '�' => '「',
  69572. '﹂' => '�',
  69573. '﹃' => '『',
  69574. '﹄' => '�',
  69575. '﹇' => '[',
  69576. '﹈' => ']',
  69577. '﹉' => ' ̅',
  69578. '﹊' => ' ̅',
  69579. '﹋' => ' ̅',
  69580. '﹌' => ' ̅',
  69581. '�' => '_',
  69582. '﹎' => '_',
  69583. '�' => '_',
  69584. '�' => ',',
  69585. '﹑' => '�',
  69586. 'ï¹’' => '.',
  69587. 'ï¹”' => ';',
  69588. '﹕' => ':',
  69589. 'ï¹–' => '?',
  69590. 'ï¹—' => '!',
  69591. '﹘' => '—',
  69592. 'ï¹™' => '(',
  69593. '﹚' => ')',
  69594. 'ï¹›' => '{',
  69595. '﹜' => '}',
  69596. '�' => '〔',
  69597. '﹞' => '〕',
  69598. '﹟' => '#',
  69599. 'ï¹ ' => '&',
  69600. '﹡' => '*',
  69601. 'ï¹¢' => '+',
  69602. 'ï¹£' => '-',
  69603. '﹤' => '<',
  69604. 'ï¹¥' => '>',
  69605. '﹦' => '=',
  69606. '﹨' => '\\',
  69607. '﹩' => '$',
  69608. '﹪' => '%',
  69609. '﹫' => '@',
  69610. 'ï¹°' => ' Ù‹',
  69611. 'ﹱ' => 'ـً',
  69612. 'ﹲ' => ' ٌ',
  69613. 'ï¹´' => ' Ù�',
  69614. 'ﹶ' => ' َ',
  69615. 'ï¹·' => 'Ù€ÙŽ',
  69616. 'ﹸ' => ' �',
  69617. 'ﹹ' => 'ـ�',
  69618. 'ﹺ' => ' �',
  69619. 'ﹻ' => 'ـ�',
  69620. 'ï¹¼' => ' Ù‘',
  69621. 'ﹽ' => 'ـّ',
  69622. 'ï¹¾' => ' Ù’',
  69623. 'ﹿ' => 'ـْ',
  69624. 'ﺀ' => 'ء',
  69625. '�' => 'آ',
  69626. 'ﺂ' => 'آ',
  69627. 'ﺃ' => 'أ',
  69628. 'ﺄ' => 'أ',
  69629. 'ﺅ' => 'ؤ',
  69630. 'ﺆ' => 'ؤ',
  69631. 'ﺇ' => 'إ',
  69632. 'ﺈ' => 'إ',
  69633. 'ﺉ' => 'ئ',
  69634. 'ﺊ' => 'ئ',
  69635. 'ﺋ' => 'ئ',
  69636. 'ﺌ' => 'ئ',
  69637. '�' => 'ا',
  69638. 'ﺎ' => 'ا',
  69639. '�' => 'ب',
  69640. '�' => 'ب',
  69641. 'ﺑ' => 'ب',
  69642. 'ﺒ' => 'ب',
  69643. 'ﺓ' => 'ة',
  69644. 'ﺔ' => 'ة',
  69645. 'ﺕ' => 'ت',
  69646. 'ﺖ' => 'ت',
  69647. 'ﺗ' => 'ت',
  69648. 'ﺘ' => 'ت',
  69649. 'ﺙ' => 'ث',
  69650. 'ﺚ' => 'ث',
  69651. 'ﺛ' => 'ث',
  69652. 'ﺜ' => 'ث',
  69653. '�' => 'ج',
  69654. 'ﺞ' => 'ج',
  69655. 'ﺟ' => 'ج',
  69656. 'ﺠ' => 'ج',
  69657. 'ﺡ' => 'ح',
  69658. 'ﺢ' => 'ح',
  69659. 'ﺣ' => 'ح',
  69660. 'ﺤ' => 'ح',
  69661. 'ﺥ' => 'خ',
  69662. 'ﺦ' => 'خ',
  69663. 'ﺧ' => 'خ',
  69664. 'ﺨ' => 'خ',
  69665. 'ﺩ' => 'د',
  69666. 'ﺪ' => 'د',
  69667. 'ﺫ' => 'ذ',
  69668. 'ﺬ' => 'ذ',
  69669. 'ﺭ' => 'ر',
  69670. 'ﺮ' => 'ر',
  69671. 'ﺯ' => 'ز',
  69672. 'ﺰ' => 'ز',
  69673. 'ﺱ' => 'س',
  69674. 'ﺲ' => 'س',
  69675. 'ﺳ' => 'س',
  69676. 'ﺴ' => 'س',
  69677. 'ﺵ' => 'ش',
  69678. 'ﺶ' => 'ش',
  69679. 'ﺷ' => 'ش',
  69680. 'ﺸ' => 'ش',
  69681. 'ﺹ' => 'ص',
  69682. 'ﺺ' => 'ص',
  69683. 'ﺻ' => 'ص',
  69684. 'ﺼ' => 'ص',
  69685. 'ﺽ' => 'ض',
  69686. 'ﺾ' => 'ض',
  69687. 'ﺿ' => 'ض',
  69688. 'ﻀ' => 'ض',
  69689. '�' => 'ط',
  69690. 'ﻂ' => 'ط',
  69691. 'ﻃ' => 'ط',
  69692. 'ﻄ' => 'ط',
  69693. 'ﻅ' => 'ظ',
  69694. 'ﻆ' => 'ظ',
  69695. 'ﻇ' => 'ظ',
  69696. 'ﻈ' => 'ظ',
  69697. 'ﻉ' => 'ع',
  69698. 'ﻊ' => 'ع',
  69699. 'ﻋ' => 'ع',
  69700. 'ﻌ' => 'ع',
  69701. '�' => 'غ',
  69702. 'ﻎ' => 'غ',
  69703. '�' => 'غ',
  69704. '�' => 'غ',
  69705. 'ﻑ' => '�',
  69706. 'ï»’' => 'Ù�',
  69707. 'ﻓ' => '�',
  69708. 'ï»”' => 'Ù�',
  69709. 'ﻕ' => 'ق',
  69710. 'ï»–' => 'Ù‚',
  69711. 'ï»—' => 'Ù‚',
  69712. 'ﻘ' => 'ق',
  69713. 'ï»™' => 'Ùƒ',
  69714. 'ﻚ' => 'ك',
  69715. 'ï»›' => 'Ùƒ',
  69716. 'ﻜ' => 'ك',
  69717. '�' => 'ل',
  69718. 'ﻞ' => 'ل',
  69719. 'ﻟ' => 'ل',
  69720. 'ï» ' => 'Ù„',
  69721. 'ﻡ' => 'م',
  69722. 'ﻢ' => 'م',
  69723. 'ﻣ' => 'م',
  69724. 'ﻤ' => 'م',
  69725. 'ﻥ' => 'ن',
  69726. 'ﻦ' => 'ن',
  69727. 'ﻧ' => 'ن',
  69728. 'ﻨ' => 'ن',
  69729. 'ﻩ' => 'ه',
  69730. 'ﻪ' => 'ه',
  69731. 'ﻫ' => 'ه',
  69732. 'ﻬ' => 'ه',
  69733. 'ï»­' => 'Ùˆ',
  69734. 'ï»®' => 'Ùˆ',
  69735. 'ﻯ' => 'ى',
  69736. 'ï»°' => 'Ù‰',
  69737. 'ï»±' => 'ÙŠ',
  69738. 'ﻲ' => 'ي',
  69739. 'ﻳ' => 'ي',
  69740. 'ï»´' => 'ÙŠ',
  69741. 'ﻵ' => 'لآ',
  69742. 'ﻶ' => 'لآ',
  69743. 'ﻷ' => 'لأ',
  69744. 'ﻸ' => 'لأ',
  69745. 'ﻹ' => 'لإ',
  69746. 'ﻺ' => 'لإ',
  69747. 'ﻻ' => 'لا',
  69748. 'ﻼ' => 'لا',
  69749. '�' => '!',
  69750. '"' => '"',
  69751. '#' => '#',
  69752. '$' => '$',
  69753. 'ï¼…' => '%',
  69754. '&' => '&',
  69755. ''' => '\'',
  69756. '(' => '(',
  69757. ')' => ')',
  69758. '*' => '*',
  69759. '+' => '+',
  69760. ',' => ',',
  69761. '�' => '-',
  69762. '.' => '.',
  69763. '�' => '/',
  69764. '�' => '0',
  69765. '1' => '1',
  69766. 'ï¼’' => '2',
  69767. '3' => '3',
  69768. 'ï¼”' => '4',
  69769. '5' => '5',
  69770. 'ï¼–' => '6',
  69771. 'ï¼—' => '7',
  69772. '8' => '8',
  69773. 'ï¼™' => '9',
  69774. ':' => ':',
  69775. 'ï¼›' => ';',
  69776. '<' => '<',
  69777. '�' => '=',
  69778. '>' => '>',
  69779. '?' => '?',
  69780. 'ï¼ ' => '@',
  69781. 'A' => 'A',
  69782. 'ï¼¢' => 'B',
  69783. 'ï¼£' => 'C',
  69784. 'D' => 'D',
  69785. 'ï¼¥' => 'E',
  69786. 'F' => 'F',
  69787. 'G' => 'G',
  69788. 'H' => 'H',
  69789. 'I' => 'I',
  69790. 'J' => 'J',
  69791. 'K' => 'K',
  69792. 'L' => 'L',
  69793. 'ï¼­' => 'M',
  69794. 'ï¼®' => 'N',
  69795. 'O' => 'O',
  69796. 'ï¼°' => 'P',
  69797. 'ï¼±' => 'Q',
  69798. 'ï¼²' => 'R',
  69799. 'ï¼³' => 'S',
  69800. 'ï¼´' => 'T',
  69801. 'ï¼µ' => 'U',
  69802. 'V' => 'V',
  69803. 'ï¼·' => 'W',
  69804. 'X' => 'X',
  69805. 'ï¼¹' => 'Y',
  69806. 'Z' => 'Z',
  69807. 'ï¼»' => '[',
  69808. 'ï¼¼' => '\\',
  69809. 'ï¼½' => ']',
  69810. 'ï¼¾' => '^',
  69811. '_' => '_',
  69812. 'ï½€' => '`',
  69813. '�' => 'a',
  69814. 'b' => 'b',
  69815. 'c' => 'c',
  69816. 'd' => 'd',
  69817. 'ï½…' => 'e',
  69818. 'f' => 'f',
  69819. 'g' => 'g',
  69820. 'h' => 'h',
  69821. 'i' => 'i',
  69822. 'j' => 'j',
  69823. 'k' => 'k',
  69824. 'l' => 'l',
  69825. '�' => 'm',
  69826. 'n' => 'n',
  69827. '�' => 'o',
  69828. '�' => 'p',
  69829. 'q' => 'q',
  69830. 'ï½’' => 'r',
  69831. 's' => 's',
  69832. 'ï½”' => 't',
  69833. 'u' => 'u',
  69834. 'ï½–' => 'v',
  69835. 'ï½—' => 'w',
  69836. 'x' => 'x',
  69837. 'ï½™' => 'y',
  69838. 'z' => 'z',
  69839. 'ï½›' => '{',
  69840. '|' => '|',
  69841. '�' => '}',
  69842. '~' => '~',
  69843. '⦅' => '⦅',
  69844. '⦆' => '⦆',
  69845. '。' => '。',
  69846. '「' => '「',
  69847. '」' => '�',
  69848. '、' => '�',
  69849. '・' => '・',
  69850. 'ヲ' => 'ヲ',
  69851. 'ァ' => 'ァ',
  69852. 'ィ' => 'ィ',
  69853. 'ゥ' => 'ゥ',
  69854. 'ェ' => 'ェ',
  69855. 'ォ' => 'ォ',
  69856. 'ャ' => 'ャ',
  69857. 'ュ' => 'ュ',
  69858. 'ョ' => 'ョ',
  69859. 'ッ' => 'ッ',
  69860. 'ー' => 'ー',
  69861. 'ï½±' => 'ã‚¢',
  69862. 'イ' => 'イ',
  69863. 'ウ' => 'ウ',
  69864. 'エ' => 'エ',
  69865. 'オ' => 'オ',
  69866. 'カ' => 'カ',
  69867. 'ï½·' => 'ã‚­',
  69868. 'ク' => 'ク',
  69869. 'ケ' => 'ケ',
  69870. 'コ' => 'コ',
  69871. 'サ' => 'サ',
  69872. 'ï½¼' => 'ã‚·',
  69873. 'ス' => 'ス',
  69874. 'ï½¾' => 'ã‚»',
  69875. 'ソ' => 'ソ',
  69876. 'ï¾€' => 'ã‚¿',
  69877. '�' => '�',
  69878. 'ツ' => 'ツ',
  69879. 'テ' => 'テ',
  69880. 'ト' => 'ト',
  69881. 'ナ' => 'ナ',
  69882. 'ニ' => 'ニ',
  69883. 'ヌ' => 'ヌ',
  69884. 'ネ' => '�',
  69885. 'ノ' => 'ノ',
  69886. 'ハ' => '�',
  69887. 'ヒ' => 'ヒ',
  69888. 'フ' => 'フ',
  69889. '�' => 'ヘ',
  69890. 'ホ' => 'ホ',
  69891. '�' => 'マ',
  69892. '�' => 'ミ',
  69893. 'ム' => 'ム',
  69894. 'メ' => 'メ',
  69895. 'モ' => 'モ',
  69896. 'ヤ' => 'ヤ',
  69897. 'ユ' => 'ユ',
  69898. 'ヨ' => 'ヨ',
  69899. 'ラ' => 'ラ',
  69900. 'リ' => 'リ',
  69901. 'ル' => 'ル',
  69902. 'レ' => 'レ',
  69903. 'ロ' => 'ロ',
  69904. 'ワ' => 'ワ',
  69905. '�' => 'ン',
  69906. '゙' => '゙',
  69907. '゚' => '゚',
  69908. 'ï¾ ' => 'á… ',
  69909. 'ᄀ' => 'ᄀ',
  69910. 'ᄁ' => '�',
  69911. 'ᆪ' => 'ᆪ',
  69912. 'ᄂ' => 'ᄂ',
  69913. 'ᆬ' => 'ᆬ',
  69914. 'ᆭ' => 'ᆭ',
  69915. 'ᄃ' => 'ᄃ',
  69916. 'ᄄ' => 'ᄄ',
  69917. 'ᄅ' => 'ᄅ',
  69918. 'ᆰ' => 'ᆰ',
  69919. 'ᆱ' => 'ᆱ',
  69920. 'ᆲ' => 'ᆲ',
  69921. 'ᆳ' => 'ᆳ',
  69922. 'ᆴ' => 'ᆴ',
  69923. 'ᆵ' => 'ᆵ',
  69924. 'ï¾°' => 'á„š',
  69925. 'ᄆ' => 'ᄆ',
  69926. 'ᄇ' => 'ᄇ',
  69927. 'ᄈ' => 'ᄈ',
  69928. 'ï¾´' => 'á„¡',
  69929. 'ᄉ' => 'ᄉ',
  69930. 'ᄊ' => 'ᄊ',
  69931. 'ï¾·' => 'á„‹',
  69932. 'ᄌ' => 'ᄌ',
  69933. 'ᄍ' => '�',
  69934. 'ᄎ' => 'ᄎ',
  69935. 'ᄏ' => '�',
  69936. 'ᄐ' => '�',
  69937. 'ï¾½' => 'á„‘',
  69938. 'ï¾¾' => 'á„’',
  69939. 'ï¿‚' => 'á…¡',
  69940. 'ᅢ' => 'ᅢ',
  69941. 'ï¿„' => 'á…£',
  69942. 'ï¿…' => 'á…¤',
  69943. 'ᅥ' => 'ᅥ',
  69944. 'ᅦ' => 'ᅦ',
  69945. 'ï¿Š' => 'á…§',
  69946. 'ï¿‹' => 'á…¨',
  69947. 'ᅩ' => 'ᅩ',
  69948. '�' => 'ᅪ',
  69949. 'ï¿Ž' => 'á…«',
  69950. '�' => 'ᅬ',
  69951. 'ï¿’' => 'á…­',
  69952. 'ï¿“' => 'á…®',
  69953. 'ï¿”' => 'á…¯',
  69954. 'ï¿•' => 'á…°',
  69955. 'ï¿–' => 'á…±',
  69956. 'ï¿—' => 'á…²',
  69957. 'ï¿š' => 'á…³',
  69958. 'ï¿›' => 'á…´',
  69959. 'ᅵ' => 'ᅵ',
  69960. '¢' => '¢',
  69961. '£' => '£',
  69962. '¬' => '¬',
  69963. 'ï¿£' => ' Ì„',
  69964. '¦' => '¦',
  69965. 'ï¿¥' => 'Â¥',
  69966. '₩' => '₩',
  69967. '│' => '│',
  69968. '←' => '�',
  69969. '↑' => '↑',
  69970. '→' => '→',
  69971. '↓' => '↓',
  69972. 'ï¿­' => 'â– ',
  69973. 'ï¿®' => 'â—‹',
  69974. '�' => 'A',
  69975. '�' => 'B',
  69976. '�' => 'C',
  69977. '�' => 'D',
  69978. '�' => 'E',
  69979. '�' => 'F',
  69980. '�' => 'G',
  69981. '�' => 'H',
  69982. '�' => 'I',
  69983. '�' => 'J',
  69984. '�' => 'K',
  69985. '�' => 'L',
  69986. '�' => 'M',
  69987. '�' => 'N',
  69988. '�' => 'O',
  69989. '�' => 'P',
  69990. '�' => 'Q',
  69991. '�' => 'R',
  69992. '�' => 'S',
  69993. '�' => 'T',
  69994. '�' => 'U',
  69995. '�' => 'V',
  69996. '�' => 'W',
  69997. '�' => 'X',
  69998. '�' => 'Y',
  69999. '�' => 'Z',
  70000. '�' => 'a',
  70001. '�' => 'b',
  70002. '�' => 'c',
  70003. '�' => 'd',
  70004. '�' => 'e',
  70005. '�' => 'f',
  70006. '�' => 'g',
  70007. '�' => 'h',
  70008. '�' => 'i',
  70009. '�' => 'j',
  70010. '�' => 'k',
  70011. '�' => 'l',
  70012. '�' => 'm',
  70013. '�' => 'n',
  70014. '�' => 'o',
  70015. '�' => 'p',
  70016. '�' => 'q',
  70017. '�' => 'r',
  70018. '�' => 's',
  70019. '�' => 't',
  70020. '�' => 'u',
  70021. '�' => 'v',
  70022. '�' => 'w',
  70023. '�' => 'x',
  70024. '�' => 'y',
  70025. '�' => 'z',
  70026. '�' => 'A',
  70027. '�' => 'B',
  70028. '�' => 'C',
  70029. '�' => 'D',
  70030. '�' => 'E',
  70031. '�' => 'F',
  70032. '�' => 'G',
  70033. '�' => 'H',
  70034. '�' => 'I',
  70035. '�' => 'J',
  70036. '�' => 'K',
  70037. '�' => 'L',
  70038. '�' => 'M',
  70039. '�' => 'N',
  70040. '�' => 'O',
  70041. '�' => 'P',
  70042. '�' => 'Q',
  70043. '�' => 'R',
  70044. '�' => 'S',
  70045. '�' => 'T',
  70046. '�' => 'U',
  70047. '�' => 'V',
  70048. '�' => 'W',
  70049. '�' => 'X',
  70050. '�' => 'Y',
  70051. '�' => 'Z',
  70052. '�' => 'a',
  70053. '�' => 'b',
  70054. '�' => 'c',
  70055. '�' => 'd',
  70056. '�' => 'e',
  70057. '�' => 'f',
  70058. '�' => 'g',
  70059. '�' => 'i',
  70060. '�' => 'j',
  70061. '�' => 'k',
  70062. '�' => 'l',
  70063. '�' => 'm',
  70064. '�' => 'n',
  70065. '�' => 'o',
  70066. '�' => 'p',
  70067. '�' => 'q',
  70068. '�' => 'r',
  70069. '�' => 's',
  70070. '�' => 't',
  70071. '�' => 'u',
  70072. '�' => 'v',
  70073. '�' => 'w',
  70074. '�' => 'x',
  70075. '�' => 'y',
  70076. '�' => 'z',
  70077. '�' => 'A',
  70078. '�' => 'B',
  70079. '�' => 'C',
  70080. '�' => 'D',
  70081. '�' => 'E',
  70082. '�' => 'F',
  70083. '�' => 'G',
  70084. '�' => 'H',
  70085. '�' => 'I',
  70086. '�' => 'J',
  70087. '�' => 'K',
  70088. '�' => 'L',
  70089. '�' => 'M',
  70090. '�' => 'N',
  70091. '�' => 'O',
  70092. '�' => 'P',
  70093. '�' => 'Q',
  70094. '�' => 'R',
  70095. '�' => 'S',
  70096. '�' => 'T',
  70097. '�' => 'U',
  70098. '�' => 'V',
  70099. '�' => 'W',
  70100. '�' => 'X',
  70101. '�' => 'Y',
  70102. '�' => 'Z',
  70103. '�' => 'a',
  70104. '�' => 'b',
  70105. '�' => 'c',
  70106. '�' => 'd',
  70107. '�' => 'e',
  70108. '�' => 'f',
  70109. '�' => 'g',
  70110. '�' => 'h',
  70111. '�' => 'i',
  70112. '�' => 'j',
  70113. '�' => 'k',
  70114. '�' => 'l',
  70115. '�' => 'm',
  70116. '�' => 'n',
  70117. '�' => 'o',
  70118. '�' => 'p',
  70119. '�' => 'q',
  70120. '�' => 'r',
  70121. '�' => 's',
  70122. '�' => 't',
  70123. '�' => 'u',
  70124. '�' => 'v',
  70125. '�' => 'w',
  70126. '�' => 'x',
  70127. '�' => 'y',
  70128. '�' => 'z',
  70129. '�' => 'A',
  70130. '�' => 'C',
  70131. '�' => 'D',
  70132. '�' => 'G',
  70133. '�' => 'J',
  70134. '�' => 'K',
  70135. '�' => 'N',
  70136. '�' => 'O',
  70137. '�' => 'P',
  70138. '�' => 'Q',
  70139. '�' => 'S',
  70140. '�' => 'T',
  70141. '�' => 'U',
  70142. '�' => 'V',
  70143. '�' => 'W',
  70144. '�' => 'X',
  70145. '�' => 'Y',
  70146. '�' => 'Z',
  70147. '�' => 'a',
  70148. '�' => 'b',
  70149. '�' => 'c',
  70150. '�' => 'd',
  70151. '�' => 'f',
  70152. '�' => 'h',
  70153. '�' => 'i',
  70154. '�' => 'j',
  70155. '�' => 'k',
  70156. '�' => 'l',
  70157. '�' => 'm',
  70158. '�' => 'n',
  70159. '�' => 'p',
  70160. '�' => 'q',
  70161. '�' => 'r',
  70162. '�' => 's',
  70163. '�' => 't',
  70164. '�' => 'u',
  70165. '�' => 'v',
  70166. '�' => 'w',
  70167. '�' => 'x',
  70168. '�' => 'y',
  70169. '�' => 'z',
  70170. '�' => 'A',
  70171. '�' => 'B',
  70172. '�' => 'C',
  70173. '�' => 'D',
  70174. '�' => 'E',
  70175. '�' => 'F',
  70176. '�' => 'G',
  70177. '�' => 'H',
  70178. '�' => 'I',
  70179. '�' => 'J',
  70180. '�' => 'K',
  70181. '�' => 'L',
  70182. '�' => 'M',
  70183. '�' => 'N',
  70184. '�' => 'O',
  70185. '�' => 'P',
  70186. '�' => 'Q',
  70187. '�' => 'R',
  70188. '�' => 'S',
  70189. '�' => 'T',
  70190. '�' => 'U',
  70191. '�' => 'V',
  70192. '�' => 'W',
  70193. '�' => 'X',
  70194. '�' => 'Y',
  70195. '�' => 'Z',
  70196. '�' => 'a',
  70197. '�' => 'b',
  70198. '�' => 'c',
  70199. '�' => 'd',
  70200. '�' => 'e',
  70201. '�' => 'f',
  70202. '�' => 'g',
  70203. '�' => 'h',
  70204. '�' => 'i',
  70205. '�' => 'j',
  70206. '�' => 'k',
  70207. '�' => 'l',
  70208. '�' => 'm',
  70209. '�' => 'n',
  70210. '�' => 'o',
  70211. '�' => 'p',
  70212. '�' => 'q',
  70213. '�' => 'r',
  70214. '�' => 's',
  70215. '�' => 't',
  70216. '�' => 'u',
  70217. '�' => 'v',
  70218. '�' => 'w',
  70219. '�' => 'x',
  70220. '�' => 'y',
  70221. '�' => 'z',
  70222. '�' => 'A',
  70223. '�' => 'B',
  70224. '�' => 'D',
  70225. '�' => 'E',
  70226. '�' => 'F',
  70227. '�' => 'G',
  70228. '�' => 'J',
  70229. '�' => 'K',
  70230. '�' => 'L',
  70231. '�' => 'M',
  70232. '�' => 'N',
  70233. '�' => 'O',
  70234. '�' => 'P',
  70235. '�' => 'Q',
  70236. '�' => 'S',
  70237. '�' => 'T',
  70238. '�' => 'U',
  70239. '�' => 'V',
  70240. '�' => 'W',
  70241. '�' => 'X',
  70242. '�' => 'Y',
  70243. '�' => 'a',
  70244. '�' => 'b',
  70245. '�' => 'c',
  70246. '�' => 'd',
  70247. '�' => 'e',
  70248. '�' => 'f',
  70249. '�' => 'g',
  70250. '�' => 'h',
  70251. '�' => 'i',
  70252. '�' => 'j',
  70253. '�' => 'k',
  70254. '�' => 'l',
  70255. '�' => 'm',
  70256. '�' => 'n',
  70257. '�' => 'o',
  70258. '�' => 'p',
  70259. '�' => 'q',
  70260. '�' => 'r',
  70261. '�' => 's',
  70262. '�' => 't',
  70263. '�' => 'u',
  70264. '�' => 'v',
  70265. '�' => 'w',
  70266. '�' => 'x',
  70267. '�' => 'y',
  70268. '�' => 'z',
  70269. '�' => 'A',
  70270. '�' => 'B',
  70271. '�' => 'D',
  70272. '�' => 'E',
  70273. '�' => 'F',
  70274. '�' => 'G',
  70275. '�' => 'I',
  70276. '�' => 'J',
  70277. '�' => 'K',
  70278. '�' => 'L',
  70279. '�' => 'M',
  70280. '�' => 'O',
  70281. '�' => 'S',
  70282. '�' => 'T',
  70283. '�' => 'U',
  70284. '�' => 'V',
  70285. '�' => 'W',
  70286. '�' => 'X',
  70287. '�' => 'Y',
  70288. '�' => 'a',
  70289. '�' => 'b',
  70290. '�' => 'c',
  70291. '�' => 'd',
  70292. '�' => 'e',
  70293. '�' => 'f',
  70294. '�' => 'g',
  70295. '�' => 'h',
  70296. '�' => 'i',
  70297. '�' => 'j',
  70298. '�' => 'k',
  70299. '�' => 'l',
  70300. '�' => 'm',
  70301. '�' => 'n',
  70302. '�' => 'o',
  70303. '�' => 'p',
  70304. '�' => 'q',
  70305. '�' => 'r',
  70306. '�' => 's',
  70307. '�' => 't',
  70308. '�' => 'u',
  70309. '�' => 'v',
  70310. '�' => 'w',
  70311. '�' => 'x',
  70312. '�' => 'y',
  70313. '�' => 'z',
  70314. '�' => 'A',
  70315. '�' => 'B',
  70316. '�' => 'C',
  70317. '�' => 'D',
  70318. '�' => 'E',
  70319. '�' => 'F',
  70320. '�' => 'G',
  70321. '�' => 'H',
  70322. '�' => 'I',
  70323. '�' => 'J',
  70324. '�' => 'K',
  70325. '�' => 'L',
  70326. '�' => 'M',
  70327. '�' => 'N',
  70328. '�' => 'O',
  70329. '�' => 'P',
  70330. '�' => 'Q',
  70331. '�' => 'R',
  70332. '�' => 'S',
  70333. '�' => 'T',
  70334. '�' => 'U',
  70335. '�' => 'V',
  70336. '�' => 'W',
  70337. '�' => 'X',
  70338. '�' => 'Y',
  70339. '�' => 'Z',
  70340. '�' => 'a',
  70341. '�' => 'b',
  70342. '�' => 'c',
  70343. '�' => 'd',
  70344. '�' => 'e',
  70345. '�' => 'f',
  70346. '�' => 'g',
  70347. '�' => 'h',
  70348. '�' => 'i',
  70349. '�' => 'j',
  70350. '�' => 'k',
  70351. '�' => 'l',
  70352. '�' => 'm',
  70353. '�' => 'n',
  70354. '�' => 'o',
  70355. '�' => 'p',
  70356. '�' => 'q',
  70357. '�' => 'r',
  70358. '�' => 's',
  70359. '�' => 't',
  70360. '�' => 'u',
  70361. '�' => 'v',
  70362. '�' => 'w',
  70363. '�' => 'x',
  70364. '�' => 'y',
  70365. '�' => 'z',
  70366. '�' => 'A',
  70367. '�' => 'B',
  70368. '�' => 'C',
  70369. '�' => 'D',
  70370. '�' => 'E',
  70371. '�' => 'F',
  70372. '�' => 'G',
  70373. '�' => 'H',
  70374. '�' => 'I',
  70375. '�' => 'J',
  70376. '�' => 'K',
  70377. '�' => 'L',
  70378. '�' => 'M',
  70379. '�' => 'N',
  70380. '�' => 'O',
  70381. '�' => 'P',
  70382. '�' => 'Q',
  70383. '�' => 'R',
  70384. '�' => 'S',
  70385. '�' => 'T',
  70386. '�' => 'U',
  70387. '�' => 'V',
  70388. '�' => 'W',
  70389. '�' => 'X',
  70390. '�' => 'Y',
  70391. '�' => 'Z',
  70392. '�' => 'a',
  70393. '�' => 'b',
  70394. '�' => 'c',
  70395. '�' => 'd',
  70396. '�' => 'e',
  70397. '�' => 'f',
  70398. '�' => 'g',
  70399. '�' => 'h',
  70400. '�' => 'i',
  70401. '�' => 'j',
  70402. '�' => 'k',
  70403. '�' => 'l',
  70404. '�' => 'm',
  70405. '�' => 'n',
  70406. '�' => 'o',
  70407. '�' => 'p',
  70408. '�' => 'q',
  70409. '�' => 'r',
  70410. '�' => 's',
  70411. '�' => 't',
  70412. '�' => 'u',
  70413. '�' => 'v',
  70414. '�' => 'w',
  70415. '�' => 'x',
  70416. '�' => 'y',
  70417. '�' => 'z',
  70418. '�' => 'A',
  70419. '�' => 'B',
  70420. '�' => 'C',
  70421. '�' => 'D',
  70422. '�' => 'E',
  70423. '�' => 'F',
  70424. '�' => 'G',
  70425. '�' => 'H',
  70426. '�' => 'I',
  70427. '�' => 'J',
  70428. '�' => 'K',
  70429. '�' => 'L',
  70430. '�' => 'M',
  70431. '�' => 'N',
  70432. '�' => 'O',
  70433. '�' => 'P',
  70434. '�' => 'Q',
  70435. '�' => 'R',
  70436. '�' => 'S',
  70437. '�' => 'T',
  70438. '�' => 'U',
  70439. '�' => 'V',
  70440. '�' => 'W',
  70441. '�' => 'X',
  70442. '�' => 'Y',
  70443. '�' => 'Z',
  70444. '�' => 'a',
  70445. '�' => 'b',
  70446. '�' => 'c',
  70447. '�' => 'd',
  70448. '�' => 'e',
  70449. '�' => 'f',
  70450. '�' => 'g',
  70451. '�' => 'h',
  70452. '�' => 'i',
  70453. '�' => 'j',
  70454. '�' => 'k',
  70455. '�' => 'l',
  70456. '�' => 'm',
  70457. '�' => 'n',
  70458. '�' => 'o',
  70459. '�' => 'p',
  70460. '�' => 'q',
  70461. '�' => 'r',
  70462. '�' => 's',
  70463. '�' => 't',
  70464. '�' => 'u',
  70465. '�' => 'v',
  70466. '�' => 'w',
  70467. '�' => 'x',
  70468. '�' => 'y',
  70469. '�' => 'z',
  70470. '�' => 'A',
  70471. '�' => 'B',
  70472. '�' => 'C',
  70473. '�' => 'D',
  70474. '�' => 'E',
  70475. '�' => 'F',
  70476. '�' => 'G',
  70477. '�' => 'H',
  70478. '�' => 'I',
  70479. '�' => 'J',
  70480. '�' => 'K',
  70481. '�' => 'L',
  70482. '�' => 'M',
  70483. '�' => 'N',
  70484. '�' => 'O',
  70485. '�' => 'P',
  70486. '�' => 'Q',
  70487. '�' => 'R',
  70488. '�' => 'S',
  70489. '�' => 'T',
  70490. '�' => 'U',
  70491. '�' => 'V',
  70492. '�' => 'W',
  70493. '�' => 'X',
  70494. '�' => 'Y',
  70495. '�' => 'Z',
  70496. '�' => 'a',
  70497. '�' => 'b',
  70498. '�' => 'c',
  70499. '�' => 'd',
  70500. '�' => 'e',
  70501. '�' => 'f',
  70502. '�' => 'g',
  70503. '�' => 'h',
  70504. '�' => 'i',
  70505. '�' => 'j',
  70506. '�' => 'k',
  70507. '�' => 'l',
  70508. '�' => 'm',
  70509. '�' => 'n',
  70510. '�' => 'o',
  70511. '�' => 'p',
  70512. '�' => 'q',
  70513. '�' => 'r',
  70514. '�' => 's',
  70515. '�' => 't',
  70516. '�' => 'u',
  70517. '�' => 'v',
  70518. '�' => 'w',
  70519. '�' => 'x',
  70520. '�' => 'y',
  70521. '�' => 'z',
  70522. '�' => 'A',
  70523. '�' => 'B',
  70524. '�' => 'C',
  70525. '�' => 'D',
  70526. '�' => 'E',
  70527. '�' => 'F',
  70528. '�' => 'G',
  70529. '�' => 'H',
  70530. '�' => 'I',
  70531. '�' => 'J',
  70532. '�' => 'K',
  70533. '�' => 'L',
  70534. '�' => 'M',
  70535. '�' => 'N',
  70536. '�' => 'O',
  70537. '�' => 'P',
  70538. '�' => 'Q',
  70539. '�' => 'R',
  70540. '�' => 'S',
  70541. '�' => 'T',
  70542. '�' => 'U',
  70543. '�' => 'V',
  70544. '�' => 'W',
  70545. '�' => 'X',
  70546. '�' => 'Y',
  70547. '�' => 'Z',
  70548. '�' => 'a',
  70549. '�' => 'b',
  70550. '�' => 'c',
  70551. '�' => 'd',
  70552. '�' => 'e',
  70553. '�' => 'f',
  70554. '�' => 'g',
  70555. '�' => 'h',
  70556. '�' => 'i',
  70557. '�' => 'j',
  70558. '�' => 'k',
  70559. '�' => 'l',
  70560. '�' => 'm',
  70561. '�' => 'n',
  70562. '�' => 'o',
  70563. '�' => 'p',
  70564. '�' => 'q',
  70565. '�' => 'r',
  70566. '�' => 's',
  70567. '�' => 't',
  70568. '�' => 'u',
  70569. '�' => 'v',
  70570. '�' => 'w',
  70571. '�' => 'x',
  70572. '�' => 'y',
  70573. '�' => 'z',
  70574. '�' => 'A',
  70575. '�' => 'B',
  70576. '�' => 'C',
  70577. '�' => 'D',
  70578. '�' => 'E',
  70579. '�' => 'F',
  70580. '�' => 'G',
  70581. '�' => 'H',
  70582. '�' => 'I',
  70583. '�' => 'J',
  70584. '�' => 'K',
  70585. '�' => 'L',
  70586. '�' => 'M',
  70587. '�' => 'N',
  70588. '�' => 'O',
  70589. '�' => 'P',
  70590. '�' => 'Q',
  70591. '�' => 'R',
  70592. '�' => 'S',
  70593. '�' => 'T',
  70594. '�' => 'U',
  70595. '�' => 'V',
  70596. '�' => 'W',
  70597. '�' => 'X',
  70598. '�' => 'Y',
  70599. '�' => 'Z',
  70600. '�' => 'a',
  70601. '�' => 'b',
  70602. '�' => 'c',
  70603. '�' => 'd',
  70604. '�' => 'e',
  70605. '�' => 'f',
  70606. '�' => 'g',
  70607. '�' => 'h',
  70608. '�' => 'i',
  70609. '�' => 'j',
  70610. '�' => 'k',
  70611. '�' => 'l',
  70612. '�' => 'm',
  70613. '�' => 'n',
  70614. '�' => 'o',
  70615. '�' => 'p',
  70616. '�' => 'q',
  70617. '�' => 'r',
  70618. '�' => 's',
  70619. '�' => 't',
  70620. '�' => 'u',
  70621. '�' => 'v',
  70622. '�' => 'w',
  70623. '�' => 'x',
  70624. '�' => 'y',
  70625. '�' => 'z',
  70626. '�' => 'ı',
  70627. '�' => 'ȷ',
  70628. '�' => 'Α',
  70629. '�' => 'Β',
  70630. '�' => 'Γ',
  70631. '�' => 'Δ',
  70632. '�' => 'Ε',
  70633. '�' => 'Ζ',
  70634. '�' => 'Η',
  70635. '�' => 'Θ',
  70636. '�' => 'Ι',
  70637. '�' => 'Κ',
  70638. '�' => 'Λ',
  70639. '�' => 'Μ',
  70640. '�' => '�',
  70641. '�' => 'Ξ',
  70642. '�' => 'Ο',
  70643. '�' => 'Π',
  70644. '�' => 'Ρ',
  70645. '�' => 'Θ',
  70646. '�' => 'Σ',
  70647. '�' => 'Τ',
  70648. '�' => 'Υ',
  70649. '�' => 'Φ',
  70650. '�' => 'Χ',
  70651. '�' => 'Ψ',
  70652. '�' => 'Ω',
  70653. '�' => '∇',
  70654. '�' => 'α',
  70655. '�' => 'β',
  70656. '�' => 'γ',
  70657. '�' => 'δ',
  70658. '�' => 'ε',
  70659. '�' => 'ζ',
  70660. '�' => 'η',
  70661. '�' => 'θ',
  70662. '�' => 'ι',
  70663. '�' => 'κ',
  70664. '�' => 'λ',
  70665. '�' => 'μ',
  70666. '�' => 'ν',
  70667. '�' => 'ξ',
  70668. '�' => 'ο',
  70669. '�' => 'π',
  70670. '�' => '�',
  70671. '�' => 'ς',
  70672. '�' => 'σ',
  70673. '�' => 'τ',
  70674. '�' => 'υ',
  70675. '�' => 'φ',
  70676. '�' => 'χ',
  70677. '�' => 'ψ',
  70678. '�' => 'ω',
  70679. '�' => '∂',
  70680. '�' => 'ε',
  70681. '�' => 'θ',
  70682. '�' => 'κ',
  70683. '�' => 'φ',
  70684. '�' => '�',
  70685. '�' => 'π',
  70686. '�' => 'Α',
  70687. '�' => 'Β',
  70688. '�' => 'Γ',
  70689. '�' => 'Δ',
  70690. '�' => 'Ε',
  70691. '�' => 'Ζ',
  70692. '�' => 'Η',
  70693. '�' => 'Θ',
  70694. '�' => 'Ι',
  70695. '�' => 'Κ',
  70696. '�' => 'Λ',
  70697. '�' => 'Μ',
  70698. '�' => '�',
  70699. '�' => 'Ξ',
  70700. '�' => 'Ο',
  70701. '�' => 'Π',
  70702. '�' => 'Ρ',
  70703. '�' => 'Θ',
  70704. '�' => 'Σ',
  70705. '�' => 'Τ',
  70706. '�' => 'Υ',
  70707. '�' => 'Φ',
  70708. '�' => 'Χ',
  70709. '�' => 'Ψ',
  70710. '�' => 'Ω',
  70711. '�' => '∇',
  70712. '�' => 'α',
  70713. '�' => 'β',
  70714. '�' => 'γ',
  70715. '�' => 'δ',
  70716. '�' => 'ε',
  70717. '�' => 'ζ',
  70718. '�' => 'η',
  70719. '�' => 'θ',
  70720. '�' => 'ι',
  70721. '�' => 'κ',
  70722. '�' => 'λ',
  70723. '�' => 'μ',
  70724. '�' => 'ν',
  70725. '�' => 'ξ',
  70726. '�' => 'ο',
  70727. '�' => 'π',
  70728. '�' => '�',
  70729. '�' => 'ς',
  70730. '�' => 'σ',
  70731. '�' => 'τ',
  70732. '�' => 'υ',
  70733. '�' => 'φ',
  70734. '�' => 'χ',
  70735. '�' => 'ψ',
  70736. '�' => 'ω',
  70737. '�' => '∂',
  70738. '�' => 'ε',
  70739. '�' => 'θ',
  70740. '�' => 'κ',
  70741. '�' => 'φ',
  70742. '�' => '�',
  70743. '�' => 'π',
  70744. '�' => 'Α',
  70745. '�' => 'Β',
  70746. '�' => 'Γ',
  70747. '�' => 'Δ',
  70748. '�' => 'Ε',
  70749. '�' => 'Ζ',
  70750. '�' => 'Η',
  70751. '�' => 'Θ',
  70752. '�' => 'Ι',
  70753. '�' => 'Κ',
  70754. '�' => 'Λ',
  70755. '�' => 'Μ',
  70756. '�' => '�',
  70757. '�' => 'Ξ',
  70758. '�' => 'Ο',
  70759. '�' => 'Π',
  70760. '�' => 'Ρ',
  70761. '�' => 'Θ',
  70762. '�' => 'Σ',
  70763. '�' => 'Τ',
  70764. '�' => 'Υ',
  70765. '�' => 'Φ',
  70766. '�' => 'Χ',
  70767. '�' => 'Ψ',
  70768. '�' => 'Ω',
  70769. '�' => '∇',
  70770. '�' => 'α',
  70771. '�' => 'β',
  70772. '�' => 'γ',
  70773. '�' => 'δ',
  70774. '�' => 'ε',
  70775. '�' => 'ζ',
  70776. '�' => 'η',
  70777. '�' => 'θ',
  70778. '�' => 'ι',
  70779. '�' => 'κ',
  70780. '�' => 'λ',
  70781. '�' => 'μ',
  70782. '�' => 'ν',
  70783. '�' => 'ξ',
  70784. '�' => 'ο',
  70785. '�' => 'π',
  70786. '�' => '�',
  70787. '�' => 'ς',
  70788. '�' => 'σ',
  70789. '�' => 'τ',
  70790. '�' => 'υ',
  70791. '�' => 'φ',
  70792. '�' => 'χ',
  70793. '�' => 'ψ',
  70794. '�' => 'ω',
  70795. '�' => '∂',
  70796. '�' => 'ε',
  70797. '�' => 'θ',
  70798. '�' => 'κ',
  70799. '�' => 'φ',
  70800. '�' => '�',
  70801. '�' => 'π',
  70802. '�' => 'Α',
  70803. '�' => 'Β',
  70804. '�' => 'Γ',
  70805. '�' => 'Δ',
  70806. '�' => 'Ε',
  70807. '�' => 'Ζ',
  70808. '�' => 'Η',
  70809. '�' => 'Θ',
  70810. '�' => 'Ι',
  70811. '�' => 'Κ',
  70812. '�' => 'Λ',
  70813. '�' => 'Μ',
  70814. '�' => '�',
  70815. '�' => 'Ξ',
  70816. '�' => 'Ο',
  70817. '�' => 'Π',
  70818. '�' => 'Ρ',
  70819. '�' => 'Θ',
  70820. '�' => 'Σ',
  70821. '�' => 'Τ',
  70822. '�' => 'Υ',
  70823. '�' => 'Φ',
  70824. '�' => 'Χ',
  70825. '�' => 'Ψ',
  70826. '�' => 'Ω',
  70827. '�' => '∇',
  70828. '�' => 'α',
  70829. '�' => 'β',
  70830. '�' => 'γ',
  70831. '�' => 'δ',
  70832. '�' => 'ε',
  70833. '�' => 'ζ',
  70834. '�' => 'η',
  70835. '�' => 'θ',
  70836. '�' => 'ι',
  70837. '�' => 'κ',
  70838. '�' => 'λ',
  70839. '�' => 'μ',
  70840. '�' => 'ν',
  70841. '�' => 'ξ',
  70842. '�' => 'ο',
  70843. '�' => 'π',
  70844. '�' => '�',
  70845. '�' => 'ς',
  70846. '�' => 'σ',
  70847. '�' => 'τ',
  70848. '�' => 'υ',
  70849. '�' => 'φ',
  70850. '�' => 'χ',
  70851. '�' => 'ψ',
  70852. '�' => 'ω',
  70853. '�' => '∂',
  70854. '�' => 'ε',
  70855. '�' => 'θ',
  70856. '�' => 'κ',
  70857. '�' => 'φ',
  70858. '�' => '�',
  70859. '�' => 'π',
  70860. '�' => 'Α',
  70861. '�' => 'Β',
  70862. '�' => 'Γ',
  70863. '�' => 'Δ',
  70864. '�' => 'Ε',
  70865. '�' => 'Ζ',
  70866. '�' => 'Η',
  70867. '�' => 'Θ',
  70868. '�' => 'Ι',
  70869. '�' => 'Κ',
  70870. '�' => 'Λ',
  70871. '�' => 'Μ',
  70872. '�' => '�',
  70873. '�' => 'Ξ',
  70874. '�' => 'Ο',
  70875. '�' => 'Π',
  70876. '�' => 'Ρ',
  70877. '�' => 'Θ',
  70878. '�' => 'Σ',
  70879. '�' => 'Τ',
  70880. '�' => 'Υ',
  70881. '�' => 'Φ',
  70882. '�' => 'Χ',
  70883. '�' => 'Ψ',
  70884. '�' => 'Ω',
  70885. '�' => '∇',
  70886. '�' => 'α',
  70887. '�' => 'β',
  70888. '�' => 'γ',
  70889. '�' => 'δ',
  70890. '�' => 'ε',
  70891. '�' => 'ζ',
  70892. '�' => 'η',
  70893. '�' => 'θ',
  70894. '�' => 'ι',
  70895. '�' => 'κ',
  70896. '�' => 'λ',
  70897. '�' => 'μ',
  70898. '�' => 'ν',
  70899. '�' => 'ξ',
  70900. '�' => 'ο',
  70901. '�' => 'π',
  70902. '�' => '�',
  70903. '�' => 'ς',
  70904. '�' => 'σ',
  70905. '�' => 'τ',
  70906. '�' => 'υ',
  70907. '�' => 'φ',
  70908. '�' => 'χ',
  70909. '�' => 'ψ',
  70910. '�' => 'ω',
  70911. '�' => '∂',
  70912. '�' => 'ε',
  70913. '�' => 'θ',
  70914. '�' => 'κ',
  70915. '�' => 'φ',
  70916. '�' => '�',
  70917. '�' => 'π',
  70918. '�' => 'Ϝ',
  70919. '�' => '�',
  70920. '�' => '0',
  70921. '�' => '1',
  70922. '�' => '2',
  70923. '�' => '3',
  70924. '�' => '4',
  70925. '�' => '5',
  70926. '�' => '6',
  70927. '�' => '7',
  70928. '�' => '8',
  70929. '�' => '9',
  70930. '�' => '0',
  70931. '�' => '1',
  70932. '�' => '2',
  70933. '�' => '3',
  70934. '�' => '4',
  70935. '�' => '5',
  70936. '�' => '6',
  70937. '�' => '7',
  70938. '�' => '8',
  70939. '�' => '9',
  70940. '�' => '0',
  70941. '�' => '1',
  70942. '�' => '2',
  70943. '�' => '3',
  70944. '�' => '4',
  70945. '�' => '5',
  70946. '�' => '6',
  70947. '�' => '7',
  70948. '�' => '8',
  70949. '�' => '9',
  70950. '�' => '0',
  70951. '�' => '1',
  70952. '�' => '2',
  70953. '�' => '3',
  70954. '�' => '4',
  70955. '�' => '5',
  70956. '�' => '6',
  70957. '�' => '7',
  70958. '�' => '8',
  70959. '�' => '9',
  70960. '�' => '0',
  70961. '�' => '1',
  70962. '�' => '2',
  70963. '�' => '3',
  70964. '�' => '4',
  70965. '�' => '5',
  70966. '�' => '6',
  70967. '�' => '7',
  70968. '�' => '8',
  70969. '�' => '9',
  70970. '𞸀' => 'ا',
  70971. '�' => 'ب',
  70972. '𞸂' => 'ج',
  70973. '𞸃' => 'د',
  70974. '𞸅' => 'و',
  70975. '𞸆' => 'ز',
  70976. '𞸇' => 'ح',
  70977. '𞸈' => 'ط',
  70978. '𞸉' => 'ي',
  70979. '𞸊' => 'ك',
  70980. '𞸋' => 'ل',
  70981. '𞸌' => 'م',
  70982. '�' => 'ن',
  70983. '𞸎' => 'س',
  70984. '�' => 'ع',
  70985. '�' => '�',
  70986. '𞸑' => 'ص',
  70987. '𞸒' => 'ق',
  70988. '𞸓' => 'ر',
  70989. '𞸔' => 'ش',
  70990. '𞸕' => 'ت',
  70991. '𞸖' => 'ث',
  70992. '𞸗' => 'خ',
  70993. '𞸘' => 'ذ',
  70994. '𞸙' => 'ض',
  70995. '𞸚' => 'ظ',
  70996. '𞸛' => 'غ',
  70997. '𞸜' => 'ٮ',
  70998. '�' => 'ں',
  70999. '𞸞' => 'ڡ',
  71000. '𞸟' => 'ٯ',
  71001. '𞸡' => 'ب',
  71002. '𞸢' => 'ج',
  71003. '𞸤' => 'ه',
  71004. '𞸧' => 'ح',
  71005. '𞸩' => 'ي',
  71006. '𞸪' => 'ك',
  71007. '𞸫' => 'ل',
  71008. '𞸬' => 'م',
  71009. '𞸭' => 'ن',
  71010. '𞸮' => 'س',
  71011. '𞸯' => 'ع',
  71012. '𞸰' => '�',
  71013. '𞸱' => 'ص',
  71014. '𞸲' => 'ق',
  71015. '𞸴' => 'ش',
  71016. '𞸵' => 'ت',
  71017. '𞸶' => 'ث',
  71018. '𞸷' => 'خ',
  71019. '𞸹' => 'ض',
  71020. '𞸻' => 'غ',
  71021. '𞹂' => 'ج',
  71022. '𞹇' => 'ح',
  71023. '𞹉' => 'ي',
  71024. '𞹋' => 'ل',
  71025. '�' => 'ن',
  71026. '𞹎' => 'س',
  71027. '�' => 'ع',
  71028. '𞹑' => 'ص',
  71029. 'ðž¹’' => 'Ù‚',
  71030. 'ðž¹”' => 'Ø´',
  71031. 'ðž¹—' => 'Ø®',
  71032. '𞹙' => 'ض',
  71033. '𞹛' => 'غ',
  71034. '�' => 'ں',
  71035. '𞹟' => 'ٯ',
  71036. '𞹡' => 'ب',
  71037. '𞹢' => 'ج',
  71038. '𞹤' => 'ه',
  71039. '𞹧' => 'ح',
  71040. '𞹨' => 'ط',
  71041. '𞹩' => 'ي',
  71042. '𞹪' => 'ك',
  71043. '𞹬' => 'م',
  71044. 'ðž¹­' => 'Ù†',
  71045. '𞹮' => 'س',
  71046. '𞹯' => 'ع',
  71047. 'ðž¹°' => 'Ù�',
  71048. '𞹱' => 'ص',
  71049. 'ðž¹²' => 'Ù‚',
  71050. 'ðž¹´' => 'Ø´',
  71051. '𞹵' => 'ت',
  71052. '𞹶' => 'ث',
  71053. 'ðž¹·' => 'Ø®',
  71054. '𞹹' => 'ض',
  71055. '𞹺' => 'ظ',
  71056. '𞹻' => 'غ',
  71057. 'ðž¹¼' => 'Ù®',
  71058. 'ðž¹¾' => 'Ú¡',
  71059. '𞺀' => 'ا',
  71060. '�' => 'ب',
  71061. '𞺂' => 'ج',
  71062. '𞺃' => 'د',
  71063. '𞺄' => 'ه',
  71064. '𞺅' => 'و',
  71065. '𞺆' => 'ز',
  71066. '𞺇' => 'ح',
  71067. '𞺈' => 'ط',
  71068. '𞺉' => 'ي',
  71069. '𞺋' => 'ل',
  71070. '𞺌' => 'م',
  71071. '�' => 'ن',
  71072. '𞺎' => 'س',
  71073. '�' => 'ع',
  71074. '�' => '�',
  71075. '𞺑' => 'ص',
  71076. '𞺒' => 'ق',
  71077. '𞺓' => 'ر',
  71078. '𞺔' => 'ش',
  71079. '𞺕' => 'ت',
  71080. '𞺖' => 'ث',
  71081. '𞺗' => 'خ',
  71082. '𞺘' => 'ذ',
  71083. '𞺙' => 'ض',
  71084. '𞺚' => 'ظ',
  71085. '𞺛' => 'غ',
  71086. '𞺡' => 'ب',
  71087. '𞺢' => 'ج',
  71088. '𞺣' => 'د',
  71089. '𞺥' => 'و',
  71090. '𞺦' => 'ز',
  71091. '𞺧' => 'ح',
  71092. '𞺨' => 'ط',
  71093. '𞺩' => 'ي',
  71094. '𞺫' => 'ل',
  71095. '𞺬' => 'م',
  71096. '𞺭' => 'ن',
  71097. '𞺮' => 'س',
  71098. '𞺯' => 'ع',
  71099. '𞺰' => '�',
  71100. '𞺱' => 'ص',
  71101. '𞺲' => 'ق',
  71102. '𞺳' => 'ر',
  71103. '𞺴' => 'ش',
  71104. '𞺵' => 'ت',
  71105. '𞺶' => 'ث',
  71106. '𞺷' => 'خ',
  71107. '𞺸' => 'ذ',
  71108. '𞺹' => 'ض',
  71109. '𞺺' => 'ظ',
  71110. '𞺻' => 'غ',
  71111. '🄀' => '0.',
  71112. '�' => '0,',
  71113. '🄂' => '1,',
  71114. '🄃' => '2,',
  71115. '🄄' => '3,',
  71116. '🄅' => '4,',
  71117. '🄆' => '5,',
  71118. '🄇' => '6,',
  71119. '🄈' => '7,',
  71120. '🄉' => '8,',
  71121. '🄊' => '9,',
  71122. '�' => '(A)',
  71123. '🄑' => '(B)',
  71124. '🄒' => '(C)',
  71125. '🄓' => '(D)',
  71126. '🄔' => '(E)',
  71127. '🄕' => '(F)',
  71128. '🄖' => '(G)',
  71129. '🄗' => '(H)',
  71130. '🄘' => '(I)',
  71131. '🄙' => '(J)',
  71132. '🄚' => '(K)',
  71133. '🄛' => '(L)',
  71134. '🄜' => '(M)',
  71135. '�' => '(N)',
  71136. '🄞' => '(O)',
  71137. '🄟' => '(P)',
  71138. '🄠' => '(Q)',
  71139. '🄡' => '(R)',
  71140. '🄢' => '(S)',
  71141. '🄣' => '(T)',
  71142. '🄤' => '(U)',
  71143. '🄥' => '(V)',
  71144. '🄦' => '(W)',
  71145. '🄧' => '(X)',
  71146. '🄨' => '(Y)',
  71147. '🄩' => '(Z)',
  71148. '🄪' => '〔S〕',
  71149. '🄫' => 'C',
  71150. '🄬' => 'R',
  71151. '🄭' => 'CD',
  71152. '🄮' => 'WZ',
  71153. '🄰' => 'A',
  71154. '🄱' => 'B',
  71155. '🄲' => 'C',
  71156. '🄳' => 'D',
  71157. '🄴' => 'E',
  71158. '🄵' => 'F',
  71159. '🄶' => 'G',
  71160. '🄷' => 'H',
  71161. '🄸' => 'I',
  71162. '🄹' => 'J',
  71163. '🄺' => 'K',
  71164. '🄻' => 'L',
  71165. '🄼' => 'M',
  71166. '🄽' => 'N',
  71167. '🄾' => 'O',
  71168. '🄿' => 'P',
  71169. '🅀' => 'Q',
  71170. '�' => 'R',
  71171. '🅂' => 'S',
  71172. '🅃' => 'T',
  71173. '🅄' => 'U',
  71174. '🅅' => 'V',
  71175. '🅆' => 'W',
  71176. '🅇' => 'X',
  71177. '🅈' => 'Y',
  71178. '🅉' => 'Z',
  71179. '🅊' => 'HV',
  71180. '🅋' => 'MV',
  71181. '🅌' => 'SD',
  71182. '�' => 'SS',
  71183. '🅎' => 'PPV',
  71184. '�' => 'WC',
  71185. '🅪' => 'MC',
  71186. '🅫' => 'MD',
  71187. '🅬' => 'MR',
  71188. '�' => 'DJ',
  71189. '🈀' => '��',
  71190. '�' => 'ココ',
  71191. '🈂' => 'サ',
  71192. '�' => '手',
  71193. '🈑' => '字',
  71194. '🈒' => '�',
  71195. '🈓' => 'デ',
  71196. '🈔' => '二',
  71197. '🈕' => '多',
  71198. '🈖' => '解',
  71199. '🈗' => '天',
  71200. '🈘' => '交',
  71201. '🈙' => '映',
  71202. '🈚' => '無',
  71203. '🈛' => '料',
  71204. '🈜' => '�',
  71205. '�' => '後',
  71206. '🈞' => '�',
  71207. '🈟' => '新',
  71208. '🈠' => '�',
  71209. '🈡' => '終',
  71210. '🈢' => '生',
  71211. '🈣' => '販',
  71212. '🈤' => '声',
  71213. '🈥' => '�',
  71214. '🈦' => '演',
  71215. '🈧' => '投',
  71216. '🈨' => '�',
  71217. '🈩' => '一',
  71218. '🈪' => '三',
  71219. '🈫' => '�',
  71220. '🈬' => '左',
  71221. '🈭' => '中',
  71222. '🈮' => '�',
  71223. '🈯' => '指',
  71224. '🈰' => '走',
  71225. '🈱' => '打',
  71226. '🈲' => '�',
  71227. '🈳' => '空',
  71228. '🈴' => '�',
  71229. '🈵' => '満',
  71230. '🈶' => '有',
  71231. '🈷' => '月',
  71232. '🈸' => '申',
  71233. '🈹' => '割',
  71234. '🈺' => '営',
  71235. '🈻' => '�',
  71236. '🉀' => '〔本〕',
  71237. '�' => '〔三〕',
  71238. '🉂' => '〔二〕',
  71239. '🉃' => '〔安〕',
  71240. '🉄' => '〔点〕',
  71241. '🉅' => '〔打〕',
  71242. '🉆' => '〔盗〕',
  71243. '🉇' => '〔�〕',
  71244. '🉈' => '〔敗〕',
  71245. '�' => '得',
  71246. '🉑' => '�',
  71247. '🯰' => '0',
  71248. '🯱' => '1',
  71249. '🯲' => '2',
  71250. '🯳' => '3',
  71251. '🯴' => '4',
  71252. '🯵' => '5',
  71253. '🯶' => '6',
  71254. '🯷' => '7',
  71255. '🯸' => '8',
  71256. '🯹' => '9',
  71257. );
  71258. <?php
  71259. use Symfony\Polyfill\Intl\Normalizer as p;
  71260. if (\PHP_VERSION_ID >= 80000) {
  71261. return require __DIR__.'/bootstrap80.php';
  71262. }
  71263. if (!function_exists('normalizer_is_normalized')) {
  71264. function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); }
  71265. }
  71266. if (!function_exists('normalizer_normalize')) {
  71267. function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); }
  71268. }
  71269. <?php
  71270. use Symfony\Polyfill\Intl\Normalizer as p;
  71271. if (!function_exists('normalizer_is_normalized')) {
  71272. function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); }
  71273. }
  71274. if (!function_exists('normalizer_normalize')) {
  71275. function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); }
  71276. }
  71277. Copyright (c) 2015-2019 Fabien Potencier
  71278. Permission is hereby granted, free of charge, to any person obtaining a copy
  71279. of this software and associated documentation files (the "Software"), to deal
  71280. in the Software without restriction, including without limitation the rights
  71281. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  71282. copies of the Software, and to permit persons to whom the Software is furnished
  71283. to do so, subject to the following conditions:
  71284. The above copyright notice and this permission notice shall be included in all
  71285. copies or substantial portions of the Software.
  71286. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  71287. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  71288. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  71289. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  71290. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  71291. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  71292. THE SOFTWARE.
  71293. <?php
  71294. namespace Symfony\Polyfill\Mbstring;
  71295. final class Mbstring
  71296. {
  71297. public const MB_CASE_FOLD = \PHP_INT_MAX;
  71298. private const CASE_FOLD = [
  71299. ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
  71300. ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
  71301. ];
  71302. private static $encodingList = ['ASCII', 'UTF-8'];
  71303. private static $language = 'neutral';
  71304. private static $internalEncoding = 'UTF-8';
  71305. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  71306. {
  71307. if (\is_array($fromEncoding) || ($fromEncoding !== null && false !== strpos($fromEncoding, ','))) {
  71308. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  71309. } else {
  71310. $fromEncoding = self::getEncoding($fromEncoding);
  71311. }
  71312. $toEncoding = self::getEncoding($toEncoding);
  71313. if ('BASE64' === $fromEncoding) {
  71314. $s = base64_decode($s);
  71315. $fromEncoding = $toEncoding;
  71316. }
  71317. if ('BASE64' === $toEncoding) {
  71318. return base64_encode($s);
  71319. }
  71320. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  71321. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  71322. $fromEncoding = 'Windows-1252';
  71323. }
  71324. if ('UTF-8' !== $fromEncoding) {
  71325. $s = \iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  71326. }
  71327. return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
  71328. }
  71329. if ('HTML-ENTITIES' === $fromEncoding) {
  71330. $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8');
  71331. $fromEncoding = 'UTF-8';
  71332. }
  71333. return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  71334. }
  71335. public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
  71336. {
  71337. $ok = true;
  71338. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  71339. if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  71340. $ok = false;
  71341. }
  71342. });
  71343. return $ok ? $fromEncoding : false;
  71344. }
  71345. public static function mb_decode_mimeheader($s)
  71346. {
  71347. return \iconv_mime_decode($s, 2, self::$internalEncoding);
  71348. }
  71349. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  71350. {
  71351. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
  71352. }
  71353. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  71354. {
  71355. if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
  71356. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  71357. return null;
  71358. }
  71359. if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
  71360. return false;
  71361. }
  71362. if (null !== $encoding && !is_scalar($encoding)) {
  71363. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  71364. return '';
  71365. }
  71366. $s = (string) $s;
  71367. if ('' === $s) {
  71368. return '';
  71369. }
  71370. $encoding = self::getEncoding($encoding);
  71371. if ('UTF-8' === $encoding) {
  71372. $encoding = null;
  71373. if (!preg_match('//u', $s)) {
  71374. $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
  71375. }
  71376. } else {
  71377. $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
  71378. }
  71379. $cnt = floor(\count($convmap) / 4) * 4;
  71380. for ($i = 0; $i < $cnt; $i += 4) {
  71381. $convmap[$i] += $convmap[$i + 2];
  71382. $convmap[$i + 1] += $convmap[$i + 2];
  71383. }
  71384. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  71385. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  71386. for ($i = 0; $i < $cnt; $i += 4) {
  71387. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  71388. return self::mb_chr($c - $convmap[$i + 2]);
  71389. }
  71390. }
  71391. return $m[0];
  71392. }, $s);
  71393. if (null === $encoding) {
  71394. return $s;
  71395. }
  71396. return \iconv('UTF-8', $encoding.'//IGNORE', $s);
  71397. }
  71398. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  71399. {
  71400. if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
  71401. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  71402. return null;
  71403. }
  71404. if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
  71405. return false;
  71406. }
  71407. if (null !== $encoding && !is_scalar($encoding)) {
  71408. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  71409. return null;
  71410. }
  71411. if (null !== $is_hex && !is_scalar($is_hex)) {
  71412. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
  71413. return null;
  71414. }
  71415. $s = (string) $s;
  71416. if ('' === $s) {
  71417. return '';
  71418. }
  71419. $encoding = self::getEncoding($encoding);
  71420. if ('UTF-8' === $encoding) {
  71421. $encoding = null;
  71422. if (!preg_match('//u', $s)) {
  71423. $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
  71424. }
  71425. } else {
  71426. $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
  71427. }
  71428. static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  71429. $cnt = floor(\count($convmap) / 4) * 4;
  71430. $i = 0;
  71431. $len = \strlen($s);
  71432. $result = '';
  71433. while ($i < $len) {
  71434. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  71435. $uchr = substr($s, $i, $ulen);
  71436. $i += $ulen;
  71437. $c = self::mb_ord($uchr);
  71438. for ($j = 0; $j < $cnt; $j += 4) {
  71439. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  71440. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  71441. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  71442. continue 2;
  71443. }
  71444. }
  71445. $result .= $uchr;
  71446. }
  71447. if (null === $encoding) {
  71448. return $result;
  71449. }
  71450. return \iconv('UTF-8', $encoding.'//IGNORE', $result);
  71451. }
  71452. public static function mb_convert_case($s, $mode, $encoding = null)
  71453. {
  71454. $s = (string) $s;
  71455. if ('' === $s) {
  71456. return '';
  71457. }
  71458. $encoding = self::getEncoding($encoding);
  71459. if ('UTF-8' === $encoding) {
  71460. $encoding = null;
  71461. if (!preg_match('//u', $s)) {
  71462. $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
  71463. }
  71464. } else {
  71465. $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
  71466. }
  71467. if (\MB_CASE_TITLE == $mode) {
  71468. static $titleRegexp = null;
  71469. if (null === $titleRegexp) {
  71470. $titleRegexp = self::getData('titleCaseRegexp');
  71471. }
  71472. $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s);
  71473. } else {
  71474. if (\MB_CASE_UPPER == $mode) {
  71475. static $upper = null;
  71476. if (null === $upper) {
  71477. $upper = self::getData('upperCase');
  71478. }
  71479. $map = $upper;
  71480. } else {
  71481. if (self::MB_CASE_FOLD === $mode) {
  71482. $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
  71483. }
  71484. static $lower = null;
  71485. if (null === $lower) {
  71486. $lower = self::getData('lowerCase');
  71487. }
  71488. $map = $lower;
  71489. }
  71490. static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  71491. $i = 0;
  71492. $len = \strlen($s);
  71493. while ($i < $len) {
  71494. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  71495. $uchr = substr($s, $i, $ulen);
  71496. $i += $ulen;
  71497. if (isset($map[$uchr])) {
  71498. $uchr = $map[$uchr];
  71499. $nlen = \strlen($uchr);
  71500. if ($nlen == $ulen) {
  71501. $nlen = $i;
  71502. do {
  71503. $s[--$nlen] = $uchr[--$ulen];
  71504. } while ($ulen);
  71505. } else {
  71506. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  71507. $len += $nlen - $ulen;
  71508. $i += $nlen - $ulen;
  71509. }
  71510. }
  71511. }
  71512. }
  71513. if (null === $encoding) {
  71514. return $s;
  71515. }
  71516. return \iconv('UTF-8', $encoding.'//IGNORE', $s);
  71517. }
  71518. public static function mb_internal_encoding($encoding = null)
  71519. {
  71520. if (null === $encoding) {
  71521. return self::$internalEncoding;
  71522. }
  71523. $normalizedEncoding = self::getEncoding($encoding);
  71524. if ('UTF-8' === $normalizedEncoding || false !== @\iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
  71525. self::$internalEncoding = $normalizedEncoding;
  71526. return true;
  71527. }
  71528. if (80000 > \PHP_VERSION_ID) {
  71529. return false;
  71530. }
  71531. throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
  71532. }
  71533. public static function mb_language($lang = null)
  71534. {
  71535. if (null === $lang) {
  71536. return self::$language;
  71537. }
  71538. switch ($normalizedLang = strtolower($lang)) {
  71539. case 'uni':
  71540. case 'neutral':
  71541. self::$language = $normalizedLang;
  71542. return true;
  71543. }
  71544. if (80000 > \PHP_VERSION_ID) {
  71545. return false;
  71546. }
  71547. throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang));
  71548. }
  71549. public static function mb_list_encodings()
  71550. {
  71551. return ['UTF-8'];
  71552. }
  71553. public static function mb_encoding_aliases($encoding)
  71554. {
  71555. switch (strtoupper($encoding)) {
  71556. case 'UTF8':
  71557. case 'UTF-8':
  71558. return ['utf8'];
  71559. }
  71560. return false;
  71561. }
  71562. public static function mb_check_encoding($var = null, $encoding = null)
  71563. {
  71564. if (null === $encoding) {
  71565. if (null === $var) {
  71566. return false;
  71567. }
  71568. $encoding = self::$internalEncoding;
  71569. }
  71570. return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var);
  71571. }
  71572. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  71573. {
  71574. if (null === $encodingList) {
  71575. $encodingList = self::$encodingList;
  71576. } else {
  71577. if (!\is_array($encodingList)) {
  71578. $encodingList = array_map('trim', explode(',', $encodingList));
  71579. }
  71580. $encodingList = array_map('strtoupper', $encodingList);
  71581. }
  71582. foreach ($encodingList as $enc) {
  71583. switch ($enc) {
  71584. case 'ASCII':
  71585. if (!preg_match('/[\x80-\xFF]/', $str)) {
  71586. return $enc;
  71587. }
  71588. break;
  71589. case 'UTF8':
  71590. case 'UTF-8':
  71591. if (preg_match('//u', $str)) {
  71592. return 'UTF-8';
  71593. }
  71594. break;
  71595. default:
  71596. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  71597. return $enc;
  71598. }
  71599. }
  71600. }
  71601. return false;
  71602. }
  71603. public static function mb_detect_order($encodingList = null)
  71604. {
  71605. if (null === $encodingList) {
  71606. return self::$encodingList;
  71607. }
  71608. if (!\is_array($encodingList)) {
  71609. $encodingList = array_map('trim', explode(',', $encodingList));
  71610. }
  71611. $encodingList = array_map('strtoupper', $encodingList);
  71612. foreach ($encodingList as $enc) {
  71613. switch ($enc) {
  71614. default:
  71615. if (strncmp($enc, 'ISO-8859-', 9)) {
  71616. return false;
  71617. }
  71618. case 'ASCII':
  71619. case 'UTF8':
  71620. case 'UTF-8':
  71621. }
  71622. }
  71623. self::$encodingList = $encodingList;
  71624. return true;
  71625. }
  71626. public static function mb_strlen($s, $encoding = null)
  71627. {
  71628. $encoding = self::getEncoding($encoding);
  71629. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  71630. return \strlen($s);
  71631. }
  71632. return @\iconv_strlen($s, $encoding);
  71633. }
  71634. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  71635. {
  71636. $encoding = self::getEncoding($encoding);
  71637. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  71638. return strpos($haystack, $needle, $offset);
  71639. }
  71640. $needle = (string) $needle;
  71641. if ('' === $needle) {
  71642. if (80000 > \PHP_VERSION_ID) {
  71643. trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING);
  71644. return false;
  71645. }
  71646. return 0;
  71647. }
  71648. return \iconv_strpos($haystack, $needle, $offset, $encoding);
  71649. }
  71650. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  71651. {
  71652. $encoding = self::getEncoding($encoding);
  71653. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  71654. return strrpos($haystack, $needle, $offset);
  71655. }
  71656. if ($offset != (int) $offset) {
  71657. $offset = 0;
  71658. } elseif ($offset = (int) $offset) {
  71659. if ($offset < 0) {
  71660. if (0 > $offset += self::mb_strlen($needle)) {
  71661. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  71662. }
  71663. $offset = 0;
  71664. } else {
  71665. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  71666. }
  71667. }
  71668. $pos = '' !== $needle || 80000 > \PHP_VERSION_ID
  71669. ? \iconv_strrpos($haystack, $needle, $encoding)
  71670. : self::mb_strlen($haystack, $encoding);
  71671. return false !== $pos ? $offset + $pos : false;
  71672. }
  71673. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  71674. {
  71675. if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
  71676. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
  71677. return null;
  71678. }
  71679. if (1 > $split_length = (int) $split_length) {
  71680. if (80000 > \PHP_VERSION_ID) {
  71681. trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
  71682. return false;
  71683. }
  71684. throw new \ValueError('Argument #2 ($length) must be greater than 0');
  71685. }
  71686. if (null === $encoding) {
  71687. $encoding = mb_internal_encoding();
  71688. }
  71689. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  71690. $rx = '/(';
  71691. while (65535 < $split_length) {
  71692. $rx .= '.{65535}';
  71693. $split_length -= 65535;
  71694. }
  71695. $rx .= '.{'.$split_length.'})/us';
  71696. return preg_split($rx, $string, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
  71697. }
  71698. $result = [];
  71699. $length = mb_strlen($string, $encoding);
  71700. for ($i = 0; $i < $length; $i += $split_length) {
  71701. $result[] = mb_substr($string, $i, $split_length, $encoding);
  71702. }
  71703. return $result;
  71704. }
  71705. public static function mb_strtolower($s, $encoding = null)
  71706. {
  71707. return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
  71708. }
  71709. public static function mb_strtoupper($s, $encoding = null)
  71710. {
  71711. return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
  71712. }
  71713. public static function mb_substitute_character($c = null)
  71714. {
  71715. if (null === $c) {
  71716. return 'none';
  71717. }
  71718. if (0 === strcasecmp($c, 'none')) {
  71719. return true;
  71720. }
  71721. if (80000 > \PHP_VERSION_ID) {
  71722. return false;
  71723. }
  71724. if (\is_int($c) || 'long' === $c || 'entity' === $c) {
  71725. return false;
  71726. }
  71727. throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint');
  71728. }
  71729. public static function mb_substr($s, $start, $length = null, $encoding = null)
  71730. {
  71731. $encoding = self::getEncoding($encoding);
  71732. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  71733. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  71734. }
  71735. if ($start < 0) {
  71736. $start = \iconv_strlen($s, $encoding) + $start;
  71737. if ($start < 0) {
  71738. $start = 0;
  71739. }
  71740. }
  71741. if (null === $length) {
  71742. $length = 2147483647;
  71743. } elseif ($length < 0) {
  71744. $length = \iconv_strlen($s, $encoding) + $length - $start;
  71745. if ($length < 0) {
  71746. return '';
  71747. }
  71748. }
  71749. return (string) \iconv_substr($s, $start, $length, $encoding);
  71750. }
  71751. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  71752. {
  71753. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  71754. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  71755. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  71756. }
  71757. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  71758. {
  71759. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  71760. return self::getSubpart($pos, $part, $haystack, $encoding);
  71761. }
  71762. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  71763. {
  71764. $encoding = self::getEncoding($encoding);
  71765. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  71766. $pos = strrpos($haystack, $needle);
  71767. } else {
  71768. $needle = self::mb_substr($needle, 0, 1, $encoding);
  71769. $pos = \iconv_strrpos($haystack, $needle, $encoding);
  71770. }
  71771. return self::getSubpart($pos, $part, $haystack, $encoding);
  71772. }
  71773. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  71774. {
  71775. $needle = self::mb_substr($needle, 0, 1, $encoding);
  71776. $pos = self::mb_strripos($haystack, $needle, $encoding);
  71777. return self::getSubpart($pos, $part, $haystack, $encoding);
  71778. }
  71779. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  71780. {
  71781. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  71782. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  71783. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  71784. }
  71785. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  71786. {
  71787. $pos = strpos($haystack, $needle);
  71788. if (false === $pos) {
  71789. return false;
  71790. }
  71791. if ($part) {
  71792. return substr($haystack, 0, $pos);
  71793. }
  71794. return substr($haystack, $pos);
  71795. }
  71796. public static function mb_get_info($type = 'all')
  71797. {
  71798. $info = [
  71799. 'internal_encoding' => self::$internalEncoding,
  71800. 'http_output' => 'pass',
  71801. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  71802. 'func_overload' => 0,
  71803. 'func_overload_list' => 'no overload',
  71804. 'mail_charset' => 'UTF-8',
  71805. 'mail_header_encoding' => 'BASE64',
  71806. 'mail_body_encoding' => 'BASE64',
  71807. 'illegal_chars' => 0,
  71808. 'encoding_translation' => 'Off',
  71809. 'language' => self::$language,
  71810. 'detect_order' => self::$encodingList,
  71811. 'substitute_character' => 'none',
  71812. 'strict_detection' => 'Off',
  71813. ];
  71814. if ('all' === $type) {
  71815. return $info;
  71816. }
  71817. if (isset($info[$type])) {
  71818. return $info[$type];
  71819. }
  71820. return false;
  71821. }
  71822. public static function mb_http_input($type = '')
  71823. {
  71824. return false;
  71825. }
  71826. public static function mb_http_output($encoding = null)
  71827. {
  71828. return null !== $encoding ? 'pass' === $encoding : 'pass';
  71829. }
  71830. public static function mb_strwidth($s, $encoding = null)
  71831. {
  71832. $encoding = self::getEncoding($encoding);
  71833. if ('UTF-8' !== $encoding) {
  71834. $s = \iconv($encoding, 'UTF-8//IGNORE', $s);
  71835. }
  71836. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  71837. return ($wide << 1) + \iconv_strlen($s, 'UTF-8');
  71838. }
  71839. public static function mb_substr_count($haystack, $needle, $encoding = null)
  71840. {
  71841. return substr_count($haystack, $needle);
  71842. }
  71843. public static function mb_output_handler($contents, $status)
  71844. {
  71845. return $contents;
  71846. }
  71847. public static function mb_chr($code, $encoding = null)
  71848. {
  71849. if (0x80 > $code %= 0x200000) {
  71850. $s = \chr($code);
  71851. } elseif (0x800 > $code) {
  71852. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  71853. } elseif (0x10000 > $code) {
  71854. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  71855. } else {
  71856. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  71857. }
  71858. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  71859. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  71860. }
  71861. return $s;
  71862. }
  71863. public static function mb_ord($s, $encoding = null)
  71864. {
  71865. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  71866. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  71867. }
  71868. if (1 === \strlen($s)) {
  71869. return \ord($s);
  71870. }
  71871. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  71872. if (0xF0 <= $code) {
  71873. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  71874. }
  71875. if (0xE0 <= $code) {
  71876. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  71877. }
  71878. if (0xC0 <= $code) {
  71879. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  71880. }
  71881. return $code;
  71882. }
  71883. private static function getSubpart($pos, $part, $haystack, $encoding)
  71884. {
  71885. if (false === $pos) {
  71886. return false;
  71887. }
  71888. if ($part) {
  71889. return self::mb_substr($haystack, 0, $pos, $encoding);
  71890. }
  71891. return self::mb_substr($haystack, $pos, null, $encoding);
  71892. }
  71893. private static function html_encoding_callback(array $m)
  71894. {
  71895. $i = 1;
  71896. $entities = '';
  71897. $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
  71898. while (isset($m[$i])) {
  71899. if (0x80 > $m[$i]) {
  71900. $entities .= \chr($m[$i++]);
  71901. continue;
  71902. }
  71903. if (0xF0 <= $m[$i]) {
  71904. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  71905. } elseif (0xE0 <= $m[$i]) {
  71906. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  71907. } else {
  71908. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  71909. }
  71910. $entities .= '&#'.$c.';';
  71911. }
  71912. return $entities;
  71913. }
  71914. private static function title_case(array $s)
  71915. {
  71916. return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8');
  71917. }
  71918. private static function getData($file)
  71919. {
  71920. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  71921. return require $file;
  71922. }
  71923. return false;
  71924. }
  71925. private static function getEncoding($encoding)
  71926. {
  71927. if (null === $encoding) {
  71928. return self::$internalEncoding;
  71929. }
  71930. if ('UTF-8' === $encoding) {
  71931. return 'UTF-8';
  71932. }
  71933. $encoding = strtoupper($encoding);
  71934. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  71935. return 'CP850';
  71936. }
  71937. if ('UTF8' === $encoding) {
  71938. return 'UTF-8';
  71939. }
  71940. return $encoding;
  71941. }
  71942. }
  71943. <?php
  71944. return array (
  71945. 'A' => 'a',
  71946. 'B' => 'b',
  71947. 'C' => 'c',
  71948. 'D' => 'd',
  71949. 'E' => 'e',
  71950. 'F' => 'f',
  71951. 'G' => 'g',
  71952. 'H' => 'h',
  71953. 'I' => 'i',
  71954. 'J' => 'j',
  71955. 'K' => 'k',
  71956. 'L' => 'l',
  71957. 'M' => 'm',
  71958. 'N' => 'n',
  71959. 'O' => 'o',
  71960. 'P' => 'p',
  71961. 'Q' => 'q',
  71962. 'R' => 'r',
  71963. 'S' => 's',
  71964. 'T' => 't',
  71965. 'U' => 'u',
  71966. 'V' => 'v',
  71967. 'W' => 'w',
  71968. 'X' => 'x',
  71969. 'Y' => 'y',
  71970. 'Z' => 'z',
  71971. 'À' => 'à',
  71972. '�' => 'á',
  71973. 'Â' => 'â',
  71974. 'Ã' => 'ã',
  71975. 'Ä' => 'ä',
  71976. 'Ã…' => 'Ã¥',
  71977. 'Æ' => 'æ',
  71978. 'Ç' => 'ç',
  71979. 'È' => 'è',
  71980. 'É' => 'é',
  71981. 'Ê' => 'ê',
  71982. 'Ë' => 'ë',
  71983. 'Ì' => 'ì',
  71984. '�' => 'í',
  71985. 'Î' => 'î',
  71986. '�' => 'ï',
  71987. '�' => 'ð',
  71988. 'Ñ' => 'ñ',
  71989. 'Ò' => 'ò',
  71990. 'Ó' => 'ó',
  71991. 'Ô' => 'ô',
  71992. 'Õ' => 'õ',
  71993. 'Ö' => 'ö',
  71994. 'Ø' => 'ø',
  71995. 'Ù' => 'ù',
  71996. 'Ú' => 'ú',
  71997. 'Û' => 'û',
  71998. 'Ü' => 'ü',
  71999. '�' => 'ý',
  72000. 'Þ' => 'þ',
  72001. 'Ā' => '�',
  72002. 'Ă' => 'ă',
  72003. 'Ä„' => 'Ä…',
  72004. 'Ć' => 'ć',
  72005. 'Ĉ' => 'ĉ',
  72006. 'ÄŠ' => 'Ä‹',
  72007. 'Č' => '�',
  72008. 'Ď' => '�',
  72009. '�' => 'đ',
  72010. 'Ä’' => 'Ä“',
  72011. 'Ä”' => 'Ä•',
  72012. 'Ä–' => 'Ä—',
  72013. 'Ę' => 'ę',
  72014. 'Äš' => 'Ä›',
  72015. 'Ĝ' => '�',
  72016. 'Äž' => 'ÄŸ',
  72017. 'Ä ' => 'Ä¡',
  72018. 'Ä¢' => 'Ä£',
  72019. 'Ĥ' => 'ĥ',
  72020. 'Ħ' => 'ħ',
  72021. 'Ĩ' => 'ĩ',
  72022. 'Ī' => 'ī',
  72023. 'Ĭ' => 'ĭ',
  72024. 'Į' => 'į',
  72025. 'İ' => 'i̇',
  72026. 'IJ' => 'ij',
  72027. 'Ĵ' => 'ĵ',
  72028. 'Ķ' => 'ķ',
  72029. 'Ĺ' => 'ĺ',
  72030. 'Ļ' => 'ļ',
  72031. 'Ľ' => 'ľ',
  72032. 'Ä¿' => 'Å€',
  72033. '�' => 'ł',
  72034. 'Ń' => 'ń',
  72035. 'Ņ' => 'ņ',
  72036. 'Ň' => 'ň',
  72037. 'ÅŠ' => 'Å‹',
  72038. 'Ō' => '�',
  72039. 'Ŏ' => '�',
  72040. '�' => 'ő',
  72041. 'Å’' => 'Å“',
  72042. 'Å”' => 'Å•',
  72043. 'Å–' => 'Å—',
  72044. 'Ř' => 'ř',
  72045. 'Åš' => 'Å›',
  72046. 'Ŝ' => '�',
  72047. 'Åž' => 'ÅŸ',
  72048. 'Å ' => 'Å¡',
  72049. 'Å¢' => 'Å£',
  72050. 'Ť' => 'ť',
  72051. 'Ŧ' => 'ŧ',
  72052. 'Ũ' => 'ũ',
  72053. 'Ū' => 'ū',
  72054. 'Ŭ' => 'ŭ',
  72055. 'Ů' => 'ů',
  72056. 'Ű' => 'ű',
  72057. 'Ų' => 'ų',
  72058. 'Ŵ' => 'ŵ',
  72059. 'Ŷ' => 'ŷ',
  72060. 'Ÿ' => 'ÿ',
  72061. 'Ź' => 'ź',
  72062. 'Ż' => 'ż',
  72063. 'Ž' => 'ž',
  72064. '�' => 'ɓ',
  72065. 'Ƃ' => 'ƃ',
  72066. 'Æ„' => 'Æ…',
  72067. 'Ɔ' => 'ɔ',
  72068. 'Ƈ' => 'ƈ',
  72069. 'Ɖ' => 'ɖ',
  72070. 'ÆŠ' => 'É—',
  72071. 'Ƌ' => 'ƌ',
  72072. 'Ǝ' => '�',
  72073. '�' => 'ə',
  72074. '�' => 'ɛ',
  72075. 'Æ‘' => 'Æ’',
  72076. 'Æ“' => 'É ',
  72077. 'Æ”' => 'É£',
  72078. 'Æ–' => 'É©',
  72079. 'Ɨ' => 'ɨ',
  72080. 'Ƙ' => 'ƙ',
  72081. 'Ɯ' => 'ɯ',
  72082. '�' => 'ɲ',
  72083. 'Ɵ' => 'ɵ',
  72084. 'Æ ' => 'Æ¡',
  72085. 'Æ¢' => 'Æ£',
  72086. 'Ƥ' => 'ƥ',
  72087. 'Ʀ' => 'ʀ',
  72088. 'Ƨ' => 'ƨ',
  72089. 'Ʃ' => 'ʃ',
  72090. 'Ƭ' => 'ƭ',
  72091. 'Ʈ' => 'ʈ',
  72092. 'Ư' => 'ư',
  72093. 'Ʊ' => 'ʊ',
  72094. 'Ʋ' => 'ʋ',
  72095. 'Ƴ' => 'ƴ',
  72096. 'Ƶ' => 'ƶ',
  72097. 'Æ·' => 'Ê’',
  72098. 'Ƹ' => 'ƹ',
  72099. 'Ƽ' => 'ƽ',
  72100. 'DŽ' => 'dž',
  72101. 'Dž' => 'dž',
  72102. 'LJ' => 'lj',
  72103. 'Lj' => 'lj',
  72104. 'NJ' => 'nj',
  72105. 'Nj' => 'nj',
  72106. '�' => 'ǎ',
  72107. '�' => '�',
  72108. 'Ç‘' => 'Ç’',
  72109. 'Ç“' => 'Ç”',
  72110. 'Ç•' => 'Ç–',
  72111. 'Ǘ' => 'ǘ',
  72112. 'Ç™' => 'Çš',
  72113. 'Ǜ' => 'ǜ',
  72114. 'Çž' => 'ÇŸ',
  72115. 'Ç ' => 'Ç¡',
  72116. 'Ç¢' => 'Ç£',
  72117. 'Ǥ' => 'ǥ',
  72118. 'Ǧ' => 'ǧ',
  72119. 'Ǩ' => 'ǩ',
  72120. 'Ǫ' => 'ǫ',
  72121. 'Ǭ' => 'ǭ',
  72122. 'Ǯ' => 'ǯ',
  72123. 'DZ' => 'dz',
  72124. 'Dz' => 'dz',
  72125. 'Ǵ' => 'ǵ',
  72126. 'Ƕ' => 'ƕ',
  72127. 'Ç·' => 'Æ¿',
  72128. 'Ǹ' => 'ǹ',
  72129. 'Ǻ' => 'ǻ',
  72130. 'Ǽ' => 'ǽ',
  72131. 'Ǿ' => 'ǿ',
  72132. 'Ȁ' => '�',
  72133. 'Ȃ' => 'ȃ',
  72134. 'È„' => 'È…',
  72135. 'Ȇ' => 'ȇ',
  72136. 'Ȉ' => 'ȉ',
  72137. 'ÈŠ' => 'È‹',
  72138. 'Ȍ' => '�',
  72139. 'Ȏ' => '�',
  72140. '�' => 'ȑ',
  72141. 'È’' => 'È“',
  72142. 'È”' => 'È•',
  72143. 'È–' => 'È—',
  72144. 'Ș' => 'ș',
  72145. 'Èš' => 'È›',
  72146. 'Ȝ' => '�',
  72147. 'Èž' => 'ÈŸ',
  72148. 'È ' => 'Æž',
  72149. 'È¢' => 'È£',
  72150. 'Ȥ' => 'ȥ',
  72151. 'Ȧ' => 'ȧ',
  72152. 'Ȩ' => 'ȩ',
  72153. 'Ȫ' => 'ȫ',
  72154. 'Ȭ' => 'ȭ',
  72155. 'Ȯ' => 'ȯ',
  72156. 'Ȱ' => 'ȱ',
  72157. 'Ȳ' => 'ȳ',
  72158. 'Ⱥ' => 'ⱥ',
  72159. 'Ȼ' => 'ȼ',
  72160. 'Ƚ' => 'ƚ',
  72161. 'Ⱦ' => 'ⱦ',
  72162. '�' => 'ɂ',
  72163. 'Ƀ' => 'ƀ',
  72164. 'Ʉ' => 'ʉ',
  72165. 'Ʌ' => 'ʌ',
  72166. 'Ɇ' => 'ɇ',
  72167. 'Ɉ' => 'ɉ',
  72168. 'ÉŠ' => 'É‹',
  72169. 'Ɍ' => '�',
  72170. 'Ɏ' => '�',
  72171. 'Ͱ' => 'ͱ',
  72172. 'Ͳ' => 'ͳ',
  72173. 'Ͷ' => 'ͷ',
  72174. 'Ϳ' => 'ϳ',
  72175. 'Ά' => 'ά',
  72176. 'Έ' => 'έ',
  72177. 'Ή' => 'ή',
  72178. 'Ί' => 'ί',
  72179. 'Ό' => 'ό',
  72180. 'Ύ' => '�',
  72181. '�' => 'ώ',
  72182. 'Α' => 'α',
  72183. 'Β' => 'β',
  72184. 'Γ' => 'γ',
  72185. 'Δ' => 'δ',
  72186. 'Ε' => 'ε',
  72187. 'Ζ' => 'ζ',
  72188. 'Η' => 'η',
  72189. 'Θ' => 'θ',
  72190. 'Ι' => 'ι',
  72191. 'Κ' => 'κ',
  72192. 'Λ' => 'λ',
  72193. 'Μ' => 'μ',
  72194. '�' => 'ν',
  72195. 'Ξ' => 'ξ',
  72196. 'Ο' => 'ο',
  72197. 'Π' => 'π',
  72198. 'Ρ' => '�',
  72199. 'Σ' => 'σ',
  72200. 'Τ' => 'τ',
  72201. 'Î¥' => 'Ï…',
  72202. 'Φ' => 'φ',
  72203. 'Χ' => 'χ',
  72204. 'Ψ' => 'ψ',
  72205. 'Ω' => 'ω',
  72206. 'Ϊ' => 'ϊ',
  72207. 'Ϋ' => 'ϋ',
  72208. '�' => 'ϗ',
  72209. 'Ϙ' => 'ϙ',
  72210. 'Ïš' => 'Ï›',
  72211. 'Ϝ' => '�',
  72212. 'Ïž' => 'ÏŸ',
  72213. 'Ï ' => 'Ï¡',
  72214. 'Ï¢' => 'Ï£',
  72215. 'Ϥ' => 'ϥ',
  72216. 'Ϧ' => 'ϧ',
  72217. 'Ϩ' => 'ϩ',
  72218. 'Ϫ' => 'ϫ',
  72219. 'Ϭ' => 'ϭ',
  72220. 'Ϯ' => 'ϯ',
  72221. 'ϴ' => 'θ',
  72222. 'Ϸ' => 'ϸ',
  72223. 'Ϲ' => 'ϲ',
  72224. 'Ϻ' => 'ϻ',
  72225. 'Ͻ' => 'ͻ',
  72226. 'Ͼ' => 'ͼ',
  72227. 'Ͽ' => 'ͽ',
  72228. 'Ѐ' => '�',
  72229. '�' => 'ё',
  72230. 'Ђ' => 'ђ',
  72231. 'Ѓ' => 'ѓ',
  72232. 'Є' => 'є',
  72233. 'Ð…' => 'Ñ•',
  72234. 'І' => 'і',
  72235. 'Ї' => 'ї',
  72236. 'Ј' => 'ј',
  72237. 'Љ' => 'љ',
  72238. 'Њ' => 'њ',
  72239. 'Ћ' => 'ћ',
  72240. 'Ќ' => 'ќ',
  72241. '�' => '�',
  72242. 'ÐŽ' => 'Ñž',
  72243. '�' => 'џ',
  72244. '�' => 'а',
  72245. 'Б' => 'б',
  72246. 'В' => 'в',
  72247. 'Г' => 'г',
  72248. 'Д' => 'д',
  72249. 'Е' => 'е',
  72250. 'Ж' => 'ж',
  72251. 'З' => 'з',
  72252. 'И' => 'и',
  72253. 'Й' => 'й',
  72254. 'К' => 'к',
  72255. 'Л' => 'л',
  72256. 'М' => 'м',
  72257. '�' => 'н',
  72258. 'О' => 'о',
  72259. 'П' => 'п',
  72260. 'Р' => 'р',
  72261. 'С' => '�',
  72262. 'Т' => 'т',
  72263. 'У' => 'у',
  72264. 'Ф' => 'ф',
  72265. 'Ð¥' => 'Ñ…',
  72266. 'Ц' => 'ц',
  72267. 'Ч' => 'ч',
  72268. 'Ш' => 'ш',
  72269. 'Щ' => 'щ',
  72270. 'Ъ' => 'ъ',
  72271. 'Ы' => 'ы',
  72272. 'Ь' => 'ь',
  72273. 'Э' => '�',
  72274. 'Ю' => 'ю',
  72275. 'Я' => '�',
  72276. 'Ñ ' => 'Ñ¡',
  72277. 'Ñ¢' => 'Ñ£',
  72278. 'Ѥ' => 'ѥ',
  72279. 'Ѧ' => 'ѧ',
  72280. 'Ѩ' => 'ѩ',
  72281. 'Ѫ' => 'ѫ',
  72282. 'Ѭ' => 'ѭ',
  72283. 'Ѯ' => 'ѯ',
  72284. 'Ѱ' => 'ѱ',
  72285. 'Ѳ' => 'ѳ',
  72286. 'Ѵ' => 'ѵ',
  72287. 'Ѷ' => 'ѷ',
  72288. 'Ѹ' => 'ѹ',
  72289. 'Ѻ' => 'ѻ',
  72290. 'Ѽ' => 'ѽ',
  72291. 'Ѿ' => 'ѿ',
  72292. 'Ò€' => 'Ò�',
  72293. 'ÒŠ' => 'Ò‹',
  72294. 'Ҍ' => '�',
  72295. 'ÒŽ' => 'Ò�',
  72296. 'Ò�' => 'Ò‘',
  72297. 'Ò’' => 'Ò“',
  72298. 'Ò”' => 'Ò•',
  72299. 'Ò–' => 'Ò—',
  72300. 'Ò˜' => 'Ò™',
  72301. 'Òš' => 'Ò›',
  72302. 'Ҝ' => '�',
  72303. 'Òž' => 'ÒŸ',
  72304. 'Ò ' => 'Ò¡',
  72305. 'Ò¢' => 'Ò£',
  72306. 'Ò¤' => 'Ò¥',
  72307. 'Ò¦' => 'Ò§',
  72308. 'Ò¨' => 'Ò©',
  72309. 'Òª' => 'Ò«',
  72310. 'Ò¬' => 'Ò­',
  72311. 'Ò®' => 'Ò¯',
  72312. 'Ò°' => 'Ò±',
  72313. 'Ò²' => 'Ò³',
  72314. 'Ò´' => 'Òµ',
  72315. 'Ò¶' => 'Ò·',
  72316. 'Ò¸' => 'Ò¹',
  72317. 'Òº' => 'Ò»',
  72318. 'Ò¼' => 'Ò½',
  72319. 'Ò¾' => 'Ò¿',
  72320. 'Ó€' => 'Ó�',
  72321. 'Ó�' => 'Ó‚',
  72322. 'Óƒ' => 'Ó„',
  72323. 'Ó…' => 'Ó†',
  72324. 'Ó‡' => 'Óˆ',
  72325. 'Ó‰' => 'ÓŠ',
  72326. 'Ӌ' => 'ӌ',
  72327. 'Ó�' => 'ÓŽ',
  72328. 'Ó�' => 'Ó‘',
  72329. 'Ó’' => 'Ó“',
  72330. 'Ó”' => 'Ó•',
  72331. 'Ó–' => 'Ó—',
  72332. 'Ó˜' => 'Ó™',
  72333. 'Óš' => 'Ó›',
  72334. 'Ӝ' => '�',
  72335. 'Óž' => 'ÓŸ',
  72336. 'Ó ' => 'Ó¡',
  72337. 'Ó¢' => 'Ó£',
  72338. 'Ó¤' => 'Ó¥',
  72339. 'Ó¦' => 'Ó§',
  72340. 'Ó¨' => 'Ó©',
  72341. 'Óª' => 'Ó«',
  72342. 'Ó¬' => 'Ó­',
  72343. 'Ó®' => 'Ó¯',
  72344. 'Ó°' => 'Ó±',
  72345. 'Ó²' => 'Ó³',
  72346. 'Ó´' => 'Óµ',
  72347. 'Ó¶' => 'Ó·',
  72348. 'Ó¸' => 'Ó¹',
  72349. 'Óº' => 'Ó»',
  72350. 'Ó¼' => 'Ó½',
  72351. 'Ó¾' => 'Ó¿',
  72352. 'Ô€' => 'Ô�',
  72353. 'Ô‚' => 'Ôƒ',
  72354. 'Ô„' => 'Ô…',
  72355. 'Ô†' => 'Ô‡',
  72356. 'Ôˆ' => 'Ô‰',
  72357. 'ÔŠ' => 'Ô‹',
  72358. 'Ԍ' => '�',
  72359. 'ÔŽ' => 'Ô�',
  72360. 'Ô�' => 'Ô‘',
  72361. 'Ô’' => 'Ô“',
  72362. 'Ô”' => 'Ô•',
  72363. 'Ô–' => 'Ô—',
  72364. 'Ô˜' => 'Ô™',
  72365. 'Ôš' => 'Ô›',
  72366. 'Ԝ' => '�',
  72367. 'Ôž' => 'ÔŸ',
  72368. 'Ô ' => 'Ô¡',
  72369. 'Ô¢' => 'Ô£',
  72370. 'Ô¤' => 'Ô¥',
  72371. 'Ô¦' => 'Ô§',
  72372. 'Ô¨' => 'Ô©',
  72373. 'Ôª' => 'Ô«',
  72374. 'Ô¬' => 'Ô­',
  72375. 'Ô®' => 'Ô¯',
  72376. 'Ô±' => 'Õ¡',
  72377. 'Ô²' => 'Õ¢',
  72378. 'Ô³' => 'Õ£',
  72379. 'Ô´' => 'Õ¤',
  72380. 'Ôµ' => 'Õ¥',
  72381. 'Ô¶' => 'Õ¦',
  72382. 'Ô·' => 'Õ§',
  72383. 'Ô¸' => 'Õ¨',
  72384. 'Ô¹' => 'Õ©',
  72385. 'Ôº' => 'Õª',
  72386. 'Ô»' => 'Õ«',
  72387. 'Ô¼' => 'Õ¬',
  72388. 'Ô½' => 'Õ­',
  72389. 'Ô¾' => 'Õ®',
  72390. 'Ô¿' => 'Õ¯',
  72391. 'Õ€' => 'Õ°',
  72392. 'Õ�' => 'Õ±',
  72393. 'Õ‚' => 'Õ²',
  72394. 'Õƒ' => 'Õ³',
  72395. 'Õ„' => 'Õ´',
  72396. 'Õ…' => 'Õµ',
  72397. 'Õ†' => 'Õ¶',
  72398. 'Õ‡' => 'Õ·',
  72399. 'Õˆ' => 'Õ¸',
  72400. 'Õ‰' => 'Õ¹',
  72401. 'ÕŠ' => 'Õº',
  72402. 'Õ‹' => 'Õ»',
  72403. 'Ռ' => 'ռ',
  72404. 'Õ�' => 'Õ½',
  72405. 'ÕŽ' => 'Õ¾',
  72406. 'Õ�' => 'Õ¿',
  72407. 'Õ�' => 'Ö€',
  72408. 'Õ‘' => 'Ö�',
  72409. 'Õ’' => 'Ö‚',
  72410. 'Õ“' => 'Öƒ',
  72411. 'Õ”' => 'Ö„',
  72412. 'Õ•' => 'Ö…',
  72413. 'Õ–' => 'Ö†',
  72414. 'á‚ ' => 'â´€',
  72415. 'á‚¡' => 'â´�',
  72416. 'á‚¢' => 'â´‚',
  72417. 'á‚£' => 'â´ƒ',
  72418. 'Ⴄ' => 'ⴄ',
  72419. 'á‚¥' => 'â´…',
  72420. 'Ⴆ' => 'ⴆ',
  72421. 'Ⴇ' => 'ⴇ',
  72422. 'Ⴈ' => 'ⴈ',
  72423. 'á‚©' => 'â´‰',
  72424. 'Ⴊ' => 'ⴊ',
  72425. 'á‚«' => 'â´‹',
  72426. 'Ⴌ' => 'ⴌ',
  72427. 'á‚­' => 'â´�',
  72428. 'á‚®' => 'â´Ž',
  72429. 'Ⴏ' => '�',
  72430. 'á‚°' => 'â´�',
  72431. 'Ⴑ' => 'ⴑ',
  72432. 'Ⴒ' => 'ⴒ',
  72433. 'Ⴓ' => 'ⴓ',
  72434. 'á‚´' => 'â´”',
  72435. 'Ⴕ' => 'ⴕ',
  72436. 'Ⴖ' => 'ⴖ',
  72437. 'á‚·' => 'â´—',
  72438. 'Ⴘ' => 'ⴘ',
  72439. 'Ⴙ' => 'ⴙ',
  72440. 'Ⴚ' => 'ⴚ',
  72441. 'á‚»' => 'â´›',
  72442. 'Ⴜ' => 'ⴜ',
  72443. 'Ⴝ' => '�',
  72444. 'Ⴞ' => 'ⴞ',
  72445. 'á‚¿' => 'â´Ÿ',
  72446. 'Ⴠ' => 'ⴠ',
  72447. '�' => 'ⴡ',
  72448. 'Ⴢ' => 'ⴢ',
  72449. 'Ⴣ' => 'ⴣ',
  72450. 'Ⴤ' => 'ⴤ',
  72451. 'Ⴥ' => 'ⴥ',
  72452. 'Ⴧ' => 'ⴧ',
  72453. '�' => 'ⴭ',
  72454. 'Ꭰ' => 'ꭰ',
  72455. 'Ꭱ' => 'ꭱ',
  72456. 'Ꭲ' => 'ꭲ',
  72457. 'Ꭳ' => 'ꭳ',
  72458. 'Ꭴ' => 'ꭴ',
  72459. 'Ꭵ' => 'ꭵ',
  72460. 'Ꭶ' => 'ꭶ',
  72461. 'Ꭷ' => 'ꭷ',
  72462. 'Ꭸ' => 'ꭸ',
  72463. 'Ꭹ' => 'ꭹ',
  72464. 'Ꭺ' => 'ꭺ',
  72465. 'Ꭻ' => 'ꭻ',
  72466. 'Ꭼ' => 'ꭼ',
  72467. 'Ꭽ' => 'ꭽ',
  72468. 'Ꭾ' => 'ꭾ',
  72469. 'Ꭿ' => 'ꭿ',
  72470. 'Ꮀ' => 'ꮀ',
  72471. 'Ꮁ' => '�',
  72472. 'Ꮂ' => 'ꮂ',
  72473. 'Ꮃ' => 'ꮃ',
  72474. 'Ꮄ' => 'ꮄ',
  72475. 'Ꮅ' => 'ꮅ',
  72476. 'Ꮆ' => 'ꮆ',
  72477. 'Ꮇ' => 'ꮇ',
  72478. 'Ꮈ' => 'ꮈ',
  72479. 'Ꮉ' => 'ꮉ',
  72480. 'Ꮊ' => 'ꮊ',
  72481. 'Ꮋ' => 'ꮋ',
  72482. 'Ꮌ' => 'ꮌ',
  72483. 'Ꮍ' => '�',
  72484. 'Ꮎ' => 'ꮎ',
  72485. 'Ꮏ' => '�',
  72486. '�' => '�',
  72487. '�' => 'ꮑ',
  72488. '�' => 'ꮒ',
  72489. '�' => 'ꮓ',
  72490. '�' => 'ꮔ',
  72491. '�' => 'ꮕ',
  72492. '�' => 'ꮖ',
  72493. '�' => 'ꮗ',
  72494. '�' => 'ꮘ',
  72495. '�' => 'ꮙ',
  72496. '�' => 'ꮚ',
  72497. '�' => 'ꮛ',
  72498. '�' => 'ꮜ',
  72499. '�' => '�',
  72500. '�' => 'ꮞ',
  72501. '�' => 'ꮟ',
  72502. '�' => 'ꮠ',
  72503. '�' => 'ꮡ',
  72504. '�' => 'ꮢ',
  72505. '�' => 'ꮣ',
  72506. '�' => 'ꮤ',
  72507. '�' => 'ꮥ',
  72508. '�' => 'ꮦ',
  72509. '�' => 'ꮧ',
  72510. '�' => 'ꮨ',
  72511. '�' => 'ꮩ',
  72512. '�' => 'ꮪ',
  72513. '�' => 'ꮫ',
  72514. '�' => 'ꮬ',
  72515. '�' => 'ꮭ',
  72516. '�' => 'ꮮ',
  72517. '�' => 'ꮯ',
  72518. '�' => 'ꮰ',
  72519. '�' => 'ꮱ',
  72520. '�' => 'ꮲ',
  72521. '�' => 'ꮳ',
  72522. '�' => 'ꮴ',
  72523. '�' => 'ꮵ',
  72524. '�' => 'ꮶ',
  72525. '�' => 'ꮷ',
  72526. '�' => 'ꮸ',
  72527. '�' => 'ꮹ',
  72528. '�' => 'ꮺ',
  72529. '�' => 'ꮻ',
  72530. '�' => 'ꮼ',
  72531. '�' => 'ꮽ',
  72532. '�' => 'ꮾ',
  72533. '�' => 'ꮿ',
  72534. '�' => '�',
  72535. '�' => '�',
  72536. '�' => '�',
  72537. '�' => '�',
  72538. '�' => '�',
  72539. '�' => '�',
  72540. '�' => '�',
  72541. 'Ბ' => 'ბ',
  72542. 'Გ' => 'გ',
  72543. 'Დ' => 'დ',
  72544. 'Ე' => 'ე',
  72545. 'Ვ' => 'ვ',
  72546. 'Ზ' => 'ზ',
  72547. 'Თ' => 'თ',
  72548. 'Ი' => 'ი',
  72549. 'Კ' => 'კ',
  72550. 'Ლ' => 'ლ',
  72551. 'Მ' => 'მ',
  72552. 'Ნ' => 'ნ',
  72553. '�' => '�',
  72554. 'Პ' => 'პ',
  72555. 'Ჟ' => 'ჟ',
  72556. 'Რ' => 'რ',
  72557. 'Ს' => 'ს',
  72558. 'Ტ' => 'ტ',
  72559. 'Უ' => 'უ',
  72560. 'Ფ' => 'ფ',
  72561. 'Ქ' => 'ქ',
  72562. 'Ღ' => 'ღ',
  72563. 'Ყ' => 'ყ',
  72564. 'Შ' => 'შ',
  72565. 'Ჩ' => 'ჩ',
  72566. 'Ც' => 'ც',
  72567. 'Ძ' => 'ძ',
  72568. 'Წ' => 'წ',
  72569. 'Ჭ' => 'ჭ',
  72570. 'Ხ' => 'ხ',
  72571. 'Ჯ' => 'ჯ',
  72572. 'Ჰ' => 'ჰ',
  72573. 'Ჱ' => 'ჱ',
  72574. 'Ჲ' => 'ჲ',
  72575. 'Ჳ' => 'ჳ',
  72576. 'Ჴ' => 'ჴ',
  72577. 'Ჵ' => 'ჵ',
  72578. 'Ჶ' => 'ჶ',
  72579. 'Ჷ' => 'ჷ',
  72580. 'Ჸ' => 'ჸ',
  72581. 'Ჹ' => 'ჹ',
  72582. 'Ჺ' => 'ჺ',
  72583. 'Ჽ' => 'ჽ',
  72584. 'Ჾ' => 'ჾ',
  72585. 'Ჿ' => 'ჿ',
  72586. 'Ḁ' => '�',
  72587. 'Ḃ' => 'ḃ',
  72588. 'Ḅ' => 'ḅ',
  72589. 'Ḇ' => 'ḇ',
  72590. 'Ḉ' => 'ḉ',
  72591. 'Ḋ' => 'ḋ',
  72592. 'Ḍ' => '�',
  72593. 'Ḏ' => '�',
  72594. '�' => 'ḑ',
  72595. 'Ḓ' => 'ḓ',
  72596. 'Ḕ' => 'ḕ',
  72597. 'Ḗ' => 'ḗ',
  72598. 'Ḙ' => 'ḙ',
  72599. 'Ḛ' => 'ḛ',
  72600. 'Ḝ' => '�',
  72601. 'Ḟ' => 'ḟ',
  72602. 'Ḡ' => 'ḡ',
  72603. 'Ḣ' => 'ḣ',
  72604. 'Ḥ' => 'ḥ',
  72605. 'Ḧ' => 'ḧ',
  72606. 'Ḩ' => 'ḩ',
  72607. 'Ḫ' => 'ḫ',
  72608. 'Ḭ' => 'ḭ',
  72609. 'Ḯ' => 'ḯ',
  72610. 'Ḱ' => 'ḱ',
  72611. 'Ḳ' => 'ḳ',
  72612. 'Ḵ' => 'ḵ',
  72613. 'Ḷ' => 'ḷ',
  72614. 'Ḹ' => 'ḹ',
  72615. 'Ḻ' => 'ḻ',
  72616. 'Ḽ' => 'ḽ',
  72617. 'Ḿ' => 'ḿ',
  72618. 'Ṁ' => '�',
  72619. 'Ṃ' => 'ṃ',
  72620. 'Ṅ' => 'ṅ',
  72621. 'Ṇ' => 'ṇ',
  72622. 'Ṉ' => 'ṉ',
  72623. 'Ṋ' => 'ṋ',
  72624. 'Ṍ' => '�',
  72625. 'Ṏ' => '�',
  72626. '�' => 'ṑ',
  72627. 'Ṓ' => 'ṓ',
  72628. 'Ṕ' => 'ṕ',
  72629. 'á¹–' => 'á¹—',
  72630. 'Ṙ' => 'ṙ',
  72631. 'Ṛ' => 'ṛ',
  72632. 'Ṝ' => '�',
  72633. 'Ṟ' => 'ṟ',
  72634. 'Ṡ' => 'ṡ',
  72635. 'á¹¢' => 'á¹£',
  72636. 'Ṥ' => 'ṥ',
  72637. 'Ṧ' => 'ṧ',
  72638. 'Ṩ' => 'ṩ',
  72639. 'Ṫ' => 'ṫ',
  72640. 'Ṭ' => 'ṭ',
  72641. 'Ṯ' => 'ṯ',
  72642. 'á¹°' => 'á¹±',
  72643. 'á¹²' => 'á¹³',
  72644. 'á¹´' => 'á¹µ',
  72645. 'Ṷ' => 'ṷ',
  72646. 'Ṹ' => 'ṹ',
  72647. 'Ṻ' => 'ṻ',
  72648. 'á¹¼' => 'á¹½',
  72649. 'Ṿ' => 'ṿ',
  72650. 'Ẁ' => '�',
  72651. 'Ẃ' => 'ẃ',
  72652. 'Ẅ' => 'ẅ',
  72653. 'Ẇ' => 'ẇ',
  72654. 'Ẉ' => 'ẉ',
  72655. 'Ẋ' => 'ẋ',
  72656. 'Ẍ' => '�',
  72657. 'Ẏ' => '�',
  72658. '�' => 'ẑ',
  72659. 'Ẓ' => 'ẓ',
  72660. 'Ẕ' => 'ẕ',
  72661. 'ẞ' => 'ß',
  72662. 'Ạ' => 'ạ',
  72663. 'Ả' => 'ả',
  72664. 'Ấ' => 'ấ',
  72665. 'Ầ' => 'ầ',
  72666. 'Ẩ' => 'ẩ',
  72667. 'Ẫ' => 'ẫ',
  72668. 'Ậ' => 'ậ',
  72669. 'Ắ' => 'ắ',
  72670. 'Ằ' => 'ằ',
  72671. 'Ẳ' => 'ẳ',
  72672. 'Ẵ' => 'ẵ',
  72673. 'Ặ' => 'ặ',
  72674. 'Ẹ' => 'ẹ',
  72675. 'Ẻ' => 'ẻ',
  72676. 'Ẽ' => 'ẽ',
  72677. 'Ế' => 'ế',
  72678. 'Ề' => '�',
  72679. 'Ể' => 'ể',
  72680. 'Ễ' => 'ễ',
  72681. 'Ệ' => 'ệ',
  72682. 'Ỉ' => 'ỉ',
  72683. 'Ị' => 'ị',
  72684. 'Ọ' => '�',
  72685. 'Ỏ' => '�',
  72686. '�' => 'ố',
  72687. 'Ồ' => 'ồ',
  72688. 'Ổ' => 'ổ',
  72689. 'á»–' => 'á»—',
  72690. 'Ộ' => 'ộ',
  72691. 'Ớ' => 'ớ',
  72692. 'Ờ' => '�',
  72693. 'Ở' => 'ở',
  72694. 'Ỡ' => 'ỡ',
  72695. 'Ợ' => 'ợ',
  72696. 'Ụ' => 'ụ',
  72697. 'Ủ' => 'ủ',
  72698. 'Ứ' => 'ứ',
  72699. 'Ừ' => 'ừ',
  72700. 'Ử' => 'ử',
  72701. 'Ữ' => 'ữ',
  72702. 'á»°' => 'á»±',
  72703. 'Ỳ' => 'ỳ',
  72704. 'Ỵ' => 'ỵ',
  72705. 'Ỷ' => 'ỷ',
  72706. 'Ỹ' => 'ỹ',
  72707. 'Ỻ' => 'ỻ',
  72708. 'Ỽ' => 'ỽ',
  72709. 'Ỿ' => 'ỿ',
  72710. 'Ἀ' => 'ἀ',
  72711. 'Ἁ' => '�',
  72712. 'Ἂ' => 'ἂ',
  72713. 'Ἃ' => 'ἃ',
  72714. 'Ἄ' => 'ἄ',
  72715. '�' => 'ἅ',
  72716. 'Ἆ' => 'ἆ',
  72717. '�' => 'ἇ',
  72718. 'Ἐ' => '�',
  72719. 'Ἑ' => 'ἑ',
  72720. 'Ἒ' => 'ἒ',
  72721. 'Ἓ' => 'ἓ',
  72722. 'Ἔ' => 'ἔ',
  72723. '�' => 'ἕ',
  72724. 'Ἠ' => 'ἠ',
  72725. 'Ἡ' => 'ἡ',
  72726. 'Ἢ' => 'ἢ',
  72727. 'Ἣ' => 'ἣ',
  72728. 'Ἤ' => 'ἤ',
  72729. 'á¼­' => 'á¼¥',
  72730. 'Ἦ' => 'ἦ',
  72731. 'Ἧ' => 'ἧ',
  72732. 'Ἰ' => 'ἰ',
  72733. 'á¼¹' => 'á¼±',
  72734. 'Ἲ' => 'ἲ',
  72735. 'á¼»' => 'á¼³',
  72736. 'á¼¼' => 'á¼´',
  72737. 'á¼½' => 'á¼µ',
  72738. 'Ἶ' => 'ἶ',
  72739. 'Ἷ' => 'ἷ',
  72740. 'Ὀ' => 'ὀ',
  72741. 'Ὁ' => '�',
  72742. 'Ὂ' => 'ὂ',
  72743. 'Ὃ' => 'ὃ',
  72744. 'Ὄ' => 'ὄ',
  72745. '�' => 'ὅ',
  72746. 'Ὑ' => 'ὑ',
  72747. 'Ὓ' => 'ὓ',
  72748. '�' => 'ὕ',
  72749. 'Ὗ' => 'ὗ',
  72750. 'Ὠ' => 'ὠ',
  72751. 'Ὡ' => 'ὡ',
  72752. 'Ὢ' => 'ὢ',
  72753. 'Ὣ' => 'ὣ',
  72754. 'Ὤ' => 'ὤ',
  72755. 'á½­' => 'á½¥',
  72756. 'Ὦ' => 'ὦ',
  72757. 'Ὧ' => 'ὧ',
  72758. 'ᾈ' => 'ᾀ',
  72759. 'ᾉ' => '�',
  72760. 'ᾊ' => 'ᾂ',
  72761. 'ᾋ' => 'ᾃ',
  72762. 'ᾌ' => 'ᾄ',
  72763. '�' => 'ᾅ',
  72764. 'ᾎ' => 'ᾆ',
  72765. '�' => 'ᾇ',
  72766. 'ᾘ' => '�',
  72767. 'ᾙ' => 'ᾑ',
  72768. 'ᾚ' => 'ᾒ',
  72769. 'ᾛ' => 'ᾓ',
  72770. 'ᾜ' => 'ᾔ',
  72771. '�' => 'ᾕ',
  72772. 'ᾞ' => 'ᾖ',
  72773. 'ᾟ' => 'ᾗ',
  72774. 'ᾨ' => 'ᾠ',
  72775. 'ᾩ' => 'ᾡ',
  72776. 'ᾪ' => 'ᾢ',
  72777. 'ᾫ' => 'ᾣ',
  72778. 'ᾬ' => 'ᾤ',
  72779. 'á¾­' => 'á¾¥',
  72780. 'ᾮ' => 'ᾦ',
  72781. 'ᾯ' => 'ᾧ',
  72782. 'Ᾰ' => 'ᾰ',
  72783. 'á¾¹' => 'á¾±',
  72784. 'Ὰ' => 'ὰ',
  72785. 'á¾»' => 'á½±',
  72786. 'á¾¼' => 'á¾³',
  72787. 'Ὲ' => 'ὲ',
  72788. 'Έ' => 'έ',
  72789. 'á¿Š' => 'á½´',
  72790. 'á¿‹' => 'á½µ',
  72791. 'ῌ' => 'ῃ',
  72792. 'Ῐ' => '�',
  72793. 'á¿™' => 'á¿‘',
  72794. 'Ὶ' => 'ὶ',
  72795. 'á¿›' => 'á½·',
  72796. 'Ῠ' => 'ῠ',
  72797. 'á¿©' => 'á¿¡',
  72798. 'Ὺ' => 'ὺ',
  72799. 'á¿«' => 'á½»',
  72800. 'Ῥ' => 'ῥ',
  72801. 'Ὸ' => 'ὸ',
  72802. 'Ό' => 'ό',
  72803. 'Ὼ' => 'ὼ',
  72804. 'á¿»' => 'á½½',
  72805. 'ῼ' => 'ῳ',
  72806. 'Ω' => 'ω',
  72807. 'K' => 'k',
  72808. 'â„«' => 'Ã¥',
  72809. 'Ⅎ' => 'ⅎ',
  72810. 'â… ' => 'â…°',
  72811. 'â…¡' => 'â…±',
  72812. 'â…¢' => 'â…²',
  72813. 'â…£' => 'â…³',
  72814. 'â…¤' => 'â…´',
  72815. 'â…¥' => 'â…µ',
  72816. 'â…¦' => 'â…¶',
  72817. 'â…§' => 'â…·',
  72818. 'â…¨' => 'â…¸',
  72819. 'â…©' => 'â…¹',
  72820. 'â…ª' => 'â…º',
  72821. 'â…«' => 'â…»',
  72822. 'â…¬' => 'â…¼',
  72823. 'â…­' => 'â…½',
  72824. 'â…®' => 'â…¾',
  72825. 'â…¯' => 'â…¿',
  72826. 'Ↄ' => 'ↄ',
  72827. 'Ⓐ' => '�',
  72828. 'â’·' => 'â“‘',
  72829. 'â’¸' => 'â“’',
  72830. 'â’¹' => 'â““',
  72831. 'â’º' => 'â“”',
  72832. 'â’»' => 'â“•',
  72833. 'â’¼' => 'â“–',
  72834. 'â’½' => 'â“—',
  72835. 'Ⓘ' => 'ⓘ',
  72836. 'â’¿' => 'â“™',
  72837. 'â“€' => 'â“š',
  72838. '�' => 'ⓛ',
  72839. 'Ⓜ' => 'ⓜ',
  72840. 'Ⓝ' => '�',
  72841. 'â“„' => 'â“ž',
  72842. 'â“…' => 'â“Ÿ',
  72843. 'Ⓠ' => 'ⓠ',
  72844. 'Ⓡ' => 'ⓡ',
  72845. 'Ⓢ' => 'ⓢ',
  72846. 'Ⓣ' => 'ⓣ',
  72847. 'Ⓤ' => 'ⓤ',
  72848. 'â“‹' => 'â“¥',
  72849. 'Ⓦ' => 'ⓦ',
  72850. '�' => 'ⓧ',
  72851. 'Ⓨ' => 'ⓨ',
  72852. '�' => 'ⓩ',
  72853. 'â°€' => 'â°°',
  72854. 'â°�' => 'â°±',
  72855. 'â°‚' => 'â°²',
  72856. 'â°ƒ' => 'â°³',
  72857. 'â°„' => 'â°´',
  72858. 'â°…' => 'â°µ',
  72859. 'â°†' => 'â°¶',
  72860. 'â°‡' => 'â°·',
  72861. 'â°ˆ' => 'â°¸',
  72862. 'â°‰' => 'â°¹',
  72863. 'â°Š' => 'â°º',
  72864. 'â°‹' => 'â°»',
  72865. 'Ⰼ' => 'ⰼ',
  72866. 'â°�' => 'â°½',
  72867. 'â°Ž' => 'â°¾',
  72868. 'â°�' => 'â°¿',
  72869. 'â°�' => 'â±€',
  72870. 'Ⱁ' => '�',
  72871. 'Ⱂ' => 'ⱂ',
  72872. 'Ⱃ' => 'ⱃ',
  72873. 'Ⱄ' => 'ⱄ',
  72874. 'â°•' => 'â±…',
  72875. 'Ⱆ' => 'ⱆ',
  72876. 'Ⱇ' => 'ⱇ',
  72877. 'Ⱈ' => 'ⱈ',
  72878. 'Ⱉ' => 'ⱉ',
  72879. 'Ⱊ' => 'ⱊ',
  72880. 'Ⱋ' => 'ⱋ',
  72881. 'Ⱌ' => 'ⱌ',
  72882. '�' => '�',
  72883. 'Ⱎ' => 'ⱎ',
  72884. 'Ⱏ' => '�',
  72885. 'Ⱐ' => '�',
  72886. 'Ⱑ' => 'ⱑ',
  72887. 'â°¢' => 'â±’',
  72888. 'Ⱓ' => 'ⱓ',
  72889. 'â°¤' => 'â±”',
  72890. 'Ⱕ' => 'ⱕ',
  72891. 'â°¦' => 'â±–',
  72892. 'â°§' => 'â±—',
  72893. 'Ⱘ' => 'ⱘ',
  72894. 'â°©' => 'â±™',
  72895. 'Ⱚ' => 'ⱚ',
  72896. 'â°«' => 'â±›',
  72897. 'Ⱜ' => 'ⱜ',
  72898. 'Ⱝ' => '�',
  72899. 'Ⱞ' => 'ⱞ',
  72900. 'Ⱡ' => 'ⱡ',
  72901. 'â±¢' => 'É«',
  72902. 'â±£' => 'áµ½',
  72903. 'Ɽ' => 'ɽ',
  72904. 'Ⱨ' => 'ⱨ',
  72905. 'Ⱪ' => 'ⱪ',
  72906. 'Ⱬ' => 'ⱬ',
  72907. 'â±­' => 'É‘',
  72908. 'Ɱ' => 'ɱ',
  72909. 'Ɐ' => '�',
  72910. 'â±°' => 'É’',
  72911. 'â±²' => 'â±³',
  72912. 'Ⱶ' => 'ⱶ',
  72913. 'â±¾' => 'È¿',
  72914. 'Ɀ' => 'ɀ',
  72915. 'Ⲁ' => '�',
  72916. 'Ⲃ' => 'ⲃ',
  72917. 'Ⲅ' => 'ⲅ',
  72918. 'Ⲇ' => 'ⲇ',
  72919. 'Ⲉ' => 'ⲉ',
  72920. 'Ⲋ' => 'ⲋ',
  72921. 'Ⲍ' => '�',
  72922. 'Ⲏ' => '�',
  72923. '�' => 'ⲑ',
  72924. 'Ⲓ' => 'ⲓ',
  72925. 'Ⲕ' => 'ⲕ',
  72926. 'â²–' => 'â²—',
  72927. 'Ⲙ' => 'ⲙ',
  72928. 'Ⲛ' => 'ⲛ',
  72929. 'Ⲝ' => '�',
  72930. 'Ⲟ' => 'ⲟ',
  72931. 'Ⲡ' => 'ⲡ',
  72932. 'â²¢' => 'â²£',
  72933. 'Ⲥ' => 'ⲥ',
  72934. 'Ⲧ' => 'ⲧ',
  72935. 'Ⲩ' => 'ⲩ',
  72936. 'Ⲫ' => 'ⲫ',
  72937. 'Ⲭ' => 'ⲭ',
  72938. 'Ⲯ' => 'ⲯ',
  72939. 'â²°' => 'â²±',
  72940. 'â²²' => 'â²³',
  72941. 'â²´' => 'â²µ',
  72942. 'Ⲷ' => 'ⲷ',
  72943. 'Ⲹ' => 'ⲹ',
  72944. 'Ⲻ' => 'ⲻ',
  72945. 'â²¼' => 'â²½',
  72946. 'Ⲿ' => 'ⲿ',
  72947. 'Ⳁ' => '�',
  72948. 'Ⳃ' => 'ⳃ',
  72949. 'Ⳅ' => 'ⳅ',
  72950. 'Ⳇ' => 'ⳇ',
  72951. 'Ⳉ' => 'ⳉ',
  72952. 'Ⳋ' => 'ⳋ',
  72953. 'Ⳍ' => '�',
  72954. 'Ⳏ' => '�',
  72955. '�' => 'ⳑ',
  72956. 'Ⳓ' => 'ⳓ',
  72957. 'Ⳕ' => 'ⳕ',
  72958. 'â³–' => 'â³—',
  72959. 'Ⳙ' => 'ⳙ',
  72960. 'Ⳛ' => 'ⳛ',
  72961. 'Ⳝ' => '�',
  72962. 'Ⳟ' => 'ⳟ',
  72963. 'Ⳡ' => 'ⳡ',
  72964. 'â³¢' => 'â³£',
  72965. 'Ⳬ' => 'ⳬ',
  72966. 'â³­' => 'â³®',
  72967. 'â³²' => 'â³³',
  72968. 'Ꙁ' => '�',
  72969. 'Ꙃ' => 'ꙃ',
  72970. 'Ꙅ' => 'ꙅ',
  72971. 'Ꙇ' => 'ꙇ',
  72972. 'Ꙉ' => 'ꙉ',
  72973. 'Ꙋ' => 'ꙋ',
  72974. 'Ꙍ' => '�',
  72975. 'Ꙏ' => '�',
  72976. '�' => 'ꙑ',
  72977. 'Ꙓ' => 'ꙓ',
  72978. 'Ꙕ' => 'ꙕ',
  72979. 'ê™–' => 'ê™—',
  72980. 'Ꙙ' => 'ꙙ',
  72981. 'Ꙛ' => 'ꙛ',
  72982. 'Ꙝ' => '�',
  72983. 'Ꙟ' => 'ꙟ',
  72984. 'Ꙡ' => 'ꙡ',
  72985. 'Ꙣ' => 'ꙣ',
  72986. 'Ꙥ' => 'ꙥ',
  72987. 'Ꙧ' => 'ꙧ',
  72988. 'Ꙩ' => 'ꙩ',
  72989. 'Ꙫ' => 'ꙫ',
  72990. 'Ꙭ' => 'ꙭ',
  72991. 'Ꚁ' => '�',
  72992. 'Ꚃ' => 'ꚃ',
  72993. 'êš„' => 'êš…',
  72994. 'Ꚇ' => 'ꚇ',
  72995. 'Ꚉ' => 'ꚉ',
  72996. 'Ꚋ' => 'ꚋ',
  72997. 'Ꚍ' => '�',
  72998. 'Ꚏ' => '�',
  72999. '�' => 'ꚑ',
  73000. 'êš’' => 'êš“',
  73001. 'êš”' => 'êš•',
  73002. 'êš–' => 'êš—',
  73003. 'Ꚙ' => 'ꚙ',
  73004. 'êšš' => 'êš›',
  73005. 'Ꜣ' => 'ꜣ',
  73006. 'Ꜥ' => 'ꜥ',
  73007. 'Ꜧ' => 'ꜧ',
  73008. 'Ꜩ' => 'ꜩ',
  73009. 'Ꜫ' => 'ꜫ',
  73010. 'Ꜭ' => 'ꜭ',
  73011. 'Ꜯ' => 'ꜯ',
  73012. 'Ꜳ' => 'ꜳ',
  73013. 'Ꜵ' => 'ꜵ',
  73014. 'Ꜷ' => 'ꜷ',
  73015. 'Ꜹ' => 'ꜹ',
  73016. 'Ꜻ' => 'ꜻ',
  73017. 'Ꜽ' => 'ꜽ',
  73018. 'Ꜿ' => 'ꜿ',
  73019. '�' => '�',
  73020. '�' => '�',
  73021. '�' => '�',
  73022. '�' => '�',
  73023. '�' => '�',
  73024. '�' => '�',
  73025. '�' => '�',
  73026. '�' => '�',
  73027. '�' => '�',
  73028. '�' => '�',
  73029. '�' => '�',
  73030. '�' => '�',
  73031. '�' => '�',
  73032. '�' => '�',
  73033. '�' => '�',
  73034. '�' => '�',
  73035. '�' => '�',
  73036. '�' => '�',
  73037. '�' => '�',
  73038. '�' => '�',
  73039. '�' => '�',
  73040. '�' => '�',
  73041. '�' => '�',
  73042. '�' => '�',
  73043. '�' => '�',
  73044. '�' => '�',
  73045. '�' => 'ᵹ',
  73046. '�' => '�',
  73047. 'Ꞁ' => '�',
  73048. 'Ꞃ' => 'ꞃ',
  73049. 'êž„' => 'êž…',
  73050. 'Ꞇ' => 'ꞇ',
  73051. 'Ꞌ' => 'ꞌ',
  73052. '�' => 'ɥ',
  73053. '�' => 'ꞑ',
  73054. 'êž’' => 'êž“',
  73055. 'êž–' => 'êž—',
  73056. 'Ꞙ' => 'ꞙ',
  73057. 'êžš' => 'êž›',
  73058. 'Ꞝ' => '�',
  73059. 'Ꞟ' => 'ꞟ',
  73060. 'êž ' => 'êž¡',
  73061. 'Ꞣ' => 'ꞣ',
  73062. 'Ꞥ' => 'ꞥ',
  73063. 'Ꞧ' => 'ꞧ',
  73064. 'Ꞩ' => 'ꞩ',
  73065. 'Ɦ' => 'ɦ',
  73066. 'Ɜ' => 'ɜ',
  73067. 'Ɡ' => 'ɡ',
  73068. 'Ɬ' => 'ɬ',
  73069. 'Ɪ' => 'ɪ',
  73070. 'êž°' => 'Êž',
  73071. 'Ʇ' => 'ʇ',
  73072. 'Ʝ' => '�',
  73073. 'êž³' => 'ê­“',
  73074. 'êž´' => 'êžµ',
  73075. 'Ꞷ' => 'ꞷ',
  73076. 'Ꞹ' => 'ꞹ',
  73077. 'Ꞻ' => 'ꞻ',
  73078. 'êž¼' => 'êž½',
  73079. 'êž¾' => 'êž¿',
  73080. 'Ꟃ' => 'ꟃ',
  73081. 'Ꞔ' => 'ꞔ',
  73082. 'Ʂ' => 'ʂ',
  73083. 'Ᶎ' => 'ᶎ',
  73084. 'Ꟈ' => 'ꟈ',
  73085. 'Ꟊ' => 'ꟊ',
  73086. 'Ꟶ' => 'ꟶ',
  73087. 'A' => '�',
  73088. 'B' => 'b',
  73089. 'C' => 'c',
  73090. 'D' => 'd',
  73091. 'ï¼¥' => 'ï½…',
  73092. 'F' => 'f',
  73093. 'G' => 'g',
  73094. 'H' => 'h',
  73095. 'I' => 'i',
  73096. 'J' => 'j',
  73097. 'K' => 'k',
  73098. 'L' => 'l',
  73099. 'M' => '�',
  73100. 'N' => 'n',
  73101. 'O' => '�',
  73102. 'P' => '�',
  73103. 'Q' => 'q',
  73104. 'ï¼²' => 'ï½’',
  73105. 'S' => 's',
  73106. 'ï¼´' => 'ï½”',
  73107. 'U' => 'u',
  73108. 'V' => 'v',
  73109. 'ï¼·' => 'ï½—',
  73110. 'X' => 'x',
  73111. 'ï¼¹' => 'ï½™',
  73112. 'Z' => 'z',
  73113. '�' => '�',
  73114. '�' => '�',
  73115. '�' => '�',
  73116. '�' => '�',
  73117. '�' => '�',
  73118. '�' => '�',
  73119. '�' => '�',
  73120. '�' => '�',
  73121. '�' => '�',
  73122. '�' => '�',
  73123. '�' => '�',
  73124. '�' => '�',
  73125. '�' => '�',
  73126. '�' => '�',
  73127. '�' => '�',
  73128. '�' => '�',
  73129. '�' => '�',
  73130. '�' => '�',
  73131. '�' => '�',
  73132. '�' => '�',
  73133. '�' => '�',
  73134. '�' => '�',
  73135. '�' => '�',
  73136. '�' => '�',
  73137. '�' => '�',
  73138. '�' => '�',
  73139. '�' => '�',
  73140. '�' => '�',
  73141. '�' => '�',
  73142. '�' => '�',
  73143. '�' => '�',
  73144. '�' => '�',
  73145. '�' => '�',
  73146. '�' => '�',
  73147. '�' => '�',
  73148. '�' => '�',
  73149. '�' => '�',
  73150. '�' => '�',
  73151. '�' => '�',
  73152. '�' => '�',
  73153. '�' => '�',
  73154. '�' => '�',
  73155. '�' => '�',
  73156. '�' => '�',
  73157. '�' => '�',
  73158. '�' => '�',
  73159. '�' => '�',
  73160. '�' => '�',
  73161. '�' => '�',
  73162. '�' => '�',
  73163. '�' => '�',
  73164. '�' => '�',
  73165. '�' => '�',
  73166. '�' => '�',
  73167. '�' => '�',
  73168. '�' => '�',
  73169. '�' => '�',
  73170. '�' => '�',
  73171. '�' => '�',
  73172. '�' => '�',
  73173. '�' => '�',
  73174. '�' => '�',
  73175. '�' => '�',
  73176. '�' => '�',
  73177. '�' => '�',
  73178. '�' => '�',
  73179. '�' => '�',
  73180. '�' => '�',
  73181. '�' => '�',
  73182. '�' => '�',
  73183. '�' => '�',
  73184. '�' => '�',
  73185. '�' => '�',
  73186. '�' => '�',
  73187. '�' => '�',
  73188. '�' => '�',
  73189. '�' => '�',
  73190. '�' => '�',
  73191. '�' => '�',
  73192. '�' => '�',
  73193. '�' => '�',
  73194. '�' => '�',
  73195. '�' => '�',
  73196. '�' => '�',
  73197. '�' => '�',
  73198. '�' => '�',
  73199. '�' => '�',
  73200. '�' => '�',
  73201. '�' => '�',
  73202. '�' => '�',
  73203. '�' => '�',
  73204. '�' => '�',
  73205. '�' => '�',
  73206. '�' => '�',
  73207. '�' => '�',
  73208. '�' => '�',
  73209. '�' => '�',
  73210. '�' => '�',
  73211. '�' => '�',
  73212. '�' => '�',
  73213. '�' => '�',
  73214. '�' => '�',
  73215. '�' => '�',
  73216. '�' => '�',
  73217. '�' => '�',
  73218. '�' => '�',
  73219. '�' => '�',
  73220. '�' => '�',
  73221. '�' => '�',
  73222. '�' => '�',
  73223. '�' => '�',
  73224. '�' => '�',
  73225. '�' => '�',
  73226. '�' => '�',
  73227. '�' => '�',
  73228. '�' => '�',
  73229. '�' => '�',
  73230. '�' => '�',
  73231. '�' => '�',
  73232. '�' => '�',
  73233. '�' => '�',
  73234. '�' => '�',
  73235. '�' => '�',
  73236. '�' => '�',
  73237. '�' => '�',
  73238. '�' => '�',
  73239. '�' => '�',
  73240. 'ð‘¢ ' => 'ð‘£€',
  73241. '𑢡' => '�',
  73242. '𑢢' => '𑣂',
  73243. '𑢣' => '𑣃',
  73244. '𑢤' => '𑣄',
  73245. 'ð‘¢¥' => 'ð‘£…',
  73246. '𑢦' => '𑣆',
  73247. '𑢧' => '𑣇',
  73248. '𑢨' => '𑣈',
  73249. '𑢩' => '𑣉',
  73250. '𑢪' => '𑣊',
  73251. '𑢫' => '𑣋',
  73252. '𑢬' => '𑣌',
  73253. '𑢭' => '�',
  73254. '𑢮' => '𑣎',
  73255. '𑢯' => '�',
  73256. '𑢰' => '�',
  73257. '𑢱' => '𑣑',
  73258. 'ð‘¢²' => 'ð‘£’',
  73259. '𑢳' => '𑣓',
  73260. 'ð‘¢´' => 'ð‘£”',
  73261. '𑢵' => '𑣕',
  73262. '𑢶' => '𑣖',
  73263. 'ð‘¢·' => 'ð‘£—',
  73264. '𑢸' => '𑣘',
  73265. 'ð‘¢¹' => 'ð‘£™',
  73266. '𑢺' => '𑣚',
  73267. 'ð‘¢»' => 'ð‘£›',
  73268. '𑢼' => '𑣜',
  73269. '𑢽' => '�',
  73270. '𑢾' => '𑣞',
  73271. '𑢿' => '𑣟',
  73272. 'ð–¹€' => 'ð–¹ ',
  73273. '�' => '𖹡',
  73274. '𖹂' => '𖹢',
  73275. '𖹃' => '𖹣',
  73276. '𖹄' => '𖹤',
  73277. 'ð–¹…' => 'ð–¹¥',
  73278. '𖹆' => '𖹦',
  73279. '𖹇' => '𖹧',
  73280. '𖹈' => '𖹨',
  73281. '𖹉' => '𖹩',
  73282. '𖹊' => '𖹪',
  73283. '𖹋' => '𖹫',
  73284. '𖹌' => '𖹬',
  73285. '�' => '𖹭',
  73286. '𖹎' => '𖹮',
  73287. '�' => '𖹯',
  73288. '�' => '𖹰',
  73289. '𖹑' => '𖹱',
  73290. 'ð–¹’' => 'ð–¹²',
  73291. '𖹓' => '𖹳',
  73292. 'ð–¹”' => 'ð–¹´',
  73293. '𖹕' => '𖹵',
  73294. '𖹖' => '𖹶',
  73295. 'ð–¹—' => 'ð–¹·',
  73296. '𖹘' => '𖹸',
  73297. 'ð–¹™' => 'ð–¹¹',
  73298. '𖹚' => '𖹺',
  73299. 'ð–¹›' => 'ð–¹»',
  73300. '𖹜' => '𖹼',
  73301. '�' => '𖹽',
  73302. '𖹞' => '𖹾',
  73303. '𖹟' => '𖹿',
  73304. '𞤀' => '𞤢',
  73305. '�' => '𞤣',
  73306. '𞤂' => '𞤤',
  73307. '𞤃' => '𞤥',
  73308. '𞤄' => '𞤦',
  73309. '𞤅' => '𞤧',
  73310. '𞤆' => '𞤨',
  73311. '𞤇' => '𞤩',
  73312. '𞤈' => '𞤪',
  73313. '𞤉' => '𞤫',
  73314. '𞤊' => '𞤬',
  73315. '𞤋' => '𞤭',
  73316. '𞤌' => '𞤮',
  73317. '�' => '𞤯',
  73318. '𞤎' => '𞤰',
  73319. '�' => '𞤱',
  73320. '�' => '𞤲',
  73321. '𞤑' => '𞤳',
  73322. '𞤒' => '𞤴',
  73323. '𞤓' => '𞤵',
  73324. '𞤔' => '𞤶',
  73325. '𞤕' => '𞤷',
  73326. '𞤖' => '𞤸',
  73327. '𞤗' => '𞤹',
  73328. '𞤘' => '𞤺',
  73329. '𞤙' => '𞤻',
  73330. '𞤚' => '𞤼',
  73331. '𞤛' => '𞤽',
  73332. '𞤜' => '𞤾',
  73333. '�' => '𞤿',
  73334. '𞤞' => '𞥀',
  73335. '𞤟' => '�',
  73336. '𞤠' => '𞥂',
  73337. '𞤡' => '𞥃',
  73338. );
  73339. <?php
  73340. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  73341. <?php
  73342. return array (
  73343. 'a' => 'A',
  73344. 'b' => 'B',
  73345. 'c' => 'C',
  73346. 'd' => 'D',
  73347. 'e' => 'E',
  73348. 'f' => 'F',
  73349. 'g' => 'G',
  73350. 'h' => 'H',
  73351. 'i' => 'I',
  73352. 'j' => 'J',
  73353. 'k' => 'K',
  73354. 'l' => 'L',
  73355. 'm' => 'M',
  73356. 'n' => 'N',
  73357. 'o' => 'O',
  73358. 'p' => 'P',
  73359. 'q' => 'Q',
  73360. 'r' => 'R',
  73361. 's' => 'S',
  73362. 't' => 'T',
  73363. 'u' => 'U',
  73364. 'v' => 'V',
  73365. 'w' => 'W',
  73366. 'x' => 'X',
  73367. 'y' => 'Y',
  73368. 'z' => 'Z',
  73369. 'µ' => 'Μ',
  73370. 'à' => 'À',
  73371. 'á' => '�',
  73372. 'â' => 'Â',
  73373. 'ã' => 'Ã',
  73374. 'ä' => 'Ä',
  73375. 'Ã¥' => 'Ã…',
  73376. 'æ' => 'Æ',
  73377. 'ç' => 'Ç',
  73378. 'è' => 'È',
  73379. 'é' => 'É',
  73380. 'ê' => 'Ê',
  73381. 'ë' => 'Ë',
  73382. 'ì' => 'Ì',
  73383. 'í' => '�',
  73384. 'î' => 'Î',
  73385. 'ï' => '�',
  73386. 'ð' => '�',
  73387. 'ñ' => 'Ñ',
  73388. 'ò' => 'Ò',
  73389. 'ó' => 'Ó',
  73390. 'ô' => 'Ô',
  73391. 'õ' => 'Õ',
  73392. 'ö' => 'Ö',
  73393. 'ø' => 'Ø',
  73394. 'ù' => 'Ù',
  73395. 'ú' => 'Ú',
  73396. 'û' => 'Û',
  73397. 'ü' => 'Ü',
  73398. 'ý' => '�',
  73399. 'þ' => 'Þ',
  73400. 'ÿ' => 'Ÿ',
  73401. '�' => 'Ā',
  73402. 'ă' => 'Ă',
  73403. 'Ä…' => 'Ä„',
  73404. 'ć' => 'Ć',
  73405. 'ĉ' => 'Ĉ',
  73406. 'Ä‹' => 'ÄŠ',
  73407. '�' => 'Č',
  73408. '�' => 'Ď',
  73409. 'đ' => '�',
  73410. 'Ä“' => 'Ä’',
  73411. 'Ä•' => 'Ä”',
  73412. 'Ä—' => 'Ä–',
  73413. 'ę' => 'Ę',
  73414. 'Ä›' => 'Äš',
  73415. '�' => 'Ĝ',
  73416. 'ÄŸ' => 'Äž',
  73417. 'Ä¡' => 'Ä ',
  73418. 'Ä£' => 'Ä¢',
  73419. 'ĥ' => 'Ĥ',
  73420. 'ħ' => 'Ħ',
  73421. 'ĩ' => 'Ĩ',
  73422. 'ī' => 'Ī',
  73423. 'ĭ' => 'Ĭ',
  73424. 'į' => 'Į',
  73425. 'ı' => 'I',
  73426. 'ij' => 'IJ',
  73427. 'ĵ' => 'Ĵ',
  73428. 'ķ' => 'Ķ',
  73429. 'ĺ' => 'Ĺ',
  73430. 'ļ' => 'Ļ',
  73431. 'ľ' => 'Ľ',
  73432. 'Å€' => 'Ä¿',
  73433. 'ł' => '�',
  73434. 'ń' => 'Ń',
  73435. 'ņ' => 'Ņ',
  73436. 'ň' => 'Ň',
  73437. 'Å‹' => 'ÅŠ',
  73438. '�' => 'Ō',
  73439. '�' => 'Ŏ',
  73440. 'ő' => '�',
  73441. 'Å“' => 'Å’',
  73442. 'Å•' => 'Å”',
  73443. 'Å—' => 'Å–',
  73444. 'ř' => 'Ř',
  73445. 'Å›' => 'Åš',
  73446. '�' => 'Ŝ',
  73447. 'ÅŸ' => 'Åž',
  73448. 'Å¡' => 'Å ',
  73449. 'Å£' => 'Å¢',
  73450. 'ť' => 'Ť',
  73451. 'ŧ' => 'Ŧ',
  73452. 'ũ' => 'Ũ',
  73453. 'ū' => 'Ū',
  73454. 'ŭ' => 'Ŭ',
  73455. 'ů' => 'Ů',
  73456. 'ű' => 'Ű',
  73457. 'ų' => 'Ų',
  73458. 'ŵ' => 'Ŵ',
  73459. 'ŷ' => 'Ŷ',
  73460. 'ź' => 'Ź',
  73461. 'ż' => 'Ż',
  73462. 'ž' => 'Ž',
  73463. 'Å¿' => 'S',
  73464. 'ƀ' => 'Ƀ',
  73465. 'ƃ' => 'Ƃ',
  73466. 'Æ…' => 'Æ„',
  73467. 'ƈ' => 'Ƈ',
  73468. 'ƌ' => 'Ƌ',
  73469. 'Æ’' => 'Æ‘',
  73470. 'ƕ' => 'Ƕ',
  73471. 'ƙ' => 'Ƙ',
  73472. 'ƚ' => 'Ƚ',
  73473. 'Æž' => 'È ',
  73474. 'Æ¡' => 'Æ ',
  73475. 'Æ£' => 'Æ¢',
  73476. 'ƥ' => 'Ƥ',
  73477. 'ƨ' => 'Ƨ',
  73478. 'ƭ' => 'Ƭ',
  73479. 'ư' => 'Ư',
  73480. 'ƴ' => 'Ƴ',
  73481. 'ƶ' => 'Ƶ',
  73482. 'ƹ' => 'Ƹ',
  73483. 'ƽ' => 'Ƽ',
  73484. 'Æ¿' => 'Ç·',
  73485. 'Ç…' => 'Ç„',
  73486. 'dž' => 'DŽ',
  73487. 'Lj' => 'LJ',
  73488. 'lj' => 'LJ',
  73489. 'Ç‹' => 'ÇŠ',
  73490. 'nj' => 'NJ',
  73491. 'ǎ' => '�',
  73492. '�' => '�',
  73493. 'Ç’' => 'Ç‘',
  73494. 'Ç”' => 'Ç“',
  73495. 'Ç–' => 'Ç•',
  73496. 'ǘ' => 'Ǘ',
  73497. 'Çš' => 'Ç™',
  73498. 'ǜ' => 'Ǜ',
  73499. '�' => 'Ǝ',
  73500. 'ÇŸ' => 'Çž',
  73501. 'Ç¡' => 'Ç ',
  73502. 'Ç£' => 'Ç¢',
  73503. 'ǥ' => 'Ǥ',
  73504. 'ǧ' => 'Ǧ',
  73505. 'ǩ' => 'Ǩ',
  73506. 'ǫ' => 'Ǫ',
  73507. 'ǭ' => 'Ǭ',
  73508. 'ǯ' => 'Ǯ',
  73509. 'Dz' => 'DZ',
  73510. 'dz' => 'DZ',
  73511. 'ǵ' => 'Ǵ',
  73512. 'ǹ' => 'Ǹ',
  73513. 'ǻ' => 'Ǻ',
  73514. 'ǽ' => 'Ǽ',
  73515. 'ǿ' => 'Ǿ',
  73516. '�' => 'Ȁ',
  73517. 'ȃ' => 'Ȃ',
  73518. 'È…' => 'È„',
  73519. 'ȇ' => 'Ȇ',
  73520. 'ȉ' => 'Ȉ',
  73521. 'È‹' => 'ÈŠ',
  73522. '�' => 'Ȍ',
  73523. '�' => 'Ȏ',
  73524. 'ȑ' => '�',
  73525. 'È“' => 'È’',
  73526. 'È•' => 'È”',
  73527. 'È—' => 'È–',
  73528. 'ș' => 'Ș',
  73529. 'È›' => 'Èš',
  73530. '�' => 'Ȝ',
  73531. 'ÈŸ' => 'Èž',
  73532. 'È£' => 'È¢',
  73533. 'ȥ' => 'Ȥ',
  73534. 'ȧ' => 'Ȧ',
  73535. 'ȩ' => 'Ȩ',
  73536. 'ȫ' => 'Ȫ',
  73537. 'ȭ' => 'Ȭ',
  73538. 'ȯ' => 'Ȯ',
  73539. 'ȱ' => 'Ȱ',
  73540. 'ȳ' => 'Ȳ',
  73541. 'ȼ' => 'Ȼ',
  73542. 'È¿' => 'â±¾',
  73543. 'ɀ' => 'Ɀ',
  73544. 'ɂ' => '�',
  73545. 'ɇ' => 'Ɇ',
  73546. 'ɉ' => 'Ɉ',
  73547. 'É‹' => 'ÉŠ',
  73548. '�' => 'Ɍ',
  73549. '�' => 'Ɏ',
  73550. '�' => 'Ɐ',
  73551. 'É‘' => 'â±­',
  73552. 'É’' => 'â±°',
  73553. 'ɓ' => '�',
  73554. 'ɔ' => 'Ɔ',
  73555. 'ɖ' => 'Ɖ',
  73556. 'É—' => 'ÆŠ',
  73557. 'ə' => '�',
  73558. 'ɛ' => '�',
  73559. 'ɜ' => 'Ɜ',
  73560. 'É ' => 'Æ“',
  73561. 'ɡ' => 'Ɡ',
  73562. 'É£' => 'Æ”',
  73563. 'ɥ' => '�',
  73564. 'ɦ' => 'Ɦ',
  73565. 'ɨ' => 'Ɨ',
  73566. 'É©' => 'Æ–',
  73567. 'ɪ' => 'Ɪ',
  73568. 'É«' => 'â±¢',
  73569. 'ɬ' => 'Ɬ',
  73570. 'ɯ' => 'Ɯ',
  73571. 'ɱ' => 'Ɱ',
  73572. 'ɲ' => '�',
  73573. 'ɵ' => 'Ɵ',
  73574. 'ɽ' => 'Ɽ',
  73575. 'ʀ' => 'Ʀ',
  73576. 'ʂ' => 'Ʂ',
  73577. 'ʃ' => 'Ʃ',
  73578. 'ʇ' => 'Ʇ',
  73579. 'ʈ' => 'Ʈ',
  73580. 'ʉ' => 'Ʉ',
  73581. 'ʊ' => 'Ʊ',
  73582. 'ʋ' => 'Ʋ',
  73583. 'ʌ' => 'Ʌ',
  73584. 'Ê’' => 'Æ·',
  73585. '�' => 'Ʝ',
  73586. 'Êž' => 'êž°',
  73587. 'ͅ' => 'Ι',
  73588. 'ͱ' => 'Ͱ',
  73589. 'ͳ' => 'Ͳ',
  73590. 'ͷ' => 'Ͷ',
  73591. 'ͻ' => 'Ͻ',
  73592. 'ͼ' => 'Ͼ',
  73593. 'ͽ' => 'Ͽ',
  73594. 'ά' => 'Ά',
  73595. 'έ' => 'Έ',
  73596. 'ή' => 'Ή',
  73597. 'ί' => 'Ί',
  73598. 'α' => 'Α',
  73599. 'β' => 'Β',
  73600. 'γ' => 'Γ',
  73601. 'δ' => 'Δ',
  73602. 'ε' => 'Ε',
  73603. 'ζ' => 'Ζ',
  73604. 'η' => 'Η',
  73605. 'θ' => 'Θ',
  73606. 'ι' => 'Ι',
  73607. 'κ' => 'Κ',
  73608. 'λ' => 'Λ',
  73609. 'μ' => 'Μ',
  73610. 'ν' => '�',
  73611. 'ξ' => 'Ξ',
  73612. 'ο' => 'Ο',
  73613. 'π' => 'Π',
  73614. '�' => 'Ρ',
  73615. 'ς' => 'Σ',
  73616. 'σ' => 'Σ',
  73617. 'τ' => 'Τ',
  73618. 'Ï…' => 'Î¥',
  73619. 'φ' => 'Φ',
  73620. 'χ' => 'Χ',
  73621. 'ψ' => 'Ψ',
  73622. 'ω' => 'Ω',
  73623. 'ϊ' => 'Ϊ',
  73624. 'ϋ' => 'Ϋ',
  73625. 'ό' => 'Ό',
  73626. '�' => 'Ύ',
  73627. 'ώ' => '�',
  73628. '�' => 'Β',
  73629. 'ϑ' => 'Θ',
  73630. 'ϕ' => 'Φ',
  73631. 'ϖ' => 'Π',
  73632. 'ϗ' => '�',
  73633. 'ϙ' => 'Ϙ',
  73634. 'Ï›' => 'Ïš',
  73635. '�' => 'Ϝ',
  73636. 'ÏŸ' => 'Ïž',
  73637. 'Ï¡' => 'Ï ',
  73638. 'Ï£' => 'Ï¢',
  73639. 'ϥ' => 'Ϥ',
  73640. 'ϧ' => 'Ϧ',
  73641. 'ϩ' => 'Ϩ',
  73642. 'ϫ' => 'Ϫ',
  73643. 'ϭ' => 'Ϭ',
  73644. 'ϯ' => 'Ϯ',
  73645. 'ϰ' => 'Κ',
  73646. 'ϱ' => 'Ρ',
  73647. 'ϲ' => 'Ϲ',
  73648. 'ϳ' => 'Ϳ',
  73649. 'ϵ' => 'Ε',
  73650. 'ϸ' => 'Ϸ',
  73651. 'ϻ' => 'Ϻ',
  73652. 'а' => '�',
  73653. 'б' => 'Б',
  73654. 'в' => 'В',
  73655. 'г' => 'Г',
  73656. 'д' => 'Д',
  73657. 'е' => 'Е',
  73658. 'ж' => 'Ж',
  73659. 'з' => 'З',
  73660. 'и' => 'И',
  73661. 'й' => 'Й',
  73662. 'к' => 'К',
  73663. 'л' => 'Л',
  73664. 'м' => 'М',
  73665. 'н' => '�',
  73666. 'о' => 'О',
  73667. 'п' => 'П',
  73668. 'р' => 'Р',
  73669. '�' => 'С',
  73670. 'т' => 'Т',
  73671. 'у' => 'У',
  73672. 'ф' => 'Ф',
  73673. 'Ñ…' => 'Ð¥',
  73674. 'ц' => 'Ц',
  73675. 'ч' => 'Ч',
  73676. 'ш' => 'Ш',
  73677. 'щ' => 'Щ',
  73678. 'ъ' => 'Ъ',
  73679. 'ы' => 'Ы',
  73680. 'ь' => 'Ь',
  73681. '�' => 'Э',
  73682. 'ю' => 'Ю',
  73683. '�' => 'Я',
  73684. '�' => 'Ѐ',
  73685. 'ё' => '�',
  73686. 'ђ' => 'Ђ',
  73687. 'ѓ' => 'Ѓ',
  73688. 'є' => 'Є',
  73689. 'Ñ•' => 'Ð…',
  73690. 'і' => 'І',
  73691. 'ї' => 'Ї',
  73692. 'ј' => 'Ј',
  73693. 'љ' => 'Љ',
  73694. 'њ' => 'Њ',
  73695. 'ћ' => 'Ћ',
  73696. 'ќ' => 'Ќ',
  73697. '�' => '�',
  73698. 'Ñž' => 'ÐŽ',
  73699. 'џ' => '�',
  73700. 'Ñ¡' => 'Ñ ',
  73701. 'Ñ£' => 'Ñ¢',
  73702. 'ѥ' => 'Ѥ',
  73703. 'ѧ' => 'Ѧ',
  73704. 'ѩ' => 'Ѩ',
  73705. 'ѫ' => 'Ѫ',
  73706. 'ѭ' => 'Ѭ',
  73707. 'ѯ' => 'Ѯ',
  73708. 'ѱ' => 'Ѱ',
  73709. 'ѳ' => 'Ѳ',
  73710. 'ѵ' => 'Ѵ',
  73711. 'ѷ' => 'Ѷ',
  73712. 'ѹ' => 'Ѹ',
  73713. 'ѻ' => 'Ѻ',
  73714. 'ѽ' => 'Ѽ',
  73715. 'ѿ' => 'Ѿ',
  73716. 'Ò�' => 'Ò€',
  73717. 'Ò‹' => 'ÒŠ',
  73718. '�' => 'Ҍ',
  73719. 'Ò�' => 'ÒŽ',
  73720. 'Ò‘' => 'Ò�',
  73721. 'Ò“' => 'Ò’',
  73722. 'Ò•' => 'Ò”',
  73723. 'Ò—' => 'Ò–',
  73724. 'Ò™' => 'Ò˜',
  73725. 'Ò›' => 'Òš',
  73726. '�' => 'Ҝ',
  73727. 'ÒŸ' => 'Òž',
  73728. 'Ò¡' => 'Ò ',
  73729. 'Ò£' => 'Ò¢',
  73730. 'Ò¥' => 'Ò¤',
  73731. 'Ò§' => 'Ò¦',
  73732. 'Ò©' => 'Ò¨',
  73733. 'Ò«' => 'Òª',
  73734. 'Ò­' => 'Ò¬',
  73735. 'Ò¯' => 'Ò®',
  73736. 'Ò±' => 'Ò°',
  73737. 'Ò³' => 'Ò²',
  73738. 'Òµ' => 'Ò´',
  73739. 'Ò·' => 'Ò¶',
  73740. 'Ò¹' => 'Ò¸',
  73741. 'Ò»' => 'Òº',
  73742. 'Ò½' => 'Ò¼',
  73743. 'Ò¿' => 'Ò¾',
  73744. 'Ó‚' => 'Ó�',
  73745. 'Ó„' => 'Óƒ',
  73746. 'Ó†' => 'Ó…',
  73747. 'Óˆ' => 'Ó‡',
  73748. 'ÓŠ' => 'Ó‰',
  73749. 'ӌ' => 'Ӌ',
  73750. 'ÓŽ' => 'Ó�',
  73751. 'Ó�' => 'Ó€',
  73752. 'Ó‘' => 'Ó�',
  73753. 'Ó“' => 'Ó’',
  73754. 'Ó•' => 'Ó”',
  73755. 'Ó—' => 'Ó–',
  73756. 'Ó™' => 'Ó˜',
  73757. 'Ó›' => 'Óš',
  73758. '�' => 'Ӝ',
  73759. 'ÓŸ' => 'Óž',
  73760. 'Ó¡' => 'Ó ',
  73761. 'Ó£' => 'Ó¢',
  73762. 'Ó¥' => 'Ó¤',
  73763. 'Ó§' => 'Ó¦',
  73764. 'Ó©' => 'Ó¨',
  73765. 'Ó«' => 'Óª',
  73766. 'Ó­' => 'Ó¬',
  73767. 'Ó¯' => 'Ó®',
  73768. 'Ó±' => 'Ó°',
  73769. 'Ó³' => 'Ó²',
  73770. 'Óµ' => 'Ó´',
  73771. 'Ó·' => 'Ó¶',
  73772. 'Ó¹' => 'Ó¸',
  73773. 'Ó»' => 'Óº',
  73774. 'Ó½' => 'Ó¼',
  73775. 'Ó¿' => 'Ó¾',
  73776. 'Ô�' => 'Ô€',
  73777. 'Ôƒ' => 'Ô‚',
  73778. 'Ô…' => 'Ô„',
  73779. 'Ô‡' => 'Ô†',
  73780. 'Ô‰' => 'Ôˆ',
  73781. 'Ô‹' => 'ÔŠ',
  73782. '�' => 'Ԍ',
  73783. 'Ô�' => 'ÔŽ',
  73784. 'Ô‘' => 'Ô�',
  73785. 'Ô“' => 'Ô’',
  73786. 'Ô•' => 'Ô”',
  73787. 'Ô—' => 'Ô–',
  73788. 'Ô™' => 'Ô˜',
  73789. 'Ô›' => 'Ôš',
  73790. '�' => 'Ԝ',
  73791. 'ÔŸ' => 'Ôž',
  73792. 'Ô¡' => 'Ô ',
  73793. 'Ô£' => 'Ô¢',
  73794. 'Ô¥' => 'Ô¤',
  73795. 'Ô§' => 'Ô¦',
  73796. 'Ô©' => 'Ô¨',
  73797. 'Ô«' => 'Ôª',
  73798. 'Ô­' => 'Ô¬',
  73799. 'Ô¯' => 'Ô®',
  73800. 'Õ¡' => 'Ô±',
  73801. 'Õ¢' => 'Ô²',
  73802. 'Õ£' => 'Ô³',
  73803. 'Õ¤' => 'Ô´',
  73804. 'Õ¥' => 'Ôµ',
  73805. 'Õ¦' => 'Ô¶',
  73806. 'Õ§' => 'Ô·',
  73807. 'Õ¨' => 'Ô¸',
  73808. 'Õ©' => 'Ô¹',
  73809. 'Õª' => 'Ôº',
  73810. 'Õ«' => 'Ô»',
  73811. 'Õ¬' => 'Ô¼',
  73812. 'Õ­' => 'Ô½',
  73813. 'Õ®' => 'Ô¾',
  73814. 'Õ¯' => 'Ô¿',
  73815. 'Õ°' => 'Õ€',
  73816. 'Õ±' => 'Õ�',
  73817. 'Õ²' => 'Õ‚',
  73818. 'Õ³' => 'Õƒ',
  73819. 'Õ´' => 'Õ„',
  73820. 'Õµ' => 'Õ…',
  73821. 'Õ¶' => 'Õ†',
  73822. 'Õ·' => 'Õ‡',
  73823. 'Õ¸' => 'Õˆ',
  73824. 'Õ¹' => 'Õ‰',
  73825. 'Õº' => 'ÕŠ',
  73826. 'Õ»' => 'Õ‹',
  73827. 'ռ' => 'Ռ',
  73828. 'Õ½' => 'Õ�',
  73829. 'Õ¾' => 'ÕŽ',
  73830. 'Õ¿' => 'Õ�',
  73831. 'Ö€' => 'Õ�',
  73832. 'Ö�' => 'Õ‘',
  73833. 'Ö‚' => 'Õ’',
  73834. 'Öƒ' => 'Õ“',
  73835. 'Ö„' => 'Õ”',
  73836. 'Ö…' => 'Õ•',
  73837. 'Ö†' => 'Õ–',
  73838. '�' => '�',
  73839. 'ბ' => 'Ბ',
  73840. 'გ' => 'Გ',
  73841. 'დ' => 'Დ',
  73842. 'ე' => 'Ე',
  73843. 'ვ' => 'Ვ',
  73844. 'ზ' => 'Ზ',
  73845. 'თ' => 'Თ',
  73846. 'ი' => 'Ი',
  73847. 'კ' => 'Კ',
  73848. 'ლ' => 'Ლ',
  73849. 'მ' => 'Მ',
  73850. 'ნ' => 'Ნ',
  73851. '�' => '�',
  73852. 'პ' => 'Პ',
  73853. 'ჟ' => 'Ჟ',
  73854. 'რ' => 'Რ',
  73855. 'ს' => 'Ს',
  73856. 'ტ' => 'Ტ',
  73857. 'უ' => 'Უ',
  73858. 'ფ' => 'Ფ',
  73859. 'ქ' => 'Ქ',
  73860. 'ღ' => 'Ღ',
  73861. 'ყ' => 'Ყ',
  73862. 'შ' => 'Შ',
  73863. 'ჩ' => 'Ჩ',
  73864. 'ც' => 'Ც',
  73865. 'ძ' => 'Ძ',
  73866. 'წ' => 'Წ',
  73867. 'ჭ' => 'Ჭ',
  73868. 'ხ' => 'Ხ',
  73869. 'ჯ' => 'Ჯ',
  73870. 'ჰ' => 'Ჰ',
  73871. 'ჱ' => 'Ჱ',
  73872. 'ჲ' => 'Ჲ',
  73873. 'ჳ' => 'Ჳ',
  73874. 'ჴ' => 'Ჴ',
  73875. 'ჵ' => 'Ჵ',
  73876. 'ჶ' => 'Ჶ',
  73877. 'ჷ' => 'Ჷ',
  73878. 'ჸ' => 'Ჸ',
  73879. 'ჹ' => 'Ჹ',
  73880. 'ჺ' => 'Ჺ',
  73881. 'ჽ' => 'Ჽ',
  73882. 'ჾ' => 'Ჾ',
  73883. 'ჿ' => 'Ჿ',
  73884. '�' => '�',
  73885. '�' => '�',
  73886. '�' => '�',
  73887. '�' => '�',
  73888. '�' => '�',
  73889. '�' => '�',
  73890. 'á²€' => 'Ð’',
  73891. '�' => 'Д',
  73892. 'ᲂ' => 'О',
  73893. 'ᲃ' => 'С',
  73894. 'ᲄ' => 'Т',
  73895. 'ᲅ' => 'Т',
  73896. 'ᲆ' => 'Ъ',
  73897. 'ᲇ' => 'Ѣ',
  73898. 'ᲈ' => 'Ꙋ',
  73899. 'ᵹ' => '�',
  73900. 'áµ½' => 'â±£',
  73901. 'ᶎ' => 'Ᶎ',
  73902. '�' => 'Ḁ',
  73903. 'ḃ' => 'Ḃ',
  73904. 'ḅ' => 'Ḅ',
  73905. 'ḇ' => 'Ḇ',
  73906. 'ḉ' => 'Ḉ',
  73907. 'ḋ' => 'Ḋ',
  73908. '�' => 'Ḍ',
  73909. '�' => 'Ḏ',
  73910. 'ḑ' => '�',
  73911. 'ḓ' => 'Ḓ',
  73912. 'ḕ' => 'Ḕ',
  73913. 'ḗ' => 'Ḗ',
  73914. 'ḙ' => 'Ḙ',
  73915. 'ḛ' => 'Ḛ',
  73916. '�' => 'Ḝ',
  73917. 'ḟ' => 'Ḟ',
  73918. 'ḡ' => 'Ḡ',
  73919. 'ḣ' => 'Ḣ',
  73920. 'ḥ' => 'Ḥ',
  73921. 'ḧ' => 'Ḧ',
  73922. 'ḩ' => 'Ḩ',
  73923. 'ḫ' => 'Ḫ',
  73924. 'ḭ' => 'Ḭ',
  73925. 'ḯ' => 'Ḯ',
  73926. 'ḱ' => 'Ḱ',
  73927. 'ḳ' => 'Ḳ',
  73928. 'ḵ' => 'Ḵ',
  73929. 'ḷ' => 'Ḷ',
  73930. 'ḹ' => 'Ḹ',
  73931. 'ḻ' => 'Ḻ',
  73932. 'ḽ' => 'Ḽ',
  73933. 'ḿ' => 'Ḿ',
  73934. '�' => 'Ṁ',
  73935. 'ṃ' => 'Ṃ',
  73936. 'ṅ' => 'Ṅ',
  73937. 'ṇ' => 'Ṇ',
  73938. 'ṉ' => 'Ṉ',
  73939. 'ṋ' => 'Ṋ',
  73940. '�' => 'Ṍ',
  73941. '�' => 'Ṏ',
  73942. 'ṑ' => '�',
  73943. 'ṓ' => 'Ṓ',
  73944. 'ṕ' => 'Ṕ',
  73945. 'á¹—' => 'á¹–',
  73946. 'ṙ' => 'Ṙ',
  73947. 'ṛ' => 'Ṛ',
  73948. '�' => 'Ṝ',
  73949. 'ṟ' => 'Ṟ',
  73950. 'ṡ' => 'Ṡ',
  73951. 'á¹£' => 'á¹¢',
  73952. 'ṥ' => 'Ṥ',
  73953. 'ṧ' => 'Ṧ',
  73954. 'ṩ' => 'Ṩ',
  73955. 'ṫ' => 'Ṫ',
  73956. 'ṭ' => 'Ṭ',
  73957. 'ṯ' => 'Ṯ',
  73958. 'á¹±' => 'á¹°',
  73959. 'á¹³' => 'á¹²',
  73960. 'á¹µ' => 'á¹´',
  73961. 'ṷ' => 'Ṷ',
  73962. 'ṹ' => 'Ṹ',
  73963. 'ṻ' => 'Ṻ',
  73964. 'á¹½' => 'á¹¼',
  73965. 'ṿ' => 'Ṿ',
  73966. '�' => 'Ẁ',
  73967. 'ẃ' => 'Ẃ',
  73968. 'ẅ' => 'Ẅ',
  73969. 'ẇ' => 'Ẇ',
  73970. 'ẉ' => 'Ẉ',
  73971. 'ẋ' => 'Ẋ',
  73972. '�' => 'Ẍ',
  73973. '�' => 'Ẏ',
  73974. 'ẑ' => '�',
  73975. 'ẓ' => 'Ẓ',
  73976. 'ẕ' => 'Ẕ',
  73977. 'ẛ' => 'Ṡ',
  73978. 'ạ' => 'Ạ',
  73979. 'ả' => 'Ả',
  73980. 'ấ' => 'Ấ',
  73981. 'ầ' => 'Ầ',
  73982. 'ẩ' => 'Ẩ',
  73983. 'ẫ' => 'Ẫ',
  73984. 'ậ' => 'Ậ',
  73985. 'ắ' => 'Ắ',
  73986. 'ằ' => 'Ằ',
  73987. 'ẳ' => 'Ẳ',
  73988. 'ẵ' => 'Ẵ',
  73989. 'ặ' => 'Ặ',
  73990. 'ẹ' => 'Ẹ',
  73991. 'ẻ' => 'Ẻ',
  73992. 'ẽ' => 'Ẽ',
  73993. 'ế' => 'Ế',
  73994. '�' => 'Ề',
  73995. 'ể' => 'Ể',
  73996. 'ễ' => 'Ễ',
  73997. 'ệ' => 'Ệ',
  73998. 'ỉ' => 'Ỉ',
  73999. 'ị' => 'Ị',
  74000. '�' => 'Ọ',
  74001. '�' => 'Ỏ',
  74002. 'ố' => '�',
  74003. 'ồ' => 'Ồ',
  74004. 'ổ' => 'Ổ',
  74005. 'á»—' => 'á»–',
  74006. 'ộ' => 'Ộ',
  74007. 'ớ' => 'Ớ',
  74008. '�' => 'Ờ',
  74009. 'ở' => 'Ở',
  74010. 'ỡ' => 'Ỡ',
  74011. 'ợ' => 'Ợ',
  74012. 'ụ' => 'Ụ',
  74013. 'ủ' => 'Ủ',
  74014. 'ứ' => 'Ứ',
  74015. 'ừ' => 'Ừ',
  74016. 'ử' => 'Ử',
  74017. 'ữ' => 'Ữ',
  74018. 'á»±' => 'á»°',
  74019. 'ỳ' => 'Ỳ',
  74020. 'ỵ' => 'Ỵ',
  74021. 'ỷ' => 'Ỷ',
  74022. 'ỹ' => 'Ỹ',
  74023. 'ỻ' => 'Ỻ',
  74024. 'ỽ' => 'Ỽ',
  74025. 'ỿ' => 'Ỿ',
  74026. 'ἀ' => 'Ἀ',
  74027. '�' => 'Ἁ',
  74028. 'ἂ' => 'Ἂ',
  74029. 'ἃ' => 'Ἃ',
  74030. 'ἄ' => 'Ἄ',
  74031. 'ἅ' => '�',
  74032. 'ἆ' => 'Ἆ',
  74033. 'ἇ' => '�',
  74034. '�' => 'Ἐ',
  74035. 'ἑ' => 'Ἑ',
  74036. 'ἒ' => 'Ἒ',
  74037. 'ἓ' => 'Ἓ',
  74038. 'ἔ' => 'Ἔ',
  74039. 'ἕ' => '�',
  74040. 'ἠ' => 'Ἠ',
  74041. 'ἡ' => 'Ἡ',
  74042. 'ἢ' => 'Ἢ',
  74043. 'ἣ' => 'Ἣ',
  74044. 'ἤ' => 'Ἤ',
  74045. 'á¼¥' => 'á¼­',
  74046. 'ἦ' => 'Ἦ',
  74047. 'ἧ' => 'Ἧ',
  74048. 'ἰ' => 'Ἰ',
  74049. 'á¼±' => 'á¼¹',
  74050. 'ἲ' => 'Ἲ',
  74051. 'á¼³' => 'á¼»',
  74052. 'á¼´' => 'á¼¼',
  74053. 'á¼µ' => 'á¼½',
  74054. 'ἶ' => 'Ἶ',
  74055. 'ἷ' => 'Ἷ',
  74056. 'ὀ' => 'Ὀ',
  74057. '�' => 'Ὁ',
  74058. 'ὂ' => 'Ὂ',
  74059. 'ὃ' => 'Ὃ',
  74060. 'ὄ' => 'Ὄ',
  74061. 'ὅ' => '�',
  74062. 'ὑ' => 'Ὑ',
  74063. 'ὓ' => 'Ὓ',
  74064. 'ὕ' => '�',
  74065. 'ὗ' => 'Ὗ',
  74066. 'ὠ' => 'Ὠ',
  74067. 'ὡ' => 'Ὡ',
  74068. 'ὢ' => 'Ὢ',
  74069. 'ὣ' => 'Ὣ',
  74070. 'ὤ' => 'Ὤ',
  74071. 'á½¥' => 'á½­',
  74072. 'ὦ' => 'Ὦ',
  74073. 'ὧ' => 'Ὧ',
  74074. 'ὰ' => 'Ὰ',
  74075. 'á½±' => 'á¾»',
  74076. 'ὲ' => 'Ὲ',
  74077. 'έ' => 'Έ',
  74078. 'á½´' => 'á¿Š',
  74079. 'á½µ' => 'á¿‹',
  74080. 'ὶ' => 'Ὶ',
  74081. 'á½·' => 'á¿›',
  74082. 'ὸ' => 'Ὸ',
  74083. 'ό' => 'Ό',
  74084. 'ὺ' => 'Ὺ',
  74085. 'á½»' => 'á¿«',
  74086. 'ὼ' => 'Ὼ',
  74087. 'á½½' => 'á¿»',
  74088. 'ᾀ' => 'ἈΙ',
  74089. '�' => 'ἉΙ',
  74090. 'ᾂ' => 'ἊΙ',
  74091. 'ᾃ' => 'ἋΙ',
  74092. 'ᾄ' => 'ἌΙ',
  74093. 'ᾅ' => '�Ι',
  74094. 'ᾆ' => 'ἎΙ',
  74095. 'ᾇ' => '�Ι',
  74096. '�' => 'ἨΙ',
  74097. 'ᾑ' => 'ἩΙ',
  74098. 'ᾒ' => 'ἪΙ',
  74099. 'ᾓ' => 'ἫΙ',
  74100. 'ᾔ' => 'ἬΙ',
  74101. 'ᾕ' => 'ἭΙ',
  74102. 'ᾖ' => 'ἮΙ',
  74103. 'ᾗ' => 'ἯΙ',
  74104. 'ᾠ' => 'ὨΙ',
  74105. 'ᾡ' => 'ὩΙ',
  74106. 'ᾢ' => 'ὪΙ',
  74107. 'ᾣ' => 'ὫΙ',
  74108. 'ᾤ' => 'ὬΙ',
  74109. 'ᾥ' => 'ὭΙ',
  74110. 'ᾦ' => 'ὮΙ',
  74111. 'ᾧ' => 'ὯΙ',
  74112. 'ᾰ' => 'Ᾰ',
  74113. 'á¾±' => 'á¾¹',
  74114. 'ᾳ' => 'ΑΙ',
  74115. 'ι' => 'Ι',
  74116. 'ῃ' => 'ΗΙ',
  74117. '�' => 'Ῐ',
  74118. 'á¿‘' => 'á¿™',
  74119. 'ῠ' => 'Ῠ',
  74120. 'á¿¡' => 'á¿©',
  74121. 'ῥ' => 'Ῥ',
  74122. 'ῳ' => 'ΩΙ',
  74123. 'ⅎ' => 'Ⅎ',
  74124. 'â…°' => 'â… ',
  74125. 'â…±' => 'â…¡',
  74126. 'â…²' => 'â…¢',
  74127. 'â…³' => 'â…£',
  74128. 'â…´' => 'â…¤',
  74129. 'â…µ' => 'â…¥',
  74130. 'â…¶' => 'â…¦',
  74131. 'â…·' => 'â…§',
  74132. 'â…¸' => 'â…¨',
  74133. 'â…¹' => 'â…©',
  74134. 'â…º' => 'â…ª',
  74135. 'â…»' => 'â…«',
  74136. 'â…¼' => 'â…¬',
  74137. 'â…½' => 'â…­',
  74138. 'â…¾' => 'â…®',
  74139. 'â…¿' => 'â…¯',
  74140. 'ↄ' => 'Ↄ',
  74141. '�' => 'Ⓐ',
  74142. 'â“‘' => 'â’·',
  74143. 'â“’' => 'â’¸',
  74144. 'â““' => 'â’¹',
  74145. 'â“”' => 'â’º',
  74146. 'â“•' => 'â’»',
  74147. 'â“–' => 'â’¼',
  74148. 'â“—' => 'â’½',
  74149. 'ⓘ' => 'Ⓘ',
  74150. 'â“™' => 'â’¿',
  74151. 'â“š' => 'â“€',
  74152. 'ⓛ' => '�',
  74153. 'ⓜ' => 'Ⓜ',
  74154. '�' => 'Ⓝ',
  74155. 'â“ž' => 'â“„',
  74156. 'â“Ÿ' => 'â“…',
  74157. 'ⓠ' => 'Ⓠ',
  74158. 'ⓡ' => 'Ⓡ',
  74159. 'ⓢ' => 'Ⓢ',
  74160. 'ⓣ' => 'Ⓣ',
  74161. 'ⓤ' => 'Ⓤ',
  74162. 'â“¥' => 'â“‹',
  74163. 'ⓦ' => 'Ⓦ',
  74164. 'ⓧ' => '�',
  74165. 'ⓨ' => 'Ⓨ',
  74166. 'ⓩ' => '�',
  74167. 'â°°' => 'â°€',
  74168. 'â°±' => 'â°�',
  74169. 'â°²' => 'â°‚',
  74170. 'â°³' => 'â°ƒ',
  74171. 'â°´' => 'â°„',
  74172. 'â°µ' => 'â°…',
  74173. 'â°¶' => 'â°†',
  74174. 'â°·' => 'â°‡',
  74175. 'â°¸' => 'â°ˆ',
  74176. 'â°¹' => 'â°‰',
  74177. 'â°º' => 'â°Š',
  74178. 'â°»' => 'â°‹',
  74179. 'ⰼ' => 'Ⰼ',
  74180. 'â°½' => 'â°�',
  74181. 'â°¾' => 'â°Ž',
  74182. 'â°¿' => 'â°�',
  74183. 'â±€' => 'â°�',
  74184. '�' => 'Ⱁ',
  74185. 'ⱂ' => 'Ⱂ',
  74186. 'ⱃ' => 'Ⱃ',
  74187. 'ⱄ' => 'Ⱄ',
  74188. 'â±…' => 'â°•',
  74189. 'ⱆ' => 'Ⱆ',
  74190. 'ⱇ' => 'Ⱇ',
  74191. 'ⱈ' => 'Ⱈ',
  74192. 'ⱉ' => 'Ⱉ',
  74193. 'ⱊ' => 'Ⱊ',
  74194. 'ⱋ' => 'Ⱋ',
  74195. 'ⱌ' => 'Ⱌ',
  74196. '�' => '�',
  74197. 'ⱎ' => 'Ⱎ',
  74198. '�' => 'Ⱏ',
  74199. '�' => 'Ⱐ',
  74200. 'ⱑ' => 'Ⱑ',
  74201. 'â±’' => 'â°¢',
  74202. 'ⱓ' => 'Ⱓ',
  74203. 'â±”' => 'â°¤',
  74204. 'ⱕ' => 'Ⱕ',
  74205. 'â±–' => 'â°¦',
  74206. 'â±—' => 'â°§',
  74207. 'ⱘ' => 'Ⱘ',
  74208. 'â±™' => 'â°©',
  74209. 'ⱚ' => 'Ⱚ',
  74210. 'â±›' => 'â°«',
  74211. 'ⱜ' => 'Ⱜ',
  74212. '�' => 'Ⱝ',
  74213. 'ⱞ' => 'Ⱞ',
  74214. 'ⱡ' => 'Ⱡ',
  74215. 'ⱥ' => 'Ⱥ',
  74216. 'ⱦ' => 'Ⱦ',
  74217. 'ⱨ' => 'Ⱨ',
  74218. 'ⱪ' => 'Ⱪ',
  74219. 'ⱬ' => 'Ⱬ',
  74220. 'â±³' => 'â±²',
  74221. 'ⱶ' => 'Ⱶ',
  74222. '�' => 'Ⲁ',
  74223. 'ⲃ' => 'Ⲃ',
  74224. 'ⲅ' => 'Ⲅ',
  74225. 'ⲇ' => 'Ⲇ',
  74226. 'ⲉ' => 'Ⲉ',
  74227. 'ⲋ' => 'Ⲋ',
  74228. '�' => 'Ⲍ',
  74229. '�' => 'Ⲏ',
  74230. 'ⲑ' => '�',
  74231. 'ⲓ' => 'Ⲓ',
  74232. 'ⲕ' => 'Ⲕ',
  74233. 'â²—' => 'â²–',
  74234. 'ⲙ' => 'Ⲙ',
  74235. 'ⲛ' => 'Ⲛ',
  74236. '�' => 'Ⲝ',
  74237. 'ⲟ' => 'Ⲟ',
  74238. 'ⲡ' => 'Ⲡ',
  74239. 'â²£' => 'â²¢',
  74240. 'ⲥ' => 'Ⲥ',
  74241. 'ⲧ' => 'Ⲧ',
  74242. 'ⲩ' => 'Ⲩ',
  74243. 'ⲫ' => 'Ⲫ',
  74244. 'ⲭ' => 'Ⲭ',
  74245. 'ⲯ' => 'Ⲯ',
  74246. 'â²±' => 'â²°',
  74247. 'â²³' => 'â²²',
  74248. 'â²µ' => 'â²´',
  74249. 'ⲷ' => 'Ⲷ',
  74250. 'ⲹ' => 'Ⲹ',
  74251. 'ⲻ' => 'Ⲻ',
  74252. 'â²½' => 'â²¼',
  74253. 'ⲿ' => 'Ⲿ',
  74254. '�' => 'Ⳁ',
  74255. 'ⳃ' => 'Ⳃ',
  74256. 'ⳅ' => 'Ⳅ',
  74257. 'ⳇ' => 'Ⳇ',
  74258. 'ⳉ' => 'Ⳉ',
  74259. 'ⳋ' => 'Ⳋ',
  74260. '�' => 'Ⳍ',
  74261. '�' => 'Ⳏ',
  74262. 'ⳑ' => '�',
  74263. 'ⳓ' => 'Ⳓ',
  74264. 'ⳕ' => 'Ⳕ',
  74265. 'â³—' => 'â³–',
  74266. 'ⳙ' => 'Ⳙ',
  74267. 'ⳛ' => 'Ⳛ',
  74268. '�' => 'Ⳝ',
  74269. 'ⳟ' => 'Ⳟ',
  74270. 'ⳡ' => 'Ⳡ',
  74271. 'â³£' => 'â³¢',
  74272. 'ⳬ' => 'Ⳬ',
  74273. 'â³®' => 'â³­',
  74274. 'â³³' => 'â³²',
  74275. 'â´€' => 'á‚ ',
  74276. 'â´�' => 'á‚¡',
  74277. 'â´‚' => 'á‚¢',
  74278. 'â´ƒ' => 'á‚£',
  74279. 'ⴄ' => 'Ⴄ',
  74280. 'â´…' => 'á‚¥',
  74281. 'ⴆ' => 'Ⴆ',
  74282. 'ⴇ' => 'Ⴇ',
  74283. 'ⴈ' => 'Ⴈ',
  74284. 'â´‰' => 'á‚©',
  74285. 'ⴊ' => 'Ⴊ',
  74286. 'â´‹' => 'á‚«',
  74287. 'ⴌ' => 'Ⴌ',
  74288. 'â´�' => 'á‚­',
  74289. 'â´Ž' => 'á‚®',
  74290. '�' => 'Ⴏ',
  74291. 'â´�' => 'á‚°',
  74292. 'ⴑ' => 'Ⴑ',
  74293. 'ⴒ' => 'Ⴒ',
  74294. 'ⴓ' => 'Ⴓ',
  74295. 'â´”' => 'á‚´',
  74296. 'ⴕ' => 'Ⴕ',
  74297. 'ⴖ' => 'Ⴖ',
  74298. 'â´—' => 'á‚·',
  74299. 'ⴘ' => 'Ⴘ',
  74300. 'ⴙ' => 'Ⴙ',
  74301. 'ⴚ' => 'Ⴚ',
  74302. 'â´›' => 'á‚»',
  74303. 'ⴜ' => 'Ⴜ',
  74304. '�' => 'Ⴝ',
  74305. 'ⴞ' => 'Ⴞ',
  74306. 'â´Ÿ' => 'á‚¿',
  74307. 'ⴠ' => 'Ⴠ',
  74308. 'ⴡ' => '�',
  74309. 'ⴢ' => 'Ⴢ',
  74310. 'ⴣ' => 'Ⴣ',
  74311. 'ⴤ' => 'Ⴤ',
  74312. 'ⴥ' => 'Ⴥ',
  74313. 'ⴧ' => 'Ⴧ',
  74314. 'ⴭ' => '�',
  74315. '�' => 'Ꙁ',
  74316. 'ꙃ' => 'Ꙃ',
  74317. 'ꙅ' => 'Ꙅ',
  74318. 'ꙇ' => 'Ꙇ',
  74319. 'ꙉ' => 'Ꙉ',
  74320. 'ꙋ' => 'Ꙋ',
  74321. '�' => 'Ꙍ',
  74322. '�' => 'Ꙏ',
  74323. 'ꙑ' => '�',
  74324. 'ꙓ' => 'Ꙓ',
  74325. 'ꙕ' => 'Ꙕ',
  74326. 'ê™—' => 'ê™–',
  74327. 'ꙙ' => 'Ꙙ',
  74328. 'ꙛ' => 'Ꙛ',
  74329. '�' => 'Ꙝ',
  74330. 'ꙟ' => 'Ꙟ',
  74331. 'ꙡ' => 'Ꙡ',
  74332. 'ꙣ' => 'Ꙣ',
  74333. 'ꙥ' => 'Ꙥ',
  74334. 'ꙧ' => 'Ꙧ',
  74335. 'ꙩ' => 'Ꙩ',
  74336. 'ꙫ' => 'Ꙫ',
  74337. 'ꙭ' => 'Ꙭ',
  74338. '�' => 'Ꚁ',
  74339. 'ꚃ' => 'Ꚃ',
  74340. 'êš…' => 'êš„',
  74341. 'ꚇ' => 'Ꚇ',
  74342. 'ꚉ' => 'Ꚉ',
  74343. 'ꚋ' => 'Ꚋ',
  74344. '�' => 'Ꚍ',
  74345. '�' => 'Ꚏ',
  74346. 'ꚑ' => '�',
  74347. 'êš“' => 'êš’',
  74348. 'êš•' => 'êš”',
  74349. 'êš—' => 'êš–',
  74350. 'ꚙ' => 'Ꚙ',
  74351. 'êš›' => 'êšš',
  74352. 'ꜣ' => 'Ꜣ',
  74353. 'ꜥ' => 'Ꜥ',
  74354. 'ꜧ' => 'Ꜧ',
  74355. 'ꜩ' => 'Ꜩ',
  74356. 'ꜫ' => 'Ꜫ',
  74357. 'ꜭ' => 'Ꜭ',
  74358. 'ꜯ' => 'Ꜯ',
  74359. 'ꜳ' => 'Ꜳ',
  74360. 'ꜵ' => 'Ꜵ',
  74361. 'ꜷ' => 'Ꜷ',
  74362. 'ꜹ' => 'Ꜹ',
  74363. 'ꜻ' => 'Ꜻ',
  74364. 'ꜽ' => 'Ꜽ',
  74365. 'ꜿ' => 'Ꜿ',
  74366. '�' => '�',
  74367. '�' => '�',
  74368. '�' => '�',
  74369. '�' => '�',
  74370. '�' => '�',
  74371. '�' => '�',
  74372. '�' => '�',
  74373. '�' => '�',
  74374. '�' => '�',
  74375. '�' => '�',
  74376. '�' => '�',
  74377. '�' => '�',
  74378. '�' => '�',
  74379. '�' => '�',
  74380. '�' => '�',
  74381. '�' => '�',
  74382. '�' => '�',
  74383. '�' => '�',
  74384. '�' => '�',
  74385. '�' => '�',
  74386. '�' => '�',
  74387. '�' => '�',
  74388. '�' => '�',
  74389. '�' => '�',
  74390. '�' => '�',
  74391. '�' => '�',
  74392. '�' => '�',
  74393. '�' => 'Ꞁ',
  74394. 'ꞃ' => 'Ꞃ',
  74395. 'êž…' => 'êž„',
  74396. 'ꞇ' => 'Ꞇ',
  74397. 'ꞌ' => 'Ꞌ',
  74398. 'ꞑ' => '�',
  74399. 'êž“' => 'êž’',
  74400. 'ꞔ' => 'Ꞔ',
  74401. 'êž—' => 'êž–',
  74402. 'ꞙ' => 'Ꞙ',
  74403. 'êž›' => 'êžš',
  74404. '�' => 'Ꞝ',
  74405. 'ꞟ' => 'Ꞟ',
  74406. 'êž¡' => 'êž ',
  74407. 'ꞣ' => 'Ꞣ',
  74408. 'ꞥ' => 'Ꞥ',
  74409. 'ꞧ' => 'Ꞧ',
  74410. 'ꞩ' => 'Ꞩ',
  74411. 'êžµ' => 'êž´',
  74412. 'ꞷ' => 'Ꞷ',
  74413. 'ꞹ' => 'Ꞹ',
  74414. 'ꞻ' => 'Ꞻ',
  74415. 'êž½' => 'êž¼',
  74416. 'êž¿' => 'êž¾',
  74417. 'ꟃ' => 'Ꟃ',
  74418. 'ꟈ' => 'Ꟈ',
  74419. 'ꟊ' => 'Ꟊ',
  74420. 'ꟶ' => 'Ꟶ',
  74421. 'ê­“' => 'êž³',
  74422. 'ꭰ' => 'Ꭰ',
  74423. 'ꭱ' => 'Ꭱ',
  74424. 'ꭲ' => 'Ꭲ',
  74425. 'ꭳ' => 'Ꭳ',
  74426. 'ꭴ' => 'Ꭴ',
  74427. 'ꭵ' => 'Ꭵ',
  74428. 'ꭶ' => 'Ꭶ',
  74429. 'ꭷ' => 'Ꭷ',
  74430. 'ꭸ' => 'Ꭸ',
  74431. 'ꭹ' => 'Ꭹ',
  74432. 'ꭺ' => 'Ꭺ',
  74433. 'ꭻ' => 'Ꭻ',
  74434. 'ꭼ' => 'Ꭼ',
  74435. 'ꭽ' => 'Ꭽ',
  74436. 'ꭾ' => 'Ꭾ',
  74437. 'ꭿ' => 'Ꭿ',
  74438. 'ꮀ' => 'Ꮀ',
  74439. '�' => 'Ꮁ',
  74440. 'ꮂ' => 'Ꮂ',
  74441. 'ꮃ' => 'Ꮃ',
  74442. 'ꮄ' => 'Ꮄ',
  74443. 'ꮅ' => 'Ꮅ',
  74444. 'ꮆ' => 'Ꮆ',
  74445. 'ꮇ' => 'Ꮇ',
  74446. 'ꮈ' => 'Ꮈ',
  74447. 'ꮉ' => 'Ꮉ',
  74448. 'ꮊ' => 'Ꮊ',
  74449. 'ꮋ' => 'Ꮋ',
  74450. 'ꮌ' => 'Ꮌ',
  74451. '�' => 'Ꮍ',
  74452. 'ꮎ' => 'Ꮎ',
  74453. '�' => 'Ꮏ',
  74454. '�' => '�',
  74455. 'ꮑ' => '�',
  74456. 'ꮒ' => '�',
  74457. 'ꮓ' => '�',
  74458. 'ꮔ' => '�',
  74459. 'ꮕ' => '�',
  74460. 'ꮖ' => '�',
  74461. 'ꮗ' => '�',
  74462. 'ꮘ' => '�',
  74463. 'ꮙ' => '�',
  74464. 'ꮚ' => '�',
  74465. 'ꮛ' => '�',
  74466. 'ꮜ' => '�',
  74467. '�' => '�',
  74468. 'ꮞ' => '�',
  74469. 'ꮟ' => '�',
  74470. 'ꮠ' => '�',
  74471. 'ꮡ' => '�',
  74472. 'ꮢ' => '�',
  74473. 'ꮣ' => '�',
  74474. 'ꮤ' => '�',
  74475. 'ꮥ' => '�',
  74476. 'ꮦ' => '�',
  74477. 'ꮧ' => '�',
  74478. 'ꮨ' => '�',
  74479. 'ꮩ' => '�',
  74480. 'ꮪ' => '�',
  74481. 'ꮫ' => '�',
  74482. 'ꮬ' => '�',
  74483. 'ꮭ' => '�',
  74484. 'ꮮ' => '�',
  74485. 'ꮯ' => '�',
  74486. 'ꮰ' => '�',
  74487. 'ꮱ' => '�',
  74488. 'ꮲ' => '�',
  74489. 'ꮳ' => '�',
  74490. 'ꮴ' => '�',
  74491. 'ꮵ' => '�',
  74492. 'ꮶ' => '�',
  74493. 'ꮷ' => '�',
  74494. 'ꮸ' => '�',
  74495. 'ꮹ' => '�',
  74496. 'ꮺ' => '�',
  74497. 'ꮻ' => '�',
  74498. 'ꮼ' => '�',
  74499. 'ꮽ' => '�',
  74500. 'ꮾ' => '�',
  74501. 'ꮿ' => '�',
  74502. '�' => 'A',
  74503. 'b' => 'B',
  74504. 'c' => 'C',
  74505. 'd' => 'D',
  74506. 'ï½…' => 'ï¼¥',
  74507. 'f' => 'F',
  74508. 'g' => 'G',
  74509. 'h' => 'H',
  74510. 'i' => 'I',
  74511. 'j' => 'J',
  74512. 'k' => 'K',
  74513. 'l' => 'L',
  74514. '�' => 'M',
  74515. 'n' => 'N',
  74516. '�' => 'O',
  74517. '�' => 'P',
  74518. 'q' => 'Q',
  74519. 'ï½’' => 'ï¼²',
  74520. 's' => 'S',
  74521. 'ï½”' => 'ï¼´',
  74522. 'u' => 'U',
  74523. 'v' => 'V',
  74524. 'ï½—' => 'ï¼·',
  74525. 'x' => 'X',
  74526. 'ï½™' => 'ï¼¹',
  74527. 'z' => 'Z',
  74528. '�' => '�',
  74529. '�' => '�',
  74530. '�' => '�',
  74531. '�' => '�',
  74532. '�' => '�',
  74533. '�' => '�',
  74534. '�' => '�',
  74535. '�' => '�',
  74536. '�' => '�',
  74537. '�' => '�',
  74538. '�' => '�',
  74539. '�' => '�',
  74540. '�' => '�',
  74541. '�' => '�',
  74542. '�' => '�',
  74543. '�' => '�',
  74544. '�' => '�',
  74545. '�' => '�',
  74546. '�' => '�',
  74547. '�' => '�',
  74548. '�' => '�',
  74549. '�' => '�',
  74550. '�' => '�',
  74551. '�' => '�',
  74552. '�' => '�',
  74553. '�' => '�',
  74554. '�' => '�',
  74555. '�' => '�',
  74556. '�' => '�',
  74557. '�' => '�',
  74558. '�' => '�',
  74559. '�' => '�',
  74560. '�' => '�',
  74561. '�' => '�',
  74562. '�' => '�',
  74563. '�' => '�',
  74564. '�' => '�',
  74565. '�' => '�',
  74566. '�' => '�',
  74567. '�' => '�',
  74568. '�' => '�',
  74569. '�' => '�',
  74570. '�' => '�',
  74571. '�' => '�',
  74572. '�' => '�',
  74573. '�' => '�',
  74574. '�' => '�',
  74575. '�' => '�',
  74576. '�' => '�',
  74577. '�' => '�',
  74578. '�' => '�',
  74579. '�' => '�',
  74580. '�' => '�',
  74581. '�' => '�',
  74582. '�' => '�',
  74583. '�' => '�',
  74584. '�' => '�',
  74585. '�' => '�',
  74586. '�' => '�',
  74587. '�' => '�',
  74588. '�' => '�',
  74589. '�' => '�',
  74590. '�' => '�',
  74591. '�' => '�',
  74592. '�' => '�',
  74593. '�' => '�',
  74594. '�' => '�',
  74595. '�' => '�',
  74596. '�' => '�',
  74597. '�' => '�',
  74598. '�' => '�',
  74599. '�' => '�',
  74600. '�' => '�',
  74601. '�' => '�',
  74602. '�' => '�',
  74603. '�' => '�',
  74604. '�' => '�',
  74605. '�' => '�',
  74606. '�' => '�',
  74607. '�' => '�',
  74608. '�' => '�',
  74609. '�' => '�',
  74610. '�' => '�',
  74611. '�' => '�',
  74612. '�' => '�',
  74613. '�' => '�',
  74614. '�' => '�',
  74615. '�' => '�',
  74616. '�' => '�',
  74617. '�' => '�',
  74618. '�' => '�',
  74619. '�' => '�',
  74620. '�' => '�',
  74621. '�' => '�',
  74622. '�' => '�',
  74623. '�' => '�',
  74624. '�' => '�',
  74625. '�' => '�',
  74626. '�' => '�',
  74627. '�' => '�',
  74628. '�' => '�',
  74629. '�' => '�',
  74630. '�' => '�',
  74631. '�' => '�',
  74632. '�' => '�',
  74633. '�' => '�',
  74634. '�' => '�',
  74635. '�' => '�',
  74636. '�' => '�',
  74637. '�' => '�',
  74638. '�' => '�',
  74639. '�' => '�',
  74640. '�' => '�',
  74641. '�' => '�',
  74642. '�' => '�',
  74643. '�' => '�',
  74644. '�' => '�',
  74645. '�' => '�',
  74646. '�' => '�',
  74647. '�' => '�',
  74648. '�' => '�',
  74649. '�' => '�',
  74650. '�' => '�',
  74651. '�' => '�',
  74652. '�' => '�',
  74653. '�' => '�',
  74654. '�' => '�',
  74655. 'ð‘£€' => 'ð‘¢ ',
  74656. '�' => '𑢡',
  74657. '𑣂' => '𑢢',
  74658. '𑣃' => '𑢣',
  74659. '𑣄' => '𑢤',
  74660. 'ð‘£…' => 'ð‘¢¥',
  74661. '𑣆' => '𑢦',
  74662. '𑣇' => '𑢧',
  74663. '𑣈' => '𑢨',
  74664. '𑣉' => '𑢩',
  74665. '𑣊' => '𑢪',
  74666. '𑣋' => '𑢫',
  74667. '𑣌' => '𑢬',
  74668. '�' => '𑢭',
  74669. '𑣎' => '𑢮',
  74670. '�' => '𑢯',
  74671. '�' => '𑢰',
  74672. '𑣑' => '𑢱',
  74673. 'ð‘£’' => 'ð‘¢²',
  74674. '𑣓' => '𑢳',
  74675. 'ð‘£”' => 'ð‘¢´',
  74676. '𑣕' => '𑢵',
  74677. '𑣖' => '𑢶',
  74678. 'ð‘£—' => 'ð‘¢·',
  74679. '𑣘' => '𑢸',
  74680. 'ð‘£™' => 'ð‘¢¹',
  74681. '𑣚' => '𑢺',
  74682. 'ð‘£›' => 'ð‘¢»',
  74683. '𑣜' => '𑢼',
  74684. '�' => '𑢽',
  74685. '𑣞' => '𑢾',
  74686. '𑣟' => '𑢿',
  74687. 'ð–¹ ' => 'ð–¹€',
  74688. '𖹡' => '�',
  74689. '𖹢' => '𖹂',
  74690. '𖹣' => '𖹃',
  74691. '𖹤' => '𖹄',
  74692. 'ð–¹¥' => 'ð–¹…',
  74693. '𖹦' => '𖹆',
  74694. '𖹧' => '𖹇',
  74695. '𖹨' => '𖹈',
  74696. '𖹩' => '𖹉',
  74697. '𖹪' => '𖹊',
  74698. '𖹫' => '𖹋',
  74699. '𖹬' => '𖹌',
  74700. '𖹭' => '�',
  74701. '𖹮' => '𖹎',
  74702. '𖹯' => '�',
  74703. '𖹰' => '�',
  74704. '𖹱' => '𖹑',
  74705. 'ð–¹²' => 'ð–¹’',
  74706. '𖹳' => '𖹓',
  74707. 'ð–¹´' => 'ð–¹”',
  74708. '𖹵' => '𖹕',
  74709. '𖹶' => '𖹖',
  74710. 'ð–¹·' => 'ð–¹—',
  74711. '𖹸' => '𖹘',
  74712. 'ð–¹¹' => 'ð–¹™',
  74713. '𖹺' => '𖹚',
  74714. 'ð–¹»' => 'ð–¹›',
  74715. '𖹼' => '𖹜',
  74716. '𖹽' => '�',
  74717. '𖹾' => '𖹞',
  74718. '𖹿' => '𖹟',
  74719. '𞤢' => '𞤀',
  74720. '𞤣' => '�',
  74721. '𞤤' => '𞤂',
  74722. '𞤥' => '𞤃',
  74723. '𞤦' => '𞤄',
  74724. '𞤧' => '𞤅',
  74725. '𞤨' => '𞤆',
  74726. '𞤩' => '𞤇',
  74727. '𞤪' => '𞤈',
  74728. '𞤫' => '𞤉',
  74729. '𞤬' => '𞤊',
  74730. '𞤭' => '𞤋',
  74731. '𞤮' => '𞤌',
  74732. '𞤯' => '�',
  74733. '𞤰' => '𞤎',
  74734. '𞤱' => '�',
  74735. '𞤲' => '�',
  74736. '𞤳' => '𞤑',
  74737. '𞤴' => '𞤒',
  74738. '𞤵' => '𞤓',
  74739. '𞤶' => '𞤔',
  74740. '𞤷' => '𞤕',
  74741. '𞤸' => '𞤖',
  74742. '𞤹' => '𞤗',
  74743. '𞤺' => '𞤘',
  74744. '𞤻' => '𞤙',
  74745. '𞤼' => '𞤚',
  74746. '𞤽' => '𞤛',
  74747. '𞤾' => '𞤜',
  74748. '𞤿' => '�',
  74749. '𞥀' => '𞤞',
  74750. '�' => '𞤟',
  74751. '𞥂' => '𞤠',
  74752. '𞥃' => '𞤡',
  74753. 'ß' => 'SS',
  74754. 'ff' => 'FF',
  74755. '�' => 'FI',
  74756. 'fl' => 'FL',
  74757. 'ffi' => 'FFI',
  74758. 'ffl' => 'FFL',
  74759. 'ſt' => 'ST',
  74760. 'st' => 'ST',
  74761. 'Ö‡' => 'ÔµÕ’',
  74762. 'ﬓ' => 'ՄՆ',
  74763. 'ﬔ' => 'ՄԵ',
  74764. 'ﬕ' => 'ՄԻ',
  74765. 'ﬖ' => 'ՎՆ',
  74766. 'ﬗ' => 'ՄԽ',
  74767. 'ʼn' => 'ʼN',
  74768. '�' => 'Ϊ�',
  74769. 'ΰ' => 'Ϋ�',
  74770. 'ǰ' => 'J̌',
  74771. 'ẖ' => 'H̱',
  74772. 'ẗ' => 'T̈',
  74773. 'ẘ' => 'W̊',
  74774. 'ẙ' => 'Y̊',
  74775. 'ẚ' => 'Aʾ',
  74776. '�' => 'Υ̓',
  74777. 'ὒ' => 'Υ̓̀',
  74778. 'ὔ' => 'Υ̓�',
  74779. 'ὖ' => 'Υ̓͂',
  74780. 'ᾶ' => 'Α͂',
  74781. 'ῆ' => 'Η͂',
  74782. 'ῒ' => 'Ϊ̀',
  74783. 'ΐ' => 'Ϊ�',
  74784. 'ῖ' => 'Ι͂',
  74785. 'ῗ' => 'Ϊ͂',
  74786. 'ῢ' => 'Ϋ̀',
  74787. 'ΰ' => 'Ϋ�',
  74788. 'ῤ' => 'Ρ̓',
  74789. 'ῦ' => 'Υ͂',
  74790. 'ῧ' => 'Ϋ͂',
  74791. 'ῶ' => 'Ω͂',
  74792. 'ᾈ' => 'ἈΙ',
  74793. 'ᾉ' => 'ἉΙ',
  74794. 'ᾊ' => 'ἊΙ',
  74795. 'ᾋ' => 'ἋΙ',
  74796. 'ᾌ' => 'ἌΙ',
  74797. '�' => '�Ι',
  74798. 'ᾎ' => 'ἎΙ',
  74799. '�' => '�Ι',
  74800. 'ᾘ' => 'ἨΙ',
  74801. 'ᾙ' => 'ἩΙ',
  74802. 'ᾚ' => 'ἪΙ',
  74803. 'ᾛ' => 'ἫΙ',
  74804. 'ᾜ' => 'ἬΙ',
  74805. '�' => 'ἭΙ',
  74806. 'ᾞ' => 'ἮΙ',
  74807. 'ᾟ' => 'ἯΙ',
  74808. 'ᾨ' => 'ὨΙ',
  74809. 'ᾩ' => 'ὩΙ',
  74810. 'ᾪ' => 'ὪΙ',
  74811. 'ᾫ' => 'ὫΙ',
  74812. 'ᾬ' => 'ὬΙ',
  74813. 'ᾭ' => 'ὭΙ',
  74814. 'ᾮ' => 'ὮΙ',
  74815. 'ᾯ' => 'ὯΙ',
  74816. 'ᾼ' => 'ΑΙ',
  74817. 'ῌ' => 'ΗΙ',
  74818. 'ῼ' => 'ΩΙ',
  74819. 'ᾲ' => 'ᾺΙ',
  74820. 'ᾴ' => 'ΆΙ',
  74821. 'ῂ' => 'ῊΙ',
  74822. 'ῄ' => 'ΉΙ',
  74823. 'ῲ' => 'ῺΙ',
  74824. 'ῴ' => '�Ι',
  74825. 'ᾷ' => 'Α͂Ι',
  74826. 'ῇ' => 'Η͂Ι',
  74827. 'ῷ' => 'Ω͂Ι',
  74828. );
  74829. <?php
  74830. use Symfony\Polyfill\Mbstring as p;
  74831. if (\PHP_VERSION_ID >= 80000) {
  74832. return require __DIR__.'/bootstrap80.php';
  74833. }
  74834. if (!function_exists('mb_convert_encoding')) {
  74835. function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
  74836. }
  74837. if (!function_exists('mb_decode_mimeheader')) {
  74838. function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
  74839. }
  74840. if (!function_exists('mb_encode_mimeheader')) {
  74841. function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
  74842. }
  74843. if (!function_exists('mb_decode_numericentity')) {
  74844. function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
  74845. }
  74846. if (!function_exists('mb_encode_numericentity')) {
  74847. function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
  74848. }
  74849. if (!function_exists('mb_convert_case')) {
  74850. function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
  74851. }
  74852. if (!function_exists('mb_internal_encoding')) {
  74853. function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
  74854. }
  74855. if (!function_exists('mb_language')) {
  74856. function mb_language($language = null) { return p\Mbstring::mb_language($language); }
  74857. }
  74858. if (!function_exists('mb_list_encodings')) {
  74859. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  74860. }
  74861. if (!function_exists('mb_encoding_aliases')) {
  74862. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  74863. }
  74864. if (!function_exists('mb_check_encoding')) {
  74865. function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
  74866. }
  74867. if (!function_exists('mb_detect_encoding')) {
  74868. function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
  74869. }
  74870. if (!function_exists('mb_detect_order')) {
  74871. function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
  74872. }
  74873. if (!function_exists('mb_parse_str')) {
  74874. function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; }
  74875. }
  74876. if (!function_exists('mb_strlen')) {
  74877. function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
  74878. }
  74879. if (!function_exists('mb_strpos')) {
  74880. function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
  74881. }
  74882. if (!function_exists('mb_strtolower')) {
  74883. function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
  74884. }
  74885. if (!function_exists('mb_strtoupper')) {
  74886. function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
  74887. }
  74888. if (!function_exists('mb_substitute_character')) {
  74889. function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
  74890. }
  74891. if (!function_exists('mb_substr')) {
  74892. function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
  74893. }
  74894. if (!function_exists('mb_stripos')) {
  74895. function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
  74896. }
  74897. if (!function_exists('mb_stristr')) {
  74898. function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
  74899. }
  74900. if (!function_exists('mb_strrchr')) {
  74901. function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
  74902. }
  74903. if (!function_exists('mb_strrichr')) {
  74904. function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
  74905. }
  74906. if (!function_exists('mb_strripos')) {
  74907. function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
  74908. }
  74909. if (!function_exists('mb_strrpos')) {
  74910. function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
  74911. }
  74912. if (!function_exists('mb_strstr')) {
  74913. function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
  74914. }
  74915. if (!function_exists('mb_get_info')) {
  74916. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  74917. }
  74918. if (!function_exists('mb_http_output')) {
  74919. function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
  74920. }
  74921. if (!function_exists('mb_strwidth')) {
  74922. function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
  74923. }
  74924. if (!function_exists('mb_substr_count')) {
  74925. function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
  74926. }
  74927. if (!function_exists('mb_output_handler')) {
  74928. function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
  74929. }
  74930. if (!function_exists('mb_http_input')) {
  74931. function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
  74932. }
  74933. if (!function_exists('mb_convert_variables')) {
  74934. function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
  74935. }
  74936. if (!function_exists('mb_ord')) {
  74937. function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
  74938. }
  74939. if (!function_exists('mb_chr')) {
  74940. function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
  74941. }
  74942. if (!function_exists('mb_scrub')) {
  74943. function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
  74944. }
  74945. if (!function_exists('mb_str_split')) {
  74946. function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
  74947. }
  74948. if (extension_loaded('mbstring')) {
  74949. return;
  74950. }
  74951. if (!defined('MB_CASE_UPPER')) {
  74952. define('MB_CASE_UPPER', 0);
  74953. }
  74954. if (!defined('MB_CASE_LOWER')) {
  74955. define('MB_CASE_LOWER', 1);
  74956. }
  74957. if (!defined('MB_CASE_TITLE')) {
  74958. define('MB_CASE_TITLE', 2);
  74959. }
  74960. <?php
  74961. use Symfony\Polyfill\Mbstring as p;
  74962. if (!function_exists('mb_convert_encoding')) {
  74963. function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); }
  74964. }
  74965. if (!function_exists('mb_decode_mimeheader')) {
  74966. function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); }
  74967. }
  74968. if (!function_exists('mb_encode_mimeheader')) {
  74969. function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); }
  74970. }
  74971. if (!function_exists('mb_decode_numericentity')) {
  74972. function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
  74973. }
  74974. if (!function_exists('mb_encode_numericentity')) {
  74975. function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); }
  74976. }
  74977. if (!function_exists('mb_convert_case')) {
  74978. function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
  74979. }
  74980. if (!function_exists('mb_internal_encoding')) {
  74981. function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
  74982. }
  74983. if (!function_exists('mb_language')) {
  74984. function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); }
  74985. }
  74986. if (!function_exists('mb_list_encodings')) {
  74987. function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
  74988. }
  74989. if (!function_exists('mb_encoding_aliases')) {
  74990. function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
  74991. }
  74992. if (!function_exists('mb_check_encoding')) {
  74993. function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
  74994. }
  74995. if (!function_exists('mb_detect_encoding')) {
  74996. function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); }
  74997. }
  74998. if (!function_exists('mb_detect_order')) {
  74999. function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
  75000. }
  75001. if (!function_exists('mb_parse_str')) {
  75002. function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; }
  75003. }
  75004. if (!function_exists('mb_strlen')) {
  75005. function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); }
  75006. }
  75007. if (!function_exists('mb_strpos')) {
  75008. function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  75009. }
  75010. if (!function_exists('mb_strtolower')) {
  75011. function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
  75012. }
  75013. if (!function_exists('mb_strtoupper')) {
  75014. function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
  75015. }
  75016. if (!function_exists('mb_substitute_character')) {
  75017. function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
  75018. }
  75019. if (!function_exists('mb_substr')) {
  75020. function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); }
  75021. }
  75022. if (!function_exists('mb_stripos')) {
  75023. function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  75024. }
  75025. if (!function_exists('mb_stristr')) {
  75026. function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  75027. }
  75028. if (!function_exists('mb_strrchr')) {
  75029. function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  75030. }
  75031. if (!function_exists('mb_strrichr')) {
  75032. function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  75033. }
  75034. if (!function_exists('mb_strripos')) {
  75035. function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  75036. }
  75037. if (!function_exists('mb_strrpos')) {
  75038. function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  75039. }
  75040. if (!function_exists('mb_strstr')) {
  75041. function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  75042. }
  75043. if (!function_exists('mb_get_info')) {
  75044. function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); }
  75045. }
  75046. if (!function_exists('mb_http_output')) {
  75047. function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
  75048. }
  75049. if (!function_exists('mb_strwidth')) {
  75050. function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
  75051. }
  75052. if (!function_exists('mb_substr_count')) {
  75053. function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
  75054. }
  75055. if (!function_exists('mb_output_handler')) {
  75056. function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
  75057. }
  75058. if (!function_exists('mb_http_input')) {
  75059. function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
  75060. }
  75061. if (!function_exists('mb_convert_variables')) {
  75062. function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); }
  75063. }
  75064. if (!function_exists('mb_ord')) {
  75065. function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); }
  75066. }
  75067. if (!function_exists('mb_chr')) {
  75068. function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
  75069. }
  75070. if (!function_exists('mb_scrub')) {
  75071. function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
  75072. }
  75073. if (!function_exists('mb_str_split')) {
  75074. function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
  75075. }
  75076. if (extension_loaded('mbstring')) {
  75077. return;
  75078. }
  75079. if (!defined('MB_CASE_UPPER')) {
  75080. define('MB_CASE_UPPER', 0);
  75081. }
  75082. if (!defined('MB_CASE_LOWER')) {
  75083. define('MB_CASE_LOWER', 1);
  75084. }
  75085. if (!defined('MB_CASE_TITLE')) {
  75086. define('MB_CASE_TITLE', 2);
  75087. }
  75088. Copyright (c) 2018-2019 Fabien Potencier
  75089. Permission is hereby granted, free of charge, to any person obtaining a copy
  75090. of this software and associated documentation files (the "Software"), to deal
  75091. in the Software without restriction, including without limitation the rights
  75092. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  75093. copies of the Software, and to permit persons to whom the Software is furnished
  75094. to do so, subject to the following conditions:
  75095. The above copyright notice and this permission notice shall be included in all
  75096. copies or substantial portions of the Software.
  75097. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  75098. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  75099. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  75100. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  75101. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  75102. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  75103. THE SOFTWARE.
  75104. <?php
  75105. namespace Symfony\Polyfill\Php73;
  75106. final class Php73
  75107. {
  75108. public static $startAt = 1533462603;
  75109. public static function hrtime($asNum = false)
  75110. {
  75111. $ns = microtime(false);
  75112. $s = substr($ns, 11) - self::$startAt;
  75113. $ns = 1E9 * (float) $ns;
  75114. if ($asNum) {
  75115. $ns += $s * 1E9;
  75116. return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
  75117. }
  75118. return [$s, (int) $ns];
  75119. }
  75120. }
  75121. <?php
  75122. if (\PHP_VERSION_ID < 70300) {
  75123. class JsonException extends Exception
  75124. {
  75125. }
  75126. }
  75127. <?php
  75128. use Symfony\Polyfill\Php73 as p;
  75129. if (\PHP_VERSION_ID >= 70300) {
  75130. return;
  75131. }
  75132. if (!function_exists('is_countable')) {
  75133. function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
  75134. }
  75135. if (!function_exists('hrtime')) {
  75136. require_once __DIR__.'/Php73.php';
  75137. p\Php73::$startAt = (int) microtime(true);
  75138. function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
  75139. }
  75140. if (!function_exists('array_key_first')) {
  75141. function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
  75142. }
  75143. if (!function_exists('array_key_last')) {
  75144. function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
  75145. }
  75146. Copyright (c) 2020 Fabien Potencier
  75147. Permission is hereby granted, free of charge, to any person obtaining a copy
  75148. of this software and associated documentation files (the "Software"), to deal
  75149. in the Software without restriction, including without limitation the rights
  75150. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  75151. copies of the Software, and to permit persons to whom the Software is furnished
  75152. to do so, subject to the following conditions:
  75153. The above copyright notice and this permission notice shall be included in all
  75154. copies or substantial portions of the Software.
  75155. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  75156. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  75157. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  75158. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  75159. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  75160. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  75161. THE SOFTWARE.
  75162. <?php
  75163. namespace Symfony\Polyfill\Php80;
  75164. final class Php80
  75165. {
  75166. public static function fdiv(float $dividend, float $divisor): float
  75167. {
  75168. return @($dividend / $divisor);
  75169. }
  75170. public static function get_debug_type($value): string
  75171. {
  75172. switch (true) {
  75173. case null === $value: return 'null';
  75174. case \is_bool($value): return 'bool';
  75175. case \is_string($value): return 'string';
  75176. case \is_array($value): return 'array';
  75177. case \is_int($value): return 'int';
  75178. case \is_float($value): return 'float';
  75179. case \is_object($value): break;
  75180. case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
  75181. default:
  75182. if (null === $type = @get_resource_type($value)) {
  75183. return 'unknown';
  75184. }
  75185. if ('Unknown' === $type) {
  75186. $type = 'closed';
  75187. }
  75188. return "resource ($type)";
  75189. }
  75190. $class = \get_class($value);
  75191. if (false === strpos($class, '@')) {
  75192. return $class;
  75193. }
  75194. return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
  75195. }
  75196. public static function get_resource_id($res): int
  75197. {
  75198. if (!\is_resource($res) && null === @get_resource_type($res)) {
  75199. throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
  75200. }
  75201. return (int) $res;
  75202. }
  75203. public static function preg_last_error_msg(): string
  75204. {
  75205. switch (preg_last_error()) {
  75206. case \PREG_INTERNAL_ERROR:
  75207. return 'Internal error';
  75208. case \PREG_BAD_UTF8_ERROR:
  75209. return 'Malformed UTF-8 characters, possibly incorrectly encoded';
  75210. case \PREG_BAD_UTF8_OFFSET_ERROR:
  75211. return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
  75212. case \PREG_BACKTRACK_LIMIT_ERROR:
  75213. return 'Backtrack limit exhausted';
  75214. case \PREG_RECURSION_LIMIT_ERROR:
  75215. return 'Recursion limit exhausted';
  75216. case \PREG_JIT_STACKLIMIT_ERROR:
  75217. return 'JIT stack limit exhausted';
  75218. case \PREG_NO_ERROR:
  75219. return 'No error';
  75220. default:
  75221. return 'Unknown error';
  75222. }
  75223. }
  75224. public static function str_contains(string $haystack, string $needle): bool
  75225. {
  75226. return '' === $needle || false !== strpos($haystack, $needle);
  75227. }
  75228. public static function str_starts_with(string $haystack, string $needle): bool
  75229. {
  75230. return 0 === strncmp($haystack, $needle, \strlen($needle));
  75231. }
  75232. public static function str_ends_with(string $haystack, string $needle): bool
  75233. {
  75234. if ('' === $needle || $needle === $haystack) {
  75235. return true;
  75236. }
  75237. if ('' === $haystack) {
  75238. return false;
  75239. }
  75240. $needleLength = \strlen($needle);
  75241. return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
  75242. }
  75243. }
  75244. <?php
  75245. namespace Symfony\Polyfill\Php80;
  75246. class PhpToken implements \Stringable
  75247. {
  75248. public $id;
  75249. public $text;
  75250. public $line;
  75251. public $pos;
  75252. public function __construct(int $id, string $text, int $line = -1, int $position = -1)
  75253. {
  75254. $this->id = $id;
  75255. $this->text = $text;
  75256. $this->line = $line;
  75257. $this->pos = $position;
  75258. }
  75259. public function getTokenName(): ?string
  75260. {
  75261. if ('UNKNOWN' === $name = token_name($this->id)) {
  75262. $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
  75263. }
  75264. return $name;
  75265. }
  75266. public function is($kind): bool
  75267. {
  75268. foreach ((array) $kind as $value) {
  75269. if (\in_array($value, [$this->id, $this->text], true)) {
  75270. return true;
  75271. }
  75272. }
  75273. return false;
  75274. }
  75275. public function isIgnorable(): bool
  75276. {
  75277. return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
  75278. }
  75279. public function __toString(): string
  75280. {
  75281. return (string) $this->text;
  75282. }
  75283. public static function tokenize(string $code, int $flags = 0): array
  75284. {
  75285. $line = 1;
  75286. $position = 0;
  75287. $tokens = token_get_all($code, $flags);
  75288. foreach ($tokens as $index => $token) {
  75289. if (\is_string($token)) {
  75290. $id = \ord($token);
  75291. $text = $token;
  75292. } else {
  75293. [$id, $text, $line] = $token;
  75294. }
  75295. $tokens[$index] = new static($id, $text, $line, $position);
  75296. $position += \strlen($text);
  75297. }
  75298. return $tokens;
  75299. }
  75300. }
  75301. <?php
  75302. #[Attribute(Attribute::TARGET_CLASS)]
  75303. final class Attribute
  75304. {
  75305. public const TARGET_CLASS = 1;
  75306. public const TARGET_FUNCTION = 2;
  75307. public const TARGET_METHOD = 4;
  75308. public const TARGET_PROPERTY = 8;
  75309. public const TARGET_CLASS_CONSTANT = 16;
  75310. public const TARGET_PARAMETER = 32;
  75311. public const TARGET_ALL = 63;
  75312. public const IS_REPEATABLE = 64;
  75313. public $flags;
  75314. public function __construct(int $flags = self::TARGET_ALL)
  75315. {
  75316. $this->flags = $flags;
  75317. }
  75318. }
  75319. <?php
  75320. if (\PHP_VERSION_ID < 80000 && \extension_loaded('tokenizer')) {
  75321. class PhpToken extends Symfony\Polyfill\Php80\PhpToken
  75322. {
  75323. }
  75324. }
  75325. <?php
  75326. if (\PHP_VERSION_ID < 80000) {
  75327. interface Stringable
  75328. {
  75329. public function __toString();
  75330. }
  75331. }
  75332. <?php
  75333. if (\PHP_VERSION_ID < 80000) {
  75334. class UnhandledMatchError extends Error
  75335. {
  75336. }
  75337. }
  75338. <?php
  75339. if (\PHP_VERSION_ID < 80000) {
  75340. class ValueError extends Error
  75341. {
  75342. }
  75343. }
  75344. <?php
  75345. use Symfony\Polyfill\Php80 as p;
  75346. if (\PHP_VERSION_ID >= 80000) {
  75347. return;
  75348. }
  75349. if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
  75350. define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
  75351. }
  75352. if (!function_exists('fdiv')) {
  75353. function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
  75354. }
  75355. if (!function_exists('preg_last_error_msg')) {
  75356. function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
  75357. }
  75358. if (!function_exists('str_contains')) {
  75359. function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
  75360. }
  75361. if (!function_exists('str_starts_with')) {
  75362. function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
  75363. }
  75364. if (!function_exists('str_ends_with')) {
  75365. function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
  75366. }
  75367. if (!function_exists('get_debug_type')) {
  75368. function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
  75369. }
  75370. if (!function_exists('get_resource_id')) {
  75371. function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
  75372. }
  75373. <?php
  75374. namespace Symfony\Component\Process\Exception;
  75375. interface ExceptionInterface extends \Throwable
  75376. {
  75377. }
  75378. <?php
  75379. namespace Symfony\Component\Process\Exception;
  75380. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  75381. {
  75382. }
  75383. <?php
  75384. namespace Symfony\Component\Process\Exception;
  75385. class LogicException extends \LogicException implements ExceptionInterface
  75386. {
  75387. }
  75388. <?php
  75389. namespace Symfony\Component\Process\Exception;
  75390. use Symfony\Component\Process\Process;
  75391. class ProcessFailedException extends RuntimeException
  75392. {
  75393. private $process;
  75394. public function __construct(Process $process)
  75395. {
  75396. if ($process->isSuccessful()) {
  75397. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  75398. }
  75399. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  75400. $process->getCommandLine(),
  75401. $process->getExitCode(),
  75402. $process->getExitCodeText(),
  75403. $process->getWorkingDirectory()
  75404. );
  75405. if (!$process->isOutputDisabled()) {
  75406. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  75407. $process->getOutput(),
  75408. $process->getErrorOutput()
  75409. );
  75410. }
  75411. parent::__construct($error);
  75412. $this->process = $process;
  75413. }
  75414. public function getProcess()
  75415. {
  75416. return $this->process;
  75417. }
  75418. }
  75419. <?php
  75420. namespace Symfony\Component\Process\Exception;
  75421. use Symfony\Component\Process\Process;
  75422. final class ProcessSignaledException extends RuntimeException
  75423. {
  75424. private $process;
  75425. public function __construct(Process $process)
  75426. {
  75427. $this->process = $process;
  75428. parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
  75429. }
  75430. public function getProcess(): Process
  75431. {
  75432. return $this->process;
  75433. }
  75434. public function getSignal(): int
  75435. {
  75436. return $this->getProcess()->getTermSignal();
  75437. }
  75438. }
  75439. <?php
  75440. namespace Symfony\Component\Process\Exception;
  75441. use Symfony\Component\Process\Process;
  75442. class ProcessTimedOutException extends RuntimeException
  75443. {
  75444. public const TYPE_GENERAL = 1;
  75445. public const TYPE_IDLE = 2;
  75446. private $process;
  75447. private $timeoutType;
  75448. public function __construct(Process $process, int $timeoutType)
  75449. {
  75450. $this->process = $process;
  75451. $this->timeoutType = $timeoutType;
  75452. parent::__construct(sprintf(
  75453. 'The process "%s" exceeded the timeout of %s seconds.',
  75454. $process->getCommandLine(),
  75455. $this->getExceededTimeout()
  75456. ));
  75457. }
  75458. public function getProcess()
  75459. {
  75460. return $this->process;
  75461. }
  75462. public function isGeneralTimeout()
  75463. {
  75464. return self::TYPE_GENERAL === $this->timeoutType;
  75465. }
  75466. public function isIdleTimeout()
  75467. {
  75468. return self::TYPE_IDLE === $this->timeoutType;
  75469. }
  75470. public function getExceededTimeout()
  75471. {
  75472. switch ($this->timeoutType) {
  75473. case self::TYPE_GENERAL:
  75474. return $this->process->getTimeout();
  75475. case self::TYPE_IDLE:
  75476. return $this->process->getIdleTimeout();
  75477. default:
  75478. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  75479. }
  75480. }
  75481. }
  75482. <?php
  75483. namespace Symfony\Component\Process\Exception;
  75484. class RuntimeException extends \RuntimeException implements ExceptionInterface
  75485. {
  75486. }
  75487. <?php
  75488. namespace Symfony\Component\Process;
  75489. class ExecutableFinder
  75490. {
  75491. private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
  75492. public function setSuffixes(array $suffixes)
  75493. {
  75494. $this->suffixes = $suffixes;
  75495. }
  75496. public function addSuffix(string $suffix)
  75497. {
  75498. $this->suffixes[] = $suffix;
  75499. }
  75500. public function find(string $name, string $default = null, array $extraDirs = [])
  75501. {
  75502. if (ini_get('open_basedir')) {
  75503. $searchPath = array_merge(explode(\PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);
  75504. $dirs = [];
  75505. foreach ($searchPath as $path) {
  75506. if (@is_dir($path)) {
  75507. $dirs[] = $path;
  75508. } else {
  75509. if (basename($path) == $name && @is_executable($path)) {
  75510. return $path;
  75511. }
  75512. }
  75513. }
  75514. } else {
  75515. $dirs = array_merge(
  75516. explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  75517. $extraDirs
  75518. );
  75519. }
  75520. $suffixes = [''];
  75521. if ('\\' === \DIRECTORY_SEPARATOR) {
  75522. $pathExt = getenv('PATHEXT');
  75523. $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  75524. }
  75525. foreach ($suffixes as $suffix) {
  75526. foreach ($dirs as $dir) {
  75527. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  75528. return $file;
  75529. }
  75530. }
  75531. }
  75532. return $default;
  75533. }
  75534. }
  75535. <?php
  75536. namespace Symfony\Component\Process;
  75537. use Symfony\Component\Process\Exception\RuntimeException;
  75538. class InputStream implements \IteratorAggregate
  75539. {
  75540. private $onEmpty = null;
  75541. private $input = [];
  75542. private $open = true;
  75543. public function onEmpty(callable $onEmpty = null)
  75544. {
  75545. $this->onEmpty = $onEmpty;
  75546. }
  75547. public function write($input)
  75548. {
  75549. if (null === $input) {
  75550. return;
  75551. }
  75552. if ($this->isClosed()) {
  75553. throw new RuntimeException(sprintf('"%s" is closed.', static::class));
  75554. }
  75555. $this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
  75556. }
  75557. public function close()
  75558. {
  75559. $this->open = false;
  75560. }
  75561. public function isClosed()
  75562. {
  75563. return !$this->open;
  75564. }
  75565. #[\ReturnTypeWillChange]
  75566. public function getIterator()
  75567. {
  75568. $this->open = true;
  75569. while ($this->open || $this->input) {
  75570. if (!$this->input) {
  75571. yield '';
  75572. continue;
  75573. }
  75574. $current = array_shift($this->input);
  75575. if ($current instanceof \Iterator) {
  75576. yield from $current;
  75577. } else {
  75578. yield $current;
  75579. }
  75580. if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) {
  75581. $this->write($onEmpty($this));
  75582. }
  75583. }
  75584. }
  75585. }
  75586. Copyright (c) 2004-2022 Fabien Potencier
  75587. Permission is hereby granted, free of charge, to any person obtaining a copy
  75588. of this software and associated documentation files (the "Software"), to deal
  75589. in the Software without restriction, including without limitation the rights
  75590. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  75591. copies of the Software, and to permit persons to whom the Software is furnished
  75592. to do so, subject to the following conditions:
  75593. The above copyright notice and this permission notice shall be included in all
  75594. copies or substantial portions of the Software.
  75595. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  75596. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  75597. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  75598. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  75599. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  75600. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  75601. THE SOFTWARE.
  75602. <?php
  75603. namespace Symfony\Component\Process;
  75604. class PhpExecutableFinder
  75605. {
  75606. private $executableFinder;
  75607. public function __construct()
  75608. {
  75609. $this->executableFinder = new ExecutableFinder();
  75610. }
  75611. public function find(bool $includeArgs = true)
  75612. {
  75613. if ($php = getenv('PHP_BINARY')) {
  75614. if (!is_executable($php)) {
  75615. $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
  75616. if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
  75617. if (!is_executable($php)) {
  75618. return false;
  75619. }
  75620. } else {
  75621. return false;
  75622. }
  75623. }
  75624. return $php;
  75625. }
  75626. $args = $this->findArguments();
  75627. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  75628. if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) {
  75629. return \PHP_BINARY.$args;
  75630. }
  75631. if ($php = getenv('PHP_PATH')) {
  75632. if (!@is_executable($php)) {
  75633. return false;
  75634. }
  75635. return $php;
  75636. }
  75637. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  75638. if (@is_executable($php)) {
  75639. return $php;
  75640. }
  75641. }
  75642. if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  75643. return $php;
  75644. }
  75645. $dirs = [\PHP_BINDIR];
  75646. if ('\\' === \DIRECTORY_SEPARATOR) {
  75647. $dirs[] = 'C:\xampp\php\\';
  75648. }
  75649. return $this->executableFinder->find('php', false, $dirs);
  75650. }
  75651. public function findArguments()
  75652. {
  75653. $arguments = [];
  75654. if ('phpdbg' === \PHP_SAPI) {
  75655. $arguments[] = '-qrr';
  75656. }
  75657. return $arguments;
  75658. }
  75659. }
  75660. <?php
  75661. namespace Symfony\Component\Process;
  75662. use Symfony\Component\Process\Exception\LogicException;
  75663. use Symfony\Component\Process\Exception\RuntimeException;
  75664. class PhpProcess extends Process
  75665. {
  75666. public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
  75667. {
  75668. if (null === $php) {
  75669. $executableFinder = new PhpExecutableFinder();
  75670. $php = $executableFinder->find(false);
  75671. $php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
  75672. }
  75673. if ('phpdbg' === \PHP_SAPI) {
  75674. $file = tempnam(sys_get_temp_dir(), 'dbg');
  75675. file_put_contents($file, $script);
  75676. register_shutdown_function('unlink', $file);
  75677. $php[] = $file;
  75678. $script = null;
  75679. }
  75680. parent::__construct($php, $cwd, $env, $script, $timeout);
  75681. }
  75682. public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
  75683. {
  75684. throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
  75685. }
  75686. public function start(callable $callback = null, array $env = [])
  75687. {
  75688. if (null === $this->getCommandLine()) {
  75689. throw new RuntimeException('Unable to find the PHP executable.');
  75690. }
  75691. parent::start($callback, $env);
  75692. }
  75693. }
  75694. <?php
  75695. namespace Symfony\Component\Process\Pipes;
  75696. use Symfony\Component\Process\Exception\InvalidArgumentException;
  75697. abstract class AbstractPipes implements PipesInterface
  75698. {
  75699. public $pipes = [];
  75700. private $inputBuffer = '';
  75701. private $input;
  75702. private $blocked = true;
  75703. private $lastError;
  75704. public function __construct($input)
  75705. {
  75706. if (\is_resource($input) || $input instanceof \Iterator) {
  75707. $this->input = $input;
  75708. } elseif (\is_string($input)) {
  75709. $this->inputBuffer = $input;
  75710. } else {
  75711. $this->inputBuffer = (string) $input;
  75712. }
  75713. }
  75714. public function close()
  75715. {
  75716. foreach ($this->pipes as $pipe) {
  75717. if (\is_resource($pipe)) {
  75718. fclose($pipe);
  75719. }
  75720. }
  75721. $this->pipes = [];
  75722. }
  75723. protected function hasSystemCallBeenInterrupted(): bool
  75724. {
  75725. $lastError = $this->lastError;
  75726. $this->lastError = null;
  75727. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  75728. }
  75729. protected function unblock()
  75730. {
  75731. if (!$this->blocked) {
  75732. return;
  75733. }
  75734. foreach ($this->pipes as $pipe) {
  75735. stream_set_blocking($pipe, 0);
  75736. }
  75737. if (\is_resource($this->input)) {
  75738. stream_set_blocking($this->input, 0);
  75739. }
  75740. $this->blocked = false;
  75741. }
  75742. protected function write(): ?array
  75743. {
  75744. if (!isset($this->pipes[0])) {
  75745. return null;
  75746. }
  75747. $input = $this->input;
  75748. if ($input instanceof \Iterator) {
  75749. if (!$input->valid()) {
  75750. $input = null;
  75751. } elseif (\is_resource($input = $input->current())) {
  75752. stream_set_blocking($input, 0);
  75753. } elseif (!isset($this->inputBuffer[0])) {
  75754. if (!\is_string($input)) {
  75755. if (!is_scalar($input)) {
  75756. throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
  75757. }
  75758. $input = (string) $input;
  75759. }
  75760. $this->inputBuffer = $input;
  75761. $this->input->next();
  75762. $input = null;
  75763. } else {
  75764. $input = null;
  75765. }
  75766. }
  75767. $r = $e = [];
  75768. $w = [$this->pipes[0]];
  75769. if (false === @stream_select($r, $w, $e, 0, 0)) {
  75770. return null;
  75771. }
  75772. foreach ($w as $stdin) {
  75773. if (isset($this->inputBuffer[0])) {
  75774. $written = fwrite($stdin, $this->inputBuffer);
  75775. $this->inputBuffer = substr($this->inputBuffer, $written);
  75776. if (isset($this->inputBuffer[0])) {
  75777. return [$this->pipes[0]];
  75778. }
  75779. }
  75780. if ($input) {
  75781. while (true) {
  75782. $data = fread($input, self::CHUNK_SIZE);
  75783. if (!isset($data[0])) {
  75784. break;
  75785. }
  75786. $written = fwrite($stdin, $data);
  75787. $data = substr($data, $written);
  75788. if (isset($data[0])) {
  75789. $this->inputBuffer = $data;
  75790. return [$this->pipes[0]];
  75791. }
  75792. }
  75793. if (feof($input)) {
  75794. if ($this->input instanceof \Iterator) {
  75795. $this->input->next();
  75796. } else {
  75797. $this->input = null;
  75798. }
  75799. }
  75800. }
  75801. }
  75802. if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
  75803. $this->input = null;
  75804. fclose($this->pipes[0]);
  75805. unset($this->pipes[0]);
  75806. } elseif (!$w) {
  75807. return [$this->pipes[0]];
  75808. }
  75809. return null;
  75810. }
  75811. public function handleError(int $type, string $msg)
  75812. {
  75813. $this->lastError = $msg;
  75814. }
  75815. }
  75816. <?php
  75817. namespace Symfony\Component\Process\Pipes;
  75818. interface PipesInterface
  75819. {
  75820. public const CHUNK_SIZE = 16384;
  75821. public function getDescriptors(): array;
  75822. public function getFiles(): array;
  75823. public function readAndWrite(bool $blocking, bool $close = false): array;
  75824. public function areOpen(): bool;
  75825. public function haveReadSupport(): bool;
  75826. public function close();
  75827. }
  75828. <?php
  75829. namespace Symfony\Component\Process\Pipes;
  75830. use Symfony\Component\Process\Process;
  75831. class UnixPipes extends AbstractPipes
  75832. {
  75833. private $ttyMode;
  75834. private $ptyMode;
  75835. private $haveReadSupport;
  75836. public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport)
  75837. {
  75838. $this->ttyMode = $ttyMode;
  75839. $this->ptyMode = $ptyMode;
  75840. $this->haveReadSupport = $haveReadSupport;
  75841. parent::__construct($input);
  75842. }
  75843. public function __sleep(): array
  75844. {
  75845. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  75846. }
  75847. public function __wakeup()
  75848. {
  75849. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  75850. }
  75851. public function __destruct()
  75852. {
  75853. $this->close();
  75854. }
  75855. public function getDescriptors(): array
  75856. {
  75857. if (!$this->haveReadSupport) {
  75858. $nullstream = fopen('/dev/null', 'c');
  75859. return [
  75860. ['pipe', 'r'],
  75861. $nullstream,
  75862. $nullstream,
  75863. ];
  75864. }
  75865. if ($this->ttyMode) {
  75866. return [
  75867. ['file', '/dev/tty', 'r'],
  75868. ['file', '/dev/tty', 'w'],
  75869. ['file', '/dev/tty', 'w'],
  75870. ];
  75871. }
  75872. if ($this->ptyMode && Process::isPtySupported()) {
  75873. return [
  75874. ['pty'],
  75875. ['pty'],
  75876. ['pty'],
  75877. ];
  75878. }
  75879. return [
  75880. ['pipe', 'r'],
  75881. ['pipe', 'w'],
  75882. ['pipe', 'w'],
  75883. ];
  75884. }
  75885. public function getFiles(): array
  75886. {
  75887. return [];
  75888. }
  75889. public function readAndWrite(bool $blocking, bool $close = false): array
  75890. {
  75891. $this->unblock();
  75892. $w = $this->write();
  75893. $read = $e = [];
  75894. $r = $this->pipes;
  75895. unset($r[0]);
  75896. set_error_handler([$this, 'handleError']);
  75897. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  75898. restore_error_handler();
  75899. if (!$this->hasSystemCallBeenInterrupted()) {
  75900. $this->pipes = [];
  75901. }
  75902. return $read;
  75903. }
  75904. restore_error_handler();
  75905. foreach ($r as $pipe) {
  75906. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  75907. do {
  75908. $data = @fread($pipe, self::CHUNK_SIZE);
  75909. $read[$type] .= $data;
  75910. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  75911. if (!isset($read[$type][0])) {
  75912. unset($read[$type]);
  75913. }
  75914. if ($close && feof($pipe)) {
  75915. fclose($pipe);
  75916. unset($this->pipes[$type]);
  75917. }
  75918. }
  75919. return $read;
  75920. }
  75921. public function haveReadSupport(): bool
  75922. {
  75923. return $this->haveReadSupport;
  75924. }
  75925. public function areOpen(): bool
  75926. {
  75927. return (bool) $this->pipes;
  75928. }
  75929. }
  75930. <?php
  75931. namespace Symfony\Component\Process\Pipes;
  75932. use Symfony\Component\Process\Exception\RuntimeException;
  75933. use Symfony\Component\Process\Process;
  75934. class WindowsPipes extends AbstractPipes
  75935. {
  75936. private $files = [];
  75937. private $fileHandles = [];
  75938. private $lockHandles = [];
  75939. private $readBytes = [
  75940. Process::STDOUT => 0,
  75941. Process::STDERR => 0,
  75942. ];
  75943. private $haveReadSupport;
  75944. public function __construct($input, bool $haveReadSupport)
  75945. {
  75946. $this->haveReadSupport = $haveReadSupport;
  75947. if ($this->haveReadSupport) {
  75948. $pipes = [
  75949. Process::STDOUT => Process::OUT,
  75950. Process::STDERR => Process::ERR,
  75951. ];
  75952. $tmpDir = sys_get_temp_dir();
  75953. $lastError = 'unknown reason';
  75954. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  75955. for ($i = 0;; ++$i) {
  75956. foreach ($pipes as $pipe => $name) {
  75957. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  75958. if (!$h = fopen($file.'.lock', 'w')) {
  75959. if (file_exists($file.'.lock')) {
  75960. continue 2;
  75961. }
  75962. restore_error_handler();
  75963. throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
  75964. }
  75965. if (!flock($h, \LOCK_EX | \LOCK_NB)) {
  75966. continue 2;
  75967. }
  75968. if (isset($this->lockHandles[$pipe])) {
  75969. flock($this->lockHandles[$pipe], \LOCK_UN);
  75970. fclose($this->lockHandles[$pipe]);
  75971. }
  75972. $this->lockHandles[$pipe] = $h;
  75973. if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
  75974. flock($this->lockHandles[$pipe], \LOCK_UN);
  75975. fclose($this->lockHandles[$pipe]);
  75976. unset($this->lockHandles[$pipe]);
  75977. continue 2;
  75978. }
  75979. $this->fileHandles[$pipe] = $h;
  75980. $this->files[$pipe] = $file;
  75981. }
  75982. break;
  75983. }
  75984. restore_error_handler();
  75985. }
  75986. parent::__construct($input);
  75987. }
  75988. public function __sleep(): array
  75989. {
  75990. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  75991. }
  75992. public function __wakeup()
  75993. {
  75994. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  75995. }
  75996. public function __destruct()
  75997. {
  75998. $this->close();
  75999. }
  76000. public function getDescriptors(): array
  76001. {
  76002. if (!$this->haveReadSupport) {
  76003. $nullstream = fopen('NUL', 'c');
  76004. return [
  76005. ['pipe', 'r'],
  76006. $nullstream,
  76007. $nullstream,
  76008. ];
  76009. }
  76010. return [
  76011. ['pipe', 'r'],
  76012. ['file', 'NUL', 'w'],
  76013. ['file', 'NUL', 'w'],
  76014. ];
  76015. }
  76016. public function getFiles(): array
  76017. {
  76018. return $this->files;
  76019. }
  76020. public function readAndWrite(bool $blocking, bool $close = false): array
  76021. {
  76022. $this->unblock();
  76023. $w = $this->write();
  76024. $read = $r = $e = [];
  76025. if ($blocking) {
  76026. if ($w) {
  76027. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  76028. } elseif ($this->fileHandles) {
  76029. usleep(Process::TIMEOUT_PRECISION * 1E6);
  76030. }
  76031. }
  76032. foreach ($this->fileHandles as $type => $fileHandle) {
  76033. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  76034. if (isset($data[0])) {
  76035. $this->readBytes[$type] += \strlen($data);
  76036. $read[$type] = $data;
  76037. }
  76038. if ($close) {
  76039. ftruncate($fileHandle, 0);
  76040. fclose($fileHandle);
  76041. flock($this->lockHandles[$type], \LOCK_UN);
  76042. fclose($this->lockHandles[$type]);
  76043. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  76044. }
  76045. }
  76046. return $read;
  76047. }
  76048. public function haveReadSupport(): bool
  76049. {
  76050. return $this->haveReadSupport;
  76051. }
  76052. public function areOpen(): bool
  76053. {
  76054. return $this->pipes && $this->fileHandles;
  76055. }
  76056. public function close()
  76057. {
  76058. parent::close();
  76059. foreach ($this->fileHandles as $type => $handle) {
  76060. ftruncate($handle, 0);
  76061. fclose($handle);
  76062. flock($this->lockHandles[$type], \LOCK_UN);
  76063. fclose($this->lockHandles[$type]);
  76064. }
  76065. $this->fileHandles = $this->lockHandles = [];
  76066. }
  76067. }
  76068. <?php
  76069. namespace Symfony\Component\Process;
  76070. use Symfony\Component\Process\Exception\InvalidArgumentException;
  76071. use Symfony\Component\Process\Exception\LogicException;
  76072. use Symfony\Component\Process\Exception\ProcessFailedException;
  76073. use Symfony\Component\Process\Exception\ProcessSignaledException;
  76074. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  76075. use Symfony\Component\Process\Exception\RuntimeException;
  76076. use Symfony\Component\Process\Pipes\PipesInterface;
  76077. use Symfony\Component\Process\Pipes\UnixPipes;
  76078. use Symfony\Component\Process\Pipes\WindowsPipes;
  76079. class Process implements \IteratorAggregate
  76080. {
  76081. public const ERR = 'err';
  76082. public const OUT = 'out';
  76083. public const STATUS_READY = 'ready';
  76084. public const STATUS_STARTED = 'started';
  76085. public const STATUS_TERMINATED = 'terminated';
  76086. public const STDIN = 0;
  76087. public const STDOUT = 1;
  76088. public const STDERR = 2;
  76089. public const TIMEOUT_PRECISION = 0.2;
  76090. public const ITER_NON_BLOCKING = 1;
  76091. public const ITER_KEEP_OUTPUT = 2;
  76092. public const ITER_SKIP_OUT = 4;
  76093. public const ITER_SKIP_ERR = 8;
  76094. private $callback;
  76095. private $hasCallback = false;
  76096. private $commandline;
  76097. private $cwd;
  76098. private $env;
  76099. private $input;
  76100. private $starttime;
  76101. private $lastOutputTime;
  76102. private $timeout;
  76103. private $idleTimeout;
  76104. private $exitcode;
  76105. private $fallbackStatus = [];
  76106. private $processInformation;
  76107. private $outputDisabled = false;
  76108. private $stdout;
  76109. private $stderr;
  76110. private $process;
  76111. private $status = self::STATUS_READY;
  76112. private $incrementalOutputOffset = 0;
  76113. private $incrementalErrorOutputOffset = 0;
  76114. private $tty = false;
  76115. private $pty;
  76116. private $options = ['suppress_errors' => true, 'bypass_shell' => true];
  76117. private $useFileHandles = false;
  76118. private $processPipes;
  76119. private $latestSignal;
  76120. private static $sigchild;
  76121. public static $exitCodes = [
  76122. 0 => 'OK',
  76123. 1 => 'General error',
  76124. 2 => 'Misuse of shell builtins',
  76125. 126 => 'Invoked command cannot execute',
  76126. 127 => 'Command not found',
  76127. 128 => 'Invalid exit argument',
  76128. 129 => 'Hangup',
  76129. 130 => 'Interrupt',
  76130. 131 => 'Quit and dump core',
  76131. 132 => 'Illegal instruction',
  76132. 133 => 'Trace/breakpoint trap',
  76133. 134 => 'Process aborted',
  76134. 135 => 'Bus error: "access to undefined portion of memory object"',
  76135. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  76136. 137 => 'Kill (terminate immediately)',
  76137. 138 => 'User-defined 1',
  76138. 139 => 'Segmentation violation',
  76139. 140 => 'User-defined 2',
  76140. 141 => 'Write to pipe with no one reading',
  76141. 142 => 'Signal raised by alarm',
  76142. 143 => 'Termination (request to terminate)',
  76143. 145 => 'Child process terminated, stopped (or continued*)',
  76144. 146 => 'Continue if stopped',
  76145. 147 => 'Stop executing temporarily',
  76146. 148 => 'Terminal stop signal',
  76147. 149 => 'Background process attempting to read from tty ("in")',
  76148. 150 => 'Background process attempting to write to tty ("out")',
  76149. 151 => 'Urgent data available on socket',
  76150. 152 => 'CPU time limit exceeded',
  76151. 153 => 'File size limit exceeded',
  76152. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  76153. 155 => 'Profiling timer expired',
  76154. 157 => 'Pollable event',
  76155. 159 => 'Bad syscall',
  76156. ];
  76157. public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
  76158. {
  76159. if (!\function_exists('proc_open')) {
  76160. throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
  76161. }
  76162. $this->commandline = $command;
  76163. $this->cwd = $cwd;
  76164. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  76165. $this->cwd = getcwd();
  76166. }
  76167. if (null !== $env) {
  76168. $this->setEnv($env);
  76169. }
  76170. $this->setInput($input);
  76171. $this->setTimeout($timeout);
  76172. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  76173. $this->pty = false;
  76174. }
  76175. public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
  76176. {
  76177. $process = new static([], $cwd, $env, $input, $timeout);
  76178. $process->commandline = $command;
  76179. return $process;
  76180. }
  76181. public function __sleep()
  76182. {
  76183. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  76184. }
  76185. public function __wakeup()
  76186. {
  76187. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  76188. }
  76189. public function __destruct()
  76190. {
  76191. if ($this->options['create_new_console'] ?? false) {
  76192. $this->processPipes->close();
  76193. } else {
  76194. $this->stop(0);
  76195. }
  76196. }
  76197. public function __clone()
  76198. {
  76199. $this->resetProcessData();
  76200. }
  76201. public function run(callable $callback = null, array $env = []): int
  76202. {
  76203. $this->start($callback, $env);
  76204. return $this->wait();
  76205. }
  76206. public function mustRun(callable $callback = null, array $env = []): self
  76207. {
  76208. if (0 !== $this->run($callback, $env)) {
  76209. throw new ProcessFailedException($this);
  76210. }
  76211. return $this;
  76212. }
  76213. public function start(callable $callback = null, array $env = [])
  76214. {
  76215. if ($this->isRunning()) {
  76216. throw new RuntimeException('Process is already running.');
  76217. }
  76218. $this->resetProcessData();
  76219. $this->starttime = $this->lastOutputTime = microtime(true);
  76220. $this->callback = $this->buildCallback($callback);
  76221. $this->hasCallback = null !== $callback;
  76222. $descriptors = $this->getDescriptors();
  76223. if ($this->env) {
  76224. $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->env, $env, 'strcasecmp') : $this->env;
  76225. }
  76226. $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->getDefaultEnv(), $env, 'strcasecmp') : $this->getDefaultEnv();
  76227. if (\is_array($commandline = $this->commandline)) {
  76228. $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline));
  76229. if ('\\' !== \DIRECTORY_SEPARATOR) {
  76230. $commandline = 'exec '.$commandline;
  76231. }
  76232. } else {
  76233. $commandline = $this->replacePlaceholders($commandline, $env);
  76234. }
  76235. if ('\\' === \DIRECTORY_SEPARATOR) {
  76236. $commandline = $this->prepareWindowsCommandLine($commandline, $env);
  76237. } elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
  76238. $descriptors[3] = ['pipe', 'w'];
  76239. $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  76240. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  76241. $ptsWorkaround = fopen(__FILE__, 'r');
  76242. }
  76243. $envPairs = [];
  76244. foreach ($env as $k => $v) {
  76245. if (false !== $v && false === \in_array($k, ['argc', 'argv', 'ARGC', 'ARGV'], true)) {
  76246. $envPairs[] = $k.'='.$v;
  76247. }
  76248. }
  76249. if (!is_dir($this->cwd)) {
  76250. throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
  76251. }
  76252. $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
  76253. if (!\is_resource($this->process)) {
  76254. throw new RuntimeException('Unable to launch a new process.');
  76255. }
  76256. $this->status = self::STATUS_STARTED;
  76257. if (isset($descriptors[3])) {
  76258. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  76259. }
  76260. if ($this->tty) {
  76261. return;
  76262. }
  76263. $this->updateStatus(false);
  76264. $this->checkTimeout();
  76265. }
  76266. public function restart(callable $callback = null, array $env = []): self
  76267. {
  76268. if ($this->isRunning()) {
  76269. throw new RuntimeException('Process is already running.');
  76270. }
  76271. $process = clone $this;
  76272. $process->start($callback, $env);
  76273. return $process;
  76274. }
  76275. public function wait(callable $callback = null)
  76276. {
  76277. $this->requireProcessIsStarted(__FUNCTION__);
  76278. $this->updateStatus(false);
  76279. if (null !== $callback) {
  76280. if (!$this->processPipes->haveReadSupport()) {
  76281. $this->stop(0);
  76282. throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait".');
  76283. }
  76284. $this->callback = $this->buildCallback($callback);
  76285. }
  76286. do {
  76287. $this->checkTimeout();
  76288. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  76289. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  76290. } while ($running);
  76291. while ($this->isRunning()) {
  76292. $this->checkTimeout();
  76293. usleep(1000);
  76294. }
  76295. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  76296. throw new ProcessSignaledException($this);
  76297. }
  76298. return $this->exitcode;
  76299. }
  76300. public function waitUntil(callable $callback): bool
  76301. {
  76302. $this->requireProcessIsStarted(__FUNCTION__);
  76303. $this->updateStatus(false);
  76304. if (!$this->processPipes->haveReadSupport()) {
  76305. $this->stop(0);
  76306. throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
  76307. }
  76308. $callback = $this->buildCallback($callback);
  76309. $ready = false;
  76310. while (true) {
  76311. $this->checkTimeout();
  76312. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  76313. $output = $this->processPipes->readAndWrite($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  76314. foreach ($output as $type => $data) {
  76315. if (3 !== $type) {
  76316. $ready = $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data) || $ready;
  76317. } elseif (!isset($this->fallbackStatus['signaled'])) {
  76318. $this->fallbackStatus['exitcode'] = (int) $data;
  76319. }
  76320. }
  76321. if ($ready) {
  76322. return true;
  76323. }
  76324. if (!$running) {
  76325. return false;
  76326. }
  76327. usleep(1000);
  76328. }
  76329. }
  76330. public function getPid()
  76331. {
  76332. return $this->isRunning() ? $this->processInformation['pid'] : null;
  76333. }
  76334. public function signal(int $signal)
  76335. {
  76336. $this->doSignal($signal, true);
  76337. return $this;
  76338. }
  76339. public function disableOutput()
  76340. {
  76341. if ($this->isRunning()) {
  76342. throw new RuntimeException('Disabling output while the process is running is not possible.');
  76343. }
  76344. if (null !== $this->idleTimeout) {
  76345. throw new LogicException('Output cannot be disabled while an idle timeout is set.');
  76346. }
  76347. $this->outputDisabled = true;
  76348. return $this;
  76349. }
  76350. public function enableOutput()
  76351. {
  76352. if ($this->isRunning()) {
  76353. throw new RuntimeException('Enabling output while the process is running is not possible.');
  76354. }
  76355. $this->outputDisabled = false;
  76356. return $this;
  76357. }
  76358. public function isOutputDisabled()
  76359. {
  76360. return $this->outputDisabled;
  76361. }
  76362. public function getOutput()
  76363. {
  76364. $this->readPipesForOutput(__FUNCTION__);
  76365. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  76366. return '';
  76367. }
  76368. return $ret;
  76369. }
  76370. public function getIncrementalOutput()
  76371. {
  76372. $this->readPipesForOutput(__FUNCTION__);
  76373. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  76374. $this->incrementalOutputOffset = ftell($this->stdout);
  76375. if (false === $latest) {
  76376. return '';
  76377. }
  76378. return $latest;
  76379. }
  76380. #[\ReturnTypeWillChange]
  76381. public function getIterator(int $flags = 0)
  76382. {
  76383. $this->readPipesForOutput(__FUNCTION__, false);
  76384. $clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);
  76385. $blocking = !(self::ITER_NON_BLOCKING & $flags);
  76386. $yieldOut = !(self::ITER_SKIP_OUT & $flags);
  76387. $yieldErr = !(self::ITER_SKIP_ERR & $flags);
  76388. while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) {
  76389. if ($yieldOut) {
  76390. $out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  76391. if (isset($out[0])) {
  76392. if ($clearOutput) {
  76393. $this->clearOutput();
  76394. } else {
  76395. $this->incrementalOutputOffset = ftell($this->stdout);
  76396. }
  76397. yield self::OUT => $out;
  76398. }
  76399. }
  76400. if ($yieldErr) {
  76401. $err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  76402. if (isset($err[0])) {
  76403. if ($clearOutput) {
  76404. $this->clearErrorOutput();
  76405. } else {
  76406. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  76407. }
  76408. yield self::ERR => $err;
  76409. }
  76410. }
  76411. if (!$blocking && !isset($out[0]) && !isset($err[0])) {
  76412. yield self::OUT => '';
  76413. }
  76414. $this->checkTimeout();
  76415. $this->readPipesForOutput(__FUNCTION__, $blocking);
  76416. }
  76417. }
  76418. public function clearOutput()
  76419. {
  76420. ftruncate($this->stdout, 0);
  76421. fseek($this->stdout, 0);
  76422. $this->incrementalOutputOffset = 0;
  76423. return $this;
  76424. }
  76425. public function getErrorOutput()
  76426. {
  76427. $this->readPipesForOutput(__FUNCTION__);
  76428. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  76429. return '';
  76430. }
  76431. return $ret;
  76432. }
  76433. public function getIncrementalErrorOutput()
  76434. {
  76435. $this->readPipesForOutput(__FUNCTION__);
  76436. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  76437. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  76438. if (false === $latest) {
  76439. return '';
  76440. }
  76441. return $latest;
  76442. }
  76443. public function clearErrorOutput()
  76444. {
  76445. ftruncate($this->stderr, 0);
  76446. fseek($this->stderr, 0);
  76447. $this->incrementalErrorOutputOffset = 0;
  76448. return $this;
  76449. }
  76450. public function getExitCode()
  76451. {
  76452. $this->updateStatus(false);
  76453. return $this->exitcode;
  76454. }
  76455. public function getExitCodeText()
  76456. {
  76457. if (null === $exitcode = $this->getExitCode()) {
  76458. return null;
  76459. }
  76460. return self::$exitCodes[$exitcode] ?? 'Unknown error';
  76461. }
  76462. public function isSuccessful()
  76463. {
  76464. return 0 === $this->getExitCode();
  76465. }
  76466. public function hasBeenSignaled()
  76467. {
  76468. $this->requireProcessIsTerminated(__FUNCTION__);
  76469. return $this->processInformation['signaled'];
  76470. }
  76471. public function getTermSignal()
  76472. {
  76473. $this->requireProcessIsTerminated(__FUNCTION__);
  76474. if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
  76475. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.');
  76476. }
  76477. return $this->processInformation['termsig'];
  76478. }
  76479. public function hasBeenStopped()
  76480. {
  76481. $this->requireProcessIsTerminated(__FUNCTION__);
  76482. return $this->processInformation['stopped'];
  76483. }
  76484. public function getStopSignal()
  76485. {
  76486. $this->requireProcessIsTerminated(__FUNCTION__);
  76487. return $this->processInformation['stopsig'];
  76488. }
  76489. public function isRunning()
  76490. {
  76491. if (self::STATUS_STARTED !== $this->status) {
  76492. return false;
  76493. }
  76494. $this->updateStatus(false);
  76495. return $this->processInformation['running'];
  76496. }
  76497. public function isStarted()
  76498. {
  76499. return self::STATUS_READY != $this->status;
  76500. }
  76501. public function isTerminated()
  76502. {
  76503. $this->updateStatus(false);
  76504. return self::STATUS_TERMINATED == $this->status;
  76505. }
  76506. public function getStatus()
  76507. {
  76508. $this->updateStatus(false);
  76509. return $this->status;
  76510. }
  76511. public function stop(float $timeout = 10, int $signal = null)
  76512. {
  76513. $timeoutMicro = microtime(true) + $timeout;
  76514. if ($this->isRunning()) {
  76515. $this->doSignal(15, false);
  76516. do {
  76517. usleep(1000);
  76518. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  76519. if ($this->isRunning()) {
  76520. $this->doSignal($signal ?: 9, false);
  76521. }
  76522. }
  76523. if ($this->isRunning()) {
  76524. if (isset($this->fallbackStatus['pid'])) {
  76525. unset($this->fallbackStatus['pid']);
  76526. return $this->stop(0, $signal);
  76527. }
  76528. $this->close();
  76529. }
  76530. return $this->exitcode;
  76531. }
  76532. public function addOutput(string $line)
  76533. {
  76534. $this->lastOutputTime = microtime(true);
  76535. fseek($this->stdout, 0, \SEEK_END);
  76536. fwrite($this->stdout, $line);
  76537. fseek($this->stdout, $this->incrementalOutputOffset);
  76538. }
  76539. public function addErrorOutput(string $line)
  76540. {
  76541. $this->lastOutputTime = microtime(true);
  76542. fseek($this->stderr, 0, \SEEK_END);
  76543. fwrite($this->stderr, $line);
  76544. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  76545. }
  76546. public function getLastOutputTime(): ?float
  76547. {
  76548. return $this->lastOutputTime;
  76549. }
  76550. public function getCommandLine()
  76551. {
  76552. return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline;
  76553. }
  76554. public function getTimeout()
  76555. {
  76556. return $this->timeout;
  76557. }
  76558. public function getIdleTimeout()
  76559. {
  76560. return $this->idleTimeout;
  76561. }
  76562. public function setTimeout(?float $timeout)
  76563. {
  76564. $this->timeout = $this->validateTimeout($timeout);
  76565. return $this;
  76566. }
  76567. public function setIdleTimeout(?float $timeout)
  76568. {
  76569. if (null !== $timeout && $this->outputDisabled) {
  76570. throw new LogicException('Idle timeout cannot be set while the output is disabled.');
  76571. }
  76572. $this->idleTimeout = $this->validateTimeout($timeout);
  76573. return $this;
  76574. }
  76575. public function setTty(bool $tty)
  76576. {
  76577. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  76578. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  76579. }
  76580. if ($tty && !self::isTtySupported()) {
  76581. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  76582. }
  76583. $this->tty = $tty;
  76584. return $this;
  76585. }
  76586. public function isTty()
  76587. {
  76588. return $this->tty;
  76589. }
  76590. public function setPty(bool $bool)
  76591. {
  76592. $this->pty = $bool;
  76593. return $this;
  76594. }
  76595. public function isPty()
  76596. {
  76597. return $this->pty;
  76598. }
  76599. public function getWorkingDirectory()
  76600. {
  76601. if (null === $this->cwd) {
  76602. return getcwd() ?: null;
  76603. }
  76604. return $this->cwd;
  76605. }
  76606. public function setWorkingDirectory(string $cwd)
  76607. {
  76608. $this->cwd = $cwd;
  76609. return $this;
  76610. }
  76611. public function getEnv()
  76612. {
  76613. return $this->env;
  76614. }
  76615. public function setEnv(array $env)
  76616. {
  76617. $this->env = $env;
  76618. return $this;
  76619. }
  76620. public function getInput()
  76621. {
  76622. return $this->input;
  76623. }
  76624. public function setInput($input)
  76625. {
  76626. if ($this->isRunning()) {
  76627. throw new LogicException('Input cannot be set while the process is running.');
  76628. }
  76629. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  76630. return $this;
  76631. }
  76632. public function checkTimeout()
  76633. {
  76634. if (self::STATUS_STARTED !== $this->status) {
  76635. return;
  76636. }
  76637. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  76638. $this->stop(0);
  76639. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  76640. }
  76641. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  76642. $this->stop(0);
  76643. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  76644. }
  76645. }
  76646. public function getStartTime(): float
  76647. {
  76648. if (!$this->isStarted()) {
  76649. throw new LogicException('Start time is only available after process start.');
  76650. }
  76651. return $this->starttime;
  76652. }
  76653. public function setOptions(array $options)
  76654. {
  76655. if ($this->isRunning()) {
  76656. throw new RuntimeException('Setting options while the process is running is not possible.');
  76657. }
  76658. $defaultOptions = $this->options;
  76659. $existingOptions = ['blocking_pipes', 'create_process_group', 'create_new_console'];
  76660. foreach ($options as $key => $value) {
  76661. if (!\in_array($key, $existingOptions)) {
  76662. $this->options = $defaultOptions;
  76663. throw new LogicException(sprintf('Invalid option "%s" passed to "%s()". Supported options are "%s".', $key, __METHOD__, implode('", "', $existingOptions)));
  76664. }
  76665. $this->options[$key] = $value;
  76666. }
  76667. }
  76668. public static function isTtySupported(): bool
  76669. {
  76670. static $isTtySupported;
  76671. if (null === $isTtySupported) {
  76672. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
  76673. }
  76674. return $isTtySupported;
  76675. }
  76676. public static function isPtySupported()
  76677. {
  76678. static $result;
  76679. if (null !== $result) {
  76680. return $result;
  76681. }
  76682. if ('\\' === \DIRECTORY_SEPARATOR) {
  76683. return $result = false;
  76684. }
  76685. return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes);
  76686. }
  76687. private function getDescriptors(): array
  76688. {
  76689. if ($this->input instanceof \Iterator) {
  76690. $this->input->rewind();
  76691. }
  76692. if ('\\' === \DIRECTORY_SEPARATOR) {
  76693. $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
  76694. } else {
  76695. $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
  76696. }
  76697. return $this->processPipes->getDescriptors();
  76698. }
  76699. protected function buildCallback(callable $callback = null)
  76700. {
  76701. if ($this->outputDisabled) {
  76702. return function ($type, $data) use ($callback): bool {
  76703. return null !== $callback && $callback($type, $data);
  76704. };
  76705. }
  76706. $out = self::OUT;
  76707. return function ($type, $data) use ($callback, $out): bool {
  76708. if ($out == $type) {
  76709. $this->addOutput($data);
  76710. } else {
  76711. $this->addErrorOutput($data);
  76712. }
  76713. return null !== $callback && $callback($type, $data);
  76714. };
  76715. }
  76716. protected function updateStatus(bool $blocking)
  76717. {
  76718. if (self::STATUS_STARTED !== $this->status) {
  76719. return;
  76720. }
  76721. $this->processInformation = proc_get_status($this->process);
  76722. $running = $this->processInformation['running'];
  76723. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  76724. if ($this->fallbackStatus && $this->isSigchildEnabled()) {
  76725. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  76726. }
  76727. if (!$running) {
  76728. $this->close();
  76729. }
  76730. }
  76731. protected function isSigchildEnabled()
  76732. {
  76733. if (null !== self::$sigchild) {
  76734. return self::$sigchild;
  76735. }
  76736. if (!\function_exists('phpinfo')) {
  76737. return self::$sigchild = false;
  76738. }
  76739. ob_start();
  76740. phpinfo(\INFO_GENERAL);
  76741. return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
  76742. }
  76743. private function readPipesForOutput(string $caller, bool $blocking = false)
  76744. {
  76745. if ($this->outputDisabled) {
  76746. throw new LogicException('Output has been disabled.');
  76747. }
  76748. $this->requireProcessIsStarted($caller);
  76749. $this->updateStatus($blocking);
  76750. }
  76751. private function validateTimeout(?float $timeout): ?float
  76752. {
  76753. $timeout = (float) $timeout;
  76754. if (0.0 === $timeout) {
  76755. $timeout = null;
  76756. } elseif ($timeout < 0) {
  76757. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  76758. }
  76759. return $timeout;
  76760. }
  76761. private function readPipes(bool $blocking, bool $close)
  76762. {
  76763. $result = $this->processPipes->readAndWrite($blocking, $close);
  76764. $callback = $this->callback;
  76765. foreach ($result as $type => $data) {
  76766. if (3 !== $type) {
  76767. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  76768. } elseif (!isset($this->fallbackStatus['signaled'])) {
  76769. $this->fallbackStatus['exitcode'] = (int) $data;
  76770. }
  76771. }
  76772. }
  76773. private function close(): int
  76774. {
  76775. $this->processPipes->close();
  76776. if (\is_resource($this->process)) {
  76777. proc_close($this->process);
  76778. }
  76779. $this->exitcode = $this->processInformation['exitcode'];
  76780. $this->status = self::STATUS_TERMINATED;
  76781. if (-1 === $this->exitcode) {
  76782. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  76783. $this->exitcode = 128 + $this->processInformation['termsig'];
  76784. } elseif ($this->isSigchildEnabled()) {
  76785. $this->processInformation['signaled'] = true;
  76786. $this->processInformation['termsig'] = -1;
  76787. }
  76788. }
  76789. $this->callback = null;
  76790. return $this->exitcode;
  76791. }
  76792. private function resetProcessData()
  76793. {
  76794. $this->starttime = null;
  76795. $this->callback = null;
  76796. $this->exitcode = null;
  76797. $this->fallbackStatus = [];
  76798. $this->processInformation = null;
  76799. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
  76800. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
  76801. $this->process = null;
  76802. $this->latestSignal = null;
  76803. $this->status = self::STATUS_READY;
  76804. $this->incrementalOutputOffset = 0;
  76805. $this->incrementalErrorOutputOffset = 0;
  76806. }
  76807. private function doSignal(int $signal, bool $throwException): bool
  76808. {
  76809. if (null === $pid = $this->getPid()) {
  76810. if ($throwException) {
  76811. throw new LogicException('Cannot send signal on a non running process.');
  76812. }
  76813. return false;
  76814. }
  76815. if ('\\' === \DIRECTORY_SEPARATOR) {
  76816. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  76817. if ($exitCode && $this->isRunning()) {
  76818. if ($throwException) {
  76819. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  76820. }
  76821. return false;
  76822. }
  76823. } else {
  76824. if (!$this->isSigchildEnabled()) {
  76825. $ok = @proc_terminate($this->process, $signal);
  76826. } elseif (\function_exists('posix_kill')) {
  76827. $ok = @posix_kill($pid, $signal);
  76828. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
  76829. $ok = false === fgets($pipes[2]);
  76830. }
  76831. if (!$ok) {
  76832. if ($throwException) {
  76833. throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
  76834. }
  76835. return false;
  76836. }
  76837. }
  76838. $this->latestSignal = $signal;
  76839. $this->fallbackStatus['signaled'] = true;
  76840. $this->fallbackStatus['exitcode'] = -1;
  76841. $this->fallbackStatus['termsig'] = $this->latestSignal;
  76842. return true;
  76843. }
  76844. private function prepareWindowsCommandLine(string $cmd, array &$env): string
  76845. {
  76846. $uid = uniqid('', true);
  76847. $varCount = 0;
  76848. $varCache = [];
  76849. $cmd = preg_replace_callback(
  76850. '/"(?:(
  76851. [^"%!^]*+
  76852. (?:
  76853. (?: !LF! | "(?:\^[%!^])?+" )
  76854. [^"%!^]*+
  76855. )++
  76856. ) | [^"]*+ )"/x',
  76857. function ($m) use (&$env, &$varCache, &$varCount, $uid) {
  76858. if (!isset($m[1])) {
  76859. return $m[0];
  76860. }
  76861. if (isset($varCache[$m[0]])) {
  76862. return $varCache[$m[0]];
  76863. }
  76864. if (str_contains($value = $m[1], "\0")) {
  76865. $value = str_replace("\0", '?', $value);
  76866. }
  76867. if (false === strpbrk($value, "\"%!\n")) {
  76868. return '"'.$value.'"';
  76869. }
  76870. $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value);
  76871. $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
  76872. $var = $uid.++$varCount;
  76873. $env[$var] = $value;
  76874. return $varCache[$m[0]] = '!'.$var.'!';
  76875. },
  76876. $cmd
  76877. );
  76878. $cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
  76879. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  76880. $cmd .= ' '.$offset.'>"'.$filename.'"';
  76881. }
  76882. return $cmd;
  76883. }
  76884. private function requireProcessIsStarted(string $functionName)
  76885. {
  76886. if (!$this->isStarted()) {
  76887. throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
  76888. }
  76889. }
  76890. private function requireProcessIsTerminated(string $functionName)
  76891. {
  76892. if (!$this->isTerminated()) {
  76893. throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));
  76894. }
  76895. }
  76896. private function escapeArgument(?string $argument): string
  76897. {
  76898. if ('' === $argument || null === $argument) {
  76899. return '""';
  76900. }
  76901. if ('\\' !== \DIRECTORY_SEPARATOR) {
  76902. return "'".str_replace("'", "'\\''", $argument)."'";
  76903. }
  76904. if (str_contains($argument, "\0")) {
  76905. $argument = str_replace("\0", '?', $argument);
  76906. }
  76907. if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
  76908. return $argument;
  76909. }
  76910. $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);
  76911. return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
  76912. }
  76913. private function replacePlaceholders(string $commandline, array $env)
  76914. {
  76915. return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
  76916. if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
  76917. throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline);
  76918. }
  76919. return $this->escapeArgument($env[$matches[1]]);
  76920. }, $commandline);
  76921. }
  76922. private function getDefaultEnv(): array
  76923. {
  76924. $env = getenv();
  76925. $env = ('\\' === \DIRECTORY_SEPARATOR ? array_intersect_ukey($env, $_SERVER, 'strcasecmp') : array_intersect_key($env, $_SERVER)) ?: $env;
  76926. return $_ENV + ('\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($env, $_ENV, 'strcasecmp') : $env);
  76927. }
  76928. }
  76929. <?php
  76930. namespace Symfony\Component\Process;
  76931. use Symfony\Component\Process\Exception\InvalidArgumentException;
  76932. class ProcessUtils
  76933. {
  76934. private function __construct()
  76935. {
  76936. }
  76937. public static function validateInput(string $caller, $input)
  76938. {
  76939. if (null !== $input) {
  76940. if (\is_resource($input)) {
  76941. return $input;
  76942. }
  76943. if (\is_string($input)) {
  76944. return $input;
  76945. }
  76946. if (is_scalar($input)) {
  76947. return (string) $input;
  76948. }
  76949. if ($input instanceof Process) {
  76950. return $input->getIterator($input::ITER_SKIP_ERR);
  76951. }
  76952. if ($input instanceof \Iterator) {
  76953. return $input;
  76954. }
  76955. if ($input instanceof \Traversable) {
  76956. return new \IteratorIterator($input);
  76957. }
  76958. throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
  76959. }
  76960. return $input;
  76961. }
  76962. }
  76963. <?php
  76964. namespace Symfony\Contracts\Service\Attribute;
  76965. #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
  76966. final class Required
  76967. {
  76968. }
  76969. <?php
  76970. namespace Symfony\Contracts\Service\Attribute;
  76971. use Symfony\Contracts\Service\ServiceSubscriberTrait;
  76972. #[\Attribute(\Attribute::TARGET_METHOD)]
  76973. final class SubscribedService
  76974. {
  76975. public function __construct(
  76976. public ?string $key = null
  76977. ) {
  76978. }
  76979. }
  76980. Copyright (c) 2018-2021 Fabien Potencier
  76981. Permission is hereby granted, free of charge, to any person obtaining a copy
  76982. of this software and associated documentation files (the "Software"), to deal
  76983. in the Software without restriction, including without limitation the rights
  76984. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  76985. copies of the Software, and to permit persons to whom the Software is furnished
  76986. to do so, subject to the following conditions:
  76987. The above copyright notice and this permission notice shall be included in all
  76988. copies or substantial portions of the Software.
  76989. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  76990. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  76991. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  76992. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  76993. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  76994. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  76995. THE SOFTWARE.
  76996. <?php
  76997. namespace Symfony\Contracts\Service;
  76998. interface ResetInterface
  76999. {
  77000. public function reset();
  77001. }
  77002. <?php
  77003. namespace Symfony\Contracts\Service;
  77004. use Psr\Container\ContainerExceptionInterface;
  77005. use Psr\Container\NotFoundExceptionInterface;
  77006. class_exists(ContainerExceptionInterface::class);
  77007. class_exists(NotFoundExceptionInterface::class);
  77008. trait ServiceLocatorTrait
  77009. {
  77010. private $factories;
  77011. private $loading = [];
  77012. private $providedTypes;
  77013. public function __construct(array $factories)
  77014. {
  77015. $this->factories = $factories;
  77016. }
  77017. public function has(string $id)
  77018. {
  77019. return isset($this->factories[$id]);
  77020. }
  77021. public function get(string $id)
  77022. {
  77023. if (!isset($this->factories[$id])) {
  77024. throw $this->createNotFoundException($id);
  77025. }
  77026. if (isset($this->loading[$id])) {
  77027. $ids = array_values($this->loading);
  77028. $ids = \array_slice($this->loading, array_search($id, $ids));
  77029. $ids[] = $id;
  77030. throw $this->createCircularReferenceException($id, $ids);
  77031. }
  77032. $this->loading[$id] = $id;
  77033. try {
  77034. return $this->factories[$id]($this);
  77035. } finally {
  77036. unset($this->loading[$id]);
  77037. }
  77038. }
  77039. public function getProvidedServices(): array
  77040. {
  77041. if (null === $this->providedTypes) {
  77042. $this->providedTypes = [];
  77043. foreach ($this->factories as $name => $factory) {
  77044. if (!\is_callable($factory)) {
  77045. $this->providedTypes[$name] = '?';
  77046. } else {
  77047. $type = (new \ReflectionFunction($factory))->getReturnType();
  77048. $this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
  77049. }
  77050. }
  77051. }
  77052. return $this->providedTypes;
  77053. }
  77054. private function createNotFoundException(string $id): NotFoundExceptionInterface
  77055. {
  77056. if (!$alternatives = array_keys($this->factories)) {
  77057. $message = 'is empty...';
  77058. } else {
  77059. $last = array_pop($alternatives);
  77060. if ($alternatives) {
  77061. $message = sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
  77062. } else {
  77063. $message = sprintf('only knows about the "%s" service.', $last);
  77064. }
  77065. }
  77066. if ($this->loading) {
  77067. $message = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
  77068. } else {
  77069. $message = sprintf('Service "%s" not found: the current service locator %s', $id, $message);
  77070. }
  77071. return new class($message) extends \InvalidArgumentException implements NotFoundExceptionInterface {
  77072. };
  77073. }
  77074. private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface
  77075. {
  77076. return new class(sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
  77077. };
  77078. }
  77079. }
  77080. <?php
  77081. namespace Symfony\Contracts\Service;
  77082. use Psr\Container\ContainerInterface;
  77083. interface ServiceProviderInterface extends ContainerInterface
  77084. {
  77085. public function getProvidedServices(): array;
  77086. }
  77087. <?php
  77088. namespace Symfony\Contracts\Service;
  77089. interface ServiceSubscriberInterface
  77090. {
  77091. public static function getSubscribedServices();
  77092. }
  77093. <?php
  77094. namespace Symfony\Contracts\Service;
  77095. use Psr\Container\ContainerInterface;
  77096. use Symfony\Contracts\Service\Attribute\SubscribedService;
  77097. trait ServiceSubscriberTrait
  77098. {
  77099. protected $container;
  77100. public static function getSubscribedServices(): array
  77101. {
  77102. static $services;
  77103. if (null !== $services) {
  77104. return $services;
  77105. }
  77106. $services = \is_callable(['parent', __FUNCTION__]) ? parent::getSubscribedServices() : [];
  77107. $attributeOptIn = false;
  77108. if (\PHP_VERSION_ID >= 80000) {
  77109. foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
  77110. if (self::class !== $method->getDeclaringClass()->name) {
  77111. continue;
  77112. }
  77113. if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) {
  77114. continue;
  77115. }
  77116. if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
  77117. throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
  77118. }
  77119. if (!$returnType = $method->getReturnType()) {
  77120. throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
  77121. }
  77122. $serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
  77123. if ($returnType->allowsNull()) {
  77124. $serviceId = '?'.$serviceId;
  77125. }
  77126. $services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId;
  77127. $attributeOptIn = true;
  77128. }
  77129. }
  77130. if (!$attributeOptIn) {
  77131. foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
  77132. if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
  77133. continue;
  77134. }
  77135. if (self::class !== $method->getDeclaringClass()->name) {
  77136. continue;
  77137. }
  77138. if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) {
  77139. continue;
  77140. }
  77141. if ($returnType->isBuiltin()) {
  77142. continue;
  77143. }
  77144. if (\PHP_VERSION_ID >= 80000) {
  77145. trigger_deprecation('symfony/service-contracts', '2.5', 'Using "%s" in "%s" without using the "%s" attribute on any method is deprecated.', ServiceSubscriberTrait::class, self::class, SubscribedService::class);
  77146. }
  77147. $services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType);
  77148. }
  77149. }
  77150. return $services;
  77151. }
  77152. public function setContainer(ContainerInterface $container)
  77153. {
  77154. $this->container = $container;
  77155. if (\is_callable(['parent', __FUNCTION__])) {
  77156. return parent::setContainer($container);
  77157. }
  77158. return null;
  77159. }
  77160. }
  77161. <?php
  77162. namespace Symfony\Contracts\Service\Test;
  77163. use PHPUnit\Framework\TestCase;
  77164. use Psr\Container\ContainerInterface;
  77165. use Symfony\Contracts\Service\ServiceLocatorTrait;
  77166. abstract class ServiceLocatorTest extends TestCase
  77167. {
  77168. protected function getServiceLocator(array $factories)
  77169. {
  77170. return new class($factories) implements ContainerInterface {
  77171. use ServiceLocatorTrait;
  77172. };
  77173. }
  77174. public function testHas()
  77175. {
  77176. $locator = $this->getServiceLocator([
  77177. 'foo' => function () { return 'bar'; },
  77178. 'bar' => function () { return 'baz'; },
  77179. function () { return 'dummy'; },
  77180. ]);
  77181. $this->assertTrue($locator->has('foo'));
  77182. $this->assertTrue($locator->has('bar'));
  77183. $this->assertFalse($locator->has('dummy'));
  77184. }
  77185. public function testGet()
  77186. {
  77187. $locator = $this->getServiceLocator([
  77188. 'foo' => function () { return 'bar'; },
  77189. 'bar' => function () { return 'baz'; },
  77190. ]);
  77191. $this->assertSame('bar', $locator->get('foo'));
  77192. $this->assertSame('baz', $locator->get('bar'));
  77193. }
  77194. public function testGetDoesNotMemoize()
  77195. {
  77196. $i = 0;
  77197. $locator = $this->getServiceLocator([
  77198. 'foo' => function () use (&$i) {
  77199. ++$i;
  77200. return 'bar';
  77201. },
  77202. ]);
  77203. $this->assertSame('bar', $locator->get('foo'));
  77204. $this->assertSame('bar', $locator->get('foo'));
  77205. $this->assertSame(2, $i);
  77206. }
  77207. public function testThrowsOnUndefinedInternalService()
  77208. {
  77209. if (!$this->getExpectedException()) {
  77210. $this->expectException(\Psr\Container\NotFoundExceptionInterface::class);
  77211. $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
  77212. }
  77213. $locator = $this->getServiceLocator([
  77214. 'foo' => function () use (&$locator) { return $locator->get('bar'); },
  77215. ]);
  77216. $locator->get('foo');
  77217. }
  77218. public function testThrowsOnCircularReference()
  77219. {
  77220. $this->expectException(\Psr\Container\ContainerExceptionInterface::class);
  77221. $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
  77222. $locator = $this->getServiceLocator([
  77223. 'foo' => function () use (&$locator) { return $locator->get('bar'); },
  77224. 'bar' => function () use (&$locator) { return $locator->get('baz'); },
  77225. 'baz' => function () use (&$locator) { return $locator->get('bar'); },
  77226. ]);
  77227. $locator->get('foo');
  77228. }
  77229. }
  77230. <?php
  77231. namespace Symfony\Component\String;
  77232. use Symfony\Component\String\Exception\ExceptionInterface;
  77233. use Symfony\Component\String\Exception\InvalidArgumentException;
  77234. use Symfony\Component\String\Exception\RuntimeException;
  77235. abstract class AbstractString implements \Stringable, \JsonSerializable
  77236. {
  77237. public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER;
  77238. public const PREG_SET_ORDER = \PREG_SET_ORDER;
  77239. public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE;
  77240. public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL;
  77241. public const PREG_SPLIT = 0;
  77242. public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY;
  77243. public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE;
  77244. public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE;
  77245. protected $string = '';
  77246. protected $ignoreCase = false;
  77247. abstract public function __construct(string $string = '');
  77248. public static function unwrap(array $values): array
  77249. {
  77250. foreach ($values as $k => $v) {
  77251. if ($v instanceof self) {
  77252. $values[$k] = $v->__toString();
  77253. } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) {
  77254. $values[$k] = $v;
  77255. }
  77256. }
  77257. return $values;
  77258. }
  77259. public static function wrap(array $values): array
  77260. {
  77261. $i = 0;
  77262. $keys = null;
  77263. foreach ($values as $k => $v) {
  77264. if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) {
  77265. $keys = $keys ?? array_keys($values);
  77266. $keys[$i] = $j;
  77267. }
  77268. if (\is_string($v)) {
  77269. $values[$k] = new static($v);
  77270. } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) {
  77271. $values[$k] = $v;
  77272. }
  77273. ++$i;
  77274. }
  77275. return null !== $keys ? array_combine($keys, $values) : $values;
  77276. }
  77277. public function after($needle, bool $includeNeedle = false, int $offset = 0): self
  77278. {
  77279. $str = clone $this;
  77280. $i = \PHP_INT_MAX;
  77281. foreach ((array) $needle as $n) {
  77282. $n = (string) $n;
  77283. $j = $this->indexOf($n, $offset);
  77284. if (null !== $j && $j < $i) {
  77285. $i = $j;
  77286. $str->string = $n;
  77287. }
  77288. }
  77289. if (\PHP_INT_MAX === $i) {
  77290. return $str;
  77291. }
  77292. if (!$includeNeedle) {
  77293. $i += $str->length();
  77294. }
  77295. return $this->slice($i);
  77296. }
  77297. public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self
  77298. {
  77299. $str = clone $this;
  77300. $i = null;
  77301. foreach ((array) $needle as $n) {
  77302. $n = (string) $n;
  77303. $j = $this->indexOfLast($n, $offset);
  77304. if (null !== $j && $j >= $i) {
  77305. $i = $offset = $j;
  77306. $str->string = $n;
  77307. }
  77308. }
  77309. if (null === $i) {
  77310. return $str;
  77311. }
  77312. if (!$includeNeedle) {
  77313. $i += $str->length();
  77314. }
  77315. return $this->slice($i);
  77316. }
  77317. abstract public function append(string ...$suffix): self;
  77318. public function before($needle, bool $includeNeedle = false, int $offset = 0): self
  77319. {
  77320. $str = clone $this;
  77321. $i = \PHP_INT_MAX;
  77322. foreach ((array) $needle as $n) {
  77323. $n = (string) $n;
  77324. $j = $this->indexOf($n, $offset);
  77325. if (null !== $j && $j < $i) {
  77326. $i = $j;
  77327. $str->string = $n;
  77328. }
  77329. }
  77330. if (\PHP_INT_MAX === $i) {
  77331. return $str;
  77332. }
  77333. if ($includeNeedle) {
  77334. $i += $str->length();
  77335. }
  77336. return $this->slice(0, $i);
  77337. }
  77338. public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self
  77339. {
  77340. $str = clone $this;
  77341. $i = null;
  77342. foreach ((array) $needle as $n) {
  77343. $n = (string) $n;
  77344. $j = $this->indexOfLast($n, $offset);
  77345. if (null !== $j && $j >= $i) {
  77346. $i = $offset = $j;
  77347. $str->string = $n;
  77348. }
  77349. }
  77350. if (null === $i) {
  77351. return $str;
  77352. }
  77353. if ($includeNeedle) {
  77354. $i += $str->length();
  77355. }
  77356. return $this->slice(0, $i);
  77357. }
  77358. public function bytesAt(int $offset): array
  77359. {
  77360. $str = $this->slice($offset, 1);
  77361. return '' === $str->string ? [] : array_values(unpack('C*', $str->string));
  77362. }
  77363. abstract public function camel(): self;
  77364. abstract public function chunk(int $length = 1): array;
  77365. public function collapseWhitespace(): self
  77366. {
  77367. $str = clone $this;
  77368. $str->string = trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $str->string));
  77369. return $str;
  77370. }
  77371. public function containsAny($needle): bool
  77372. {
  77373. return null !== $this->indexOf($needle);
  77374. }
  77375. public function endsWith($suffix): bool
  77376. {
  77377. if (!\is_array($suffix) && !$suffix instanceof \Traversable) {
  77378. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  77379. }
  77380. foreach ($suffix as $s) {
  77381. if ($this->endsWith((string) $s)) {
  77382. return true;
  77383. }
  77384. }
  77385. return false;
  77386. }
  77387. public function ensureEnd(string $suffix): self
  77388. {
  77389. if (!$this->endsWith($suffix)) {
  77390. return $this->append($suffix);
  77391. }
  77392. $suffix = preg_quote($suffix);
  77393. $regex = '{('.$suffix.')(?:'.$suffix.')++$}D';
  77394. return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1');
  77395. }
  77396. public function ensureStart(string $prefix): self
  77397. {
  77398. $prefix = new static($prefix);
  77399. if (!$this->startsWith($prefix)) {
  77400. return $this->prepend($prefix);
  77401. }
  77402. $str = clone $this;
  77403. $i = $prefixLen = $prefix->length();
  77404. while ($this->indexOf($prefix, $i) === $i) {
  77405. $str = $str->slice($prefixLen);
  77406. $i += $prefixLen;
  77407. }
  77408. return $str;
  77409. }
  77410. public function equalsTo($string): bool
  77411. {
  77412. if (!\is_array($string) && !$string instanceof \Traversable) {
  77413. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  77414. }
  77415. foreach ($string as $s) {
  77416. if ($this->equalsTo((string) $s)) {
  77417. return true;
  77418. }
  77419. }
  77420. return false;
  77421. }
  77422. abstract public function folded(): self;
  77423. public function ignoreCase(): self
  77424. {
  77425. $str = clone $this;
  77426. $str->ignoreCase = true;
  77427. return $str;
  77428. }
  77429. public function indexOf($needle, int $offset = 0): ?int
  77430. {
  77431. if (!\is_array($needle) && !$needle instanceof \Traversable) {
  77432. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  77433. }
  77434. $i = \PHP_INT_MAX;
  77435. foreach ($needle as $n) {
  77436. $j = $this->indexOf((string) $n, $offset);
  77437. if (null !== $j && $j < $i) {
  77438. $i = $j;
  77439. }
  77440. }
  77441. return \PHP_INT_MAX === $i ? null : $i;
  77442. }
  77443. public function indexOfLast($needle, int $offset = 0): ?int
  77444. {
  77445. if (!\is_array($needle) && !$needle instanceof \Traversable) {
  77446. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  77447. }
  77448. $i = null;
  77449. foreach ($needle as $n) {
  77450. $j = $this->indexOfLast((string) $n, $offset);
  77451. if (null !== $j && $j >= $i) {
  77452. $i = $offset = $j;
  77453. }
  77454. }
  77455. return $i;
  77456. }
  77457. public function isEmpty(): bool
  77458. {
  77459. return '' === $this->string;
  77460. }
  77461. abstract public function join(array $strings, string $lastGlue = null): self;
  77462. public function jsonSerialize(): string
  77463. {
  77464. return $this->string;
  77465. }
  77466. abstract public function length(): int;
  77467. abstract public function lower(): self;
  77468. abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
  77469. abstract public function padBoth(int $length, string $padStr = ' '): self;
  77470. abstract public function padEnd(int $length, string $padStr = ' '): self;
  77471. abstract public function padStart(int $length, string $padStr = ' '): self;
  77472. abstract public function prepend(string ...$prefix): self;
  77473. public function repeat(int $multiplier): self
  77474. {
  77475. if (0 > $multiplier) {
  77476. throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier));
  77477. }
  77478. $str = clone $this;
  77479. $str->string = str_repeat($str->string, $multiplier);
  77480. return $str;
  77481. }
  77482. abstract public function replace(string $from, string $to): self;
  77483. abstract public function replaceMatches(string $fromRegexp, $to): self;
  77484. abstract public function reverse(): self;
  77485. abstract public function slice(int $start = 0, int $length = null): self;
  77486. abstract public function snake(): self;
  77487. abstract public function splice(string $replacement, int $start = 0, int $length = null): self;
  77488. public function split(string $delimiter, int $limit = null, int $flags = null): array
  77489. {
  77490. if (null === $flags) {
  77491. throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.');
  77492. }
  77493. if ($this->ignoreCase) {
  77494. $delimiter .= 'i';
  77495. }
  77496. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  77497. try {
  77498. if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) {
  77499. $lastError = preg_last_error();
  77500. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  77501. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  77502. throw new RuntimeException('Splitting failed with '.$k.'.');
  77503. }
  77504. }
  77505. throw new RuntimeException('Splitting failed with unknown error code.');
  77506. }
  77507. } finally {
  77508. restore_error_handler();
  77509. }
  77510. $str = clone $this;
  77511. if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) {
  77512. foreach ($chunks as &$chunk) {
  77513. $str->string = $chunk[0];
  77514. $chunk[0] = clone $str;
  77515. }
  77516. } else {
  77517. foreach ($chunks as &$chunk) {
  77518. $str->string = $chunk;
  77519. $chunk = clone $str;
  77520. }
  77521. }
  77522. return $chunks;
  77523. }
  77524. public function startsWith($prefix): bool
  77525. {
  77526. if (!\is_array($prefix) && !$prefix instanceof \Traversable) {
  77527. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  77528. }
  77529. foreach ($prefix as $prefix) {
  77530. if ($this->startsWith((string) $prefix)) {
  77531. return true;
  77532. }
  77533. }
  77534. return false;
  77535. }
  77536. abstract public function title(bool $allWords = false): self;
  77537. public function toByteString(string $toEncoding = null): ByteString
  77538. {
  77539. $b = new ByteString();
  77540. $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding;
  77541. if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') {
  77542. $b->string = $this->string;
  77543. return $b;
  77544. }
  77545. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  77546. try {
  77547. try {
  77548. $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8');
  77549. } catch (InvalidArgumentException $e) {
  77550. if (!\function_exists('iconv')) {
  77551. throw $e;
  77552. }
  77553. $b->string = iconv('UTF-8', $toEncoding, $this->string);
  77554. }
  77555. } finally {
  77556. restore_error_handler();
  77557. }
  77558. return $b;
  77559. }
  77560. public function toCodePointString(): CodePointString
  77561. {
  77562. return new CodePointString($this->string);
  77563. }
  77564. public function toString(): string
  77565. {
  77566. return $this->string;
  77567. }
  77568. public function toUnicodeString(): UnicodeString
  77569. {
  77570. return new UnicodeString($this->string);
  77571. }
  77572. abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  77573. abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  77574. public function trimPrefix($prefix): self
  77575. {
  77576. if (\is_array($prefix) || $prefix instanceof \Traversable) {
  77577. foreach ($prefix as $s) {
  77578. $t = $this->trimPrefix($s);
  77579. if ($t->string !== $this->string) {
  77580. return $t;
  77581. }
  77582. }
  77583. return clone $this;
  77584. }
  77585. $str = clone $this;
  77586. if ($prefix instanceof self) {
  77587. $prefix = $prefix->string;
  77588. } else {
  77589. $prefix = (string) $prefix;
  77590. }
  77591. if ('' !== $prefix && \strlen($this->string) >= \strlen($prefix) && 0 === substr_compare($this->string, $prefix, 0, \strlen($prefix), $this->ignoreCase)) {
  77592. $str->string = substr($this->string, \strlen($prefix));
  77593. }
  77594. return $str;
  77595. }
  77596. abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  77597. public function trimSuffix($suffix): self
  77598. {
  77599. if (\is_array($suffix) || $suffix instanceof \Traversable) {
  77600. foreach ($suffix as $s) {
  77601. $t = $this->trimSuffix($s);
  77602. if ($t->string !== $this->string) {
  77603. return $t;
  77604. }
  77605. }
  77606. return clone $this;
  77607. }
  77608. $str = clone $this;
  77609. if ($suffix instanceof self) {
  77610. $suffix = $suffix->string;
  77611. } else {
  77612. $suffix = (string) $suffix;
  77613. }
  77614. if ('' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase)) {
  77615. $str->string = substr($this->string, 0, -\strlen($suffix));
  77616. }
  77617. return $str;
  77618. }
  77619. public function truncate(int $length, string $ellipsis = '', bool $cut = true): self
  77620. {
  77621. $stringLength = $this->length();
  77622. if ($stringLength <= $length) {
  77623. return clone $this;
  77624. }
  77625. $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0;
  77626. if ($length < $ellipsisLength) {
  77627. $ellipsisLength = 0;
  77628. }
  77629. if (!$cut) {
  77630. if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) {
  77631. return clone $this;
  77632. }
  77633. $length += $ellipsisLength;
  77634. }
  77635. $str = $this->slice(0, $length - $ellipsisLength);
  77636. return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str;
  77637. }
  77638. abstract public function upper(): self;
  77639. abstract public function width(bool $ignoreAnsiDecoration = true): int;
  77640. public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self
  77641. {
  77642. $lines = '' !== $break ? $this->split($break) : [clone $this];
  77643. $chars = [];
  77644. $mask = '';
  77645. if (1 === \count($lines) && '' === $lines[0]->string) {
  77646. return $lines[0];
  77647. }
  77648. foreach ($lines as $i => $line) {
  77649. if ($i) {
  77650. $chars[] = $break;
  77651. $mask .= '#';
  77652. }
  77653. foreach ($line->chunk() as $char) {
  77654. $chars[] = $char->string;
  77655. $mask .= ' ' === $char->string ? ' ' : '?';
  77656. }
  77657. }
  77658. $string = '';
  77659. $j = 0;
  77660. $b = $i = -1;
  77661. $mask = wordwrap($mask, $width, '#', $cut);
  77662. while (false !== $b = strpos($mask, '#', $b + 1)) {
  77663. for (++$i; $i < $b; ++$i) {
  77664. $string .= $chars[$j];
  77665. unset($chars[$j++]);
  77666. }
  77667. if ($break === $chars[$j] || ' ' === $chars[$j]) {
  77668. unset($chars[$j++]);
  77669. }
  77670. $string .= $break;
  77671. }
  77672. $str = clone $this;
  77673. $str->string = $string.implode('', $chars);
  77674. return $str;
  77675. }
  77676. public function __sleep(): array
  77677. {
  77678. return ['string'];
  77679. }
  77680. public function __clone()
  77681. {
  77682. $this->ignoreCase = false;
  77683. }
  77684. public function __toString(): string
  77685. {
  77686. return $this->string;
  77687. }
  77688. }
  77689. <?php
  77690. namespace Symfony\Component\String;
  77691. use Symfony\Component\String\Exception\ExceptionInterface;
  77692. use Symfony\Component\String\Exception\InvalidArgumentException;
  77693. use Symfony\Component\String\Exception\RuntimeException;
  77694. abstract class AbstractUnicodeString extends AbstractString
  77695. {
  77696. public const NFC = \Normalizer::NFC;
  77697. public const NFD = \Normalizer::NFD;
  77698. public const NFKC = \Normalizer::NFKC;
  77699. public const NFKD = \Normalizer::NFKD;
  77700. private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  77701. private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', '�', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', '�', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', '�', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', '�', 'ᾎ', '�', '�', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', '�', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', '�', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
  77702. private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', '�', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', '�', 'ὒ', 'ὔ', 'ὖ', 'ἀι', '�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', '�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', '�', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
  77703. private const UPPER_FROM = ['ß', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', '�', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];
  77704. private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ�', 'Ϋ�', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓�', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ�', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ�', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂'];
  77705. private const TRANSLIT_FROM = ['Æ', '�', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', '�', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', '�', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', '�', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', '�', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', '�', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', '�', 'Ɏ', '�', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', '�', '�', 'ʑ', 'ʙ', 'ʛ', 'ʜ', '�', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', '�', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', '�', '�', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', '�', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', '�', 'ᶎ', '�', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', '�', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '�', '�', '�', '�', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '�', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '�', '„', '‟', '′', '″', '�', '〞', '«', '»', '‹', '›', '�', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '�', '�', '�', '�', '�', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '�', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆'];
  77706. private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))'];
  77707. private static $transliterators = [];
  77708. private static $tableZero;
  77709. private static $tableWide;
  77710. public static function fromCodePoints(int ...$codes): self
  77711. {
  77712. $string = '';
  77713. foreach ($codes as $code) {
  77714. if (0x80 > $code %= 0x200000) {
  77715. $string .= \chr($code);
  77716. } elseif (0x800 > $code) {
  77717. $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  77718. } elseif (0x10000 > $code) {
  77719. $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  77720. } else {
  77721. $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  77722. }
  77723. }
  77724. return new static($string);
  77725. }
  77726. public function ascii(array $rules = []): self
  77727. {
  77728. $str = clone $this;
  77729. $s = $str->string;
  77730. $str->string = '';
  77731. array_unshift($rules, 'nfd');
  77732. $rules[] = 'latin-ascii';
  77733. if (\function_exists('transliterator_transliterate')) {
  77734. $rules[] = 'any-latin/bgn';
  77735. }
  77736. $rules[] = 'nfkd';
  77737. $rules[] = '[:nonspacing mark:] remove';
  77738. while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) {
  77739. if (0 < --$i) {
  77740. $str->string .= substr($s, 0, $i);
  77741. $s = substr($s, $i);
  77742. }
  77743. if (!$rule = array_shift($rules)) {
  77744. $rules = [];
  77745. }
  77746. if ($rule instanceof \Transliterator) {
  77747. $s = $rule->transliterate($s);
  77748. } elseif ($rule instanceof \Closure) {
  77749. $s = $rule($s);
  77750. } elseif ($rule) {
  77751. if ('nfd' === $rule = strtolower($rule)) {
  77752. normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD);
  77753. } elseif ('nfkd' === $rule) {
  77754. normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD);
  77755. } elseif ('[:nonspacing mark:] remove' === $rule) {
  77756. $s = preg_replace('/\p{Mn}++/u', '', $s);
  77757. } elseif ('latin-ascii' === $rule) {
  77758. $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s);
  77759. } elseif ('de-ascii' === $rule) {
  77760. $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s);
  77761. $s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s);
  77762. } elseif (\function_exists('transliterator_transliterate')) {
  77763. if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) {
  77764. if ('any-latin/bgn' === $rule) {
  77765. $rule = 'any-latin';
  77766. $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule);
  77767. }
  77768. if (null === $transliterator) {
  77769. throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule));
  77770. }
  77771. self::$transliterators['any-latin/bgn'] = $transliterator;
  77772. }
  77773. $s = $transliterator->transliterate($s);
  77774. }
  77775. } elseif (!\function_exists('iconv')) {
  77776. $s = preg_replace('/[^\x00-\x7F]/u', '?', $s);
  77777. } else {
  77778. $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
  77779. $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]);
  77780. if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) {
  77781. throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class));
  77782. }
  77783. return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?');
  77784. }, $s);
  77785. }
  77786. }
  77787. $str->string .= $s;
  77788. return $str;
  77789. }
  77790. public function camel(): parent
  77791. {
  77792. $str = clone $this;
  77793. $str->string = str_replace(' ', '', preg_replace_callback('/\b./u', static function ($m) use (&$i) {
  77794. return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
  77795. }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string)));
  77796. return $str;
  77797. }
  77798. public function codePointsAt(int $offset): array
  77799. {
  77800. $str = $this->slice($offset, 1);
  77801. if ('' === $str->string) {
  77802. return [];
  77803. }
  77804. $codePoints = [];
  77805. foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
  77806. $codePoints[] = mb_ord($c, 'UTF-8');
  77807. }
  77808. return $codePoints;
  77809. }
  77810. public function folded(bool $compat = true): parent
  77811. {
  77812. $str = clone $this;
  77813. if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) {
  77814. $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC);
  77815. $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $this->string), 'UTF-8');
  77816. } else {
  77817. $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF);
  77818. }
  77819. return $str;
  77820. }
  77821. public function join(array $strings, string $lastGlue = null): parent
  77822. {
  77823. $str = clone $this;
  77824. $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
  77825. $str->string = implode($this->string, $strings).$tail;
  77826. if (!preg_match('//u', $str->string)) {
  77827. throw new InvalidArgumentException('Invalid UTF-8 string.');
  77828. }
  77829. return $str;
  77830. }
  77831. public function lower(): parent
  77832. {
  77833. $str = clone $this;
  77834. $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8');
  77835. return $str;
  77836. }
  77837. public function match(string $regexp, int $flags = 0, int $offset = 0): array
  77838. {
  77839. $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
  77840. if ($this->ignoreCase) {
  77841. $regexp .= 'i';
  77842. }
  77843. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  77844. try {
  77845. if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
  77846. $lastError = preg_last_error();
  77847. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  77848. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  77849. throw new RuntimeException('Matching failed with '.$k.'.');
  77850. }
  77851. }
  77852. throw new RuntimeException('Matching failed with unknown error code.');
  77853. }
  77854. } finally {
  77855. restore_error_handler();
  77856. }
  77857. return $matches;
  77858. }
  77859. public function normalize(int $form = self::NFC): self
  77860. {
  77861. if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) {
  77862. throw new InvalidArgumentException('Unsupported normalization form.');
  77863. }
  77864. $str = clone $this;
  77865. normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
  77866. return $str;
  77867. }
  77868. public function padBoth(int $length, string $padStr = ' '): parent
  77869. {
  77870. if ('' === $padStr || !preg_match('//u', $padStr)) {
  77871. throw new InvalidArgumentException('Invalid UTF-8 string.');
  77872. }
  77873. $pad = clone $this;
  77874. $pad->string = $padStr;
  77875. return $this->pad($length, $pad, \STR_PAD_BOTH);
  77876. }
  77877. public function padEnd(int $length, string $padStr = ' '): parent
  77878. {
  77879. if ('' === $padStr || !preg_match('//u', $padStr)) {
  77880. throw new InvalidArgumentException('Invalid UTF-8 string.');
  77881. }
  77882. $pad = clone $this;
  77883. $pad->string = $padStr;
  77884. return $this->pad($length, $pad, \STR_PAD_RIGHT);
  77885. }
  77886. public function padStart(int $length, string $padStr = ' '): parent
  77887. {
  77888. if ('' === $padStr || !preg_match('//u', $padStr)) {
  77889. throw new InvalidArgumentException('Invalid UTF-8 string.');
  77890. }
  77891. $pad = clone $this;
  77892. $pad->string = $padStr;
  77893. return $this->pad($length, $pad, \STR_PAD_LEFT);
  77894. }
  77895. public function replaceMatches(string $fromRegexp, $to): parent
  77896. {
  77897. if ($this->ignoreCase) {
  77898. $fromRegexp .= 'i';
  77899. }
  77900. if (\is_array($to) || $to instanceof \Closure) {
  77901. if (!\is_callable($to)) {
  77902. throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
  77903. }
  77904. $replace = 'preg_replace_callback';
  77905. $to = static function (array $m) use ($to): string {
  77906. $to = $to($m);
  77907. if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) {
  77908. throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.');
  77909. }
  77910. return $to;
  77911. };
  77912. } elseif ('' !== $to && !preg_match('//u', $to)) {
  77913. throw new InvalidArgumentException('Invalid UTF-8 string.');
  77914. } else {
  77915. $replace = 'preg_replace';
  77916. }
  77917. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  77918. try {
  77919. if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
  77920. $lastError = preg_last_error();
  77921. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  77922. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  77923. throw new RuntimeException('Matching failed with '.$k.'.');
  77924. }
  77925. }
  77926. throw new RuntimeException('Matching failed with unknown error code.');
  77927. }
  77928. } finally {
  77929. restore_error_handler();
  77930. }
  77931. $str = clone $this;
  77932. $str->string = $string;
  77933. return $str;
  77934. }
  77935. public function reverse(): parent
  77936. {
  77937. $str = clone $this;
  77938. $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY)));
  77939. return $str;
  77940. }
  77941. public function snake(): parent
  77942. {
  77943. $str = $this->camel()->title();
  77944. $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8');
  77945. return $str;
  77946. }
  77947. public function title(bool $allWords = false): parent
  77948. {
  77949. $str = clone $this;
  77950. $limit = $allWords ? -1 : 1;
  77951. $str->string = preg_replace_callback('/\b./u', static function (array $m): string {
  77952. return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
  77953. }, $str->string, $limit);
  77954. return $str;
  77955. }
  77956. public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  77957. {
  77958. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  77959. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  77960. }
  77961. $chars = preg_quote($chars);
  77962. $str = clone $this;
  77963. $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string);
  77964. return $str;
  77965. }
  77966. public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  77967. {
  77968. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  77969. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  77970. }
  77971. $chars = preg_quote($chars);
  77972. $str = clone $this;
  77973. $str->string = preg_replace("{[$chars]++$}uD", '', $str->string);
  77974. return $str;
  77975. }
  77976. public function trimPrefix($prefix): parent
  77977. {
  77978. if (!$this->ignoreCase) {
  77979. return parent::trimPrefix($prefix);
  77980. }
  77981. $str = clone $this;
  77982. if ($prefix instanceof \Traversable) {
  77983. $prefix = iterator_to_array($prefix, false);
  77984. } elseif ($prefix instanceof parent) {
  77985. $prefix = $prefix->string;
  77986. }
  77987. $prefix = implode('|', array_map('preg_quote', (array) $prefix));
  77988. $str->string = preg_replace("{^(?:$prefix)}iuD", '', $this->string);
  77989. return $str;
  77990. }
  77991. public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  77992. {
  77993. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  77994. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  77995. }
  77996. $chars = preg_quote($chars);
  77997. $str = clone $this;
  77998. $str->string = preg_replace("{^[$chars]++}uD", '', $str->string);
  77999. return $str;
  78000. }
  78001. public function trimSuffix($suffix): parent
  78002. {
  78003. if (!$this->ignoreCase) {
  78004. return parent::trimSuffix($suffix);
  78005. }
  78006. $str = clone $this;
  78007. if ($suffix instanceof \Traversable) {
  78008. $suffix = iterator_to_array($suffix, false);
  78009. } elseif ($suffix instanceof parent) {
  78010. $suffix = $suffix->string;
  78011. }
  78012. $suffix = implode('|', array_map('preg_quote', (array) $suffix));
  78013. $str->string = preg_replace("{(?:$suffix)$}iuD", '', $this->string);
  78014. return $str;
  78015. }
  78016. public function upper(): parent
  78017. {
  78018. $str = clone $this;
  78019. $str->string = mb_strtoupper($str->string, 'UTF-8');
  78020. if (\PHP_VERSION_ID < 70300) {
  78021. $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string);
  78022. }
  78023. return $str;
  78024. }
  78025. public function width(bool $ignoreAnsiDecoration = true): int
  78026. {
  78027. $width = 0;
  78028. $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string);
  78029. if (false !== strpos($s, "\r")) {
  78030. $s = str_replace(["\r\n", "\r"], "\n", $s);
  78031. }
  78032. if (!$ignoreAnsiDecoration) {
  78033. $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s);
  78034. }
  78035. foreach (explode("\n", $s) as $s) {
  78036. if ($ignoreAnsiDecoration) {
  78037. $s = preg_replace('/(?:\x1B(?:
  78038. \[ [\x30-\x3F]*+ [\x20-\x2F]*+ [0x40-\x7E]
  78039. | [P\]X^_] .*? \x1B\\\\
  78040. | [\x41-\x7E]
  78041. )|[\p{Cc}\x7F]++)/xu', '', $s);
  78042. }
  78043. $width += $this->wcswidth($s);
  78044. }
  78045. return $width;
  78046. }
  78047. private function pad(int $len, self $pad, int $type): parent
  78048. {
  78049. $sLen = $this->length();
  78050. if ($len <= $sLen) {
  78051. return clone $this;
  78052. }
  78053. $padLen = $pad->length();
  78054. $freeLen = $len - $sLen;
  78055. $len = $freeLen % $padLen;
  78056. switch ($type) {
  78057. case \STR_PAD_RIGHT:
  78058. return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  78059. case \STR_PAD_LEFT:
  78060. return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  78061. case \STR_PAD_BOTH:
  78062. $freeLen /= 2;
  78063. $rightLen = ceil($freeLen);
  78064. $len = $rightLen % $padLen;
  78065. $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  78066. $leftLen = floor($freeLen);
  78067. $len = $leftLen % $padLen;
  78068. return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  78069. default:
  78070. throw new InvalidArgumentException('Invalid padding type.');
  78071. }
  78072. }
  78073. private function wcswidth(string $string): int
  78074. {
  78075. $width = 0;
  78076. foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
  78077. $codePoint = mb_ord($c, 'UTF-8');
  78078. if (0 === $codePoint
  78079. || 0x034F === $codePoint
  78080. || (0x200B <= $codePoint && 0x200F >= $codePoint)
  78081. || 0x2028 === $codePoint
  78082. || 0x2029 === $codePoint
  78083. || (0x202A <= $codePoint && 0x202E >= $codePoint)
  78084. || (0x2060 <= $codePoint && 0x2063 >= $codePoint)
  78085. ) {
  78086. continue;
  78087. }
  78088. if (32 > $codePoint
  78089. || (0x07F <= $codePoint && 0x0A0 > $codePoint)
  78090. ) {
  78091. return -1;
  78092. }
  78093. if (null === self::$tableZero) {
  78094. self::$tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php';
  78095. }
  78096. if ($codePoint >= self::$tableZero[0][0] && $codePoint <= self::$tableZero[$ubound = \count(self::$tableZero) - 1][1]) {
  78097. $lbound = 0;
  78098. while ($ubound >= $lbound) {
  78099. $mid = floor(($lbound + $ubound) / 2);
  78100. if ($codePoint > self::$tableZero[$mid][1]) {
  78101. $lbound = $mid + 1;
  78102. } elseif ($codePoint < self::$tableZero[$mid][0]) {
  78103. $ubound = $mid - 1;
  78104. } else {
  78105. continue 2;
  78106. }
  78107. }
  78108. }
  78109. if (null === self::$tableWide) {
  78110. self::$tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php';
  78111. }
  78112. if ($codePoint >= self::$tableWide[0][0] && $codePoint <= self::$tableWide[$ubound = \count(self::$tableWide) - 1][1]) {
  78113. $lbound = 0;
  78114. while ($ubound >= $lbound) {
  78115. $mid = floor(($lbound + $ubound) / 2);
  78116. if ($codePoint > self::$tableWide[$mid][1]) {
  78117. $lbound = $mid + 1;
  78118. } elseif ($codePoint < self::$tableWide[$mid][0]) {
  78119. $ubound = $mid - 1;
  78120. } else {
  78121. $width += 2;
  78122. continue 2;
  78123. }
  78124. }
  78125. }
  78126. ++$width;
  78127. }
  78128. return $width;
  78129. }
  78130. }
  78131. <?php
  78132. namespace Symfony\Component\String;
  78133. use Symfony\Component\String\Exception\ExceptionInterface;
  78134. use Symfony\Component\String\Exception\InvalidArgumentException;
  78135. use Symfony\Component\String\Exception\RuntimeException;
  78136. class ByteString extends AbstractString
  78137. {
  78138. private const ALPHABET_ALPHANUMERIC = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
  78139. public function __construct(string $string = '')
  78140. {
  78141. $this->string = $string;
  78142. }
  78143. public static function fromRandom(int $length = 16, string $alphabet = null): self
  78144. {
  78145. if ($length <= 0) {
  78146. throw new InvalidArgumentException(sprintf('A strictly positive length is expected, "%d" given.', $length));
  78147. }
  78148. $alphabet = $alphabet ?? self::ALPHABET_ALPHANUMERIC;
  78149. $alphabetSize = \strlen($alphabet);
  78150. $bits = (int) ceil(log($alphabetSize, 2.0));
  78151. if ($bits <= 0 || $bits > 56) {
  78152. throw new InvalidArgumentException('The length of the alphabet must in the [2^1, 2^56] range.');
  78153. }
  78154. $ret = '';
  78155. while ($length > 0) {
  78156. $urandomLength = (int) ceil(2 * $length * $bits / 8.0);
  78157. $data = random_bytes($urandomLength);
  78158. $unpackedData = 0;
  78159. $unpackedBits = 0;
  78160. for ($i = 0; $i < $urandomLength && $length > 0; ++$i) {
  78161. $unpackedData = ($unpackedData << 8) | \ord($data[$i]);
  78162. $unpackedBits += 8;
  78163. for (; $unpackedBits >= $bits && $length > 0; $unpackedBits -= $bits) {
  78164. $index = ($unpackedData & ((1 << $bits) - 1));
  78165. $unpackedData >>= $bits;
  78166. if ($index < $alphabetSize) {
  78167. $ret .= $alphabet[$index];
  78168. --$length;
  78169. }
  78170. }
  78171. }
  78172. }
  78173. return new static($ret);
  78174. }
  78175. public function bytesAt(int $offset): array
  78176. {
  78177. $str = $this->string[$offset] ?? '';
  78178. return '' === $str ? [] : [\ord($str)];
  78179. }
  78180. public function append(string ...$suffix): parent
  78181. {
  78182. $str = clone $this;
  78183. $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
  78184. return $str;
  78185. }
  78186. public function camel(): parent
  78187. {
  78188. $str = clone $this;
  78189. $str->string = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->string))));
  78190. return $str;
  78191. }
  78192. public function chunk(int $length = 1): array
  78193. {
  78194. if (1 > $length) {
  78195. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  78196. }
  78197. if ('' === $this->string) {
  78198. return [];
  78199. }
  78200. $str = clone $this;
  78201. $chunks = [];
  78202. foreach (str_split($this->string, $length) as $chunk) {
  78203. $str->string = $chunk;
  78204. $chunks[] = clone $str;
  78205. }
  78206. return $chunks;
  78207. }
  78208. public function endsWith($suffix): bool
  78209. {
  78210. if ($suffix instanceof parent) {
  78211. $suffix = $suffix->string;
  78212. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  78213. return parent::endsWith($suffix);
  78214. } else {
  78215. $suffix = (string) $suffix;
  78216. }
  78217. return '' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase);
  78218. }
  78219. public function equalsTo($string): bool
  78220. {
  78221. if ($string instanceof parent) {
  78222. $string = $string->string;
  78223. } elseif (\is_array($string) || $string instanceof \Traversable) {
  78224. return parent::equalsTo($string);
  78225. } else {
  78226. $string = (string) $string;
  78227. }
  78228. if ('' !== $string && $this->ignoreCase) {
  78229. return 0 === strcasecmp($string, $this->string);
  78230. }
  78231. return $string === $this->string;
  78232. }
  78233. public function folded(): parent
  78234. {
  78235. $str = clone $this;
  78236. $str->string = strtolower($str->string);
  78237. return $str;
  78238. }
  78239. public function indexOf($needle, int $offset = 0): ?int
  78240. {
  78241. if ($needle instanceof parent) {
  78242. $needle = $needle->string;
  78243. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  78244. return parent::indexOf($needle, $offset);
  78245. } else {
  78246. $needle = (string) $needle;
  78247. }
  78248. if ('' === $needle) {
  78249. return null;
  78250. }
  78251. $i = $this->ignoreCase ? stripos($this->string, $needle, $offset) : strpos($this->string, $needle, $offset);
  78252. return false === $i ? null : $i;
  78253. }
  78254. public function indexOfLast($needle, int $offset = 0): ?int
  78255. {
  78256. if ($needle instanceof parent) {
  78257. $needle = $needle->string;
  78258. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  78259. return parent::indexOfLast($needle, $offset);
  78260. } else {
  78261. $needle = (string) $needle;
  78262. }
  78263. if ('' === $needle) {
  78264. return null;
  78265. }
  78266. $i = $this->ignoreCase ? strripos($this->string, $needle, $offset) : strrpos($this->string, $needle, $offset);
  78267. return false === $i ? null : $i;
  78268. }
  78269. public function isUtf8(): bool
  78270. {
  78271. return '' === $this->string || preg_match('//u', $this->string);
  78272. }
  78273. public function join(array $strings, string $lastGlue = null): parent
  78274. {
  78275. $str = clone $this;
  78276. $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
  78277. $str->string = implode($this->string, $strings).$tail;
  78278. return $str;
  78279. }
  78280. public function length(): int
  78281. {
  78282. return \strlen($this->string);
  78283. }
  78284. public function lower(): parent
  78285. {
  78286. $str = clone $this;
  78287. $str->string = strtolower($str->string);
  78288. return $str;
  78289. }
  78290. public function match(string $regexp, int $flags = 0, int $offset = 0): array
  78291. {
  78292. $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
  78293. if ($this->ignoreCase) {
  78294. $regexp .= 'i';
  78295. }
  78296. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  78297. try {
  78298. if (false === $match($regexp, $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
  78299. $lastError = preg_last_error();
  78300. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  78301. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  78302. throw new RuntimeException('Matching failed with '.$k.'.');
  78303. }
  78304. }
  78305. throw new RuntimeException('Matching failed with unknown error code.');
  78306. }
  78307. } finally {
  78308. restore_error_handler();
  78309. }
  78310. return $matches;
  78311. }
  78312. public function padBoth(int $length, string $padStr = ' '): parent
  78313. {
  78314. $str = clone $this;
  78315. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_BOTH);
  78316. return $str;
  78317. }
  78318. public function padEnd(int $length, string $padStr = ' '): parent
  78319. {
  78320. $str = clone $this;
  78321. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_RIGHT);
  78322. return $str;
  78323. }
  78324. public function padStart(int $length, string $padStr = ' '): parent
  78325. {
  78326. $str = clone $this;
  78327. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_LEFT);
  78328. return $str;
  78329. }
  78330. public function prepend(string ...$prefix): parent
  78331. {
  78332. $str = clone $this;
  78333. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$str->string;
  78334. return $str;
  78335. }
  78336. public function replace(string $from, string $to): parent
  78337. {
  78338. $str = clone $this;
  78339. if ('' !== $from) {
  78340. $str->string = $this->ignoreCase ? str_ireplace($from, $to, $this->string) : str_replace($from, $to, $this->string);
  78341. }
  78342. return $str;
  78343. }
  78344. public function replaceMatches(string $fromRegexp, $to): parent
  78345. {
  78346. if ($this->ignoreCase) {
  78347. $fromRegexp .= 'i';
  78348. }
  78349. if (\is_array($to)) {
  78350. if (!\is_callable($to)) {
  78351. throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
  78352. }
  78353. $replace = 'preg_replace_callback';
  78354. } else {
  78355. $replace = $to instanceof \Closure ? 'preg_replace_callback' : 'preg_replace';
  78356. }
  78357. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  78358. try {
  78359. if (null === $string = $replace($fromRegexp, $to, $this->string)) {
  78360. $lastError = preg_last_error();
  78361. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  78362. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  78363. throw new RuntimeException('Matching failed with '.$k.'.');
  78364. }
  78365. }
  78366. throw new RuntimeException('Matching failed with unknown error code.');
  78367. }
  78368. } finally {
  78369. restore_error_handler();
  78370. }
  78371. $str = clone $this;
  78372. $str->string = $string;
  78373. return $str;
  78374. }
  78375. public function reverse(): parent
  78376. {
  78377. $str = clone $this;
  78378. $str->string = strrev($str->string);
  78379. return $str;
  78380. }
  78381. public function slice(int $start = 0, int $length = null): parent
  78382. {
  78383. $str = clone $this;
  78384. $str->string = (string) substr($this->string, $start, $length ?? \PHP_INT_MAX);
  78385. return $str;
  78386. }
  78387. public function snake(): parent
  78388. {
  78389. $str = $this->camel()->title();
  78390. $str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
  78391. return $str;
  78392. }
  78393. public function splice(string $replacement, int $start = 0, int $length = null): parent
  78394. {
  78395. $str = clone $this;
  78396. $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
  78397. return $str;
  78398. }
  78399. public function split(string $delimiter, int $limit = null, int $flags = null): array
  78400. {
  78401. if (1 > $limit = $limit ?? \PHP_INT_MAX) {
  78402. throw new InvalidArgumentException('Split limit must be a positive integer.');
  78403. }
  78404. if ('' === $delimiter) {
  78405. throw new InvalidArgumentException('Split delimiter is empty.');
  78406. }
  78407. if (null !== $flags) {
  78408. return parent::split($delimiter, $limit, $flags);
  78409. }
  78410. $str = clone $this;
  78411. $chunks = $this->ignoreCase
  78412. ? preg_split('{'.preg_quote($delimiter).'}iD', $this->string, $limit)
  78413. : explode($delimiter, $this->string, $limit);
  78414. foreach ($chunks as &$chunk) {
  78415. $str->string = $chunk;
  78416. $chunk = clone $str;
  78417. }
  78418. return $chunks;
  78419. }
  78420. public function startsWith($prefix): bool
  78421. {
  78422. if ($prefix instanceof parent) {
  78423. $prefix = $prefix->string;
  78424. } elseif (!\is_string($prefix)) {
  78425. return parent::startsWith($prefix);
  78426. }
  78427. return '' !== $prefix && 0 === ($this->ignoreCase ? strncasecmp($this->string, $prefix, \strlen($prefix)) : strncmp($this->string, $prefix, \strlen($prefix)));
  78428. }
  78429. public function title(bool $allWords = false): parent
  78430. {
  78431. $str = clone $this;
  78432. $str->string = $allWords ? ucwords($str->string) : ucfirst($str->string);
  78433. return $str;
  78434. }
  78435. public function toUnicodeString(string $fromEncoding = null): UnicodeString
  78436. {
  78437. return new UnicodeString($this->toCodePointString($fromEncoding)->string);
  78438. }
  78439. public function toCodePointString(string $fromEncoding = null): CodePointString
  78440. {
  78441. $u = new CodePointString();
  78442. if (\in_array($fromEncoding, [null, 'utf8', 'utf-8', 'UTF8', 'UTF-8'], true) && preg_match('//u', $this->string)) {
  78443. $u->string = $this->string;
  78444. return $u;
  78445. }
  78446. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  78447. try {
  78448. try {
  78449. $validEncoding = false !== mb_detect_encoding($this->string, $fromEncoding ?? 'Windows-1252', true);
  78450. } catch (InvalidArgumentException $e) {
  78451. if (!\function_exists('iconv')) {
  78452. throw $e;
  78453. }
  78454. $u->string = iconv($fromEncoding ?? 'Windows-1252', 'UTF-8', $this->string);
  78455. return $u;
  78456. }
  78457. } finally {
  78458. restore_error_handler();
  78459. }
  78460. if (!$validEncoding) {
  78461. throw new InvalidArgumentException(sprintf('Invalid "%s" string.', $fromEncoding ?? 'Windows-1252'));
  78462. }
  78463. $u->string = mb_convert_encoding($this->string, 'UTF-8', $fromEncoding ?? 'Windows-1252');
  78464. return $u;
  78465. }
  78466. public function trim(string $chars = " \t\n\r\0\x0B\x0C"): parent
  78467. {
  78468. $str = clone $this;
  78469. $str->string = trim($str->string, $chars);
  78470. return $str;
  78471. }
  78472. public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C"): parent
  78473. {
  78474. $str = clone $this;
  78475. $str->string = rtrim($str->string, $chars);
  78476. return $str;
  78477. }
  78478. public function trimStart(string $chars = " \t\n\r\0\x0B\x0C"): parent
  78479. {
  78480. $str = clone $this;
  78481. $str->string = ltrim($str->string, $chars);
  78482. return $str;
  78483. }
  78484. public function upper(): parent
  78485. {
  78486. $str = clone $this;
  78487. $str->string = strtoupper($str->string);
  78488. return $str;
  78489. }
  78490. public function width(bool $ignoreAnsiDecoration = true): int
  78491. {
  78492. $string = preg_match('//u', $this->string) ? $this->string : preg_replace('/[\x80-\xFF]/', '?', $this->string);
  78493. return (new CodePointString($string))->width($ignoreAnsiDecoration);
  78494. }
  78495. }
  78496. <?php
  78497. namespace Symfony\Component\String;
  78498. use Symfony\Component\String\Exception\ExceptionInterface;
  78499. use Symfony\Component\String\Exception\InvalidArgumentException;
  78500. class CodePointString extends AbstractUnicodeString
  78501. {
  78502. public function __construct(string $string = '')
  78503. {
  78504. if ('' !== $string && !preg_match('//u', $string)) {
  78505. throw new InvalidArgumentException('Invalid UTF-8 string.');
  78506. }
  78507. $this->string = $string;
  78508. }
  78509. public function append(string ...$suffix): AbstractString
  78510. {
  78511. $str = clone $this;
  78512. $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
  78513. if (!preg_match('//u', $str->string)) {
  78514. throw new InvalidArgumentException('Invalid UTF-8 string.');
  78515. }
  78516. return $str;
  78517. }
  78518. public function chunk(int $length = 1): array
  78519. {
  78520. if (1 > $length) {
  78521. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  78522. }
  78523. if ('' === $this->string) {
  78524. return [];
  78525. }
  78526. $rx = '/(';
  78527. while (65535 < $length) {
  78528. $rx .= '.{65535}';
  78529. $length -= 65535;
  78530. }
  78531. $rx .= '.{'.$length.'})/us';
  78532. $str = clone $this;
  78533. $chunks = [];
  78534. foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
  78535. $str->string = $chunk;
  78536. $chunks[] = clone $str;
  78537. }
  78538. return $chunks;
  78539. }
  78540. public function codePointsAt(int $offset): array
  78541. {
  78542. $str = $offset ? $this->slice($offset, 1) : $this;
  78543. return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')];
  78544. }
  78545. public function endsWith($suffix): bool
  78546. {
  78547. if ($suffix instanceof AbstractString) {
  78548. $suffix = $suffix->string;
  78549. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  78550. return parent::endsWith($suffix);
  78551. } else {
  78552. $suffix = (string) $suffix;
  78553. }
  78554. if ('' === $suffix || !preg_match('//u', $suffix)) {
  78555. return false;
  78556. }
  78557. if ($this->ignoreCase) {
  78558. return preg_match('{'.preg_quote($suffix).'$}iuD', $this->string);
  78559. }
  78560. return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix));
  78561. }
  78562. public function equalsTo($string): bool
  78563. {
  78564. if ($string instanceof AbstractString) {
  78565. $string = $string->string;
  78566. } elseif (\is_array($string) || $string instanceof \Traversable) {
  78567. return parent::equalsTo($string);
  78568. } else {
  78569. $string = (string) $string;
  78570. }
  78571. if ('' !== $string && $this->ignoreCase) {
  78572. return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
  78573. }
  78574. return $string === $this->string;
  78575. }
  78576. public function indexOf($needle, int $offset = 0): ?int
  78577. {
  78578. if ($needle instanceof AbstractString) {
  78579. $needle = $needle->string;
  78580. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  78581. return parent::indexOf($needle, $offset);
  78582. } else {
  78583. $needle = (string) $needle;
  78584. }
  78585. if ('' === $needle) {
  78586. return null;
  78587. }
  78588. $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8');
  78589. return false === $i ? null : $i;
  78590. }
  78591. public function indexOfLast($needle, int $offset = 0): ?int
  78592. {
  78593. if ($needle instanceof AbstractString) {
  78594. $needle = $needle->string;
  78595. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  78596. return parent::indexOfLast($needle, $offset);
  78597. } else {
  78598. $needle = (string) $needle;
  78599. }
  78600. if ('' === $needle) {
  78601. return null;
  78602. }
  78603. $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8');
  78604. return false === $i ? null : $i;
  78605. }
  78606. public function length(): int
  78607. {
  78608. return mb_strlen($this->string, 'UTF-8');
  78609. }
  78610. public function prepend(string ...$prefix): AbstractString
  78611. {
  78612. $str = clone $this;
  78613. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
  78614. if (!preg_match('//u', $str->string)) {
  78615. throw new InvalidArgumentException('Invalid UTF-8 string.');
  78616. }
  78617. return $str;
  78618. }
  78619. public function replace(string $from, string $to): AbstractString
  78620. {
  78621. $str = clone $this;
  78622. if ('' === $from || !preg_match('//u', $from)) {
  78623. return $str;
  78624. }
  78625. if ('' !== $to && !preg_match('//u', $to)) {
  78626. throw new InvalidArgumentException('Invalid UTF-8 string.');
  78627. }
  78628. if ($this->ignoreCase) {
  78629. $str->string = implode($to, preg_split('{'.preg_quote($from).'}iuD', $this->string));
  78630. } else {
  78631. $str->string = str_replace($from, $to, $this->string);
  78632. }
  78633. return $str;
  78634. }
  78635. public function slice(int $start = 0, int $length = null): AbstractString
  78636. {
  78637. $str = clone $this;
  78638. $str->string = mb_substr($this->string, $start, $length, 'UTF-8');
  78639. return $str;
  78640. }
  78641. public function splice(string $replacement, int $start = 0, int $length = null): AbstractString
  78642. {
  78643. if (!preg_match('//u', $replacement)) {
  78644. throw new InvalidArgumentException('Invalid UTF-8 string.');
  78645. }
  78646. $str = clone $this;
  78647. $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0;
  78648. $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length;
  78649. $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
  78650. return $str;
  78651. }
  78652. public function split(string $delimiter, int $limit = null, int $flags = null): array
  78653. {
  78654. if (1 > $limit = $limit ?? \PHP_INT_MAX) {
  78655. throw new InvalidArgumentException('Split limit must be a positive integer.');
  78656. }
  78657. if ('' === $delimiter) {
  78658. throw new InvalidArgumentException('Split delimiter is empty.');
  78659. }
  78660. if (null !== $flags) {
  78661. return parent::split($delimiter.'u', $limit, $flags);
  78662. }
  78663. if (!preg_match('//u', $delimiter)) {
  78664. throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
  78665. }
  78666. $str = clone $this;
  78667. $chunks = $this->ignoreCase
  78668. ? preg_split('{'.preg_quote($delimiter).'}iuD', $this->string, $limit)
  78669. : explode($delimiter, $this->string, $limit);
  78670. foreach ($chunks as &$chunk) {
  78671. $str->string = $chunk;
  78672. $chunk = clone $str;
  78673. }
  78674. return $chunks;
  78675. }
  78676. public function startsWith($prefix): bool
  78677. {
  78678. if ($prefix instanceof AbstractString) {
  78679. $prefix = $prefix->string;
  78680. } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
  78681. return parent::startsWith($prefix);
  78682. } else {
  78683. $prefix = (string) $prefix;
  78684. }
  78685. if ('' === $prefix || !preg_match('//u', $prefix)) {
  78686. return false;
  78687. }
  78688. if ($this->ignoreCase) {
  78689. return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8');
  78690. }
  78691. return 0 === strncmp($this->string, $prefix, \strlen($prefix));
  78692. }
  78693. }
  78694. <?php
  78695. namespace Symfony\Component\String\Exception;
  78696. interface ExceptionInterface extends \Throwable
  78697. {
  78698. }
  78699. <?php
  78700. namespace Symfony\Component\String\Exception;
  78701. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  78702. {
  78703. }
  78704. <?php
  78705. namespace Symfony\Component\String\Exception;
  78706. class RuntimeException extends \RuntimeException implements ExceptionInterface
  78707. {
  78708. }
  78709. <?php
  78710. namespace Symfony\Component\String\Inflector;
  78711. final class EnglishInflector implements InflectorInterface
  78712. {
  78713. private const PLURAL_MAP = [
  78714. ['a', 1, true, true, ['on', 'um']],
  78715. ['ea', 2, true, true, 'a'],
  78716. ['secivres', 8, true, true, 'service'],
  78717. ['eci', 3, false, true, 'ouse'],
  78718. ['esee', 4, false, true, 'oose'],
  78719. ['i', 1, true, true, 'us'],
  78720. ['nem', 3, true, true, 'man'],
  78721. ['nerdlihc', 8, true, true, 'child'],
  78722. ['nexo', 4, false, false, 'ox'],
  78723. ['seci', 4, false, true, ['ex', 'ix', 'ice']],
  78724. ['seifles', 7, true, true, 'selfie'],
  78725. ['seibmoz', 7, true, true, 'zombie'],
  78726. ['seivom', 6, true, true, 'movie'],
  78727. ['sesutcep', 8, true, true, 'pectus'],
  78728. ['teef', 4, true, true, 'foot'],
  78729. ['eseeg', 5, true, true, 'goose'],
  78730. ['hteet', 5, true, true, 'tooth'],
  78731. ['swen', 4, true, true, 'news'],
  78732. ['seires', 6, true, true, 'series'],
  78733. ['sei', 3, false, true, 'y'],
  78734. ['sess', 4, true, false, 'ss'],
  78735. ['ses', 3, true, true, ['s', 'se', 'sis']],
  78736. ['sevit', 5, true, true, 'tive'],
  78737. ['sevird', 6, false, true, 'drive'],
  78738. ['sevi', 4, false, true, 'ife'],
  78739. ['sevom', 5, true, true, 'move'],
  78740. ['sev', 3, true, true, ['f', 've', 'ff']],
  78741. ['sexa', 4, false, false, ['ax', 'axe', 'axis']],
  78742. ['sex', 3, true, false, 'x'],
  78743. ['sezz', 4, true, false, 'z'],
  78744. ['suae', 4, false, true, 'eau'],
  78745. ['see', 3, true, true, 'ee'],
  78746. ['segd', 4, true, true, 'dge'],
  78747. ['se', 2, true, true, ['', 'e']],
  78748. ['s', 1, true, true, ''],
  78749. ['xuae', 4, false, true, 'eau'],
  78750. ['elpoep', 6, true, true, 'person'],
  78751. ];
  78752. private const SINGULAR_MAP = [
  78753. ['airetirc', 8, false, false, 'criterion'],
  78754. ['aluben', 6, false, false, 'nebulae'],
  78755. ['dlihc', 5, true, true, 'children'],
  78756. ['eci', 3, false, true, 'ices'],
  78757. ['ecivres', 7, true, true, 'services'],
  78758. ['efi', 3, false, true, 'ives'],
  78759. ['eifles', 6, true, true, 'selfies'],
  78760. ['eivom', 5, true, true, 'movies'],
  78761. ['esuol', 5, false, true, 'lice'],
  78762. ['esuom', 5, false, true, 'mice'],
  78763. ['esoo', 4, false, true, 'eese'],
  78764. ['es', 2, true, true, 'ses'],
  78765. ['esoog', 5, true, true, 'geese'],
  78766. ['ev', 2, true, true, 'ves'],
  78767. ['evird', 5, false, true, 'drives'],
  78768. ['evit', 4, true, true, 'tives'],
  78769. ['evom', 4, true, true, 'moves'],
  78770. ['ffats', 5, true, true, 'staves'],
  78771. ['ff', 2, true, true, 'ffs'],
  78772. ['f', 1, true, true, ['fs', 'ves']],
  78773. ['hc', 2, true, true, 'ches'],
  78774. ['hs', 2, true, true, 'shes'],
  78775. ['htoot', 5, true, true, 'teeth'],
  78776. ['mu', 2, true, true, 'a'],
  78777. ['nam', 3, true, true, 'men'],
  78778. ['nosrep', 6, true, true, ['persons', 'people']],
  78779. ['noi', 3, true, true, 'ions'],
  78780. ['nop', 3, true, true, 'pons'],
  78781. ['nos', 3, true, true, 'sons'],
  78782. ['no', 2, true, true, 'a'],
  78783. ['ohce', 4, true, true, 'echoes'],
  78784. ['oreh', 4, true, true, 'heroes'],
  78785. ['salta', 5, true, true, 'atlases'],
  78786. ['siri', 4, true, true, 'irises'],
  78787. ['sis', 3, true, true, 'ses'],
  78788. ['ss', 2, true, false, 'sses'],
  78789. ['suballys', 8, true, true, 'syllabi'],
  78790. ['sub', 3, true, true, 'buses'],
  78791. ['suc', 3, true, true, 'cuses'],
  78792. ['sutcep', 6, true, true, 'pectuses'],
  78793. ['su', 2, true, true, 'i'],
  78794. ['swen', 4, true, true, 'news'],
  78795. ['toof', 4, true, true, 'feet'],
  78796. ['uae', 3, false, true, ['eaus', 'eaux']],
  78797. ['xo', 2, false, false, 'oxen'],
  78798. ['xaoh', 4, true, false, 'hoaxes'],
  78799. ['xedni', 5, false, true, ['indicies', 'indexes']],
  78800. ['xo', 2, false, true, 'oxes'],
  78801. ['x', 1, true, false, ['cies', 'xes']],
  78802. ['xi', 2, false, true, 'ices'],
  78803. ['y', 1, false, true, 'ies'],
  78804. ['ziuq', 4, true, false, 'quizzes'],
  78805. ['z', 1, true, true, 'zes'],
  78806. ];
  78807. private const UNINFLECTED = [
  78808. '',
  78809. 'atad',
  78810. 'reed',
  78811. 'kcabdeef',
  78812. 'hsif',
  78813. 'ofni',
  78814. 'esoom',
  78815. 'seires',
  78816. 'peehs',
  78817. 'seiceps',
  78818. ];
  78819. public function singularize(string $plural): array
  78820. {
  78821. $pluralRev = strrev($plural);
  78822. $lowerPluralRev = strtolower($pluralRev);
  78823. $pluralLength = \strlen($lowerPluralRev);
  78824. if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
  78825. return [$plural];
  78826. }
  78827. foreach (self::PLURAL_MAP as $map) {
  78828. $suffix = $map[0];
  78829. $suffixLength = $map[1];
  78830. $j = 0;
  78831. while ($suffix[$j] === $lowerPluralRev[$j]) {
  78832. ++$j;
  78833. if ($j === $suffixLength) {
  78834. if ($j < $pluralLength) {
  78835. $nextIsVocal = false !== strpos('aeiou', $lowerPluralRev[$j]);
  78836. if (!$map[2] && $nextIsVocal) {
  78837. break;
  78838. }
  78839. if (!$map[3] && !$nextIsVocal) {
  78840. break;
  78841. }
  78842. }
  78843. $newBase = substr($plural, 0, $pluralLength - $suffixLength);
  78844. $newSuffix = $map[4];
  78845. $firstUpper = ctype_upper($pluralRev[$j - 1]);
  78846. if (\is_array($newSuffix)) {
  78847. $singulars = [];
  78848. foreach ($newSuffix as $newSuffixEntry) {
  78849. $singulars[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
  78850. }
  78851. return $singulars;
  78852. }
  78853. return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
  78854. }
  78855. if ($j === $pluralLength) {
  78856. break;
  78857. }
  78858. }
  78859. }
  78860. return [$plural];
  78861. }
  78862. public function pluralize(string $singular): array
  78863. {
  78864. $singularRev = strrev($singular);
  78865. $lowerSingularRev = strtolower($singularRev);
  78866. $singularLength = \strlen($lowerSingularRev);
  78867. if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
  78868. return [$singular];
  78869. }
  78870. foreach (self::SINGULAR_MAP as $map) {
  78871. $suffix = $map[0];
  78872. $suffixLength = $map[1];
  78873. $j = 0;
  78874. while ($suffix[$j] === $lowerSingularRev[$j]) {
  78875. ++$j;
  78876. if ($j === $suffixLength) {
  78877. if ($j < $singularLength) {
  78878. $nextIsVocal = false !== strpos('aeiou', $lowerSingularRev[$j]);
  78879. if (!$map[2] && $nextIsVocal) {
  78880. break;
  78881. }
  78882. if (!$map[3] && !$nextIsVocal) {
  78883. break;
  78884. }
  78885. }
  78886. $newBase = substr($singular, 0, $singularLength - $suffixLength);
  78887. $newSuffix = $map[4];
  78888. $firstUpper = ctype_upper($singularRev[$j - 1]);
  78889. if (\is_array($newSuffix)) {
  78890. $plurals = [];
  78891. foreach ($newSuffix as $newSuffixEntry) {
  78892. $plurals[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
  78893. }
  78894. return $plurals;
  78895. }
  78896. return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
  78897. }
  78898. if ($j === $singularLength) {
  78899. break;
  78900. }
  78901. }
  78902. }
  78903. return [$singular.'s'];
  78904. }
  78905. }
  78906. <?php
  78907. namespace Symfony\Component\String\Inflector;
  78908. final class FrenchInflector implements InflectorInterface
  78909. {
  78910. private const PLURALIZE_REGEXP = [
  78911. ['/(s|x|z)$/i', '\1'],
  78912. ['/(eau)$/i', '\1x'],
  78913. ['/^(landau)$/i', '\1s'],
  78914. ['/(au)$/i', '\1x'],
  78915. ['/^(pneu|bleu|émeu)$/i', '\1s'],
  78916. ['/(eu)$/i', '\1x'],
  78917. ['/^(bal|carnaval|caracal|chacal|choral|corral|étal|festival|récital|val)$/i', '\1s'],
  78918. ['/al$/i', '\1aux'],
  78919. ['/^(aspir|b|cor|ém|ferm|soupir|trav|vant|vitr)ail$/i', '\1aux'],
  78920. ['/^(bij|caill|ch|gen|hib|jouj|p)ou$/i', '\1oux'],
  78921. ['/^(cinquante|soixante|mille)$/i', '\1'],
  78922. ['/^(mon|ma)(sieur|dame|demoiselle|seigneur)$/', 'mes\2s'],
  78923. ['/^(Mon|Ma)(sieur|dame|demoiselle|seigneur)$/', 'Mes\2s'],
  78924. ];
  78925. private const SINGULARIZE_REGEXP = [
  78926. ['/((aspir|b|cor|ém|ferm|soupir|trav|vant|vitr))aux$/i', '\1ail'],
  78927. ['/(eau)x$/i', '\1'],
  78928. ['/(amir|anim|arsen|boc|can|capit|capor|chev|crist|génér|hopit|hôpit|idé|journ|littor|loc|m|mét|minér|princip|radic|termin)aux$/i', '\1al'],
  78929. ['/(au)x$/i', '\1'],
  78930. ['/(eu)x$/i', '\1'],
  78931. ['/(bij|caill|ch|gen|hib|jouj|p)oux$/i', '\1ou'],
  78932. ['/^mes(dame|demoiselle)s$/', 'ma\1'],
  78933. ['/^Mes(dame|demoiselle)s$/', 'Ma\1'],
  78934. ['/^mes(sieur|seigneur)s$/', 'mon\1'],
  78935. ['/^Mes(sieur|seigneur)s$/', 'Mon\1'],
  78936. ['/s$/i', ''],
  78937. ];
  78938. private const UNINFLECTED = '/^(abcès|accès|abus|albatros|anchois|anglais|autobus|bois|brebis|carquois|cas|chas|colis|concours|corps|cours|cyprès|décès|devis|discours|dos|embarras|engrais|entrelacs|excès|fils|fois|gâchis|gars|glas|héros|intrus|jars|jus|kermès|lacis|legs|lilas|marais|mars|matelas|mépris|mets|mois|mors|obus|os|palais|paradis|parcours|pardessus|pays|plusieurs|poids|pois|pouls|printemps|processus|progrès|puits|pus|rabais|radis|recors|recours|refus|relais|remords|remous|rictus|rhinocéros|repas|rubis|sas|secours|sens|souris|succès|talus|tapis|tas|taudis|temps|tiers|univers|velours|verglas|vernis|virus)$/i';
  78939. public function singularize(string $plural): array
  78940. {
  78941. if ($this->isInflectedWord($plural)) {
  78942. return [$plural];
  78943. }
  78944. foreach (self::SINGULARIZE_REGEXP as $rule) {
  78945. [$regexp, $replace] = $rule;
  78946. if (1 === preg_match($regexp, $plural)) {
  78947. return [preg_replace($regexp, $replace, $plural)];
  78948. }
  78949. }
  78950. return [$plural];
  78951. }
  78952. public function pluralize(string $singular): array
  78953. {
  78954. if ($this->isInflectedWord($singular)) {
  78955. return [$singular];
  78956. }
  78957. foreach (self::PLURALIZE_REGEXP as $rule) {
  78958. [$regexp, $replace] = $rule;
  78959. if (1 === preg_match($regexp, $singular)) {
  78960. return [preg_replace($regexp, $replace, $singular)];
  78961. }
  78962. }
  78963. return [$singular.'s'];
  78964. }
  78965. private function isInflectedWord(string $word): bool
  78966. {
  78967. return 1 === preg_match(self::UNINFLECTED, $word);
  78968. }
  78969. }
  78970. <?php
  78971. namespace Symfony\Component\String\Inflector;
  78972. interface InflectorInterface
  78973. {
  78974. public function singularize(string $plural): array;
  78975. public function pluralize(string $singular): array;
  78976. }
  78977. Copyright (c) 2019-2022 Fabien Potencier
  78978. Permission is hereby granted, free of charge, to any person obtaining a copy
  78979. of this software and associated documentation files (the "Software"), to deal
  78980. in the Software without restriction, including without limitation the rights
  78981. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  78982. copies of the Software, and to permit persons to whom the Software is furnished
  78983. to do so, subject to the following conditions:
  78984. The above copyright notice and this permission notice shall be included in all
  78985. copies or substantial portions of the Software.
  78986. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  78987. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  78988. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  78989. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  78990. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  78991. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  78992. THE SOFTWARE.
  78993. <?php
  78994. namespace Symfony\Component\String;
  78995. class LazyString implements \Stringable, \JsonSerializable
  78996. {
  78997. private $value;
  78998. public static function fromCallable($callback, ...$arguments): self
  78999. {
  79000. if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) {
  79001. throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type($callback)));
  79002. }
  79003. $lazyString = new static();
  79004. $lazyString->value = static function () use (&$callback, &$arguments, &$value): string {
  79005. if (null !== $arguments) {
  79006. if (!\is_callable($callback)) {
  79007. $callback[0] = $callback[0]();
  79008. $callback[1] = $callback[1] ?? '__invoke';
  79009. }
  79010. $value = $callback(...$arguments);
  79011. $callback = self::getPrettyName($callback);
  79012. $arguments = null;
  79013. }
  79014. return $value ?? '';
  79015. };
  79016. return $lazyString;
  79017. }
  79018. public static function fromStringable($value): self
  79019. {
  79020. if (!self::isStringable($value)) {
  79021. throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value)));
  79022. }
  79023. if (\is_object($value)) {
  79024. return static::fromCallable([$value, '__toString']);
  79025. }
  79026. $lazyString = new static();
  79027. $lazyString->value = (string) $value;
  79028. return $lazyString;
  79029. }
  79030. final public static function isStringable($value): bool
  79031. {
  79032. return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : is_scalar($value));
  79033. }
  79034. final public static function resolve($value): string
  79035. {
  79036. return $value;
  79037. }
  79038. public function __toString()
  79039. {
  79040. if (\is_string($this->value)) {
  79041. return $this->value;
  79042. }
  79043. try {
  79044. return $this->value = ($this->value)();
  79045. } catch (\Throwable $e) {
  79046. if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) {
  79047. $type = explode(', ', $e->getMessage());
  79048. $type = substr(array_pop($type), 0, -\strlen(' returned'));
  79049. $r = new \ReflectionFunction($this->value);
  79050. $callback = $r->getStaticVariables()['callback'];
  79051. $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type));
  79052. }
  79053. if (\PHP_VERSION_ID < 70400) {
  79054. return trigger_error($e, \E_USER_ERROR);
  79055. }
  79056. throw $e;
  79057. }
  79058. }
  79059. public function __sleep(): array
  79060. {
  79061. $this->__toString();
  79062. return ['value'];
  79063. }
  79064. public function jsonSerialize(): string
  79065. {
  79066. return $this->__toString();
  79067. }
  79068. private function __construct()
  79069. {
  79070. }
  79071. private static function getPrettyName(callable $callback): string
  79072. {
  79073. if (\is_string($callback)) {
  79074. return $callback;
  79075. }
  79076. if (\is_array($callback)) {
  79077. $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0];
  79078. $method = $callback[1];
  79079. } elseif ($callback instanceof \Closure) {
  79080. $r = new \ReflectionFunction($callback);
  79081. if (false !== strpos($r->name, '{closure}') || !$class = $r->getClosureScopeClass()) {
  79082. return $r->name;
  79083. }
  79084. $class = $class->name;
  79085. $method = $r->name;
  79086. } else {
  79087. $class = get_debug_type($callback);
  79088. $method = '__invoke';
  79089. }
  79090. return $class.'::'.$method;
  79091. }
  79092. }
  79093. <?php
  79094. return [
  79095. [
  79096. 4352,
  79097. 4447,
  79098. ],
  79099. [
  79100. 8986,
  79101. 8987,
  79102. ],
  79103. [
  79104. 9001,
  79105. 9001,
  79106. ],
  79107. [
  79108. 9002,
  79109. 9002,
  79110. ],
  79111. [
  79112. 9193,
  79113. 9196,
  79114. ],
  79115. [
  79116. 9200,
  79117. 9200,
  79118. ],
  79119. [
  79120. 9203,
  79121. 9203,
  79122. ],
  79123. [
  79124. 9725,
  79125. 9726,
  79126. ],
  79127. [
  79128. 9748,
  79129. 9749,
  79130. ],
  79131. [
  79132. 9800,
  79133. 9811,
  79134. ],
  79135. [
  79136. 9855,
  79137. 9855,
  79138. ],
  79139. [
  79140. 9875,
  79141. 9875,
  79142. ],
  79143. [
  79144. 9889,
  79145. 9889,
  79146. ],
  79147. [
  79148. 9898,
  79149. 9899,
  79150. ],
  79151. [
  79152. 9917,
  79153. 9918,
  79154. ],
  79155. [
  79156. 9924,
  79157. 9925,
  79158. ],
  79159. [
  79160. 9934,
  79161. 9934,
  79162. ],
  79163. [
  79164. 9940,
  79165. 9940,
  79166. ],
  79167. [
  79168. 9962,
  79169. 9962,
  79170. ],
  79171. [
  79172. 9970,
  79173. 9971,
  79174. ],
  79175. [
  79176. 9973,
  79177. 9973,
  79178. ],
  79179. [
  79180. 9978,
  79181. 9978,
  79182. ],
  79183. [
  79184. 9981,
  79185. 9981,
  79186. ],
  79187. [
  79188. 9989,
  79189. 9989,
  79190. ],
  79191. [
  79192. 9994,
  79193. 9995,
  79194. ],
  79195. [
  79196. 10024,
  79197. 10024,
  79198. ],
  79199. [
  79200. 10060,
  79201. 10060,
  79202. ],
  79203. [
  79204. 10062,
  79205. 10062,
  79206. ],
  79207. [
  79208. 10067,
  79209. 10069,
  79210. ],
  79211. [
  79212. 10071,
  79213. 10071,
  79214. ],
  79215. [
  79216. 10133,
  79217. 10135,
  79218. ],
  79219. [
  79220. 10160,
  79221. 10160,
  79222. ],
  79223. [
  79224. 10175,
  79225. 10175,
  79226. ],
  79227. [
  79228. 11035,
  79229. 11036,
  79230. ],
  79231. [
  79232. 11088,
  79233. 11088,
  79234. ],
  79235. [
  79236. 11093,
  79237. 11093,
  79238. ],
  79239. [
  79240. 11904,
  79241. 11929,
  79242. ],
  79243. [
  79244. 11931,
  79245. 12019,
  79246. ],
  79247. [
  79248. 12032,
  79249. 12245,
  79250. ],
  79251. [
  79252. 12272,
  79253. 12283,
  79254. ],
  79255. [
  79256. 12288,
  79257. 12288,
  79258. ],
  79259. [
  79260. 12289,
  79261. 12291,
  79262. ],
  79263. [
  79264. 12292,
  79265. 12292,
  79266. ],
  79267. [
  79268. 12293,
  79269. 12293,
  79270. ],
  79271. [
  79272. 12294,
  79273. 12294,
  79274. ],
  79275. [
  79276. 12295,
  79277. 12295,
  79278. ],
  79279. [
  79280. 12296,
  79281. 12296,
  79282. ],
  79283. [
  79284. 12297,
  79285. 12297,
  79286. ],
  79287. [
  79288. 12298,
  79289. 12298,
  79290. ],
  79291. [
  79292. 12299,
  79293. 12299,
  79294. ],
  79295. [
  79296. 12300,
  79297. 12300,
  79298. ],
  79299. [
  79300. 12301,
  79301. 12301,
  79302. ],
  79303. [
  79304. 12302,
  79305. 12302,
  79306. ],
  79307. [
  79308. 12303,
  79309. 12303,
  79310. ],
  79311. [
  79312. 12304,
  79313. 12304,
  79314. ],
  79315. [
  79316. 12305,
  79317. 12305,
  79318. ],
  79319. [
  79320. 12306,
  79321. 12307,
  79322. ],
  79323. [
  79324. 12308,
  79325. 12308,
  79326. ],
  79327. [
  79328. 12309,
  79329. 12309,
  79330. ],
  79331. [
  79332. 12310,
  79333. 12310,
  79334. ],
  79335. [
  79336. 12311,
  79337. 12311,
  79338. ],
  79339. [
  79340. 12312,
  79341. 12312,
  79342. ],
  79343. [
  79344. 12313,
  79345. 12313,
  79346. ],
  79347. [
  79348. 12314,
  79349. 12314,
  79350. ],
  79351. [
  79352. 12315,
  79353. 12315,
  79354. ],
  79355. [
  79356. 12316,
  79357. 12316,
  79358. ],
  79359. [
  79360. 12317,
  79361. 12317,
  79362. ],
  79363. [
  79364. 12318,
  79365. 12319,
  79366. ],
  79367. [
  79368. 12320,
  79369. 12320,
  79370. ],
  79371. [
  79372. 12321,
  79373. 12329,
  79374. ],
  79375. [
  79376. 12330,
  79377. 12333,
  79378. ],
  79379. [
  79380. 12334,
  79381. 12335,
  79382. ],
  79383. [
  79384. 12336,
  79385. 12336,
  79386. ],
  79387. [
  79388. 12337,
  79389. 12341,
  79390. ],
  79391. [
  79392. 12342,
  79393. 12343,
  79394. ],
  79395. [
  79396. 12344,
  79397. 12346,
  79398. ],
  79399. [
  79400. 12347,
  79401. 12347,
  79402. ],
  79403. [
  79404. 12348,
  79405. 12348,
  79406. ],
  79407. [
  79408. 12349,
  79409. 12349,
  79410. ],
  79411. [
  79412. 12350,
  79413. 12350,
  79414. ],
  79415. [
  79416. 12353,
  79417. 12438,
  79418. ],
  79419. [
  79420. 12441,
  79421. 12442,
  79422. ],
  79423. [
  79424. 12443,
  79425. 12444,
  79426. ],
  79427. [
  79428. 12445,
  79429. 12446,
  79430. ],
  79431. [
  79432. 12447,
  79433. 12447,
  79434. ],
  79435. [
  79436. 12448,
  79437. 12448,
  79438. ],
  79439. [
  79440. 12449,
  79441. 12538,
  79442. ],
  79443. [
  79444. 12539,
  79445. 12539,
  79446. ],
  79447. [
  79448. 12540,
  79449. 12542,
  79450. ],
  79451. [
  79452. 12543,
  79453. 12543,
  79454. ],
  79455. [
  79456. 12549,
  79457. 12591,
  79458. ],
  79459. [
  79460. 12593,
  79461. 12686,
  79462. ],
  79463. [
  79464. 12688,
  79465. 12689,
  79466. ],
  79467. [
  79468. 12690,
  79469. 12693,
  79470. ],
  79471. [
  79472. 12694,
  79473. 12703,
  79474. ],
  79475. [
  79476. 12704,
  79477. 12735,
  79478. ],
  79479. [
  79480. 12736,
  79481. 12771,
  79482. ],
  79483. [
  79484. 12784,
  79485. 12799,
  79486. ],
  79487. [
  79488. 12800,
  79489. 12830,
  79490. ],
  79491. [
  79492. 12832,
  79493. 12841,
  79494. ],
  79495. [
  79496. 12842,
  79497. 12871,
  79498. ],
  79499. [
  79500. 12880,
  79501. 12880,
  79502. ],
  79503. [
  79504. 12881,
  79505. 12895,
  79506. ],
  79507. [
  79508. 12896,
  79509. 12927,
  79510. ],
  79511. [
  79512. 12928,
  79513. 12937,
  79514. ],
  79515. [
  79516. 12938,
  79517. 12976,
  79518. ],
  79519. [
  79520. 12977,
  79521. 12991,
  79522. ],
  79523. [
  79524. 12992,
  79525. 13055,
  79526. ],
  79527. [
  79528. 13056,
  79529. 13311,
  79530. ],
  79531. [
  79532. 13312,
  79533. 19903,
  79534. ],
  79535. [
  79536. 19968,
  79537. 40959,
  79538. ],
  79539. [
  79540. 40960,
  79541. 40980,
  79542. ],
  79543. [
  79544. 40981,
  79545. 40981,
  79546. ],
  79547. [
  79548. 40982,
  79549. 42124,
  79550. ],
  79551. [
  79552. 42128,
  79553. 42182,
  79554. ],
  79555. [
  79556. 43360,
  79557. 43388,
  79558. ],
  79559. [
  79560. 44032,
  79561. 55203,
  79562. ],
  79563. [
  79564. 63744,
  79565. 64109,
  79566. ],
  79567. [
  79568. 64110,
  79569. 64111,
  79570. ],
  79571. [
  79572. 64112,
  79573. 64217,
  79574. ],
  79575. [
  79576. 64218,
  79577. 64255,
  79578. ],
  79579. [
  79580. 65040,
  79581. 65046,
  79582. ],
  79583. [
  79584. 65047,
  79585. 65047,
  79586. ],
  79587. [
  79588. 65048,
  79589. 65048,
  79590. ],
  79591. [
  79592. 65049,
  79593. 65049,
  79594. ],
  79595. [
  79596. 65072,
  79597. 65072,
  79598. ],
  79599. [
  79600. 65073,
  79601. 65074,
  79602. ],
  79603. [
  79604. 65075,
  79605. 65076,
  79606. ],
  79607. [
  79608. 65077,
  79609. 65077,
  79610. ],
  79611. [
  79612. 65078,
  79613. 65078,
  79614. ],
  79615. [
  79616. 65079,
  79617. 65079,
  79618. ],
  79619. [
  79620. 65080,
  79621. 65080,
  79622. ],
  79623. [
  79624. 65081,
  79625. 65081,
  79626. ],
  79627. [
  79628. 65082,
  79629. 65082,
  79630. ],
  79631. [
  79632. 65083,
  79633. 65083,
  79634. ],
  79635. [
  79636. 65084,
  79637. 65084,
  79638. ],
  79639. [
  79640. 65085,
  79641. 65085,
  79642. ],
  79643. [
  79644. 65086,
  79645. 65086,
  79646. ],
  79647. [
  79648. 65087,
  79649. 65087,
  79650. ],
  79651. [
  79652. 65088,
  79653. 65088,
  79654. ],
  79655. [
  79656. 65089,
  79657. 65089,
  79658. ],
  79659. [
  79660. 65090,
  79661. 65090,
  79662. ],
  79663. [
  79664. 65091,
  79665. 65091,
  79666. ],
  79667. [
  79668. 65092,
  79669. 65092,
  79670. ],
  79671. [
  79672. 65093,
  79673. 65094,
  79674. ],
  79675. [
  79676. 65095,
  79677. 65095,
  79678. ],
  79679. [
  79680. 65096,
  79681. 65096,
  79682. ],
  79683. [
  79684. 65097,
  79685. 65100,
  79686. ],
  79687. [
  79688. 65101,
  79689. 65103,
  79690. ],
  79691. [
  79692. 65104,
  79693. 65106,
  79694. ],
  79695. [
  79696. 65108,
  79697. 65111,
  79698. ],
  79699. [
  79700. 65112,
  79701. 65112,
  79702. ],
  79703. [
  79704. 65113,
  79705. 65113,
  79706. ],
  79707. [
  79708. 65114,
  79709. 65114,
  79710. ],
  79711. [
  79712. 65115,
  79713. 65115,
  79714. ],
  79715. [
  79716. 65116,
  79717. 65116,
  79718. ],
  79719. [
  79720. 65117,
  79721. 65117,
  79722. ],
  79723. [
  79724. 65118,
  79725. 65118,
  79726. ],
  79727. [
  79728. 65119,
  79729. 65121,
  79730. ],
  79731. [
  79732. 65122,
  79733. 65122,
  79734. ],
  79735. [
  79736. 65123,
  79737. 65123,
  79738. ],
  79739. [
  79740. 65124,
  79741. 65126,
  79742. ],
  79743. [
  79744. 65128,
  79745. 65128,
  79746. ],
  79747. [
  79748. 65129,
  79749. 65129,
  79750. ],
  79751. [
  79752. 65130,
  79753. 65131,
  79754. ],
  79755. [
  79756. 65281,
  79757. 65283,
  79758. ],
  79759. [
  79760. 65284,
  79761. 65284,
  79762. ],
  79763. [
  79764. 65285,
  79765. 65287,
  79766. ],
  79767. [
  79768. 65288,
  79769. 65288,
  79770. ],
  79771. [
  79772. 65289,
  79773. 65289,
  79774. ],
  79775. [
  79776. 65290,
  79777. 65290,
  79778. ],
  79779. [
  79780. 65291,
  79781. 65291,
  79782. ],
  79783. [
  79784. 65292,
  79785. 65292,
  79786. ],
  79787. [
  79788. 65293,
  79789. 65293,
  79790. ],
  79791. [
  79792. 65294,
  79793. 65295,
  79794. ],
  79795. [
  79796. 65296,
  79797. 65305,
  79798. ],
  79799. [
  79800. 65306,
  79801. 65307,
  79802. ],
  79803. [
  79804. 65308,
  79805. 65310,
  79806. ],
  79807. [
  79808. 65311,
  79809. 65312,
  79810. ],
  79811. [
  79812. 65313,
  79813. 65338,
  79814. ],
  79815. [
  79816. 65339,
  79817. 65339,
  79818. ],
  79819. [
  79820. 65340,
  79821. 65340,
  79822. ],
  79823. [
  79824. 65341,
  79825. 65341,
  79826. ],
  79827. [
  79828. 65342,
  79829. 65342,
  79830. ],
  79831. [
  79832. 65343,
  79833. 65343,
  79834. ],
  79835. [
  79836. 65344,
  79837. 65344,
  79838. ],
  79839. [
  79840. 65345,
  79841. 65370,
  79842. ],
  79843. [
  79844. 65371,
  79845. 65371,
  79846. ],
  79847. [
  79848. 65372,
  79849. 65372,
  79850. ],
  79851. [
  79852. 65373,
  79853. 65373,
  79854. ],
  79855. [
  79856. 65374,
  79857. 65374,
  79858. ],
  79859. [
  79860. 65375,
  79861. 65375,
  79862. ],
  79863. [
  79864. 65376,
  79865. 65376,
  79866. ],
  79867. [
  79868. 65504,
  79869. 65505,
  79870. ],
  79871. [
  79872. 65506,
  79873. 65506,
  79874. ],
  79875. [
  79876. 65507,
  79877. 65507,
  79878. ],
  79879. [
  79880. 65508,
  79881. 65508,
  79882. ],
  79883. [
  79884. 65509,
  79885. 65510,
  79886. ],
  79887. [
  79888. 94176,
  79889. 94177,
  79890. ],
  79891. [
  79892. 94178,
  79893. 94178,
  79894. ],
  79895. [
  79896. 94179,
  79897. 94179,
  79898. ],
  79899. [
  79900. 94180,
  79901. 94180,
  79902. ],
  79903. [
  79904. 94192,
  79905. 94193,
  79906. ],
  79907. [
  79908. 94208,
  79909. 100343,
  79910. ],
  79911. [
  79912. 100352,
  79913. 101119,
  79914. ],
  79915. [
  79916. 101120,
  79917. 101589,
  79918. ],
  79919. [
  79920. 101632,
  79921. 101640,
  79922. ],
  79923. [
  79924. 110576,
  79925. 110579,
  79926. ],
  79927. [
  79928. 110581,
  79929. 110587,
  79930. ],
  79931. [
  79932. 110589,
  79933. 110590,
  79934. ],
  79935. [
  79936. 110592,
  79937. 110847,
  79938. ],
  79939. [
  79940. 110848,
  79941. 110882,
  79942. ],
  79943. [
  79944. 110928,
  79945. 110930,
  79946. ],
  79947. [
  79948. 110948,
  79949. 110951,
  79950. ],
  79951. [
  79952. 110960,
  79953. 111355,
  79954. ],
  79955. [
  79956. 126980,
  79957. 126980,
  79958. ],
  79959. [
  79960. 127183,
  79961. 127183,
  79962. ],
  79963. [
  79964. 127374,
  79965. 127374,
  79966. ],
  79967. [
  79968. 127377,
  79969. 127386,
  79970. ],
  79971. [
  79972. 127488,
  79973. 127490,
  79974. ],
  79975. [
  79976. 127504,
  79977. 127547,
  79978. ],
  79979. [
  79980. 127552,
  79981. 127560,
  79982. ],
  79983. [
  79984. 127568,
  79985. 127569,
  79986. ],
  79987. [
  79988. 127584,
  79989. 127589,
  79990. ],
  79991. [
  79992. 127744,
  79993. 127776,
  79994. ],
  79995. [
  79996. 127789,
  79997. 127797,
  79998. ],
  79999. [
  80000. 127799,
  80001. 127868,
  80002. ],
  80003. [
  80004. 127870,
  80005. 127891,
  80006. ],
  80007. [
  80008. 127904,
  80009. 127946,
  80010. ],
  80011. [
  80012. 127951,
  80013. 127955,
  80014. ],
  80015. [
  80016. 127968,
  80017. 127984,
  80018. ],
  80019. [
  80020. 127988,
  80021. 127988,
  80022. ],
  80023. [
  80024. 127992,
  80025. 127994,
  80026. ],
  80027. [
  80028. 127995,
  80029. 127999,
  80030. ],
  80031. [
  80032. 128000,
  80033. 128062,
  80034. ],
  80035. [
  80036. 128064,
  80037. 128064,
  80038. ],
  80039. [
  80040. 128066,
  80041. 128252,
  80042. ],
  80043. [
  80044. 128255,
  80045. 128317,
  80046. ],
  80047. [
  80048. 128331,
  80049. 128334,
  80050. ],
  80051. [
  80052. 128336,
  80053. 128359,
  80054. ],
  80055. [
  80056. 128378,
  80057. 128378,
  80058. ],
  80059. [
  80060. 128405,
  80061. 128406,
  80062. ],
  80063. [
  80064. 128420,
  80065. 128420,
  80066. ],
  80067. [
  80068. 128507,
  80069. 128511,
  80070. ],
  80071. [
  80072. 128512,
  80073. 128591,
  80074. ],
  80075. [
  80076. 128640,
  80077. 128709,
  80078. ],
  80079. [
  80080. 128716,
  80081. 128716,
  80082. ],
  80083. [
  80084. 128720,
  80085. 128722,
  80086. ],
  80087. [
  80088. 128725,
  80089. 128727,
  80090. ],
  80091. [
  80092. 128733,
  80093. 128735,
  80094. ],
  80095. [
  80096. 128747,
  80097. 128748,
  80098. ],
  80099. [
  80100. 128756,
  80101. 128764,
  80102. ],
  80103. [
  80104. 128992,
  80105. 129003,
  80106. ],
  80107. [
  80108. 129008,
  80109. 129008,
  80110. ],
  80111. [
  80112. 129292,
  80113. 129338,
  80114. ],
  80115. [
  80116. 129340,
  80117. 129349,
  80118. ],
  80119. [
  80120. 129351,
  80121. 129535,
  80122. ],
  80123. [
  80124. 129648,
  80125. 129652,
  80126. ],
  80127. [
  80128. 129656,
  80129. 129660,
  80130. ],
  80131. [
  80132. 129664,
  80133. 129670,
  80134. ],
  80135. [
  80136. 129680,
  80137. 129708,
  80138. ],
  80139. [
  80140. 129712,
  80141. 129722,
  80142. ],
  80143. [
  80144. 129728,
  80145. 129733,
  80146. ],
  80147. [
  80148. 129744,
  80149. 129753,
  80150. ],
  80151. [
  80152. 129760,
  80153. 129767,
  80154. ],
  80155. [
  80156. 129776,
  80157. 129782,
  80158. ],
  80159. [
  80160. 131072,
  80161. 173791,
  80162. ],
  80163. [
  80164. 173792,
  80165. 173823,
  80166. ],
  80167. [
  80168. 173824,
  80169. 177976,
  80170. ],
  80171. [
  80172. 177977,
  80173. 177983,
  80174. ],
  80175. [
  80176. 177984,
  80177. 178205,
  80178. ],
  80179. [
  80180. 178206,
  80181. 178207,
  80182. ],
  80183. [
  80184. 178208,
  80185. 183969,
  80186. ],
  80187. [
  80188. 183970,
  80189. 183983,
  80190. ],
  80191. [
  80192. 183984,
  80193. 191456,
  80194. ],
  80195. [
  80196. 191457,
  80197. 194559,
  80198. ],
  80199. [
  80200. 194560,
  80201. 195101,
  80202. ],
  80203. [
  80204. 195102,
  80205. 195103,
  80206. ],
  80207. [
  80208. 195104,
  80209. 196605,
  80210. ],
  80211. [
  80212. 196608,
  80213. 201546,
  80214. ],
  80215. [
  80216. 201547,
  80217. 262141,
  80218. ],
  80219. ];
  80220. <?php
  80221. return [
  80222. [
  80223. 768,
  80224. 879,
  80225. ],
  80226. [
  80227. 1155,
  80228. 1159,
  80229. ],
  80230. [
  80231. 1160,
  80232. 1161,
  80233. ],
  80234. [
  80235. 1425,
  80236. 1469,
  80237. ],
  80238. [
  80239. 1471,
  80240. 1471,
  80241. ],
  80242. [
  80243. 1473,
  80244. 1474,
  80245. ],
  80246. [
  80247. 1476,
  80248. 1477,
  80249. ],
  80250. [
  80251. 1479,
  80252. 1479,
  80253. ],
  80254. [
  80255. 1552,
  80256. 1562,
  80257. ],
  80258. [
  80259. 1611,
  80260. 1631,
  80261. ],
  80262. [
  80263. 1648,
  80264. 1648,
  80265. ],
  80266. [
  80267. 1750,
  80268. 1756,
  80269. ],
  80270. [
  80271. 1759,
  80272. 1764,
  80273. ],
  80274. [
  80275. 1767,
  80276. 1768,
  80277. ],
  80278. [
  80279. 1770,
  80280. 1773,
  80281. ],
  80282. [
  80283. 1809,
  80284. 1809,
  80285. ],
  80286. [
  80287. 1840,
  80288. 1866,
  80289. ],
  80290. [
  80291. 1958,
  80292. 1968,
  80293. ],
  80294. [
  80295. 2027,
  80296. 2035,
  80297. ],
  80298. [
  80299. 2045,
  80300. 2045,
  80301. ],
  80302. [
  80303. 2070,
  80304. 2073,
  80305. ],
  80306. [
  80307. 2075,
  80308. 2083,
  80309. ],
  80310. [
  80311. 2085,
  80312. 2087,
  80313. ],
  80314. [
  80315. 2089,
  80316. 2093,
  80317. ],
  80318. [
  80319. 2137,
  80320. 2139,
  80321. ],
  80322. [
  80323. 2200,
  80324. 2207,
  80325. ],
  80326. [
  80327. 2250,
  80328. 2273,
  80329. ],
  80330. [
  80331. 2275,
  80332. 2306,
  80333. ],
  80334. [
  80335. 2362,
  80336. 2362,
  80337. ],
  80338. [
  80339. 2364,
  80340. 2364,
  80341. ],
  80342. [
  80343. 2369,
  80344. 2376,
  80345. ],
  80346. [
  80347. 2381,
  80348. 2381,
  80349. ],
  80350. [
  80351. 2385,
  80352. 2391,
  80353. ],
  80354. [
  80355. 2402,
  80356. 2403,
  80357. ],
  80358. [
  80359. 2433,
  80360. 2433,
  80361. ],
  80362. [
  80363. 2492,
  80364. 2492,
  80365. ],
  80366. [
  80367. 2497,
  80368. 2500,
  80369. ],
  80370. [
  80371. 2509,
  80372. 2509,
  80373. ],
  80374. [
  80375. 2530,
  80376. 2531,
  80377. ],
  80378. [
  80379. 2558,
  80380. 2558,
  80381. ],
  80382. [
  80383. 2561,
  80384. 2562,
  80385. ],
  80386. [
  80387. 2620,
  80388. 2620,
  80389. ],
  80390. [
  80391. 2625,
  80392. 2626,
  80393. ],
  80394. [
  80395. 2631,
  80396. 2632,
  80397. ],
  80398. [
  80399. 2635,
  80400. 2637,
  80401. ],
  80402. [
  80403. 2641,
  80404. 2641,
  80405. ],
  80406. [
  80407. 2672,
  80408. 2673,
  80409. ],
  80410. [
  80411. 2677,
  80412. 2677,
  80413. ],
  80414. [
  80415. 2689,
  80416. 2690,
  80417. ],
  80418. [
  80419. 2748,
  80420. 2748,
  80421. ],
  80422. [
  80423. 2753,
  80424. 2757,
  80425. ],
  80426. [
  80427. 2759,
  80428. 2760,
  80429. ],
  80430. [
  80431. 2765,
  80432. 2765,
  80433. ],
  80434. [
  80435. 2786,
  80436. 2787,
  80437. ],
  80438. [
  80439. 2810,
  80440. 2815,
  80441. ],
  80442. [
  80443. 2817,
  80444. 2817,
  80445. ],
  80446. [
  80447. 2876,
  80448. 2876,
  80449. ],
  80450. [
  80451. 2879,
  80452. 2879,
  80453. ],
  80454. [
  80455. 2881,
  80456. 2884,
  80457. ],
  80458. [
  80459. 2893,
  80460. 2893,
  80461. ],
  80462. [
  80463. 2901,
  80464. 2902,
  80465. ],
  80466. [
  80467. 2914,
  80468. 2915,
  80469. ],
  80470. [
  80471. 2946,
  80472. 2946,
  80473. ],
  80474. [
  80475. 3008,
  80476. 3008,
  80477. ],
  80478. [
  80479. 3021,
  80480. 3021,
  80481. ],
  80482. [
  80483. 3072,
  80484. 3072,
  80485. ],
  80486. [
  80487. 3076,
  80488. 3076,
  80489. ],
  80490. [
  80491. 3132,
  80492. 3132,
  80493. ],
  80494. [
  80495. 3134,
  80496. 3136,
  80497. ],
  80498. [
  80499. 3142,
  80500. 3144,
  80501. ],
  80502. [
  80503. 3146,
  80504. 3149,
  80505. ],
  80506. [
  80507. 3157,
  80508. 3158,
  80509. ],
  80510. [
  80511. 3170,
  80512. 3171,
  80513. ],
  80514. [
  80515. 3201,
  80516. 3201,
  80517. ],
  80518. [
  80519. 3260,
  80520. 3260,
  80521. ],
  80522. [
  80523. 3263,
  80524. 3263,
  80525. ],
  80526. [
  80527. 3270,
  80528. 3270,
  80529. ],
  80530. [
  80531. 3276,
  80532. 3277,
  80533. ],
  80534. [
  80535. 3298,
  80536. 3299,
  80537. ],
  80538. [
  80539. 3328,
  80540. 3329,
  80541. ],
  80542. [
  80543. 3387,
  80544. 3388,
  80545. ],
  80546. [
  80547. 3393,
  80548. 3396,
  80549. ],
  80550. [
  80551. 3405,
  80552. 3405,
  80553. ],
  80554. [
  80555. 3426,
  80556. 3427,
  80557. ],
  80558. [
  80559. 3457,
  80560. 3457,
  80561. ],
  80562. [
  80563. 3530,
  80564. 3530,
  80565. ],
  80566. [
  80567. 3538,
  80568. 3540,
  80569. ],
  80570. [
  80571. 3542,
  80572. 3542,
  80573. ],
  80574. [
  80575. 3633,
  80576. 3633,
  80577. ],
  80578. [
  80579. 3636,
  80580. 3642,
  80581. ],
  80582. [
  80583. 3655,
  80584. 3662,
  80585. ],
  80586. [
  80587. 3761,
  80588. 3761,
  80589. ],
  80590. [
  80591. 3764,
  80592. 3772,
  80593. ],
  80594. [
  80595. 3784,
  80596. 3789,
  80597. ],
  80598. [
  80599. 3864,
  80600. 3865,
  80601. ],
  80602. [
  80603. 3893,
  80604. 3893,
  80605. ],
  80606. [
  80607. 3895,
  80608. 3895,
  80609. ],
  80610. [
  80611. 3897,
  80612. 3897,
  80613. ],
  80614. [
  80615. 3953,
  80616. 3966,
  80617. ],
  80618. [
  80619. 3968,
  80620. 3972,
  80621. ],
  80622. [
  80623. 3974,
  80624. 3975,
  80625. ],
  80626. [
  80627. 3981,
  80628. 3991,
  80629. ],
  80630. [
  80631. 3993,
  80632. 4028,
  80633. ],
  80634. [
  80635. 4038,
  80636. 4038,
  80637. ],
  80638. [
  80639. 4141,
  80640. 4144,
  80641. ],
  80642. [
  80643. 4146,
  80644. 4151,
  80645. ],
  80646. [
  80647. 4153,
  80648. 4154,
  80649. ],
  80650. [
  80651. 4157,
  80652. 4158,
  80653. ],
  80654. [
  80655. 4184,
  80656. 4185,
  80657. ],
  80658. [
  80659. 4190,
  80660. 4192,
  80661. ],
  80662. [
  80663. 4209,
  80664. 4212,
  80665. ],
  80666. [
  80667. 4226,
  80668. 4226,
  80669. ],
  80670. [
  80671. 4229,
  80672. 4230,
  80673. ],
  80674. [
  80675. 4237,
  80676. 4237,
  80677. ],
  80678. [
  80679. 4253,
  80680. 4253,
  80681. ],
  80682. [
  80683. 4957,
  80684. 4959,
  80685. ],
  80686. [
  80687. 5906,
  80688. 5908,
  80689. ],
  80690. [
  80691. 5938,
  80692. 5939,
  80693. ],
  80694. [
  80695. 5970,
  80696. 5971,
  80697. ],
  80698. [
  80699. 6002,
  80700. 6003,
  80701. ],
  80702. [
  80703. 6068,
  80704. 6069,
  80705. ],
  80706. [
  80707. 6071,
  80708. 6077,
  80709. ],
  80710. [
  80711. 6086,
  80712. 6086,
  80713. ],
  80714. [
  80715. 6089,
  80716. 6099,
  80717. ],
  80718. [
  80719. 6109,
  80720. 6109,
  80721. ],
  80722. [
  80723. 6155,
  80724. 6157,
  80725. ],
  80726. [
  80727. 6159,
  80728. 6159,
  80729. ],
  80730. [
  80731. 6277,
  80732. 6278,
  80733. ],
  80734. [
  80735. 6313,
  80736. 6313,
  80737. ],
  80738. [
  80739. 6432,
  80740. 6434,
  80741. ],
  80742. [
  80743. 6439,
  80744. 6440,
  80745. ],
  80746. [
  80747. 6450,
  80748. 6450,
  80749. ],
  80750. [
  80751. 6457,
  80752. 6459,
  80753. ],
  80754. [
  80755. 6679,
  80756. 6680,
  80757. ],
  80758. [
  80759. 6683,
  80760. 6683,
  80761. ],
  80762. [
  80763. 6742,
  80764. 6742,
  80765. ],
  80766. [
  80767. 6744,
  80768. 6750,
  80769. ],
  80770. [
  80771. 6752,
  80772. 6752,
  80773. ],
  80774. [
  80775. 6754,
  80776. 6754,
  80777. ],
  80778. [
  80779. 6757,
  80780. 6764,
  80781. ],
  80782. [
  80783. 6771,
  80784. 6780,
  80785. ],
  80786. [
  80787. 6783,
  80788. 6783,
  80789. ],
  80790. [
  80791. 6832,
  80792. 6845,
  80793. ],
  80794. [
  80795. 6846,
  80796. 6846,
  80797. ],
  80798. [
  80799. 6847,
  80800. 6862,
  80801. ],
  80802. [
  80803. 6912,
  80804. 6915,
  80805. ],
  80806. [
  80807. 6964,
  80808. 6964,
  80809. ],
  80810. [
  80811. 6966,
  80812. 6970,
  80813. ],
  80814. [
  80815. 6972,
  80816. 6972,
  80817. ],
  80818. [
  80819. 6978,
  80820. 6978,
  80821. ],
  80822. [
  80823. 7019,
  80824. 7027,
  80825. ],
  80826. [
  80827. 7040,
  80828. 7041,
  80829. ],
  80830. [
  80831. 7074,
  80832. 7077,
  80833. ],
  80834. [
  80835. 7080,
  80836. 7081,
  80837. ],
  80838. [
  80839. 7083,
  80840. 7085,
  80841. ],
  80842. [
  80843. 7142,
  80844. 7142,
  80845. ],
  80846. [
  80847. 7144,
  80848. 7145,
  80849. ],
  80850. [
  80851. 7149,
  80852. 7149,
  80853. ],
  80854. [
  80855. 7151,
  80856. 7153,
  80857. ],
  80858. [
  80859. 7212,
  80860. 7219,
  80861. ],
  80862. [
  80863. 7222,
  80864. 7223,
  80865. ],
  80866. [
  80867. 7376,
  80868. 7378,
  80869. ],
  80870. [
  80871. 7380,
  80872. 7392,
  80873. ],
  80874. [
  80875. 7394,
  80876. 7400,
  80877. ],
  80878. [
  80879. 7405,
  80880. 7405,
  80881. ],
  80882. [
  80883. 7412,
  80884. 7412,
  80885. ],
  80886. [
  80887. 7416,
  80888. 7417,
  80889. ],
  80890. [
  80891. 7616,
  80892. 7679,
  80893. ],
  80894. [
  80895. 8400,
  80896. 8412,
  80897. ],
  80898. [
  80899. 8413,
  80900. 8416,
  80901. ],
  80902. [
  80903. 8417,
  80904. 8417,
  80905. ],
  80906. [
  80907. 8418,
  80908. 8420,
  80909. ],
  80910. [
  80911. 8421,
  80912. 8432,
  80913. ],
  80914. [
  80915. 11503,
  80916. 11505,
  80917. ],
  80918. [
  80919. 11647,
  80920. 11647,
  80921. ],
  80922. [
  80923. 11744,
  80924. 11775,
  80925. ],
  80926. [
  80927. 12330,
  80928. 12333,
  80929. ],
  80930. [
  80931. 12441,
  80932. 12442,
  80933. ],
  80934. [
  80935. 42607,
  80936. 42607,
  80937. ],
  80938. [
  80939. 42608,
  80940. 42610,
  80941. ],
  80942. [
  80943. 42612,
  80944. 42621,
  80945. ],
  80946. [
  80947. 42654,
  80948. 42655,
  80949. ],
  80950. [
  80951. 42736,
  80952. 42737,
  80953. ],
  80954. [
  80955. 43010,
  80956. 43010,
  80957. ],
  80958. [
  80959. 43014,
  80960. 43014,
  80961. ],
  80962. [
  80963. 43019,
  80964. 43019,
  80965. ],
  80966. [
  80967. 43045,
  80968. 43046,
  80969. ],
  80970. [
  80971. 43052,
  80972. 43052,
  80973. ],
  80974. [
  80975. 43204,
  80976. 43205,
  80977. ],
  80978. [
  80979. 43232,
  80980. 43249,
  80981. ],
  80982. [
  80983. 43263,
  80984. 43263,
  80985. ],
  80986. [
  80987. 43302,
  80988. 43309,
  80989. ],
  80990. [
  80991. 43335,
  80992. 43345,
  80993. ],
  80994. [
  80995. 43392,
  80996. 43394,
  80997. ],
  80998. [
  80999. 43443,
  81000. 43443,
  81001. ],
  81002. [
  81003. 43446,
  81004. 43449,
  81005. ],
  81006. [
  81007. 43452,
  81008. 43453,
  81009. ],
  81010. [
  81011. 43493,
  81012. 43493,
  81013. ],
  81014. [
  81015. 43561,
  81016. 43566,
  81017. ],
  81018. [
  81019. 43569,
  81020. 43570,
  81021. ],
  81022. [
  81023. 43573,
  81024. 43574,
  81025. ],
  81026. [
  81027. 43587,
  81028. 43587,
  81029. ],
  81030. [
  81031. 43596,
  81032. 43596,
  81033. ],
  81034. [
  81035. 43644,
  81036. 43644,
  81037. ],
  81038. [
  81039. 43696,
  81040. 43696,
  81041. ],
  81042. [
  81043. 43698,
  81044. 43700,
  81045. ],
  81046. [
  81047. 43703,
  81048. 43704,
  81049. ],
  81050. [
  81051. 43710,
  81052. 43711,
  81053. ],
  81054. [
  81055. 43713,
  81056. 43713,
  81057. ],
  81058. [
  81059. 43756,
  81060. 43757,
  81061. ],
  81062. [
  81063. 43766,
  81064. 43766,
  81065. ],
  81066. [
  81067. 44005,
  81068. 44005,
  81069. ],
  81070. [
  81071. 44008,
  81072. 44008,
  81073. ],
  81074. [
  81075. 44013,
  81076. 44013,
  81077. ],
  81078. [
  81079. 64286,
  81080. 64286,
  81081. ],
  81082. [
  81083. 65024,
  81084. 65039,
  81085. ],
  81086. [
  81087. 65056,
  81088. 65071,
  81089. ],
  81090. [
  81091. 66045,
  81092. 66045,
  81093. ],
  81094. [
  81095. 66272,
  81096. 66272,
  81097. ],
  81098. [
  81099. 66422,
  81100. 66426,
  81101. ],
  81102. [
  81103. 68097,
  81104. 68099,
  81105. ],
  81106. [
  81107. 68101,
  81108. 68102,
  81109. ],
  81110. [
  81111. 68108,
  81112. 68111,
  81113. ],
  81114. [
  81115. 68152,
  81116. 68154,
  81117. ],
  81118. [
  81119. 68159,
  81120. 68159,
  81121. ],
  81122. [
  81123. 68325,
  81124. 68326,
  81125. ],
  81126. [
  81127. 68900,
  81128. 68903,
  81129. ],
  81130. [
  81131. 69291,
  81132. 69292,
  81133. ],
  81134. [
  81135. 69446,
  81136. 69456,
  81137. ],
  81138. [
  81139. 69506,
  81140. 69509,
  81141. ],
  81142. [
  81143. 69633,
  81144. 69633,
  81145. ],
  81146. [
  81147. 69688,
  81148. 69702,
  81149. ],
  81150. [
  81151. 69744,
  81152. 69744,
  81153. ],
  81154. [
  81155. 69747,
  81156. 69748,
  81157. ],
  81158. [
  81159. 69759,
  81160. 69761,
  81161. ],
  81162. [
  81163. 69811,
  81164. 69814,
  81165. ],
  81166. [
  81167. 69817,
  81168. 69818,
  81169. ],
  81170. [
  81171. 69826,
  81172. 69826,
  81173. ],
  81174. [
  81175. 69888,
  81176. 69890,
  81177. ],
  81178. [
  81179. 69927,
  81180. 69931,
  81181. ],
  81182. [
  81183. 69933,
  81184. 69940,
  81185. ],
  81186. [
  81187. 70003,
  81188. 70003,
  81189. ],
  81190. [
  81191. 70016,
  81192. 70017,
  81193. ],
  81194. [
  81195. 70070,
  81196. 70078,
  81197. ],
  81198. [
  81199. 70089,
  81200. 70092,
  81201. ],
  81202. [
  81203. 70095,
  81204. 70095,
  81205. ],
  81206. [
  81207. 70191,
  81208. 70193,
  81209. ],
  81210. [
  81211. 70196,
  81212. 70196,
  81213. ],
  81214. [
  81215. 70198,
  81216. 70199,
  81217. ],
  81218. [
  81219. 70206,
  81220. 70206,
  81221. ],
  81222. [
  81223. 70367,
  81224. 70367,
  81225. ],
  81226. [
  81227. 70371,
  81228. 70378,
  81229. ],
  81230. [
  81231. 70400,
  81232. 70401,
  81233. ],
  81234. [
  81235. 70459,
  81236. 70460,
  81237. ],
  81238. [
  81239. 70464,
  81240. 70464,
  81241. ],
  81242. [
  81243. 70502,
  81244. 70508,
  81245. ],
  81246. [
  81247. 70512,
  81248. 70516,
  81249. ],
  81250. [
  81251. 70712,
  81252. 70719,
  81253. ],
  81254. [
  81255. 70722,
  81256. 70724,
  81257. ],
  81258. [
  81259. 70726,
  81260. 70726,
  81261. ],
  81262. [
  81263. 70750,
  81264. 70750,
  81265. ],
  81266. [
  81267. 70835,
  81268. 70840,
  81269. ],
  81270. [
  81271. 70842,
  81272. 70842,
  81273. ],
  81274. [
  81275. 70847,
  81276. 70848,
  81277. ],
  81278. [
  81279. 70850,
  81280. 70851,
  81281. ],
  81282. [
  81283. 71090,
  81284. 71093,
  81285. ],
  81286. [
  81287. 71100,
  81288. 71101,
  81289. ],
  81290. [
  81291. 71103,
  81292. 71104,
  81293. ],
  81294. [
  81295. 71132,
  81296. 71133,
  81297. ],
  81298. [
  81299. 71219,
  81300. 71226,
  81301. ],
  81302. [
  81303. 71229,
  81304. 71229,
  81305. ],
  81306. [
  81307. 71231,
  81308. 71232,
  81309. ],
  81310. [
  81311. 71339,
  81312. 71339,
  81313. ],
  81314. [
  81315. 71341,
  81316. 71341,
  81317. ],
  81318. [
  81319. 71344,
  81320. 71349,
  81321. ],
  81322. [
  81323. 71351,
  81324. 71351,
  81325. ],
  81326. [
  81327. 71453,
  81328. 71455,
  81329. ],
  81330. [
  81331. 71458,
  81332. 71461,
  81333. ],
  81334. [
  81335. 71463,
  81336. 71467,
  81337. ],
  81338. [
  81339. 71727,
  81340. 71735,
  81341. ],
  81342. [
  81343. 71737,
  81344. 71738,
  81345. ],
  81346. [
  81347. 71995,
  81348. 71996,
  81349. ],
  81350. [
  81351. 71998,
  81352. 71998,
  81353. ],
  81354. [
  81355. 72003,
  81356. 72003,
  81357. ],
  81358. [
  81359. 72148,
  81360. 72151,
  81361. ],
  81362. [
  81363. 72154,
  81364. 72155,
  81365. ],
  81366. [
  81367. 72160,
  81368. 72160,
  81369. ],
  81370. [
  81371. 72193,
  81372. 72202,
  81373. ],
  81374. [
  81375. 72243,
  81376. 72248,
  81377. ],
  81378. [
  81379. 72251,
  81380. 72254,
  81381. ],
  81382. [
  81383. 72263,
  81384. 72263,
  81385. ],
  81386. [
  81387. 72273,
  81388. 72278,
  81389. ],
  81390. [
  81391. 72281,
  81392. 72283,
  81393. ],
  81394. [
  81395. 72330,
  81396. 72342,
  81397. ],
  81398. [
  81399. 72344,
  81400. 72345,
  81401. ],
  81402. [
  81403. 72752,
  81404. 72758,
  81405. ],
  81406. [
  81407. 72760,
  81408. 72765,
  81409. ],
  81410. [
  81411. 72767,
  81412. 72767,
  81413. ],
  81414. [
  81415. 72850,
  81416. 72871,
  81417. ],
  81418. [
  81419. 72874,
  81420. 72880,
  81421. ],
  81422. [
  81423. 72882,
  81424. 72883,
  81425. ],
  81426. [
  81427. 72885,
  81428. 72886,
  81429. ],
  81430. [
  81431. 73009,
  81432. 73014,
  81433. ],
  81434. [
  81435. 73018,
  81436. 73018,
  81437. ],
  81438. [
  81439. 73020,
  81440. 73021,
  81441. ],
  81442. [
  81443. 73023,
  81444. 73029,
  81445. ],
  81446. [
  81447. 73031,
  81448. 73031,
  81449. ],
  81450. [
  81451. 73104,
  81452. 73105,
  81453. ],
  81454. [
  81455. 73109,
  81456. 73109,
  81457. ],
  81458. [
  81459. 73111,
  81460. 73111,
  81461. ],
  81462. [
  81463. 73459,
  81464. 73460,
  81465. ],
  81466. [
  81467. 92912,
  81468. 92916,
  81469. ],
  81470. [
  81471. 92976,
  81472. 92982,
  81473. ],
  81474. [
  81475. 94031,
  81476. 94031,
  81477. ],
  81478. [
  81479. 94095,
  81480. 94098,
  81481. ],
  81482. [
  81483. 94180,
  81484. 94180,
  81485. ],
  81486. [
  81487. 113821,
  81488. 113822,
  81489. ],
  81490. [
  81491. 118528,
  81492. 118573,
  81493. ],
  81494. [
  81495. 118576,
  81496. 118598,
  81497. ],
  81498. [
  81499. 119143,
  81500. 119145,
  81501. ],
  81502. [
  81503. 119163,
  81504. 119170,
  81505. ],
  81506. [
  81507. 119173,
  81508. 119179,
  81509. ],
  81510. [
  81511. 119210,
  81512. 119213,
  81513. ],
  81514. [
  81515. 119362,
  81516. 119364,
  81517. ],
  81518. [
  81519. 121344,
  81520. 121398,
  81521. ],
  81522. [
  81523. 121403,
  81524. 121452,
  81525. ],
  81526. [
  81527. 121461,
  81528. 121461,
  81529. ],
  81530. [
  81531. 121476,
  81532. 121476,
  81533. ],
  81534. [
  81535. 121499,
  81536. 121503,
  81537. ],
  81538. [
  81539. 121505,
  81540. 121519,
  81541. ],
  81542. [
  81543. 122880,
  81544. 122886,
  81545. ],
  81546. [
  81547. 122888,
  81548. 122904,
  81549. ],
  81550. [
  81551. 122907,
  81552. 122913,
  81553. ],
  81554. [
  81555. 122915,
  81556. 122916,
  81557. ],
  81558. [
  81559. 122918,
  81560. 122922,
  81561. ],
  81562. [
  81563. 123184,
  81564. 123190,
  81565. ],
  81566. [
  81567. 123566,
  81568. 123566,
  81569. ],
  81570. [
  81571. 123628,
  81572. 123631,
  81573. ],
  81574. [
  81575. 125136,
  81576. 125142,
  81577. ],
  81578. [
  81579. 125252,
  81580. 125258,
  81581. ],
  81582. [
  81583. 917760,
  81584. 917999,
  81585. ],
  81586. ];
  81587. <?php
  81588. namespace Symfony\Component\String;
  81589. if (!\function_exists(u::class)) {
  81590. function u(?string $string = ''): UnicodeString
  81591. {
  81592. return new UnicodeString($string ?? '');
  81593. }
  81594. }
  81595. if (!\function_exists(b::class)) {
  81596. function b(?string $string = ''): ByteString
  81597. {
  81598. return new ByteString($string ?? '');
  81599. }
  81600. }
  81601. if (!\function_exists(s::class)) {
  81602. function s(?string $string = ''): AbstractString
  81603. {
  81604. $string = $string ?? '';
  81605. return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
  81606. }
  81607. }
  81608. <?php
  81609. namespace Symfony\Component\String\Slugger;
  81610. use Symfony\Component\String\AbstractUnicodeString;
  81611. use Symfony\Component\String\UnicodeString;
  81612. use Symfony\Contracts\Translation\LocaleAwareInterface;
  81613. if (!interface_exists(LocaleAwareInterface::class)) {
  81614. throw new \LogicException('You cannot use the "Symfony\Component\String\Slugger\AsciiSlugger" as the "symfony/translation-contracts" package is not installed. Try running "composer require symfony/translation-contracts".');
  81615. }
  81616. class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
  81617. {
  81618. private const LOCALE_TO_TRANSLITERATOR_ID = [
  81619. 'am' => 'Amharic-Latin',
  81620. 'ar' => 'Arabic-Latin',
  81621. 'az' => 'Azerbaijani-Latin',
  81622. 'be' => 'Belarusian-Latin',
  81623. 'bg' => 'Bulgarian-Latin',
  81624. 'bn' => 'Bengali-Latin',
  81625. 'de' => 'de-ASCII',
  81626. 'el' => 'Greek-Latin',
  81627. 'fa' => 'Persian-Latin',
  81628. 'he' => 'Hebrew-Latin',
  81629. 'hy' => 'Armenian-Latin',
  81630. 'ka' => 'Georgian-Latin',
  81631. 'kk' => 'Kazakh-Latin',
  81632. 'ky' => 'Kirghiz-Latin',
  81633. 'ko' => 'Korean-Latin',
  81634. 'mk' => 'Macedonian-Latin',
  81635. 'mn' => 'Mongolian-Latin',
  81636. 'or' => 'Oriya-Latin',
  81637. 'ps' => 'Pashto-Latin',
  81638. 'ru' => 'Russian-Latin',
  81639. 'sr' => 'Serbian-Latin',
  81640. 'sr_Cyrl' => 'Serbian-Latin',
  81641. 'th' => 'Thai-Latin',
  81642. 'tk' => 'Turkmen-Latin',
  81643. 'uk' => 'Ukrainian-Latin',
  81644. 'uz' => 'Uzbek-Latin',
  81645. 'zh' => 'Han-Latin',
  81646. ];
  81647. private $defaultLocale;
  81648. private $symbolsMap = [
  81649. 'en' => ['@' => 'at', '&' => 'and'],
  81650. ];
  81651. private $transliterators = [];
  81652. public function __construct(string $defaultLocale = null, $symbolsMap = null)
  81653. {
  81654. if (null !== $symbolsMap && !\is_array($symbolsMap) && !$symbolsMap instanceof \Closure) {
  81655. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be array, Closure or null, "%s" given.', __METHOD__, \gettype($symbolsMap)));
  81656. }
  81657. $this->defaultLocale = $defaultLocale;
  81658. $this->symbolsMap = $symbolsMap ?? $this->symbolsMap;
  81659. }
  81660. public function setLocale($locale)
  81661. {
  81662. $this->defaultLocale = $locale;
  81663. }
  81664. public function getLocale()
  81665. {
  81666. return $this->defaultLocale;
  81667. }
  81668. public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString
  81669. {
  81670. $locale = $locale ?? $this->defaultLocale;
  81671. $transliterator = [];
  81672. if ($locale && ('de' === $locale || 0 === strpos($locale, 'de_'))) {
  81673. $transliterator = ['de-ASCII'];
  81674. } elseif (\function_exists('transliterator_transliterate') && $locale) {
  81675. $transliterator = (array) $this->createTransliterator($locale);
  81676. }
  81677. if ($this->symbolsMap instanceof \Closure) {
  81678. $symbolsMap = $this->symbolsMap;
  81679. array_unshift($transliterator, static function ($s) use ($symbolsMap, $locale) {
  81680. return $symbolsMap($s, $locale);
  81681. });
  81682. }
  81683. $unicodeString = (new UnicodeString($string))->ascii($transliterator);
  81684. if (\is_array($this->symbolsMap)) {
  81685. $map = null;
  81686. if (isset($this->symbolsMap[$locale])) {
  81687. $map = $this->symbolsMap[$locale];
  81688. } else {
  81689. $parent = self::getParentLocale($locale);
  81690. if ($parent && isset($this->symbolsMap[$parent])) {
  81691. $map = $this->symbolsMap[$parent];
  81692. }
  81693. }
  81694. if ($map) {
  81695. foreach ($map as $char => $replace) {
  81696. $unicodeString = $unicodeString->replace($char, ' '.$replace.' ');
  81697. }
  81698. }
  81699. }
  81700. return $unicodeString
  81701. ->replaceMatches('/[^A-Za-z0-9]++/', $separator)
  81702. ->trim($separator)
  81703. ;
  81704. }
  81705. private function createTransliterator(string $locale): ?\Transliterator
  81706. {
  81707. if (\array_key_exists($locale, $this->transliterators)) {
  81708. return $this->transliterators[$locale];
  81709. }
  81710. if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$locale] ?? null) {
  81711. return $this->transliterators[$locale] = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
  81712. }
  81713. if (!$parent = self::getParentLocale($locale)) {
  81714. return $this->transliterators[$locale] = null;
  81715. }
  81716. if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$parent] ?? null) {
  81717. $transliterator = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
  81718. }
  81719. return $this->transliterators[$locale] = $this->transliterators[$parent] = $transliterator ?? null;
  81720. }
  81721. private static function getParentLocale(?string $locale): ?string
  81722. {
  81723. if (!$locale) {
  81724. return null;
  81725. }
  81726. if (false === $str = strrchr($locale, '_')) {
  81727. return null;
  81728. }
  81729. return substr($locale, 0, -\strlen($str));
  81730. }
  81731. }
  81732. <?php
  81733. namespace Symfony\Component\String\Slugger;
  81734. use Symfony\Component\String\AbstractUnicodeString;
  81735. interface SluggerInterface
  81736. {
  81737. public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString;
  81738. }
  81739. <?php
  81740. namespace Symfony\Component\String;
  81741. use Symfony\Component\String\Exception\ExceptionInterface;
  81742. use Symfony\Component\String\Exception\InvalidArgumentException;
  81743. class UnicodeString extends AbstractUnicodeString
  81744. {
  81745. public function __construct(string $string = '')
  81746. {
  81747. $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string);
  81748. if (false === $this->string) {
  81749. throw new InvalidArgumentException('Invalid UTF-8 string.');
  81750. }
  81751. }
  81752. public function append(string ...$suffix): AbstractString
  81753. {
  81754. $str = clone $this;
  81755. $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix));
  81756. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  81757. if (false === $str->string) {
  81758. throw new InvalidArgumentException('Invalid UTF-8 string.');
  81759. }
  81760. return $str;
  81761. }
  81762. public function chunk(int $length = 1): array
  81763. {
  81764. if (1 > $length) {
  81765. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  81766. }
  81767. if ('' === $this->string) {
  81768. return [];
  81769. }
  81770. $rx = '/(';
  81771. while (65535 < $length) {
  81772. $rx .= '\X{65535}';
  81773. $length -= 65535;
  81774. }
  81775. $rx .= '\X{'.$length.'})/u';
  81776. $str = clone $this;
  81777. $chunks = [];
  81778. foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
  81779. $str->string = $chunk;
  81780. $chunks[] = clone $str;
  81781. }
  81782. return $chunks;
  81783. }
  81784. public function endsWith($suffix): bool
  81785. {
  81786. if ($suffix instanceof AbstractString) {
  81787. $suffix = $suffix->string;
  81788. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  81789. return parent::endsWith($suffix);
  81790. } else {
  81791. $suffix = (string) $suffix;
  81792. }
  81793. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  81794. normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form);
  81795. if ('' === $suffix || false === $suffix) {
  81796. return false;
  81797. }
  81798. if ($this->ignoreCase) {
  81799. return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8');
  81800. }
  81801. return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
  81802. }
  81803. public function equalsTo($string): bool
  81804. {
  81805. if ($string instanceof AbstractString) {
  81806. $string = $string->string;
  81807. } elseif (\is_array($string) || $string instanceof \Traversable) {
  81808. return parent::equalsTo($string);
  81809. } else {
  81810. $string = (string) $string;
  81811. }
  81812. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  81813. normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form);
  81814. if ('' !== $string && false !== $string && $this->ignoreCase) {
  81815. return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
  81816. }
  81817. return $string === $this->string;
  81818. }
  81819. public function indexOf($needle, int $offset = 0): ?int
  81820. {
  81821. if ($needle instanceof AbstractString) {
  81822. $needle = $needle->string;
  81823. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  81824. return parent::indexOf($needle, $offset);
  81825. } else {
  81826. $needle = (string) $needle;
  81827. }
  81828. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  81829. normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
  81830. if ('' === $needle || false === $needle) {
  81831. return null;
  81832. }
  81833. try {
  81834. $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);
  81835. } catch (\ValueError $e) {
  81836. return null;
  81837. }
  81838. return false === $i ? null : $i;
  81839. }
  81840. public function indexOfLast($needle, int $offset = 0): ?int
  81841. {
  81842. if ($needle instanceof AbstractString) {
  81843. $needle = $needle->string;
  81844. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  81845. return parent::indexOfLast($needle, $offset);
  81846. } else {
  81847. $needle = (string) $needle;
  81848. }
  81849. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  81850. normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
  81851. if ('' === $needle || false === $needle) {
  81852. return null;
  81853. }
  81854. $string = $this->string;
  81855. if (0 > $offset) {
  81856. if (0 > $offset += grapheme_strlen($needle)) {
  81857. $string = grapheme_substr($string, 0, $offset);
  81858. }
  81859. $offset = 0;
  81860. }
  81861. $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset);
  81862. return false === $i ? null : $i;
  81863. }
  81864. public function join(array $strings, string $lastGlue = null): AbstractString
  81865. {
  81866. $str = parent::join($strings, $lastGlue);
  81867. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  81868. return $str;
  81869. }
  81870. public function length(): int
  81871. {
  81872. return grapheme_strlen($this->string);
  81873. }
  81874. public function normalize(int $form = self::NFC): parent
  81875. {
  81876. $str = clone $this;
  81877. if (\in_array($form, [self::NFC, self::NFKC], true)) {
  81878. normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
  81879. } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) {
  81880. throw new InvalidArgumentException('Unsupported normalization form.');
  81881. } elseif (!normalizer_is_normalized($str->string, $form)) {
  81882. $str->string = normalizer_normalize($str->string, $form);
  81883. $str->ignoreCase = null;
  81884. }
  81885. return $str;
  81886. }
  81887. public function prepend(string ...$prefix): AbstractString
  81888. {
  81889. $str = clone $this;
  81890. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
  81891. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  81892. if (false === $str->string) {
  81893. throw new InvalidArgumentException('Invalid UTF-8 string.');
  81894. }
  81895. return $str;
  81896. }
  81897. public function replace(string $from, string $to): AbstractString
  81898. {
  81899. $str = clone $this;
  81900. normalizer_is_normalized($from) ?: $from = normalizer_normalize($from);
  81901. if ('' !== $from && false !== $from) {
  81902. $tail = $str->string;
  81903. $result = '';
  81904. $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
  81905. while ('' !== $tail && false !== $i = $indexOf($tail, $from)) {
  81906. $slice = grapheme_substr($tail, 0, $i);
  81907. $result .= $slice.$to;
  81908. $tail = substr($tail, \strlen($slice) + \strlen($from));
  81909. }
  81910. $str->string = $result.$tail;
  81911. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  81912. if (false === $str->string) {
  81913. throw new InvalidArgumentException('Invalid UTF-8 string.');
  81914. }
  81915. }
  81916. return $str;
  81917. }
  81918. public function replaceMatches(string $fromRegexp, $to): AbstractString
  81919. {
  81920. $str = parent::replaceMatches($fromRegexp, $to);
  81921. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  81922. return $str;
  81923. }
  81924. public function slice(int $start = 0, int $length = null): AbstractString
  81925. {
  81926. $str = clone $this;
  81927. if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
  81928. $start = 0;
  81929. }
  81930. $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
  81931. return $str;
  81932. }
  81933. public function splice(string $replacement, int $start = 0, int $length = null): AbstractString
  81934. {
  81935. $str = clone $this;
  81936. if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
  81937. $start = 0;
  81938. }
  81939. $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
  81940. $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
  81941. $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
  81942. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  81943. if (false === $str->string) {
  81944. throw new InvalidArgumentException('Invalid UTF-8 string.');
  81945. }
  81946. return $str;
  81947. }
  81948. public function split(string $delimiter, int $limit = null, int $flags = null): array
  81949. {
  81950. if (1 > $limit = $limit ?? 2147483647) {
  81951. throw new InvalidArgumentException('Split limit must be a positive integer.');
  81952. }
  81953. if ('' === $delimiter) {
  81954. throw new InvalidArgumentException('Split delimiter is empty.');
  81955. }
  81956. if (null !== $flags) {
  81957. return parent::split($delimiter.'u', $limit, $flags);
  81958. }
  81959. normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter);
  81960. if (false === $delimiter) {
  81961. throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
  81962. }
  81963. $str = clone $this;
  81964. $tail = $this->string;
  81965. $chunks = [];
  81966. $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
  81967. while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) {
  81968. $str->string = grapheme_substr($tail, 0, $i);
  81969. $chunks[] = clone $str;
  81970. $tail = substr($tail, \strlen($str->string) + \strlen($delimiter));
  81971. --$limit;
  81972. }
  81973. $str->string = $tail;
  81974. $chunks[] = clone $str;
  81975. return $chunks;
  81976. }
  81977. public function startsWith($prefix): bool
  81978. {
  81979. if ($prefix instanceof AbstractString) {
  81980. $prefix = $prefix->string;
  81981. } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
  81982. return parent::startsWith($prefix);
  81983. } else {
  81984. $prefix = (string) $prefix;
  81985. }
  81986. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  81987. normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form);
  81988. if ('' === $prefix || false === $prefix) {
  81989. return false;
  81990. }
  81991. if ($this->ignoreCase) {
  81992. return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8');
  81993. }
  81994. return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES);
  81995. }
  81996. public function __wakeup()
  81997. {
  81998. if (!\is_string($this->string)) {
  81999. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  82000. }
  82001. normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
  82002. }
  82003. public function __clone()
  82004. {
  82005. if (null === $this->ignoreCase) {
  82006. normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
  82007. }
  82008. $this->ignoreCase = false;
  82009. }
  82010. }
  82011. <?php
  82012. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  82013. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  82014. }
  82015. if (PHP_VERSION_ID < 70205) {
  82016. echo 'Composer 2.3.0 dropped support for PHP <7.2.5 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  82017. exit(1);
  82018. }
  82019. setlocale(LC_ALL, 'C');
  82020. require __DIR__.'/../src/bootstrap.php';
  82021. use Composer\Console\Application;
  82022. use Composer\XdebugHandler\XdebugHandler;
  82023. use Composer\Util\Platform;
  82024. use Composer\Util\ErrorHandler;
  82025. error_reporting(-1);
  82026. // Restart without Xdebug
  82027. $xdebug = new XdebugHandler('Composer');
  82028. $xdebug->check();
  82029. unset($xdebug);
  82030. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  82031. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  82032. exit(1);
  82033. }
  82034. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  82035. echo 'The iconv OR mbstring extension is required and both are missing.'
  82036. .PHP_EOL.'Install either of them or recompile php without --disable-iconv.'
  82037. .PHP_EOL.'Aborting.'.PHP_EOL;
  82038. exit(1);
  82039. }
  82040. if (function_exists('ini_set')) {
  82041. @ini_set('display_errors', '1');
  82042. // Set user defined memory limit
  82043. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  82044. @ini_set('memory_limit', $memoryLimit);
  82045. } else {
  82046. $memoryInBytes = function ($value) {
  82047. $unit = strtolower(substr($value, -1, 1));
  82048. $value = (int) $value;
  82049. switch($unit) {
  82050. case 'g':
  82051. $value *= 1024;
  82052. // no break (cumulative multiplier)
  82053. case 'm':
  82054. $value *= 1024;
  82055. // no break (cumulative multiplier)
  82056. case 'k':
  82057. $value *= 1024;
  82058. }
  82059. return $value;
  82060. };
  82061. $memoryLimit = trim(ini_get('memory_limit'));
  82062. // Increase memory_limit if it is lower than 1.5GB
  82063. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  82064. @ini_set('memory_limit', '1536M');
  82065. }
  82066. unset($memoryInBytes);
  82067. }
  82068. unset($memoryLimit);
  82069. }
  82070. // Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
  82071. // see https://github.com/php/php-src/issues/7896
  82072. if (PHP_VERSION_ID >= 70113 && (PHP_VERSION_ID < 80016 || (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80103)) && Platform::isWindows()) {
  82073. foreach ($_SERVER as $serverVar => $serverVal) {
  82074. if (($serverVal = getenv($serverVar)) !== false) {
  82075. $_SERVER[$serverVar] = $serverVal;
  82076. }
  82077. }
  82078. }
  82079. Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));
  82080. ErrorHandler::register();
  82081. // run the command application
  82082. $application = new Application();
  82083. $application->run();
  82084. Copyright (c) Nils Adermann, Jordi Boggiano
  82085. Permission is hereby granted, free of charge, to any person obtaining a copy
  82086. of this software and associated documentation files (the "Software"), to deal
  82087. in the Software without restriction, including without limitation the rights
  82088. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  82089. copies of the Software, and to permit persons to whom the Software is furnished
  82090. to do so, subject to the following conditions:
  82091. The above copyright notice and this permission notice shall be included in all
  82092. copies or substantial portions of the Software.
  82093. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  82094. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  82095. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  82096. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  82097. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  82098. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  82099. THE SOFTWARE.
  82100. q¡²ŸF¢õH:-¥‚/ÏÛXïÚú¿É=ŽkÝ•|gÙQ¡`Ä<Ôý¹Ñ,s£Ç/Þ1Ü6)]È59Ý�ê­Æ���GBMB