composer.phar 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236872378723887239872408724187242872438724487245872468724787248872498725087251872528725387254872558725687257872588725987260872618726287263872648726587266872678726887269872708727187272872738727487275872768727787278872798728087281872828728387284872858728687287872888728987290872918729287293872948729587296872978729887299873008730187302873038730487305873068730787308873098731087311873128731387314873158731687317873188731987320873218732287323873248732587326873278732887329873308733187332873338733487335873368733787338873398734087341873428734387344873458734687347873488734987350873518735287353873548735587356873578735887359873608736187362873638736487365873668736787368873698737087371873728737387374873758737687377873788737987380873818738287383873848738587386873878738887389873908739187392873938739487395873968739787398873998740087401874028740387404874058740687407874088740987410874118741287413874148741587416874178741887419874208742187422874238742487425874268742787428874298743087431874328743387434874358743687437874388743987440874418744287443874448744587446874478744887449874508745187452874538745487455874568745787458874598746087461874628746387464874658746687467874688746987470874718747287473874748747587476874778747887479874808748187482874838748487485874868748787488874898749087491874928749387494874958749687497874988749987500875018750287503875048750587506875078750887509875108751187512875138751487515875168751787518875198752087521875228752387524875258752687527875288752987530875318753287533875348753587536875378753887539875408754187542875438754487545875468754787548875498755087551875528755387554875558755687557875588755987560875618756287563875648756587566875678756887569875708757187572875738757487575875768757787578875798758087581875828758387584875858758687587875888758987590875918759287593875948759587596875978759887599876008760187602876038760487605876068760787608876098761087611876128761387614876158761687617876188761987620876218762287623876248762587626876278762887629876308763187632876338763487635876368763787638876398764087641876428764387644876458764687647876488764987650876518765287653876548765587656876578765887659876608766187662876638766487665876668766787668876698767087671876728767387674876758767687677876788767987680876818768287683876848768587686876878768887689876908769187692876938769487695876968769787698876998770087701877028770387704877058770687707877088770987710877118771287713877148771587716877178771887719877208772187722877238772487725877268772787728877298773087731877328773387734877358773687737877388773987740877418774287743877448774587746877478774887749877508775187752877538775487755877568775787758877598776087761877628776387764877658776687767877688776987770877718777287773877748777587776877778777887779877808778187782877838778487785877868778787788877898779087791877928779387794877958779687797877988779987800878018780287803878048780587806878078780887809878108781187812878138781487815878168781787818878198782087821878228782387824878258782687827878288782987830878318783287833878348783587836878378783887839878408784187842878438784487845878468784787848878498785087851878528785387854878558785687857878588785987860878618786287863878648786587866878678786887869878708787187872878738787487875878768787787878878798788087881878828788387884878858788687887878888788987890878918789287893878948789587896878978789887899879008790187902879038790487905879068790787908879098791087911879128791387914879158791687917879188791987920879218792287923879248792587926879278792887929879308793187932879338793487935879368793787938879398794087941879428794387944879458794687947879488794987950879518795287953879548795587956879578795887959879608796187962879638796487965879668796787968879698797087971879728797387974879758797687977879788797987980879818798287983879848798587986879878798887989879908799187992879938799487995879968799787998879998800088001880028800388004880058800688007880088800988010880118801288013880148801588016880178801888019880208802188022880238802488025880268802788028880298803088031880328803388034880358803688037880388803988040880418804288043880448804588046880478804888049880508805188052880538805488055880568805788058880598806088061880628806388064880658806688067880688806988070880718807288073880748807588076880778807888079880808808188082880838808488085880868808788088880898809088091880928809388094880958809688097880988809988100881018810288103881048810588106881078810888109881108811188112881138811488115881168811788118881198812088121881228812388124881258812688127881288812988130881318813288133881348813588136881378813888139881408814188142881438814488145881468814788148881498815088151881528815388154881558815688157881588815988160881618816288163881648816588166881678816888169881708817188172881738817488175881768817788178881798818088181881828818388184881858818688187881888818988190881918819288193881948819588196881978819888199882008820188202882038820488205882068820788208882098821088211882128821388214882158821688217882188821988220882218822288223882248822588226882278822888229882308823188232882338823488235882368823788238882398824088241882428824388244882458824688247882488824988250882518825288253882548825588256882578825888259882608826188262882638826488265882668826788268882698827088271882728827388274882758827688277882788827988280882818828288283882848828588286882878828888289882908829188292882938829488295882968829788298882998830088301883028830388304883058830688307883088830988310883118831288313883148831588316883178831888319883208832188322883238832488325883268832788328883298833088331883328833388334883358833688337883388833988340883418834288343883448834588346883478834888349883508835188352883538835488355883568835788358883598836088361883628836388364883658836688367883688836988370883718837288373883748837588376883778837888379883808838188382883838838488385883868838788388883898839088391883928839388394883958839688397883988839988400884018840288403884048840588406884078840888409884108841188412884138841488415884168841788418884198842088421884228842388424884258842688427884288842988430884318843288433884348843588436884378843888439884408844188442884438844488445884468844788448884498845088451884528845388454884558845688457884588845988460884618846288463884648846588466884678846888469884708847188472884738847488475884768847788478884798848088481884828848388484884858848688487884888848988490884918849288493884948849588496884978849888499885008850188502885038850488505885068850788508885098851088511885128851388514885158851688517885188851988520885218852288523885248852588526885278852888529885308853188532885338853488535885368853788538885398854088541885428854388544885458854688547885488854988550885518855288553885548855588556885578855888559885608856188562885638856488565885668856788568885698857088571885728857388574885758857688577885788857988580885818858288583885848858588586885878858888589885908859188592885938859488595885968859788598885998860088601886028860388604886058860688607886088860988610886118861288613886148861588616886178861888619886208862188622886238862488625886268862788628886298863088631886328863388634886358863688637886388863988640886418864288643886448864588646886478864888649886508865188652886538865488655886568865788658886598866088661886628866388664886658866688667886688866988670886718867288673886748867588676886778867888679886808868188682886838868488685886868868788688886898869088691886928869388694886958869688697886988869988700887018870288703887048870588706887078870888709887108871188712887138871488715887168871788718887198872088721887228872388724887258872688727887288872988730887318873288733887348873588736887378873888739887408874188742887438874488745887468874788748887498875088751887528875388754887558875688757887588875988760887618876288763887648876588766887678876888769887708877188772887738877488775887768877788778887798878088781887828878388784887858878688787887888878988790887918879288793887948879588796887978879888799888008880188802888038880488805888068880788808888098881088811888128881388814888158881688817888188881988820888218882288823888248882588826888278882888829888308883188832888338883488835888368883788838888398884088841888428884388844888458884688847888488884988850888518885288853888548885588856888578885888859888608886188862888638886488865888668886788868888698887088871888728887388874888758887688877888788887988880888818888288883888848888588886888878888888889888908889188892888938889488895888968889788898888998890088901889028890388904889058890688907889088890988910889118891288913889148891588916889178891888919889208892188922889238892488925889268892788928889298893088931889328893388934889358893688937889388893988940889418894288943889448894588946889478894888949889508895188952889538895488955889568895788958889598896088961889628896388964889658896688967889688896988970889718897288973889748897588976889778897888979889808898188982889838898488985889868898788988889898899088991889928899388994889958899688997889988899989000890018900289003890048900589006890078900889009890108901189012890138901489015890168901789018890198902089021890228902389024890258902689027890288902989030890318903289033890348903589036890378903889039890408904189042890438904489045890468904789048890498905089051890528905389054890558905689057890588905989060890618906289063890648906589066890678906889069890708907189072890738907489075890768907789078890798908089081890828908389084890858908689087890888908989090890918909289093890948909589096890978909889099891008910189102891038910489105891068910789108891098911089111891128911389114891158911689117891188911989120891218912289123891248912589126891278912889129891308913189132891338913489135891368913789138891398914089141891428914389144891458914689147891488914989150891518915289153891548915589156891578915889159891608916189162891638916489165891668916789168891698917089171891728917389174891758917689177891788917989180891818918289183891848918589186891878918889189891908919189192891938919489195891968919789198891998920089201892028920389204892058920689207892088920989210892118921289213892148921589216892178921889219892208922189222892238922489225892268922789228892298923089231892328923389234892358923689237892388923989240892418924289243892448924589246892478924889249892508925189252892538925489255892568925789258892598926089261892628926389264892658926689267892688926989270892718927289273892748927589276892778927889279892808928189282892838928489285892868928789288892898929089291892928929389294892958929689297892988929989300893018930289303893048930589306893078930889309893108931189312893138931489315893168931789318893198932089321893228932389324893258932689327893288932989330893318933289333893348933589336893378933889339893408934189342893438934489345893468934789348893498935089351893528935389354893558935689357893588935989360893618936289363893648936589366893678936889369893708937189372893738937489375893768937789378893798938089381893828938389384893858938689387893888938989390893918939289393893948939589396893978939889399894008940189402894038940489405894068940789408894098941089411894128941389414894158941689417894188941989420894218942289423894248942589426894278942889429894308943189432894338943489435894368943789438894398944089441894428944389444894458944689447894488944989450894518945289453894548945589456894578945889459894608946189462894638946489465894668946789468894698947089471894728947389474894758947689477894788947989480894818948289483894848948589486894878948889489894908949189492894938949489495894968949789498894998950089501895028950389504895058950689507895088950989510895118951289513895148951589516895178951889519895208952189522895238952489525895268952789528895298953089531895328953389534895358953689537895388953989540895418954289543895448954589546895478954889549895508955189552895538955489555895568955789558895598956089561895628956389564895658956689567895688956989570895718957289573895748957589576895778957889579895808958189582895838958489585895868958789588895898959089591895928959389594895958959689597895988959989600896018960289603896048960589606896078960889609896108961189612896138961489615896168961789618896198962089621896228962389624896258962689627896288962989630896318963289633896348963589636896378963889639896408964189642896438964489645896468964789648896498965089651896528965389654896558965689657896588965989660896618966289663896648966589666896678966889669896708967189672896738967489675896768967789678896798968089681896828968389684896858968689687896888968989690896918969289693896948969589696896978969889699897008970189702897038970489705897068970789708897098971089711897128971389714897158971689717897188971989720897218972289723897248972589726897278972889729897308973189732897338973489735897368973789738897398974089741897428974389744897458974689747897488974989750897518975289753897548975589756897578975889759897608976189762897638976489765897668976789768897698977089771897728977389774897758977689777897788977989780897818978289783897848978589786897878978889789897908979189792897938979489795897968979789798897998980089801898028980389804898058980689807898088980989810898118981289813898148981589816898178981889819898208982189822898238982489825898268982789828898298983089831898328983389834898358983689837898388983989840898418984289843898448984589846898478984889849898508985189852898538985489855898568985789858898598986089861898628986389864898658986689867898688986989870898718987289873898748987589876898778987889879898808988189882898838988489885898868988789888898898989089891898928989389894898958989689897898988989989900899018990289903899048990589906899078990889909899108991189912899138991489915899168991789918899198992089921899228992389924899258992689927899288992989930899318993289933899348993589936899378993889939899408994189942899438994489945899468994789948899498995089951899528995389954899558995689957899588995989960899618996289963899648996589966899678996889969899708997189972899738997489975899768997789978899798998089981899828998389984899858998689987899888998989990899918999289993899948999589996899978999889999900009000190002900039000490005900069000790008900099001090011900129001390014900159001690017900189001990020900219002290023900249002590026900279002890029900309003190032900339003490035900369003790038900399004090041900429004390044900459004690047900489004990050900519005290053900549005590056900579005890059900609006190062900639006490065900669006790068900699007090071900729007390074900759007690077900789007990080900819008290083900849008590086900879008890089900909009190092900939009490095900969009790098900999010090101901029010390104901059010690107901089010990110901119011290113901149011590116901179011890119901209012190122901239012490125901269012790128901299013090131901329013390134901359013690137901389013990140901419014290143901449014590146901479014890149901509015190152901539015490155901569015790158901599016090161901629016390164901659016690167901689016990170901719017290173901749017590176901779017890179901809018190182901839018490185901869018790188901899019090191901929019390194901959019690197901989019990200902019020290203902049020590206902079020890209902109021190212902139021490215902169021790218902199022090221902229022390224902259022690227902289022990230902319023290233902349023590236902379023890239902409024190242902439024490245902469024790248902499025090251902529025390254902559025690257902589025990260902619026290263902649026590266902679026890269902709027190272902739027490275902769027790278902799028090281902829028390284902859028690287902889028990290902919029290293902949029590296902979029890299903009030190302903039030490305903069030790308903099031090311903129031390314903159031690317903189031990320903219032290323903249032590326903279032890329903309033190332903339033490335903369033790338903399034090341903429034390344903459034690347903489034990350903519035290353903549035590356903579035890359903609036190362903639036490365903669036790368903699037090371903729037390374903759037690377903789037990380903819038290383903849038590386903879038890389903909039190392903939039490395903969039790398903999040090401904029040390404904059040690407904089040990410904119041290413904149041590416904179041890419904209042190422904239042490425904269042790428904299043090431904329043390434904359043690437904389043990440904419044290443904449044590446904479044890449904509045190452904539045490455904569045790458904599046090461904629046390464904659046690467904689046990470904719047290473904749047590476904779047890479904809048190482904839048490485904869048790488904899049090491904929049390494904959049690497904989049990500905019050290503905049050590506905079050890509905109051190512905139051490515905169051790518905199052090521905229052390524905259052690527905289052990530905319053290533905349053590536905379053890539905409054190542905439054490545905469054790548905499055090551905529055390554905559055690557905589055990560905619056290563905649056590566905679056890569905709057190572905739057490575905769057790578905799058090581905829058390584905859058690587905889058990590905919059290593905949059590596905979059890599906009060190602906039060490605906069060790608906099061090611906129061390614906159061690617906189061990620906219062290623906249062590626906279062890629906309063190632906339063490635906369063790638906399064090641906429064390644906459064690647906489064990650906519065290653906549065590656906579065890659906609066190662906639066490665906669066790668906699067090671906729067390674906759067690677906789067990680906819068290683906849068590686906879068890689906909069190692906939069490695906969069790698906999070090701907029070390704907059070690707907089070990710907119071290713907149071590716907179071890719907209072190722907239072490725907269072790728907299073090731907329073390734907359073690737907389073990740907419074290743907449074590746907479074890749907509075190752907539075490755907569075790758907599076090761907629076390764907659076690767907689076990770907719077290773907749077590776907779077890779907809078190782907839078490785907869078790788907899079090791907929079390794907959079690797907989079990800908019080290803908049080590806908079080890809908109081190812908139081490815908169081790818908199082090821908229082390824908259082690827908289082990830908319083290833908349083590836908379083890839908409084190842908439084490845908469084790848908499085090851908529085390854908559085690857908589085990860908619086290863908649086590866908679086890869908709087190872908739087490875908769087790878908799088090881908829088390884908859088690887908889088990890908919089290893908949089590896908979089890899909009090190902909039090490905909069090790908909099091090911909129091390914909159091690917909189091990920909219092290923909249092590926909279092890929909309093190932909339093490935909369093790938909399094090941909429094390944909459094690947909489094990950909519095290953909549095590956909579095890959909609096190962909639096490965909669096790968909699097090971909729097390974909759097690977909789097990980909819098290983909849098590986909879098890989909909099190992909939099490995909969099790998909999100091001910029100391004910059100691007910089100991010910119101291013910149101591016910179101891019910209102191022910239102491025910269102791028910299103091031910329103391034910359103691037910389103991040910419104291043910449104591046910479104891049910509105191052910539105491055910569105791058910599106091061910629106391064910659106691067910689106991070910719107291073910749107591076910779107891079910809108191082910839108491085910869108791088910899109091091910929109391094910959109691097910989109991100911019110291103911049110591106911079110891109911109111191112911139111491115911169111791118911199112091121911229112391124911259112691127911289112991130911319113291133911349113591136911379113891139911409114191142911439114491145911469114791148911499115091151911529115391154911559115691157911589115991160911619116291163911649116591166911679116891169911709117191172911739117491175911769117791178911799118091181911829118391184911859118691187911889118991190911919119291193911949119591196911979119891199912009120191202912039120491205912069120791208912099121091211912129121391214912159121691217912189121991220912219122291223912249122591226912279122891229912309123191232912339123491235912369123791238912399124091241912429124391244912459124691247912489124991250912519125291253912549125591256912579125891259912609126191262912639126491265912669126791268912699127091271912729127391274912759127691277912789127991280912819128291283912849128591286912879128891289912909129191292912939129491295912969129791298912999130091301913029130391304913059130691307913089130991310913119131291313913149131591316913179131891319913209132191322913239132491325913269132791328913299133091331913329133391334913359133691337913389133991340913419134291343913449134591346913479134891349913509135191352913539135491355913569135791358913599136091361913629136391364913659136691367913689136991370913719137291373913749137591376913779137891379913809138191382913839138491385913869138791388913899139091391913929139391394913959139691397913989139991400914019140291403914049140591406914079140891409914109141191412914139141491415914169141791418914199142091421914229142391424914259142691427914289142991430914319143291433914349143591436914379143891439914409144191442914439144491445914469144791448914499145091451914529145391454914559145691457914589145991460914619146291463914649146591466914679146891469914709147191472914739147491475914769147791478914799148091481914829148391484914859148691487914889148991490914919149291493914949149591496914979149891499915009150191502915039150491505915069150791508915099151091511915129151391514915159151691517915189151991520915219152291523915249152591526915279152891529915309153191532915339153491535915369153791538915399154091541915429154391544915459154691547915489154991550915519155291553915549155591556915579155891559915609156191562915639156491565915669156791568915699157091571915729157391574915759157691577915789157991580915819158291583915849158591586915879158891589915909159191592915939159491595915969159791598915999160091601916029160391604916059160691607916089160991610916119161291613916149161591616916179161891619916209162191622916239162491625916269162791628916299163091631916329163391634916359163691637916389163991640916419164291643916449164591646916479164891649916509165191652916539165491655916569165791658916599166091661916629166391664916659166691667916689166991670916719167291673916749167591676916779167891679916809168191682916839168491685916869168791688916899169091691916929169391694916959169691697916989169991700917019170291703917049170591706917079170891709917109171191712917139171491715917169171791718917199172091721917229172391724917259172691727917289172991730917319173291733917349173591736917379173891739917409174191742917439174491745917469174791748917499175091751917529175391754917559175691757917589175991760917619176291763917649176591766917679176891769917709177191772917739177491775917769177791778917799178091781917829178391784917859178691787917889178991790917919179291793917949179591796917979179891799918009180191802918039180491805918069180791808918099181091811918129181391814918159181691817918189181991820918219182291823918249182591826918279182891829918309183191832918339183491835918369183791838918399184091841918429184391844918459184691847918489184991850918519185291853918549185591856918579185891859918609186191862918639186491865918669186791868918699187091871918729187391874918759187691877918789187991880918819188291883918849188591886918879188891889918909189191892918939189491895918969189791898918999190091901919029190391904919059190691907919089190991910919119191291913919149191591916919179191891919919209192191922919239192491925919269192791928919299193091931919329193391934919359193691937919389193991940919419194291943919449194591946919479194891949919509195191952919539195491955919569195791958919599196091961919629196391964919659196691967919689196991970919719197291973919749197591976919779197891979919809198191982919839198491985919869198791988919899199091991919929199391994919959199691997919989199992000920019200292003920049200592006920079200892009920109201192012920139201492015920169201792018920199202092021920229202392024920259202692027920289202992030920319203292033920349203592036920379203892039920409204192042920439204492045920469204792048920499205092051920529205392054920559205692057920589205992060920619206292063920649206592066920679206892069920709207192072920739207492075920769207792078920799208092081920829208392084920859208692087920889208992090920919209292093920949209592096920979209892099921009210192102921039210492105921069210792108921099211092111921129211392114921159211692117921189211992120921219212292123921249212592126921279212892129921309213192132921339213492135921369213792138921399214092141921429214392144921459214692147921489214992150921519215292153921549215592156921579215892159921609216192162921639216492165921669216792168921699217092171921729217392174921759217692177921789217992180921819218292183921849218592186921879218892189921909219192192921939219492195921969219792198921999220092201922029220392204922059220692207922089220992210922119221292213922149221592216922179221892219922209222192222922239222492225922269222792228922299223092231922329223392234922359223692237922389223992240922419224292243922449224592246922479224892249922509225192252922539225492255922569225792258922599226092261922629226392264922659226692267922689226992270922719227292273922749227592276922779227892279922809228192282922839228492285922869228792288922899229092291922929229392294922959229692297922989229992300923019230292303923049230592306923079230892309923109231192312923139231492315923169231792318923199232092321923229232392324923259232692327923289232992330923319233292333923349233592336923379233892339923409234192342923439234492345923469234792348923499235092351923529235392354923559235692357923589235992360923619236292363923649236592366923679236892369923709237192372923739237492375923769237792378923799238092381923829238392384923859238692387923889238992390923919239292393923949239592396923979239892399924009240192402924039240492405924069240792408924099241092411924129241392414924159241692417924189241992420924219242292423924249242592426924279242892429924309243192432924339243492435924369243792438924399244092441924429244392444924459244692447924489244992450924519245292453924549245592456924579245892459924609246192462924639246492465924669246792468924699247092471924729247392474924759247692477924789247992480924819248292483924849248592486924879248892489924909249192492924939249492495924969249792498924999250092501925029250392504925059250692507925089250992510925119251292513925149251592516925179251892519925209252192522925239252492525925269252792528925299253092531925329253392534925359253692537925389253992540925419254292543925449254592546925479254892549925509255192552925539255492555925569255792558925599256092561925629256392564925659256692567925689256992570925719257292573925749257592576925779257892579925809258192582925839258492585925869258792588925899259092591925929259392594925959259692597925989259992600926019260292603926049260592606926079260892609926109261192612926139261492615926169261792618926199262092621926229262392624926259262692627926289262992630926319263292633926349263592636926379263892639926409264192642926439264492645926469264792648926499265092651926529265392654926559265692657926589265992660926619266292663926649266592666926679266892669926709267192672926739267492675926769267792678926799268092681926829268392684926859268692687926889268992690926919269292693926949269592696926979269892699927009270192702927039270492705927069270792708927099271092711927129271392714927159271692717927189271992720927219272292723927249272592726927279272892729927309273192732927339273492735927369273792738927399274092741927429274392744927459274692747927489274992750927519275292753927549275592756927579275892759927609276192762927639276492765927669276792768927699277092771927729277392774927759277692777927789277992780927819278292783927849278592786927879278892789927909279192792927939279492795927969279792798927999280092801928029280392804928059280692807928089280992810928119281292813928149281592816928179281892819928209282192822928239282492825928269282792828928299283092831928329283392834928359283692837928389283992840928419284292843928449284592846928479284892849928509285192852928539285492855928569285792858928599286092861928629286392864928659286692867928689286992870928719287292873928749287592876928779287892879928809288192882928839288492885928869288792888928899289092891928929289392894928959289692897928989289992900929019290292903929049290592906929079290892909929109291192912929139291492915929169291792918929199292092921929229292392924929259292692927929289292992930929319293292933929349293592936929379293892939929409294192942929439294492945929469294792948929499295092951929529295392954929559295692957929589295992960929619296292963929649296592966929679296892969929709297192972929739297492975929769297792978929799298092981929829298392984929859298692987929889298992990929919299292993929949299592996929979299892999930009300193002930039300493005930069300793008930099301093011930129301393014930159301693017930189301993020930219302293023930249302593026930279302893029930309303193032930339303493035930369303793038930399304093041930429304393044930459304693047930489304993050930519305293053930549305593056930579305893059930609306193062930639306493065930669306793068930699307093071930729307393074930759307693077930789307993080930819308293083930849308593086930879308893089930909309193092930939309493095930969309793098930999310093101931029310393104931059310693107931089310993110931119311293113931149311593116931179311893119931209312193122931239312493125931269312793128931299313093131931329313393134931359313693137931389313993140931419314293143931449314593146931479314893149931509315193152931539315493155931569315793158931599316093161931629316393164931659316693167931689316993170931719317293173931749317593176931779317893179931809318193182931839318493185931869318793188931899319093191931929319393194931959319693197931989319993200932019320293203932049320593206932079320893209932109321193212932139321493215932169321793218932199322093221932229322393224932259322693227932289322993230932319323293233932349323593236932379323893239932409324193242932439324493245932469324793248932499325093251932529325393254932559325693257932589325993260932619326293263932649326593266932679326893269932709327193272932739327493275932769327793278932799328093281932829328393284932859328693287932889328993290932919329293293932949329593296932979329893299933009330193302933039330493305933069330793308933099331093311933129331393314933159331693317933189331993320933219332293323933249332593326933279332893329933309333193332933339333493335933369333793338933399334093341933429334393344933459334693347933489334993350933519335293353933549335593356933579335893359933609336193362933639336493365933669336793368933699337093371933729337393374933759337693377933789337993380933819338293383933849338593386933879338893389933909339193392933939339493395933969339793398933999340093401934029340393404934059340693407934089340993410934119341293413934149341593416934179341893419934209342193422934239342493425934269342793428934299343093431934329343393434934359343693437934389343993440934419344293443934449344593446934479344893449
  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. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. -–��ú������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.php½i��WÚ'_½i��Æ6ä������+���src/Composer/Autoload/ClassMapGenerator.phpõ��WÚ'_õ��Ó–ä5¤���������src/Composer/Cache.phpç��WÚ'_ç��[27¤������%���src/Composer/Command/AboutCommand.phpØ��WÚ'_Ø��ö÷;‡¤������'���src/Composer/Command/ArchiveCommand.phpä��WÚ'_ä��Õ­¤������$���src/Composer/Command/BaseCommand.phpÜ ��WÚ'_Ü ��gô1¤������.���src/Composer/Command/BaseDependencyCommand.phpg��WÚ'_g��öNp¤������1���src/Composer/Command/CheckPlatformReqsCommand.php��WÚ'_���„Ǥ������*���src/Composer/Command/ClearCacheCommand.php½��WÚ'_½��°I¤������&���src/Composer/Command/ConfigCommand.phpÎQ��WÚ'_ÎQ��xþÎ ¤������-���src/Composer/Command/CreateProjectCommand.phpq;��WÚ'_q;��¾ô¹‡¤������'���src/Composer/Command/DependsCommand.phpø��WÚ'_ø��ªeá¤������(���src/Composer/Command/DiagnoseCommand.php%P��WÚ'_%P��"vé…¤������,���src/Composer/Command/DumpAutoloadCommand.phpã ��WÚ'_ã ��© ]†¤������$���src/Composer/Command/ExecCommand.php ��WÚ'_ ��X?!“¤������$���src/Composer/Command/FundCommand.php,
  25. ��WÚ'_,
  26. ��9¤������&���src/Composer/Command/GlobalCommand.phpz ��WÚ'_z ��³çå?¤������$���src/Composer/Command/HomeCommand.php��WÚ'_��qLBŽ¤������$���src/Composer/Command/InitCommand.phpçU��WÚ'_çU��dßG�¤������'���src/Composer/Command/InstallCommand.phpT��WÚ'_T��Þùõ›¤������(���src/Composer/Command/LicensesCommand.phpò��WÚ'_ò��´È¤������(���src/Composer/Command/OutdatedCommand.php ��WÚ'_ ��اc¤������)���src/Composer/Command/ProhibitsCommand.php��WÚ'_��_¤éS¤������&���src/Composer/Command/RemoveCommand.phpá��WÚ'_á��Å1÷&¤������'���src/Composer/Command/RequireCommand.php¯)��WÚ'_¯)��^ %¤������)���src/Composer/Command/RunScriptCommand.php³��WÚ'_³��·ü¤������+���src/Composer/Command/ScriptAliasCommand.php¯��WÚ'_¯��?=Ѥ������&���src/Composer/Command/SearchCommand.phpU ��WÚ'_U ��…ߤ������*���src/Composer/Command/SelfUpdateCommand.php™C��WÚ'_™C��rk5¤������$���src/Composer/Command/ShowCommand.phpƒ‚��WÚ'_ƒ‚��O‘� ¤������&���src/Composer/Command/StatusCommand.phpP��WÚ'_P��:±çú¤������(���src/Composer/Command/SuggestsCommand.php��WÚ'_��ò‚Bɤ������&���src/Composer/Command/UpdateCommand.phpë#��WÚ'_ë#��3<&�¤������(���src/Composer/Command/ValidateCommand.phpk��WÚ'_k��y‚8K¤���������src/Composer/Composer.php ��WÚ'_ ��ÃCH®¤���������src/Composer/Config.php×$��WÚ'_×$��ÝܾS¤������-���src/Composer/Config/ConfigSourceInterface.php��WÚ'_��³ [/¤������(���src/Composer/Config/JsonConfigSource.php¹��WÚ'_¹��”\©-¤������$���src/Composer/Console/Application.phpe8��WÚ'_e8�� X‚¤������,���src/Composer/Console/HtmlOutputFormatter.php3��WÚ'_3��Ú�Eu¤������-���src/Composer/DependencyResolver/Decisions.php6��WÚ'_6��à• ž¤������1���src/Composer/DependencyResolver/DefaultPolicy.php��WÚ'_��˜ë>#¤������/���src/Composer/DependencyResolver/GenericRule.phpµ��WÚ'_µ��᫤¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��WÚ'_C��´\õ*¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��WÚ'_÷��ïÎà÷¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��WÚ'_ý��3#†¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���WÚ'_Ó���Ùâ&ä¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��WÚ'_¹��&¢e
  27. ¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��WÚ'_I��FûÂɤ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.php'��WÚ'_'��Qúɯ¤������3���src/Composer/DependencyResolver/PolicyInterface.php­��WÚ'_­��Ÿ‹R¤������(���src/Composer/DependencyResolver/Pool.php#��WÚ'_#��ÿ…C�¤������+���src/Composer/DependencyResolver/Problem.phpú��WÚ'_ú��]D5¤������+���src/Composer/DependencyResolver/Request.phpƒ��WÚ'_ƒ��åVP„¤������(���src/Composer/DependencyResolver/Rule.php?��WÚ'_?��¬‘œü¤������1���src/Composer/DependencyResolver/Rule2Literals.php��WÚ'_��tZÅɤ������+���src/Composer/DependencyResolver/RuleSet.phpª
  28. ��WÚ'_ª
  29. ��_΂¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php‹��WÚ'_‹��‡ �¤������3���src/Composer/DependencyResolver/RuleSetIterator.php��WÚ'_��›Cü$¤������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��WÚ'_i��hïš,¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��WÚ'_á��‰rôv¤������1���src/Composer/DependencyResolver/RuleWatchNode.php��WÚ'_���Gd7¤������*���src/Composer/DependencyResolver/Solver.phpf:��WÚ'_f:��Nø1´¤������6���src/Composer/DependencyResolver/SolverBugException.php™��WÚ'_™��Xg6¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��WÚ'_ô��×|Ŧ¤������/���src/Composer/DependencyResolver/Transaction.php×��WÚ'_×��Vm쟤������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��WÚ'_Æ ��G s0¤������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���WÚ'_Ì���¯à¨¿¤������+���src/Composer/Downloader/DownloadManager.php`��WÚ'_`��#ÏX¤������/���src/Composer/Downloader/DownloaderInterface.phpÊ��WÚ'_Ê��gs!l¤������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���WÚ'_Ñ���&Áœ¿¤������*���src/Composer/Downloader/FileDownloader.phpG��WÚ'_G��äOФ������/���src/Composer/Downloader/FilesystemException.php
  30. ��WÚ'_
  31. ��.-‹¤������,���src/Composer/Downloader/FossilDownloader.php‚ ��WÚ'_‚ ��Ü�Ii¤������)���src/Composer/Downloader/GitDownloader.phpû6��WÚ'_û6��Ëv0K¤������*���src/Composer/Downloader/GzipDownloader.phpó��WÚ'_ó��}Úo¤������(���src/Composer/Downloader/HgDownloader.php”��WÚ'_”��ßis̤������*���src/Composer/Downloader/PathDownloader.phpT��WÚ'_T��®–¤������0���src/Composer/Downloader/PearPackageExtractor.phpu��WÚ'_u��z„‡¤������.���src/Composer/Downloader/PerforceDownloader.phpž��WÚ'_ž��Öüñ9¤������*���src/Composer/Downloader/PharDownloader.phpå���WÚ'_å���ÞÉç¤������)���src/Composer/Downloader/RarDownloader.phpž��WÚ'_ž��6 3U¤������)���src/Composer/Downloader/SvnDownloader.phpM��WÚ'_M�� !`¤������)���src/Composer/Downloader/TarDownloader.phpã���WÚ'_ã���Í’X?¤������.���src/Composer/Downloader/TransportException.php=��WÚ'_=��ZÎÈÞ¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���WÚ'_Ô���`§ôö¤������)���src/Composer/Downloader/VcsDownloader.php¡��WÚ'_¡��( à>¤������(���src/Composer/Downloader/XzDownloader.php§��WÚ'_§��W$;á¤������)���src/Composer/Downloader/ZipDownloader.php���WÚ'_���®Û#s¤������&���src/Composer/EventDispatcher/Event.php ��WÚ'_ ��±™jï¤������0���src/Composer/EventDispatcher/EventDispatcher.php�7��WÚ'_�7��—Øa¡¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���WÚ'_©���h·0¤������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���WÚ'_v���wZ8S¤������)���src/Composer/Exception/NoSslException.phpf���WÚ'_f���ËíM�¤���������src/Composer/Factory.php_=��WÚ'__=��x"Ť���������src/Composer/IO/BaseIO.php•��WÚ'_•��ìÏA¤���������src/Composer/IO/BufferIO.php¾��WÚ'_¾��X~d¤���������src/Composer/IO/ConsoleIO.php��WÚ'_��üw·¤���������src/Composer/IO/IOInterface.phpì��WÚ'_ì���Õ�¤���������src/Composer/IO/NullIO.phpÀ��WÚ'_À��F`sʤ���������src/Composer/Installer.php¦£��WÚ'_¦£��8Òд¤������*���src/Composer/Installer/BinaryInstaller.php
  32. ��WÚ'_
  33. ��t¤{ø¤������2���src/Composer/Installer/BinaryPresenceInterface.phpË���WÚ'_Ë���À5š¨¤������.���src/Composer/Installer/InstallationManager.php-��WÚ'_-��¾}Œ7¤������)���src/Composer/Installer/InstallerEvent.php��WÚ'_��lÔzi¤������*���src/Composer/Installer/InstallerEvents.phpÞ���WÚ'_Þ���ìŸ@G¤������-���src/Composer/Installer/InstallerInterface.phpã��WÚ'_ã��^ƒ“ʤ������+���src/Composer/Installer/LibraryInstaller.php%��WÚ'_%�� »�̤������/���src/Composer/Installer/MetapackageInstaller.phpÊ��WÚ'_Ê��Ùti·¤������(���src/Composer/Installer/NoopInstaller.php+��WÚ'_+��À·M}¤������'���src/Composer/Installer/PackageEvent.phpe��WÚ'_e��;° ¤������(���src/Composer/Installer/PackageEvents.php¸��WÚ'_¸��dbØs¤������.���src/Composer/Installer/PearBinaryInstaller.phpø ��WÚ'_ø ��*ë•k¤������(���src/Composer/Installer/PearInstaller.php¢��WÚ'_¢��È‚¶Ñ¤������*���src/Composer/Installer/PluginInstaller.php¢��WÚ'_¢��L´a:¤������+���src/Composer/Installer/ProjectInstaller.php��WÚ'_��*0@P¤������4���src/Composer/Installer/SuggestedPackagesReporter.php:��WÚ'_:��‚´UV¤���������src/Composer/Json/JsonFile.phpL��WÚ'_L��rs¤������#���src/Composer/Json/JsonFormatter.phpb��WÚ'_b��ÝNš¤������%���src/Composer/Json/JsonManipulator.php“4��WÚ'_“4��Í®š¤������-���src/Composer/Json/JsonValidationException.php\��WÚ'_\��.Xóܤ������%���src/Composer/Package/AliasPackage.phpî��WÚ'_î��-�×&¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��WÚ'_ ��yY+¦¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��WÚ'_Þ�� ²²¹¤������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��WÚ'_Ý ��í<´B¤������3���src/Composer/Package/Archiver/ArchiverInterface.php��WÚ'_��ñ´> ¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��WÚ'_–��y¶=Ƥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��WÚ'_��‹SZ0¤������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��WÚ'_r��3‘Mh¤������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��WÚ'_ �� •¦S¤������.���src/Composer/Package/Archiver/PharArchiver.php?��WÚ'_?��®— u¤������-���src/Composer/Package/Archiver/ZipArchiver.phpX��WÚ'_X��¤k�~¤������$���src/Composer/Package/BasePackage.php ��WÚ'_ ��Î&|'¤������*���src/Composer/Package/Comparer/Comparer.phpR��WÚ'_R��Ïسî¤������(���src/Composer/Package/CompletePackage.php¦��WÚ'_¦��p[Ö¤������1���src/Composer/Package/CompletePackageInterface.php��WÚ'_��Ϋ>¤������+���src/Composer/Package/Dumper/ArrayDumper.phpb ��WÚ'_b ��s•°›¤���������src/Composer/Package/Link.phpˆ��WÚ'_ˆ��å¶Y«¤������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��WÚ'_‚��é~‹¤������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��WÚ'_d��¤ôLn¤������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��WÚ'_‚��ób`ý¤������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��WÚ'_i��Þ”š%¤������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��WÚ'_X��}`y¤������+���src/Composer/Package/Loader/ArrayLoader.php½��WÚ'_½��c
  34. @�¤������7���src/Composer/Package/Loader/InvalidPackageException.phpE��WÚ'_E��xb¾¤������*���src/Composer/Package/Loader/JsonLoader.phpù��WÚ'_ù��!~ˆ{¤������/���src/Composer/Package/Loader/LoaderInterface.php²���WÚ'_²���¦}úΤ������1���src/Composer/Package/Loader/RootPackageLoader.phpë��WÚ'_ë��ÛŠ ›¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.php.B��WÚ'_.B��åpHD¤���������src/Composer/Package/Locker.php="��WÚ'_="��GµF+¤������ ���src/Composer/Package/Package.phpÉ��WÚ'_É��cÃ�h¤������)���src/Composer/Package/PackageInterface.php\��WÚ'_\��xåp¨¤������)���src/Composer/Package/RootAliasPackage.php ��WÚ'_ �� _€ø¤������$���src/Composer/Package/RootPackage.php��WÚ'_��ŽÎ_¤������-���src/Composer/Package/RootPackageInterface.php¹��WÚ'_¹��"maV¤������/���src/Composer/Package/Version/VersionGuesser.php"��WÚ'_"��XTõK¤������.���src/Composer/Package/Version/VersionParser.php¥��WÚ'_¥��ô´à¤������0���src/Composer/Package/Version/VersionSelector.php¨��WÚ'_¨��ý5½,¤������-���src/Composer/Plugin/Capability/Capability.phpW���WÚ'_W���æ_¨1¤������2���src/Composer/Plugin/Capability/CommandProvider.php—���WÚ'_—���ûOâ>¤���������src/Composer/Plugin/Capable.php���WÚ'_���Æq+¤������$���src/Composer/Plugin/CommandEvent.phpâ��WÚ'_â��³ÆÇW¤������$���src/Composer/Plugin/PluginEvents.phpö���WÚ'_ö���á1=z¤������'���src/Composer/Plugin/PluginInterface.phpô���WÚ'_ô���)'*ؤ������%���src/Composer/Plugin/PluginManager.phpª$��WÚ'_ª$��m‰ƒä¤������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��WÚ'_õ��:ðd¤������,���src/Composer/Plugin/PreFileDownloadEvent.php`��WÚ'_`���9-Τ������4���src/Composer/Question/StrictConfirmationQuestion.php��WÚ'_��'.³è¤������+���src/Composer/Repository/ArrayRepository.php¬��WÚ'_¬��cð?¤������.���src/Composer/Repository/ArtifactRepository.phpí��WÚ'_í��q9OS¤������*���src/Composer/Repository/BaseRepository.phpŠ��WÚ'_Š��äÝ÷¤������.���src/Composer/Repository/ComposerRepository.php0U��WÚ'_0U��Ã7L†¤������/���src/Composer/Repository/CompositeRepository.php;��WÚ'_;��¤¯S¤������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���WÚ'_…���±Ÿ_¤������0���src/Composer/Repository/FilesystemRepository.phpp��WÚ'_p��#ù¤������4���src/Composer/Repository/InstalledArrayRepository.php£���WÚ'_£���/ö~>¤������9���src/Composer/Repository/InstalledFilesystemRepository.php£���WÚ'_£���V
  35. •_¤������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���WÚ'_‡���£9p¤������6���src/Composer/Repository/InvalidRepositoryException.phpn���WÚ'_n���à“똤������-���src/Composer/Repository/PackageRepository.phpj��WÚ'_j��¥ôò̤������*���src/Composer/Repository/PathRepository.phpé��WÚ'_é��J!šˆ¤������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��WÚ'_I��c6³¤������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��WÚ'_Ä��:T*ɤ������.���src/Composer/Repository/Pear/ChannelReader.phpí��WÚ'_í��?ÈYT¤������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��WÚ'_® ��™ÖÛú¤������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��WÚ'_& ��òUb¤������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��WÚ'_q��9=¤������/���src/Composer/Repository/Pear/DependencyInfo.phpq��WÚ'_q��fºTò¤������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��WÚ'_…��÷$Li¤������,���src/Composer/Repository/Pear/PackageInfo.php°��WÚ'_°��Ÿ ¸ ¤������,���src/Composer/Repository/Pear/ReleaseInfo.php’��WÚ'_’��o“ŠÃ¤������*���src/Composer/Repository/PearRepository.phpª��WÚ'_ª��)Ÿƒ}¤������.���src/Composer/Repository/PlatformRepository.php;!��WÚ'_;!��äö9¤������-���src/Composer/Repository/RepositoryFactory.phpb��WÚ'_b��’{²ý¤������/���src/Composer/Repository/RepositoryInterface.phpÛ��WÚ'_Û��’âÁ¤������-���src/Composer/Repository/RepositoryManager.phpM ��WÚ'_M ��<(;Œ¤������7���src/Composer/Repository/RepositorySecurityException.phpo���WÚ'_o���pÕ«ª¤������/���src/Composer/Repository/Vcs/BitbucketDriver.php‚ ��WÚ'_‚ ��n¢v>¤������,���src/Composer/Repository/Vcs/FossilDriver.php³��WÚ'_³��ÐCk¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpë��WÚ'_ë��œ´½X¤������)���src/Composer/Repository/Vcs/GitDriver.php:��WÚ'_:��ÀÕ.p¤������,���src/Composer/Repository/Vcs/GitHubDriver.php�4��WÚ'_�4��ê,ˆä¤������,���src/Composer/Repository/Vcs/GitLabDriver.phpŽ*��WÚ'_Ž*��½¹²Ð¤������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpå��WÚ'_å��@)‰L¤������(���src/Composer/Repository/Vcs/HgDriver.phpB��WÚ'_B��»ƒî¤������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��WÚ'_ù ��&½tÙ¤������)���src/Composer/Repository/Vcs/SvnDriver.php¤��WÚ'_¤�� ¤������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��WÚ'_æ
  37. ��eׯ-¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��WÚ'_÷��ÇX[‰¤������)���src/Composer/Repository/VcsRepository.php˜-��WÚ'_˜-��ø2²¤������1���src/Composer/Repository/VersionCacheInterface.php”���WÚ'_”���A?Rï¤������3���src/Composer/Repository/WritableArrayRepository.php��WÚ'_��¾G*¤������7���src/Composer/Repository/WritableRepositoryInterface.php‰��WÚ'_‰��‘/sï¤������$���src/Composer/Script/CommandEvent.phpW���WÚ'_W���£VZt¤���������src/Composer/Script/Event.phpº��WÚ'_º��ò�»¤¤������$���src/Composer/Script/PackageEvent.phpœ���WÚ'_œ���§ÿÉ ¤������$���src/Composer/Script/ScriptEvents.phpP��WÚ'_P��‡�¶¤������ ���src/Composer/SelfUpdate/Keys.php���WÚ'_��� îÊN¤������$���src/Composer/SelfUpdate/Versions.phpH��WÚ'_H��c lB¤������ ���src/Composer/Util/AuthHelper.phpË��WÚ'_Ë��>zx–¤���������src/Composer/Util/Bitbucket.php*��WÚ'_*��,Lšk¤������$���src/Composer/Util/ComposerMirror.php±��WÚ'_±��­½øؤ������%���src/Composer/Util/ConfigValidator.php÷��WÚ'_÷��v•Í¤������"���src/Composer/Util/ErrorHandler.php»��WÚ'_»��O›rk¤������ ���src/Composer/Util/Filesystem.phpm/��WÚ'_m/��Çë¡ú¤���������src/Composer/Util/Git.phpä0��WÚ'_ä0��'‰ïç¤���������src/Composer/Util/GitHub.php| ��WÚ'_| ��`0tü¤���������src/Composer/Util/GitLab.phpù��WÚ'_ù��ž7«£¤���������src/Composer/Util/Hg.php¾��WÚ'_¾��LÓ �¤���������src/Composer/Util/IniHelper.phph��WÚ'_h��;FP¤������$���src/Composer/Util/NoProxyPattern.php|��WÚ'_|��¸|ää¤������#���src/Composer/Util/PackageSorter.phpÞ��WÚ'_Þ��ê×ìY¤���������src/Composer/Util/Perforce.php¸2��WÚ'_¸2��Ás&}¤���������src/Composer/Util/Platform.phpü��WÚ'_ü��s­fç¤������%���src/Composer/Util/ProcessExecutor.php$ ��WÚ'_$ ��¨Nó¤������&���src/Composer/Util/RemoteFilesystem.phpFr��WÚ'_Fr��¡Ò¤���������src/Composer/Util/Silencer.phpé��WÚ'_é��“Vjf¤������!���src/Composer/Util/SpdxLicense.php��WÚ'_��¾7
  38. ñ¤������*���src/Composer/Util/StreamContextFactory.php��WÚ'_��CÉ…ù¤���������src/Composer/Util/Svn.php,��WÚ'_,��Ì žÄ¤���������src/Composer/Util/TlsHelper.phpL
  39. ��WÚ'_L
  40. ��" i¤���������src/Composer/Util/Url.php£��WÚ'_£��3œÉܤ���������src/Composer/Util/Zip.php³��WÚ'_³��äŠÎª¤���������src/Composer/XdebugHandler.phpð��WÚ'_ð��zÓf~¤���������src/bootstrap.php¹��WÚ'_¹��I}œ¤������%���src/Composer/Autoload/ClassLoader.php“4��WÚ'_“4��²z�–¤������#���res/composer-repository-schema.jsonð��WÚ'_ð���GÐà¤���������res/composer-schema.jsonM���WÚ'_M���_Τ������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json¸ ��WÚ'_¸ ��Â4DC¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsoná£��WÚ'_á£��Ú¼Ó¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��WÚ'_�$��•�¥v¤������&���vendor/symfony/console/Application.php=X��WÚ'_=X��� S’¤������*���vendor/symfony/console/Command/Command.phpî"��WÚ'_î"��x°jÕ¤������.���vendor/symfony/console/Command/HelpCommand.phpØ��WÚ'_Ø��¦Ú-:¤������.���vendor/symfony/console/Command/ListCommand.phpZ��WÚ'_Z��»w`¤������(���vendor/symfony/console/ConsoleEvents.phpé���WÚ'_é���RÛÔe¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��WÚ'_Ð��™Ž5°¤������0���vendor/symfony/console/Descriptor/Descriptor.php���WÚ'_���¿N•¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���WÚ'_ü���±Qµ¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��WÚ'_Ü ��*û�ɤ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��WÚ'_¶��·Ô;ݤ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��WÚ'_¼��òç$¤������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��WÚ'_��b{<¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��WÚ'_°��!�Ȥ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��WÚ'_Å��ÒxÛ\¤������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��WÚ'_��á2é¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��WÚ'_z��³,îL¤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��WÚ'_Ô��È÷ L¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���WÚ'_f���¡ABª¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���WÚ'_¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���WÚ'_¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���WÚ'_’���ÍO\e¤������5���vendor/symfony/console/Exception/RuntimeException.php–���WÚ'_–���Ùí,6¤������4���vendor/symfony/console/Formatter/OutputFormatter.php6��WÚ'_6��?=¨¤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��WÚ'_Œ��òññÀ¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��WÚ'_F��𦴤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��WÚ'_„��÷½G¤������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��WÚ'_@��G¨ýU¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��WÚ'_y��Ì8ÆФ������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��WÚ'_w��|¦C¤������.���vendor/symfony/console/Helper/DialogHelper.php��WÚ'_��¹ÜÃ_¤������1���vendor/symfony/console/Helper/FormatterHelper.phpd��WÚ'_d��§×,¸¤������(���vendor/symfony/console/Helper/Helper.php«��WÚ'_«��!�§—¤������1���vendor/symfony/console/Helper/HelperInterface.phpå���WÚ'_å���Š ¤������+���vendor/symfony/console/Helper/HelperSet.phpÊ��WÚ'_Ê��áÏW"¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��WÚ'_c��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��WÚ'_Ó ��©w‚R¤������-���vendor/symfony/console/Helper/ProgressBar.phpl%��WÚ'_l%�� díÛ¤������0���vendor/symfony/console/Helper/ProgressHelper.php]��WÚ'_]��ù»‰X¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��WÚ'_N��ÿ§³l¤������0���vendor/symfony/console/Helper/QuestionHelper.phpl��WÚ'_l��Ntó¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  41. ��WÚ'_–
  42. ��- ؤ������'���vendor/symfony/console/Helper/Table.phpÄ*��WÚ'_Ä*��¾™ØT¤������+���vendor/symfony/console/Helper/TableCell.php���WÚ'_���åV^¤������-���vendor/symfony/console/Helper/TableHelper.php ��WÚ'_ ��›uô™¤������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���WÚ'_Ê���az¤������,���vendor/symfony/console/Helper/TableStyle.php
  43. ��WÚ'_
  44. ��_ÍI"¤������*���vendor/symfony/console/Input/ArgvInput.php��WÚ'_��×ö†›¤������+���vendor/symfony/console/Input/ArrayInput.php) ��WÚ'_) ��¥ÑC¤������&���vendor/symfony/console/Input/Input.php£ ��WÚ'_£ ��f¡?¤������.���vendor/symfony/console/Input/InputArgument.php��WÚ'_��D £¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���WÚ'_˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php†��WÚ'_†��¤U)¤¤������/���vendor/symfony/console/Input/InputInterface.php£��WÚ'_£��ÆBŒ'¤������,���vendor/symfony/console/Input/InputOption.php ��WÚ'_ ��\¢Ü=¤������,���vendor/symfony/console/Input/StringInput.phpš��WÚ'_š��žµ è¤���������vendor/symfony/console/LICENSE)��WÚ'_)��NUN½¤������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��WÚ'_0 ��…� ¸¤������0���vendor/symfony/console/Output/BufferedOutput.php_��WÚ'__��‹ >P¤������/���vendor/symfony/console/Output/ConsoleOutput.php±��WÚ'_±��nì!f¤������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���WÚ'_à���‡†Æʤ������,���vendor/symfony/console/Output/NullOutput.phpÏ��WÚ'_Ï��®˜‹Z¤������(���vendor/symfony/console/Output/Output.php˜ ��WÚ'_˜ ��0p¤������1���vendor/symfony/console/Output/OutputInterface.php��WÚ'_���ì&¤������.���vendor/symfony/console/Output/StreamOutput.php���WÚ'_���Ä’Oç¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  45. ��WÚ'_x
  46. ��W€!¤������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��WÚ'_è��/Ô�¤������,���vendor/symfony/console/Question/Question.phpÎ ��WÚ'_Î ��lF¤������ ���vendor/symfony/console/Shell.phpæ��WÚ'_æ��¼XÒA¤������,���vendor/symfony/console/Style/OutputStyle.php\��WÚ'_\��wפ¤������/���vendor/symfony/console/Style/StyleInterface.phpÏ��WÚ'_Ï��&nÅѤ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��WÚ'_ä��­å (¤������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��WÚ'_Ï��sž9i¤������/���vendor/symfony/console/Tester/CommandTester.phpª��WÚ'_ª��¬K z¤������(���vendor/symfony/debug/BufferingLogger.phpt��WÚ'_t��=�hܤ���������vendor/symfony/debug/Debug.php,��WÚ'_,��Ë~Ž.¤������)���vendor/symfony/debug/DebugClassLoader.phpµ��WÚ'_µ��1rEÓ¤������%���vendor/symfony/debug/ErrorHandler.phpH��WÚ'_H��¹:D#¤������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��WÚ'_–��i‰æô¤������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��WÚ'_˜��-
  47. d2¤������1���vendor/symfony/debug/Exception/DummyException.php��WÚ'_��®+Ãê¤������6���vendor/symfony/debug/Exception/FatalErrorException.php��WÚ'_��™Ä¤������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��WÚ'_W��?àèK¤������3���vendor/symfony/debug/Exception/FlattenException.php¼��WÚ'_¼�� פ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���WÚ'_~���ë¨oâ¤������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��WÚ'_š���ñJÀ¤������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��WÚ'_˜��nöêؤ������)���vendor/symfony/debug/ExceptionHandler.php)3��WÚ'_)3���h5=¤������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��WÚ'_A��Ϥ¹l¤������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��WÚ'_��ĹBV¤������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��WÚ'_x��~ò"¤������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��WÚ'_O���ž¦*¤���������vendor/symfony/debug/LICENSE)��WÚ'_)��NUN½¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���WÚ'_i���$ ÿ›¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��WÚ'_¼��pí\¶¤������3���vendor/symfony/filesystem/Exception/IOException.php‡��WÚ'_‡��€ü#Ѥ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���WÚ'_¦���jÙwM¤������(���vendor/symfony/filesystem/Filesystem.phpc4��WÚ'_c4��‹×@þ¤������!���vendor/symfony/filesystem/LICENSE)��WÚ'_)��NUN½¤������)���vendor/symfony/filesystem/LockHandler.phpö��WÚ'_ö��ŸZµ1¤������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��WÚ'_\ ��hˆB¤������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���WÚ'_���HC€/¤������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��WÚ'_›��Mþ¤������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��WÚ'_3��75$·¤������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��WÚ'_��Ÿ`]¤������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��WÚ'_ô��Þdè;¤������/���vendor/symfony/finder/Comparator/Comparator.php���WÚ'_���¾üœµ¤������3���vendor/symfony/finder/Comparator/DateComparator.php#��WÚ'_#��°Τ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��WÚ'_|��ITÇͤ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���WÚ'_„���½¾sœ¤������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��WÚ'_¬��wR¤������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���WÚ'_„���Gz-¤������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��WÚ'_)��x§e¤������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��WÚ'_º��˜þ˜¤������/���vendor/symfony/finder/Expression/Expression.php��WÚ'_��i¥:Ť������)���vendor/symfony/finder/Expression/Glob.phpf��WÚ'_f��DÞcj¤������*���vendor/symfony/finder/Expression/Regex.php��WÚ'_��ü(ÃϤ������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��WÚ'_Í��\p4†¤������ ���vendor/symfony/finder/Finder.phpc.��WÚ'_c.��:ˆ5g¤���������vendor/symfony/finder/Glob.phpL��WÚ'_L��jÍ9פ������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��WÚ'_]��ÎoÅƤ������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��WÚ'_x��ôP¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��WÚ'_î��üÍ�q¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��WÚ'_í��nõH¤������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��WÚ'_#��G?T½¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��WÚ'_Z��(&ø¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��WÚ'_5��ší¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��WÚ'_r��tu¤������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��WÚ'_Ã��š+µÞ¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��WÚ'_-��ºÎÒ_¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��WÚ'_Ð��‚c¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��WÚ'_ ��ë]í»¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��WÚ'_e��Ÿ’áé¤������3���vendor/symfony/finder/Iterator/SortableIterator.php+��WÚ'_+��õÝË ¤���������vendor/symfony/finder/LICENSE)��WÚ'_)��NUN½¤������'���vendor/symfony/finder/Shell/Command.php> ��WÚ'_> ��_~u ¤������%���vendor/symfony/finder/Shell/Shell.phpr��WÚ'_r��þpN¤������%���vendor/symfony/finder/SplFileInfo.php��WÚ'_��þ�íù¤������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��WÚ'_H ��³�Õݤ������%���vendor/symfony/polyfill-ctype/LICENSE)��WÚ'_)��´`e0¤������+���vendor/symfony/polyfill-ctype/bootstrap.phpä��WÚ'_ä��—o£¤������(���vendor/symfony/polyfill-mbstring/LICENSE)��WÚ'_)��“\ª¤������-���vendor/symfony/polyfill-mbstring/Mbstring.php€G��WÚ'_€G��ɖз¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷T��WÚ'_÷T��ß2ª?¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��WÚ'_ã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpîU��WÚ'_îU��`þ8Q¤������.���vendor/symfony/polyfill-mbstring/bootstrap.php)��WÚ'_)��p¼B¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���WÚ'_f���]ö>T¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���WÚ'_¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���WÚ'_”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��WÚ'_x��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��WÚ'_��﫤������5���vendor/symfony/process/Exception/RuntimeException.php˜���WÚ'_˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.php���WÚ'_���ûus€¤���������vendor/symfony/process/LICENSE)��WÚ'_)��NUN½¤������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��WÚ'_Ï��Î%h¤������%���vendor/symfony/process/PhpProcess.phpü��WÚ'_ü��‡jûü¤������.���vendor/symfony/process/Pipes/AbstractPipes.php½��WÚ'_½��憤������/���vendor/symfony/process/Pipes/PipesInterface.phpD��WÚ'_D��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php>��WÚ'_>��ª•ir¤������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��WÚ'_p ��âU~ɤ������"���vendor/symfony/process/Process.php·R��WÚ'_·R��Š`Õ¤������)���vendor/symfony/process/ProcessBuilder.phpâ
  48. ��WÚ'_â
  49. ��†M¶¤������'���vendor/symfony/process/ProcessUtils.phpQ��WÚ'_Q��b-$m¤���������vendor/seld/jsonlint/LICENSE"��WÚ'_"��aƒsy¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��WÚ'_*��•pñ¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php_2��WÚ'__2��Š–S¤������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php'��WÚ'_'��T×5ã¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��WÚ'_��‰²ñ¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���WÚ'_>���ÿqŸŸ¤������(���vendor/justinrainbow/json-schema/LICENSE ��WÚ'_ ��ºç©¤������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��WÚ'_ñ��fC¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��WÚ'_¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  50. ��WÚ'_�
  51. ��ÍèÓ¯¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��WÚ'_§ ��›Vؤ������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��WÚ'_¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��WÚ'_]��VŽU<¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��WÚ'_ã ��á0;¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��WÚ'_…��“TœÚ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��WÚ'_‡ ��ï›(¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��WÚ'_Ã��©Å¼x¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��WÚ'_0 ��×j´˜¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��WÚ'_��¥wš‡¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��WÚ'_a�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��WÚ'_—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��WÚ'_‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��WÚ'_&��4˜©T¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpS"��WÚ'_S"��¼¾õ:¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��WÚ'_è��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���WÚ'_I���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���WÚ'_•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���WÚ'_l���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���WÚ'_l���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���WÚ'_u���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���WÚ'_w���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��WÚ'_Þ��\¸
  52. ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���WÚ'_o���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���WÚ'_…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���WÚ'_€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���WÚ'_j���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���WÚ'_f���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��WÚ'_þ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��WÚ'_ ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��WÚ'_œ ��åfO¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��WÚ'_��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���WÚ'_á���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��WÚ'_¥��Ô§Lb¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��WÚ'_%��5" ¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��WÚ'_,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���WÚ'_®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��WÚ'_ ��£Ÿ)à¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��WÚ'_F��¨IaD¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���WÚ'_ƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���WÚ'_…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpv��WÚ'_v��õÍg¤������%���vendor/composer/spdx-licenses/LICENSE��WÚ'_��Bhí¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��WÚ'_H��͉T¤���������vendor/composer/semver/LICENSE��WÚ'_��Bhí¤������)���vendor/composer/semver/src/Comparator.php��WÚ'_��wlƒï¤������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��WÚ'_î��Õ­w-¤������4���vendor/composer/semver/src/Constraint/Constraint.php’ ��WÚ'_’ ��I&â¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���WÚ'_ß���0C,‡¤������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpä��WÚ'_ä��ïõ‚³¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.php,��WÚ'_,��0°=¤������%���vendor/composer/semver/src/Semver.php‚��WÚ'_‚��?nݤ������,���vendor/composer/semver/src/VersionParser.php¸*��WÚ'_¸*��GLÇí¤������!���vendor/composer/ca-bundle/LICENSE��WÚ'_��*!^`¤������*���vendor/composer/ca-bundle/src/CaBundle.phpR��WÚ'_R��!Ã%�¤������&���vendor/composer/xdebug-handler/LICENSE)��WÚ'_)��#Ô;^¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��WÚ'_´��*D’�¤������.���vendor/composer/xdebug-handler/src/Process.phpp ��WÚ'_p ��i,i‘¤������-���vendor/composer/xdebug-handler/src/Status.php
  53. ��WÚ'_
  54. ��$Ÿv-¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.phpÌ!��WÚ'_Ì!��:{•¤���������vendor/psr/log/LICENSE=��WÚ'_=��p±ŽO¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��WÚ'_;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���WÚ'_`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���WÚ'_û���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���WÚ'_|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���WÚ'_§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��WÚ'_È��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��WÚ'_k��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.php ���WÚ'_ ���ÆDi¯¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���WÚ'_p���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��WÚ'_ ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��WÚ'_<��þ(åI¤���������vendor/autoload.php‚���WÚ'_‚���‹UºO¤������'���vendor/composer/autoload_namespaces.phpd���WÚ'_d���Z¡¦H¤������!���vendor/composer/autoload_psr4.php÷��WÚ'_÷��Å*š¤������%���vendor/composer/autoload_classmap.phpd���WÚ'_d���Z¡¦H¤������"���vendor/composer/autoload_files.php��WÚ'_��¥� ®¤������!���vendor/composer/autoload_real.phpL��WÚ'_L��a0Øê¤������#���vendor/composer/autoload_static.php§
  55. ��WÚ'_§
  56. ��§kBõ¤���������vendor/composer/ClassLoader.php¨��WÚ'_¨��xää`¤������(���vendor/composer/ca-bundle/res/cacert.pemÇi�WÚ'_Çi�4ËŸ‡¤������ ���bin/composerÊ��WÚ'_Ê���4K¤���������LICENSE.��WÚ'_.�� Õ¤������<?php
  57. namespace Composer\Autoload;
  58. use Composer\Config;
  59. use Composer\EventDispatcher\EventDispatcher;
  60. use Composer\Installer\InstallationManager;
  61. use Composer\IO\IOInterface;
  62. use Composer\Package\AliasPackage;
  63. use Composer\Package\PackageInterface;
  64. use Composer\Repository\InstalledRepositoryInterface;
  65. use Composer\Util\Filesystem;
  66. use Composer\Script\ScriptEvents;
  67. use Composer\Util\PackageSorter;
  68. class AutoloadGenerator
  69. {
  70. private $eventDispatcher;
  71. private $io;
  72. private $devMode = false;
  73. private $classMapAuthoritative = false;
  74. private $apcu = false;
  75. private $runScripts = false;
  76. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  77. {
  78. $this->eventDispatcher = $eventDispatcher;
  79. $this->io = $io;
  80. }
  81. public function setDevMode($devMode = true)
  82. {
  83. $this->devMode = (bool) $devMode;
  84. }
  85. public function setClassMapAuthoritative($classMapAuthoritative)
  86. {
  87. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  88. }
  89. public function setApcu($apcu)
  90. {
  91. $this->apcu = (bool) $apcu;
  92. }
  93. public function setRunScripts($runScripts = true)
  94. {
  95. $this->runScripts = (bool) $runScripts;
  96. }
  97. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsrPackages = false, $suffix = '')
  98. {
  99. if ($this->classMapAuthoritative) {
  100. $scanPsrPackages = true;
  101. }
  102. if ($this->runScripts) {
  103. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  104. 'optimize' => (bool) $scanPsrPackages,
  105. ));
  106. }
  107. $filesystem = new Filesystem();
  108. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  109. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  110. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  111. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  112. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  113. $targetDir = $vendorPath.'/'.$targetDir;
  114. $filesystem->ensureDirectoryExists($targetDir);
  115. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  116. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  117. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  118. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  119. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  120. $namespacesFile = <<<EOF
  121. <?php
  122. // autoload_namespaces.php @generated by Composer
  123. \$vendorDir = $vendorPathCode52;
  124. \$baseDir = $appBaseDirCode;
  125. return array(
  126. EOF;
  127. $psr4File = <<<EOF
  128. <?php
  129. // autoload_psr4.php @generated by Composer
  130. \$vendorDir = $vendorPathCode52;
  131. \$baseDir = $appBaseDirCode;
  132. return array(
  133. EOF;
  134. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  135. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  136. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  137. $exportedPaths = array();
  138. foreach ($paths as $path) {
  139. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  140. }
  141. $exportedPrefix = var_export($namespace, true);
  142. $namespacesFile .= " $exportedPrefix => ";
  143. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  144. }
  145. $namespacesFile .= ");\n";
  146. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  147. $exportedPaths = array();
  148. foreach ($paths as $path) {
  149. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  150. }
  151. $exportedPrefix = var_export($namespace, true);
  152. $psr4File .= " $exportedPrefix => ";
  153. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  154. }
  155. $psr4File .= ");\n";
  156. $classmapFile = <<<EOF
  157. <?php
  158. // autoload_classmap.php @generated by Composer
  159. \$vendorDir = $vendorPathCode52;
  160. \$baseDir = $appBaseDirCode;
  161. return array(
  162. EOF;
  163. $targetDirLoader = null;
  164. $mainAutoload = $mainPackage->getAutoload();
  165. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  166. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  167. $prefixes = implode(', ', array_map(function ($prefix) {
  168. return var_export($prefix, true);
  169. }, array_keys($mainAutoload['psr-0'])));
  170. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  171. $targetDirLoader = <<<EOF
  172. public static function autoload(\$class)
  173. {
  174. \$dir = $baseDirFromTargetDirCode . '/';
  175. \$prefixes = array($prefixes);
  176. foreach (\$prefixes as \$prefix) {
  177. if (0 !== strpos(\$class, \$prefix)) {
  178. continue;
  179. }
  180. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  181. if (!\$path = stream_resolve_include_path(\$path)) {
  182. return false;
  183. }
  184. require \$path;
  185. return true;
  186. }
  187. }
  188. EOF;
  189. }
  190. $excluded = null;
  191. if (!empty($autoloads['exclude-from-classmap'])) {
  192. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  193. }
  194. $classMap = array();
  195. $ambiguousClasses = array();
  196. $scannedFiles = array();
  197. foreach ($autoloads['classmap'] as $dir) {
  198. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, null, null, $classMap, $ambiguousClasses, $scannedFiles);
  199. }
  200. if ($scanPsrPackages) {
  201. $namespacesToScan = array();
  202. foreach (array('psr-4', 'psr-0') as $psrType) {
  203. foreach ($autoloads[$psrType] as $namespace => $paths) {
  204. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  205. }
  206. }
  207. krsort($namespacesToScan);
  208. foreach ($namespacesToScan as $namespace => $groups) {
  209. foreach ($groups as $group) {
  210. foreach ($group['paths'] as $dir) {
  211. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  212. if (!is_dir($dir)) {
  213. continue;
  214. }
  215. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
  216. }
  217. }
  218. }
  219. }
  220. foreach ($ambiguousClasses as $className => $ambigiousPaths) {
  221. $cleanPath = str_replace(array('$vendorDir . \'', '$baseDir . \'', "',\n"), array($vendorPath, $basePath, ''), $classMap[$className]);
  222. $this->io->writeError(
  223. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  224. ' was found '. (count($ambigiousPaths) + 1) .'x: in "'.$cleanPath.'" and "'. implode('", "', $ambigiousPaths) .'", the first will be used.</warning>'
  225. );
  226. }
  227. ksort($classMap);
  228. foreach ($classMap as $class => $code) {
  229. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  230. }
  231. $classmapFile .= ");\n";
  232. if (!$suffix) {
  233. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  234. $content = file_get_contents($vendorPath.'/autoload.php');
  235. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  236. $suffix = $match[1];
  237. }
  238. }
  239. if (!$suffix) {
  240. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  241. }
  242. }
  243. $this->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  244. $this->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  245. $this->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  246. $includePathFilePath = $targetDir.'/include_paths.php';
  247. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  248. $this->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  249. } elseif (file_exists($includePathFilePath)) {
  250. unlink($includePathFilePath);
  251. }
  252. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  253. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  254. $this->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  255. } elseif (file_exists($includeFilesFilePath)) {
  256. unlink($includeFilesFilePath);
  257. }
  258. $this->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  259. $this->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  260. $this->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  261. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  262. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  263. if ($this->runScripts) {
  264. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  265. 'optimize' => (bool) $scanPsrPackages,
  266. ));
  267. }
  268. return count($classMap);
  269. }
  270. private function filePutContentsIfModified($path, $content)
  271. {
  272. $currentContent = @file_get_contents($path);
  273. if (!$currentContent || ($currentContent != $content)) {
  274. return file_put_contents($path, $content);
  275. }
  276. return 0;
  277. }
  278. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
  279. {
  280. foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
  281. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  282. if (!isset($classMap[$class])) {
  283. $classMap[$class] = $pathCode;
  284. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  285. $ambiguousClasses[$class][] = $path;
  286. }
  287. }
  288. return $classMap;
  289. }
  290. private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
  291. {
  292. return ClassMapGenerator::createMap($dir, $excluded, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
  293. }
  294. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  295. {
  296. $packageMap = array(array($mainPackage, ''));
  297. foreach ($packages as $package) {
  298. if ($package instanceof AliasPackage) {
  299. continue;
  300. }
  301. $this->validatePackage($package);
  302. $packageMap[] = array(
  303. $package,
  304. $installationManager->getInstallPath($package),
  305. );
  306. }
  307. return $packageMap;
  308. }
  309. protected function validatePackage(PackageInterface $package)
  310. {
  311. $autoload = $package->getAutoload();
  312. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  313. $name = $package->getName();
  314. $package->getTargetDir();
  315. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  316. }
  317. if (!empty($autoload['psr-4'])) {
  318. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  319. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  320. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  321. }
  322. }
  323. }
  324. }
  325. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  326. {
  327. $mainPackageMap = array_shift($packageMap);
  328. if ($filterOutRequireDevPackages) {
  329. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  330. }
  331. $sortedPackageMap = $this->sortPackageMap($packageMap);
  332. $sortedPackageMap[] = $mainPackageMap;
  333. array_unshift($packageMap, $mainPackageMap);
  334. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  335. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  336. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  337. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  338. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  339. krsort($psr0);
  340. krsort($psr4);
  341. return array(
  342. 'psr-0' => $psr0,
  343. 'psr-4' => $psr4,
  344. 'classmap' => $classmap,
  345. 'files' => $files,
  346. 'exclude-from-classmap' => $exclude,
  347. );
  348. }
  349. public function createLoader(array $autoloads)
  350. {
  351. $loader = new ClassLoader();
  352. if (isset($autoloads['psr-0'])) {
  353. foreach ($autoloads['psr-0'] as $namespace => $path) {
  354. $loader->add($namespace, $path);
  355. }
  356. }
  357. if (isset($autoloads['psr-4'])) {
  358. foreach ($autoloads['psr-4'] as $namespace => $path) {
  359. $loader->addPsr4($namespace, $path);
  360. }
  361. }
  362. if (isset($autoloads['classmap'])) {
  363. $excluded = null;
  364. if (!empty($autoloads['exclude-from-classmap'])) {
  365. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  366. }
  367. $scannedFiles = array();
  368. foreach ($autoloads['classmap'] as $dir) {
  369. try {
  370. $loader->addClassMap($this->generateClassMap($dir, $excluded, null, null, false, $scannedFiles));
  371. } catch (\RuntimeException $e) {
  372. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  373. }
  374. }
  375. }
  376. return $loader;
  377. }
  378. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  379. {
  380. $includePaths = array();
  381. foreach ($packageMap as $item) {
  382. list($package, $installPath) = $item;
  383. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  384. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  385. }
  386. foreach ($package->getIncludePaths() as $includePath) {
  387. $includePath = trim($includePath, '/');
  388. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  389. }
  390. }
  391. if (!$includePaths) {
  392. return;
  393. }
  394. $includePathsCode = '';
  395. foreach ($includePaths as $path) {
  396. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  397. }
  398. return <<<EOF
  399. <?php
  400. // include_paths.php @generated by Composer
  401. \$vendorDir = $vendorPathCode;
  402. \$baseDir = $appBaseDirCode;
  403. return array(
  404. $includePathsCode);
  405. EOF;
  406. }
  407. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  408. {
  409. $filesCode = '';
  410. foreach ($files as $fileIdentifier => $functionFile) {
  411. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  412. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  413. }
  414. if (!$filesCode) {
  415. return false;
  416. }
  417. return <<<EOF
  418. <?php
  419. // autoload_files.php @generated by Composer
  420. \$vendorDir = $vendorPathCode;
  421. \$baseDir = $appBaseDirCode;
  422. return array(
  423. $filesCode);
  424. EOF;
  425. }
  426. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  427. {
  428. if (!$filesystem->isAbsolutePath($path)) {
  429. $path = $basePath . '/' . $path;
  430. }
  431. $path = $filesystem->normalizePath($path);
  432. $baseDir = '';
  433. if (strpos($path.'/', $vendorPath.'/') === 0) {
  434. $path = substr($path, strlen($vendorPath));
  435. $baseDir = '$vendorDir';
  436. if ($path !== false) {
  437. $baseDir .= " . ";
  438. }
  439. } else {
  440. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  441. if (!$filesystem->isAbsolutePath($path)) {
  442. $baseDir = '$baseDir . ';
  443. $path = '/' . $path;
  444. }
  445. }
  446. if (strpos($path, '.phar') !== false) {
  447. $baseDir = "'phar://' . " . $baseDir;
  448. }
  449. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  450. }
  451. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  452. {
  453. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  454. if ("'" === $lastChar || '"' === $lastChar) {
  455. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  456. } else {
  457. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  458. }
  459. return <<<AUTOLOAD
  460. <?php
  461. // autoload.php @generated by Composer
  462. require_once $vendorPathToTargetDirCode;
  463. return ComposerAutoloaderInit$suffix::getLoader();
  464. AUTOLOAD;
  465. }
  466. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  467. {
  468. $file = <<<HEADER
  469. <?php
  470. // autoload_real.php @generated by Composer
  471. class ComposerAutoloaderInit$suffix
  472. {
  473. private static \$loader;
  474. public static function loadClassLoader(\$class)
  475. {
  476. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  477. require __DIR__ . '/ClassLoader.php';
  478. }
  479. }
  480. /**
  481. * @return \Composer\Autoload\ClassLoader
  482. */
  483. public static function getLoader()
  484. {
  485. if (null !== self::\$loader) {
  486. return self::\$loader;
  487. }
  488. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  489. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  490. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  491. HEADER;
  492. if ($useIncludePath) {
  493. $file .= <<<'INCLUDE_PATH'
  494. $includePaths = require __DIR__ . '/include_paths.php';
  495. $includePaths[] = get_include_path();
  496. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  497. INCLUDE_PATH;
  498. }
  499. $file .= <<<STATIC_INIT
  500. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  501. if (\$useStaticLoader) {
  502. require_once __DIR__ . '/autoload_static.php';
  503. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  504. } else {
  505. STATIC_INIT;
  506. if (!$this->classMapAuthoritative) {
  507. $file .= <<<'PSR04'
  508. $map = require __DIR__ . '/autoload_namespaces.php';
  509. foreach ($map as $namespace => $path) {
  510. $loader->set($namespace, $path);
  511. }
  512. $map = require __DIR__ . '/autoload_psr4.php';
  513. foreach ($map as $namespace => $path) {
  514. $loader->setPsr4($namespace, $path);
  515. }
  516. PSR04;
  517. }
  518. if ($useClassMap) {
  519. $file .= <<<'CLASSMAP'
  520. $classMap = require __DIR__ . '/autoload_classmap.php';
  521. if ($classMap) {
  522. $loader->addClassMap($classMap);
  523. }
  524. CLASSMAP;
  525. }
  526. $file .= " }\n\n";
  527. if ($this->classMapAuthoritative) {
  528. $file .= <<<'CLASSMAPAUTHORITATIVE'
  529. $loader->setClassMapAuthoritative(true);
  530. CLASSMAPAUTHORITATIVE;
  531. }
  532. if ($this->apcu) {
  533. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  534. $file .= <<<APCU
  535. \$loader->setApcuPrefix('$apcuPrefix');
  536. APCU;
  537. }
  538. if ($useGlobalIncludePath) {
  539. $file .= <<<'INCLUDEPATH'
  540. $loader->setUseIncludePath(true);
  541. INCLUDEPATH;
  542. }
  543. if ($targetDirLoader) {
  544. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  545. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  546. REGISTER_TARGET_DIR_AUTOLOAD;
  547. }
  548. $file .= <<<REGISTER_LOADER
  549. \$loader->register($prependAutoloader);
  550. REGISTER_LOADER;
  551. if ($useIncludeFiles) {
  552. $file .= <<<INCLUDE_FILES
  553. if (\$useStaticLoader) {
  554. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  555. } else {
  556. \$includeFiles = require __DIR__ . '/autoload_files.php';
  557. }
  558. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  559. composerRequire$suffix(\$fileIdentifier, \$file);
  560. }
  561. INCLUDE_FILES;
  562. }
  563. $file .= <<<METHOD_FOOTER
  564. return \$loader;
  565. }
  566. METHOD_FOOTER;
  567. $file .= $targetDirLoader;
  568. if ($useIncludeFiles) {
  569. return $file . <<<FOOTER
  570. }
  571. function composerRequire$suffix(\$fileIdentifier, \$file)
  572. {
  573. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  574. require \$file;
  575. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  576. }
  577. }
  578. FOOTER;
  579. }
  580. return $file . <<<FOOTER
  581. }
  582. FOOTER;
  583. }
  584. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  585. {
  586. $staticPhpVersion = 50600;
  587. $file = <<<HEADER
  588. <?php
  589. // autoload_static.php @generated by Composer
  590. namespace Composer\Autoload;
  591. class ComposerStaticInit$suffix
  592. {
  593. HEADER;
  594. $loader = new ClassLoader();
  595. $map = require $targetDir . '/autoload_namespaces.php';
  596. foreach ($map as $namespace => $path) {
  597. $loader->set($namespace, $path);
  598. }
  599. $map = require $targetDir . '/autoload_psr4.php';
  600. foreach ($map as $namespace => $path) {
  601. $loader->setPsr4($namespace, $path);
  602. }
  603. $classMap = require $targetDir . '/autoload_classmap.php';
  604. if ($classMap) {
  605. $loader->addClassMap($classMap);
  606. }
  607. $filesystem = new Filesystem();
  608. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  609. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  610. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  611. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  612. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  613. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  614. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  615. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  616. $initializer = '';
  617. $prefix = "\0Composer\Autoload\ClassLoader\0";
  618. $prefixLen = strlen($prefix);
  619. if (file_exists($targetDir . '/autoload_files.php')) {
  620. $maps = array('files' => require $targetDir . '/autoload_files.php');
  621. } else {
  622. $maps = array();
  623. }
  624. foreach ((array) $loader as $prop => $value) {
  625. if ($value && 0 === strpos($prop, $prefix)) {
  626. $maps[substr($prop, $prefixLen)] = $value;
  627. }
  628. }
  629. foreach ($maps as $prop => $value) {
  630. if (count($value) > 32767) {
  631. $staticPhpVersion = 70000;
  632. }
  633. $value = strtr(
  634. var_export($value, true),
  635. array(
  636. $absoluteVendorPathCode => $vendorPathCode,
  637. $absoluteVendorPharPathCode => $vendorPharPathCode,
  638. $absoluteAppBaseDirCode => $appBaseDirCode,
  639. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  640. )
  641. );
  642. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  643. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  644. if ('files' !== $prop) {
  645. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  646. }
  647. }
  648. return $file . <<<INITIALIZER
  649. public static function getInitializer(ClassLoader \$loader)
  650. {
  651. return \Closure::bind(function () use (\$loader) {
  652. $initializer
  653. }, null, ClassLoader::class);
  654. }
  655. }
  656. INITIALIZER;
  657. }
  658. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  659. {
  660. $autoloads = array();
  661. foreach ($packageMap as $item) {
  662. list($package, $installPath) = $item;
  663. $autoload = $package->getAutoload();
  664. if ($this->devMode && $package === $mainPackage) {
  665. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  666. }
  667. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  668. continue;
  669. }
  670. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  671. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  672. }
  673. foreach ($autoload[$type] as $namespace => $paths) {
  674. foreach ((array) $paths as $path) {
  675. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  676. if ($package === $mainPackage) {
  677. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  678. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  679. } else {
  680. $path = $package->getTargetDir() . '/' . $path;
  681. }
  682. }
  683. if ($type === 'exclude-from-classmap') {
  684. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  685. $path = str_replace('\\*\\*', '.+?', $path);
  686. $path = str_replace('\\*', '[^/]+?', $path);
  687. $updir = null;
  688. $path = preg_replace_callback(
  689. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  690. function ($matches) use (&$updir) {
  691. if (isset($matches[1])) {
  692. $updir = str_replace('\\.', '.', $matches[1]);
  693. }
  694. return '';
  695. },
  696. $path
  697. );
  698. if (empty($installPath)) {
  699. $installPath = strtr(getcwd(), '\\', '/');
  700. }
  701. $resolvedPath = realpath($installPath . '/' . $updir);
  702. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  703. continue;
  704. }
  705. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  706. if ($type === 'files') {
  707. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  708. continue;
  709. } elseif ($type === 'classmap') {
  710. $autoloads[] = $relativePath;
  711. continue;
  712. }
  713. $autoloads[$namespace][] = $relativePath;
  714. }
  715. }
  716. }
  717. return $autoloads;
  718. }
  719. protected function getFileIdentifier(PackageInterface $package, $path)
  720. {
  721. return md5($package->getName() . ':' . $path);
  722. }
  723. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  724. {
  725. $packages = array();
  726. $include = array();
  727. $replacedBy = array();
  728. foreach ($packageMap as $item) {
  729. $package = $item[0];
  730. $name = $package->getName();
  731. $packages[$name] = $package;
  732. foreach ($package->getReplaces() as $replace) {
  733. $replacedBy[$replace->getTarget()] = $name;
  734. }
  735. }
  736. $add = function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy) {
  737. foreach ($package->getRequires() as $link) {
  738. $target = $link->getTarget();
  739. if (isset($replacedBy[$target])) {
  740. $target = $replacedBy[$target];
  741. }
  742. if (!isset($include[$target])) {
  743. $include[$target] = true;
  744. if (isset($packages[$target])) {
  745. $add($packages[$target]);
  746. }
  747. }
  748. }
  749. };
  750. $add($mainPackage);
  751. return array_filter(
  752. $packageMap,
  753. function ($item) use ($include) {
  754. $package = $item[0];
  755. foreach ($package->getNames() as $name) {
  756. if (isset($include[$name])) {
  757. return true;
  758. }
  759. }
  760. return false;
  761. }
  762. );
  763. }
  764. protected function sortPackageMap(array $packageMap)
  765. {
  766. $packages = array();
  767. $paths = array();
  768. foreach ($packageMap as $item) {
  769. list($package, $path) = $item;
  770. $name = $package->getName();
  771. $packages[$name] = $package;
  772. $paths[$name] = $path;
  773. }
  774. $sortedPackages = PackageSorter::sortPackages($packages);
  775. $sortedPackageMap = array();
  776. foreach ($sortedPackages as $package) {
  777. $name = $package->getName();
  778. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  779. }
  780. return $sortedPackageMap;
  781. }
  782. protected function safeCopy($source, $target)
  783. {
  784. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  785. $source = fopen($source, 'r');
  786. $target = fopen($target, 'w+');
  787. stream_copy_to_stream($source, $target);
  788. fclose($source);
  789. fclose($target);
  790. }
  791. }
  792. private function filesAreEqual($a, $b)
  793. {
  794. if (filesize($a) !== filesize($b)) {
  795. return false;
  796. }
  797. $ah = fopen($a, 'rb');
  798. $bh = fopen($b, 'rb');
  799. $result = true;
  800. while (!feof($ah)) {
  801. if (fread($ah, 8192) != fread($bh, 8192)) {
  802. $result = false;
  803. break;
  804. }
  805. }
  806. fclose($ah);
  807. fclose($bh);
  808. return $result;
  809. }
  810. }
  811. <?php
  812. namespace Composer\Autoload;
  813. use Symfony\Component\Finder\Finder;
  814. use Composer\IO\IOInterface;
  815. use Composer\Util\Filesystem;
  816. class ClassMapGenerator
  817. {
  818. public static function dump($dirs, $file)
  819. {
  820. $maps = array();
  821. foreach ($dirs as $dir) {
  822. $maps = array_merge($maps, static::createMap($dir));
  823. }
  824. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  825. }
  826. public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
  827. {
  828. if (is_string($path)) {
  829. $basePath = $path;
  830. if (is_file($path)) {
  831. $path = array(new \SplFileInfo($path));
  832. } elseif (is_dir($path)) {
  833. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  834. } else {
  835. throw new \RuntimeException(
  836. 'Could not scan for classes inside "'.$path.
  837. '" which does not appear to be a file nor a folder'
  838. );
  839. }
  840. } elseif (null !== $autoloadType) {
  841. throw new \RuntimeException('Path must be a string when specifying an autoload type');
  842. }
  843. $map = array();
  844. $filesystem = new Filesystem();
  845. $cwd = realpath(getcwd());
  846. foreach ($path as $file) {
  847. $filePath = $file->getPathname();
  848. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  849. continue;
  850. }
  851. if (!$filesystem->isAbsolutePath($filePath)) {
  852. $filePath = $cwd . '/' . $filePath;
  853. $filePath = $filesystem->normalizePath($filePath);
  854. } else {
  855. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  856. }
  857. $realPath = realpath($filePath);
  858. if (isset($scannedFiles[$realPath])) {
  859. continue;
  860. }
  861. if ($excluded && preg_match($excluded, strtr($realPath, '\\', '/'))) {
  862. continue;
  863. }
  864. if ($excluded && preg_match($excluded, strtr($filePath, '\\', '/'))) {
  865. continue;
  866. }
  867. $classes = self::findClasses($filePath);
  868. if (null !== $autoloadType) {
  869. list($classes, $validClasses) = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);
  870. if ($validClasses) {
  871. $scannedFiles[$realPath] = true;
  872. }
  873. } else {
  874. $scannedFiles[$realPath] = true;
  875. }
  876. foreach ($classes as $class) {
  877. if ( null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
  878. continue;
  879. }
  880. if (!isset($map[$class])) {
  881. $map[$class] = $filePath;
  882. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  883. $io->writeError(
  884. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  885. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  886. );
  887. }
  888. }
  889. }
  890. return $map;
  891. }
  892. private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
  893. {
  894. $validClasses = array();
  895. $rejectedClasses = array();
  896. $realSubPath = substr($filePath, strlen($basePath) + 1);
  897. $realSubPath = substr($realSubPath, 0, strrpos($realSubPath, '.'));
  898. foreach ($classes as $class) {
  899. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  900. continue;
  901. }
  902. if ('psr-0' === $namespaceType) {
  903. $namespaceLength = strrpos($class, '\\');
  904. if (false !== $namespaceLength) {
  905. $namespace = substr($class, 0, $namespaceLength + 1);
  906. $className = substr($class, $namespaceLength + 1);
  907. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  908. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  909. }
  910. else {
  911. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  912. }
  913. } elseif ('psr-4' === $namespaceType) {
  914. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  915. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  916. } else {
  917. throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
  918. }
  919. if ($subPath === $realSubPath) {
  920. $validClasses[] = $class;
  921. } else {
  922. $rejectedClasses[] = $class;
  923. }
  924. }
  925. if (empty($validClasses)) {
  926. foreach ($rejectedClasses as $class) {
  927. trigger_error(
  928. "Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. It will not autoload anymore in Composer v2.0.",
  929. E_USER_DEPRECATED
  930. );
  931. }
  932. }
  933. return array($classes, $validClasses);
  934. }
  935. private static function findClasses($path)
  936. {
  937. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  938. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  939. $extraTypes .= '|enum';
  940. }
  941. $contents = @php_strip_whitespace($path);
  942. if (!$contents) {
  943. if (!file_exists($path)) {
  944. $message = 'File at "%s" does not exist, check your classmap definitions';
  945. } elseif (!is_readable($path)) {
  946. $message = 'File at "%s" is not readable, check its permissions';
  947. } elseif ('' === trim(file_get_contents($path))) {
  948. return array();
  949. } else {
  950. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  951. }
  952. $error = error_get_last();
  953. if (isset($error['message'])) {
  954. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  955. }
  956. throw new \RuntimeException(sprintf($message, $path));
  957. }
  958. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  959. return array();
  960. }
  961. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  962. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  963. if (substr($contents, 0, 2) !== '<?') {
  964. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  965. if ($replacements === 0) {
  966. return array();
  967. }
  968. }
  969. $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
  970. $pos = strrpos($contents, '?>');
  971. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  972. $contents = substr($contents, 0, $pos);
  973. }
  974. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  975. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  976. }
  977. preg_match_all('{
  978. (?:
  979. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  980. | \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*+ [\{;]
  981. )
  982. }ix', $contents, $matches);
  983. $classes = array();
  984. $namespace = '';
  985. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  986. if (!empty($matches['ns'][$i])) {
  987. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  988. } else {
  989. $name = $matches['name'][$i];
  990. if ($name === 'extends' || $name === 'implements') {
  991. continue;
  992. }
  993. if ($name[0] === ':') {
  994. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  995. } elseif ($matches['type'][$i] === 'enum') {
  996. $name = rtrim($name, ':');
  997. }
  998. $classes[] = ltrim($namespace . $name, '\\');
  999. }
  1000. }
  1001. return $classes;
  1002. }
  1003. }
  1004. <?php
  1005. namespace Composer;
  1006. use Composer\IO\IOInterface;
  1007. use Composer\Util\Filesystem;
  1008. use Composer\Util\Silencer;
  1009. use Symfony\Component\Finder\Finder;
  1010. class Cache
  1011. {
  1012. private static $cacheCollected = false;
  1013. private $io;
  1014. private $root;
  1015. private $enabled = true;
  1016. private $allowList;
  1017. private $filesystem;
  1018. public function __construct(IOInterface $io, $cacheDir, $allowList = 'a-z0-9.', Filesystem $filesystem = null)
  1019. {
  1020. $this->io = $io;
  1021. $this->root = rtrim($cacheDir, '/\\') . '/';
  1022. $this->allowList = $allowList;
  1023. $this->filesystem = $filesystem ?: new Filesystem();
  1024. if (!self::isUsable($cacheDir)) {
  1025. $this->enabled = false;
  1026. return;
  1027. }
  1028. if (
  1029. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1030. || !is_writable($this->root)
  1031. ) {
  1032. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  1033. $this->enabled = false;
  1034. }
  1035. }
  1036. public static function isUsable($path)
  1037. {
  1038. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1039. }
  1040. public function isEnabled()
  1041. {
  1042. return $this->enabled;
  1043. }
  1044. public function getRoot()
  1045. {
  1046. return $this->root;
  1047. }
  1048. public function read($file)
  1049. {
  1050. if ($this->enabled) {
  1051. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1052. if (file_exists($this->root . $file)) {
  1053. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1054. return file_get_contents($this->root . $file);
  1055. }
  1056. }
  1057. return false;
  1058. }
  1059. public function write($file, $contents)
  1060. {
  1061. if ($this->enabled) {
  1062. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1063. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1064. try {
  1065. return file_put_contents($this->root . $file, $contents);
  1066. } catch (\ErrorException $e) {
  1067. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1068. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1069. unlink($this->root . $file);
  1070. $message = sprintf(
  1071. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1072. $this->root . $file,
  1073. $m[1],
  1074. $m[2],
  1075. @disk_free_space($this->root . dirname($file))
  1076. );
  1077. $this->io->writeError($message);
  1078. return false;
  1079. }
  1080. throw $e;
  1081. }
  1082. }
  1083. return false;
  1084. }
  1085. public function copyFrom($file, $source)
  1086. {
  1087. if ($this->enabled) {
  1088. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1089. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1090. if (!file_exists($source)) {
  1091. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1092. } elseif ($this->io->isDebug()) {
  1093. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1094. }
  1095. return copy($source, $this->root . $file);
  1096. }
  1097. return false;
  1098. }
  1099. public function copyTo($file, $target)
  1100. {
  1101. if ($this->enabled) {
  1102. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1103. if (file_exists($this->root . $file)) {
  1104. try {
  1105. touch($this->root . $file, filemtime($this->root . $file), time());
  1106. } catch (\ErrorException $e) {
  1107. Silencer::call('touch', $this->root . $file);
  1108. }
  1109. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1110. return copy($this->root . $file, $target);
  1111. }
  1112. }
  1113. return false;
  1114. }
  1115. public function gcIsNecessary()
  1116. {
  1117. return (!self::$cacheCollected && !mt_rand(0, 50));
  1118. }
  1119. public function remove($file)
  1120. {
  1121. if ($this->enabled) {
  1122. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1123. if (file_exists($this->root . $file)) {
  1124. return $this->filesystem->unlink($this->root . $file);
  1125. }
  1126. }
  1127. return false;
  1128. }
  1129. public function clear()
  1130. {
  1131. if ($this->enabled) {
  1132. $this->filesystem->emptyDirectory($this->root);
  1133. return true;
  1134. }
  1135. return false;
  1136. }
  1137. public function gc($ttl, $maxSize)
  1138. {
  1139. if ($this->enabled) {
  1140. $expire = new \DateTime();
  1141. $expire->modify('-'.$ttl.' seconds');
  1142. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1143. foreach ($finder as $file) {
  1144. $this->filesystem->unlink($file->getPathname());
  1145. }
  1146. $totalSize = $this->filesystem->size($this->root);
  1147. if ($totalSize > $maxSize) {
  1148. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1149. while ($totalSize > $maxSize && $iterator->valid()) {
  1150. $filepath = $iterator->current()->getPathname();
  1151. $totalSize -= $this->filesystem->size($filepath);
  1152. $this->filesystem->unlink($filepath);
  1153. $iterator->next();
  1154. }
  1155. }
  1156. self::$cacheCollected = true;
  1157. return true;
  1158. }
  1159. return false;
  1160. }
  1161. public function sha1($file)
  1162. {
  1163. if ($this->enabled) {
  1164. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1165. if (file_exists($this->root . $file)) {
  1166. return sha1_file($this->root . $file);
  1167. }
  1168. }
  1169. return false;
  1170. }
  1171. public function sha256($file)
  1172. {
  1173. if ($this->enabled) {
  1174. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1175. if (file_exists($this->root . $file)) {
  1176. return hash_file('sha256', $this->root . $file);
  1177. }
  1178. }
  1179. return false;
  1180. }
  1181. protected function getFinder()
  1182. {
  1183. return Finder::create()->in($this->root)->files();
  1184. }
  1185. }
  1186. <?php
  1187. namespace Composer\Command;
  1188. use Symfony\Component\Console\Input\InputInterface;
  1189. use Symfony\Component\Console\Output\OutputInterface;
  1190. class AboutCommand extends BaseCommand
  1191. {
  1192. protected function configure()
  1193. {
  1194. $this
  1195. ->setName('about')
  1196. ->setDescription('Shows the short information about Composer.')
  1197. ->setHelp(
  1198. <<<EOT
  1199. <info>php composer.phar about</info>
  1200. EOT
  1201. )
  1202. ;
  1203. }
  1204. protected function execute(InputInterface $input, OutputInterface $output)
  1205. {
  1206. $this->getIO()->write(
  1207. <<<EOT
  1208. <info>Composer - Dependency Manager for PHP</info>
  1209. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1210. See https://getcomposer.org/ for more information.</comment>
  1211. EOT
  1212. );
  1213. return 0;
  1214. }
  1215. }
  1216. <?php
  1217. namespace Composer\Command;
  1218. use Composer\Factory;
  1219. use Composer\IO\IOInterface;
  1220. use Composer\Config;
  1221. use Composer\Composer;
  1222. use Composer\Repository\CompositeRepository;
  1223. use Composer\Repository\RepositoryFactory;
  1224. use Composer\Script\ScriptEvents;
  1225. use Composer\Plugin\CommandEvent;
  1226. use Composer\Plugin\PluginEvents;
  1227. use Composer\Util\Filesystem;
  1228. use Symfony\Component\Console\Input\InputArgument;
  1229. use Symfony\Component\Console\Input\InputInterface;
  1230. use Symfony\Component\Console\Input\InputOption;
  1231. use Symfony\Component\Console\Output\OutputInterface;
  1232. class ArchiveCommand extends BaseCommand
  1233. {
  1234. protected function configure()
  1235. {
  1236. $this
  1237. ->setName('archive')
  1238. ->setDescription('Creates an archive of this composer package.')
  1239. ->setDefinition(array(
  1240. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1241. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1242. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1243. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1244. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1245. .' Note that the format will be appended.'),
  1246. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1247. ))
  1248. ->setHelp(
  1249. <<<EOT
  1250. The <info>archive</info> command creates an archive of the specified format
  1251. containing the files and directories of the Composer project or the specified
  1252. package in the specified version and writes it to the specified directory.
  1253. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1254. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1255. EOT
  1256. )
  1257. ;
  1258. }
  1259. protected function execute(InputInterface $input, OutputInterface $output)
  1260. {
  1261. $composer = $this->getComposer(false);
  1262. $config = null;
  1263. if ($composer) {
  1264. $config = $composer->getConfig();
  1265. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1266. $eventDispatcher = $composer->getEventDispatcher();
  1267. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1268. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1269. }
  1270. if (!$config) {
  1271. $config = Factory::createConfig();
  1272. }
  1273. if (null === $input->getOption('format')) {
  1274. $input->setOption('format', $config->get('archive-format'));
  1275. }
  1276. if (null === $input->getOption('dir')) {
  1277. $input->setOption('dir', $config->get('archive-dir'));
  1278. }
  1279. $returnCode = $this->archive(
  1280. $this->getIO(),
  1281. $config,
  1282. $input->getArgument('package'),
  1283. $input->getArgument('version'),
  1284. $input->getOption('format'),
  1285. $input->getOption('dir'),
  1286. $input->getOption('file'),
  1287. $input->getOption('ignore-filters'),
  1288. $composer
  1289. );
  1290. if (0 === $returnCode && $composer) {
  1291. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1292. }
  1293. return $returnCode;
  1294. }
  1295. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1296. {
  1297. if ($composer) {
  1298. $archiveManager = $composer->getArchiveManager();
  1299. } else {
  1300. $factory = new Factory;
  1301. $downloadManager = $factory->createDownloadManager($io, $config);
  1302. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1303. }
  1304. if ($packageName) {
  1305. $package = $this->selectPackage($io, $packageName, $version);
  1306. if (!$package) {
  1307. return 1;
  1308. }
  1309. } else {
  1310. $package = $this->getComposer()->getPackage();
  1311. }
  1312. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1313. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1314. $fs = new Filesystem;
  1315. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1316. $io->writeError('Created: ', false);
  1317. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1318. return 0;
  1319. }
  1320. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1321. {
  1322. $io->writeError('<info>Searching for the specified package.</info>');
  1323. if ($composer = $this->getComposer(false)) {
  1324. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1325. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1326. } else {
  1327. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1328. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1329. $repo = new CompositeRepository($defaultRepos);
  1330. }
  1331. $packages = $repo->findPackages($packageName, $version);
  1332. if (count($packages) > 1) {
  1333. $package = reset($packages);
  1334. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1335. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1336. return $p->getPrettyString();
  1337. }, $packages)).'.');
  1338. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1339. } elseif ($packages) {
  1340. $package = reset($packages);
  1341. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1342. } else {
  1343. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1344. return false;
  1345. }
  1346. return $package;
  1347. }
  1348. }
  1349. <?php
  1350. namespace Composer\Command;
  1351. use Composer\Composer;
  1352. use Composer\Config;
  1353. use Composer\Console\Application;
  1354. use Composer\Factory;
  1355. use Composer\IO\IOInterface;
  1356. use Composer\IO\NullIO;
  1357. use Composer\Plugin\PreCommandRunEvent;
  1358. use Composer\Plugin\PluginEvents;
  1359. use Symfony\Component\Console\Input\InputInterface;
  1360. use Symfony\Component\Console\Output\OutputInterface;
  1361. use Symfony\Component\Console\Command\Command;
  1362. abstract class BaseCommand extends Command
  1363. {
  1364. private $composer;
  1365. private $io;
  1366. public function getComposer($required = true, $disablePlugins = null)
  1367. {
  1368. if (null === $this->composer) {
  1369. $application = $this->getApplication();
  1370. if ($application instanceof Application) {
  1371. $this->composer = $application->getComposer($required, $disablePlugins);
  1372. } elseif ($required) {
  1373. throw new \RuntimeException(
  1374. 'Could not create a Composer\Composer instance, you must inject '.
  1375. 'one if this command is not used with a Composer\Console\Application instance'
  1376. );
  1377. }
  1378. }
  1379. return $this->composer;
  1380. }
  1381. public function setComposer(Composer $composer)
  1382. {
  1383. $this->composer = $composer;
  1384. }
  1385. public function resetComposer()
  1386. {
  1387. $this->composer = null;
  1388. $this->getApplication()->resetComposer();
  1389. }
  1390. public function isProxyCommand()
  1391. {
  1392. return false;
  1393. }
  1394. public function getIO()
  1395. {
  1396. if (null === $this->io) {
  1397. $application = $this->getApplication();
  1398. if ($application instanceof Application) {
  1399. $this->io = $application->getIO();
  1400. } else {
  1401. $this->io = new NullIO();
  1402. }
  1403. }
  1404. return $this->io;
  1405. }
  1406. public function setIO(IOInterface $io)
  1407. {
  1408. $this->io = $io;
  1409. }
  1410. protected function initialize(InputInterface $input, OutputInterface $output)
  1411. {
  1412. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1413. $composer = $this->getComposer(false, $disablePlugins);
  1414. if (null === $composer) {
  1415. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1416. }
  1417. if ($composer) {
  1418. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1419. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1420. }
  1421. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1422. $input->setOption('no-progress', true);
  1423. }
  1424. parent::initialize($input, $output);
  1425. }
  1426. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1427. {
  1428. $preferSource = false;
  1429. $preferDist = false;
  1430. switch ($config->get('preferred-install')) {
  1431. case 'source':
  1432. $preferSource = true;
  1433. break;
  1434. case 'dist':
  1435. $preferDist = true;
  1436. break;
  1437. case 'auto':
  1438. default:
  1439. break;
  1440. }
  1441. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1442. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1443. $preferDist = $input->getOption('prefer-dist');
  1444. }
  1445. return array($preferSource, $preferDist);
  1446. }
  1447. }
  1448. <?php
  1449. namespace Composer\Command;
  1450. use Composer\DependencyResolver\Pool;
  1451. use Composer\Package\Link;
  1452. use Composer\Package\PackageInterface;
  1453. use Composer\Repository\ArrayRepository;
  1454. use Composer\Repository\CompositeRepository;
  1455. use Composer\Repository\PlatformRepository;
  1456. use Composer\Repository\RepositoryFactory;
  1457. use Composer\Plugin\CommandEvent;
  1458. use Composer\Plugin\PluginEvents;
  1459. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1460. use Composer\Package\Version\VersionParser;
  1461. use Symfony\Component\Console\Helper\Table;
  1462. use Symfony\Component\Console\Input\InputArgument;
  1463. use Symfony\Component\Console\Input\InputInterface;
  1464. use Symfony\Component\Console\Input\InputOption;
  1465. use Symfony\Component\Console\Output\OutputInterface;
  1466. class BaseDependencyCommand extends BaseCommand
  1467. {
  1468. const ARGUMENT_PACKAGE = 'package';
  1469. const ARGUMENT_CONSTRAINT = 'constraint';
  1470. const OPTION_RECURSIVE = 'recursive';
  1471. const OPTION_TREE = 'tree';
  1472. protected $colors;
  1473. protected function configure()
  1474. {
  1475. $this->setDefinition(array(
  1476. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1477. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1478. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1479. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1480. ));
  1481. }
  1482. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1483. {
  1484. $composer = $this->getComposer();
  1485. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1486. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1487. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1488. $repository = new CompositeRepository(array(
  1489. new ArrayRepository(array($composer->getPackage())),
  1490. $composer->getRepositoryManager()->getLocalRepository(),
  1491. new PlatformRepository(array(), $platformOverrides),
  1492. ));
  1493. $pool = new Pool();
  1494. $pool->addRepository($repository);
  1495. list($needle, $textConstraint) = array_pad(
  1496. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1497. 2,
  1498. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1499. );
  1500. $packages = $pool->whatProvides(strtolower($needle));
  1501. if (empty($packages)) {
  1502. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1503. }
  1504. if (!$repository->findPackage($needle, $textConstraint)) {
  1505. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1506. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1507. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1508. }
  1509. }
  1510. $needles = array($needle);
  1511. if ($inverted) {
  1512. foreach ($packages as $package) {
  1513. $needles = array_merge($needles, array_map(function (Link $link) {
  1514. return $link->getTarget();
  1515. }, $package->getReplaces()));
  1516. }
  1517. }
  1518. if ('*' !== $textConstraint) {
  1519. $versionParser = new VersionParser();
  1520. $constraint = $versionParser->parseConstraints($textConstraint);
  1521. } else {
  1522. $constraint = null;
  1523. }
  1524. $renderTree = $input->getOption(self::OPTION_TREE);
  1525. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1526. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1527. if (empty($results)) {
  1528. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1529. $this->getIO()->writeError(sprintf(
  1530. '<info>There is no installed package depending on "%s"%s</info>',
  1531. $needle,
  1532. $extra
  1533. ));
  1534. } elseif ($renderTree) {
  1535. $this->initStyles($output);
  1536. $root = $packages[0];
  1537. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1538. $this->printTree($results);
  1539. } else {
  1540. $this->printTable($output, $results);
  1541. }
  1542. return 0;
  1543. }
  1544. protected function printTable(OutputInterface $output, $results)
  1545. {
  1546. $table = array();
  1547. $doubles = array();
  1548. do {
  1549. $queue = array();
  1550. $rows = array();
  1551. foreach ($results as $result) {
  1552. list($package, $link, $children) = $result;
  1553. $unique = (string) $link;
  1554. if (isset($doubles[$unique])) {
  1555. continue;
  1556. }
  1557. $doubles[$unique] = true;
  1558. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1559. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1560. if ($children) {
  1561. $queue = array_merge($queue, $children);
  1562. }
  1563. }
  1564. $results = $queue;
  1565. $table = array_merge($rows, $table);
  1566. } while (!empty($results));
  1567. $renderer = new Table($output);
  1568. $renderer->setStyle('compact');
  1569. $rendererStyle = $renderer->getStyle();
  1570. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1571. $rendererStyle->setVerticalBorderChars('');
  1572. } else {
  1573. $rendererStyle->setVerticalBorderChar('');
  1574. }
  1575. $rendererStyle->setCellRowContentFormat('%s ');
  1576. $renderer->setRows($table)->render();
  1577. }
  1578. protected function initStyles(OutputInterface $output)
  1579. {
  1580. $this->colors = array(
  1581. 'green',
  1582. 'yellow',
  1583. 'cyan',
  1584. 'magenta',
  1585. 'blue',
  1586. );
  1587. foreach ($this->colors as $color) {
  1588. $style = new OutputFormatterStyle($color);
  1589. $output->getFormatter()->setStyle($color, $style);
  1590. }
  1591. }
  1592. protected function printTree($results, $prefix = '', $level = 1)
  1593. {
  1594. $count = count($results);
  1595. $idx = 0;
  1596. foreach ($results as $result) {
  1597. list($package, $link, $children) = $result;
  1598. $color = $this->colors[$level % count($this->colors)];
  1599. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1600. $isLast = (++$idx == $count);
  1601. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1602. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1603. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1604. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1605. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1606. if ($children) {
  1607. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1608. }
  1609. }
  1610. }
  1611. private function writeTreeLine($line)
  1612. {
  1613. $io = $this->getIO();
  1614. if (!$io->isDecorated()) {
  1615. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1616. }
  1617. $io->write($line);
  1618. }
  1619. }
  1620. <?php
  1621. namespace Composer\Command;
  1622. use Composer\Package\Link;
  1623. use Composer\Package\PackageInterface;
  1624. use Composer\Semver\Constraint\Constraint;
  1625. use Symfony\Component\Console\Helper\Table;
  1626. use Symfony\Component\Console\Input\InputInterface;
  1627. use Symfony\Component\Console\Input\InputOption;
  1628. use Symfony\Component\Console\Output\OutputInterface;
  1629. use Composer\Repository\PlatformRepository;
  1630. class CheckPlatformReqsCommand extends BaseCommand
  1631. {
  1632. protected function configure()
  1633. {
  1634. $this->setName('check-platform-reqs')
  1635. ->setDescription('Check that platform requirements are satisfied.')
  1636. ->setDefinition(array(
  1637. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1638. ))
  1639. ->setHelp(
  1640. <<<EOT
  1641. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1642. 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.
  1643. <info>php composer.phar check-platform-reqs</info>
  1644. EOT
  1645. );
  1646. }
  1647. protected function execute(InputInterface $input, OutputInterface $output)
  1648. {
  1649. $composer = $this->getComposer();
  1650. $requires = $composer->getPackage()->getRequires();
  1651. if ($input->getOption('no-dev')) {
  1652. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1653. } else {
  1654. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1655. if (!$dependencies) {
  1656. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1657. }
  1658. $requires += $composer->getPackage()->getDevRequires();
  1659. }
  1660. foreach ($requires as $require => $link) {
  1661. $requires[$require] = array($link);
  1662. }
  1663. foreach ($dependencies as $package) {
  1664. foreach ($package->getRequires() as $require => $link) {
  1665. $requires[$require][] = $link;
  1666. }
  1667. }
  1668. ksort($requires);
  1669. $platformRepo = new PlatformRepository(array(), array());
  1670. $currentPlatformPackages = $platformRepo->getPackages();
  1671. $currentPlatformPackageMap = array();
  1672. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1673. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1674. }
  1675. $results = array();
  1676. $exitCode = 0;
  1677. foreach ($requires as $require => $links) {
  1678. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1679. if (isset($currentPlatformPackageMap[$require])) {
  1680. $pass = true;
  1681. $version = $currentPlatformPackageMap[$require]->getVersion();
  1682. foreach ($links as $link) {
  1683. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1684. $results[] = array(
  1685. $currentPlatformPackageMap[$require]->getPrettyName(),
  1686. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1687. $link,
  1688. '<error>failed</error>',
  1689. );
  1690. $pass = false;
  1691. $exitCode = max($exitCode, 1);
  1692. }
  1693. }
  1694. if ($pass) {
  1695. $results[] = array(
  1696. $currentPlatformPackageMap[$require]->getPrettyName(),
  1697. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1698. null,
  1699. '<info>success</info>',
  1700. );
  1701. }
  1702. } else {
  1703. $results[] = array(
  1704. $require,
  1705. 'n/a',
  1706. $links[0],
  1707. '<error>missing</error>',
  1708. );
  1709. $exitCode = max($exitCode, 2);
  1710. }
  1711. }
  1712. }
  1713. $this->printTable($output, $results);
  1714. return $exitCode;
  1715. }
  1716. protected function printTable(OutputInterface $output, $results)
  1717. {
  1718. $table = array();
  1719. $rows = array();
  1720. foreach ($results as $result) {
  1721. list($platformPackage, $version, $link, $status) = $result;
  1722. $rows[] = array(
  1723. $platformPackage,
  1724. $version,
  1725. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1726. $status,
  1727. );
  1728. }
  1729. $table = array_merge($rows, $table);
  1730. $renderer = new Table($output);
  1731. $renderer->setStyle('compact');
  1732. $rendererStyle = $renderer->getStyle();
  1733. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1734. $rendererStyle->setVerticalBorderChars('');
  1735. } else {
  1736. $rendererStyle->setVerticalBorderChar('');
  1737. }
  1738. $rendererStyle->setCellRowContentFormat('%s ');
  1739. $renderer->setRows($table)->render();
  1740. }
  1741. }
  1742. <?php
  1743. namespace Composer\Command;
  1744. use Composer\Cache;
  1745. use Composer\Factory;
  1746. use Symfony\Component\Console\Input\InputInterface;
  1747. use Symfony\Component\Console\Output\OutputInterface;
  1748. class ClearCacheCommand extends BaseCommand
  1749. {
  1750. protected function configure()
  1751. {
  1752. $this
  1753. ->setName('clear-cache')
  1754. ->setAliases(array('clearcache', 'cc'))
  1755. ->setDescription('Clears composer\'s internal package cache.')
  1756. ->setHelp(
  1757. <<<EOT
  1758. The <info>clear-cache</info> deletes all cached packages from composer's
  1759. cache directory.
  1760. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  1761. EOT
  1762. )
  1763. ;
  1764. }
  1765. protected function execute(InputInterface $input, OutputInterface $output)
  1766. {
  1767. $config = Factory::createConfig();
  1768. $io = $this->getIO();
  1769. $cachePaths = array(
  1770. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1771. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1772. 'cache-files-dir' => $config->get('cache-files-dir'),
  1773. 'cache-dir' => $config->get('cache-dir'),
  1774. );
  1775. foreach ($cachePaths as $key => $cachePath) {
  1776. $cachePath = realpath($cachePath);
  1777. if (!$cachePath) {
  1778. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1779. continue;
  1780. }
  1781. $cache = new Cache($io, $cachePath);
  1782. if (!$cache->isEnabled()) {
  1783. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1784. continue;
  1785. }
  1786. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1787. $cache->clear();
  1788. }
  1789. $io->writeError('<info>All caches cleared.</info>');
  1790. return 0;
  1791. }
  1792. }
  1793. <?php
  1794. namespace Composer\Command;
  1795. use Composer\Util\Platform;
  1796. use Composer\Util\Silencer;
  1797. use Symfony\Component\Console\Input\InputInterface;
  1798. use Symfony\Component\Console\Input\InputArgument;
  1799. use Symfony\Component\Console\Input\InputOption;
  1800. use Symfony\Component\Console\Output\OutputInterface;
  1801. use Composer\Config;
  1802. use Composer\Config\JsonConfigSource;
  1803. use Composer\Factory;
  1804. use Composer\IO\IOInterface;
  1805. use Composer\Json\JsonFile;
  1806. use Composer\Semver\VersionParser;
  1807. use Composer\Package\BasePackage;
  1808. class ConfigCommand extends BaseCommand
  1809. {
  1810. protected $config;
  1811. protected $configFile;
  1812. protected $configSource;
  1813. protected $authConfigFile;
  1814. protected $authConfigSource;
  1815. protected function configure()
  1816. {
  1817. $this
  1818. ->setName('config')
  1819. ->setDescription('Sets config options.')
  1820. ->setDefinition(array(
  1821. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1822. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1823. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1824. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1825. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1826. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1827. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1828. new InputArgument('setting-key', null, 'Setting key'),
  1829. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1830. ))
  1831. ->setHelp(
  1832. <<<EOT
  1833. This command allows you to edit composer config settings and repositories
  1834. in either the local composer.json file or the global config.json file.
  1835. Additionally it lets you edit most properties in the local composer.json.
  1836. To set a config setting:
  1837. <comment>%command.full_name% bin-dir bin/</comment>
  1838. To read a config setting:
  1839. <comment>%command.full_name% bin-dir</comment>
  1840. Outputs: <info>bin</info>
  1841. To edit the global config.json file:
  1842. <comment>%command.full_name% --global</comment>
  1843. To add a repository:
  1844. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1845. To remove a repository (repo is a short alias for repositories):
  1846. <comment>%command.full_name% --unset repo.foo</comment>
  1847. To disable packagist:
  1848. <comment>%command.full_name% repo.packagist false</comment>
  1849. You can alter repositories in the global config.json file by passing in the
  1850. <info>--global</info> option.
  1851. To add or edit suggested packages you can use:
  1852. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  1853. To add or edit extra properties you can use:
  1854. <comment>%command.full_name% extra.property value</comment>
  1855. To edit the file in an external editor:
  1856. <comment>%command.full_name% --editor</comment>
  1857. To choose your editor you can set the "EDITOR" env variable.
  1858. To get a list of configuration values in the file:
  1859. <comment>%command.full_name% --list</comment>
  1860. You can always pass more than one option. As an example, if you want to edit the
  1861. global config.json file.
  1862. <comment>%command.full_name% --editor --global</comment>
  1863. Read more at https://getcomposer.org/doc/03-cli.md#config
  1864. EOT
  1865. )
  1866. ;
  1867. }
  1868. protected function initialize(InputInterface $input, OutputInterface $output)
  1869. {
  1870. parent::initialize($input, $output);
  1871. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1872. throw new \RuntimeException('--file and --global can not be combined');
  1873. }
  1874. $io = $this->getIO();
  1875. $this->config = Factory::createConfig($io);
  1876. $configFile = $input->getOption('global')
  1877. ? ($this->config->get('home') . '/config.json')
  1878. : ($input->getOption('file') ?: Factory::getComposerFile());
  1879. if (
  1880. ($configFile === 'composer.json' || $configFile === './composer.json')
  1881. && !file_exists($configFile)
  1882. && realpath(getcwd()) === realpath($this->config->get('home'))
  1883. ) {
  1884. file_put_contents($configFile, "{\n}\n");
  1885. }
  1886. $this->configFile = new JsonFile($configFile, null, $io);
  1887. $this->configSource = new JsonConfigSource($this->configFile);
  1888. $authConfigFile = $input->getOption('global')
  1889. ? ($this->config->get('home') . '/auth.json')
  1890. : dirname(realpath($configFile)) . '/auth.json';
  1891. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1892. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1893. if ($input->getOption('global') && !$this->configFile->exists()) {
  1894. touch($this->configFile->getPath());
  1895. $this->configFile->write(array('config' => new \ArrayObject));
  1896. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1897. }
  1898. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1899. touch($this->authConfigFile->getPath());
  1900. $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));
  1901. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1902. }
  1903. if (!$this->configFile->exists()) {
  1904. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1905. }
  1906. }
  1907. protected function execute(InputInterface $input, OutputInterface $output)
  1908. {
  1909. if ($input->getOption('editor')) {
  1910. $editor = escapeshellcmd(getenv('EDITOR'));
  1911. if (!$editor) {
  1912. if (Platform::isWindows()) {
  1913. $editor = 'notepad';
  1914. } else {
  1915. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1916. if (exec('which '.$candidate)) {
  1917. $editor = $candidate;
  1918. break;
  1919. }
  1920. }
  1921. }
  1922. }
  1923. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1924. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1925. return 0;
  1926. }
  1927. if (!$input->getOption('global')) {
  1928. $this->config->merge($this->configFile->read());
  1929. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1930. }
  1931. if ($input->getOption('list')) {
  1932. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1933. return 0;
  1934. }
  1935. $settingKey = $input->getArgument('setting-key');
  1936. if (!$settingKey) {
  1937. return 0;
  1938. }
  1939. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1940. throw new \RuntimeException('You can not combine a setting value with --unset');
  1941. }
  1942. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1943. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1944. $rawData = $this->configFile->read();
  1945. $data = $this->config->all();
  1946. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1947. if (!isset($matches[1]) || $matches[1] === '') {
  1948. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1949. } else {
  1950. if (!isset($data['repositories'][$matches[1]])) {
  1951. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1952. }
  1953. $value = $data['repositories'][$matches[1]];
  1954. }
  1955. } elseif (strpos($settingKey, '.')) {
  1956. $bits = explode('.', $settingKey);
  1957. if ($bits[0] === 'extra') {
  1958. $data = $rawData;
  1959. } else {
  1960. $data = $data['config'];
  1961. }
  1962. $match = false;
  1963. foreach ($bits as $bit) {
  1964. $key = isset($key) ? $key.'.'.$bit : $bit;
  1965. $match = false;
  1966. if (isset($data[$key])) {
  1967. $match = true;
  1968. $data = $data[$key];
  1969. unset($key);
  1970. }
  1971. }
  1972. if (!$match) {
  1973. throw new \RuntimeException($settingKey.' is not defined.');
  1974. }
  1975. $value = $data;
  1976. } elseif (isset($data['config'][$settingKey])) {
  1977. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1978. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1979. $value = $rawData[$settingKey];
  1980. } else {
  1981. throw new \RuntimeException($settingKey.' is not defined');
  1982. }
  1983. if (is_array($value)) {
  1984. $value = json_encode($value);
  1985. }
  1986. $this->getIO()->write($value, true, IOInterface::QUIET);
  1987. return 0;
  1988. }
  1989. $values = $input->getArgument('setting-value');
  1990. $booleanValidator = function ($val) {
  1991. return in_array($val, array('true', 'false', '1', '0'), true);
  1992. };
  1993. $booleanNormalizer = function ($val) {
  1994. return $val !== 'false' && (bool) $val;
  1995. };
  1996. $uniqueConfigValues = array(
  1997. 'process-timeout' => array('is_numeric', 'intval'),
  1998. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1999. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  2000. 'preferred-install' => array(
  2001. function ($val) {
  2002. return in_array($val, array('auto', 'source', 'dist'), true);
  2003. },
  2004. function ($val) {
  2005. return $val;
  2006. },
  2007. ),
  2008. 'store-auths' => array(
  2009. function ($val) {
  2010. return in_array($val, array('true', 'false', 'prompt'), true);
  2011. },
  2012. function ($val) {
  2013. if ('prompt' === $val) {
  2014. return 'prompt';
  2015. }
  2016. return $val !== 'false' && (bool) $val;
  2017. },
  2018. ),
  2019. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  2020. 'vendor-dir' => array('is_string', function ($val) {
  2021. return $val;
  2022. }),
  2023. 'bin-dir' => array('is_string', function ($val) {
  2024. return $val;
  2025. }),
  2026. 'archive-dir' => array('is_string', function ($val) {
  2027. return $val;
  2028. }),
  2029. 'archive-format' => array('is_string', function ($val) {
  2030. return $val;
  2031. }),
  2032. 'data-dir' => array('is_string', function ($val) {
  2033. return $val;
  2034. }),
  2035. 'cache-dir' => array('is_string', function ($val) {
  2036. return $val;
  2037. }),
  2038. 'cache-files-dir' => array('is_string', function ($val) {
  2039. return $val;
  2040. }),
  2041. 'cache-repo-dir' => array('is_string', function ($val) {
  2042. return $val;
  2043. }),
  2044. 'cache-vcs-dir' => array('is_string', function ($val) {
  2045. return $val;
  2046. }),
  2047. 'cache-ttl' => array('is_numeric', 'intval'),
  2048. 'cache-files-ttl' => array('is_numeric', 'intval'),
  2049. 'cache-files-maxsize' => array(
  2050. function ($val) {
  2051. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  2052. },
  2053. function ($val) {
  2054. return $val;
  2055. },
  2056. ),
  2057. 'bin-compat' => array(
  2058. function ($val) {
  2059. return in_array($val, array('auto', 'full'));
  2060. },
  2061. function ($val) {
  2062. return $val;
  2063. },
  2064. ),
  2065. 'discard-changes' => array(
  2066. function ($val) {
  2067. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  2068. },
  2069. function ($val) {
  2070. if ('stash' === $val) {
  2071. return 'stash';
  2072. }
  2073. return $val !== 'false' && (bool) $val;
  2074. },
  2075. ),
  2076. 'autoloader-suffix' => array('is_string', function ($val) {
  2077. return $val === 'null' ? null : $val;
  2078. }),
  2079. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  2080. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  2081. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  2082. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  2083. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  2084. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  2085. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  2086. 'cafile' => array(
  2087. function ($val) {
  2088. return file_exists($val) && is_readable($val);
  2089. },
  2090. function ($val) {
  2091. return $val === 'null' ? null : $val;
  2092. },
  2093. ),
  2094. 'capath' => array(
  2095. function ($val) {
  2096. return is_dir($val) && is_readable($val);
  2097. },
  2098. function ($val) {
  2099. return $val === 'null' ? null : $val;
  2100. },
  2101. ),
  2102. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2103. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2104. 'lock' => array($booleanValidator, $booleanNormalizer),
  2105. );
  2106. $multiConfigValues = array(
  2107. 'github-protocols' => array(
  2108. function ($vals) {
  2109. if (!is_array($vals)) {
  2110. return 'array expected';
  2111. }
  2112. foreach ($vals as $val) {
  2113. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2114. return 'valid protocols include: git, https, ssh';
  2115. }
  2116. }
  2117. return true;
  2118. },
  2119. function ($vals) {
  2120. return $vals;
  2121. },
  2122. ),
  2123. 'github-domains' => array(
  2124. function ($vals) {
  2125. if (!is_array($vals)) {
  2126. return 'array expected';
  2127. }
  2128. return true;
  2129. },
  2130. function ($vals) {
  2131. return $vals;
  2132. },
  2133. ),
  2134. 'gitlab-domains' => array(
  2135. function ($vals) {
  2136. if (!is_array($vals)) {
  2137. return 'array expected';
  2138. }
  2139. return true;
  2140. },
  2141. function ($vals) {
  2142. return $vals;
  2143. },
  2144. ),
  2145. );
  2146. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2147. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2148. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2149. }
  2150. $this->configSource->removeConfigSetting($settingKey);
  2151. return 0;
  2152. }
  2153. if (isset($uniqueConfigValues[$settingKey])) {
  2154. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2155. return 0;
  2156. }
  2157. if (isset($multiConfigValues[$settingKey])) {
  2158. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2159. return 0;
  2160. }
  2161. if (preg_match('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  2162. if ($input->getOption('unset')) {
  2163. $this->configSource->removeConfigSetting($settingKey);
  2164. return 0;
  2165. }
  2166. list($validator) = $uniqueConfigValues['preferred-install'];
  2167. if (!$validator($values[0])) {
  2168. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  2169. }
  2170. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2171. return 0;
  2172. }
  2173. $uniqueProps = array(
  2174. 'name' => array('is_string', function ($val) {
  2175. return $val;
  2176. }),
  2177. 'type' => array('is_string', function ($val) {
  2178. return $val;
  2179. }),
  2180. 'description' => array('is_string', function ($val) {
  2181. return $val;
  2182. }),
  2183. 'homepage' => array('is_string', function ($val) {
  2184. return $val;
  2185. }),
  2186. 'version' => array('is_string', function ($val) {
  2187. return $val;
  2188. }),
  2189. 'minimum-stability' => array(
  2190. function ($val) {
  2191. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2192. },
  2193. function ($val) {
  2194. return VersionParser::normalizeStability($val);
  2195. },
  2196. ),
  2197. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2198. );
  2199. $multiProps = array(
  2200. 'keywords' => array(
  2201. function ($vals) {
  2202. if (!is_array($vals)) {
  2203. return 'array expected';
  2204. }
  2205. return true;
  2206. },
  2207. function ($vals) {
  2208. return $vals;
  2209. },
  2210. ),
  2211. 'license' => array(
  2212. function ($vals) {
  2213. if (!is_array($vals)) {
  2214. return 'array expected';
  2215. }
  2216. return true;
  2217. },
  2218. function ($vals) {
  2219. return $vals;
  2220. },
  2221. ),
  2222. );
  2223. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2224. 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');
  2225. }
  2226. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2227. $this->configSource->removeProperty($settingKey);
  2228. return 0;
  2229. }
  2230. if (isset($uniqueProps[$settingKey])) {
  2231. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2232. return 0;
  2233. }
  2234. if (isset($multiProps[$settingKey])) {
  2235. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2236. return 0;
  2237. }
  2238. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2239. if ($input->getOption('unset')) {
  2240. $this->configSource->removeRepository($matches[1]);
  2241. return 0;
  2242. }
  2243. if (2 === count($values)) {
  2244. $this->configSource->addRepository($matches[1], array(
  2245. 'type' => $values[0],
  2246. 'url' => $values[1],
  2247. ));
  2248. return 0;
  2249. }
  2250. if (1 === count($values)) {
  2251. $value = strtolower($values[0]);
  2252. if (true === $booleanValidator($value)) {
  2253. if (false === $booleanNormalizer($value)) {
  2254. $this->configSource->addRepository($matches[1], false);
  2255. return 0;
  2256. }
  2257. } else {
  2258. $value = JsonFile::parseJson($values[0]);
  2259. $this->configSource->addRepository($matches[1], $value);
  2260. return 0;
  2261. }
  2262. }
  2263. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2264. }
  2265. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2266. if ($input->getOption('unset')) {
  2267. $this->configSource->removeProperty($settingKey);
  2268. return 0;
  2269. }
  2270. $this->configSource->addProperty($settingKey, $values[0]);
  2271. return 0;
  2272. }
  2273. if (preg_match('/^suggest\.(.+)/', $settingKey, $matches)) {
  2274. if ($input->getOption('unset')) {
  2275. $this->configSource->removeProperty($settingKey);
  2276. return 0;
  2277. }
  2278. $this->configSource->addProperty($settingKey, implode(' ', $values));
  2279. return 0;
  2280. }
  2281. if (in_array($settingKey, array('suggest', 'extra'), true) && $input->getOption('unset')) {
  2282. $this->configSource->removeProperty($settingKey);
  2283. return 0;
  2284. }
  2285. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2286. if ($input->getOption('unset')) {
  2287. $this->configSource->removeConfigSetting($settingKey);
  2288. return 0;
  2289. }
  2290. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2291. return 0;
  2292. }
  2293. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2294. $this->configSource->removeConfigSetting($settingKey);
  2295. return 0;
  2296. }
  2297. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  2298. if ($input->getOption('unset')) {
  2299. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2300. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2301. return 0;
  2302. }
  2303. if ($matches[1] === 'bitbucket-oauth') {
  2304. if (2 !== count($values)) {
  2305. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2306. }
  2307. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2308. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2309. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'), true)) {
  2310. if (1 !== count($values)) {
  2311. throw new \RuntimeException('Too many arguments, expected only one token');
  2312. }
  2313. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2314. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2315. } elseif ($matches[1] === 'http-basic') {
  2316. if (2 !== count($values)) {
  2317. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2318. }
  2319. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2320. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2321. }
  2322. return 0;
  2323. }
  2324. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2325. if ($input->getOption('unset')) {
  2326. $this->configSource->removeProperty($settingKey);
  2327. return 0;
  2328. }
  2329. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2330. return 0;
  2331. }
  2332. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2333. }
  2334. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2335. {
  2336. list($validator, $normalizer) = $callbacks;
  2337. if (1 !== count($values)) {
  2338. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2339. }
  2340. if (true !== $validation = $validator($values[0])) {
  2341. throw new \RuntimeException(sprintf(
  2342. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2343. $values[0]
  2344. ));
  2345. }
  2346. $normalizedValue = $normalizer($values[0]);
  2347. if ($key === 'disable-tls') {
  2348. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2349. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2350. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2351. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2352. }
  2353. }
  2354. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2355. }
  2356. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2357. {
  2358. list($validator, $normalizer) = $callbacks;
  2359. if (true !== $validation = $validator($values)) {
  2360. throw new \RuntimeException(sprintf(
  2361. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2362. json_encode($values)
  2363. ));
  2364. }
  2365. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2366. }
  2367. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2368. {
  2369. $origK = $k;
  2370. $io = $this->getIO();
  2371. foreach ($contents as $key => $value) {
  2372. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2373. continue;
  2374. }
  2375. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2376. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2377. $k .= preg_replace('{^config\.}', '', $key . '.');
  2378. $this->listConfiguration($value, $rawVal, $output, $k);
  2379. $k = $origK;
  2380. continue;
  2381. }
  2382. if (is_array($value)) {
  2383. $value = array_map(function ($val) {
  2384. return is_array($val) ? json_encode($val) : $val;
  2385. }, $value);
  2386. $value = '['.implode(', ', $value).']';
  2387. }
  2388. if (is_bool($value)) {
  2389. $value = var_export($value, true);
  2390. }
  2391. if (is_string($rawVal) && $rawVal != $value) {
  2392. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2393. } else {
  2394. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2395. }
  2396. }
  2397. }
  2398. }
  2399. <?php
  2400. namespace Composer\Command;
  2401. use Composer\Config;
  2402. use Composer\Factory;
  2403. use Composer\Installer;
  2404. use Composer\Installer\ProjectInstaller;
  2405. use Composer\Installer\InstallationManager;
  2406. use Composer\Installer\SuggestedPackagesReporter;
  2407. use Composer\IO\IOInterface;
  2408. use Composer\Package\BasePackage;
  2409. use Composer\DependencyResolver\Pool;
  2410. use Composer\DependencyResolver\Operation\InstallOperation;
  2411. use Composer\Package\Version\VersionSelector;
  2412. use Composer\Package\AliasPackage;
  2413. use Composer\Repository\RepositoryFactory;
  2414. use Composer\Repository\CompositeRepository;
  2415. use Composer\Repository\PlatformRepository;
  2416. use Composer\Repository\InstalledFilesystemRepository;
  2417. use Composer\Script\ScriptEvents;
  2418. use Composer\Util\Silencer;
  2419. use Symfony\Component\Console\Input\InputArgument;
  2420. use Symfony\Component\Console\Input\InputInterface;
  2421. use Symfony\Component\Console\Input\InputOption;
  2422. use Symfony\Component\Console\Output\OutputInterface;
  2423. use Symfony\Component\Finder\Finder;
  2424. use Composer\Json\JsonFile;
  2425. use Composer\Config\JsonConfigSource;
  2426. use Composer\Util\Filesystem;
  2427. use Composer\Package\Version\VersionParser;
  2428. use Composer\EventDispatcher\EventDispatcher;
  2429. class CreateProjectCommand extends BaseCommand
  2430. {
  2431. protected $suggestedPackagesReporter;
  2432. protected function configure()
  2433. {
  2434. $this
  2435. ->setName('create-project')
  2436. ->setDescription('Creates new project from a package into given directory.')
  2437. ->setDefinition(array(
  2438. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2439. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2440. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2441. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2442. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2443. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2444. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2445. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2446. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the repository option to the composer.json.'),
  2447. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2448. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2449. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2450. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2451. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2452. 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.'),
  2453. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2454. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2455. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2456. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2457. ))
  2458. ->setHelp(
  2459. <<<EOT
  2460. The <info>create-project</info> command creates a new project from a given
  2461. package into a new directory. If executed without params and in a directory
  2462. with a composer.json file it installs the packages for the current project.
  2463. You can use this command to bootstrap new projects or setup a clean
  2464. version-controlled installation for developers of your project.
  2465. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2466. You can also specify the version with the package name using = or : as separator.
  2467. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2468. To install unstable packages, either specify the version you want, or use the
  2469. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2470. To setup a developer workable version you should create the project using the source
  2471. controlled code by appending the <info>'--prefer-source'</info> flag.
  2472. To install a package from another repository than the default one you
  2473. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2474. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2475. EOT
  2476. )
  2477. ;
  2478. }
  2479. protected function execute(InputInterface $input, OutputInterface $output)
  2480. {
  2481. $config = Factory::createConfig();
  2482. $io = $this->getIO();
  2483. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2484. if ($input->getOption('dev')) {
  2485. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2486. }
  2487. if ($input->getOption('no-custom-installers')) {
  2488. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2489. $input->setOption('no-plugins', true);
  2490. }
  2491. return $this->installProject(
  2492. $io,
  2493. $config,
  2494. $input,
  2495. $input->getArgument('package'),
  2496. $input->getArgument('directory'),
  2497. $input->getArgument('version'),
  2498. $input->getOption('stability'),
  2499. $preferSource,
  2500. $preferDist,
  2501. !$input->getOption('no-dev'),
  2502. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2503. $input->getOption('no-plugins'),
  2504. $input->getOption('no-scripts'),
  2505. $input->getOption('no-progress'),
  2506. $input->getOption('no-install'),
  2507. $input->getOption('ignore-platform-reqs'),
  2508. !$input->getOption('no-secure-http'),
  2509. $input->getOption('add-repository')
  2510. );
  2511. }
  2512. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $addRepository = false)
  2513. {
  2514. $oldCwd = getcwd();
  2515. $io->loadConfiguration($config);
  2516. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2517. if ($packageName !== null) {
  2518. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2519. } else {
  2520. $installedFromVcs = false;
  2521. }
  2522. $composer = Factory::create($io, null, $disablePlugins);
  2523. if ($repository !== null && $addRepository) {
  2524. if ($composer->getLocker()->isLocked()) {
  2525. $io->writeError('<error>Adding a repository when creating a project that provides a composer.lock file is not supported</error>');
  2526. return false;
  2527. }
  2528. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repository, true);
  2529. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  2530. $name = RepositoryFactory::generateRepositoryName(0, $repoConfig, $composerJsonRepositoriesConfig);
  2531. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2532. $configSource->addRepository($name, $repoConfig);
  2533. $composer = Factory::create($io, null, $disablePlugins);
  2534. }
  2535. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2536. $fs = new Filesystem();
  2537. if ($noScripts === false) {
  2538. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2539. }
  2540. $config = $composer->getConfig();
  2541. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2542. if ($noInstall === false) {
  2543. $installer = Installer::create($io, $composer);
  2544. $installer->setPreferSource($preferSource)
  2545. ->setPreferDist($preferDist)
  2546. ->setDevMode($installDevPackages)
  2547. ->setRunScripts(!$noScripts)
  2548. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2549. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2550. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2551. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2552. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2553. if ($disablePlugins) {
  2554. $installer->disablePlugins();
  2555. }
  2556. $status = $installer->run();
  2557. if (0 !== $status) {
  2558. return $status;
  2559. }
  2560. }
  2561. $hasVcs = $installedFromVcs;
  2562. if (
  2563. !$input->getOption('keep-vcs')
  2564. && $installedFromVcs
  2565. && (
  2566. $input->getOption('remove-vcs')
  2567. || !$io->isInteractive()
  2568. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2569. )
  2570. ) {
  2571. $finder = new Finder();
  2572. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2573. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2574. $finder->name($vcsName);
  2575. }
  2576. try {
  2577. $dirs = iterator_to_array($finder);
  2578. unset($finder);
  2579. foreach ($dirs as $dir) {
  2580. if (!$fs->removeDirectory($dir)) {
  2581. throw new \RuntimeException('Could not remove '.$dir);
  2582. }
  2583. }
  2584. } catch (\Exception $e) {
  2585. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2586. }
  2587. $hasVcs = false;
  2588. }
  2589. if (!$hasVcs) {
  2590. $package = $composer->getPackage();
  2591. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2592. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2593. foreach ($package->{'get'.$meta['method']}() as $link) {
  2594. if ($link->getPrettyConstraint() === 'self.version') {
  2595. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2596. }
  2597. }
  2598. }
  2599. }
  2600. if ($noScripts === false) {
  2601. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2602. }
  2603. chdir($oldCwd);
  2604. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2605. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2606. Silencer::call('rmdir', $vendorComposerDir);
  2607. $vendorDir = $config->get('vendor-dir');
  2608. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2609. Silencer::call('rmdir', $vendorDir);
  2610. }
  2611. }
  2612. return 0;
  2613. }
  2614. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2615. {
  2616. if (!$secureHttp) {
  2617. $config->merge(array('config' => array('secure-http' => false)));
  2618. }
  2619. $composer = Factory::create($io, $config->all(), $disablePlugins);
  2620. $config = $composer->getConfig();
  2621. $rm = $composer->getRepositoryManager();
  2622. if (null === $repository) {
  2623. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm));
  2624. } else {
  2625. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true, $rm);
  2626. }
  2627. $parser = new VersionParser();
  2628. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2629. $name = strtolower($requirements[0]['name']);
  2630. if (!$packageVersion && isset($requirements[0]['version'])) {
  2631. $packageVersion = $requirements[0]['version'];
  2632. }
  2633. if (null === $directory) {
  2634. $parts = explode("/", $name, 2);
  2635. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2636. }
  2637. $fs = new Filesystem();
  2638. if (!$fs->isAbsolutePath($directory)) {
  2639. $directory = getcwd() . DIRECTORY_SEPARATOR . $directory;
  2640. }
  2641. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(getcwd(), $directory, true) . '"</info>');
  2642. if (file_exists($directory)) {
  2643. if (!is_dir($directory)) {
  2644. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  2645. } elseif (!$fs->isDirEmpty($directory)) {
  2646. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  2647. }
  2648. }
  2649. if (null === $stability) {
  2650. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2651. $stability = $match[1];
  2652. } else {
  2653. $stability = VersionParser::parseStability($packageVersion);
  2654. }
  2655. }
  2656. $stability = VersionParser::normalizeStability($stability);
  2657. if (!isset(BasePackage::$stabilities[$stability])) {
  2658. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2659. }
  2660. $pool = new Pool($stability);
  2661. $pool->addRepository($sourceRepo);
  2662. $phpVersion = null;
  2663. $prettyPhpVersion = null;
  2664. if (!$ignorePlatformReqs) {
  2665. $platformOverrides = $config->get('platform') ?: array();
  2666. $platform = new PlatformRepository(array(), $platformOverrides);
  2667. $phpPackage = $platform->findPackage('php', '*');
  2668. $phpVersion = $phpPackage->getVersion();
  2669. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2670. }
  2671. $versionSelector = new VersionSelector($pool);
  2672. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2673. if (!$package) {
  2674. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2675. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2676. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2677. }
  2678. throw new \InvalidArgumentException($errorMessage .'.');
  2679. }
  2680. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  2681. @mkdir($directory, 0777, true);
  2682. if ($realDir = realpath($directory)) {
  2683. pcntl_async_signals(true);
  2684. pcntl_signal(SIGINT, function () use ($realDir) {
  2685. $fs = new Filesystem();
  2686. $fs->removeDirectory($realDir);
  2687. exit(130);
  2688. });
  2689. }
  2690. }
  2691. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2692. if ($disablePlugins) {
  2693. $io->writeError('<info>Plugins have been disabled.</info>');
  2694. }
  2695. if ($package instanceof AliasPackage) {
  2696. $package = $package->getAliasOf();
  2697. }
  2698. $dm = $composer->getDownloadManager();
  2699. $dm->setPreferSource($preferSource)
  2700. ->setPreferDist($preferDist)
  2701. ->setOutputProgress(!$noProgress);
  2702. $projectInstaller = new ProjectInstaller($directory, $dm);
  2703. $im = $composer->getInstallationManager();
  2704. $im->addInstaller($projectInstaller);
  2705. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2706. $im->notifyInstalls($io);
  2707. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2708. $installedFromVcs = 'source' === $package->getInstallationSource();
  2709. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2710. chdir($directory);
  2711. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2712. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2713. return $installedFromVcs;
  2714. }
  2715. }
  2716. <?php
  2717. namespace Composer\Command;
  2718. use Symfony\Component\Console\Input\InputInterface;
  2719. use Symfony\Component\Console\Output\OutputInterface;
  2720. class DependsCommand extends BaseDependencyCommand
  2721. {
  2722. protected function configure()
  2723. {
  2724. parent::configure();
  2725. $this
  2726. ->setName('depends')
  2727. ->setAliases(array('why'))
  2728. ->setDescription('Shows which packages cause the given package to be installed.')
  2729. ->setHelp(
  2730. <<<EOT
  2731. Displays detailed information about where a package is referenced.
  2732. <info>php composer.phar depends composer/composer</info>
  2733. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2734. EOT
  2735. )
  2736. ;
  2737. }
  2738. protected function execute(InputInterface $input, OutputInterface $output)
  2739. {
  2740. return parent::doExecute($input, $output, false);
  2741. }
  2742. }
  2743. <?php
  2744. namespace Composer\Command;
  2745. use Composer\Composer;
  2746. use Composer\Factory;
  2747. use Composer\Config;
  2748. use Composer\Downloader\TransportException;
  2749. use Composer\Repository\PlatformRepository;
  2750. use Composer\Plugin\CommandEvent;
  2751. use Composer\Plugin\PluginEvents;
  2752. use Composer\Util\ConfigValidator;
  2753. use Composer\Util\IniHelper;
  2754. use Composer\Util\ProcessExecutor;
  2755. use Composer\Util\RemoteFilesystem;
  2756. use Composer\Util\StreamContextFactory;
  2757. use Composer\SelfUpdate\Keys;
  2758. use Composer\SelfUpdate\Versions;
  2759. use Composer\IO\NullIO;
  2760. use Symfony\Component\Console\Input\InputInterface;
  2761. use Symfony\Component\Console\Output\OutputInterface;
  2762. class DiagnoseCommand extends BaseCommand
  2763. {
  2764. protected $rfs;
  2765. protected $process;
  2766. protected $exitCode = 0;
  2767. protected function configure()
  2768. {
  2769. $this
  2770. ->setName('diagnose')
  2771. ->setDescription('Diagnoses the system to identify common errors.')
  2772. ->setHelp(
  2773. <<<EOT
  2774. The <info>diagnose</info> command checks common errors to help debugging problems.
  2775. The process exit code will be 1 in case of warnings and 2 for errors.
  2776. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2777. EOT
  2778. )
  2779. ;
  2780. }
  2781. protected function execute(InputInterface $input, OutputInterface $output)
  2782. {
  2783. $composer = $this->getComposer(false);
  2784. $io = $this->getIO();
  2785. if ($composer) {
  2786. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2787. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2788. $io->write('Checking composer.json: ', false);
  2789. $this->outputResult($this->checkComposerSchema());
  2790. }
  2791. if ($composer) {
  2792. $config = $composer->getConfig();
  2793. } else {
  2794. $config = Factory::createConfig();
  2795. }
  2796. $config->merge(array('config' => array('secure-http' => false)));
  2797. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2798. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2799. $this->process = new ProcessExecutor($io);
  2800. $io->write('Checking platform settings: ', false);
  2801. $this->outputResult($this->checkPlatform());
  2802. $io->write('Checking git settings: ', false);
  2803. $this->outputResult($this->checkGit());
  2804. $io->write('Checking http connectivity to packagist: ', false);
  2805. $this->outputResult($this->checkHttp('http', $config));
  2806. $io->write('Checking https connectivity to packagist: ', false);
  2807. $this->outputResult($this->checkHttp('https', $config));
  2808. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2809. if (!empty($opts['http']['proxy'])) {
  2810. $io->write('Checking HTTP proxy: ', false);
  2811. $this->outputResult($this->checkHttpProxy());
  2812. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2813. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2814. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2815. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2816. }
  2817. if ($oauth = $config->get('github-oauth')) {
  2818. foreach ($oauth as $domain => $token) {
  2819. $io->write('Checking '.$domain.' oauth access: ', false);
  2820. $this->outputResult($this->checkGithubOauth($domain, $token));
  2821. }
  2822. } else {
  2823. $io->write('Checking github.com rate limit: ', false);
  2824. try {
  2825. $rate = $this->getGithubRateLimit('github.com');
  2826. if (!is_array($rate)) {
  2827. $this->outputResult($rate);
  2828. } elseif (10 > $rate['remaining']) {
  2829. $io->write('<warning>WARNING</warning>');
  2830. $io->write(sprintf(
  2831. '<comment>Github has a rate limit on their API. '
  2832. . 'You currently have <options=bold>%u</options=bold> '
  2833. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2834. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2835. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2836. $rate['remaining'],
  2837. $rate['limit']
  2838. ));
  2839. } else {
  2840. $this->outputResult(true);
  2841. }
  2842. } catch (\Exception $e) {
  2843. if ($e instanceof TransportException && $e->getCode() === 401) {
  2844. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2845. } else {
  2846. $this->outputResult($e);
  2847. }
  2848. }
  2849. }
  2850. $io->write('Checking disk free space: ', false);
  2851. $this->outputResult($this->checkDiskSpace($config));
  2852. if ('phar:' === substr(__FILE__, 0, 5)) {
  2853. $io->write('Checking pubkeys: ', false);
  2854. $this->outputResult($this->checkPubKeys($config));
  2855. $io->write('Checking composer version: ', false);
  2856. $this->outputResult($this->checkVersion($config));
  2857. }
  2858. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2859. $platformOverrides = $config->get('platform') ?: array();
  2860. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2861. $phpPkg = $platformRepo->findPackage('php', '*');
  2862. $phpVersion = $phpPkg->getPrettyVersion();
  2863. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2864. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2865. }
  2866. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2867. if (defined('PHP_BINARY')) {
  2868. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2869. }
  2870. $io->write(sprintf('OpenSSL version: <comment>%s</comment>', OPENSSL_VERSION_TEXT));
  2871. return $this->exitCode;
  2872. }
  2873. private function checkComposerSchema()
  2874. {
  2875. $validator = new ConfigValidator($this->getIO());
  2876. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2877. if ($errors || $warnings) {
  2878. $messages = array(
  2879. 'error' => $errors,
  2880. 'warning' => $warnings,
  2881. );
  2882. $output = '';
  2883. foreach ($messages as $style => $msgs) {
  2884. foreach ($msgs as $msg) {
  2885. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2886. }
  2887. }
  2888. return rtrim($output);
  2889. }
  2890. return true;
  2891. }
  2892. private function checkGit()
  2893. {
  2894. $this->process->execute('git config color.ui', $output);
  2895. if (strtolower(trim($output)) === 'always') {
  2896. 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>';
  2897. }
  2898. return true;
  2899. }
  2900. private function checkHttp($proto, Config $config)
  2901. {
  2902. $result = $this->checkConnectivity();
  2903. if ($result !== true) {
  2904. return $result;
  2905. }
  2906. $disableTls = false;
  2907. $result = array();
  2908. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2909. $disableTls = true;
  2910. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2911. }
  2912. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2913. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2914. }
  2915. try {
  2916. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2917. } catch (TransportException $e) {
  2918. if (false !== strpos($e->getMessage(), 'cafile')) {
  2919. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2920. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2921. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2922. } else {
  2923. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2924. }
  2925. }
  2926. if (count($result) > 0) {
  2927. return $result;
  2928. }
  2929. return true;
  2930. }
  2931. private function checkHttpProxy()
  2932. {
  2933. $result = $this->checkConnectivity();
  2934. if ($result !== true) {
  2935. return $result;
  2936. }
  2937. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2938. try {
  2939. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2940. $hash = reset($json['provider-includes']);
  2941. $hash = $hash['sha256'];
  2942. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2943. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2944. if (hash('sha256', $provider) !== $hash) {
  2945. return 'It seems that your proxy is modifying http traffic on the fly';
  2946. }
  2947. } catch (\Exception $e) {
  2948. return $e;
  2949. }
  2950. return true;
  2951. }
  2952. private function checkHttpProxyFullUriRequestParam()
  2953. {
  2954. $result = $this->checkConnectivity();
  2955. if ($result !== true) {
  2956. return $result;
  2957. }
  2958. $url = 'http://repo.packagist.org/packages.json';
  2959. try {
  2960. $this->rfs->getContents('packagist.org', $url, false);
  2961. } catch (TransportException $e) {
  2962. try {
  2963. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2964. } catch (TransportException $e) {
  2965. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2966. }
  2967. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2968. }
  2969. return true;
  2970. }
  2971. private function checkHttpsProxyFullUriRequestParam()
  2972. {
  2973. $result = $this->checkConnectivity();
  2974. if ($result !== true) {
  2975. return $result;
  2976. }
  2977. if (!extension_loaded('openssl')) {
  2978. return 'You need the openssl extension installed for this check';
  2979. }
  2980. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2981. try {
  2982. $this->rfs->getContents('github.com', $url, false);
  2983. } catch (TransportException $e) {
  2984. try {
  2985. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2986. } catch (TransportException $e) {
  2987. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2988. }
  2989. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2990. }
  2991. return true;
  2992. }
  2993. private function checkGithubOauth($domain, $token)
  2994. {
  2995. $result = $this->checkConnectivity();
  2996. if ($result !== true) {
  2997. return $result;
  2998. }
  2999. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3000. try {
  3001. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  3002. return $this->rfs->getContents($domain, $url, false, array(
  3003. 'retry-auth-failure' => false,
  3004. )) ? true : 'Unexpected error';
  3005. } catch (\Exception $e) {
  3006. if ($e instanceof TransportException && $e->getCode() === 401) {
  3007. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  3008. }
  3009. return $e;
  3010. }
  3011. }
  3012. private function getGithubRateLimit($domain, $token = null)
  3013. {
  3014. $result = $this->checkConnectivity();
  3015. if ($result !== true) {
  3016. return $result;
  3017. }
  3018. if ($token) {
  3019. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3020. }
  3021. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  3022. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  3023. $data = json_decode($json, true);
  3024. return $data['resources']['core'];
  3025. }
  3026. private function checkDiskSpace($config)
  3027. {
  3028. $minSpaceFree = 1024 * 1024;
  3029. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  3030. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  3031. ) {
  3032. return '<error>The disk hosting '.$dir.' is full</error>';
  3033. }
  3034. return true;
  3035. }
  3036. private function checkPubKeys($config)
  3037. {
  3038. $home = $config->get('home');
  3039. $errors = array();
  3040. $io = $this->getIO();
  3041. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  3042. $io->write('');
  3043. }
  3044. if (file_exists($home.'/keys.tags.pub')) {
  3045. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  3046. } else {
  3047. $errors[] = '<error>Missing pubkey for tags verification</error>';
  3048. }
  3049. if (file_exists($home.'/keys.dev.pub')) {
  3050. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  3051. } else {
  3052. $errors[] = '<error>Missing pubkey for dev verification</error>';
  3053. }
  3054. if ($errors) {
  3055. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  3056. }
  3057. return $errors ?: true;
  3058. }
  3059. private function checkVersion($config)
  3060. {
  3061. $result = $this->checkConnectivity();
  3062. if ($result !== true) {
  3063. return $result;
  3064. }
  3065. $versionsUtil = new Versions($config, $this->rfs);
  3066. try {
  3067. $latest = $versionsUtil->getLatest();
  3068. } catch (\Exception $e) {
  3069. return $e;
  3070. }
  3071. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  3072. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  3073. }
  3074. return true;
  3075. }
  3076. private function outputResult($result)
  3077. {
  3078. $io = $this->getIO();
  3079. if (true === $result) {
  3080. $io->write('<info>OK</info>');
  3081. return;
  3082. }
  3083. $hadError = false;
  3084. $hadWarning = false;
  3085. if ($result instanceof \Exception) {
  3086. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  3087. }
  3088. if (!$result) {
  3089. $hadError = true;
  3090. } else {
  3091. if (!is_array($result)) {
  3092. $result = array($result);
  3093. }
  3094. foreach ($result as $message) {
  3095. if (false !== strpos($message, '<error>')) {
  3096. $hadError = true;
  3097. } elseif (false !== strpos($message, '<warning>')) {
  3098. $hadWarning = true;
  3099. }
  3100. }
  3101. }
  3102. if ($hadError) {
  3103. $io->write('<error>FAIL</error>');
  3104. $this->exitCode = max($this->exitCode, 2);
  3105. } elseif ($hadWarning) {
  3106. $io->write('<warning>WARNING</warning>');
  3107. $this->exitCode = max($this->exitCode, 1);
  3108. }
  3109. if ($result) {
  3110. foreach ($result as $message) {
  3111. $io->write($message);
  3112. }
  3113. }
  3114. }
  3115. private function checkPlatform()
  3116. {
  3117. $output = '';
  3118. $out = function ($msg, $style) use (&$output) {
  3119. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  3120. };
  3121. $errors = array();
  3122. $warnings = array();
  3123. $displayIniMessage = false;
  3124. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  3125. $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.';
  3126. if (!function_exists('json_decode')) {
  3127. $errors['json'] = true;
  3128. }
  3129. if (!extension_loaded('Phar')) {
  3130. $errors['phar'] = true;
  3131. }
  3132. if (!extension_loaded('filter')) {
  3133. $errors['filter'] = true;
  3134. }
  3135. if (!extension_loaded('hash')) {
  3136. $errors['hash'] = true;
  3137. }
  3138. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  3139. $errors['iconv_mbstring'] = true;
  3140. }
  3141. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  3142. $errors['allow_url_fopen'] = true;
  3143. }
  3144. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  3145. $errors['ioncube'] = ioncube_loader_version();
  3146. }
  3147. if (PHP_VERSION_ID < 50302) {
  3148. $errors['php'] = PHP_VERSION;
  3149. }
  3150. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  3151. $warnings['php'] = PHP_VERSION;
  3152. }
  3153. if (!extension_loaded('openssl')) {
  3154. $errors['openssl'] = true;
  3155. }
  3156. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  3157. $warnings['openssl_version'] = true;
  3158. }
  3159. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  3160. $warnings['apc_cli'] = true;
  3161. }
  3162. if (!extension_loaded('zlib')) {
  3163. $warnings['zlib'] = true;
  3164. }
  3165. ob_start();
  3166. phpinfo(INFO_GENERAL);
  3167. $phpinfo = ob_get_clean();
  3168. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3169. $configure = $match[1];
  3170. if (false !== strpos($configure, '--enable-sigchild')) {
  3171. $warnings['sigchild'] = true;
  3172. }
  3173. if (false !== strpos($configure, '--with-curlwrappers')) {
  3174. $warnings['curlwrappers'] = true;
  3175. }
  3176. }
  3177. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3178. $warnings['xdebug_profile'] = true;
  3179. } elseif (extension_loaded('xdebug')) {
  3180. $warnings['xdebug_loaded'] = true;
  3181. }
  3182. if (defined('PHP_WINDOWS_VERSION_BUILD')
  3183. && (version_compare(PHP_VERSION, '7.2.23', '<')
  3184. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  3185. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  3186. $warnings['onedrive'] = PHP_VERSION;
  3187. }
  3188. if (!empty($errors)) {
  3189. foreach ($errors as $error => $current) {
  3190. switch ($error) {
  3191. case 'json':
  3192. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3193. $text .= "Install it or recompile php without --disable-json";
  3194. break;
  3195. case 'phar':
  3196. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3197. $text .= "Install it or recompile php without --disable-phar";
  3198. break;
  3199. case 'filter':
  3200. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3201. $text .= "Install it or recompile php without --disable-filter";
  3202. break;
  3203. case 'hash':
  3204. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3205. $text .= "Install it or recompile php without --disable-hash";
  3206. break;
  3207. case 'iconv_mbstring':
  3208. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3209. $text .= "Install either of them or recompile php without --disable-iconv";
  3210. break;
  3211. case 'unicode':
  3212. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3213. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3214. $text .= " detect_unicode = Off";
  3215. $displayIniMessage = true;
  3216. break;
  3217. case 'suhosin':
  3218. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3219. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  3220. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3221. $displayIniMessage = true;
  3222. break;
  3223. case 'php':
  3224. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3225. break;
  3226. case 'allow_url_fopen':
  3227. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3228. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3229. $text .= " allow_url_fopen = On";
  3230. $displayIniMessage = true;
  3231. break;
  3232. case 'ioncube':
  3233. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3234. $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;
  3235. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3236. $displayIniMessage = true;
  3237. break;
  3238. case 'openssl':
  3239. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3240. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3241. break;
  3242. }
  3243. $out($text, 'error');
  3244. }
  3245. $output .= PHP_EOL;
  3246. }
  3247. if (!empty($warnings)) {
  3248. foreach ($warnings as $warning => $current) {
  3249. switch ($warning) {
  3250. case 'apc_cli':
  3251. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3252. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3253. $text .= " apc.enable_cli = Off";
  3254. $displayIniMessage = true;
  3255. break;
  3256. case 'zlib':
  3257. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3258. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3259. $displayIniMessage = true;
  3260. break;
  3261. case 'sigchild':
  3262. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3263. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3264. $text .= " https://bugs.php.net/bug.php?id=22999";
  3265. break;
  3266. case 'curlwrappers':
  3267. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3268. $text .= " Recompile it without this flag if possible";
  3269. break;
  3270. case 'php':
  3271. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3272. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3273. break;
  3274. case 'openssl_version':
  3275. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3276. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3277. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3278. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3279. break;
  3280. case 'xdebug_loaded':
  3281. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3282. $text .= " Disabling it when using Composer is recommended.";
  3283. break;
  3284. case 'xdebug_profile':
  3285. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3286. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3287. $text .= " xdebug.profiler_enabled = 0";
  3288. $displayIniMessage = true;
  3289. break;
  3290. case 'onedrive':
  3291. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  3292. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  3293. break;
  3294. }
  3295. $out($text, 'comment');
  3296. }
  3297. }
  3298. if ($displayIniMessage) {
  3299. $out($iniMessage, 'comment');
  3300. }
  3301. return !$warnings && !$errors ? true : $output;
  3302. }
  3303. private function checkConnectivity()
  3304. {
  3305. if (!ini_get('allow_url_fopen')) {
  3306. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3307. return $result;
  3308. }
  3309. return true;
  3310. }
  3311. }
  3312. <?php
  3313. namespace Composer\Command;
  3314. use Composer\Plugin\CommandEvent;
  3315. use Composer\Plugin\PluginEvents;
  3316. use Symfony\Component\Console\Input\InputInterface;
  3317. use Symfony\Component\Console\Input\InputOption;
  3318. use Symfony\Component\Console\Output\OutputInterface;
  3319. class DumpAutoloadCommand extends BaseCommand
  3320. {
  3321. protected function configure()
  3322. {
  3323. $this
  3324. ->setName('dump-autoload')
  3325. ->setAliases(array('dumpautoload'))
  3326. ->setDescription('Dumps the autoloader.')
  3327. ->setDefinition(array(
  3328. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3329. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3330. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3331. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3332. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3333. ))
  3334. ->setHelp(
  3335. <<<EOT
  3336. <info>php composer.phar dump-autoload</info>
  3337. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3338. EOT
  3339. )
  3340. ;
  3341. }
  3342. protected function execute(InputInterface $input, OutputInterface $output)
  3343. {
  3344. $composer = $this->getComposer();
  3345. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3346. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3347. $installationManager = $composer->getInstallationManager();
  3348. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3349. $package = $composer->getPackage();
  3350. $config = $composer->getConfig();
  3351. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3352. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3353. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3354. if ($authoritative) {
  3355. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  3356. } elseif ($optimize) {
  3357. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  3358. } else {
  3359. $this->getIO()->write('<info>Generating autoload files</info>');
  3360. }
  3361. $generator = $composer->getAutoloadGenerator();
  3362. $generator->setDevMode(!$input->getOption('no-dev'));
  3363. $generator->setClassMapAuthoritative($authoritative);
  3364. $generator->setApcu($apcu);
  3365. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3366. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3367. if ($authoritative) {
  3368. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3369. } elseif ($optimize) {
  3370. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3371. } else {
  3372. $this->getIO()->write('<info>Generated autoload files</info>');
  3373. }
  3374. return 0;
  3375. }
  3376. }
  3377. <?php
  3378. namespace Composer\Command;
  3379. use Symfony\Component\Console\Input\InputInterface;
  3380. use Symfony\Component\Console\Input\InputOption;
  3381. use Symfony\Component\Console\Output\OutputInterface;
  3382. use Symfony\Component\Console\Input\InputArgument;
  3383. class ExecCommand extends BaseCommand
  3384. {
  3385. protected function configure()
  3386. {
  3387. $this
  3388. ->setName('exec')
  3389. ->setDescription('Executes a vendored binary/script.')
  3390. ->setDefinition(array(
  3391. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3392. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3393. new InputArgument(
  3394. 'args',
  3395. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3396. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3397. ),
  3398. ))
  3399. ->setHelp(
  3400. <<<EOT
  3401. Executes a vendored binary/script.
  3402. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3403. EOT
  3404. )
  3405. ;
  3406. }
  3407. protected function execute(InputInterface $input, OutputInterface $output)
  3408. {
  3409. $composer = $this->getComposer();
  3410. $binDir = $composer->getConfig()->get('bin-dir');
  3411. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3412. $bins = glob($binDir . '/*');
  3413. $bins = array_merge($bins, array_map(function ($e) {
  3414. return "$e (local)";
  3415. }, $composer->getPackage()->getBinaries()));
  3416. if (!$bins) {
  3417. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3418. }
  3419. $this->getIO()->write(
  3420. <<<EOT
  3421. <comment>Available binaries:</comment>
  3422. EOT
  3423. );
  3424. foreach ($bins as $bin) {
  3425. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3426. continue;
  3427. }
  3428. $previousBin = $bin;
  3429. $bin = basename($bin);
  3430. $this->getIO()->write(
  3431. <<<EOT
  3432. <info>- $bin</info>
  3433. EOT
  3434. );
  3435. }
  3436. return 0;
  3437. }
  3438. $binary = $input->getArgument('binary');
  3439. $dispatcher = $composer->getEventDispatcher();
  3440. $dispatcher->addListener('__exec_command', $binary);
  3441. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3442. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3443. }
  3444. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory()) {
  3445. try {
  3446. chdir($this->getApplication()->getInitialWorkingDirectory());
  3447. } catch (\Exception $e) {
  3448. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  3449. }
  3450. }
  3451. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3452. }
  3453. }
  3454. <?php
  3455. namespace Composer\Command;
  3456. use Composer\Package\CompletePackageInterface;
  3457. use Composer\Package\AliasPackage;
  3458. use Composer\Repository\CompositeRepository;
  3459. use Symfony\Component\Console\Input\InputInterface;
  3460. use Symfony\Component\Console\Input\InputOption;
  3461. use Symfony\Component\Console\Output\OutputInterface;
  3462. class FundCommand extends BaseCommand
  3463. {
  3464. protected function configure()
  3465. {
  3466. $this->setName('fund')
  3467. ->setDescription('Discover how to help fund the maintenance of your dependencies.')
  3468. ;
  3469. }
  3470. protected function execute(InputInterface $input, OutputInterface $output)
  3471. {
  3472. $composer = $this->getComposer();
  3473. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3474. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  3475. $fundings = array();
  3476. foreach ($repo->getPackages() as $package) {
  3477. if ($package instanceof AliasPackage) {
  3478. continue;
  3479. }
  3480. $latest = $remoteRepos->findPackage($package->getName(), 'dev-master');
  3481. if ($latest instanceof CompletePackageInterface && $latest->getFunding()) {
  3482. $fundings = $this->insertFundingData($fundings, $latest);
  3483. continue;
  3484. }
  3485. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  3486. $fundings = $this->insertFundingData($fundings, $package);
  3487. }
  3488. }
  3489. ksort($fundings);
  3490. $io = $this->getIO();
  3491. if ($fundings) {
  3492. $prev = null;
  3493. $io->write('The following packages were found in your dependencies which publish funding information:');
  3494. foreach ($fundings as $vendor => $links) {
  3495. $io->write('');
  3496. $io->write(sprintf("<comment>%s</comment>", $vendor));
  3497. foreach ($links as $url => $packages) {
  3498. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  3499. if ($prev !== $line) {
  3500. $io->write($line);
  3501. $prev = $line;
  3502. }
  3503. $io->write(sprintf(' %s', $url));
  3504. }
  3505. }
  3506. $io->write("");
  3507. $io->write("Please consider following these links and sponsoring the work of package authors!");
  3508. $io->write("Thank you!");
  3509. } else {
  3510. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  3511. }
  3512. return 0;
  3513. }
  3514. private function insertFundingData(array $fundings, CompletePackageInterface $package)
  3515. {
  3516. foreach ($package->getFunding() as $fundingOption) {
  3517. list($vendor, $packageName) = explode('/', $package->getPrettyName());
  3518. if (empty($fundingOption['url'])) {
  3519. continue;
  3520. }
  3521. $url = $fundingOption['url'];
  3522. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && preg_match('{^https://github.com/([^/]+)$}', $url, $match)) {
  3523. $url = 'https://github.com/sponsors/'.$match[1];
  3524. }
  3525. $fundings[$vendor][$url][] = $packageName;
  3526. }
  3527. return $fundings;
  3528. }
  3529. }
  3530. <?php
  3531. namespace Composer\Command;
  3532. use Composer\Factory;
  3533. use Composer\Util\Filesystem;
  3534. use Symfony\Component\Console\Input\InputInterface;
  3535. use Symfony\Component\Console\Input\InputArgument;
  3536. use Symfony\Component\Console\Input\StringInput;
  3537. use Symfony\Component\Console\Output\OutputInterface;
  3538. class GlobalCommand extends BaseCommand
  3539. {
  3540. protected function configure()
  3541. {
  3542. $this
  3543. ->setName('global')
  3544. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3545. ->setDefinition(array(
  3546. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3547. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3548. ))
  3549. ->setHelp(
  3550. <<<EOT
  3551. Use this command as a wrapper to run other Composer commands
  3552. within the global context of COMPOSER_HOME.
  3553. You can use this to install CLI utilities globally, all you need
  3554. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3555. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3556. and /home/<user>/.composer on unix systems.
  3557. If your system uses freedesktop.org standards, then it will first check
  3558. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3559. Note: This path may vary depending on customizations to bin-dir in
  3560. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3561. Read more at https://getcomposer.org/doc/03-cli.md#global
  3562. EOT
  3563. )
  3564. ;
  3565. }
  3566. public function run(InputInterface $input, OutputInterface $output)
  3567. {
  3568. $tokens = preg_split('{\s+}', $input->__toString());
  3569. $args = array();
  3570. foreach ($tokens as $token) {
  3571. if ($token && $token[0] !== '-') {
  3572. $args[] = $token;
  3573. if (count($args) >= 2) {
  3574. break;
  3575. }
  3576. }
  3577. }
  3578. if (count($args) < 2) {
  3579. return parent::run($input, $output);
  3580. }
  3581. $config = Factory::createConfig();
  3582. $home = $config->get('home');
  3583. if (!is_dir($home)) {
  3584. $fs = new Filesystem();
  3585. $fs->ensureDirectoryExists($home);
  3586. if (!is_dir($home)) {
  3587. throw new \RuntimeException('Could not create home directory');
  3588. }
  3589. }
  3590. try {
  3591. chdir($home);
  3592. } catch (\Exception $e) {
  3593. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3594. }
  3595. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3596. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3597. $this->getApplication()->resetComposer();
  3598. return $this->getApplication()->run($input, $output);
  3599. }
  3600. public function isProxyCommand()
  3601. {
  3602. return true;
  3603. }
  3604. }
  3605. <?php
  3606. namespace Composer\Command;
  3607. use Composer\Package\CompletePackageInterface;
  3608. use Composer\Repository\RepositoryInterface;
  3609. use Composer\Repository\ArrayRepository;
  3610. use Composer\Repository\RepositoryFactory;
  3611. use Composer\Util\Platform;
  3612. use Composer\Util\ProcessExecutor;
  3613. use Symfony\Component\Console\Input\InputArgument;
  3614. use Symfony\Component\Console\Input\InputOption;
  3615. use Symfony\Component\Console\Input\InputInterface;
  3616. use Symfony\Component\Console\Output\OutputInterface;
  3617. class HomeCommand extends BaseCommand
  3618. {
  3619. protected function configure()
  3620. {
  3621. $this
  3622. ->setName('browse')
  3623. ->setAliases(array('home'))
  3624. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3625. ->setDefinition(array(
  3626. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3627. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3628. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3629. ))
  3630. ->setHelp(
  3631. <<<EOT
  3632. The home command opens or shows a package's repository URL or
  3633. homepage in your default browser.
  3634. To open the homepage by default, use -H or --homepage.
  3635. To show instead of open the repository or homepage URL, use -s or --show.
  3636. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3637. EOT
  3638. );
  3639. }
  3640. protected function execute(InputInterface $input, OutputInterface $output)
  3641. {
  3642. $repos = $this->initializeRepos();
  3643. $io = $this->getIO();
  3644. $return = 0;
  3645. $packages = $input->getArgument('packages');
  3646. if (!$packages) {
  3647. $io->writeError('No package specified, opening homepage for the root package');
  3648. $packages = array($this->getComposer()->getPackage()->getName());
  3649. }
  3650. foreach ($packages as $packageName) {
  3651. $handled = false;
  3652. $packageExists = false;
  3653. foreach ($repos as $repo) {
  3654. foreach ($repo->findPackages($packageName) as $package) {
  3655. $packageExists = true;
  3656. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3657. $handled = true;
  3658. break 2;
  3659. }
  3660. }
  3661. }
  3662. if (!$packageExists) {
  3663. $return = 1;
  3664. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3665. }
  3666. if (!$handled) {
  3667. $return = 1;
  3668. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3669. }
  3670. }
  3671. return $return;
  3672. }
  3673. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3674. {
  3675. $support = $package->getSupport();
  3676. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3677. if (!$url || $showHomepage) {
  3678. $url = $package->getHomepage();
  3679. }
  3680. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3681. return false;
  3682. }
  3683. if ($showOnly) {
  3684. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3685. } else {
  3686. $this->openBrowser($url);
  3687. }
  3688. return true;
  3689. }
  3690. private function openBrowser($url)
  3691. {
  3692. $url = ProcessExecutor::escape($url);
  3693. $process = new ProcessExecutor($this->getIO());
  3694. if (Platform::isWindows()) {
  3695. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3696. }
  3697. $linux = $process->execute('which xdg-open', $output);
  3698. $osx = $process->execute('which open', $output);
  3699. if (0 === $linux) {
  3700. $process->execute('xdg-open ' . $url, $output);
  3701. } elseif (0 === $osx) {
  3702. $process->execute('open ' . $url, $output);
  3703. } else {
  3704. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3705. }
  3706. }
  3707. private function initializeRepos()
  3708. {
  3709. $composer = $this->getComposer(false);
  3710. if ($composer) {
  3711. return array_merge(
  3712. array(new ArrayRepository(array($composer->getPackage()))),
  3713. array($composer->getRepositoryManager()->getLocalRepository()),
  3714. $composer->getRepositoryManager()->getRepositories()
  3715. );
  3716. }
  3717. return RepositoryFactory::defaultRepos($this->getIO());
  3718. }
  3719. }
  3720. <?php
  3721. namespace Composer\Command;
  3722. use Composer\DependencyResolver\Pool;
  3723. use Composer\Factory;
  3724. use Composer\Json\JsonFile;
  3725. use Composer\Package\BasePackage;
  3726. use Composer\Package\Package;
  3727. use Composer\Package\Version\VersionParser;
  3728. use Composer\Package\Version\VersionSelector;
  3729. use Composer\Repository\CompositeRepository;
  3730. use Composer\Repository\PlatformRepository;
  3731. use Composer\Repository\RepositoryFactory;
  3732. use Composer\Util\ProcessExecutor;
  3733. use Symfony\Component\Console\Input\ArrayInput;
  3734. use Symfony\Component\Console\Input\InputInterface;
  3735. use Symfony\Component\Console\Input\InputOption;
  3736. use Symfony\Component\Console\Output\OutputInterface;
  3737. use Symfony\Component\Process\ExecutableFinder;
  3738. use Symfony\Component\Process\Process;
  3739. class InitCommand extends BaseCommand
  3740. {
  3741. protected $repos;
  3742. private $gitConfig;
  3743. private $pools;
  3744. protected function configure()
  3745. {
  3746. $this
  3747. ->setName('init')
  3748. ->setDescription('Creates a basic composer.json file in current directory.')
  3749. ->setDefinition(array(
  3750. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3751. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3752. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3753. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3754. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3755. 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"'),
  3756. 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"'),
  3757. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3758. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3759. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3760. ))
  3761. ->setHelp(
  3762. <<<EOT
  3763. The <info>init</info> command creates a basic composer.json file
  3764. in the current directory.
  3765. <info>php composer.phar init</info>
  3766. Read more at https://getcomposer.org/doc/03-cli.md#init
  3767. EOT
  3768. )
  3769. ;
  3770. }
  3771. protected function execute(InputInterface $input, OutputInterface $output)
  3772. {
  3773. $io = $this->getIO();
  3774. $allowList = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3775. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowList)));
  3776. if (isset($options['author'])) {
  3777. $options['authors'] = $this->formatAuthors($options['author']);
  3778. unset($options['author']);
  3779. }
  3780. $repositories = $input->getOption('repository');
  3781. if ($repositories) {
  3782. $config = Factory::createConfig($io);
  3783. foreach ($repositories as $repo) {
  3784. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3785. }
  3786. }
  3787. if (isset($options['stability'])) {
  3788. $options['minimum-stability'] = $options['stability'];
  3789. unset($options['stability']);
  3790. }
  3791. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3792. if (array() === $options['require']) {
  3793. $options['require'] = new \stdClass;
  3794. }
  3795. if (isset($options['require-dev'])) {
  3796. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3797. if (array() === $options['require-dev']) {
  3798. $options['require-dev'] = new \stdClass;
  3799. }
  3800. }
  3801. $file = new JsonFile(Factory::getComposerFile());
  3802. $json = $file->encode($options);
  3803. if ($input->isInteractive()) {
  3804. $io->writeError(array('', $json, ''));
  3805. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3806. $io->writeError('<error>Command aborted</error>');
  3807. return 1;
  3808. }
  3809. }
  3810. $file->write($options);
  3811. if ($input->isInteractive() && is_dir('.git')) {
  3812. $ignoreFile = realpath('.gitignore');
  3813. if (false === $ignoreFile) {
  3814. $ignoreFile = realpath('.') . '/.gitignore';
  3815. }
  3816. if (!$this->hasVendorIgnore($ignoreFile)) {
  3817. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3818. if ($io->askConfirmation($question, true)) {
  3819. $this->addVendorIgnore($ignoreFile);
  3820. }
  3821. }
  3822. }
  3823. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3824. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3825. $this->installDependencies($output);
  3826. }
  3827. return 0;
  3828. }
  3829. protected function interact(InputInterface $input, OutputInterface $output)
  3830. {
  3831. $git = $this->getGitConfig();
  3832. $io = $this->getIO();
  3833. $formatter = $this->getHelperSet()->get('formatter');
  3834. $repositories = $input->getOption('repository');
  3835. if ($repositories) {
  3836. $config = Factory::createConfig($io);
  3837. $repos = array(new PlatformRepository);
  3838. $createDefaultPackagistRepo = true;
  3839. foreach ($repositories as $repo) {
  3840. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3841. if (
  3842. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3843. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3844. ) {
  3845. $createDefaultPackagistRepo = false;
  3846. continue;
  3847. }
  3848. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3849. }
  3850. if ($createDefaultPackagistRepo) {
  3851. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3852. 'type' => 'composer',
  3853. 'url' => 'https://repo.packagist.org',
  3854. ));
  3855. }
  3856. $this->repos = new CompositeRepository($repos);
  3857. unset($repos, $config, $repositories);
  3858. }
  3859. $io->writeError(array(
  3860. '',
  3861. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3862. '',
  3863. ));
  3864. $io->writeError(array(
  3865. '',
  3866. 'This command will guide you through creating your composer.json config.',
  3867. '',
  3868. ));
  3869. $cwd = realpath(".");
  3870. if (!$name = $input->getOption('name')) {
  3871. $name = basename($cwd);
  3872. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3873. $name = strtolower($name);
  3874. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3875. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3876. } elseif (isset($git['github.user'])) {
  3877. $name = $git['github.user'] . '/' . $name;
  3878. } elseif (!empty($_SERVER['USERNAME'])) {
  3879. $name = $_SERVER['USERNAME'] . '/' . $name;
  3880. } elseif (!empty($_SERVER['USER'])) {
  3881. $name = $_SERVER['USER'] . '/' . $name;
  3882. } elseif (get_current_user()) {
  3883. $name = get_current_user() . '/' . $name;
  3884. } else {
  3885. $name .= '/' . $name;
  3886. }
  3887. $name = strtolower($name);
  3888. } else {
  3889. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3890. throw new \InvalidArgumentException(
  3891. 'The package name '.$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_.-]+'
  3892. );
  3893. }
  3894. }
  3895. $name = $io->askAndValidate(
  3896. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3897. function ($value) use ($name) {
  3898. if (null === $value) {
  3899. return $name;
  3900. }
  3901. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3902. throw new \InvalidArgumentException(
  3903. '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_.-]+'
  3904. );
  3905. }
  3906. return $value;
  3907. },
  3908. null,
  3909. $name
  3910. );
  3911. $input->setOption('name', $name);
  3912. $description = $input->getOption('description') ?: false;
  3913. $description = $io->ask(
  3914. 'Description [<comment>'.$description.'</comment>]: ',
  3915. $description
  3916. );
  3917. $input->setOption('description', $description);
  3918. if (null === $author = $input->getOption('author')) {
  3919. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3920. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3921. } elseif (isset($git['user.name'])) {
  3922. $author_name = $git['user.name'];
  3923. }
  3924. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3925. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3926. } elseif (isset($git['user.email'])) {
  3927. $author_email = $git['user.email'];
  3928. }
  3929. if (isset($author_name) && isset($author_email)) {
  3930. $author = sprintf('%s <%s>', $author_name, $author_email);
  3931. }
  3932. }
  3933. $self = $this;
  3934. $author = $io->askAndValidate(
  3935. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3936. function ($value) use ($self, $author) {
  3937. if ($value === 'n' || $value === 'no') {
  3938. return;
  3939. }
  3940. $value = $value ?: $author;
  3941. $author = $self->parseAuthorString($value);
  3942. return sprintf('%s <%s>', $author['name'], $author['email']);
  3943. },
  3944. null,
  3945. $author
  3946. );
  3947. $input->setOption('author', $author);
  3948. $minimumStability = $input->getOption('stability') ?: null;
  3949. $minimumStability = $io->askAndValidate(
  3950. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3951. function ($value) use ($minimumStability) {
  3952. if (null === $value) {
  3953. return $minimumStability;
  3954. }
  3955. if (!isset(BasePackage::$stabilities[$value])) {
  3956. throw new \InvalidArgumentException(
  3957. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3958. implode(', ', array_keys(BasePackage::$stabilities))
  3959. );
  3960. }
  3961. return $value;
  3962. },
  3963. null,
  3964. $minimumStability
  3965. );
  3966. $input->setOption('stability', $minimumStability);
  3967. $type = $input->getOption('type') ?: false;
  3968. $type = $io->ask(
  3969. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3970. $type
  3971. );
  3972. $input->setOption('type', $type);
  3973. if (null === $license = $input->getOption('license')) {
  3974. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3975. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3976. }
  3977. }
  3978. $license = $io->ask(
  3979. 'License [<comment>'.$license.'</comment>]: ',
  3980. $license
  3981. );
  3982. $input->setOption('license', $license);
  3983. $io->writeError(array('', 'Define your dependencies.', ''));
  3984. $repos = $this->getRepos();
  3985. $preferredStability = $minimumStability ?: 'stable';
  3986. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3987. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3988. $require = $input->getOption('require');
  3989. $requirements = array();
  3990. if ($require || $io->askConfirmation($question, true)) {
  3991. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3992. }
  3993. $input->setOption('require', $requirements);
  3994. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3995. $requireDev = $input->getOption('require-dev');
  3996. $devRequirements = array();
  3997. if ($requireDev || $io->askConfirmation($question, true)) {
  3998. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3999. }
  4000. $input->setOption('require-dev', $devRequirements);
  4001. }
  4002. public function parseAuthorString($author)
  4003. {
  4004. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  4005. if ($this->isValidEmail($match['email'])) {
  4006. return array(
  4007. 'name' => trim($match['name']),
  4008. 'email' => $match['email'],
  4009. );
  4010. }
  4011. }
  4012. throw new \InvalidArgumentException(
  4013. 'Invalid author string. Must be in the format: '.
  4014. 'John Smith <john@example.com>'
  4015. );
  4016. }
  4017. protected function findPackages($name)
  4018. {
  4019. return $this->getRepos()->search($name);
  4020. }
  4021. protected function getRepos()
  4022. {
  4023. if (!$this->repos) {
  4024. $this->repos = new CompositeRepository(array_merge(
  4025. array(new PlatformRepository),
  4026. RepositoryFactory::defaultRepos($this->getIO())
  4027. ));
  4028. }
  4029. return $this->repos;
  4030. }
  4031. final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
  4032. {
  4033. if ($requires) {
  4034. $requires = $this->normalizeRequirements($requires);
  4035. $result = array();
  4036. $io = $this->getIO();
  4037. foreach ($requires as $requirement) {
  4038. if (!isset($requirement['version'])) {
  4039. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, null, null, $fixed);
  4040. $requirement['version'] = $version;
  4041. $requirement['name'] = $name;
  4042. $io->writeError(sprintf(
  4043. 'Using version <info>%s</info> for <info>%s</info>',
  4044. $requirement['version'],
  4045. $requirement['name']
  4046. ));
  4047. } else {
  4048. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
  4049. $requirement['name'] = $name;
  4050. }
  4051. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  4052. }
  4053. return $result;
  4054. }
  4055. $versionParser = new VersionParser();
  4056. $composer = $this->getComposer(false);
  4057. $installedRepo = $composer ? $composer->getRepositoryManager()->getLocalRepository() : null;
  4058. $existingPackages = array();
  4059. if ($installedRepo) {
  4060. foreach ($installedRepo->getPackages() as $package) {
  4061. $existingPackages[] = $package->getName();
  4062. }
  4063. }
  4064. foreach ($requires as $requiredPackage) {
  4065. $existingPackages[] = substr($requiredPackage, 0, strpos($requiredPackage, ' '));
  4066. }
  4067. unset($composer, $installedRepo, $requiredPackage);
  4068. $io = $this->getIO();
  4069. while (null !== $package = $io->ask('Search for a package: ')) {
  4070. $matches = $this->findPackages($package);
  4071. if (count($matches)) {
  4072. foreach ($matches as $position => $foundPackage) {
  4073. if (in_array($foundPackage['name'], $existingPackages, true)) {
  4074. unset($matches[$position]);
  4075. }
  4076. }
  4077. $matches = array_values($matches);
  4078. $exactMatch = null;
  4079. $choices = array();
  4080. foreach ($matches as $position => $foundPackage) {
  4081. $abandoned = '';
  4082. if (isset($foundPackage['abandoned'])) {
  4083. if (is_string($foundPackage['abandoned'])) {
  4084. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  4085. } else {
  4086. $replacement = 'No replacement was suggested';
  4087. }
  4088. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  4089. }
  4090. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  4091. if ($foundPackage['name'] === $package) {
  4092. $exactMatch = true;
  4093. break;
  4094. }
  4095. }
  4096. if (!$exactMatch) {
  4097. $io->writeError(array(
  4098. '',
  4099. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  4100. '',
  4101. ));
  4102. $io->writeError($choices);
  4103. $io->writeError('');
  4104. $validator = function ($selection) use ($matches, $versionParser) {
  4105. if ('' === $selection) {
  4106. return false;
  4107. }
  4108. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  4109. $package = $matches[(int) $selection];
  4110. return $package['name'];
  4111. }
  4112. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  4113. if (isset($packageMatches['version'])) {
  4114. $versionParser->parseConstraints($packageMatches['version']);
  4115. return $packageMatches['name'].' '.$packageMatches['version'];
  4116. }
  4117. return $packageMatches['name'];
  4118. }
  4119. throw new \Exception('Not a valid selection');
  4120. };
  4121. $package = $io->askAndValidate(
  4122. 'Enter package # to add, or the complete package name if it is not listed: ',
  4123. $validator,
  4124. 3,
  4125. false
  4126. );
  4127. }
  4128. if (false !== $package && false === strpos($package, ' ')) {
  4129. $validator = function ($input) {
  4130. $input = trim($input);
  4131. return $input ?: false;
  4132. };
  4133. $constraint = $io->askAndValidate(
  4134. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  4135. $validator,
  4136. 3,
  4137. false
  4138. );
  4139. if (false === $constraint) {
  4140. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  4141. $io->writeError(sprintf(
  4142. 'Using version <info>%s</info> for <info>%s</info>',
  4143. $constraint,
  4144. $package
  4145. ));
  4146. }
  4147. $package .= ' '.$constraint;
  4148. }
  4149. if (false !== $package) {
  4150. $requires[] = $package;
  4151. $existingPackages[] = substr($package, 0, strpos($package, ' '));
  4152. }
  4153. }
  4154. }
  4155. return $requires;
  4156. }
  4157. protected function formatAuthors($author)
  4158. {
  4159. return array($this->parseAuthorString($author));
  4160. }
  4161. protected function formatRequirements(array $requirements)
  4162. {
  4163. $requires = array();
  4164. $requirements = $this->normalizeRequirements($requirements);
  4165. foreach ($requirements as $requirement) {
  4166. $requires[$requirement['name']] = $requirement['version'];
  4167. }
  4168. return $requires;
  4169. }
  4170. protected function getGitConfig()
  4171. {
  4172. if (null !== $this->gitConfig) {
  4173. return $this->gitConfig;
  4174. }
  4175. $finder = new ExecutableFinder();
  4176. $gitBin = $finder->find('git');
  4177. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  4178. $cmd = new Process(array($gitBin, 'config', '-l'));
  4179. } else {
  4180. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  4181. }
  4182. $cmd->run();
  4183. if ($cmd->isSuccessful()) {
  4184. $this->gitConfig = array();
  4185. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  4186. foreach ($matches as $match) {
  4187. $this->gitConfig[$match[1]] = $match[2];
  4188. }
  4189. return $this->gitConfig;
  4190. }
  4191. return $this->gitConfig = array();
  4192. }
  4193. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  4194. {
  4195. if (!file_exists($ignoreFile)) {
  4196. return false;
  4197. }
  4198. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  4199. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  4200. foreach ($lines as $line) {
  4201. if (preg_match($pattern, $line)) {
  4202. return true;
  4203. }
  4204. }
  4205. return false;
  4206. }
  4207. protected function normalizeRequirements(array $requirements)
  4208. {
  4209. $parser = new VersionParser();
  4210. return $parser->parseNameVersionPairs($requirements);
  4211. }
  4212. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  4213. {
  4214. $contents = "";
  4215. if (file_exists($ignoreFile)) {
  4216. $contents = file_get_contents($ignoreFile);
  4217. if ("\n" !== substr($contents, 0, -1)) {
  4218. $contents .= "\n";
  4219. }
  4220. }
  4221. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  4222. }
  4223. protected function isValidEmail($email)
  4224. {
  4225. if (!function_exists('filter_var')) {
  4226. return true;
  4227. }
  4228. if (PHP_VERSION_ID < 50303) {
  4229. return true;
  4230. }
  4231. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  4232. }
  4233. private function getPool(InputInterface $input, $minimumStability = null)
  4234. {
  4235. $key = $minimumStability ?: 'default';
  4236. if (!isset($this->pools[$key])) {
  4237. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  4238. $pool->addRepository($this->getRepos());
  4239. }
  4240. return $this->pools[$key];
  4241. }
  4242. private function getMinimumStability(InputInterface $input)
  4243. {
  4244. if ($input->hasOption('stability')) {
  4245. return VersionParser::normalizeStability($input->getOption('stability') ?: 'stable');
  4246. }
  4247. $file = Factory::getComposerFile();
  4248. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  4249. if (!empty($composer['minimum-stability'])) {
  4250. return VersionParser::normalizeStability($composer['minimum-stability']);
  4251. }
  4252. }
  4253. return 'stable';
  4254. }
  4255. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
  4256. {
  4257. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  4258. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  4259. if ($ignorePlatformReqs) {
  4260. $phpVersion = null;
  4261. }
  4262. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  4263. if (!$package) {
  4264. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  4265. return array($name, $requiredVersion ?: '*');
  4266. }
  4267. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  4268. throw new \InvalidArgumentException(sprintf(
  4269. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  4270. $name,
  4271. $requiredVersion,
  4272. $phpVersion
  4273. ));
  4274. }
  4275. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  4276. throw new \InvalidArgumentException(sprintf(
  4277. 'Could not find package %s in a version matching %s',
  4278. $name,
  4279. $requiredVersion
  4280. ));
  4281. }
  4282. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  4283. throw new \InvalidArgumentException(sprintf(
  4284. 'Could not find package %s in any version matching your PHP version (%s)',
  4285. $name,
  4286. $phpVersion
  4287. ));
  4288. }
  4289. $similar = $this->findSimilar($name);
  4290. if ($similar) {
  4291. if ($requiredVersion === null && in_array($name, $similar, true)) {
  4292. throw new \InvalidArgumentException(sprintf(
  4293. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  4294. $name,
  4295. $this->getMinimumStability($input)
  4296. ));
  4297. }
  4298. throw new \InvalidArgumentException(sprintf(
  4299. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4300. $name,
  4301. implode("\n ", $similar)
  4302. ));
  4303. }
  4304. throw new \InvalidArgumentException(sprintf(
  4305. '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).',
  4306. $name,
  4307. $this->getMinimumStability($input)
  4308. ));
  4309. }
  4310. return array(
  4311. $package->getPrettyName(),
  4312. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  4313. );
  4314. }
  4315. private function findSimilar($package)
  4316. {
  4317. try {
  4318. $results = $this->repos->search($package);
  4319. } catch (\Exception $e) {
  4320. return array();
  4321. }
  4322. $similarPackages = array();
  4323. $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4324. foreach ($results as $result) {
  4325. if ($installedRepo->findPackage($result['name'], '*')) {
  4326. continue;
  4327. }
  4328. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4329. }
  4330. asort($similarPackages);
  4331. return array_keys(array_slice($similarPackages, 0, 5));
  4332. }
  4333. private function installDependencies($output)
  4334. {
  4335. try {
  4336. $installCommand = $this->getApplication()->find('install');
  4337. $installCommand->run(new ArrayInput(array()), $output);
  4338. } catch (\Exception $e) {
  4339. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4340. }
  4341. }
  4342. private function hasDependencies($options)
  4343. {
  4344. $requires = (array) $options['require'];
  4345. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4346. return !empty($requires) || !empty($devRequires);
  4347. }
  4348. }
  4349. <?php
  4350. namespace Composer\Command;
  4351. use Composer\Installer;
  4352. use Composer\Plugin\CommandEvent;
  4353. use Composer\Plugin\PluginEvents;
  4354. use Symfony\Component\Console\Input\InputInterface;
  4355. use Symfony\Component\Console\Input\InputOption;
  4356. use Symfony\Component\Console\Input\InputArgument;
  4357. use Symfony\Component\Console\Output\OutputInterface;
  4358. class InstallCommand extends BaseCommand
  4359. {
  4360. protected function configure()
  4361. {
  4362. $this
  4363. ->setName('install')
  4364. ->setAliases(array('i'))
  4365. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4366. ->setDefinition(array(
  4367. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4368. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4369. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4370. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4371. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4372. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4373. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4374. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4375. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4376. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4377. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4378. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4379. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4380. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4381. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4382. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4383. ))
  4384. ->setHelp(
  4385. <<<EOT
  4386. The <info>install</info> command reads the composer.lock file from
  4387. the current directory, processes it, and downloads and installs all the
  4388. libraries and dependencies outlined in that file. If the file does not
  4389. exist it will look for composer.json and do the same.
  4390. <info>php composer.phar install</info>
  4391. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4392. EOT
  4393. )
  4394. ;
  4395. }
  4396. protected function execute(InputInterface $input, OutputInterface $output)
  4397. {
  4398. $io = $this->getIO();
  4399. if ($args = $input->getArgument('packages')) {
  4400. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4401. return 1;
  4402. }
  4403. if ($input->getOption('no-custom-installers')) {
  4404. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4405. $input->setOption('no-plugins', true);
  4406. }
  4407. if ($input->getOption('dev')) {
  4408. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4409. }
  4410. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4411. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4412. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4413. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4414. $install = Installer::create($io, $composer);
  4415. $config = $composer->getConfig();
  4416. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4417. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4418. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4419. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4420. $install
  4421. ->setDryRun($input->getOption('dry-run'))
  4422. ->setVerbose($input->getOption('verbose'))
  4423. ->setPreferSource($preferSource)
  4424. ->setPreferDist($preferDist)
  4425. ->setDevMode(!$input->getOption('no-dev'))
  4426. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4427. ->setRunScripts(!$input->getOption('no-scripts'))
  4428. ->setSkipSuggest($input->getOption('no-suggest'))
  4429. ->setOptimizeAutoloader($optimize)
  4430. ->setClassMapAuthoritative($authoritative)
  4431. ->setApcuAutoloader($apcu)
  4432. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4433. ;
  4434. if ($input->getOption('no-plugins')) {
  4435. $install->disablePlugins();
  4436. }
  4437. return $install->run();
  4438. }
  4439. }
  4440. <?php
  4441. namespace Composer\Command;
  4442. use Composer\Json\JsonFile;
  4443. use Composer\Plugin\CommandEvent;
  4444. use Composer\Plugin\PluginEvents;
  4445. use Composer\Package\PackageInterface;
  4446. use Composer\Repository\RepositoryInterface;
  4447. use Symfony\Component\Console\Helper\Table;
  4448. use Symfony\Component\Console\Input\InputInterface;
  4449. use Symfony\Component\Console\Input\InputOption;
  4450. use Symfony\Component\Console\Output\OutputInterface;
  4451. class LicensesCommand extends BaseCommand
  4452. {
  4453. protected function configure()
  4454. {
  4455. $this
  4456. ->setName('licenses')
  4457. ->setDescription('Shows information about licenses of dependencies.')
  4458. ->setDefinition(array(
  4459. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4460. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4461. ))
  4462. ->setHelp(
  4463. <<<EOT
  4464. The license command displays detailed information about the licenses of
  4465. the installed dependencies.
  4466. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4467. EOT
  4468. )
  4469. ;
  4470. }
  4471. protected function execute(InputInterface $input, OutputInterface $output)
  4472. {
  4473. $composer = $this->getComposer();
  4474. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4475. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4476. $root = $composer->getPackage();
  4477. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4478. if ($input->getOption('no-dev')) {
  4479. $packages = $this->filterRequiredPackages($repo, $root);
  4480. } else {
  4481. $packages = $this->appendPackages($repo->getPackages(), array());
  4482. }
  4483. ksort($packages);
  4484. $io = $this->getIO();
  4485. switch ($format = $input->getOption('format')) {
  4486. case 'text':
  4487. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4488. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4489. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4490. $io->write('Dependencies:');
  4491. $io->write('');
  4492. $table = new Table($output);
  4493. $table->setStyle('compact');
  4494. $tableStyle = $table->getStyle();
  4495. if (method_exists($tableStyle, 'setVerticalBorderChars')) {
  4496. $tableStyle->setVerticalBorderChars('');
  4497. } else {
  4498. $tableStyle->setVerticalBorderChar('');
  4499. }
  4500. $tableStyle->setCellRowContentFormat('%s ');
  4501. $table->setHeaders(array('Name', 'Version', 'License'));
  4502. foreach ($packages as $package) {
  4503. $table->addRow(array(
  4504. $package->getPrettyName(),
  4505. $package->getFullPrettyVersion(),
  4506. implode(', ', $package->getLicense()) ?: 'none',
  4507. ));
  4508. }
  4509. $table->render();
  4510. break;
  4511. case 'json':
  4512. $dependencies = array();
  4513. foreach ($packages as $package) {
  4514. $dependencies[$package->getPrettyName()] = array(
  4515. 'version' => $package->getFullPrettyVersion(),
  4516. 'license' => $package->getLicense(),
  4517. );
  4518. }
  4519. $io->write(JsonFile::encode(array(
  4520. 'name' => $root->getPrettyName(),
  4521. 'version' => $root->getFullPrettyVersion(),
  4522. 'license' => $root->getLicense(),
  4523. 'dependencies' => $dependencies,
  4524. )));
  4525. break;
  4526. default:
  4527. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4528. }
  4529. return 0;
  4530. }
  4531. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4532. {
  4533. $requires = array_keys($package->getRequires());
  4534. $packageListNames = array_keys($bucket);
  4535. $packages = array_filter(
  4536. $repo->getPackages(),
  4537. function ($package) use ($requires, $packageListNames) {
  4538. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4539. }
  4540. );
  4541. $bucket = $this->appendPackages($packages, $bucket);
  4542. foreach ($packages as $package) {
  4543. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4544. }
  4545. return $bucket;
  4546. }
  4547. public function appendPackages(array $packages, array $bucket)
  4548. {
  4549. foreach ($packages as $package) {
  4550. $bucket[$package->getName()] = $package;
  4551. }
  4552. return $bucket;
  4553. }
  4554. }
  4555. <?php
  4556. namespace Composer\Command;
  4557. use Symfony\Component\Console\Input\InputInterface;
  4558. use Symfony\Component\Console\Input\InputArgument;
  4559. use Symfony\Component\Console\Input\ArrayInput;
  4560. use Symfony\Component\Console\Input\InputOption;
  4561. use Symfony\Component\Console\Output\OutputInterface;
  4562. class OutdatedCommand extends ShowCommand
  4563. {
  4564. protected function configure()
  4565. {
  4566. $this
  4567. ->setName('outdated')
  4568. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4569. ->setDefinition(array(
  4570. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4571. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4572. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4573. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4574. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4575. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4576. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4577. 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.'),
  4578. ))
  4579. ->setHelp(
  4580. <<<EOT
  4581. The outdated command is just a proxy for `composer show -l`
  4582. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4583. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4584. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4585. compatibility breaks according to semver, so upgrade when you can but it
  4586. may involve work.
  4587. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4588. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4589. EOT
  4590. )
  4591. ;
  4592. }
  4593. protected function execute(InputInterface $input, OutputInterface $output)
  4594. {
  4595. $args = array(
  4596. 'command' => 'show',
  4597. '--latest' => true,
  4598. );
  4599. if (!$input->getOption('all')) {
  4600. $args['--outdated'] = true;
  4601. }
  4602. if ($input->getOption('direct')) {
  4603. $args['--direct'] = true;
  4604. }
  4605. if ($input->getArgument('package')) {
  4606. $args['package'] = $input->getArgument('package');
  4607. }
  4608. if ($input->getOption('strict')) {
  4609. $args['--strict'] = true;
  4610. }
  4611. if ($input->getOption('minor-only')) {
  4612. $args['--minor-only'] = true;
  4613. }
  4614. $args['--format'] = $input->getOption('format');
  4615. $args['--ignore'] = $input->getOption('ignore');
  4616. $input = new ArrayInput($args);
  4617. return $this->getApplication()->run($input, $output);
  4618. }
  4619. public function isProxyCommand()
  4620. {
  4621. return true;
  4622. }
  4623. }
  4624. <?php
  4625. namespace Composer\Command;
  4626. use Symfony\Component\Console\Input\InputInterface;
  4627. use Symfony\Component\Console\Output\OutputInterface;
  4628. class ProhibitsCommand extends BaseDependencyCommand
  4629. {
  4630. protected function configure()
  4631. {
  4632. parent::configure();
  4633. $this
  4634. ->setName('prohibits')
  4635. ->setAliases(array('why-not'))
  4636. ->setDescription('Shows which packages prevent the given package from being installed.')
  4637. ->setHelp(
  4638. <<<EOT
  4639. Displays detailed information about why a package cannot be installed.
  4640. <info>php composer.phar prohibits composer/composer</info>
  4641. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4642. EOT
  4643. )
  4644. ;
  4645. }
  4646. protected function execute(InputInterface $input, OutputInterface $output)
  4647. {
  4648. return parent::doExecute($input, $output, true);
  4649. }
  4650. }
  4651. <?php
  4652. namespace Composer\Command;
  4653. use Composer\Config\JsonConfigSource;
  4654. use Composer\Installer;
  4655. use Composer\Plugin\CommandEvent;
  4656. use Composer\Plugin\PluginEvents;
  4657. use Composer\Json\JsonFile;
  4658. use Composer\Factory;
  4659. use Symfony\Component\Console\Input\InputInterface;
  4660. use Symfony\Component\Console\Input\InputOption;
  4661. use Symfony\Component\Console\Input\InputArgument;
  4662. use Symfony\Component\Console\Output\OutputInterface;
  4663. use Composer\Package\BasePackage;
  4664. class RemoveCommand extends BaseCommand
  4665. {
  4666. protected function configure()
  4667. {
  4668. $this
  4669. ->setName('remove')
  4670. ->setDescription('Removes a package from the require or require-dev.')
  4671. ->setDefinition(array(
  4672. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4673. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4674. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4675. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4676. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4677. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4678. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4679. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4680. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4681. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4682. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4683. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4684. ))
  4685. ->setHelp(
  4686. <<<EOT
  4687. The <info>remove</info> command removes a package from the current
  4688. list of installed packages
  4689. <info>php composer.phar remove</info>
  4690. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4691. EOT
  4692. )
  4693. ;
  4694. }
  4695. protected function execute(InputInterface $input, OutputInterface $output)
  4696. {
  4697. $packages = $input->getArgument('packages');
  4698. $packages = array_map('strtolower', $packages);
  4699. $file = Factory::getComposerFile();
  4700. $jsonFile = new JsonFile($file);
  4701. $composer = $jsonFile->read();
  4702. $composerBackup = file_get_contents($jsonFile->getPath());
  4703. $json = new JsonConfigSource($jsonFile);
  4704. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4705. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4706. $io = $this->getIO();
  4707. if ($input->getOption('update-with-dependencies')) {
  4708. $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>');
  4709. }
  4710. foreach (array('require', 'require-dev') as $linkType) {
  4711. if (isset($composer[$linkType])) {
  4712. foreach ($composer[$linkType] as $name => $version) {
  4713. $composer[$linkType][strtolower($name)] = $name;
  4714. }
  4715. }
  4716. }
  4717. foreach ($packages as $package) {
  4718. if (isset($composer[$type][$package])) {
  4719. $json->removeLink($type, $composer[$type][$package]);
  4720. } elseif (isset($composer[$altType][$package])) {
  4721. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4722. if ($io->isInteractive()) {
  4723. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4724. $json->removeLink($altType, $composer[$altType][$package]);
  4725. }
  4726. }
  4727. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4728. foreach ($matches as $matchedPackage) {
  4729. $json->removeLink($type, $matchedPackage);
  4730. }
  4731. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4732. foreach ($matches as $matchedPackage) {
  4733. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4734. if ($io->isInteractive()) {
  4735. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4736. $json->removeLink($altType, $matchedPackage);
  4737. }
  4738. }
  4739. }
  4740. } else {
  4741. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4742. }
  4743. }
  4744. if ($input->getOption('no-update')) {
  4745. return 0;
  4746. }
  4747. $this->resetComposer();
  4748. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4749. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4750. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4751. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4752. $install = Installer::create($io, $composer);
  4753. $updateDevMode = !$input->getOption('update-no-dev');
  4754. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4755. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4756. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4757. $install
  4758. ->setVerbose($input->getOption('verbose'))
  4759. ->setDevMode($updateDevMode)
  4760. ->setOptimizeAutoloader($optimize)
  4761. ->setClassMapAuthoritative($authoritative)
  4762. ->setApcuAutoloader($apcu)
  4763. ->setUpdate(true)
  4764. ->setUpdateAllowList($packages)
  4765. ->setAllowListTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4766. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4767. ->setRunScripts(!$input->getOption('no-scripts'))
  4768. ;
  4769. $status = $install->run();
  4770. if ($status !== 0) {
  4771. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4772. file_put_contents($jsonFile->getPath(), $composerBackup);
  4773. }
  4774. return $status;
  4775. }
  4776. }
  4777. <?php
  4778. namespace Composer\Command;
  4779. use Symfony\Component\Console\Input\InputInterface;
  4780. use Symfony\Component\Console\Input\InputArgument;
  4781. use Symfony\Component\Console\Input\InputOption;
  4782. use Symfony\Component\Console\Output\OutputInterface;
  4783. use Composer\Factory;
  4784. use Composer\Installer;
  4785. use Composer\Json\JsonFile;
  4786. use Composer\Json\JsonManipulator;
  4787. use Composer\Package\Version\VersionParser;
  4788. use Composer\Plugin\CommandEvent;
  4789. use Composer\Plugin\PluginEvents;
  4790. use Composer\Repository\CompositeRepository;
  4791. use Composer\Repository\PlatformRepository;
  4792. use Composer\IO\IOInterface;
  4793. use Composer\Util\Silencer;
  4794. class RequireCommand extends InitCommand
  4795. {
  4796. private $newlyCreated;
  4797. private $json;
  4798. private $file;
  4799. private $composerBackup;
  4800. protected function configure()
  4801. {
  4802. $this
  4803. ->setName('require')
  4804. ->setDescription('Adds required packages to your composer.json and installs them.')
  4805. ->setDefinition(array(
  4806. 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"'),
  4807. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4808. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4809. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4810. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  4811. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4812. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4813. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4814. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4815. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4816. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4817. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4818. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4819. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4820. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4821. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4822. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4823. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4824. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4825. ))
  4826. ->setHelp(
  4827. <<<EOT
  4828. The require command adds required packages to your composer.json and installs them.
  4829. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4830. matches to require.
  4831. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4832. If you do not want to install the new dependencies immediately you can call it with --no-update
  4833. Read more at https://getcomposer.org/doc/03-cli.md#require
  4834. EOT
  4835. )
  4836. ;
  4837. }
  4838. protected function execute(InputInterface $input, OutputInterface $output)
  4839. {
  4840. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  4841. pcntl_async_signals(true);
  4842. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4843. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4844. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4845. }
  4846. $this->file = Factory::getComposerFile();
  4847. $io = $this->getIO();
  4848. $this->newlyCreated = !file_exists($this->file);
  4849. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4850. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4851. return 1;
  4852. }
  4853. if (!is_readable($this->file) && false === Silencer::call('file_get_contents', $this->file)) {
  4854. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4855. return 1;
  4856. }
  4857. if (filesize($this->file) === 0) {
  4858. file_put_contents($this->file, "{\n}\n");
  4859. }
  4860. $this->json = new JsonFile($this->file);
  4861. $this->composerBackup = file_get_contents($this->json->getPath());
  4862. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4863. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4864. return 1;
  4865. }
  4866. if ($input->getOption('fixed') === true) {
  4867. $config = $this->json->read();
  4868. $packageType = empty($config['type']) ? 'library' : $config['type'];
  4869. if ($packageType !== 'project') {
  4870. $io->writeError('<error>"--fixed" option is allowed for "project" package types only to prevent possible misuses.</error>');
  4871. if (empty($config['type'])) {
  4872. $io->writeError('<error>If your package is not library, you should explicitly specify "type" parameter in composer.json.</error>');
  4873. }
  4874. return 1;
  4875. }
  4876. }
  4877. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4878. $repos = $composer->getRepositoryManager()->getRepositories();
  4879. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4880. $this->repos = new CompositeRepository(array_merge(
  4881. array(new PlatformRepository(array(), $platformOverrides)),
  4882. $repos
  4883. ));
  4884. if ($composer->getPackage()->getPreferStable()) {
  4885. $preferredStability = 'stable';
  4886. } else {
  4887. $preferredStability = $composer->getPackage()->getMinimumStability();
  4888. }
  4889. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4890. try {
  4891. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'), $input->getOption('fixed'));
  4892. } catch (\Exception $e) {
  4893. if ($this->newlyCreated) {
  4894. throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
  4895. }
  4896. throw $e;
  4897. }
  4898. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4899. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4900. $requirements = $this->formatRequirements($requirements);
  4901. $versionParser = new VersionParser();
  4902. foreach ($requirements as $package => $constraint) {
  4903. if (strtolower($package) === $composer->getPackage()->getName()) {
  4904. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4905. return 1;
  4906. }
  4907. $versionParser->parseConstraints($constraint);
  4908. }
  4909. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4910. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4911. $composerDefinition = $this->json->read();
  4912. foreach ($requirements as $package => $version) {
  4913. $composerDefinition[$requireKey][$package] = $version;
  4914. unset($composerDefinition[$removeKey][$package]);
  4915. }
  4916. $this->json->write($composerDefinition);
  4917. }
  4918. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4919. if ($input->getOption('no-update')) {
  4920. return 0;
  4921. }
  4922. try {
  4923. return $this->doUpdate($input, $output, $io, $requirements);
  4924. } catch (\Exception $e) {
  4925. $this->revertComposerFile(false);
  4926. throw $e;
  4927. }
  4928. }
  4929. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4930. {
  4931. $this->resetComposer();
  4932. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4933. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4934. $updateDevMode = !$input->getOption('update-no-dev');
  4935. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4936. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4937. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4938. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4939. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4940. $install = Installer::create($io, $composer);
  4941. $install
  4942. ->setVerbose($input->getOption('verbose'))
  4943. ->setPreferSource($input->getOption('prefer-source'))
  4944. ->setPreferDist($input->getOption('prefer-dist'))
  4945. ->setDevMode($updateDevMode)
  4946. ->setRunScripts(!$input->getOption('no-scripts'))
  4947. ->setSkipSuggest($input->getOption('no-suggest'))
  4948. ->setOptimizeAutoloader($optimize)
  4949. ->setClassMapAuthoritative($authoritative)
  4950. ->setApcuAutoloader($apcu)
  4951. ->setUpdate(true)
  4952. ->setUpdateAllowList(array_keys($requirements))
  4953. ->setAllowListTransitiveDependencies($input->getOption('update-with-dependencies'))
  4954. ->setAllowListAllDependencies($input->getOption('update-with-all-dependencies'))
  4955. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4956. ->setPreferStable($input->getOption('prefer-stable'))
  4957. ->setPreferLowest($input->getOption('prefer-lowest'))
  4958. ;
  4959. $status = $install->run();
  4960. if ($status !== 0) {
  4961. $this->revertComposerFile(false);
  4962. }
  4963. return $status;
  4964. }
  4965. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4966. {
  4967. $contents = file_get_contents($json->getPath());
  4968. $manipulator = new JsonManipulator($contents);
  4969. foreach ($new as $package => $constraint) {
  4970. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4971. return false;
  4972. }
  4973. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4974. return false;
  4975. }
  4976. }
  4977. file_put_contents($json->getPath(), $manipulator->getContents());
  4978. return true;
  4979. }
  4980. protected function interact(InputInterface $input, OutputInterface $output)
  4981. {
  4982. return;
  4983. }
  4984. public function revertComposerFile($hardExit = true)
  4985. {
  4986. $io = $this->getIO();
  4987. if ($this->newlyCreated) {
  4988. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4989. unlink($this->json->getPath());
  4990. } else {
  4991. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4992. file_put_contents($this->json->getPath(), $this->composerBackup);
  4993. }
  4994. if ($hardExit) {
  4995. exit(1);
  4996. }
  4997. }
  4998. }
  4999. <?php
  5000. namespace Composer\Command;
  5001. use Composer\Script\Event as ScriptEvent;
  5002. use Composer\Script\ScriptEvents;
  5003. use Composer\Util\ProcessExecutor;
  5004. use Symfony\Component\Console\Input\InputInterface;
  5005. use Symfony\Component\Console\Input\InputOption;
  5006. use Symfony\Component\Console\Input\InputArgument;
  5007. use Symfony\Component\Console\Output\OutputInterface;
  5008. use Symfony\Component\Console\Helper\Table;
  5009. class RunScriptCommand extends BaseCommand
  5010. {
  5011. protected $scriptEvents = array(
  5012. ScriptEvents::PRE_INSTALL_CMD,
  5013. ScriptEvents::POST_INSTALL_CMD,
  5014. ScriptEvents::PRE_UPDATE_CMD,
  5015. ScriptEvents::POST_UPDATE_CMD,
  5016. ScriptEvents::PRE_STATUS_CMD,
  5017. ScriptEvents::POST_STATUS_CMD,
  5018. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  5019. ScriptEvents::POST_CREATE_PROJECT_CMD,
  5020. ScriptEvents::PRE_ARCHIVE_CMD,
  5021. ScriptEvents::POST_ARCHIVE_CMD,
  5022. ScriptEvents::PRE_AUTOLOAD_DUMP,
  5023. ScriptEvents::POST_AUTOLOAD_DUMP,
  5024. );
  5025. protected function configure()
  5026. {
  5027. $this
  5028. ->setName('run-script')
  5029. ->setAliases(array('run'))
  5030. ->setDescription('Runs the scripts defined in composer.json.')
  5031. ->setDefinition(array(
  5032. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  5033. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5034. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  5035. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5036. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5037. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  5038. ))
  5039. ->setHelp(
  5040. <<<EOT
  5041. The <info>run-script</info> command runs scripts defined in composer.json:
  5042. <info>php composer.phar run-script post-update-cmd</info>
  5043. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5044. EOT
  5045. )
  5046. ;
  5047. }
  5048. protected function execute(InputInterface $input, OutputInterface $output)
  5049. {
  5050. if ($input->getOption('list')) {
  5051. return $this->listScripts($output);
  5052. } elseif (!$input->getArgument('script')) {
  5053. throw new \RuntimeException('Missing required argument "script"');
  5054. }
  5055. $script = $input->getArgument('script');
  5056. if (!in_array($script, $this->scriptEvents)) {
  5057. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  5058. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  5059. }
  5060. }
  5061. $composer = $this->getComposer();
  5062. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  5063. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  5064. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  5065. if (!$hasListeners) {
  5066. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  5067. }
  5068. $args = $input->getArgument('args');
  5069. if (null !== $timeout = $input->getOption('timeout')) {
  5070. if (!ctype_digit($timeout)) {
  5071. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  5072. }
  5073. ProcessExecutor::setTimeout((int) $timeout);
  5074. }
  5075. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  5076. }
  5077. protected function listScripts(OutputInterface $output)
  5078. {
  5079. $scripts = $this->getComposer()->getPackage()->getScripts();
  5080. if (!count($scripts)) {
  5081. return 0;
  5082. }
  5083. $io = $this->getIO();
  5084. $io->writeError('<info>scripts:</info>');
  5085. $table = array();
  5086. foreach ($scripts as $name => $script) {
  5087. $description = '';
  5088. try {
  5089. $cmd = $this->getApplication()->find($name);
  5090. if ($cmd instanceof ScriptAliasCommand) {
  5091. $description = $cmd->getDescription();
  5092. }
  5093. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  5094. }
  5095. $table[] = array(' '.$name, $description);
  5096. }
  5097. $renderer = new Table($output);
  5098. $renderer->setStyle('compact');
  5099. $rendererStyle = $renderer->getStyle();
  5100. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  5101. $rendererStyle->setVerticalBorderChars('');
  5102. } else {
  5103. $rendererStyle->setVerticalBorderChar('');
  5104. }
  5105. $rendererStyle->setCellRowContentFormat('%s ');
  5106. $renderer->setRows($table)->render();
  5107. return 0;
  5108. }
  5109. }
  5110. <?php
  5111. namespace Composer\Command;
  5112. use Symfony\Component\Console\Input\InputInterface;
  5113. use Symfony\Component\Console\Input\InputOption;
  5114. use Symfony\Component\Console\Input\InputArgument;
  5115. use Symfony\Component\Console\Output\OutputInterface;
  5116. class ScriptAliasCommand extends BaseCommand
  5117. {
  5118. private $script;
  5119. private $description;
  5120. public function __construct($script, $description)
  5121. {
  5122. $this->script = $script;
  5123. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  5124. parent::__construct();
  5125. }
  5126. protected function configure()
  5127. {
  5128. $this
  5129. ->setName($this->script)
  5130. ->setDescription($this->description)
  5131. ->setDefinition(array(
  5132. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5133. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5134. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5135. ))
  5136. ->setHelp(
  5137. <<<EOT
  5138. The <info>run-script</info> command runs scripts defined in composer.json:
  5139. <info>php composer.phar run-script post-update-cmd</info>
  5140. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5141. EOT
  5142. )
  5143. ;
  5144. }
  5145. protected function execute(InputInterface $input, OutputInterface $output)
  5146. {
  5147. $composer = $this->getComposer();
  5148. $args = $input->getArguments();
  5149. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  5150. }
  5151. }
  5152. <?php
  5153. namespace Composer\Command;
  5154. use Composer\Factory;
  5155. use Symfony\Component\Console\Input\InputInterface;
  5156. use Symfony\Component\Console\Input\InputArgument;
  5157. use Symfony\Component\Console\Input\InputOption;
  5158. use Symfony\Component\Console\Output\OutputInterface;
  5159. use Composer\Repository\CompositeRepository;
  5160. use Composer\Repository\PlatformRepository;
  5161. use Composer\Repository\RepositoryInterface;
  5162. use Composer\Plugin\CommandEvent;
  5163. use Composer\Plugin\PluginEvents;
  5164. class SearchCommand extends BaseCommand
  5165. {
  5166. protected $matches;
  5167. protected $lowMatches = array();
  5168. protected $tokens;
  5169. protected $output;
  5170. protected $onlyName;
  5171. protected function configure()
  5172. {
  5173. $this
  5174. ->setName('search')
  5175. ->setDescription('Searches for packages.')
  5176. ->setDefinition(array(
  5177. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  5178. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  5179. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  5180. ))
  5181. ->setHelp(
  5182. <<<EOT
  5183. The search command searches for packages by its name
  5184. <info>php composer.phar search symfony composer</info>
  5185. Read more at https://getcomposer.org/doc/03-cli.md#search
  5186. EOT
  5187. )
  5188. ;
  5189. }
  5190. protected function execute(InputInterface $input, OutputInterface $output)
  5191. {
  5192. $platformRepo = new PlatformRepository;
  5193. $io = $this->getIO();
  5194. if (!($composer = $this->getComposer(false))) {
  5195. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  5196. }
  5197. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5198. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5199. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5200. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  5201. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5202. $onlyName = $input->getOption('only-name');
  5203. $type = $input->getOption('type') ?: null;
  5204. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  5205. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  5206. foreach ($results as $result) {
  5207. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  5208. }
  5209. return 0;
  5210. }
  5211. }
  5212. <?php
  5213. namespace Composer\Command;
  5214. use Composer\Composer;
  5215. use Composer\Factory;
  5216. use Composer\Config;
  5217. use Composer\Util\Filesystem;
  5218. use Composer\Util\Platform;
  5219. use Composer\SelfUpdate\Keys;
  5220. use Composer\SelfUpdate\Versions;
  5221. use Composer\IO\IOInterface;
  5222. use Composer\Downloader\FilesystemException;
  5223. use Symfony\Component\Console\Input\InputInterface;
  5224. use Symfony\Component\Console\Input\InputOption;
  5225. use Symfony\Component\Console\Input\InputArgument;
  5226. use Symfony\Component\Console\Output\OutputInterface;
  5227. use Symfony\Component\Finder\Finder;
  5228. class SelfUpdateCommand extends BaseCommand
  5229. {
  5230. const HOMEPAGE = 'getcomposer.org';
  5231. const OLD_INSTALL_EXT = '-old.phar';
  5232. protected function configure()
  5233. {
  5234. $this
  5235. ->setName('self-update')
  5236. ->setAliases(array('selfupdate'))
  5237. ->setDescription('Updates composer.phar to the latest version.')
  5238. ->setDefinition(array(
  5239. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  5240. 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'),
  5241. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  5242. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5243. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  5244. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  5245. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  5246. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  5247. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  5248. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  5249. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  5250. ))
  5251. ->setHelp(
  5252. <<<EOT
  5253. The <info>self-update</info> command checks getcomposer.org for newer
  5254. versions of composer and if found, installs the latest.
  5255. <info>php composer.phar self-update</info>
  5256. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  5257. EOT
  5258. )
  5259. ;
  5260. }
  5261. protected function execute(InputInterface $input, OutputInterface $output)
  5262. {
  5263. $config = Factory::createConfig();
  5264. if ($config->get('disable-tls') === true) {
  5265. $baseUrl = 'http://' . self::HOMEPAGE;
  5266. } else {
  5267. $baseUrl = 'https://' . self::HOMEPAGE;
  5268. }
  5269. $io = $this->getIO();
  5270. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  5271. $versionsUtil = new Versions($config, $remoteFilesystem);
  5272. $requestedChannel = null;
  5273. foreach (Versions::$channels as $channel) {
  5274. if ($input->getOption($channel)) {
  5275. $requestedChannel = $channel;
  5276. $versionsUtil->setChannel($channel);
  5277. break;
  5278. }
  5279. }
  5280. if ($input->getOption('set-channel-only')) {
  5281. return 0;
  5282. }
  5283. $cacheDir = $config->get('cache-dir');
  5284. $rollbackDir = $config->get('data-dir');
  5285. $home = $config->get('home');
  5286. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  5287. if ($input->getOption('update-keys')) {
  5288. return $this->fetchKeys($io, $config);
  5289. }
  5290. if (!file_exists($localFilename)) {
  5291. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  5292. }
  5293. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  5294. if (!is_writable($tmpDir)) {
  5295. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  5296. }
  5297. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  5298. $composeUser = posix_getpwuid(posix_geteuid());
  5299. $homeOwner = posix_getpwuid(fileowner($home));
  5300. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  5301. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  5302. }
  5303. }
  5304. if ($input->getOption('rollback')) {
  5305. return $this->rollback($output, $rollbackDir, $localFilename);
  5306. }
  5307. $latest = $versionsUtil->getLatest();
  5308. $latestStable = $versionsUtil->getLatest('stable');
  5309. try {
  5310. $latestPreview = $versionsUtil->getLatest('preview');
  5311. } catch (\UnexpectedValueException $e) {
  5312. $latestPreview = $latestStable;
  5313. }
  5314. $latestVersion = $latest['version'];
  5315. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  5316. $currentMajorVersion = preg_replace('{^(\d+).*}', '$1', Composer::getVersion());
  5317. $updateMajorVersion = preg_replace('{^(\d+).*}', '$1', $updateVersion);
  5318. $previewMajorVersion = preg_replace('{^(\d+).*}', '$1', $latestPreview['version']);
  5319. if ($versionsUtil->getChannel() === 'stable' && !$input->getArgument('version')) {
  5320. if ($currentMajorVersion < $updateMajorVersion) {
  5321. $skippedVersion = $updateVersion;
  5322. $versionsUtil->setChannel($currentMajorVersion);
  5323. $latest = $versionsUtil->getLatest();
  5324. $latestStable = $versionsUtil->getLatest('stable');
  5325. $latestVersion = $latest['version'];
  5326. $updateVersion = $latestVersion;
  5327. $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://github.com/composer/composer/releases for changelogs.</warning>');
  5328. } elseif ($currentMajorVersion < $previewMajorVersion) {
  5329. $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>');
  5330. }
  5331. }
  5332. if ($requestedChannel && is_numeric($requestedChannel) && substr($latestStable['version'], 0, 1) !== $requestedChannel) {
  5333. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$requestedChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  5334. }
  5335. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  5336. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  5337. return 1;
  5338. }
  5339. if (Composer::VERSION === $updateVersion) {
  5340. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  5341. if ($input->getOption('clean-backups')) {
  5342. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  5343. }
  5344. return 0;
  5345. }
  5346. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  5347. $backupFile = sprintf(
  5348. '%s/%s-%s%s',
  5349. $rollbackDir,
  5350. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  5351. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  5352. self::OLD_INSTALL_EXT
  5353. );
  5354. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  5355. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  5356. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  5357. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  5358. $io->writeError(' ', false);
  5359. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  5360. $io->writeError('');
  5361. if (!file_exists($tempFilename) || !$signature) {
  5362. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  5363. return 1;
  5364. }
  5365. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  5366. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5367. } else {
  5368. if (!extension_loaded('openssl')) {
  5369. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5370. . '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.');
  5371. }
  5372. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5373. if (!file_exists($sigFile)) {
  5374. file_put_contents(
  5375. $home.'/keys.dev.pub',
  5376. <<<DEVPUBKEY
  5377. -----BEGIN PUBLIC KEY-----
  5378. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5379. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5380. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5381. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5382. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5383. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5384. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5385. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5386. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5387. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5388. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5389. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5390. -----END PUBLIC KEY-----
  5391. DEVPUBKEY
  5392. );
  5393. file_put_contents(
  5394. $home.'/keys.tags.pub',
  5395. <<<TAGSPUBKEY
  5396. -----BEGIN PUBLIC KEY-----
  5397. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5398. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5399. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5400. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5401. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5402. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5403. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5404. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5405. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5406. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5407. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5408. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5409. -----END PUBLIC KEY-----
  5410. TAGSPUBKEY
  5411. );
  5412. }
  5413. $pubkeyid = openssl_pkey_get_public($sigFile);
  5414. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5415. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5416. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5417. }
  5418. $signature = json_decode($signature, true);
  5419. $signature = base64_decode($signature['sha384']);
  5420. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5421. openssl_free_key($pubkeyid);
  5422. if (!$verified) {
  5423. 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');
  5424. }
  5425. }
  5426. if ($input->getOption('clean-backups')) {
  5427. $this->cleanBackups($rollbackDir);
  5428. }
  5429. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5430. @unlink($tempFilename);
  5431. return 1;
  5432. }
  5433. if (file_exists($backupFile)) {
  5434. $io->writeError(sprintf(
  5435. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5436. Composer::VERSION
  5437. ));
  5438. } else {
  5439. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5440. }
  5441. return 0;
  5442. }
  5443. protected function fetchKeys(IOInterface $io, Config $config)
  5444. {
  5445. if (!$io->isInteractive()) {
  5446. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5447. }
  5448. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5449. $validator = function ($value) {
  5450. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5451. throw new \UnexpectedValueException('Invalid input');
  5452. }
  5453. return trim($value)."\n";
  5454. };
  5455. $devKey = '';
  5456. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5457. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5458. while ($line = $io->ask('')) {
  5459. $devKey .= trim($line)."\n";
  5460. if (trim($line) === '-----END PUBLIC KEY-----') {
  5461. break;
  5462. }
  5463. }
  5464. }
  5465. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5466. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5467. $tagsKey = '';
  5468. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5469. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5470. while ($line = $io->ask('')) {
  5471. $tagsKey .= trim($line)."\n";
  5472. if (trim($line) === '-----END PUBLIC KEY-----') {
  5473. break;
  5474. }
  5475. }
  5476. }
  5477. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5478. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5479. $io->write('Public keys stored in '.$config->get('home'));
  5480. }
  5481. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5482. {
  5483. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5484. if (!$rollbackVersion) {
  5485. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5486. }
  5487. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5488. if (!is_file($oldFile)) {
  5489. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5490. }
  5491. if (!is_readable($oldFile)) {
  5492. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5493. }
  5494. $io = $this->getIO();
  5495. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5496. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  5497. return 1;
  5498. }
  5499. return 0;
  5500. }
  5501. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5502. {
  5503. $io = $this->getIO();
  5504. @chmod($newFilename, fileperms($localFilename));
  5505. if (!$this->validatePhar($newFilename, $error)) {
  5506. $io->writeError('<error>The '.($backupTarget ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  5507. if ($backupTarget) {
  5508. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5509. }
  5510. return false;
  5511. }
  5512. if ($backupTarget) {
  5513. @copy($localFilename, $backupTarget);
  5514. }
  5515. try {
  5516. rename($newFilename, $localFilename);
  5517. return true;
  5518. } catch (\Exception $e) {
  5519. if (!is_writable(dirname($localFilename))
  5520. && $io->isInteractive()
  5521. && $this->isWindowsNonAdminUser()) {
  5522. return $this->tryAsWindowsAdmin($localFilename, $newFilename);
  5523. }
  5524. $action = 'Composer '.($backupTarget ? 'update' : 'rollback');
  5525. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  5526. }
  5527. }
  5528. protected function cleanBackups($rollbackDir, $except = null)
  5529. {
  5530. $finder = $this->getOldInstallationFinder($rollbackDir);
  5531. $io = $this->getIO();
  5532. $fs = new Filesystem;
  5533. foreach ($finder as $file) {
  5534. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5535. continue;
  5536. }
  5537. $file = (string) $file;
  5538. $io->writeError('<info>Removing: '.$file.'</info>');
  5539. $fs->remove($file);
  5540. }
  5541. }
  5542. protected function getLastBackupVersion($rollbackDir)
  5543. {
  5544. $finder = $this->getOldInstallationFinder($rollbackDir);
  5545. $finder->sortByName();
  5546. $files = iterator_to_array($finder);
  5547. if (count($files)) {
  5548. return basename(end($files), self::OLD_INSTALL_EXT);
  5549. }
  5550. return false;
  5551. }
  5552. protected function getOldInstallationFinder($rollbackDir)
  5553. {
  5554. $finder = Finder::create()
  5555. ->depth(0)
  5556. ->files()
  5557. ->name('*' . self::OLD_INSTALL_EXT)
  5558. ->in($rollbackDir);
  5559. return $finder;
  5560. }
  5561. protected function validatePhar($pharFile, &$error)
  5562. {
  5563. if (ini_get('phar.readonly')) {
  5564. return true;
  5565. }
  5566. try {
  5567. $phar = new \Phar($pharFile);
  5568. unset($phar);
  5569. $result = true;
  5570. } catch (\Exception $e) {
  5571. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5572. throw $e;
  5573. }
  5574. $error = $e->getMessage();
  5575. $result = false;
  5576. }
  5577. return $result;
  5578. }
  5579. protected function isWindowsNonAdminUser()
  5580. {
  5581. if (!Platform::isWindows()) {
  5582. return false;
  5583. }
  5584. exec('fltmc.exe filters', $output, $exitCode);
  5585. return $exitCode !== 0;
  5586. }
  5587. protected function tryAsWindowsAdmin($localFilename, $newFilename)
  5588. {
  5589. $io = $this->getIO();
  5590. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  5591. $helpMessage = 'Please run the self-update command as an Administrator.';
  5592. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  5593. if (!$io->askConfirmation($question, false)) {
  5594. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  5595. return false;
  5596. }
  5597. $tmpFile = tempnam(sys_get_temp_dir(), '');
  5598. $script = $tmpFile.'.vbs';
  5599. rename($tmpFile, $script);
  5600. $checksum = hash_file('sha256', $newFilename);
  5601. $source = str_replace('/', '\\', $newFilename);
  5602. $destination = str_replace('/', '\\', $localFilename);
  5603. $vbs = <<<EOT
  5604. Set UAC = CreateObject("Shell.Application")
  5605. UAC.ShellExecute "cmd.exe", "/c move /y ""$source"" ""$destination""", "", "runas", 0
  5606. Wscript.Sleep(300)
  5607. EOT;
  5608. file_put_contents($script, $vbs);
  5609. exec('"'.$script.'"');
  5610. @unlink($script);
  5611. if ($result = (hash_file('sha256', $localFilename) === $checksum)) {
  5612. $io->writeError('<info>Operation succeeded.</info>');
  5613. } else {
  5614. $io->writeError('<error>Operation failed (file not written). '.$helpMessage.'</error>');
  5615. };
  5616. return $result;
  5617. }
  5618. }
  5619. <?php
  5620. namespace Composer\Command;
  5621. use Composer\Composer;
  5622. use Composer\DependencyResolver\DefaultPolicy;
  5623. use Composer\DependencyResolver\Pool;
  5624. use Composer\Json\JsonFile;
  5625. use Composer\Package\BasePackage;
  5626. use Composer\Package\CompletePackageInterface;
  5627. use Composer\Package\PackageInterface;
  5628. use Composer\Package\Version\VersionParser;
  5629. use Composer\Package\Version\VersionSelector;
  5630. use Composer\Plugin\CommandEvent;
  5631. use Composer\Plugin\PluginEvents;
  5632. use Composer\Repository\ArrayRepository;
  5633. use Composer\Repository\ComposerRepository;
  5634. use Composer\Repository\CompositeRepository;
  5635. use Composer\Repository\PlatformRepository;
  5636. use Composer\Repository\RepositoryFactory;
  5637. use Composer\Repository\RepositoryInterface;
  5638. use Composer\Semver\Constraint\ConstraintInterface;
  5639. use Composer\Semver\Semver;
  5640. use Composer\Spdx\SpdxLicenses;
  5641. use Composer\Util\Platform;
  5642. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5643. use Symfony\Component\Console\Input\InputArgument;
  5644. use Symfony\Component\Console\Input\InputInterface;
  5645. use Symfony\Component\Console\Input\InputOption;
  5646. use Symfony\Component\Console\Output\OutputInterface;
  5647. use Symfony\Component\Console\Terminal;
  5648. class ShowCommand extends BaseCommand
  5649. {
  5650. protected $versionParser;
  5651. protected $colors;
  5652. private $pool;
  5653. protected function configure()
  5654. {
  5655. $this
  5656. ->setName('show')
  5657. ->setAliases(array('info'))
  5658. ->setDescription('Shows information about packages.')
  5659. ->setDefinition(array(
  5660. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5661. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5662. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5663. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5664. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5665. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5666. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5667. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5668. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5669. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5670. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5671. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5672. 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.'),
  5673. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5674. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5675. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5676. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5677. ))
  5678. ->setHelp(
  5679. <<<EOT
  5680. The show command displays detailed information about a package, or
  5681. lists all packages available.
  5682. Read more at https://getcomposer.org/doc/03-cli.md#show
  5683. EOT
  5684. )
  5685. ;
  5686. }
  5687. protected function execute(InputInterface $input, OutputInterface $output)
  5688. {
  5689. $this->versionParser = new VersionParser;
  5690. if ($input->getOption('tree')) {
  5691. $this->initStyles($output);
  5692. }
  5693. $composer = $this->getComposer(false);
  5694. $io = $this->getIO();
  5695. if ($input->getOption('installed')) {
  5696. $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>');
  5697. }
  5698. if ($input->getOption('outdated')) {
  5699. $input->setOption('latest', true);
  5700. } elseif ($input->getOption('ignore')) {
  5701. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5702. }
  5703. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5704. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5705. return 1;
  5706. }
  5707. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5708. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5709. return 1;
  5710. }
  5711. if ($input->getOption('tree') && $input->getOption('latest')) {
  5712. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5713. return 1;
  5714. }
  5715. if ($input->getOption('tree') && $input->getOption('path')) {
  5716. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  5717. return 1;
  5718. }
  5719. $format = $input->getOption('format');
  5720. if (!in_array($format, array('text', 'json'))) {
  5721. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5722. return 1;
  5723. }
  5724. $platformOverrides = array();
  5725. if ($composer) {
  5726. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5727. }
  5728. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5729. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5730. if ($input->getOption('self')) {
  5731. $package = $this->getComposer()->getPackage();
  5732. if ($input->getOption('name-only')) {
  5733. $io->write($package->getName());
  5734. return 0;
  5735. }
  5736. $repos = $installedRepo = new ArrayRepository(array($package));
  5737. } elseif ($input->getOption('platform')) {
  5738. $repos = $installedRepo = $platformRepo;
  5739. } elseif ($input->getOption('available')) {
  5740. $installedRepo = $platformRepo;
  5741. if ($composer) {
  5742. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5743. } else {
  5744. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5745. $repos = new CompositeRepository($defaultRepos);
  5746. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5747. }
  5748. } elseif ($input->getOption('all') && $composer) {
  5749. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5750. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5751. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5752. } elseif ($input->getOption('all')) {
  5753. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5754. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5755. $installedRepo = $platformRepo;
  5756. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5757. } else {
  5758. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5759. $rootPkg = $this->getComposer()->getPackage();
  5760. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5761. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5762. }
  5763. }
  5764. if ($composer) {
  5765. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5766. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5767. }
  5768. if ($input->getOption('latest') && null === $composer) {
  5769. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5770. $input->setOption('latest', false);
  5771. }
  5772. $packageFilter = $input->getArgument('package');
  5773. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5774. if (empty($package)) {
  5775. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5776. if (empty($package)) {
  5777. $options = $input->getOptions();
  5778. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5779. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $input->getArgument('package')) && !$input->getOption('platform')) {
  5780. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found, try using --platform (-p) to show platform packages.');
  5781. }
  5782. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5783. }
  5784. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5785. return 1;
  5786. }
  5787. } else {
  5788. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5789. }
  5790. $exitCode = 0;
  5791. if ($input->getOption('tree')) {
  5792. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5793. if ('json' === $format) {
  5794. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5795. } else {
  5796. $this->displayPackageTree(array($arrayTree));
  5797. }
  5798. } else {
  5799. $latestPackage = null;
  5800. if ($input->getOption('latest')) {
  5801. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5802. }
  5803. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5804. $exitCode = 1;
  5805. }
  5806. if ($input->getOption('path')) {
  5807. $io->write($package->getName(), false);
  5808. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5809. return $exitCode;
  5810. }
  5811. if ('json' === $format) {
  5812. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  5813. } else {
  5814. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  5815. }
  5816. }
  5817. return $exitCode;
  5818. }
  5819. if ($input->getOption('tree')) {
  5820. $rootRequires = $this->getRootRequires();
  5821. $packages = $installedRepo->getPackages();
  5822. usort($packages, 'strcmp');
  5823. $arrayTree = array();
  5824. foreach ($packages as $package) {
  5825. if (in_array($package->getName(), $rootRequires, true)) {
  5826. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5827. }
  5828. }
  5829. if ('json' === $format) {
  5830. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5831. } else {
  5832. $this->displayPackageTree($arrayTree);
  5833. }
  5834. return 0;
  5835. }
  5836. if ($repos instanceof CompositeRepository) {
  5837. $repos = $repos->getRepositories();
  5838. } elseif (!is_array($repos)) {
  5839. $repos = array($repos);
  5840. }
  5841. $packages = array();
  5842. if (null !== $packageFilter) {
  5843. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5844. }
  5845. $packageListFilter = array();
  5846. if ($input->getOption('direct')) {
  5847. $packageListFilter = $this->getRootRequires();
  5848. }
  5849. if (class_exists('Symfony\Component\Console\Terminal')) {
  5850. $terminal = new Terminal();
  5851. $width = $terminal->getWidth();
  5852. } else {
  5853. list($width) = $this->getApplication()->getTerminalDimensions();
  5854. }
  5855. if (null === $width) {
  5856. $width = PHP_INT_MAX;
  5857. }
  5858. if (Platform::isWindows()) {
  5859. $width--;
  5860. } else {
  5861. $width = max(80, $width);
  5862. }
  5863. if ($input->getOption('path') && null === $composer) {
  5864. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5865. $input->setOption('path', false);
  5866. }
  5867. foreach ($repos as $repo) {
  5868. if ($repo === $platformRepo) {
  5869. $type = 'platform';
  5870. } elseif (
  5871. $repo === $installedRepo
  5872. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5873. ) {
  5874. $type = 'installed';
  5875. } else {
  5876. $type = 'available';
  5877. }
  5878. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5879. foreach ($repo->getProviderNames() as $name) {
  5880. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5881. $packages[$type][$name] = $name;
  5882. }
  5883. }
  5884. } else {
  5885. foreach ($repo->getPackages() as $package) {
  5886. if (!isset($packages[$type][$package->getName()])
  5887. || !is_object($packages[$type][$package->getName()])
  5888. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5889. ) {
  5890. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5891. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5892. $packages[$type][$package->getName()] = $package;
  5893. }
  5894. }
  5895. }
  5896. }
  5897. }
  5898. }
  5899. $showAllTypes = $input->getOption('all');
  5900. $showLatest = $input->getOption('latest');
  5901. $showMinorOnly = $input->getOption('minor-only');
  5902. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5903. $indent = $showAllTypes ? ' ' : '';
  5904. $latestPackages = array();
  5905. $exitCode = 0;
  5906. $viewData = array();
  5907. $viewMetaData = array();
  5908. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5909. if (isset($packages[$type])) {
  5910. ksort($packages[$type]);
  5911. $nameLength = $versionLength = $latestLength = 0;
  5912. if ($showLatest && $showVersion) {
  5913. foreach ($packages[$type] as $package) {
  5914. if (is_object($package)) {
  5915. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5916. if ($latestPackage === false) {
  5917. continue;
  5918. }
  5919. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5920. }
  5921. }
  5922. }
  5923. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5924. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5925. $writeLatest = $writeVersion && $showLatest;
  5926. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5927. $hasOutdatedPackages = false;
  5928. $viewData[$type] = array();
  5929. foreach ($packages[$type] as $package) {
  5930. $packageViewData = array();
  5931. if (is_object($package)) {
  5932. $latestPackage = null;
  5933. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5934. $latestPackage = $latestPackages[$package->getPrettyName()];
  5935. }
  5936. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5937. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5938. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5939. continue;
  5940. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5941. $hasOutdatedPackages = true;
  5942. }
  5943. $packageViewData['name'] = $package->getPrettyName();
  5944. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5945. if ($writeVersion) {
  5946. $packageViewData['version'] = $package->getFullPrettyVersion();
  5947. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5948. }
  5949. if ($writeLatest && $latestPackage) {
  5950. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5951. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5952. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5953. }
  5954. if ($writeDescription) {
  5955. $packageViewData['description'] = $package->getDescription();
  5956. }
  5957. if ($writePath) {
  5958. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5959. }
  5960. if ($latestPackage && $latestPackage->isAbandoned()) {
  5961. $replacement = is_string($latestPackage->getReplacementPackage())
  5962. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5963. : 'No replacement was suggested';
  5964. $packageWarning = sprintf(
  5965. 'Package %s is abandoned, you should avoid using it. %s.',
  5966. $package->getPrettyName(),
  5967. $replacement
  5968. );
  5969. $packageViewData['warning'] = $packageWarning;
  5970. }
  5971. } else {
  5972. $packageViewData['name'] = $package;
  5973. $nameLength = max($nameLength, strlen($package));
  5974. }
  5975. $viewData[$type][] = $packageViewData;
  5976. }
  5977. $viewMetaData[$type] = array(
  5978. 'nameLength' => $nameLength,
  5979. 'versionLength' => $versionLength,
  5980. 'latestLength' => $latestLength,
  5981. );
  5982. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5983. $exitCode = 1;
  5984. break;
  5985. }
  5986. }
  5987. }
  5988. if ('json' === $format) {
  5989. $io->write(JsonFile::encode($viewData));
  5990. } else {
  5991. foreach ($viewData as $type => $packages) {
  5992. $nameLength = $viewMetaData[$type]['nameLength'];
  5993. $versionLength = $viewMetaData[$type]['versionLength'];
  5994. $latestLength = $viewMetaData[$type]['latestLength'];
  5995. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5996. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5997. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5998. if ($writeLatest && !$io->isDecorated()) {
  5999. $latestLength += 2;
  6000. }
  6001. if ($showAllTypes) {
  6002. if ('available' === $type) {
  6003. $io->write('<comment>' . $type . '</comment>:');
  6004. } else {
  6005. $io->write('<info>' . $type . '</info>:');
  6006. }
  6007. }
  6008. foreach ($packages as $package) {
  6009. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  6010. if (isset($package['version']) && $writeVersion) {
  6011. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  6012. }
  6013. if (isset($package['latest']) && $writeLatest) {
  6014. $latestVersion = $package['latest'];
  6015. $updateStatus = $package['latest-status'];
  6016. $style = $this->updateStatusToVersionStyle($updateStatus);
  6017. if (!$io->isDecorated()) {
  6018. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  6019. }
  6020. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  6021. }
  6022. if (isset($package['description']) && $writeDescription) {
  6023. $description = strtok($package['description'], "\r\n");
  6024. $remaining = $width - $nameLength - $versionLength - 4;
  6025. if ($writeLatest) {
  6026. $remaining -= $latestLength;
  6027. }
  6028. if (strlen($description) > $remaining) {
  6029. $description = substr($description, 0, $remaining - 3) . '...';
  6030. }
  6031. $io->write(' ' . $description, false);
  6032. }
  6033. if (isset($package['path'])) {
  6034. $io->write(' ' . $package['path'], false);
  6035. }
  6036. $io->write('');
  6037. if (isset($package['warning'])) {
  6038. $io->write('<warning>' . $package['warning'] . '</warning>');
  6039. }
  6040. }
  6041. if ($showAllTypes) {
  6042. $io->write('');
  6043. }
  6044. }
  6045. }
  6046. return $exitCode;
  6047. }
  6048. protected function getRootRequires()
  6049. {
  6050. $rootPackage = $this->getComposer()->getPackage();
  6051. return array_map(
  6052. 'strtolower',
  6053. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  6054. );
  6055. }
  6056. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  6057. {
  6058. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  6059. }
  6060. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  6061. {
  6062. $name = strtolower($name);
  6063. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  6064. $policy = new DefaultPolicy();
  6065. $pool = new Pool('dev');
  6066. $pool->addRepository($repos);
  6067. $matchedPackage = null;
  6068. $versions = array();
  6069. $matches = $pool->whatProvides($name, $constraint);
  6070. foreach ($matches as $index => $package) {
  6071. if ($package->getName() !== $name) {
  6072. unset($matches[$index]);
  6073. continue;
  6074. }
  6075. if (null === $version && $installedRepo->hasPackage($package)) {
  6076. $matchedPackage = $package;
  6077. }
  6078. $versions[$package->getPrettyVersion()] = $package->getVersion();
  6079. $matches[$index] = $package->getId();
  6080. }
  6081. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  6082. $matchedPackage = $pool->literalToPackage($preferred[0]);
  6083. }
  6084. return array($matchedPackage, $versions);
  6085. }
  6086. protected function printPackageInfo(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6087. {
  6088. $io = $this->getIO();
  6089. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  6090. $this->printLinks($package, 'requires');
  6091. $this->printLinks($package, 'devRequires', 'requires (dev)');
  6092. if ($package->getSuggests()) {
  6093. $io->write("\n<info>suggests</info>");
  6094. foreach ($package->getSuggests() as $suggested => $reason) {
  6095. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  6096. }
  6097. }
  6098. $this->printLinks($package, 'provides');
  6099. $this->printLinks($package, 'conflicts');
  6100. $this->printLinks($package, 'replaces');
  6101. }
  6102. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6103. {
  6104. $io = $this->getIO();
  6105. $io->write('<info>name</info> : ' . $package->getPrettyName());
  6106. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  6107. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  6108. $this->printVersions($package, $versions, $installedRepo);
  6109. if ($latestPackage) {
  6110. $style = $this->getVersionStyle($latestPackage, $package);
  6111. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  6112. } else {
  6113. $latestPackage = $package;
  6114. }
  6115. $io->write('<info>type</info> : ' . $package->getType());
  6116. $this->printLicenses($package);
  6117. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  6118. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  6119. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  6120. if ($installedRepo->hasPackage($package)) {
  6121. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  6122. }
  6123. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  6124. if ($latestPackage->isAbandoned()) {
  6125. $replacement = ($latestPackage->getReplacementPackage() !== null)
  6126. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  6127. : null;
  6128. $io->writeError(
  6129. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  6130. );
  6131. }
  6132. if ($package->getSupport()) {
  6133. $io->write("\n<info>support</info>");
  6134. foreach ($package->getSupport() as $type => $value) {
  6135. $io->write('<comment>' . $type . '</comment> : '.$value);
  6136. }
  6137. }
  6138. if ($package->getAutoload()) {
  6139. $io->write("\n<info>autoload</info>");
  6140. foreach ($package->getAutoload() as $type => $autoloads) {
  6141. $io->write('<comment>' . $type . '</comment>');
  6142. if ($type === 'psr-0') {
  6143. foreach ($autoloads as $name => $path) {
  6144. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6145. }
  6146. } elseif ($type === 'psr-4') {
  6147. foreach ($autoloads as $name => $path) {
  6148. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6149. }
  6150. } elseif ($type === 'classmap') {
  6151. $io->write(implode(', ', $autoloads));
  6152. }
  6153. }
  6154. if ($package->getIncludePaths()) {
  6155. $io->write('<comment>include-path</comment>');
  6156. $io->write(implode(', ', $package->getIncludePaths()));
  6157. }
  6158. }
  6159. }
  6160. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  6161. {
  6162. uasort($versions, 'version_compare');
  6163. $versions = array_keys(array_reverse($versions));
  6164. if ($installedRepo->hasPackage($package)) {
  6165. $installedVersion = $package->getPrettyVersion();
  6166. $key = array_search($installedVersion, $versions);
  6167. if (false !== $key) {
  6168. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  6169. }
  6170. }
  6171. $versions = implode(', ', $versions);
  6172. $this->getIO()->write('<info>versions</info> : ' . $versions);
  6173. }
  6174. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  6175. {
  6176. $title = $title ?: $linkType;
  6177. $io = $this->getIO();
  6178. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  6179. $io->write("\n<info>" . $title . "</info>");
  6180. foreach ($links as $link) {
  6181. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  6182. }
  6183. }
  6184. }
  6185. protected function printLicenses(CompletePackageInterface $package)
  6186. {
  6187. $spdxLicenses = new SpdxLicenses();
  6188. $licenses = $package->getLicense();
  6189. $io = $this->getIO();
  6190. foreach ($licenses as $licenseId) {
  6191. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6192. if (!$license) {
  6193. $out = $licenseId;
  6194. } else {
  6195. if ($license[1] === true) {
  6196. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  6197. } else {
  6198. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  6199. }
  6200. }
  6201. $io->write('<info>license</info> : ' . $out);
  6202. }
  6203. }
  6204. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6205. {
  6206. $json = array(
  6207. 'name' => $package->getPrettyName(),
  6208. 'description' => $package->getDescription(),
  6209. 'keywords' => $package->getKeywords() ?: array(),
  6210. 'type' => $package->getType(),
  6211. 'homepage' => $package->getHomepage(),
  6212. 'names' => $package->getNames()
  6213. );
  6214. $json = $this->appendVersions($json, $versions);
  6215. $json = $this->appendLicenses($json, $package);
  6216. if ($latestPackage) {
  6217. $json['latest'] = $latestPackage->getPrettyVersion();
  6218. } else {
  6219. $latestPackage = $package;
  6220. }
  6221. if ($package->getSourceType()) {
  6222. $json['source'] = array(
  6223. 'type' => $package->getSourceType(),
  6224. 'url' => $package->getSourceUrl(),
  6225. 'reference' => $package->getSourceReference()
  6226. );
  6227. }
  6228. if ($package->getDistType()) {
  6229. $json['dist'] = array(
  6230. 'type' => $package->getDistType(),
  6231. 'url' => $package->getDistUrl(),
  6232. 'reference' => $package->getDistReference()
  6233. );
  6234. }
  6235. if ($installedRepo->hasPackage($package)) {
  6236. $json['path'] = realpath($this->getComposer()->getInstallationManager()->getInstallPath($package));
  6237. if ($json['path'] === false) {
  6238. unset($json['path']);
  6239. }
  6240. }
  6241. if ($latestPackage->isAbandoned()) {
  6242. $json['replacement'] = $latestPackage->getReplacementPackage();
  6243. }
  6244. if ($package->getSuggests()) {
  6245. $json['suggests'] = $package->getSuggests();
  6246. }
  6247. if ($package->getSupport()) {
  6248. $json['support'] = $package->getSupport();
  6249. }
  6250. $json = $this->appendAutoload($json, $package);
  6251. if ($package->getIncludePaths()) {
  6252. $json['include_path'] = $package->getIncludePaths();
  6253. }
  6254. $json = $this->appendLinks($json, $package);
  6255. $this->getIO()->write(JsonFile::encode($json));
  6256. }
  6257. private function appendVersions($json, array $versions)
  6258. {
  6259. uasort($versions, 'version_compare');
  6260. $versions = array_keys(array_reverse($versions));
  6261. $json['versions'] = $versions;
  6262. return $json;
  6263. }
  6264. private function appendLicenses($json, CompletePackageInterface $package)
  6265. {
  6266. if ($licenses = $package->getLicense()) {
  6267. $spdxLicenses = new SpdxLicenses();
  6268. $json['licenses'] = array_map(function ($licenseId) use ($spdxLicenses) {
  6269. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6270. if (!$license) {
  6271. return $licenseId;
  6272. }
  6273. return array(
  6274. 'name' => $license[0],
  6275. 'osi' => $licenseId,
  6276. 'url' => $license[2]
  6277. );
  6278. }, $licenses);
  6279. }
  6280. return $json;
  6281. }
  6282. private function appendAutoload($json, CompletePackageInterface $package)
  6283. {
  6284. if ($package->getAutoload()) {
  6285. $autoload = array();
  6286. foreach ($package->getAutoload() as $type => $autoloads) {
  6287. if ($type === 'psr-0' || $type === 'psr-4') {
  6288. $psr = array();
  6289. foreach ($autoloads as $name => $path) {
  6290. if (!$path) {
  6291. $path = '.';
  6292. }
  6293. $psr[$name ?: '*'] = $path;
  6294. }
  6295. $autoload[$type] = $psr;
  6296. } elseif ($type === 'classmap') {
  6297. $autoload['classmap'] = $autoloads;
  6298. }
  6299. }
  6300. $json['autoload'] = $autoload;
  6301. }
  6302. return $json;
  6303. }
  6304. private function appendLinks($json, CompletePackageInterface $package)
  6305. {
  6306. foreach (array('requires', 'devRequires', 'provides', 'conflicts', 'replaces') as $linkType) {
  6307. $json = $this->appendLink($json, $package, $linkType);
  6308. }
  6309. return $json;
  6310. }
  6311. private function appendLink($json, CompletePackageInterface $package, $linkType)
  6312. {
  6313. $links = $package->{'get' . ucfirst($linkType)}();
  6314. if ($links) {
  6315. $json[$linkType] = array();
  6316. foreach ($links as $link) {
  6317. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  6318. }
  6319. }
  6320. return $json;
  6321. }
  6322. protected function initStyles(OutputInterface $output)
  6323. {
  6324. $this->colors = array(
  6325. 'green',
  6326. 'yellow',
  6327. 'cyan',
  6328. 'magenta',
  6329. 'blue',
  6330. );
  6331. foreach ($this->colors as $color) {
  6332. $style = new OutputFormatterStyle($color);
  6333. $output->getFormatter()->setStyle($color, $style);
  6334. }
  6335. }
  6336. protected function displayPackageTree(array $arrayTree)
  6337. {
  6338. $io = $this->getIO();
  6339. foreach ($arrayTree as $package) {
  6340. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  6341. $io->write(' ' . $package['version'], false);
  6342. $io->write(' ' . strtok($package['description'], "\r\n"));
  6343. if (isset($package['requires'])) {
  6344. $requires = $package['requires'];
  6345. $treeBar = '├';
  6346. $j = 0;
  6347. $total = count($requires);
  6348. foreach ($requires as $require) {
  6349. $requireName = $require['name'];
  6350. $j++;
  6351. if ($j === $total) {
  6352. $treeBar = 'â””';
  6353. }
  6354. $level = 1;
  6355. $color = $this->colors[$level];
  6356. $info = sprintf(
  6357. '%s──<%s>%s</%s> %s',
  6358. $treeBar,
  6359. $color,
  6360. $requireName,
  6361. $color,
  6362. $require['version']
  6363. );
  6364. $this->writeTreeLine($info);
  6365. $treeBar = str_replace('â””', ' ', $treeBar);
  6366. $packagesInTree = array($package['name'], $requireName);
  6367. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  6368. }
  6369. }
  6370. }
  6371. }
  6372. protected function generatePackageTree(
  6373. PackageInterface $package,
  6374. RepositoryInterface $installedRepo,
  6375. RepositoryInterface $distantRepos
  6376. ) {
  6377. $requires = $package->getRequires();
  6378. ksort($requires);
  6379. $children = array();
  6380. foreach ($requires as $requireName => $require) {
  6381. $packagesInTree = array($package->getName(), $requireName);
  6382. $treeChildDesc = array(
  6383. 'name' => $requireName,
  6384. 'version' => $require->getPrettyConstraint(),
  6385. );
  6386. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  6387. if ($deepChildren) {
  6388. $treeChildDesc['requires'] = $deepChildren;
  6389. }
  6390. $children[] = $treeChildDesc;
  6391. }
  6392. $tree = array(
  6393. 'name' => $package->getPrettyName(),
  6394. 'version' => $package->getPrettyVersion(),
  6395. 'description' => $package->getDescription(),
  6396. );
  6397. if ($children) {
  6398. $tree['requires'] = $children;
  6399. }
  6400. return $tree;
  6401. }
  6402. protected function displayTree(
  6403. $package,
  6404. array $packagesInTree,
  6405. $previousTreeBar = '├',
  6406. $level = 1
  6407. ) {
  6408. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  6409. if (isset($package['requires'])) {
  6410. $requires = $package['requires'];
  6411. $treeBar = $previousTreeBar . ' ├';
  6412. $i = 0;
  6413. $total = count($requires);
  6414. foreach ($requires as $require) {
  6415. $currentTree = $packagesInTree;
  6416. $i++;
  6417. if ($i === $total) {
  6418. $treeBar = $previousTreeBar . ' â””';
  6419. }
  6420. $colorIdent = $level % count($this->colors);
  6421. $color = $this->colors[$colorIdent];
  6422. $circularWarn = in_array(
  6423. $require['name'],
  6424. $currentTree,
  6425. true
  6426. ) ? '(circular dependency aborted here)' : '';
  6427. $info = rtrim(sprintf(
  6428. '%s──<%s>%s</%s> %s %s',
  6429. $treeBar,
  6430. $color,
  6431. $require['name'],
  6432. $color,
  6433. $require['version'],
  6434. $circularWarn
  6435. ));
  6436. $this->writeTreeLine($info);
  6437. $treeBar = str_replace('â””', ' ', $treeBar);
  6438. $currentTree[] = $require['name'];
  6439. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  6440. }
  6441. }
  6442. }
  6443. protected function addTree(
  6444. $name,
  6445. $package,
  6446. RepositoryInterface $installedRepo,
  6447. RepositoryInterface $distantRepos,
  6448. array $packagesInTree
  6449. ) {
  6450. $children = array();
  6451. list($package, $versions) = $this->getPackage(
  6452. $installedRepo,
  6453. $distantRepos,
  6454. $name,
  6455. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  6456. );
  6457. if (is_object($package)) {
  6458. $requires = $package->getRequires();
  6459. ksort($requires);
  6460. foreach ($requires as $requireName => $require) {
  6461. $currentTree = $packagesInTree;
  6462. $treeChildDesc = array(
  6463. 'name' => $requireName,
  6464. 'version' => $require->getPrettyConstraint(),
  6465. );
  6466. if (!in_array($requireName, $currentTree, true)) {
  6467. $currentTree[] = $requireName;
  6468. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  6469. if ($deepChildren) {
  6470. $treeChildDesc['requires'] = $deepChildren;
  6471. }
  6472. }
  6473. $children[] = $treeChildDesc;
  6474. }
  6475. }
  6476. return $children;
  6477. }
  6478. private function updateStatusToVersionStyle($updateStatus)
  6479. {
  6480. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  6481. }
  6482. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  6483. {
  6484. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  6485. return 'up-to-date';
  6486. }
  6487. $constraint = $package->getVersion();
  6488. if (0 !== strpos($constraint, 'dev-')) {
  6489. $constraint = '^'.$constraint;
  6490. }
  6491. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  6492. return 'semver-safe-update';
  6493. }
  6494. return 'update-possible';
  6495. }
  6496. private function writeTreeLine($line)
  6497. {
  6498. $io = $this->getIO();
  6499. if (!$io->isDecorated()) {
  6500. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  6501. }
  6502. $io->write($line);
  6503. }
  6504. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  6505. {
  6506. $name = $package->getName();
  6507. $versionSelector = new VersionSelector($this->getPool($composer));
  6508. $stability = $composer->getPackage()->getMinimumStability();
  6509. $flags = $composer->getPackage()->getStabilityFlags();
  6510. if (isset($flags[$name])) {
  6511. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  6512. }
  6513. $bestStability = $stability;
  6514. if ($composer->getPackage()->getPreferStable()) {
  6515. $bestStability = $package->getStability();
  6516. }
  6517. $targetVersion = null;
  6518. if (0 === strpos($package->getVersion(), 'dev-')) {
  6519. $targetVersion = $package->getVersion();
  6520. }
  6521. if ($targetVersion === null && $minorOnly) {
  6522. $targetVersion = '^' . $package->getVersion();
  6523. }
  6524. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  6525. }
  6526. private function getPool(Composer $composer)
  6527. {
  6528. if (!$this->pool) {
  6529. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  6530. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  6531. }
  6532. return $this->pool;
  6533. }
  6534. }
  6535. <?php
  6536. namespace Composer\Command;
  6537. use Symfony\Component\Console\Input\InputInterface;
  6538. use Symfony\Component\Console\Input\InputOption;
  6539. use Symfony\Component\Console\Output\OutputInterface;
  6540. use Composer\Downloader\ChangeReportInterface;
  6541. use Composer\Downloader\DvcsDownloaderInterface;
  6542. use Composer\Downloader\VcsCapableDownloaderInterface;
  6543. use Composer\Package\Dumper\ArrayDumper;
  6544. use Composer\Package\Version\VersionGuesser;
  6545. use Composer\Package\Version\VersionParser;
  6546. use Composer\Plugin\CommandEvent;
  6547. use Composer\Plugin\PluginEvents;
  6548. use Composer\Script\ScriptEvents;
  6549. use Composer\Util\ProcessExecutor;
  6550. class StatusCommand extends BaseCommand
  6551. {
  6552. const EXIT_CODE_ERRORS = 1;
  6553. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  6554. const EXIT_CODE_VERSION_CHANGES = 4;
  6555. protected function configure()
  6556. {
  6557. $this
  6558. ->setName('status')
  6559. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  6560. ->setDefinition(array(
  6561. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  6562. ))
  6563. ->setHelp(
  6564. <<<EOT
  6565. The status command displays a list of dependencies that have
  6566. been modified locally.
  6567. Read more at https://getcomposer.org/doc/03-cli.md#status
  6568. EOT
  6569. )
  6570. ;
  6571. }
  6572. protected function execute(InputInterface $input, OutputInterface $output)
  6573. {
  6574. $composer = $this->getComposer();
  6575. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6576. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6577. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6578. $exitCode = $this->doExecute($input, $output);
  6579. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6580. return $exitCode;
  6581. }
  6582. private function doExecute(InputInterface $input, OutputInterface $output)
  6583. {
  6584. $composer = $this->getComposer();
  6585. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6586. $dm = $composer->getDownloadManager();
  6587. $im = $composer->getInstallationManager();
  6588. $errors = array();
  6589. $io = $this->getIO();
  6590. $unpushedChanges = array();
  6591. $vcsVersionChanges = array();
  6592. $parser = new VersionParser;
  6593. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6594. $dumper = new ArrayDumper;
  6595. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6596. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6597. $targetDir = $im->getInstallPath($package);
  6598. if ($downloader instanceof ChangeReportInterface) {
  6599. if (is_link($targetDir)) {
  6600. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6601. }
  6602. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6603. $errors[$targetDir] = $changes;
  6604. }
  6605. }
  6606. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6607. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6608. switch ($package->getInstallationSource()) {
  6609. case 'source':
  6610. $previousRef = $package->getSourceReference();
  6611. break;
  6612. case 'dist':
  6613. $previousRef = $package->getDistReference();
  6614. break;
  6615. default:
  6616. $previousRef = null;
  6617. }
  6618. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6619. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6620. $vcsVersionChanges[$targetDir] = array(
  6621. 'previous' => array(
  6622. 'version' => $package->getPrettyVersion(),
  6623. 'ref' => $previousRef,
  6624. ),
  6625. 'current' => array(
  6626. 'version' => $currentVersion['pretty_version'],
  6627. 'ref' => $currentVersion['commit'],
  6628. ),
  6629. );
  6630. }
  6631. }
  6632. }
  6633. if ($downloader instanceof DvcsDownloaderInterface) {
  6634. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6635. $unpushedChanges[$targetDir] = $unpushed;
  6636. }
  6637. }
  6638. }
  6639. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6640. $io->writeError('<info>No local changes</info>');
  6641. return 0;
  6642. }
  6643. if ($errors) {
  6644. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6645. foreach ($errors as $path => $changes) {
  6646. if ($input->getOption('verbose')) {
  6647. $indentedChanges = implode("\n", array_map(function ($line) {
  6648. return ' ' . ltrim($line);
  6649. }, explode("\n", $changes)));
  6650. $io->write('<info>'.$path.'</info>:');
  6651. $io->write($indentedChanges);
  6652. } else {
  6653. $io->write($path);
  6654. }
  6655. }
  6656. }
  6657. if ($unpushedChanges) {
  6658. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6659. foreach ($unpushedChanges as $path => $changes) {
  6660. if ($input->getOption('verbose')) {
  6661. $indentedChanges = implode("\n", array_map(function ($line) {
  6662. return ' ' . ltrim($line);
  6663. }, explode("\n", $changes)));
  6664. $io->write('<info>'.$path.'</info>:');
  6665. $io->write($indentedChanges);
  6666. } else {
  6667. $io->write($path);
  6668. }
  6669. }
  6670. }
  6671. if ($vcsVersionChanges) {
  6672. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6673. foreach ($vcsVersionChanges as $path => $changes) {
  6674. if ($input->getOption('verbose')) {
  6675. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6676. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6677. if ($io->isVeryVerbose()) {
  6678. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6679. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6680. }
  6681. $io->write('<info>'.$path.'</info>:');
  6682. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6683. } else {
  6684. $io->write($path);
  6685. }
  6686. }
  6687. }
  6688. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6689. $io->writeError('Use --verbose (-v) to see a list of files');
  6690. }
  6691. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6692. }
  6693. }
  6694. <?php
  6695. namespace Composer\Command;
  6696. use Composer\Repository\PlatformRepository;
  6697. use Symfony\Component\Console\Input\InputArgument;
  6698. use Symfony\Component\Console\Input\InputInterface;
  6699. use Symfony\Component\Console\Input\InputOption;
  6700. use Symfony\Component\Console\Output\OutputInterface;
  6701. class SuggestsCommand extends BaseCommand
  6702. {
  6703. protected function configure()
  6704. {
  6705. $this
  6706. ->setName('suggests')
  6707. ->setDescription('Shows package suggestions.')
  6708. ->setDefinition(array(
  6709. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6710. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6711. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6712. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6713. ))
  6714. ->setHelp(
  6715. <<<EOT
  6716. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6717. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6718. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6719. EOT
  6720. )
  6721. ;
  6722. }
  6723. protected function execute(InputInterface $input, OutputInterface $output)
  6724. {
  6725. $lock = $this->getComposer()->getLocker()->getLockData();
  6726. if (empty($lock)) {
  6727. throw new \RuntimeException('Lockfile seems to be empty?');
  6728. }
  6729. $packages = $lock['packages'];
  6730. if (!$input->getOption('no-dev')) {
  6731. $packages += $lock['packages-dev'];
  6732. }
  6733. $filter = $input->getArgument('packages');
  6734. $installed = array();
  6735. foreach ($packages as $package) {
  6736. $installed[] = $package['name'];
  6737. if (!empty($package['provide'])) {
  6738. $installed = array_merge($installed, array_keys($package['provide']));
  6739. }
  6740. if (!empty($package['replace'])) {
  6741. $installed = array_merge($installed, array_keys($package['replace']));
  6742. }
  6743. }
  6744. $installed = array_flip($installed);
  6745. ksort($installed);
  6746. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6747. $suggesters = array();
  6748. $suggested = array();
  6749. foreach ($packages as $package) {
  6750. $packageName = $package['name'];
  6751. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6752. continue;
  6753. }
  6754. foreach ($package['suggest'] as $suggestion => $reason) {
  6755. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6756. continue;
  6757. }
  6758. if (!isset($installed[$suggestion])) {
  6759. $suggesters[$packageName][$suggestion] = $reason;
  6760. $suggested[$suggestion][$packageName] = $reason;
  6761. }
  6762. }
  6763. }
  6764. ksort($suggesters);
  6765. ksort($suggested);
  6766. $mode = 0;
  6767. $io = $this->getIO();
  6768. if ($input->getOption('by-package') || $io->isVerbose()) {
  6769. $mode |= 1;
  6770. }
  6771. if ($input->getOption('by-suggestion')) {
  6772. $mode |= 2;
  6773. }
  6774. if ($mode === 0) {
  6775. foreach (array_keys($suggested) as $suggestion) {
  6776. $io->write(sprintf('<info>%s</info>', $suggestion));
  6777. }
  6778. return 0;
  6779. }
  6780. if ($mode & 1) {
  6781. foreach ($suggesters as $suggester => $suggestions) {
  6782. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6783. foreach ($suggestions as $suggestion => $reason) {
  6784. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6785. }
  6786. $io->write('');
  6787. }
  6788. }
  6789. if ($mode & 2) {
  6790. if ($mode & 1) {
  6791. $io->write(str_repeat('-', 78));
  6792. }
  6793. foreach ($suggested as $suggestion => $suggesters) {
  6794. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6795. foreach ($suggesters as $suggester => $reason) {
  6796. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6797. }
  6798. $io->write('');
  6799. }
  6800. }
  6801. return 0;
  6802. }
  6803. }
  6804. <?php
  6805. namespace Composer\Command;
  6806. use Composer\Composer;
  6807. use Composer\Installer;
  6808. use Composer\IO\IOInterface;
  6809. use Composer\Plugin\CommandEvent;
  6810. use Composer\Plugin\PluginEvents;
  6811. use Symfony\Component\Console\Helper\Table;
  6812. use Symfony\Component\Console\Input\InputInterface;
  6813. use Symfony\Component\Console\Input\InputOption;
  6814. use Symfony\Component\Console\Input\InputArgument;
  6815. use Symfony\Component\Console\Output\OutputInterface;
  6816. use Symfony\Component\Console\Question\Question;
  6817. class UpdateCommand extends BaseCommand
  6818. {
  6819. protected function configure()
  6820. {
  6821. $this
  6822. ->setName('update')
  6823. ->setAliases(array('u', 'upgrade'))
  6824. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6825. ->setDefinition(array(
  6826. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6827. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6828. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6829. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6830. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6831. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6832. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6833. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6834. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6835. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6836. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6837. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6838. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of allowed packages to the allow list, except those defined in root package.'),
  6839. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of allowed packages to the allow list, including those defined in root package.'),
  6840. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6841. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6842. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6843. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6844. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6845. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6846. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6847. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6848. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6849. ))
  6850. ->setHelp(
  6851. <<<EOT
  6852. The <info>update</info> command reads the composer.json file from the
  6853. current directory, processes it, and updates, removes or installs all the
  6854. dependencies.
  6855. <info>php composer.phar update</info>
  6856. To limit the update operation to a few packages, you can list the package(s)
  6857. you want to update as such:
  6858. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6859. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6860. from a specific vendor:
  6861. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6862. To select packages names interactively with auto-completion use <info>-i</info>.
  6863. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6864. EOT
  6865. )
  6866. ;
  6867. }
  6868. protected function execute(InputInterface $input, OutputInterface $output)
  6869. {
  6870. $io = $this->getIO();
  6871. if ($input->getOption('no-custom-installers')) {
  6872. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6873. $input->setOption('no-plugins', true);
  6874. }
  6875. if ($input->getOption('dev')) {
  6876. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6877. }
  6878. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6879. $packages = $input->getArgument('packages');
  6880. if ($input->getOption('interactive')) {
  6881. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6882. }
  6883. if ($input->getOption('root-reqs')) {
  6884. $require = array_keys($composer->getPackage()->getRequires());
  6885. if (!$input->getOption('no-dev')) {
  6886. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6887. $require = array_merge($require, $requireDev);
  6888. }
  6889. if (!empty($packages)) {
  6890. $packages = array_intersect($packages, $require);
  6891. } else {
  6892. $packages = $require;
  6893. }
  6894. }
  6895. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6896. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6897. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6898. $install = Installer::create($io, $composer);
  6899. $config = $composer->getConfig();
  6900. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6901. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6902. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6903. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6904. $install
  6905. ->setDryRun($input->getOption('dry-run'))
  6906. ->setVerbose($input->getOption('verbose'))
  6907. ->setPreferSource($preferSource)
  6908. ->setPreferDist($preferDist)
  6909. ->setDevMode(!$input->getOption('no-dev'))
  6910. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6911. ->setRunScripts(!$input->getOption('no-scripts'))
  6912. ->setSkipSuggest($input->getOption('no-suggest'))
  6913. ->setOptimizeAutoloader($optimize)
  6914. ->setClassMapAuthoritative($authoritative)
  6915. ->setApcuAutoloader($apcu)
  6916. ->setUpdate(true)
  6917. ->setUpdateAllowList($input->getOption('lock') ? array('lock') : $packages)
  6918. ->setAllowListTransitiveDependencies($input->getOption('with-dependencies'))
  6919. ->setAllowListAllDependencies($input->getOption('with-all-dependencies'))
  6920. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6921. ->setPreferStable($input->getOption('prefer-stable'))
  6922. ->setPreferLowest($input->getOption('prefer-lowest'))
  6923. ;
  6924. if ($input->getOption('no-plugins')) {
  6925. $install->disablePlugins();
  6926. }
  6927. return $install->run();
  6928. }
  6929. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6930. {
  6931. if (!$input->isInteractive()) {
  6932. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6933. }
  6934. $requires = array_merge(
  6935. $composer->getPackage()->getRequires(),
  6936. $composer->getPackage()->getDevRequires()
  6937. );
  6938. $autocompleterValues = array();
  6939. foreach ($requires as $require) {
  6940. $target = $require->getTarget();
  6941. $autocompleterValues[strtolower($target)] = $target;
  6942. }
  6943. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6944. foreach ($installedPackages as $package) {
  6945. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6946. }
  6947. $helper = $this->getHelper('question');
  6948. $question = new Question('<comment>Enter package name: </comment>', null);
  6949. $io->writeError('<info>Press enter without value to end submission</info>');
  6950. do {
  6951. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6952. $question->setAutocompleterValues($autocompleterValues);
  6953. $addedPackage = $helper->ask($input, $output, $question);
  6954. if (!is_string($addedPackage) || empty($addedPackage)) {
  6955. break;
  6956. }
  6957. $addedPackage = strtolower($addedPackage);
  6958. if (!in_array($addedPackage, $packages)) {
  6959. $packages[] = $addedPackage;
  6960. }
  6961. } while (true);
  6962. $packages = array_filter($packages);
  6963. if (!$packages) {
  6964. throw new \InvalidArgumentException('You must enter minimum one package.');
  6965. }
  6966. $table = new Table($output);
  6967. $table->setHeaders(array('Selected packages'));
  6968. foreach ($packages as $package) {
  6969. $table->addRow(array($package));
  6970. }
  6971. $table->render();
  6972. if ($io->askConfirmation(sprintf(
  6973. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6974. 1 === count($packages) ? '' : 's'
  6975. ), true)) {
  6976. return $packages;
  6977. }
  6978. throw new \RuntimeException('Installation aborted.');
  6979. }
  6980. }
  6981. <?php
  6982. namespace Composer\Command;
  6983. use Composer\Factory;
  6984. use Composer\Package\Loader\ValidatingArrayLoader;
  6985. use Composer\Plugin\CommandEvent;
  6986. use Composer\Plugin\PluginEvents;
  6987. use Composer\Util\ConfigValidator;
  6988. use Symfony\Component\Console\Input\InputArgument;
  6989. use Symfony\Component\Console\Input\InputInterface;
  6990. use Symfony\Component\Console\Input\InputOption;
  6991. use Symfony\Component\Console\Output\OutputInterface;
  6992. class ValidateCommand extends BaseCommand
  6993. {
  6994. protected function configure()
  6995. {
  6996. $this
  6997. ->setName('validate')
  6998. ->setDescription('Validates a composer.json and composer.lock.')
  6999. ->setDefinition(array(
  7000. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  7001. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  7002. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  7003. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  7004. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  7005. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  7006. ))
  7007. ->setHelp(
  7008. <<<EOT
  7009. The validate command validates a given composer.json and composer.lock
  7010. Exit codes in case of errors are:
  7011. 1 validation warning(s), only when --strict is given
  7012. 2 validation error(s)
  7013. 3 file unreadable or missing
  7014. Read more at https://getcomposer.org/doc/03-cli.md#validate
  7015. EOT
  7016. );
  7017. }
  7018. protected function execute(InputInterface $input, OutputInterface $output)
  7019. {
  7020. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  7021. $io = $this->getIO();
  7022. if (!file_exists($file)) {
  7023. $io->writeError('<error>' . $file . ' not found.</error>');
  7024. return 3;
  7025. }
  7026. if (!is_readable($file)) {
  7027. $io->writeError('<error>' . $file . ' is not readable.</error>');
  7028. return 3;
  7029. }
  7030. $validator = new ConfigValidator($io);
  7031. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  7032. $checkPublish = !$input->getOption('no-check-publish');
  7033. $checkLock = !$input->getOption('no-check-lock');
  7034. $isStrict = $input->getOption('strict');
  7035. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7036. $lockErrors = array();
  7037. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  7038. $locker = $composer->getLocker();
  7039. if ($locker->isLocked() && !$locker->isFresh()) {
  7040. $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>`.';
  7041. }
  7042. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  7043. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7044. if ($input->getOption('with-dependencies')) {
  7045. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7046. foreach ($localRepo->getPackages() as $package) {
  7047. $path = $composer->getInstallationManager()->getInstallPath($package);
  7048. $file = $path . '/composer.json';
  7049. if (is_dir($path) && file_exists($file)) {
  7050. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7051. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  7052. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7053. $exitCode = max($depCode, $exitCode);
  7054. }
  7055. }
  7056. }
  7057. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  7058. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7059. $exitCode = max($eventCode, $exitCode);
  7060. return $exitCode;
  7061. }
  7062. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  7063. {
  7064. $doPrintSchemaUrl = false;
  7065. if ($errors) {
  7066. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  7067. } elseif ($publishErrors) {
  7068. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  7069. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  7070. $doPrintSchemaUrl = $printSchemaUrl;
  7071. } elseif ($warnings) {
  7072. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  7073. $doPrintSchemaUrl = $printSchemaUrl;
  7074. } else {
  7075. $io->write('<info>' . $name . ' is valid</info>');
  7076. }
  7077. if ($doPrintSchemaUrl) {
  7078. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  7079. }
  7080. $extraWarnings = array();
  7081. if ($checkPublish) {
  7082. $errors = array_merge($errors, $publishErrors);
  7083. } else {
  7084. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  7085. }
  7086. if ($checkLock) {
  7087. $errors = array_merge($errors, $lockErrors);
  7088. } else {
  7089. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  7090. }
  7091. $messages = array(
  7092. 'error' => $errors,
  7093. 'warning' => array_merge($warnings, $extraWarnings),
  7094. );
  7095. foreach ($messages as $style => $msgs) {
  7096. foreach ($msgs as $msg) {
  7097. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  7098. }
  7099. }
  7100. }
  7101. }
  7102. <?php
  7103. namespace Composer;
  7104. use Composer\Package\RootPackageInterface;
  7105. use Composer\Package\Locker;
  7106. use Composer\Repository\RepositoryManager;
  7107. use Composer\Installer\InstallationManager;
  7108. use Composer\Plugin\PluginManager;
  7109. use Composer\Downloader\DownloadManager;
  7110. use Composer\EventDispatcher\EventDispatcher;
  7111. use Composer\Autoload\AutoloadGenerator;
  7112. use Composer\Package\Archiver\ArchiveManager;
  7113. class Composer
  7114. {
  7115. const VERSION = '1.10.10';
  7116. const BRANCH_ALIAS_VERSION = '';
  7117. const RELEASE_DATE = '2020-08-03 11:35:19';
  7118. const SOURCE_VERSION = '';
  7119. const RUNTIME_API_VERSION = '1.0.0';
  7120. public static function getVersion()
  7121. {
  7122. if (self::VERSION === '@package_version'.'@') {
  7123. return self::SOURCE_VERSION;
  7124. }
  7125. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  7126. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  7127. }
  7128. return self::VERSION;
  7129. }
  7130. private $package;
  7131. private $locker;
  7132. private $repositoryManager;
  7133. private $downloadManager;
  7134. private $installationManager;
  7135. private $pluginManager;
  7136. private $config;
  7137. private $eventDispatcher;
  7138. private $autoloadGenerator;
  7139. private $archiveManager;
  7140. public function setPackage(RootPackageInterface $package)
  7141. {
  7142. $this->package = $package;
  7143. }
  7144. public function getPackage()
  7145. {
  7146. return $this->package;
  7147. }
  7148. public function setConfig(Config $config)
  7149. {
  7150. $this->config = $config;
  7151. }
  7152. public function getConfig()
  7153. {
  7154. return $this->config;
  7155. }
  7156. public function setLocker(Locker $locker)
  7157. {
  7158. $this->locker = $locker;
  7159. }
  7160. public function getLocker()
  7161. {
  7162. return $this->locker;
  7163. }
  7164. public function setRepositoryManager(RepositoryManager $manager)
  7165. {
  7166. $this->repositoryManager = $manager;
  7167. }
  7168. public function getRepositoryManager()
  7169. {
  7170. return $this->repositoryManager;
  7171. }
  7172. public function setDownloadManager(DownloadManager $manager)
  7173. {
  7174. $this->downloadManager = $manager;
  7175. }
  7176. public function getDownloadManager()
  7177. {
  7178. return $this->downloadManager;
  7179. }
  7180. public function setArchiveManager(ArchiveManager $manager)
  7181. {
  7182. $this->archiveManager = $manager;
  7183. }
  7184. public function getArchiveManager()
  7185. {
  7186. return $this->archiveManager;
  7187. }
  7188. public function setInstallationManager(InstallationManager $manager)
  7189. {
  7190. $this->installationManager = $manager;
  7191. }
  7192. public function getInstallationManager()
  7193. {
  7194. return $this->installationManager;
  7195. }
  7196. public function setPluginManager(PluginManager $manager)
  7197. {
  7198. $this->pluginManager = $manager;
  7199. }
  7200. public function getPluginManager()
  7201. {
  7202. return $this->pluginManager;
  7203. }
  7204. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  7205. {
  7206. $this->eventDispatcher = $eventDispatcher;
  7207. }
  7208. public function getEventDispatcher()
  7209. {
  7210. return $this->eventDispatcher;
  7211. }
  7212. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  7213. {
  7214. $this->autoloadGenerator = $autoloadGenerator;
  7215. }
  7216. public function getAutoloadGenerator()
  7217. {
  7218. return $this->autoloadGenerator;
  7219. }
  7220. }
  7221. <?php
  7222. namespace Composer;
  7223. use Composer\Config\ConfigSourceInterface;
  7224. use Composer\Downloader\TransportException;
  7225. use Composer\IO\IOInterface;
  7226. use Composer\Util\Platform;
  7227. use Composer\Util\ProcessExecutor;
  7228. class Config
  7229. {
  7230. const RELATIVE_PATHS = 1;
  7231. public static $defaultConfig = array(
  7232. 'process-timeout' => 300,
  7233. 'use-include-path' => false,
  7234. 'preferred-install' => 'auto',
  7235. 'notify-on-install' => true,
  7236. 'github-protocols' => array('https', 'ssh', 'git'),
  7237. 'vendor-dir' => 'vendor',
  7238. 'bin-dir' => '{$vendor-dir}/bin',
  7239. 'cache-dir' => '{$home}/cache',
  7240. 'data-dir' => '{$home}',
  7241. 'cache-files-dir' => '{$cache-dir}/files',
  7242. 'cache-repo-dir' => '{$cache-dir}/repo',
  7243. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  7244. 'cache-ttl' => 15552000,
  7245. 'cache-files-ttl' => null,
  7246. 'cache-files-maxsize' => '300MiB',
  7247. 'bin-compat' => 'auto',
  7248. 'discard-changes' => false,
  7249. 'autoloader-suffix' => null,
  7250. 'sort-packages' => false,
  7251. 'optimize-autoloader' => false,
  7252. 'classmap-authoritative' => false,
  7253. 'apcu-autoloader' => false,
  7254. 'prepend-autoloader' => true,
  7255. 'github-domains' => array('github.com'),
  7256. 'bitbucket-expose-hostname' => true,
  7257. 'disable-tls' => false,
  7258. 'secure-http' => true,
  7259. 'cafile' => null,
  7260. 'capath' => null,
  7261. 'github-expose-hostname' => true,
  7262. 'gitlab-domains' => array('gitlab.com'),
  7263. 'store-auths' => 'prompt',
  7264. 'platform' => array(),
  7265. 'archive-format' => 'tar',
  7266. 'archive-dir' => '.',
  7267. 'htaccess-protect' => true,
  7268. 'use-github-api' => true,
  7269. 'lock' => true,
  7270. );
  7271. public static $defaultRepositories = array(
  7272. 'packagist.org' => array(
  7273. 'type' => 'composer',
  7274. 'url' => 'https?://repo.packagist.org',
  7275. 'allow_ssl_downgrade' => true,
  7276. ),
  7277. );
  7278. private $config;
  7279. private $baseDir;
  7280. private $repositories;
  7281. private $configSource;
  7282. private $authConfigSource;
  7283. private $useEnvironment;
  7284. private $warnedHosts = array();
  7285. public function __construct($useEnvironment = true, $baseDir = null)
  7286. {
  7287. $this->config = static::$defaultConfig;
  7288. $this->repositories = static::$defaultRepositories;
  7289. $this->useEnvironment = (bool) $useEnvironment;
  7290. $this->baseDir = $baseDir;
  7291. }
  7292. public function setConfigSource(ConfigSourceInterface $source)
  7293. {
  7294. $this->configSource = $source;
  7295. }
  7296. public function getConfigSource()
  7297. {
  7298. return $this->configSource;
  7299. }
  7300. public function setAuthConfigSource(ConfigSourceInterface $source)
  7301. {
  7302. $this->authConfigSource = $source;
  7303. }
  7304. public function getAuthConfigSource()
  7305. {
  7306. return $this->authConfigSource;
  7307. }
  7308. public function merge($config)
  7309. {
  7310. if (!empty($config['config']) && is_array($config['config'])) {
  7311. foreach ($config['config'] as $key => $val) {
  7312. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer')) && isset($this->config[$key])) {
  7313. $this->config[$key] = array_merge($this->config[$key], $val);
  7314. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  7315. if (is_array($val) || is_array($this->config[$key])) {
  7316. if (is_string($val)) {
  7317. $val = array('*' => $val);
  7318. }
  7319. if (is_string($this->config[$key])) {
  7320. $this->config[$key] = array('*' => $this->config[$key]);
  7321. }
  7322. $this->config[$key] = array_merge($this->config[$key], $val);
  7323. if (isset($this->config[$key]['*'])) {
  7324. $wildcard = $this->config[$key]['*'];
  7325. unset($this->config[$key]['*']);
  7326. $this->config[$key]['*'] = $wildcard;
  7327. }
  7328. } else {
  7329. $this->config[$key] = $val;
  7330. }
  7331. } else {
  7332. $this->config[$key] = $val;
  7333. }
  7334. }
  7335. }
  7336. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  7337. $this->repositories = array_reverse($this->repositories, true);
  7338. $newRepos = array_reverse($config['repositories'], true);
  7339. foreach ($newRepos as $name => $repository) {
  7340. if (false === $repository) {
  7341. $this->disableRepoByName($name);
  7342. continue;
  7343. }
  7344. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  7345. $this->disableRepoByName(key($repository));
  7346. continue;
  7347. }
  7348. if (is_int($name)) {
  7349. $this->repositories[] = $repository;
  7350. } else {
  7351. if ($name === 'packagist') {
  7352. $this->repositories[$name . '.org'] = $repository;
  7353. } else {
  7354. $this->repositories[$name] = $repository;
  7355. }
  7356. }
  7357. }
  7358. $this->repositories = array_reverse($this->repositories, true);
  7359. }
  7360. }
  7361. public function getRepositories()
  7362. {
  7363. return $this->repositories;
  7364. }
  7365. public function get($key, $flags = 0)
  7366. {
  7367. switch ($key) {
  7368. case 'vendor-dir':
  7369. case 'bin-dir':
  7370. case 'process-timeout':
  7371. case 'data-dir':
  7372. case 'cache-dir':
  7373. case 'cache-files-dir':
  7374. case 'cache-repo-dir':
  7375. case 'cache-vcs-dir':
  7376. case 'cafile':
  7377. case 'capath':
  7378. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  7379. $val = $this->getComposerEnv($env);
  7380. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  7381. $val = Platform::expandPath($val);
  7382. if (substr($key, -4) !== '-dir') {
  7383. return $val;
  7384. }
  7385. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  7386. case 'htaccess-protect':
  7387. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  7388. if (false === $value) {
  7389. $value = $this->config[$key];
  7390. }
  7391. return $value !== 'false' && (bool) $value;
  7392. case 'cache-ttl':
  7393. return (int) $this->config[$key];
  7394. case 'cache-files-maxsize':
  7395. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  7396. throw new \RuntimeException(
  7397. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  7398. );
  7399. }
  7400. $size = $matches[1];
  7401. if (isset($matches[2])) {
  7402. switch (strtolower($matches[2])) {
  7403. case 'g':
  7404. $size *= 1024;
  7405. case 'm':
  7406. $size *= 1024;
  7407. case 'k':
  7408. $size *= 1024;
  7409. break;
  7410. }
  7411. }
  7412. return $size;
  7413. case 'cache-files-ttl':
  7414. if (isset($this->config[$key])) {
  7415. return (int) $this->config[$key];
  7416. }
  7417. return (int) $this->config['cache-ttl'];
  7418. case 'home':
  7419. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  7420. return rtrim($this->process($val, $flags), '/\\');
  7421. case 'bin-compat':
  7422. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  7423. if (!in_array($value, array('auto', 'full'))) {
  7424. throw new \RuntimeException(
  7425. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  7426. );
  7427. }
  7428. return $value;
  7429. case 'discard-changes':
  7430. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  7431. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  7432. throw new \RuntimeException(
  7433. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  7434. );
  7435. }
  7436. if ('stash' === $env) {
  7437. return 'stash';
  7438. }
  7439. return $env !== 'false' && (bool) $env;
  7440. }
  7441. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  7442. throw new \RuntimeException(
  7443. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  7444. );
  7445. }
  7446. return $this->config[$key];
  7447. case 'github-protocols':
  7448. $protos = $this->config['github-protocols'];
  7449. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  7450. unset($protos[$index]);
  7451. }
  7452. if (reset($protos) === 'http') {
  7453. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  7454. }
  7455. return $protos;
  7456. case 'disable-tls':
  7457. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7458. case 'secure-http':
  7459. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7460. case 'use-github-api':
  7461. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7462. case 'lock':
  7463. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7464. default:
  7465. if (!isset($this->config[$key])) {
  7466. return null;
  7467. }
  7468. return $this->process($this->config[$key], $flags);
  7469. }
  7470. }
  7471. public function all($flags = 0)
  7472. {
  7473. $all = array(
  7474. 'repositories' => $this->getRepositories(),
  7475. );
  7476. foreach (array_keys($this->config) as $key) {
  7477. $all['config'][$key] = $this->get($key, $flags);
  7478. }
  7479. return $all;
  7480. }
  7481. public function raw()
  7482. {
  7483. return array(
  7484. 'repositories' => $this->getRepositories(),
  7485. 'config' => $this->config,
  7486. );
  7487. }
  7488. public function has($key)
  7489. {
  7490. return array_key_exists($key, $this->config);
  7491. }
  7492. private function process($value, $flags)
  7493. {
  7494. $config = $this;
  7495. if (!is_string($value)) {
  7496. return $value;
  7497. }
  7498. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  7499. return $config->get($match[1], $flags);
  7500. }, $value);
  7501. }
  7502. private function realpath($path)
  7503. {
  7504. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  7505. return $path;
  7506. }
  7507. return $this->baseDir . '/' . $path;
  7508. }
  7509. private function getComposerEnv($var)
  7510. {
  7511. if ($this->useEnvironment) {
  7512. return getenv($var);
  7513. }
  7514. return false;
  7515. }
  7516. private function disableRepoByName($name)
  7517. {
  7518. if (isset($this->repositories[$name])) {
  7519. unset($this->repositories[$name]);
  7520. } elseif ($name === 'packagist') {
  7521. unset($this->repositories['packagist.org']);
  7522. }
  7523. }
  7524. public function prohibitUrlByConfig($url, IOInterface $io = null)
  7525. {
  7526. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  7527. return;
  7528. }
  7529. $scheme = parse_url($url, PHP_URL_SCHEME);
  7530. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  7531. if ($this->get('secure-http')) {
  7532. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  7533. } elseif ($io) {
  7534. $host = parse_url($url, PHP_URL_HOST);
  7535. if (!isset($this->warnedHosts[$host])) {
  7536. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  7537. }
  7538. $this->warnedHosts[$host] = true;
  7539. }
  7540. }
  7541. }
  7542. public static function disableProcessTimeout()
  7543. {
  7544. ProcessExecutor::setTimeout(0);
  7545. }
  7546. }
  7547. <?php
  7548. namespace Composer\Config;
  7549. interface ConfigSourceInterface
  7550. {
  7551. public function addRepository($name, $config);
  7552. public function removeRepository($name);
  7553. public function addConfigSetting($name, $value);
  7554. public function removeConfigSetting($name);
  7555. public function addProperty($name, $value);
  7556. public function removeProperty($name);
  7557. public function addLink($type, $name, $value);
  7558. public function removeLink($type, $name);
  7559. public function getName();
  7560. }
  7561. <?php
  7562. namespace Composer\Config;
  7563. use Composer\Json\JsonFile;
  7564. use Composer\Json\JsonManipulator;
  7565. use Composer\Util\Silencer;
  7566. class JsonConfigSource implements ConfigSourceInterface
  7567. {
  7568. private $file;
  7569. private $authConfig;
  7570. public function __construct(JsonFile $file, $authConfig = false)
  7571. {
  7572. $this->file = $file;
  7573. $this->authConfig = $authConfig;
  7574. }
  7575. public function getName()
  7576. {
  7577. return $this->file->getPath();
  7578. }
  7579. public function addRepository($name, $config)
  7580. {
  7581. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7582. if (isset($config['repositories'])) {
  7583. foreach ($config['repositories'] as $index => $val) {
  7584. if ($index === $repo) {
  7585. continue;
  7586. }
  7587. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7588. unset($config['repositories'][$index]);
  7589. $config['repositories']['packagist.org'] = false;
  7590. break;
  7591. }
  7592. }
  7593. }
  7594. $config['repositories'][$repo] = $repoConfig;
  7595. });
  7596. }
  7597. public function removeRepository($name)
  7598. {
  7599. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7600. unset($config['repositories'][$repo]);
  7601. });
  7602. }
  7603. public function addConfigSetting($name, $value)
  7604. {
  7605. $authConfig = $this->authConfig;
  7606. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7607. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7608. list($key, $host) = explode('.', $key, 2);
  7609. if ($authConfig) {
  7610. $config[$key][$host] = $val;
  7611. } else {
  7612. $config['config'][$key][$host] = $val;
  7613. }
  7614. } else {
  7615. $config['config'][$key] = $val;
  7616. }
  7617. });
  7618. }
  7619. public function removeConfigSetting($name)
  7620. {
  7621. $authConfig = $this->authConfig;
  7622. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7623. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7624. list($key, $host) = explode('.', $key, 2);
  7625. if ($authConfig) {
  7626. unset($config[$key][$host]);
  7627. } else {
  7628. unset($config['config'][$key][$host]);
  7629. }
  7630. } else {
  7631. unset($config['config'][$key]);
  7632. }
  7633. });
  7634. }
  7635. public function addProperty($name, $value)
  7636. {
  7637. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7638. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7639. $bits = explode('.', $key);
  7640. $last = array_pop($bits);
  7641. $arr = &$config[reset($bits)];
  7642. foreach ($bits as $bit) {
  7643. if (!isset($arr[$bit])) {
  7644. $arr[$bit] = array();
  7645. }
  7646. $arr = &$arr[$bit];
  7647. }
  7648. $arr[$last] = $val;
  7649. } else {
  7650. $config[$key] = $val;
  7651. }
  7652. });
  7653. }
  7654. public function removeProperty($name)
  7655. {
  7656. $authConfig = $this->authConfig;
  7657. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7658. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7659. $bits = explode('.', $key);
  7660. $last = array_pop($bits);
  7661. $arr = &$config[reset($bits)];
  7662. foreach ($bits as $bit) {
  7663. if (!isset($arr[$bit])) {
  7664. return;
  7665. }
  7666. $arr = &$arr[$bit];
  7667. }
  7668. unset($arr[$last]);
  7669. } else {
  7670. unset($config[$key]);
  7671. }
  7672. });
  7673. }
  7674. public function addLink($type, $name, $value)
  7675. {
  7676. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7677. $config[$type][$name] = $value;
  7678. });
  7679. }
  7680. public function removeLink($type, $name)
  7681. {
  7682. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7683. unset($config[$type][$name]);
  7684. if (0 === count($config[$type])) {
  7685. unset($config[$type]);
  7686. }
  7687. });
  7688. }
  7689. protected function manipulateJson($method, $args, $fallback)
  7690. {
  7691. $args = func_get_args();
  7692. array_shift($args);
  7693. $fallback = array_pop($args);
  7694. if ($this->file->exists()) {
  7695. if (!is_writable($this->file->getPath())) {
  7696. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7697. }
  7698. if (!is_readable($this->file->getPath())) {
  7699. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7700. }
  7701. $contents = file_get_contents($this->file->getPath());
  7702. } elseif ($this->authConfig) {
  7703. $contents = "{\n}\n";
  7704. } else {
  7705. $contents = "{\n \"config\": {\n }\n}\n";
  7706. }
  7707. $manipulator = new JsonManipulator($contents);
  7708. $newFile = !$this->file->exists();
  7709. if ($this->authConfig && $method === 'addConfigSetting') {
  7710. $method = 'addSubNode';
  7711. list($mainNode, $name) = explode('.', $args[0], 2);
  7712. $args = array($mainNode, $name, $args[1]);
  7713. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7714. $method = 'removeSubNode';
  7715. list($mainNode, $name) = explode('.', $args[0], 2);
  7716. $args = array($mainNode, $name);
  7717. }
  7718. if (call_user_func_array(array($manipulator, $method), $args)) {
  7719. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7720. } else {
  7721. $config = $this->file->read();
  7722. $this->arrayUnshiftRef($args, $config);
  7723. call_user_func_array($fallback, $args);
  7724. foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev') as $linkType) {
  7725. if (isset($config[$linkType]) && $config[$linkType] === array()) {
  7726. $config[$linkType] = new \stdClass;
  7727. }
  7728. }
  7729. $this->file->write($config);
  7730. }
  7731. if ($newFile) {
  7732. Silencer::call('chmod', $this->file->getPath(), 0600);
  7733. }
  7734. }
  7735. private function arrayUnshiftRef(&$array, &$value)
  7736. {
  7737. $return = array_unshift($array, '');
  7738. $array[0] = &$value;
  7739. return $return;
  7740. }
  7741. }
  7742. <?php
  7743. namespace Composer\Console;
  7744. use Composer\IO\NullIO;
  7745. use Composer\Util\Platform;
  7746. use Composer\Util\Silencer;
  7747. use Symfony\Component\Console\Application as BaseApplication;
  7748. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7749. use Symfony\Component\Console\Helper\HelperSet;
  7750. use Symfony\Component\Console\Helper\QuestionHelper;
  7751. use Symfony\Component\Console\Input\InputInterface;
  7752. use Symfony\Component\Console\Input\InputOption;
  7753. use Symfony\Component\Console\Output\OutputInterface;
  7754. use Composer\Command;
  7755. use Composer\Composer;
  7756. use Composer\Factory;
  7757. use Composer\IO\IOInterface;
  7758. use Composer\IO\ConsoleIO;
  7759. use Composer\Json\JsonValidationException;
  7760. use Composer\Util\ErrorHandler;
  7761. use Composer\EventDispatcher\ScriptExecutionException;
  7762. use Composer\Exception\NoSslException;
  7763. class Application extends BaseApplication
  7764. {
  7765. protected $composer;
  7766. protected $io;
  7767. private static $logo = ' ______
  7768. / ____/___ ____ ___ ____ ____ ________ _____
  7769. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7770. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7771. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7772. /_/
  7773. ';
  7774. private $hasPluginCommands = false;
  7775. private $disablePluginsByDefault = false;
  7776. private $initialWorkingDirectory = '';
  7777. public function __construct()
  7778. {
  7779. static $shutdownRegistered = false;
  7780. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7781. ini_set('xdebug.show_exception_trace', false);
  7782. ini_set('xdebug.scream', false);
  7783. }
  7784. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7785. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7786. }
  7787. if (!$shutdownRegistered) {
  7788. $shutdownRegistered = true;
  7789. register_shutdown_function(function () {
  7790. $lastError = error_get_last();
  7791. if ($lastError && $lastError['message'] &&
  7792. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7793. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7794. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7795. }
  7796. });
  7797. }
  7798. $this->io = new NullIO();
  7799. $this->initialWorkingDirectory = getcwd();
  7800. parent::__construct('Composer', Composer::getVersion());
  7801. }
  7802. public function run(InputInterface $input = null, OutputInterface $output = null)
  7803. {
  7804. if (null === $output) {
  7805. $output = Factory::createOutput();
  7806. }
  7807. return parent::run($input, $output);
  7808. }
  7809. public function doRun(InputInterface $input, OutputInterface $output)
  7810. {
  7811. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7812. if (getenv('COMPOSER_NO_INTERACTION')) {
  7813. $input->setInteractive(false);
  7814. }
  7815. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7816. new QuestionHelper(),
  7817. )));
  7818. ErrorHandler::register($io);
  7819. if ($input->hasParameterOption('--no-cache')) {
  7820. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7821. $_SERVER['COMPOSER_CACHE_DIR'] = Platform::isWindows() ? 'nul' : '/dev/null';
  7822. putenv('COMPOSER_CACHE_DIR='.$_SERVER['COMPOSER_CACHE_DIR']);
  7823. }
  7824. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7825. $oldWorkingDir = getcwd();
  7826. chdir($newWorkDir);
  7827. $this->initialWorkingDirectory = $newWorkDir;
  7828. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7829. }
  7830. $commandName = '';
  7831. if ($name = $this->getCommandName($input)) {
  7832. try {
  7833. $commandName = $this->find($name)->getName();
  7834. } catch (CommandNotFoundException $e) {
  7835. $commandName = false;
  7836. } catch (\InvalidArgumentException $e) {
  7837. }
  7838. }
  7839. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile())) {
  7840. $dir = dirname(getcwd());
  7841. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7842. while (dirname($dir) !== $dir && $dir !== $home) {
  7843. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7844. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7845. $oldWorkingDir = getcwd();
  7846. chdir($dir);
  7847. }
  7848. break;
  7849. }
  7850. $dir = dirname($dir);
  7851. }
  7852. }
  7853. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7854. try {
  7855. foreach ($this->getPluginCommands() as $command) {
  7856. if ($this->has($command->getName())) {
  7857. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7858. } else {
  7859. $this->add($command);
  7860. }
  7861. }
  7862. } catch (NoSslException $e) {
  7863. }
  7864. $this->hasPluginCommands = true;
  7865. }
  7866. $isProxyCommand = false;
  7867. if ($name = $this->getCommandName($input)) {
  7868. try {
  7869. $command = $this->find($name);
  7870. $commandName = $command->getName();
  7871. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7872. } catch (\InvalidArgumentException $e) {
  7873. }
  7874. }
  7875. if (!$isProxyCommand) {
  7876. $io->writeError(sprintf(
  7877. 'Running %s (%s) with %s on %s',
  7878. Composer::getVersion(),
  7879. Composer::RELEASE_DATE,
  7880. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7881. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7882. ), true, IOInterface::DEBUG);
  7883. if (PHP_VERSION_ID < 50302) {
  7884. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  7885. }
  7886. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7887. $io->writeError('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7888. }
  7889. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7890. $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']));
  7891. }
  7892. if (
  7893. !Platform::isWindows()
  7894. && function_exists('exec')
  7895. && !getenv('COMPOSER_ALLOW_SUPERUSER')
  7896. && (ini_get('open_basedir') || !file_exists('/.dockerenv'))
  7897. ) {
  7898. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7899. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7900. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7901. }
  7902. if ($uid = (int) getenv('SUDO_UID')) {
  7903. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7904. }
  7905. }
  7906. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7907. }
  7908. Silencer::call(function () use ($io) {
  7909. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7910. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7911. $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()));
  7912. }
  7913. });
  7914. $file = Factory::getComposerFile();
  7915. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7916. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7917. foreach ($composer['scripts'] as $script => $dummy) {
  7918. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7919. if ($this->has($script)) {
  7920. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7921. } else {
  7922. $description = null;
  7923. if (isset($composer['scripts-descriptions'][$script])) {
  7924. $description = $composer['scripts-descriptions'][$script];
  7925. }
  7926. $this->add(new Command\ScriptAliasCommand($script, $description));
  7927. }
  7928. }
  7929. }
  7930. }
  7931. }
  7932. }
  7933. try {
  7934. if ($input->hasParameterOption('--profile')) {
  7935. $startTime = microtime(true);
  7936. $this->io->enableDebugging($startTime);
  7937. }
  7938. $result = parent::doRun($input, $output);
  7939. if (isset($oldWorkingDir)) {
  7940. chdir($oldWorkingDir);
  7941. }
  7942. if (isset($startTime)) {
  7943. $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');
  7944. }
  7945. restore_error_handler();
  7946. return $result;
  7947. } catch (ScriptExecutionException $e) {
  7948. return $e->getCode();
  7949. } catch (\Exception $e) {
  7950. $this->hintCommonErrors($e);
  7951. restore_error_handler();
  7952. throw $e;
  7953. }
  7954. }
  7955. private function getNewWorkingDir(InputInterface $input)
  7956. {
  7957. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7958. if (false !== $workingDir && !is_dir($workingDir)) {
  7959. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7960. }
  7961. return $workingDir;
  7962. }
  7963. private function hintCommonErrors($exception)
  7964. {
  7965. $io = $this->getIO();
  7966. Silencer::suppress();
  7967. try {
  7968. $composer = $this->getComposer(false, true);
  7969. if ($composer) {
  7970. $config = $composer->getConfig();
  7971. $minSpaceFree = 1024 * 1024;
  7972. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7973. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7974. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7975. ) {
  7976. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7977. }
  7978. }
  7979. } catch (\Exception $e) {
  7980. }
  7981. Silencer::restore();
  7982. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7983. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7984. $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);
  7985. }
  7986. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7987. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7988. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7989. }
  7990. }
  7991. public function getComposer($required = true, $disablePlugins = null)
  7992. {
  7993. if (null === $disablePlugins) {
  7994. $disablePlugins = $this->disablePluginsByDefault;
  7995. }
  7996. if (null === $this->composer) {
  7997. try {
  7998. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7999. } catch (\InvalidArgumentException $e) {
  8000. if ($required) {
  8001. $this->io->writeError($e->getMessage());
  8002. exit(1);
  8003. }
  8004. } catch (JsonValidationException $e) {
  8005. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  8006. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  8007. throw new JsonValidationException($message);
  8008. }
  8009. }
  8010. return $this->composer;
  8011. }
  8012. public function resetComposer()
  8013. {
  8014. $this->composer = null;
  8015. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  8016. $this->getIO()->resetAuthentications();
  8017. }
  8018. }
  8019. public function getIO()
  8020. {
  8021. return $this->io;
  8022. }
  8023. public function getHelp()
  8024. {
  8025. return self::$logo . parent::getHelp();
  8026. }
  8027. protected function getDefaultCommands()
  8028. {
  8029. $commands = array_merge(parent::getDefaultCommands(), array(
  8030. new Command\AboutCommand(),
  8031. new Command\ConfigCommand(),
  8032. new Command\DependsCommand(),
  8033. new Command\ProhibitsCommand(),
  8034. new Command\InitCommand(),
  8035. new Command\InstallCommand(),
  8036. new Command\CreateProjectCommand(),
  8037. new Command\UpdateCommand(),
  8038. new Command\SearchCommand(),
  8039. new Command\ValidateCommand(),
  8040. new Command\ShowCommand(),
  8041. new Command\SuggestsCommand(),
  8042. new Command\RequireCommand(),
  8043. new Command\DumpAutoloadCommand(),
  8044. new Command\StatusCommand(),
  8045. new Command\ArchiveCommand(),
  8046. new Command\DiagnoseCommand(),
  8047. new Command\RunScriptCommand(),
  8048. new Command\LicensesCommand(),
  8049. new Command\GlobalCommand(),
  8050. new Command\ClearCacheCommand(),
  8051. new Command\RemoveCommand(),
  8052. new Command\HomeCommand(),
  8053. new Command\ExecCommand(),
  8054. new Command\OutdatedCommand(),
  8055. new Command\CheckPlatformReqsCommand(),
  8056. new Command\FundCommand(),
  8057. ));
  8058. if ('phar:' === substr(__FILE__, 0, 5)) {
  8059. $commands[] = new Command\SelfUpdateCommand();
  8060. }
  8061. return $commands;
  8062. }
  8063. public function getLongVersion()
  8064. {
  8065. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  8066. return sprintf(
  8067. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  8068. $this->getName(),
  8069. Composer::BRANCH_ALIAS_VERSION,
  8070. $this->getVersion(),
  8071. Composer::RELEASE_DATE
  8072. );
  8073. }
  8074. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  8075. }
  8076. protected function getDefaultInputDefinition()
  8077. {
  8078. $definition = parent::getDefaultInputDefinition();
  8079. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  8080. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  8081. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  8082. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  8083. return $definition;
  8084. }
  8085. private function getPluginCommands()
  8086. {
  8087. $commands = array();
  8088. $composer = $this->getComposer(false, false);
  8089. if (null === $composer) {
  8090. $composer = Factory::createGlobal($this->io, false);
  8091. }
  8092. if (null !== $composer) {
  8093. $pm = $composer->getPluginManager();
  8094. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  8095. $newCommands = $capability->getCommands();
  8096. if (!is_array($newCommands)) {
  8097. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  8098. }
  8099. foreach ($newCommands as $command) {
  8100. if (!$command instanceof Command\BaseCommand) {
  8101. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  8102. }
  8103. }
  8104. $commands = array_merge($commands, $newCommands);
  8105. }
  8106. }
  8107. return $commands;
  8108. }
  8109. public function getInitialWorkingDirectory()
  8110. {
  8111. return $this->initialWorkingDirectory;
  8112. }
  8113. }
  8114. <?php
  8115. namespace Composer\Console;
  8116. use Symfony\Component\Console\Formatter\OutputFormatter;
  8117. class HtmlOutputFormatter extends OutputFormatter
  8118. {
  8119. private static $availableForegroundColors = array(
  8120. 30 => 'black',
  8121. 31 => 'red',
  8122. 32 => 'green',
  8123. 33 => 'yellow',
  8124. 34 => 'blue',
  8125. 35 => 'magenta',
  8126. 36 => 'cyan',
  8127. 37 => 'white',
  8128. );
  8129. private static $availableBackgroundColors = array(
  8130. 40 => 'black',
  8131. 41 => 'red',
  8132. 42 => 'green',
  8133. 43 => 'yellow',
  8134. 44 => 'blue',
  8135. 45 => 'magenta',
  8136. 46 => 'cyan',
  8137. 47 => 'white',
  8138. );
  8139. private static $availableOptions = array(
  8140. 1 => 'bold',
  8141. 4 => 'underscore',
  8142. );
  8143. public function __construct(array $styles = array())
  8144. {
  8145. parent::__construct(true, $styles);
  8146. }
  8147. public function format($message)
  8148. {
  8149. $formatted = parent::format($message);
  8150. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  8151. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  8152. }
  8153. private function formatHtml($matches)
  8154. {
  8155. $out = '<span style="';
  8156. foreach (explode(';', $matches[1]) as $code) {
  8157. if (isset(self::$availableForegroundColors[$code])) {
  8158. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  8159. } elseif (isset(self::$availableBackgroundColors[$code])) {
  8160. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  8161. } elseif (isset(self::$availableOptions[$code])) {
  8162. switch (self::$availableOptions[$code]) {
  8163. case 'bold':
  8164. $out .= 'font-weight:bold;';
  8165. break;
  8166. case 'underscore':
  8167. $out .= 'text-decoration:underline;';
  8168. break;
  8169. }
  8170. }
  8171. }
  8172. return $out.'">'.$matches[2].'</span>';
  8173. }
  8174. }
  8175. <?php
  8176. namespace Composer\DependencyResolver;
  8177. class Decisions implements \Iterator, \Countable
  8178. {
  8179. const DECISION_LITERAL = 0;
  8180. const DECISION_REASON = 1;
  8181. protected $pool;
  8182. protected $decisionMap;
  8183. protected $decisionQueue = array();
  8184. public function __construct($pool)
  8185. {
  8186. $this->pool = $pool;
  8187. $this->decisionMap = array();
  8188. }
  8189. public function decide($literal, $level, $why)
  8190. {
  8191. $this->addDecision($literal, $level);
  8192. $this->decisionQueue[] = array(
  8193. self::DECISION_LITERAL => $literal,
  8194. self::DECISION_REASON => $why,
  8195. );
  8196. }
  8197. public function satisfy($literal)
  8198. {
  8199. $packageId = abs($literal);
  8200. return (
  8201. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  8202. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  8203. );
  8204. }
  8205. public function conflict($literal)
  8206. {
  8207. $packageId = abs($literal);
  8208. return (
  8209. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  8210. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  8211. );
  8212. }
  8213. public function decided($literalOrPackageId)
  8214. {
  8215. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  8216. }
  8217. public function undecided($literalOrPackageId)
  8218. {
  8219. return empty($this->decisionMap[abs($literalOrPackageId)]);
  8220. }
  8221. public function decidedInstall($literalOrPackageId)
  8222. {
  8223. $packageId = abs($literalOrPackageId);
  8224. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  8225. }
  8226. public function decisionLevel($literalOrPackageId)
  8227. {
  8228. $packageId = abs($literalOrPackageId);
  8229. if (isset($this->decisionMap[$packageId])) {
  8230. return abs($this->decisionMap[$packageId]);
  8231. }
  8232. return 0;
  8233. }
  8234. public function decisionRule($literalOrPackageId)
  8235. {
  8236. $packageId = abs($literalOrPackageId);
  8237. foreach ($this->decisionQueue as $i => $decision) {
  8238. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  8239. return $decision[self::DECISION_REASON];
  8240. }
  8241. }
  8242. return null;
  8243. }
  8244. public function atOffset($queueOffset)
  8245. {
  8246. return $this->decisionQueue[$queueOffset];
  8247. }
  8248. public function validOffset($queueOffset)
  8249. {
  8250. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  8251. }
  8252. public function lastReason()
  8253. {
  8254. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  8255. }
  8256. public function lastLiteral()
  8257. {
  8258. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  8259. }
  8260. public function reset()
  8261. {
  8262. while ($decision = array_pop($this->decisionQueue)) {
  8263. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8264. }
  8265. }
  8266. public function resetToOffset($offset)
  8267. {
  8268. while (count($this->decisionQueue) > $offset + 1) {
  8269. $decision = array_pop($this->decisionQueue);
  8270. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8271. }
  8272. }
  8273. public function revertLast()
  8274. {
  8275. $this->decisionMap[abs($this->lastLiteral())] = 0;
  8276. array_pop($this->decisionQueue);
  8277. }
  8278. public function count()
  8279. {
  8280. return count($this->decisionQueue);
  8281. }
  8282. public function rewind()
  8283. {
  8284. end($this->decisionQueue);
  8285. }
  8286. public function current()
  8287. {
  8288. return current($this->decisionQueue);
  8289. }
  8290. public function key()
  8291. {
  8292. return key($this->decisionQueue);
  8293. }
  8294. public function next()
  8295. {
  8296. return prev($this->decisionQueue);
  8297. }
  8298. public function valid()
  8299. {
  8300. return false !== current($this->decisionQueue);
  8301. }
  8302. public function isEmpty()
  8303. {
  8304. return count($this->decisionQueue) === 0;
  8305. }
  8306. protected function addDecision($literal, $level)
  8307. {
  8308. $packageId = abs($literal);
  8309. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  8310. if ($previousDecision != 0) {
  8311. $literalString = $this->pool->literalToPrettyString($literal, array());
  8312. $package = $this->pool->literalToPackage($literal);
  8313. throw new SolverBugException(
  8314. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  8315. );
  8316. }
  8317. if ($literal > 0) {
  8318. $this->decisionMap[$packageId] = $level;
  8319. } else {
  8320. $this->decisionMap[$packageId] = -$level;
  8321. }
  8322. }
  8323. public function __toString()
  8324. {
  8325. $decisionMap = $this->decisionMap;
  8326. ksort($decisionMap);
  8327. $str = '[';
  8328. foreach ($decisionMap as $packageId => $level) {
  8329. $str .= $packageId.':'.$level.',';
  8330. }
  8331. $str .= ']';
  8332. return $str;
  8333. }
  8334. }
  8335. <?php
  8336. namespace Composer\DependencyResolver;
  8337. use Composer\Package\PackageInterface;
  8338. use Composer\Package\AliasPackage;
  8339. use Composer\Package\BasePackage;
  8340. use Composer\Semver\Constraint\Constraint;
  8341. class DefaultPolicy implements PolicyInterface
  8342. {
  8343. private $preferStable;
  8344. private $preferLowest;
  8345. public function __construct($preferStable = false, $preferLowest = false)
  8346. {
  8347. $this->preferStable = $preferStable;
  8348. $this->preferLowest = $preferLowest;
  8349. }
  8350. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  8351. {
  8352. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  8353. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  8354. }
  8355. $constraint = new Constraint($operator, $b->getVersion());
  8356. $version = new Constraint('==', $a->getVersion());
  8357. return $constraint->matchSpecific($version, true);
  8358. }
  8359. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  8360. {
  8361. $packages = array();
  8362. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  8363. if ($candidate !== $package) {
  8364. $packages[] = $candidate;
  8365. }
  8366. }
  8367. return $packages;
  8368. }
  8369. public function getPriority(Pool $pool, PackageInterface $package)
  8370. {
  8371. return $pool->getPriority($package->getRepository());
  8372. }
  8373. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  8374. {
  8375. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  8376. foreach ($packages as &$literals) {
  8377. $policy = $this;
  8378. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8379. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  8380. });
  8381. }
  8382. foreach ($packages as &$literals) {
  8383. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  8384. $literals = $this->pruneToBestVersion($pool, $literals);
  8385. $literals = $this->pruneRemoteAliases($pool, $literals);
  8386. }
  8387. $selected = call_user_func_array('array_merge', array_values($packages));
  8388. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8389. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  8390. });
  8391. return $selected;
  8392. }
  8393. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  8394. {
  8395. $packages = array();
  8396. foreach ($literals as $literal) {
  8397. $packageName = $pool->literalToPackage($literal)->getName();
  8398. if (!isset($packages[$packageName])) {
  8399. $packages[$packageName] = array();
  8400. }
  8401. if (isset($installedMap[abs($literal)])) {
  8402. array_unshift($packages[$packageName], $literal);
  8403. } else {
  8404. $packages[$packageName][] = $literal;
  8405. }
  8406. }
  8407. return $packages;
  8408. }
  8409. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  8410. {
  8411. if ($a->getRepository() === $b->getRepository()) {
  8412. if ($a->getName() === $b->getName()) {
  8413. $aAliased = $a instanceof AliasPackage;
  8414. $bAliased = $b instanceof AliasPackage;
  8415. if ($aAliased && !$bAliased) {
  8416. return -1;
  8417. }
  8418. if (!$aAliased && $bAliased) {
  8419. return 1;
  8420. }
  8421. }
  8422. if (!$ignoreReplace) {
  8423. if ($this->replaces($a, $b)) {
  8424. return 1;
  8425. }
  8426. if ($this->replaces($b, $a)) {
  8427. return -1;
  8428. }
  8429. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  8430. $requiredVendor = substr($requiredPackage, 0, $pos);
  8431. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  8432. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  8433. if ($bIsSameVendor !== $aIsSameVendor) {
  8434. return $aIsSameVendor ? -1 : 1;
  8435. }
  8436. }
  8437. }
  8438. if ($a->id === $b->id) {
  8439. return 0;
  8440. }
  8441. return ($a->id < $b->id) ? -1 : 1;
  8442. }
  8443. if (isset($installedMap[$a->id])) {
  8444. return -1;
  8445. }
  8446. if (isset($installedMap[$b->id])) {
  8447. return 1;
  8448. }
  8449. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  8450. }
  8451. protected function replaces(PackageInterface $source, PackageInterface $target)
  8452. {
  8453. foreach ($source->getReplaces() as $link) {
  8454. if ($link->getTarget() === $target->getName()
  8455. ) {
  8456. return true;
  8457. }
  8458. }
  8459. return false;
  8460. }
  8461. protected function pruneToBestVersion(Pool $pool, $literals)
  8462. {
  8463. $operator = $this->preferLowest ? '<' : '>';
  8464. $bestLiterals = array($literals[0]);
  8465. $bestPackage = $pool->literalToPackage($literals[0]);
  8466. foreach ($literals as $i => $literal) {
  8467. if (0 === $i) {
  8468. continue;
  8469. }
  8470. $package = $pool->literalToPackage($literal);
  8471. if ($this->versionCompare($package, $bestPackage, $operator)) {
  8472. $bestPackage = $package;
  8473. $bestLiterals = array($literal);
  8474. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  8475. $bestLiterals[] = $literal;
  8476. }
  8477. }
  8478. return $bestLiterals;
  8479. }
  8480. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  8481. {
  8482. $selected = array();
  8483. $priority = null;
  8484. foreach ($literals as $literal) {
  8485. $package = $pool->literalToPackage($literal);
  8486. if (isset($installedMap[$package->id])) {
  8487. $selected[] = $literal;
  8488. continue;
  8489. }
  8490. if (null === $priority) {
  8491. $priority = $this->getPriority($pool, $package);
  8492. }
  8493. if ($this->getPriority($pool, $package) != $priority) {
  8494. break;
  8495. }
  8496. $selected[] = $literal;
  8497. }
  8498. return $selected;
  8499. }
  8500. protected function pruneRemoteAliases(Pool $pool, array $literals)
  8501. {
  8502. $hasLocalAlias = false;
  8503. foreach ($literals as $literal) {
  8504. $package = $pool->literalToPackage($literal);
  8505. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8506. $hasLocalAlias = true;
  8507. break;
  8508. }
  8509. }
  8510. if (!$hasLocalAlias) {
  8511. return $literals;
  8512. }
  8513. $selected = array();
  8514. foreach ($literals as $literal) {
  8515. $package = $pool->literalToPackage($literal);
  8516. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8517. $selected[] = $literal;
  8518. }
  8519. }
  8520. return $selected;
  8521. }
  8522. }
  8523. <?php
  8524. namespace Composer\DependencyResolver;
  8525. use Composer\Package\PackageInterface;
  8526. use Composer\Package\Link;
  8527. class GenericRule extends Rule
  8528. {
  8529. protected $literals;
  8530. public function __construct(array $literals, $reason, $reasonData, $job = null)
  8531. {
  8532. parent::__construct($reason, $reasonData, $job);
  8533. sort($literals);
  8534. $this->literals = $literals;
  8535. }
  8536. public function getLiterals()
  8537. {
  8538. return $this->literals;
  8539. }
  8540. public function getHash()
  8541. {
  8542. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  8543. return $data['hash'];
  8544. }
  8545. public function equals(Rule $rule)
  8546. {
  8547. return $this->literals === $rule->getLiterals();
  8548. }
  8549. public function isAssertion()
  8550. {
  8551. return 1 === count($this->literals);
  8552. }
  8553. public function __toString()
  8554. {
  8555. $result = $this->isDisabled() ? 'disabled(' : '(';
  8556. foreach ($this->literals as $i => $literal) {
  8557. if ($i != 0) {
  8558. $result .= '|';
  8559. }
  8560. $result .= $literal;
  8561. }
  8562. $result .= ')';
  8563. return $result;
  8564. }
  8565. }
  8566. <?php
  8567. namespace Composer\DependencyResolver\Operation;
  8568. use Composer\Package\PackageInterface;
  8569. class InstallOperation extends SolverOperation
  8570. {
  8571. protected $package;
  8572. public function __construct(PackageInterface $package, $reason = null)
  8573. {
  8574. parent::__construct($reason);
  8575. $this->package = $package;
  8576. }
  8577. public function getPackage()
  8578. {
  8579. return $this->package;
  8580. }
  8581. public function getJobType()
  8582. {
  8583. return 'install';
  8584. }
  8585. public function __toString()
  8586. {
  8587. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8588. }
  8589. }
  8590. <?php
  8591. namespace Composer\DependencyResolver\Operation;
  8592. use Composer\Package\AliasPackage;
  8593. use Composer\Package\PackageInterface;
  8594. class MarkAliasInstalledOperation extends SolverOperation
  8595. {
  8596. protected $package;
  8597. public function __construct(AliasPackage $package, $reason = null)
  8598. {
  8599. parent::__construct($reason);
  8600. $this->package = $package;
  8601. }
  8602. public function getPackage()
  8603. {
  8604. return $this->package;
  8605. }
  8606. public function getJobType()
  8607. {
  8608. return 'markAliasInstalled';
  8609. }
  8610. public function __toString()
  8611. {
  8612. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8613. }
  8614. }
  8615. <?php
  8616. namespace Composer\DependencyResolver\Operation;
  8617. use Composer\Package\AliasPackage;
  8618. use Composer\Package\PackageInterface;
  8619. class MarkAliasUninstalledOperation extends SolverOperation
  8620. {
  8621. protected $package;
  8622. public function __construct(AliasPackage $package, $reason = null)
  8623. {
  8624. parent::__construct($reason);
  8625. $this->package = $package;
  8626. }
  8627. public function getPackage()
  8628. {
  8629. return $this->package;
  8630. }
  8631. public function getJobType()
  8632. {
  8633. return 'markAliasUninstalled';
  8634. }
  8635. public function __toString()
  8636. {
  8637. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8638. }
  8639. }
  8640. <?php
  8641. namespace Composer\DependencyResolver\Operation;
  8642. interface OperationInterface
  8643. {
  8644. public function getJobType();
  8645. public function getReason();
  8646. public function __toString();
  8647. }
  8648. <?php
  8649. namespace Composer\DependencyResolver\Operation;
  8650. use Composer\Package\PackageInterface;
  8651. abstract class SolverOperation implements OperationInterface
  8652. {
  8653. protected $reason;
  8654. public function __construct($reason = null)
  8655. {
  8656. $this->reason = $reason;
  8657. }
  8658. public function getReason()
  8659. {
  8660. return $this->reason;
  8661. }
  8662. protected function formatVersion(PackageInterface $package)
  8663. {
  8664. return $package->getFullPrettyVersion();
  8665. }
  8666. }
  8667. <?php
  8668. namespace Composer\DependencyResolver\Operation;
  8669. use Composer\Package\PackageInterface;
  8670. class UninstallOperation extends SolverOperation
  8671. {
  8672. protected $package;
  8673. public function __construct(PackageInterface $package, $reason = null)
  8674. {
  8675. parent::__construct($reason);
  8676. $this->package = $package;
  8677. }
  8678. public function getPackage()
  8679. {
  8680. return $this->package;
  8681. }
  8682. public function getJobType()
  8683. {
  8684. return 'uninstall';
  8685. }
  8686. public function __toString()
  8687. {
  8688. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8689. }
  8690. }
  8691. <?php
  8692. namespace Composer\DependencyResolver\Operation;
  8693. use Composer\Package\PackageInterface;
  8694. use Composer\Package\Version\VersionParser;
  8695. class UpdateOperation extends SolverOperation
  8696. {
  8697. protected $initialPackage;
  8698. protected $targetPackage;
  8699. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8700. {
  8701. parent::__construct($reason);
  8702. $this->initialPackage = $initial;
  8703. $this->targetPackage = $target;
  8704. }
  8705. public function getInitialPackage()
  8706. {
  8707. return $this->initialPackage;
  8708. }
  8709. public function getTargetPackage()
  8710. {
  8711. return $this->targetPackage;
  8712. }
  8713. public function getJobType()
  8714. {
  8715. return 'update';
  8716. }
  8717. public function __toString()
  8718. {
  8719. $actionName = VersionParser::isUpgrade($this->initialPackage->getVersion(), $this->targetPackage->getVersion()) ? 'Updating' : 'Downgrading';
  8720. return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8721. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8722. }
  8723. }
  8724. <?php
  8725. namespace Composer\DependencyResolver;
  8726. use Composer\Package\PackageInterface;
  8727. interface PolicyInterface
  8728. {
  8729. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8730. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8731. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8732. }
  8733. <?php
  8734. namespace Composer\DependencyResolver;
  8735. use Composer\Package\BasePackage;
  8736. use Composer\Package\AliasPackage;
  8737. use Composer\Package\Version\VersionParser;
  8738. use Composer\Semver\Constraint\ConstraintInterface;
  8739. use Composer\Semver\Constraint\Constraint;
  8740. use Composer\Semver\Constraint\EmptyConstraint;
  8741. use Composer\Repository\RepositoryInterface;
  8742. use Composer\Repository\CompositeRepository;
  8743. use Composer\Repository\ComposerRepository;
  8744. use Composer\Repository\InstalledRepositoryInterface;
  8745. use Composer\Repository\PlatformRepository;
  8746. use Composer\Package\PackageInterface;
  8747. class Pool implements \Countable
  8748. {
  8749. const MATCH_NAME = -1;
  8750. const MATCH_NONE = 0;
  8751. const MATCH = 1;
  8752. const MATCH_PROVIDE = 2;
  8753. const MATCH_REPLACE = 3;
  8754. const MATCH_FILTERED = 4;
  8755. protected $repositories = array();
  8756. protected $providerRepos = array();
  8757. protected $packages = array();
  8758. protected $packageByName = array();
  8759. protected $packageByExactName = array();
  8760. protected $acceptableStabilities;
  8761. protected $stabilityFlags;
  8762. protected $versionParser;
  8763. protected $providerCache = array();
  8764. protected $filterRequires;
  8765. protected $whitelist = null;
  8766. protected $id = 1;
  8767. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8768. {
  8769. $this->versionParser = new VersionParser;
  8770. $this->acceptableStabilities = array();
  8771. foreach (BasePackage::$stabilities as $stability => $value) {
  8772. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8773. $this->acceptableStabilities[$stability] = $value;
  8774. }
  8775. }
  8776. $this->stabilityFlags = $stabilityFlags;
  8777. $this->filterRequires = $filterRequires;
  8778. foreach ($filterRequires as $name => $constraint) {
  8779. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8780. unset($this->filterRequires[$name]);
  8781. }
  8782. }
  8783. }
  8784. public function setAllowList($allowList)
  8785. {
  8786. $this->setWhitelist($allowList);
  8787. }
  8788. public function setWhitelist($whitelist)
  8789. {
  8790. $this->whitelist = $whitelist;
  8791. $this->providerCache = array();
  8792. }
  8793. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8794. {
  8795. if ($repo instanceof CompositeRepository) {
  8796. $repos = $repo->getRepositories();
  8797. } else {
  8798. $repos = array($repo);
  8799. }
  8800. foreach ($repos as $repo) {
  8801. $this->repositories[] = $repo;
  8802. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8803. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8804. $this->providerRepos[] = $repo;
  8805. $repo->setRootAliases($rootAliases);
  8806. $repo->resetPackageIds();
  8807. } else {
  8808. foreach ($repo->getPackages() as $package) {
  8809. $names = $package->getNames();
  8810. $stability = $package->getStability();
  8811. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8812. $package->setId($this->id++);
  8813. $this->packages[] = $package;
  8814. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8815. foreach ($names as $provided) {
  8816. $this->packageByName[$provided][] = $package;
  8817. }
  8818. $name = $package->getName();
  8819. if (isset($rootAliases[$name][$package->getVersion()])) {
  8820. $alias = $rootAliases[$name][$package->getVersion()];
  8821. if ($package instanceof AliasPackage) {
  8822. $package = $package->getAliasOf();
  8823. }
  8824. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8825. $aliasPackage->setRootPackageAlias(true);
  8826. $aliasPackage->setId($this->id++);
  8827. $package->getRepository()->addPackage($aliasPackage);
  8828. $this->packages[] = $aliasPackage;
  8829. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8830. foreach ($aliasPackage->getNames() as $name) {
  8831. $this->packageByName[$name][] = $aliasPackage;
  8832. }
  8833. }
  8834. }
  8835. }
  8836. }
  8837. }
  8838. }
  8839. public function getPriority(RepositoryInterface $repo)
  8840. {
  8841. $priority = array_search($repo, $this->repositories, true);
  8842. if (false === $priority) {
  8843. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8844. }
  8845. return -$priority;
  8846. }
  8847. public function packageById($id)
  8848. {
  8849. return $this->packages[$id - 1];
  8850. }
  8851. public function count()
  8852. {
  8853. return count($this->packages);
  8854. }
  8855. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8856. {
  8857. if ($bypassFilters) {
  8858. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8859. }
  8860. $key = ((int) $mustMatchName).$constraint;
  8861. if (isset($this->providerCache[$name][$key])) {
  8862. return $this->providerCache[$name][$key];
  8863. }
  8864. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8865. }
  8866. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8867. {
  8868. $candidates = array();
  8869. foreach ($this->providerRepos as $repo) {
  8870. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8871. $candidates[] = $candidate;
  8872. if ($candidate->id < 1) {
  8873. $candidate->setId($this->id++);
  8874. $this->packages[$this->id - 2] = $candidate;
  8875. }
  8876. }
  8877. }
  8878. if ($mustMatchName) {
  8879. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8880. return $candidate->getName() == $name;
  8881. });
  8882. if (isset($this->packageByExactName[$name])) {
  8883. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8884. }
  8885. } elseif (isset($this->packageByName[$name])) {
  8886. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8887. }
  8888. $matches = $provideMatches = array();
  8889. $nameMatch = false;
  8890. foreach ($candidates as $candidate) {
  8891. $aliasOfCandidate = null;
  8892. if ($candidate instanceof AliasPackage) {
  8893. $aliasOfCandidate = $candidate->getAliasOf();
  8894. }
  8895. if ($this->whitelist !== null && !$bypassFilters && (
  8896. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8897. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8898. )) {
  8899. continue;
  8900. }
  8901. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8902. case self::MATCH_NONE:
  8903. break;
  8904. case self::MATCH_NAME:
  8905. $nameMatch = true;
  8906. break;
  8907. case self::MATCH:
  8908. $nameMatch = true;
  8909. $matches[] = $candidate;
  8910. break;
  8911. case self::MATCH_PROVIDE:
  8912. $provideMatches[] = $candidate;
  8913. break;
  8914. case self::MATCH_REPLACE:
  8915. $matches[] = $candidate;
  8916. break;
  8917. case self::MATCH_FILTERED:
  8918. break;
  8919. default:
  8920. throw new \UnexpectedValueException('Unexpected match type');
  8921. }
  8922. }
  8923. if ($nameMatch) {
  8924. return $matches;
  8925. }
  8926. return array_merge($matches, $provideMatches);
  8927. }
  8928. public function literalToPackage($literal)
  8929. {
  8930. $packageId = abs($literal);
  8931. return $this->packageById($packageId);
  8932. }
  8933. public function literalToPrettyString($literal, $installedMap)
  8934. {
  8935. $package = $this->literalToPackage($literal);
  8936. if (isset($installedMap[$package->id])) {
  8937. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8938. } else {
  8939. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8940. }
  8941. return $prefix.' '.$package->getPrettyString();
  8942. }
  8943. public function isPackageAcceptable($name, $stability)
  8944. {
  8945. foreach ((array) $name as $n) {
  8946. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8947. return true;
  8948. }
  8949. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8950. return true;
  8951. }
  8952. }
  8953. return false;
  8954. }
  8955. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8956. {
  8957. $candidateName = $candidate->getName();
  8958. $candidateVersion = $candidate->getVersion();
  8959. $isDev = $candidate->getStability() === 'dev';
  8960. $isAlias = $candidate instanceof AliasPackage;
  8961. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8962. $requireFilter = $this->filterRequires[$name];
  8963. } else {
  8964. $requireFilter = new EmptyConstraint;
  8965. }
  8966. if ($candidateName === $name) {
  8967. $pkgConstraint = new Constraint('==', $candidateVersion);
  8968. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8969. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8970. }
  8971. return self::MATCH_NAME;
  8972. }
  8973. $provides = $candidate->getProvides();
  8974. $replaces = $candidate->getReplaces();
  8975. if (isset($replaces[0]) || isset($provides[0])) {
  8976. foreach ($provides as $link) {
  8977. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8978. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8979. }
  8980. }
  8981. foreach ($replaces as $link) {
  8982. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8983. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8984. }
  8985. }
  8986. return self::MATCH_NONE;
  8987. }
  8988. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8989. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8990. }
  8991. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8992. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8993. }
  8994. return self::MATCH_NONE;
  8995. }
  8996. }
  8997. <?php
  8998. namespace Composer\DependencyResolver;
  8999. use Composer\Package\CompletePackageInterface;
  9000. class Problem
  9001. {
  9002. protected $reasonSeen;
  9003. protected $reasons = array();
  9004. protected $section = 0;
  9005. protected $pool;
  9006. public function __construct(Pool $pool)
  9007. {
  9008. $this->pool = $pool;
  9009. }
  9010. public function addRule(Rule $rule)
  9011. {
  9012. $this->addReason(spl_object_hash($rule), array(
  9013. 'rule' => $rule,
  9014. 'job' => $rule->getJob(),
  9015. ));
  9016. }
  9017. public function getReasons()
  9018. {
  9019. return $this->reasons;
  9020. }
  9021. public function getPrettyString(array $installedMap = array())
  9022. {
  9023. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  9024. if (count($reasons) === 1) {
  9025. reset($reasons);
  9026. $reason = current($reasons);
  9027. $job = $reason['job'];
  9028. $packageName = $job['packageName'];
  9029. $constraint = $job['constraint'];
  9030. if (isset($constraint)) {
  9031. $packages = $this->pool->whatProvides($packageName, $constraint);
  9032. } else {
  9033. $packages = array();
  9034. }
  9035. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  9036. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  9037. $version = phpversion();
  9038. $available = $this->pool->whatProvides($packageName);
  9039. if (count($available)) {
  9040. $firstAvailable = reset($available);
  9041. $version = $firstAvailable->getPrettyVersion();
  9042. $extra = $firstAvailable->getExtra();
  9043. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  9044. $version .= '; ' . $firstAvailable->getDescription();
  9045. }
  9046. }
  9047. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  9048. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  9049. return $msg . 'your HHVM version does not satisfy that requirement.';
  9050. }
  9051. if ($packageName === 'hhvm') {
  9052. return $msg . 'you are running this with PHP and not HHVM.';
  9053. }
  9054. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  9055. }
  9056. if (0 === stripos($packageName, 'ext-')) {
  9057. if (false !== strpos($packageName, ' ')) {
  9058. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  9059. }
  9060. $ext = substr($packageName, 4);
  9061. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9062. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  9063. }
  9064. if (0 === stripos($packageName, 'lib-')) {
  9065. if (strtolower($packageName) === 'lib-icu') {
  9066. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  9067. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  9068. }
  9069. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  9070. }
  9071. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  9072. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  9073. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  9074. }
  9075. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  9076. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  9077. }
  9078. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  9079. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  9080. }
  9081. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  9082. }
  9083. }
  9084. $messages = array();
  9085. foreach ($reasons as $reason) {
  9086. $rule = $reason['rule'];
  9087. $job = $reason['job'];
  9088. if ($job) {
  9089. $messages[] = $this->jobToText($job);
  9090. } elseif ($rule) {
  9091. if ($rule instanceof Rule) {
  9092. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  9093. }
  9094. }
  9095. }
  9096. return "\n - ".implode("\n - ", $messages);
  9097. }
  9098. protected function addReason($id, $reason)
  9099. {
  9100. if (!isset($this->reasonSeen[$id])) {
  9101. $this->reasonSeen[$id] = true;
  9102. $this->reasons[$this->section][] = $reason;
  9103. }
  9104. }
  9105. public function nextSection()
  9106. {
  9107. $this->section++;
  9108. }
  9109. protected function jobToText($job)
  9110. {
  9111. $packageName = $job['packageName'];
  9112. $constraint = $job['constraint'];
  9113. switch ($job['cmd']) {
  9114. case 'install':
  9115. $packages = $this->pool->whatProvides($packageName, $constraint);
  9116. if (!$packages) {
  9117. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  9118. }
  9119. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  9120. case 'update':
  9121. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  9122. case 'remove':
  9123. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  9124. }
  9125. if (isset($constraint)) {
  9126. $packages = $this->pool->whatProvides($packageName, $constraint);
  9127. } else {
  9128. $packages = array();
  9129. }
  9130. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  9131. }
  9132. protected function getPackageList($packages)
  9133. {
  9134. $prepared = array();
  9135. foreach ($packages as $package) {
  9136. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9137. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9138. }
  9139. foreach ($prepared as $name => $package) {
  9140. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9141. }
  9142. return implode(', ', $prepared);
  9143. }
  9144. protected function constraintToText($constraint)
  9145. {
  9146. return $constraint ? ' '.$constraint->getPrettyString() : '';
  9147. }
  9148. }
  9149. <?php
  9150. namespace Composer\DependencyResolver;
  9151. use Composer\Semver\Constraint\ConstraintInterface;
  9152. class Request
  9153. {
  9154. protected $jobs;
  9155. public function __construct()
  9156. {
  9157. $this->jobs = array();
  9158. }
  9159. public function install($packageName, ConstraintInterface $constraint = null)
  9160. {
  9161. $this->addJob($packageName, 'install', $constraint);
  9162. }
  9163. public function update($packageName, ConstraintInterface $constraint = null)
  9164. {
  9165. $this->addJob($packageName, 'update', $constraint);
  9166. }
  9167. public function remove($packageName, ConstraintInterface $constraint = null)
  9168. {
  9169. $this->addJob($packageName, 'remove', $constraint);
  9170. }
  9171. public function fix($packageName, ConstraintInterface $constraint = null)
  9172. {
  9173. $this->addJob($packageName, 'install', $constraint, true);
  9174. }
  9175. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  9176. {
  9177. $packageName = strtolower($packageName);
  9178. $this->jobs[] = array(
  9179. 'cmd' => $cmd,
  9180. 'packageName' => $packageName,
  9181. 'constraint' => $constraint,
  9182. 'fixed' => $fixed,
  9183. );
  9184. }
  9185. public function updateAll()
  9186. {
  9187. $this->jobs[] = array('cmd' => 'update-all');
  9188. }
  9189. public function getJobs()
  9190. {
  9191. return $this->jobs;
  9192. }
  9193. }
  9194. <?php
  9195. namespace Composer\DependencyResolver;
  9196. use Composer\Package\CompletePackage;
  9197. use Composer\Package\Link;
  9198. use Composer\Package\PackageInterface;
  9199. abstract class Rule
  9200. {
  9201. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  9202. const RULE_JOB_INSTALL = 2;
  9203. const RULE_JOB_REMOVE = 3;
  9204. const RULE_PACKAGE_CONFLICT = 6;
  9205. const RULE_PACKAGE_REQUIRES = 7;
  9206. const RULE_PACKAGE_OBSOLETES = 8;
  9207. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  9208. const RULE_PACKAGE_SAME_NAME = 10;
  9209. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  9210. const RULE_LEARNED = 12;
  9211. const RULE_PACKAGE_ALIAS = 13;
  9212. const BITFIELD_TYPE = 0;
  9213. const BITFIELD_REASON = 8;
  9214. const BITFIELD_DISABLED = 16;
  9215. protected $bitfield;
  9216. protected $job;
  9217. protected $reasonData;
  9218. public function __construct($reason, $reasonData, $job = null)
  9219. {
  9220. $this->reasonData = $reasonData;
  9221. if ($job) {
  9222. $this->job = $job;
  9223. }
  9224. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  9225. ($reason << self::BITFIELD_REASON) |
  9226. (255 << self::BITFIELD_TYPE);
  9227. }
  9228. abstract public function getLiterals();
  9229. abstract public function getHash();
  9230. public function getJob()
  9231. {
  9232. return $this->job;
  9233. }
  9234. abstract public function equals(Rule $rule);
  9235. public function getReason()
  9236. {
  9237. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  9238. }
  9239. public function getReasonData()
  9240. {
  9241. return $this->reasonData;
  9242. }
  9243. public function getRequiredPackage()
  9244. {
  9245. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  9246. return $this->reasonData;
  9247. }
  9248. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  9249. return $this->reasonData->getTarget();
  9250. }
  9251. }
  9252. public function setType($type)
  9253. {
  9254. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  9255. }
  9256. public function getType()
  9257. {
  9258. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  9259. }
  9260. public function disable()
  9261. {
  9262. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  9263. }
  9264. public function enable()
  9265. {
  9266. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  9267. }
  9268. public function isDisabled()
  9269. {
  9270. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9271. }
  9272. public function isEnabled()
  9273. {
  9274. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9275. }
  9276. abstract public function isAssertion();
  9277. public function getPrettyString(Pool $pool, array $installedMap = array())
  9278. {
  9279. $literals = $this->getLiterals();
  9280. $ruleText = '';
  9281. foreach ($literals as $i => $literal) {
  9282. if ($i != 0) {
  9283. $ruleText .= '|';
  9284. }
  9285. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  9286. }
  9287. switch ($this->getReason()) {
  9288. case self::RULE_INTERNAL_ALLOW_UPDATE:
  9289. return $ruleText;
  9290. case self::RULE_JOB_INSTALL:
  9291. return "Install command rule ($ruleText)";
  9292. case self::RULE_JOB_REMOVE:
  9293. return "Remove command rule ($ruleText)";
  9294. case self::RULE_PACKAGE_CONFLICT:
  9295. $package1 = $pool->literalToPackage($literals[0]);
  9296. $package2 = $pool->literalToPackage($literals[1]);
  9297. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  9298. case self::RULE_PACKAGE_REQUIRES:
  9299. $sourceLiteral = array_shift($literals);
  9300. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  9301. $requires = array();
  9302. foreach ($literals as $literal) {
  9303. $requires[] = $pool->literalToPackage($literal);
  9304. }
  9305. $text = $this->reasonData->getPrettyString($sourcePackage);
  9306. if ($requires) {
  9307. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  9308. } else {
  9309. $targetName = $this->reasonData->getTarget();
  9310. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  9311. if (defined('HHVM_VERSION')) {
  9312. return $text . ' -> your HHVM version does not satisfy that requirement.';
  9313. }
  9314. $packages = $pool->whatProvides($targetName);
  9315. $package = count($packages) ? current($packages) : phpversion();
  9316. if ($targetName === 'hhvm') {
  9317. if ($package instanceof CompletePackage) {
  9318. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9319. } else {
  9320. return $text . ' -> you are running this with PHP and not HHVM.';
  9321. }
  9322. }
  9323. if (!($package instanceof CompletePackage)) {
  9324. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  9325. }
  9326. $extra = $package->getExtra();
  9327. if (!empty($extra['config.platform'])) {
  9328. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9329. } else {
  9330. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9331. }
  9332. return $text;
  9333. }
  9334. if (0 === strpos($targetName, 'ext-')) {
  9335. $ext = substr($targetName, 4);
  9336. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9337. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  9338. }
  9339. if (0 === strpos($targetName, 'lib-')) {
  9340. $lib = substr($targetName, 4);
  9341. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  9342. }
  9343. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  9344. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  9345. }
  9346. return $text . ' -> no matching package found.';
  9347. }
  9348. return $text;
  9349. case self::RULE_PACKAGE_OBSOLETES:
  9350. return $ruleText;
  9351. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  9352. return $ruleText;
  9353. case self::RULE_PACKAGE_SAME_NAME:
  9354. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  9355. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  9356. return $ruleText;
  9357. case self::RULE_LEARNED:
  9358. return 'Conclusion: '.$ruleText;
  9359. case self::RULE_PACKAGE_ALIAS:
  9360. return $ruleText;
  9361. default:
  9362. return '('.$ruleText.')';
  9363. }
  9364. }
  9365. protected function formatPackagesUnique($pool, array $packages)
  9366. {
  9367. $prepared = array();
  9368. foreach ($packages as $package) {
  9369. if (!is_object($package)) {
  9370. $package = $pool->literalToPackage($package);
  9371. }
  9372. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9373. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9374. }
  9375. foreach ($prepared as $name => $package) {
  9376. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9377. }
  9378. return implode(', ', $prepared);
  9379. }
  9380. }
  9381. <?php
  9382. namespace Composer\DependencyResolver;
  9383. use Composer\Package\PackageInterface;
  9384. use Composer\Package\Link;
  9385. class Rule2Literals extends Rule
  9386. {
  9387. protected $literal1;
  9388. protected $literal2;
  9389. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  9390. {
  9391. parent::__construct($reason, $reasonData, $job);
  9392. if ($literal1 < $literal2) {
  9393. $this->literal1 = $literal1;
  9394. $this->literal2 = $literal2;
  9395. } else {
  9396. $this->literal1 = $literal2;
  9397. $this->literal2 = $literal1;
  9398. }
  9399. }
  9400. public function getLiterals()
  9401. {
  9402. return array($this->literal1, $this->literal2);
  9403. }
  9404. public function getHash()
  9405. {
  9406. return $this->literal1.','.$this->literal2;
  9407. }
  9408. public function equals(Rule $rule)
  9409. {
  9410. if ($rule instanceof self) {
  9411. if ($this->literal1 !== $rule->literal1) {
  9412. return false;
  9413. }
  9414. if ($this->literal2 !== $rule->literal2) {
  9415. return false;
  9416. }
  9417. return true;
  9418. }
  9419. $literals = $rule->getLiterals();
  9420. if (2 != count($literals)) {
  9421. return false;
  9422. }
  9423. if ($this->literal1 !== $literals[0]) {
  9424. return false;
  9425. }
  9426. if ($this->literal2 !== $literals[1]) {
  9427. return false;
  9428. }
  9429. return true;
  9430. }
  9431. public function isAssertion()
  9432. {
  9433. return false;
  9434. }
  9435. public function __toString()
  9436. {
  9437. $result = $this->isDisabled() ? 'disabled(' : '(';
  9438. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  9439. return $result;
  9440. }
  9441. }
  9442. <?php
  9443. namespace Composer\DependencyResolver;
  9444. class RuleSet implements \IteratorAggregate, \Countable
  9445. {
  9446. const TYPE_PACKAGE = 0;
  9447. const TYPE_JOB = 1;
  9448. const TYPE_LEARNED = 4;
  9449. public $ruleById;
  9450. protected static $types = array(
  9451. 255 => 'UNKNOWN',
  9452. self::TYPE_PACKAGE => 'PACKAGE',
  9453. self::TYPE_JOB => 'JOB',
  9454. self::TYPE_LEARNED => 'LEARNED',
  9455. );
  9456. protected $rules;
  9457. protected $nextRuleId;
  9458. protected $rulesByHash;
  9459. public function __construct()
  9460. {
  9461. $this->nextRuleId = 0;
  9462. foreach ($this->getTypes() as $type) {
  9463. $this->rules[$type] = array();
  9464. }
  9465. $this->rulesByHash = array();
  9466. }
  9467. public function add(Rule $rule, $type)
  9468. {
  9469. if (!isset(self::$types[$type])) {
  9470. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  9471. }
  9472. $hash = $rule->getHash();
  9473. if (isset($this->rulesByHash[$hash])) {
  9474. $potentialDuplicates = $this->rulesByHash[$hash];
  9475. if (is_array($potentialDuplicates)) {
  9476. foreach ($potentialDuplicates as $potentialDuplicate) {
  9477. if ($rule->equals($potentialDuplicate)) {
  9478. return;
  9479. }
  9480. }
  9481. } else {
  9482. if ($rule->equals($potentialDuplicates)) {
  9483. return;
  9484. }
  9485. }
  9486. }
  9487. if (!isset($this->rules[$type])) {
  9488. $this->rules[$type] = array();
  9489. }
  9490. $this->rules[$type][] = $rule;
  9491. $this->ruleById[$this->nextRuleId] = $rule;
  9492. $rule->setType($type);
  9493. $this->nextRuleId++;
  9494. if (!isset($this->rulesByHash[$hash])) {
  9495. $this->rulesByHash[$hash] = $rule;
  9496. } elseif (is_array($this->rulesByHash[$hash])) {
  9497. $this->rulesByHash[$hash][] = $rule;
  9498. } else {
  9499. $originalRule = $this->rulesByHash[$hash];
  9500. $this->rulesByHash[$hash] = array($originalRule, $rule);
  9501. }
  9502. }
  9503. public function count()
  9504. {
  9505. return $this->nextRuleId;
  9506. }
  9507. public function ruleById($id)
  9508. {
  9509. return $this->ruleById[$id];
  9510. }
  9511. public function getRules()
  9512. {
  9513. return $this->rules;
  9514. }
  9515. public function getIterator()
  9516. {
  9517. return new RuleSetIterator($this->getRules());
  9518. }
  9519. public function getIteratorFor($types)
  9520. {
  9521. if (!is_array($types)) {
  9522. $types = array($types);
  9523. }
  9524. $allRules = $this->getRules();
  9525. $rules = array();
  9526. foreach ($types as $type) {
  9527. $rules[$type] = $allRules[$type];
  9528. }
  9529. return new RuleSetIterator($rules);
  9530. }
  9531. public function getIteratorWithout($types)
  9532. {
  9533. if (!is_array($types)) {
  9534. $types = array($types);
  9535. }
  9536. $rules = $this->getRules();
  9537. foreach ($types as $type) {
  9538. unset($rules[$type]);
  9539. }
  9540. return new RuleSetIterator($rules);
  9541. }
  9542. public function getTypes()
  9543. {
  9544. $types = self::$types;
  9545. unset($types[255]);
  9546. return array_keys($types);
  9547. }
  9548. public function getPrettyString(Pool $pool = null)
  9549. {
  9550. $string = "\n";
  9551. foreach ($this->rules as $type => $rules) {
  9552. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  9553. foreach ($rules as $rule) {
  9554. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  9555. }
  9556. $string .= "\n\n";
  9557. }
  9558. return $string;
  9559. }
  9560. public function __toString()
  9561. {
  9562. return $this->getPrettyString(null);
  9563. }
  9564. }
  9565. <?php
  9566. namespace Composer\DependencyResolver;
  9567. use Composer\Package\PackageInterface;
  9568. use Composer\Package\AliasPackage;
  9569. use Composer\Repository\PlatformRepository;
  9570. class RuleSetGenerator
  9571. {
  9572. protected $policy;
  9573. protected $pool;
  9574. protected $rules;
  9575. protected $jobs;
  9576. protected $installedMap;
  9577. protected $allowListedMap;
  9578. protected $addedMap;
  9579. protected $conflictAddedMap;
  9580. protected $addedPackages;
  9581. protected $addedPackagesByNames;
  9582. public function __construct(PolicyInterface $policy, Pool $pool)
  9583. {
  9584. $this->policy = $policy;
  9585. $this->pool = $pool;
  9586. }
  9587. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  9588. {
  9589. $literals = array(-$package->id);
  9590. foreach ($providers as $provider) {
  9591. if ($provider === $package) {
  9592. return null;
  9593. }
  9594. $literals[] = $provider->id;
  9595. }
  9596. return new GenericRule($literals, $reason, $reasonData);
  9597. }
  9598. protected function createInstallOneOfRule(array $packages, $reason, $job)
  9599. {
  9600. $literals = array();
  9601. foreach ($packages as $package) {
  9602. $literals[] = $package->id;
  9603. }
  9604. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9605. }
  9606. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9607. {
  9608. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9609. }
  9610. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9611. {
  9612. if ($issuer === $provider) {
  9613. return null;
  9614. }
  9615. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9616. }
  9617. private function addRule($type, Rule $newRule = null)
  9618. {
  9619. if (!$newRule) {
  9620. return;
  9621. }
  9622. $this->rules->add($newRule, $type);
  9623. }
  9624. protected function allowListFromPackage(PackageInterface $package)
  9625. {
  9626. $this->whitelistFromPackage($package);
  9627. }
  9628. protected function whitelistFromPackage(PackageInterface $package)
  9629. {
  9630. $workQueue = new \SplQueue;
  9631. $workQueue->enqueue($package);
  9632. while (!$workQueue->isEmpty()) {
  9633. $package = $workQueue->dequeue();
  9634. if (isset($this->allowListedMap[$package->id])) {
  9635. continue;
  9636. }
  9637. $this->allowListedMap[$package->id] = true;
  9638. foreach ($package->getRequires() as $link) {
  9639. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9640. foreach ($possibleRequires as $require) {
  9641. $workQueue->enqueue($require);
  9642. }
  9643. }
  9644. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9645. foreach ($obsoleteProviders as $provider) {
  9646. if ($provider === $package) {
  9647. continue;
  9648. }
  9649. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9650. $workQueue->enqueue($provider);
  9651. }
  9652. }
  9653. }
  9654. }
  9655. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9656. {
  9657. $workQueue = new \SplQueue;
  9658. $workQueue->enqueue($package);
  9659. while (!$workQueue->isEmpty()) {
  9660. $package = $workQueue->dequeue();
  9661. if (isset($this->addedMap[$package->id])) {
  9662. continue;
  9663. }
  9664. $this->addedMap[$package->id] = true;
  9665. $this->addedPackages[] = $package;
  9666. foreach ($package->getNames() as $name) {
  9667. $this->addedPackagesByNames[$name][] = $package;
  9668. }
  9669. foreach ($package->getRequires() as $link) {
  9670. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9671. continue;
  9672. }
  9673. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9674. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9675. foreach ($possibleRequires as $require) {
  9676. $workQueue->enqueue($require);
  9677. }
  9678. }
  9679. $packageName = $package->getName();
  9680. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9681. foreach ($obsoleteProviders as $provider) {
  9682. if ($provider === $package) {
  9683. continue;
  9684. }
  9685. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9686. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9687. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9688. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9689. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9690. }
  9691. }
  9692. }
  9693. }
  9694. protected function addConflictRules($ignorePlatformReqs = false)
  9695. {
  9696. foreach ($this->addedPackages as $package) {
  9697. foreach ($package->getConflicts() as $link) {
  9698. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9699. continue;
  9700. }
  9701. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9702. continue;
  9703. }
  9704. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9705. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9706. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9707. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9708. }
  9709. }
  9710. }
  9711. $isInstalled = isset($this->installedMap[$package->id]);
  9712. foreach ($package->getReplaces() as $link) {
  9713. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9714. continue;
  9715. }
  9716. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9717. if ($provider === $package) {
  9718. continue;
  9719. }
  9720. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9721. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9722. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9723. }
  9724. }
  9725. }
  9726. }
  9727. }
  9728. protected function obsoleteImpossibleForAlias($package, $provider)
  9729. {
  9730. $packageIsAlias = $package instanceof AliasPackage;
  9731. $providerIsAlias = $provider instanceof AliasPackage;
  9732. $impossible = (
  9733. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9734. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9735. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9736. );
  9737. return $impossible;
  9738. }
  9739. protected function allowListFromJobs()
  9740. {
  9741. $this->whitelistFromJobs();
  9742. }
  9743. protected function whitelistFromJobs()
  9744. {
  9745. foreach ($this->jobs as $job) {
  9746. switch ($job['cmd']) {
  9747. case 'install':
  9748. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9749. foreach ($packages as $package) {
  9750. $this->allowListFromPackage($package);
  9751. }
  9752. break;
  9753. }
  9754. }
  9755. }
  9756. protected function addRulesForJobs($ignorePlatformReqs)
  9757. {
  9758. foreach ($this->jobs as $job) {
  9759. switch ($job['cmd']) {
  9760. case 'install':
  9761. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9762. break;
  9763. }
  9764. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9765. if ($packages) {
  9766. foreach ($packages as $package) {
  9767. if (!isset($this->installedMap[$package->id])) {
  9768. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9769. }
  9770. }
  9771. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9772. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9773. }
  9774. break;
  9775. case 'remove':
  9776. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9777. foreach ($packages as $package) {
  9778. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9779. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9780. }
  9781. break;
  9782. }
  9783. }
  9784. }
  9785. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9786. {
  9787. $this->jobs = $jobs;
  9788. $this->rules = new RuleSet;
  9789. $this->installedMap = $installedMap;
  9790. $this->allowListedMap = array();
  9791. foreach ($this->installedMap as $package) {
  9792. $this->allowListFromPackage($package);
  9793. }
  9794. $this->allowListFromJobs();
  9795. $this->pool->setAllowList($this->allowListedMap);
  9796. $this->addedMap = array();
  9797. $this->conflictAddedMap = array();
  9798. $this->addedPackages = array();
  9799. $this->addedPackagesByNames = array();
  9800. foreach ($this->installedMap as $package) {
  9801. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9802. }
  9803. $this->addRulesForJobs($ignorePlatformReqs);
  9804. $this->addConflictRules($ignorePlatformReqs);
  9805. $this->addedPackages = $this->addedPackagesByNames = null;
  9806. return $this->rules;
  9807. }
  9808. }
  9809. <?php
  9810. namespace Composer\DependencyResolver;
  9811. class RuleSetIterator implements \Iterator
  9812. {
  9813. protected $rules;
  9814. protected $types;
  9815. protected $currentOffset;
  9816. protected $currentType;
  9817. protected $currentTypeOffset;
  9818. public function __construct(array $rules)
  9819. {
  9820. $this->rules = $rules;
  9821. $this->types = array_keys($rules);
  9822. sort($this->types);
  9823. $this->rewind();
  9824. }
  9825. public function current()
  9826. {
  9827. return $this->rules[$this->currentType][$this->currentOffset];
  9828. }
  9829. public function key()
  9830. {
  9831. return $this->currentType;
  9832. }
  9833. public function next()
  9834. {
  9835. $this->currentOffset++;
  9836. if (!isset($this->rules[$this->currentType])) {
  9837. return;
  9838. }
  9839. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9840. $this->currentOffset = 0;
  9841. do {
  9842. $this->currentTypeOffset++;
  9843. if (!isset($this->types[$this->currentTypeOffset])) {
  9844. $this->currentType = -1;
  9845. break;
  9846. }
  9847. $this->currentType = $this->types[$this->currentTypeOffset];
  9848. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9849. }
  9850. }
  9851. public function rewind()
  9852. {
  9853. $this->currentOffset = 0;
  9854. $this->currentTypeOffset = -1;
  9855. $this->currentType = -1;
  9856. do {
  9857. $this->currentTypeOffset++;
  9858. if (!isset($this->types[$this->currentTypeOffset])) {
  9859. $this->currentType = -1;
  9860. break;
  9861. }
  9862. $this->currentType = $this->types[$this->currentTypeOffset];
  9863. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9864. }
  9865. public function valid()
  9866. {
  9867. return isset($this->rules[$this->currentType])
  9868. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9869. }
  9870. }
  9871. <?php
  9872. namespace Composer\DependencyResolver;
  9873. class RuleWatchChain extends \SplDoublyLinkedList
  9874. {
  9875. protected $offset = 0;
  9876. public function seek($offset)
  9877. {
  9878. $this->rewind();
  9879. for ($i = 0; $i < $offset; $i++, $this->next());
  9880. }
  9881. public function remove()
  9882. {
  9883. $offset = $this->key();
  9884. $this->offsetUnset($offset);
  9885. $this->seek($offset);
  9886. }
  9887. }
  9888. <?php
  9889. namespace Composer\DependencyResolver;
  9890. class RuleWatchGraph
  9891. {
  9892. protected $watchChains = array();
  9893. public function insert(RuleWatchNode $node)
  9894. {
  9895. if ($node->getRule()->isAssertion()) {
  9896. return;
  9897. }
  9898. foreach (array($node->watch1, $node->watch2) as $literal) {
  9899. if (!isset($this->watchChains[$literal])) {
  9900. $this->watchChains[$literal] = new RuleWatchChain;
  9901. }
  9902. $this->watchChains[$literal]->unshift($node);
  9903. }
  9904. }
  9905. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9906. {
  9907. $literal = -$decidedLiteral;
  9908. if (!isset($this->watchChains[$literal])) {
  9909. return null;
  9910. }
  9911. $chain = $this->watchChains[$literal];
  9912. $chain->rewind();
  9913. while ($chain->valid()) {
  9914. $node = $chain->current();
  9915. $otherWatch = $node->getOtherWatch($literal);
  9916. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9917. $ruleLiterals = $node->getRule()->getLiterals();
  9918. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9919. return $literal !== $ruleLiteral &&
  9920. $otherWatch !== $ruleLiteral &&
  9921. !$decisions->conflict($ruleLiteral);
  9922. });
  9923. if ($alternativeLiterals) {
  9924. reset($alternativeLiterals);
  9925. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9926. continue;
  9927. }
  9928. if ($decisions->conflict($otherWatch)) {
  9929. return $node->getRule();
  9930. }
  9931. $decisions->decide($otherWatch, $level, $node->getRule());
  9932. }
  9933. $chain->next();
  9934. }
  9935. return null;
  9936. }
  9937. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9938. {
  9939. if (!isset($this->watchChains[$toLiteral])) {
  9940. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9941. }
  9942. $node->moveWatch($fromLiteral, $toLiteral);
  9943. $this->watchChains[$fromLiteral]->remove();
  9944. $this->watchChains[$toLiteral]->unshift($node);
  9945. }
  9946. }
  9947. <?php
  9948. namespace Composer\DependencyResolver;
  9949. class RuleWatchNode
  9950. {
  9951. public $watch1;
  9952. public $watch2;
  9953. protected $rule;
  9954. public function __construct($rule)
  9955. {
  9956. $this->rule = $rule;
  9957. $literals = $rule->getLiterals();
  9958. $literalCount = count($literals);
  9959. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9960. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9961. }
  9962. public function watch2OnHighest(Decisions $decisions)
  9963. {
  9964. $literals = $this->rule->getLiterals();
  9965. if (count($literals) < 3) {
  9966. return;
  9967. }
  9968. $watchLevel = 0;
  9969. foreach ($literals as $literal) {
  9970. $level = $decisions->decisionLevel($literal);
  9971. if ($level > $watchLevel) {
  9972. $this->watch2 = $literal;
  9973. $watchLevel = $level;
  9974. }
  9975. }
  9976. }
  9977. public function getRule()
  9978. {
  9979. return $this->rule;
  9980. }
  9981. public function getOtherWatch($literal)
  9982. {
  9983. if ($this->watch1 == $literal) {
  9984. return $this->watch2;
  9985. }
  9986. return $this->watch1;
  9987. }
  9988. public function moveWatch($from, $to)
  9989. {
  9990. if ($this->watch1 == $from) {
  9991. $this->watch1 = $to;
  9992. } else {
  9993. $this->watch2 = $to;
  9994. }
  9995. }
  9996. }
  9997. <?php
  9998. namespace Composer\DependencyResolver;
  9999. use Composer\IO\IOInterface;
  10000. use Composer\Repository\RepositoryInterface;
  10001. use Composer\Repository\PlatformRepository;
  10002. class Solver
  10003. {
  10004. const BRANCH_LITERALS = 0;
  10005. const BRANCH_LEVEL = 1;
  10006. protected $policy;
  10007. protected $pool;
  10008. protected $installed;
  10009. protected $rules;
  10010. protected $ruleSetGenerator;
  10011. protected $jobs;
  10012. protected $updateMap = array();
  10013. protected $watchGraph;
  10014. protected $decisions;
  10015. protected $installedMap;
  10016. protected $propagateIndex;
  10017. protected $branches = array();
  10018. protected $problems = array();
  10019. protected $learnedPool = array();
  10020. protected $learnedWhy = array();
  10021. public $testFlagLearnedPositiveLiteral = false;
  10022. protected $io;
  10023. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  10024. {
  10025. $this->io = $io;
  10026. $this->policy = $policy;
  10027. $this->pool = $pool;
  10028. $this->installed = $installed;
  10029. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  10030. }
  10031. public function getRuleSetSize()
  10032. {
  10033. return count($this->rules);
  10034. }
  10035. private function makeAssertionRuleDecisions()
  10036. {
  10037. $decisionStart = count($this->decisions) - 1;
  10038. $rulesCount = count($this->rules);
  10039. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  10040. $rule = $this->rules->ruleById[$ruleIndex];
  10041. if (!$rule->isAssertion() || $rule->isDisabled()) {
  10042. continue;
  10043. }
  10044. $literals = $rule->getLiterals();
  10045. $literal = $literals[0];
  10046. if (!$this->decisions->decided($literal)) {
  10047. $this->decisions->decide($literal, 1, $rule);
  10048. continue;
  10049. }
  10050. if ($this->decisions->satisfy($literal)) {
  10051. continue;
  10052. }
  10053. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  10054. $rule->disable();
  10055. continue;
  10056. }
  10057. $conflict = $this->decisions->decisionRule($literal);
  10058. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  10059. $problem = new Problem($this->pool);
  10060. $problem->addRule($rule);
  10061. $problem->addRule($conflict);
  10062. $this->disableProblem($rule);
  10063. $this->problems[] = $problem;
  10064. continue;
  10065. }
  10066. $problem = new Problem($this->pool);
  10067. $problem->addRule($rule);
  10068. $problem->addRule($conflict);
  10069. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  10070. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  10071. continue;
  10072. }
  10073. $assertRuleLiterals = $assertRule->getLiterals();
  10074. $assertRuleLiteral = $assertRuleLiterals[0];
  10075. if (abs($literal) !== abs($assertRuleLiteral)) {
  10076. continue;
  10077. }
  10078. $problem->addRule($assertRule);
  10079. $this->disableProblem($assertRule);
  10080. }
  10081. $this->problems[] = $problem;
  10082. $this->decisions->resetToOffset($decisionStart);
  10083. $ruleIndex = -1;
  10084. }
  10085. }
  10086. protected function setupInstalledMap()
  10087. {
  10088. $this->installedMap = array();
  10089. foreach ($this->installed->getPackages() as $package) {
  10090. $this->installedMap[$package->id] = $package;
  10091. }
  10092. }
  10093. protected function checkForRootRequireProblems($ignorePlatformReqs)
  10094. {
  10095. foreach ($this->jobs as $job) {
  10096. switch ($job['cmd']) {
  10097. case 'update':
  10098. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  10099. foreach ($packages as $package) {
  10100. if (isset($this->installedMap[$package->id])) {
  10101. $this->updateMap[$package->id] = true;
  10102. }
  10103. }
  10104. break;
  10105. case 'update-all':
  10106. foreach ($this->installedMap as $package) {
  10107. $this->updateMap[$package->id] = true;
  10108. }
  10109. break;
  10110. case 'install':
  10111. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  10112. break;
  10113. }
  10114. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  10115. $problem = new Problem($this->pool);
  10116. $problem->addRule(new GenericRule(array(), null, null, $job));
  10117. $this->problems[] = $problem;
  10118. }
  10119. break;
  10120. }
  10121. }
  10122. }
  10123. public function solve(Request $request, $ignorePlatformReqs = false)
  10124. {
  10125. $this->jobs = $request->getJobs();
  10126. $this->setupInstalledMap();
  10127. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  10128. $this->checkForRootRequireProblems($ignorePlatformReqs);
  10129. $this->decisions = new Decisions($this->pool);
  10130. $this->watchGraph = new RuleWatchGraph;
  10131. foreach ($this->rules as $rule) {
  10132. $this->watchGraph->insert(new RuleWatchNode($rule));
  10133. }
  10134. $this->makeAssertionRuleDecisions();
  10135. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  10136. $before = microtime(true);
  10137. $this->runSat(true);
  10138. $this->io->writeError('', true, IOInterface::DEBUG);
  10139. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  10140. foreach ($this->installedMap as $packageId => $void) {
  10141. if ($this->decisions->undecided($packageId)) {
  10142. $this->decisions->decide(-$packageId, 1, null);
  10143. }
  10144. }
  10145. if ($this->problems) {
  10146. throw new SolverProblemsException($this->problems, $this->installedMap);
  10147. }
  10148. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  10149. return $transaction->getOperations();
  10150. }
  10151. protected function propagate($level)
  10152. {
  10153. while ($this->decisions->validOffset($this->propagateIndex)) {
  10154. $decision = $this->decisions->atOffset($this->propagateIndex);
  10155. $conflict = $this->watchGraph->propagateLiteral(
  10156. $decision[Decisions::DECISION_LITERAL],
  10157. $level,
  10158. $this->decisions
  10159. );
  10160. $this->propagateIndex++;
  10161. if ($conflict) {
  10162. return $conflict;
  10163. }
  10164. }
  10165. return null;
  10166. }
  10167. private function revert($level)
  10168. {
  10169. while (!$this->decisions->isEmpty()) {
  10170. $literal = $this->decisions->lastLiteral();
  10171. if ($this->decisions->undecided($literal)) {
  10172. break;
  10173. }
  10174. $decisionLevel = $this->decisions->decisionLevel($literal);
  10175. if ($decisionLevel <= $level) {
  10176. break;
  10177. }
  10178. $this->decisions->revertLast();
  10179. $this->propagateIndex = count($this->decisions);
  10180. }
  10181. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  10182. array_pop($this->branches);
  10183. }
  10184. }
  10185. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  10186. {
  10187. $level++;
  10188. $this->decisions->decide($literal, $level, $rule);
  10189. while (true) {
  10190. $rule = $this->propagate($level);
  10191. if (!$rule) {
  10192. break;
  10193. }
  10194. if ($level == 1) {
  10195. return $this->analyzeUnsolvable($rule, $disableRules);
  10196. }
  10197. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  10198. if ($newLevel <= 0 || $newLevel >= $level) {
  10199. throw new SolverBugException(
  10200. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  10201. );
  10202. } elseif (!$newRule) {
  10203. throw new SolverBugException(
  10204. "No rule was learned from analyzing $rule at level $level."
  10205. );
  10206. }
  10207. $level = $newLevel;
  10208. $this->revert($level);
  10209. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  10210. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  10211. $ruleNode = new RuleWatchNode($newRule);
  10212. $ruleNode->watch2OnHighest($this->decisions);
  10213. $this->watchGraph->insert($ruleNode);
  10214. $this->decisions->decide($learnLiteral, $level, $newRule);
  10215. }
  10216. return $level;
  10217. }
  10218. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  10219. {
  10220. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  10221. $selectedLiteral = array_shift($literals);
  10222. if (count($literals)) {
  10223. $this->branches[] = array($literals, $level);
  10224. }
  10225. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  10226. }
  10227. protected function analyze($level, Rule $rule)
  10228. {
  10229. $analyzedRule = $rule;
  10230. $ruleLevel = 1;
  10231. $num = 0;
  10232. $l1num = 0;
  10233. $seen = array();
  10234. $learnedLiterals = array(null);
  10235. $decisionId = count($this->decisions);
  10236. $this->learnedPool[] = array();
  10237. while (true) {
  10238. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  10239. foreach ($rule->getLiterals() as $literal) {
  10240. if ($this->decisions->satisfy($literal)) {
  10241. continue;
  10242. }
  10243. if (isset($seen[abs($literal)])) {
  10244. continue;
  10245. }
  10246. $seen[abs($literal)] = true;
  10247. $l = $this->decisions->decisionLevel($literal);
  10248. if (1 === $l) {
  10249. $l1num++;
  10250. } elseif ($level === $l) {
  10251. $num++;
  10252. } else {
  10253. $learnedLiterals[] = $literal;
  10254. if ($l > $ruleLevel) {
  10255. $ruleLevel = $l;
  10256. }
  10257. }
  10258. }
  10259. $l1retry = true;
  10260. while ($l1retry) {
  10261. $l1retry = false;
  10262. if (!$num && !--$l1num) {
  10263. break 2;
  10264. }
  10265. while (true) {
  10266. if ($decisionId <= 0) {
  10267. throw new SolverBugException(
  10268. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  10269. );
  10270. }
  10271. $decisionId--;
  10272. $decision = $this->decisions->atOffset($decisionId);
  10273. $literal = $decision[Decisions::DECISION_LITERAL];
  10274. if (isset($seen[abs($literal)])) {
  10275. break;
  10276. }
  10277. }
  10278. unset($seen[abs($literal)]);
  10279. if ($num && 0 === --$num) {
  10280. if ($literal < 0) {
  10281. $this->testFlagLearnedPositiveLiteral = true;
  10282. }
  10283. $learnedLiterals[0] = -$literal;
  10284. if (!$l1num) {
  10285. break 2;
  10286. }
  10287. foreach ($learnedLiterals as $i => $learnedLiteral) {
  10288. if ($i !== 0) {
  10289. unset($seen[abs($learnedLiteral)]);
  10290. }
  10291. }
  10292. $l1num++;
  10293. $l1retry = true;
  10294. }
  10295. }
  10296. $decision = $this->decisions->atOffset($decisionId);
  10297. $rule = $decision[Decisions::DECISION_REASON];
  10298. }
  10299. $why = count($this->learnedPool) - 1;
  10300. if (!$learnedLiterals[0]) {
  10301. throw new SolverBugException(
  10302. "Did not find a learnable literal in analyzed rule $analyzedRule."
  10303. );
  10304. }
  10305. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  10306. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  10307. }
  10308. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  10309. {
  10310. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  10311. $why = spl_object_hash($conflictRule);
  10312. $learnedWhy = $this->learnedWhy[$why];
  10313. $problemRules = $this->learnedPool[$learnedWhy];
  10314. foreach ($problemRules as $problemRule) {
  10315. $this->analyzeUnsolvableRule($problem, $problemRule);
  10316. }
  10317. return;
  10318. }
  10319. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  10320. return;
  10321. }
  10322. $problem->nextSection();
  10323. $problem->addRule($conflictRule);
  10324. }
  10325. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  10326. {
  10327. $problem = new Problem($this->pool);
  10328. $problem->addRule($conflictRule);
  10329. $this->analyzeUnsolvableRule($problem, $conflictRule);
  10330. $this->problems[] = $problem;
  10331. $seen = array();
  10332. $literals = $conflictRule->getLiterals();
  10333. foreach ($literals as $literal) {
  10334. if ($this->decisions->satisfy($literal)) {
  10335. continue;
  10336. }
  10337. $seen[abs($literal)] = true;
  10338. }
  10339. foreach ($this->decisions as $decision) {
  10340. $literal = $decision[Decisions::DECISION_LITERAL];
  10341. if (!isset($seen[abs($literal)])) {
  10342. continue;
  10343. }
  10344. $why = $decision[Decisions::DECISION_REASON];
  10345. $problem->addRule($why);
  10346. $this->analyzeUnsolvableRule($problem, $why);
  10347. $literals = $why->getLiterals();
  10348. foreach ($literals as $literal) {
  10349. if ($this->decisions->satisfy($literal)) {
  10350. continue;
  10351. }
  10352. $seen[abs($literal)] = true;
  10353. }
  10354. }
  10355. if ($disableRules) {
  10356. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  10357. $this->disableProblem($reason['rule']);
  10358. }
  10359. $this->resetSolver();
  10360. return 1;
  10361. }
  10362. return 0;
  10363. }
  10364. private function disableProblem(Rule $why)
  10365. {
  10366. $job = $why->getJob();
  10367. if (!$job) {
  10368. $why->disable();
  10369. return;
  10370. }
  10371. foreach ($this->rules as $rule) {
  10372. if ($job === $rule->getJob()) {
  10373. $rule->disable();
  10374. }
  10375. }
  10376. }
  10377. private function resetSolver()
  10378. {
  10379. $this->decisions->reset();
  10380. $this->propagateIndex = 0;
  10381. $this->branches = array();
  10382. $this->enableDisableLearnedRules();
  10383. $this->makeAssertionRuleDecisions();
  10384. }
  10385. private function enableDisableLearnedRules()
  10386. {
  10387. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  10388. $why = $this->learnedWhy[spl_object_hash($rule)];
  10389. $problemRules = $this->learnedPool[$why];
  10390. $foundDisabled = false;
  10391. foreach ($problemRules as $problemRule) {
  10392. if ($problemRule->isDisabled()) {
  10393. $foundDisabled = true;
  10394. break;
  10395. }
  10396. }
  10397. if ($foundDisabled && $rule->isEnabled()) {
  10398. $rule->disable();
  10399. } elseif (!$foundDisabled && $rule->isDisabled()) {
  10400. $rule->enable();
  10401. }
  10402. }
  10403. }
  10404. private function runSat($disableRules = true)
  10405. {
  10406. $this->propagateIndex = 0;
  10407. $decisionQueue = array();
  10408. $disableRules = array();
  10409. $level = 1;
  10410. $systemLevel = $level + 1;
  10411. while (true) {
  10412. if (1 === $level) {
  10413. $conflictRule = $this->propagate($level);
  10414. if (null !== $conflictRule) {
  10415. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  10416. continue;
  10417. }
  10418. return;
  10419. }
  10420. }
  10421. if ($level < $systemLevel) {
  10422. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  10423. foreach ($iterator as $rule) {
  10424. if ($rule->isEnabled()) {
  10425. $decisionQueue = array();
  10426. $noneSatisfied = true;
  10427. foreach ($rule->getLiterals() as $literal) {
  10428. if ($this->decisions->satisfy($literal)) {
  10429. $noneSatisfied = false;
  10430. break;
  10431. }
  10432. if ($literal > 0 && $this->decisions->undecided($literal)) {
  10433. $decisionQueue[] = $literal;
  10434. }
  10435. }
  10436. if ($noneSatisfied && count($decisionQueue)) {
  10437. if (count($this->installed) != count($this->updateMap)) {
  10438. $prunedQueue = array();
  10439. foreach ($decisionQueue as $literal) {
  10440. if (isset($this->installedMap[abs($literal)])) {
  10441. $prunedQueue[] = $literal;
  10442. if (isset($this->updateMap[abs($literal)])) {
  10443. $prunedQueue = $decisionQueue;
  10444. break;
  10445. }
  10446. }
  10447. }
  10448. $decisionQueue = $prunedQueue;
  10449. }
  10450. }
  10451. if ($noneSatisfied && count($decisionQueue)) {
  10452. $oLevel = $level;
  10453. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10454. if (0 === $level) {
  10455. return;
  10456. }
  10457. if ($level <= $oLevel) {
  10458. break;
  10459. }
  10460. }
  10461. }
  10462. }
  10463. $systemLevel = $level + 1;
  10464. $iterator->next();
  10465. if ($iterator->valid()) {
  10466. continue;
  10467. }
  10468. }
  10469. if ($level < $systemLevel) {
  10470. $systemLevel = $level;
  10471. }
  10472. $rulesCount = count($this->rules);
  10473. $pass = 1;
  10474. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  10475. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  10476. if ($i == $rulesCount) {
  10477. if (1 === $pass) {
  10478. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  10479. } else {
  10480. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  10481. }
  10482. $i = 0;
  10483. $pass++;
  10484. }
  10485. $rule = $this->rules->ruleById[$i];
  10486. $literals = $rule->getLiterals();
  10487. if ($rule->isDisabled()) {
  10488. continue;
  10489. }
  10490. $decisionQueue = array();
  10491. foreach ($literals as $literal) {
  10492. if ($literal <= 0) {
  10493. if (!$this->decisions->decidedInstall($literal)) {
  10494. continue 2;
  10495. }
  10496. } else {
  10497. if ($this->decisions->decidedInstall($literal)) {
  10498. continue 2;
  10499. }
  10500. if ($this->decisions->undecided($literal)) {
  10501. $decisionQueue[] = $literal;
  10502. }
  10503. }
  10504. }
  10505. if (count($decisionQueue) < 2) {
  10506. continue;
  10507. }
  10508. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10509. if (0 === $level) {
  10510. return;
  10511. }
  10512. $rulesCount = count($this->rules);
  10513. $n = -1;
  10514. }
  10515. if ($level < $systemLevel) {
  10516. continue;
  10517. }
  10518. if (count($this->branches)) {
  10519. $lastLiteral = null;
  10520. $lastLevel = null;
  10521. $lastBranchIndex = 0;
  10522. $lastBranchOffset = 0;
  10523. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  10524. list($literals, $l) = $this->branches[$i];
  10525. foreach ($literals as $offset => $literal) {
  10526. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  10527. $lastLiteral = $literal;
  10528. $lastBranchIndex = $i;
  10529. $lastBranchOffset = $offset;
  10530. $lastLevel = $l;
  10531. }
  10532. }
  10533. }
  10534. if ($lastLiteral) {
  10535. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  10536. $level = $lastLevel;
  10537. $this->revert($level);
  10538. $why = $this->decisions->lastReason();
  10539. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  10540. if ($level == 0) {
  10541. return;
  10542. }
  10543. continue;
  10544. }
  10545. }
  10546. break;
  10547. }
  10548. }
  10549. }
  10550. <?php
  10551. namespace Composer\DependencyResolver;
  10552. class SolverBugException extends \RuntimeException
  10553. {
  10554. public function __construct($message)
  10555. {
  10556. parent::__construct(
  10557. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  10558. "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"
  10559. );
  10560. }
  10561. }
  10562. <?php
  10563. namespace Composer\DependencyResolver;
  10564. use Composer\Util\IniHelper;
  10565. class SolverProblemsException extends \RuntimeException
  10566. {
  10567. protected $problems;
  10568. protected $installedMap;
  10569. public function __construct(array $problems, array $installedMap)
  10570. {
  10571. $this->problems = $problems;
  10572. $this->installedMap = $installedMap;
  10573. parent::__construct($this->createMessage(), 2);
  10574. }
  10575. protected function createMessage()
  10576. {
  10577. $text = "\n";
  10578. $hasExtensionProblems = false;
  10579. foreach ($this->problems as $i => $problem) {
  10580. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  10581. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  10582. $hasExtensionProblems = true;
  10583. }
  10584. }
  10585. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  10586. $text .= "\nPotential 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.";
  10587. }
  10588. if ($hasExtensionProblems) {
  10589. $text .= $this->createExtensionHint();
  10590. }
  10591. return $text;
  10592. }
  10593. public function getProblems()
  10594. {
  10595. return $this->problems;
  10596. }
  10597. private function createExtensionHint()
  10598. {
  10599. $paths = IniHelper::getAll();
  10600. if (count($paths) === 1 && empty($paths[0])) {
  10601. return '';
  10602. }
  10603. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  10604. $text .= implode("\n - ", $paths);
  10605. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  10606. return $text;
  10607. }
  10608. private function hasExtensionProblems(array $reasonSets)
  10609. {
  10610. foreach ($reasonSets as $reasonSet) {
  10611. foreach ($reasonSet as $reason) {
  10612. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10613. return true;
  10614. }
  10615. }
  10616. }
  10617. return false;
  10618. }
  10619. }
  10620. <?php
  10621. namespace Composer\DependencyResolver;
  10622. use Composer\Package\AliasPackage;
  10623. class Transaction
  10624. {
  10625. protected $policy;
  10626. protected $pool;
  10627. protected $installedMap;
  10628. protected $decisions;
  10629. protected $transaction;
  10630. public function __construct($policy, $pool, $installedMap, $decisions)
  10631. {
  10632. $this->policy = $policy;
  10633. $this->pool = $pool;
  10634. $this->installedMap = $installedMap;
  10635. $this->decisions = $decisions;
  10636. $this->transaction = array();
  10637. }
  10638. public function getOperations()
  10639. {
  10640. $installMeansUpdateMap = $this->findUpdates();
  10641. $updateMap = array();
  10642. $installMap = array();
  10643. $uninstallMap = array();
  10644. foreach ($this->decisions as $i => $decision) {
  10645. $literal = $decision[Decisions::DECISION_LITERAL];
  10646. $reason = $decision[Decisions::DECISION_REASON];
  10647. $package = $this->pool->literalToPackage($literal);
  10648. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10649. continue;
  10650. }
  10651. if ($literal > 0) {
  10652. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10653. $source = $installMeansUpdateMap[abs($literal)];
  10654. $updateMap[$package->id] = array(
  10655. 'package' => $package,
  10656. 'source' => $source,
  10657. 'reason' => $reason,
  10658. );
  10659. unset($installMeansUpdateMap[abs($literal)]);
  10660. $ignoreRemove[$source->id] = true;
  10661. } else {
  10662. $installMap[$package->id] = array(
  10663. 'package' => $package,
  10664. 'reason' => $reason,
  10665. );
  10666. }
  10667. }
  10668. }
  10669. foreach ($this->decisions as $i => $decision) {
  10670. $literal = $decision[Decisions::DECISION_LITERAL];
  10671. $reason = $decision[Decisions::DECISION_REASON];
  10672. $package = $this->pool->literalToPackage($literal);
  10673. if ($literal <= 0 &&
  10674. isset($this->installedMap[$package->id]) &&
  10675. !isset($ignoreRemove[$package->id])) {
  10676. $uninstallMap[$package->id] = array(
  10677. 'package' => $package,
  10678. 'reason' => $reason,
  10679. );
  10680. }
  10681. }
  10682. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10683. return $this->transaction;
  10684. }
  10685. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10686. {
  10687. $queue = array_map(
  10688. function ($operation) {
  10689. return $operation['package'];
  10690. },
  10691. $this->findRootPackages($installMap, $updateMap)
  10692. );
  10693. $visited = array();
  10694. while (!empty($queue)) {
  10695. $package = array_pop($queue);
  10696. $packageId = $package->id;
  10697. if (!isset($visited[$packageId])) {
  10698. $queue[] = $package;
  10699. if ($package instanceof AliasPackage) {
  10700. $queue[] = $package->getAliasOf();
  10701. } else {
  10702. foreach ($package->getRequires() as $link) {
  10703. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10704. foreach ($possibleRequires as $require) {
  10705. $queue[] = $require;
  10706. }
  10707. }
  10708. }
  10709. $visited[$package->id] = true;
  10710. } else {
  10711. if (isset($installMap[$packageId])) {
  10712. $this->install(
  10713. $installMap[$packageId]['package'],
  10714. $installMap[$packageId]['reason']
  10715. );
  10716. unset($installMap[$packageId]);
  10717. }
  10718. if (isset($updateMap[$packageId])) {
  10719. $this->update(
  10720. $updateMap[$packageId]['source'],
  10721. $updateMap[$packageId]['package'],
  10722. $updateMap[$packageId]['reason']
  10723. );
  10724. unset($updateMap[$packageId]);
  10725. }
  10726. }
  10727. }
  10728. foreach ($uninstallMap as $uninstall) {
  10729. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10730. }
  10731. }
  10732. protected function findRootPackages($installMap, $updateMap)
  10733. {
  10734. $packages = $installMap + $updateMap;
  10735. $roots = $packages;
  10736. foreach ($packages as $packageId => $operation) {
  10737. $package = $operation['package'];
  10738. if (!isset($roots[$packageId])) {
  10739. continue;
  10740. }
  10741. foreach ($package->getRequires() as $link) {
  10742. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10743. foreach ($possibleRequires as $require) {
  10744. if ($require !== $package) {
  10745. unset($roots[$require->id]);
  10746. }
  10747. }
  10748. }
  10749. }
  10750. return $roots;
  10751. }
  10752. protected function findUpdates()
  10753. {
  10754. $installMeansUpdateMap = array();
  10755. foreach ($this->decisions as $i => $decision) {
  10756. $literal = $decision[Decisions::DECISION_LITERAL];
  10757. $package = $this->pool->literalToPackage($literal);
  10758. if ($package instanceof AliasPackage) {
  10759. continue;
  10760. }
  10761. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10762. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10763. $literals = array($package->id);
  10764. foreach ($updates as $update) {
  10765. $literals[] = $update->id;
  10766. }
  10767. foreach ($literals as $updateLiteral) {
  10768. if ($updateLiteral !== $literal) {
  10769. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10770. }
  10771. }
  10772. }
  10773. }
  10774. return $installMeansUpdateMap;
  10775. }
  10776. protected function install($package, $reason)
  10777. {
  10778. if ($package instanceof AliasPackage) {
  10779. return $this->markAliasInstalled($package, $reason);
  10780. }
  10781. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10782. }
  10783. protected function update($from, $to, $reason)
  10784. {
  10785. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10786. }
  10787. protected function uninstall($package, $reason)
  10788. {
  10789. if ($package instanceof AliasPackage) {
  10790. return $this->markAliasUninstalled($package, $reason);
  10791. }
  10792. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10793. }
  10794. protected function markAliasInstalled($package, $reason)
  10795. {
  10796. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10797. }
  10798. protected function markAliasUninstalled($package, $reason)
  10799. {
  10800. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10801. }
  10802. }
  10803. <?php
  10804. namespace Composer\Downloader;
  10805. use Composer\Package\PackageInterface;
  10806. use Symfony\Component\Finder\Finder;
  10807. use Composer\IO\IOInterface;
  10808. abstract class ArchiveDownloader extends FileDownloader
  10809. {
  10810. public function download(PackageInterface $package, $path, $output = true)
  10811. {
  10812. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10813. $retries = 3;
  10814. while ($retries--) {
  10815. $fileName = parent::download($package, $path, $output);
  10816. if ($output) {
  10817. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10818. }
  10819. try {
  10820. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10821. try {
  10822. $this->extract($fileName, $temporaryDir);
  10823. } catch (\Exception $e) {
  10824. parent::clearLastCacheWrite($package);
  10825. throw $e;
  10826. }
  10827. $this->filesystem->unlink($fileName);
  10828. $contentDir = $this->getFolderContent($temporaryDir);
  10829. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10830. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10831. }
  10832. foreach ($contentDir as $file) {
  10833. $file = (string) $file;
  10834. $this->filesystem->rename($file, $path . '/' . basename($file));
  10835. }
  10836. $this->filesystem->removeDirectory($temporaryDir);
  10837. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10838. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10839. }
  10840. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10841. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10842. }
  10843. } catch (\Exception $e) {
  10844. $this->filesystem->removeDirectory($path);
  10845. $this->filesystem->removeDirectory($temporaryDir);
  10846. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10847. $this->io->writeError('');
  10848. if ($this->io->isDebug()) {
  10849. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10850. } else {
  10851. $this->io->writeError(' Invalid zip file, retrying...');
  10852. }
  10853. usleep(500000);
  10854. continue;
  10855. }
  10856. throw $e;
  10857. }
  10858. break;
  10859. }
  10860. }
  10861. protected function getFileName(PackageInterface $package, $path)
  10862. {
  10863. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10864. }
  10865. abstract protected function extract($file, $path);
  10866. private function getFolderContent($dir)
  10867. {
  10868. $finder = Finder::create()
  10869. ->ignoreVCS(false)
  10870. ->ignoreDotFiles(false)
  10871. ->notName('.DS_Store')
  10872. ->depth(0)
  10873. ->in($dir);
  10874. return iterator_to_array($finder);
  10875. }
  10876. }
  10877. <?php
  10878. namespace Composer\Downloader;
  10879. use Composer\Package\PackageInterface;
  10880. interface ChangeReportInterface
  10881. {
  10882. public function getLocalChanges(PackageInterface $package, $path);
  10883. }
  10884. <?php
  10885. namespace Composer\Downloader;
  10886. use Composer\Package\PackageInterface;
  10887. use Composer\IO\IOInterface;
  10888. use Composer\Util\Filesystem;
  10889. class DownloadManager
  10890. {
  10891. private $io;
  10892. private $preferDist = false;
  10893. private $preferSource = false;
  10894. private $packagePreferences = array();
  10895. private $filesystem;
  10896. private $downloaders = array();
  10897. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10898. {
  10899. $this->io = $io;
  10900. $this->preferSource = $preferSource;
  10901. $this->filesystem = $filesystem ?: new Filesystem();
  10902. }
  10903. public function setPreferSource($preferSource)
  10904. {
  10905. $this->preferSource = $preferSource;
  10906. return $this;
  10907. }
  10908. public function setPreferDist($preferDist)
  10909. {
  10910. $this->preferDist = $preferDist;
  10911. return $this;
  10912. }
  10913. public function setPreferences(array $preferences)
  10914. {
  10915. $this->packagePreferences = $preferences;
  10916. return $this;
  10917. }
  10918. public function setOutputProgress($outputProgress)
  10919. {
  10920. foreach ($this->downloaders as $downloader) {
  10921. $downloader->setOutputProgress($outputProgress);
  10922. }
  10923. return $this;
  10924. }
  10925. public function setDownloader($type, DownloaderInterface $downloader)
  10926. {
  10927. $type = strtolower($type);
  10928. $this->downloaders[$type] = $downloader;
  10929. return $this;
  10930. }
  10931. public function getDownloader($type)
  10932. {
  10933. $type = strtolower($type);
  10934. if (!isset($this->downloaders[$type])) {
  10935. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10936. }
  10937. return $this->downloaders[$type];
  10938. }
  10939. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10940. {
  10941. $installationSource = $package->getInstallationSource();
  10942. if ('metapackage' === $package->getType()) {
  10943. return;
  10944. }
  10945. if ('dist' === $installationSource) {
  10946. $downloader = $this->getDownloader($package->getDistType());
  10947. } elseif ('source' === $installationSource) {
  10948. $downloader = $this->getDownloader($package->getSourceType());
  10949. } else {
  10950. throw new \InvalidArgumentException(
  10951. 'Package '.$package.' seems not been installed properly'
  10952. );
  10953. }
  10954. if ($installationSource !== $downloader->getInstallationSource()) {
  10955. throw new \LogicException(sprintf(
  10956. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10957. get_class($downloader),
  10958. $downloader->getInstallationSource(),
  10959. $installationSource,
  10960. $package
  10961. ));
  10962. }
  10963. return $downloader;
  10964. }
  10965. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10966. {
  10967. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10968. $sourceType = $package->getSourceType();
  10969. $distType = $package->getDistType();
  10970. $sources = array();
  10971. if ($sourceType) {
  10972. $sources[] = 'source';
  10973. }
  10974. if ($distType) {
  10975. $sources[] = 'dist';
  10976. }
  10977. if (empty($sources)) {
  10978. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10979. }
  10980. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10981. $sources = array_reverse($sources);
  10982. }
  10983. $this->filesystem->ensureDirectoryExists($targetDir);
  10984. foreach ($sources as $i => $source) {
  10985. if (isset($e)) {
  10986. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10987. }
  10988. $package->setInstallationSource($source);
  10989. try {
  10990. $downloader = $this->getDownloaderForInstalledPackage($package);
  10991. if ($downloader) {
  10992. $downloader->download($package, $targetDir);
  10993. }
  10994. break;
  10995. } catch (\RuntimeException $e) {
  10996. if ($i === count($sources) - 1) {
  10997. throw $e;
  10998. }
  10999. $this->io->writeError(
  11000. ' <warning>Failed to download '.
  11001. $package->getPrettyName().
  11002. ' from ' . $source . ': '.
  11003. $e->getMessage().'</warning>'
  11004. );
  11005. }
  11006. }
  11007. }
  11008. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  11009. {
  11010. $downloader = $this->getDownloaderForInstalledPackage($initial);
  11011. if (!$downloader) {
  11012. return;
  11013. }
  11014. $installationSource = $initial->getInstallationSource();
  11015. if ('dist' === $installationSource) {
  11016. $initialType = $initial->getDistType();
  11017. $targetType = $target->getDistType();
  11018. } else {
  11019. $initialType = $initial->getSourceType();
  11020. $targetType = $target->getSourceType();
  11021. }
  11022. if ($target->isDev() && 'dist' === $installationSource) {
  11023. $downloader->remove($initial, $targetDir);
  11024. $this->download($target, $targetDir);
  11025. return;
  11026. }
  11027. if ($initialType === $targetType) {
  11028. $target->setInstallationSource($installationSource);
  11029. try {
  11030. $downloader->update($initial, $target, $targetDir);
  11031. return;
  11032. } catch (\RuntimeException $e) {
  11033. if (!$this->io->isInteractive()) {
  11034. throw $e;
  11035. }
  11036. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  11037. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  11038. throw $e;
  11039. }
  11040. }
  11041. }
  11042. $downloader->remove($initial, $targetDir);
  11043. $this->download($target, $targetDir, 'source' === $installationSource);
  11044. }
  11045. public function remove(PackageInterface $package, $targetDir)
  11046. {
  11047. $downloader = $this->getDownloaderForInstalledPackage($package);
  11048. if ($downloader) {
  11049. $downloader->remove($package, $targetDir);
  11050. }
  11051. }
  11052. protected function resolvePackageInstallPreference(PackageInterface $package)
  11053. {
  11054. foreach ($this->packagePreferences as $pattern => $preference) {
  11055. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  11056. if (preg_match($pattern, $package->getName())) {
  11057. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  11058. return 'dist';
  11059. }
  11060. return 'source';
  11061. }
  11062. }
  11063. return $package->isDev() ? 'source' : 'dist';
  11064. }
  11065. }
  11066. <?php
  11067. namespace Composer\Downloader;
  11068. use Composer\Package\PackageInterface;
  11069. interface DownloaderInterface
  11070. {
  11071. public function getInstallationSource();
  11072. public function download(PackageInterface $package, $path);
  11073. public function update(PackageInterface $initial, PackageInterface $target, $path);
  11074. public function remove(PackageInterface $package, $path);
  11075. public function setOutputProgress($outputProgress);
  11076. }
  11077. <?php
  11078. namespace Composer\Downloader;
  11079. use Composer\Package\PackageInterface;
  11080. interface DvcsDownloaderInterface
  11081. {
  11082. public function getUnpushedChanges(PackageInterface $package, $path);
  11083. }
  11084. <?php
  11085. namespace Composer\Downloader;
  11086. use Composer\Config;
  11087. use Composer\Cache;
  11088. use Composer\Factory;
  11089. use Composer\IO\IOInterface;
  11090. use Composer\IO\NullIO;
  11091. use Composer\Package\Comparer\Comparer;
  11092. use Composer\Package\PackageInterface;
  11093. use Composer\Package\Version\VersionParser;
  11094. use Composer\Plugin\PluginEvents;
  11095. use Composer\Plugin\PreFileDownloadEvent;
  11096. use Composer\EventDispatcher\EventDispatcher;
  11097. use Composer\Util\Filesystem;
  11098. use Composer\Util\RemoteFilesystem;
  11099. use Composer\Util\Url as UrlUtil;
  11100. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  11101. {
  11102. protected $io;
  11103. protected $config;
  11104. protected $rfs;
  11105. protected $filesystem;
  11106. protected $cache;
  11107. protected $outputProgress = true;
  11108. private $lastCacheWrites = array();
  11109. private $eventDispatcher;
  11110. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  11111. {
  11112. $this->io = $io;
  11113. $this->config = $config;
  11114. $this->eventDispatcher = $eventDispatcher;
  11115. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  11116. $this->filesystem = $filesystem ?: new Filesystem();
  11117. $this->cache = $cache;
  11118. if ($this->cache && $this->cache->gcIsNecessary()) {
  11119. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  11120. }
  11121. }
  11122. public function getInstallationSource()
  11123. {
  11124. return 'dist';
  11125. }
  11126. public function download(PackageInterface $package, $path, $output = true)
  11127. {
  11128. if (!$package->getDistUrl()) {
  11129. throw new \InvalidArgumentException('The given package is missing url information');
  11130. }
  11131. if ($output) {
  11132. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11133. }
  11134. $urls = $package->getDistUrls();
  11135. while ($url = array_shift($urls)) {
  11136. try {
  11137. $fileName = $this->doDownload($package, $path, $url);
  11138. break;
  11139. } catch (\Exception $e) {
  11140. if ($this->io->isDebug()) {
  11141. $this->io->writeError('');
  11142. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  11143. } elseif (count($urls)) {
  11144. $this->io->writeError('');
  11145. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  11146. }
  11147. if (!count($urls)) {
  11148. throw $e;
  11149. }
  11150. }
  11151. }
  11152. if ($output) {
  11153. $this->io->writeError('');
  11154. }
  11155. return $fileName;
  11156. }
  11157. protected function doDownload(PackageInterface $package, $path, $url)
  11158. {
  11159. $this->filesystem->emptyDirectory($path);
  11160. $fileName = $this->getFileName($package, $path);
  11161. $processedUrl = $this->processUrl($package, $url);
  11162. $origin = RemoteFilesystem::getOrigin($processedUrl);
  11163. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  11164. if ($this->eventDispatcher) {
  11165. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  11166. }
  11167. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  11168. try {
  11169. $checksum = $package->getDistSha1Checksum();
  11170. $cacheKey = $this->getCacheKey($package, $processedUrl);
  11171. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  11172. $this->io->writeError('Loading from cache', false);
  11173. } else {
  11174. if (!$this->outputProgress) {
  11175. $this->io->writeError('Downloading', false);
  11176. }
  11177. $retries = 3;
  11178. while ($retries--) {
  11179. try {
  11180. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  11181. break;
  11182. } catch (TransportException $e) {
  11183. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  11184. throw $e;
  11185. }
  11186. $this->io->writeError('');
  11187. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  11188. usleep(500000);
  11189. }
  11190. }
  11191. if (!$this->outputProgress) {
  11192. $this->io->writeError(' (<comment>100%</comment>)', false);
  11193. }
  11194. if ($this->cache) {
  11195. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  11196. $this->cache->copyFrom($cacheKey, $fileName);
  11197. }
  11198. }
  11199. if (!file_exists($fileName)) {
  11200. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  11201. .' directory is writable and you have internet connectivity');
  11202. }
  11203. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  11204. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  11205. }
  11206. } catch (\Exception $e) {
  11207. $this->filesystem->removeDirectory($path);
  11208. $this->clearLastCacheWrite($package);
  11209. throw $e;
  11210. }
  11211. return $fileName;
  11212. }
  11213. public function setOutputProgress($outputProgress)
  11214. {
  11215. $this->outputProgress = $outputProgress;
  11216. return $this;
  11217. }
  11218. protected function clearLastCacheWrite(PackageInterface $package)
  11219. {
  11220. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  11221. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  11222. unset($this->lastCacheWrites[$package->getName()]);
  11223. }
  11224. }
  11225. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11226. {
  11227. $name = $target->getName();
  11228. $from = $initial->getFullPrettyVersion();
  11229. $to = $target->getFullPrettyVersion();
  11230. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11231. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11232. $this->remove($initial, $path, false);
  11233. $this->download($target, $path, false);
  11234. $this->io->writeError('');
  11235. }
  11236. public function remove(PackageInterface $package, $path, $output = true)
  11237. {
  11238. if ($output) {
  11239. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11240. }
  11241. if (!$this->filesystem->removeDirectory($path)) {
  11242. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11243. }
  11244. }
  11245. protected function getFileName(PackageInterface $package, $path)
  11246. {
  11247. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11248. }
  11249. protected function processUrl(PackageInterface $package, $url)
  11250. {
  11251. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  11252. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  11253. }
  11254. if ($package->getDistReference()) {
  11255. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  11256. }
  11257. return $url;
  11258. }
  11259. private function getCacheKey(PackageInterface $package, $processedUrl)
  11260. {
  11261. $cacheKey = sha1($processedUrl);
  11262. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  11263. }
  11264. public function getLocalChanges(PackageInterface $package, $targetDir)
  11265. {
  11266. $prevIO = $this->io;
  11267. $prevProgress = $this->outputProgress;
  11268. $this->io = new NullIO;
  11269. $this->io->loadConfiguration($this->config);
  11270. $this->outputProgress = false;
  11271. $e = null;
  11272. try {
  11273. $this->download($package, $targetDir.'_compare', false);
  11274. $comparer = new Comparer();
  11275. $comparer->setSource($targetDir.'_compare');
  11276. $comparer->setUpdate($targetDir);
  11277. $comparer->doCompare();
  11278. $output = $comparer->getChanged(true, true);
  11279. $this->filesystem->removeDirectory($targetDir.'_compare');
  11280. } catch (\Exception $e) {
  11281. }
  11282. $this->io = $prevIO;
  11283. $this->outputProgress = $prevProgress;
  11284. if ($e) {
  11285. throw $e;
  11286. }
  11287. return trim($output);
  11288. }
  11289. }
  11290. <?php
  11291. namespace Composer\Downloader;
  11292. class FilesystemException extends \Exception
  11293. {
  11294. public function __construct($message = '', $code = 0, \Exception $previous = null)
  11295. {
  11296. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  11297. }
  11298. }
  11299. <?php
  11300. namespace Composer\Downloader;
  11301. use Composer\Package\PackageInterface;
  11302. use Composer\Util\ProcessExecutor;
  11303. class FossilDownloader extends VcsDownloader
  11304. {
  11305. public function doDownload(PackageInterface $package, $path, $url)
  11306. {
  11307. $this->config->prohibitUrlByConfig($url, $this->io);
  11308. $url = ProcessExecutor::escape($url);
  11309. $ref = ProcessExecutor::escape($package->getSourceReference());
  11310. $repoFile = $path . '.fossil';
  11311. $this->io->writeError("Cloning ".$package->getSourceReference());
  11312. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  11313. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  11314. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11315. }
  11316. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  11317. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11318. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11319. }
  11320. $command = sprintf('fossil update %s', $ref);
  11321. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11322. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11323. }
  11324. }
  11325. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11326. {
  11327. $this->config->prohibitUrlByConfig($url, $this->io);
  11328. $url = ProcessExecutor::escape($url);
  11329. $ref = ProcessExecutor::escape($target->getSourceReference());
  11330. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11331. if (!$this->hasMetadataRepository($path)) {
  11332. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11333. }
  11334. $command = sprintf('fossil pull && fossil up %s', $ref);
  11335. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11336. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11337. }
  11338. }
  11339. public function getLocalChanges(PackageInterface $package, $path)
  11340. {
  11341. if (!$this->hasMetadataRepository($path)) {
  11342. return null;
  11343. }
  11344. $this->process->execute('fossil changes', $output, realpath($path));
  11345. return trim($output) ?: null;
  11346. }
  11347. protected function getCommitLogs($fromReference, $toReference, $path)
  11348. {
  11349. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  11350. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11351. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11352. }
  11353. $log = '';
  11354. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  11355. foreach ($this->process->splitLines($output) as $line) {
  11356. if (preg_match($match, $line)) {
  11357. break;
  11358. }
  11359. $log .= $line;
  11360. }
  11361. return $log;
  11362. }
  11363. protected function hasMetadataRepository($path)
  11364. {
  11365. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  11366. }
  11367. }
  11368. <?php
  11369. namespace Composer\Downloader;
  11370. use Composer\Config;
  11371. use Composer\IO\IOInterface;
  11372. use Composer\Package\PackageInterface;
  11373. use Composer\Util\Filesystem;
  11374. use Composer\Util\Git as GitUtil;
  11375. use Composer\Util\Platform;
  11376. use Composer\Util\ProcessExecutor;
  11377. use Composer\Cache;
  11378. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  11379. {
  11380. private $hasStashedChanges = false;
  11381. private $hasDiscardedChanges = false;
  11382. private $gitUtil;
  11383. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11384. {
  11385. parent::__construct($io, $config, $process, $fs);
  11386. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  11387. }
  11388. public function doDownload(PackageInterface $package, $path, $url)
  11389. {
  11390. GitUtil::cleanEnv();
  11391. $path = $this->normalizePath($path);
  11392. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  11393. $ref = $package->getSourceReference();
  11394. $flag = Platform::isWindows() ? '/D ' : '';
  11395. $gitVersion = GitUtil::getVersion($this->process);
  11396. $msg = "Cloning ".$this->getShortHash($ref);
  11397. $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%';
  11398. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  11399. $this->io->writeError('', true, IOInterface::DEBUG);
  11400. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  11401. try {
  11402. if (!$this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref)) {
  11403. $this->io->writeError('<error>Failed to update '.$url.' in cache, package installation for '.$package->getPrettyName().' might fail.</error>');
  11404. }
  11405. if (is_dir($cachePath)) {
  11406. $command =
  11407. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  11408. . '&& cd '.$flag.'%path% '
  11409. . '&& git remote set-url origin %sanitizedUrl% && git remote add composer %sanitizedUrl%';
  11410. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  11411. }
  11412. } catch (\RuntimeException $e) {
  11413. if (0 === strpos(get_class($e), 'PHPUnit')) {
  11414. throw $e;
  11415. }
  11416. }
  11417. }
  11418. $this->io->writeError($msg);
  11419. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  11420. return str_replace(
  11421. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  11422. array(
  11423. ProcessExecutor::escape($url),
  11424. ProcessExecutor::escape($path),
  11425. ProcessExecutor::escape($cachePath),
  11426. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url)),
  11427. ),
  11428. $command
  11429. );
  11430. };
  11431. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  11432. if ($url !== $package->getSourceUrl()) {
  11433. $this->updateOriginUrl($path, $package->getSourceUrl());
  11434. } else {
  11435. $this->setPushUrl($path, $url);
  11436. }
  11437. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  11438. if ($package->getDistReference() === $package->getSourceReference()) {
  11439. $package->setDistReference($newRef);
  11440. }
  11441. $package->setSourceReference($newRef);
  11442. }
  11443. }
  11444. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11445. {
  11446. GitUtil::cleanEnv();
  11447. if (!$this->hasMetadataRepository($path)) {
  11448. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11449. }
  11450. $updateOriginUrl = false;
  11451. if (
  11452. 0 === $this->process->execute('git remote -v', $output, $path)
  11453. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  11454. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  11455. ) {
  11456. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  11457. $updateOriginUrl = true;
  11458. }
  11459. }
  11460. $ref = $target->getSourceReference();
  11461. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  11462. $command = '(git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)) && git remote set-url composer %s';
  11463. $commandCallable = function ($url) use ($command, $ref) {
  11464. return sprintf(
  11465. $command,
  11466. ProcessExecutor::escape($url),
  11467. ProcessExecutor::escape($ref.'^{commit}'),
  11468. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url))
  11469. );
  11470. };
  11471. $this->gitUtil->runCommand($commandCallable, $url, $path);
  11472. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  11473. if ($target->getDistReference() === $target->getSourceReference()) {
  11474. $target->setDistReference($newRef);
  11475. }
  11476. $target->setSourceReference($newRef);
  11477. }
  11478. if ($updateOriginUrl) {
  11479. $this->updateOriginUrl($path, $target->getSourceUrl());
  11480. }
  11481. }
  11482. public function getLocalChanges(PackageInterface $package, $path)
  11483. {
  11484. GitUtil::cleanEnv();
  11485. if (!$this->hasMetadataRepository($path)) {
  11486. return;
  11487. }
  11488. $command = 'git status --porcelain --untracked-files=no';
  11489. if (0 !== $this->process->execute($command, $output, $path)) {
  11490. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11491. }
  11492. return trim($output) ?: null;
  11493. }
  11494. public function getUnpushedChanges(PackageInterface $package, $path)
  11495. {
  11496. GitUtil::cleanEnv();
  11497. $path = $this->normalizePath($path);
  11498. if (!$this->hasMetadataRepository($path)) {
  11499. return;
  11500. }
  11501. $command = 'git show-ref --head -d';
  11502. if (0 !== $this->process->execute($command, $output, $path)) {
  11503. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11504. }
  11505. $refs = trim($output);
  11506. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  11507. return;
  11508. }
  11509. $headRef = $match[1];
  11510. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  11511. return;
  11512. }
  11513. $branch = $matches[1][0];
  11514. $unpushedChanges = null;
  11515. for ($i = 0; $i <= 1; $i++) {
  11516. foreach ($matches[1] as $candidate) {
  11517. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  11518. $branch = $candidate;
  11519. $remoteBranch = $match[1];
  11520. break;
  11521. }
  11522. }
  11523. if (!isset($remoteBranch)) {
  11524. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  11525. } else {
  11526. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  11527. if (0 !== $this->process->execute($command, $output, $path)) {
  11528. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11529. }
  11530. $unpushedChanges = trim($output) ?: null;
  11531. }
  11532. if ($unpushedChanges && $i === 0) {
  11533. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  11534. }
  11535. if (!$unpushedChanges) {
  11536. break;
  11537. }
  11538. }
  11539. return $unpushedChanges;
  11540. }
  11541. protected function cleanChanges(PackageInterface $package, $path, $update)
  11542. {
  11543. GitUtil::cleanEnv();
  11544. $path = $this->normalizePath($path);
  11545. $unpushed = $this->getUnpushedChanges($package, $path);
  11546. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  11547. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  11548. }
  11549. if (!$changes = $this->getLocalChanges($package, $path)) {
  11550. return;
  11551. }
  11552. if (!$this->io->isInteractive()) {
  11553. $discardChanges = $this->config->get('discard-changes');
  11554. if (true === $discardChanges) {
  11555. return $this->discardChanges($path);
  11556. }
  11557. if ('stash' === $discardChanges) {
  11558. if (!$update) {
  11559. return parent::cleanChanges($package, $path, $update);
  11560. }
  11561. return $this->stashChanges($path);
  11562. }
  11563. return parent::cleanChanges($package, $path, $update);
  11564. }
  11565. $changes = array_map(function ($elem) {
  11566. return ' '.$elem;
  11567. }, preg_split('{\s*\r?\n\s*}', $changes));
  11568. $this->io->writeError(' <error>The package has modified files:</error>');
  11569. $this->io->writeError(array_slice($changes, 0, 10));
  11570. if (count($changes) > 10) {
  11571. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  11572. }
  11573. while (true) {
  11574. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  11575. case 'y':
  11576. $this->discardChanges($path);
  11577. break 2;
  11578. case 's':
  11579. if (!$update) {
  11580. goto help;
  11581. }
  11582. $this->stashChanges($path);
  11583. break 2;
  11584. case 'n':
  11585. throw new \RuntimeException('Update aborted');
  11586. case 'v':
  11587. $this->io->writeError($changes);
  11588. break;
  11589. case 'd':
  11590. $this->viewDiff($path);
  11591. break;
  11592. case '?':
  11593. default:
  11594. help:
  11595. $this->io->writeError(array(
  11596. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11597. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11598. ' v - view modified files',
  11599. ' d - view local modifications (diff)',
  11600. ));
  11601. if ($update) {
  11602. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  11603. }
  11604. $this->io->writeError(' ? - print help');
  11605. break;
  11606. }
  11607. }
  11608. }
  11609. protected function reapplyChanges($path)
  11610. {
  11611. $path = $this->normalizePath($path);
  11612. if ($this->hasStashedChanges) {
  11613. $this->hasStashedChanges = false;
  11614. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  11615. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  11616. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  11617. }
  11618. }
  11619. $this->hasDiscardedChanges = false;
  11620. }
  11621. protected function updateToCommit($path, $reference, $branch, $date)
  11622. {
  11623. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11624. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11625. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11626. $branches = null;
  11627. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11628. $branches = $output;
  11629. }
  11630. $gitRef = $reference;
  11631. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11632. && $branches
  11633. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11634. ) {
  11635. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11636. if (0 === $this->process->execute($command, $output, $path)) {
  11637. return;
  11638. }
  11639. }
  11640. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11641. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11642. $branch = 'v' . $branch;
  11643. }
  11644. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11645. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11646. if (0 === $this->process->execute($command, $output, $path)
  11647. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11648. ) {
  11649. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11650. if (0 === $this->process->execute($command, $output, $path)) {
  11651. return;
  11652. }
  11653. }
  11654. }
  11655. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11656. if (0 === $this->process->execute($command, $output, $path)) {
  11657. return;
  11658. }
  11659. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11660. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11661. }
  11662. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11663. }
  11664. protected function updateOriginUrl($path, $url)
  11665. {
  11666. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11667. $this->setPushUrl($path, $url);
  11668. }
  11669. protected function setPushUrl($path, $url)
  11670. {
  11671. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11672. $protocols = $this->config->get('github-protocols');
  11673. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11674. if (!in_array('ssh', $protocols, true)) {
  11675. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11676. }
  11677. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11678. $this->process->execute($cmd, $ignoredOutput, $path);
  11679. }
  11680. }
  11681. protected function getCommitLogs($fromReference, $toReference, $path)
  11682. {
  11683. $path = $this->normalizePath($path);
  11684. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11685. if (0 !== $this->process->execute($command, $output, $path)) {
  11686. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11687. }
  11688. return $output;
  11689. }
  11690. protected function discardChanges($path)
  11691. {
  11692. $path = $this->normalizePath($path);
  11693. if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
  11694. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11695. }
  11696. $this->hasDiscardedChanges = true;
  11697. }
  11698. protected function stashChanges($path)
  11699. {
  11700. $path = $this->normalizePath($path);
  11701. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11702. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11703. }
  11704. $this->hasStashedChanges = true;
  11705. }
  11706. protected function viewDiff($path)
  11707. {
  11708. $path = $this->normalizePath($path);
  11709. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11710. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11711. }
  11712. $this->io->writeError($output);
  11713. }
  11714. protected function normalizePath($path)
  11715. {
  11716. if (Platform::isWindows() && strlen($path) > 0) {
  11717. $basePath = $path;
  11718. $removed = array();
  11719. while (!is_dir($basePath) && $basePath !== '\\') {
  11720. array_unshift($removed, basename($basePath));
  11721. $basePath = dirname($basePath);
  11722. }
  11723. if ($basePath === '\\') {
  11724. return $path;
  11725. }
  11726. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11727. }
  11728. return $path;
  11729. }
  11730. protected function hasMetadataRepository($path)
  11731. {
  11732. $path = $this->normalizePath($path);
  11733. return is_dir($path.'/.git');
  11734. }
  11735. protected function getShortHash($reference)
  11736. {
  11737. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11738. return substr($reference, 0, 10);
  11739. }
  11740. return $reference;
  11741. }
  11742. }
  11743. <?php
  11744. namespace Composer\Downloader;
  11745. use Composer\Config;
  11746. use Composer\Cache;
  11747. use Composer\EventDispatcher\EventDispatcher;
  11748. use Composer\Package\PackageInterface;
  11749. use Composer\Util\Platform;
  11750. use Composer\Util\ProcessExecutor;
  11751. use Composer\Util\RemoteFilesystem;
  11752. use Composer\IO\IOInterface;
  11753. class GzipDownloader extends ArchiveDownloader
  11754. {
  11755. protected $process;
  11756. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11757. {
  11758. $this->process = $process ?: new ProcessExecutor($io);
  11759. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11760. }
  11761. protected function extract($file, $path)
  11762. {
  11763. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11764. if (!Platform::isWindows()) {
  11765. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11766. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11767. return;
  11768. }
  11769. if (extension_loaded('zlib')) {
  11770. $this->extractUsingExt($file, $targetFilepath);
  11771. return;
  11772. }
  11773. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11774. throw new \RuntimeException($processError);
  11775. }
  11776. $this->extractUsingExt($file, $targetFilepath);
  11777. }
  11778. protected function getFileName(PackageInterface $package, $path)
  11779. {
  11780. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11781. }
  11782. private function extractUsingExt($file, $targetFilepath)
  11783. {
  11784. $archiveFile = gzopen($file, 'rb');
  11785. $targetFile = fopen($targetFilepath, 'wb');
  11786. while ($string = gzread($archiveFile, 4096)) {
  11787. fwrite($targetFile, $string, Platform::strlen($string));
  11788. }
  11789. gzclose($archiveFile);
  11790. fclose($targetFile);
  11791. }
  11792. }
  11793. <?php
  11794. namespace Composer\Downloader;
  11795. use Composer\Package\PackageInterface;
  11796. use Composer\Util\ProcessExecutor;
  11797. use Composer\Util\Hg as HgUtils;
  11798. class HgDownloader extends VcsDownloader
  11799. {
  11800. public function doDownload(PackageInterface $package, $path, $url)
  11801. {
  11802. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11803. $cloneCommand = function ($url) use ($path) {
  11804. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11805. };
  11806. $hgUtils->runCommand($cloneCommand, $url, $path);
  11807. $ref = ProcessExecutor::escape($package->getSourceReference());
  11808. $command = sprintf('hg up %s', $ref);
  11809. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11810. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11811. }
  11812. }
  11813. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11814. {
  11815. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11816. $ref = $target->getSourceReference();
  11817. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11818. if (!$this->hasMetadataRepository($path)) {
  11819. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11820. }
  11821. $command = function ($url) use ($ref) {
  11822. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11823. };
  11824. $hgUtils->runCommand($command, $url, $path);
  11825. }
  11826. public function getLocalChanges(PackageInterface $package, $path)
  11827. {
  11828. if (!is_dir($path.'/.hg')) {
  11829. return null;
  11830. }
  11831. $this->process->execute('hg st', $output, realpath($path));
  11832. return trim($output) ?: null;
  11833. }
  11834. protected function getCommitLogs($fromReference, $toReference, $path)
  11835. {
  11836. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11837. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11838. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11839. }
  11840. return $output;
  11841. }
  11842. protected function hasMetadataRepository($path)
  11843. {
  11844. return is_dir($path . '/.hg');
  11845. }
  11846. }
  11847. <?php
  11848. namespace Composer\Downloader;
  11849. use Composer\Package\Archiver\ArchivableFilesFinder;
  11850. use Composer\Package\Dumper\ArrayDumper;
  11851. use Composer\Package\PackageInterface;
  11852. use Composer\Package\Version\VersionGuesser;
  11853. use Composer\Package\Version\VersionParser;
  11854. use Composer\Util\Platform;
  11855. use Composer\Util\ProcessExecutor;
  11856. use Composer\Util\Filesystem as ComposerFilesystem;
  11857. use Symfony\Component\Filesystem\Exception\IOException;
  11858. use Symfony\Component\Filesystem\Filesystem;
  11859. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11860. {
  11861. const STRATEGY_SYMLINK = 10;
  11862. const STRATEGY_MIRROR = 20;
  11863. public function download(PackageInterface $package, $path, $output = true)
  11864. {
  11865. $url = $package->getDistUrl();
  11866. $realUrl = realpath($url);
  11867. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11868. throw new \RuntimeException(sprintf(
  11869. 'Source path "%s" is not found for package %s',
  11870. $url,
  11871. $package->getName()
  11872. ));
  11873. }
  11874. if (realpath($path) === $realUrl) {
  11875. if ($output) {
  11876. $this->io->writeError(sprintf(
  11877. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11878. $package->getName(),
  11879. $package->getFullPrettyVersion()
  11880. ));
  11881. }
  11882. return;
  11883. }
  11884. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11885. throw new \RuntimeException(sprintf(
  11886. 'Package %s cannot install to "%s" inside its source at "%s"',
  11887. $package->getName(),
  11888. realpath($path),
  11889. $realUrl
  11890. ));
  11891. }
  11892. $transportOptions = $package->getTransportOptions() + array('symlink' => null, 'relative' => true);
  11893. $currentStrategy = self::STRATEGY_SYMLINK;
  11894. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11895. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11896. if ($mirrorPathRepos) {
  11897. $currentStrategy = self::STRATEGY_MIRROR;
  11898. }
  11899. if (true === $transportOptions['symlink']) {
  11900. $currentStrategy = self::STRATEGY_SYMLINK;
  11901. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11902. } elseif (false === $transportOptions['symlink']) {
  11903. $currentStrategy = self::STRATEGY_MIRROR;
  11904. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11905. }
  11906. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11907. $currentStrategy = self::STRATEGY_MIRROR;
  11908. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11909. }
  11910. $fileSystem = new Filesystem();
  11911. $this->filesystem->removeDirectory($path);
  11912. if ($output) {
  11913. $this->io->writeError(sprintf(
  11914. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11915. $package->getName(),
  11916. $package->getFullPrettyVersion()
  11917. ), false);
  11918. }
  11919. $isFallback = false;
  11920. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11921. try {
  11922. if (Platform::isWindows()) {
  11923. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11924. $this->filesystem->junction($realUrl, $path);
  11925. } else {
  11926. $absolutePath = $path;
  11927. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11928. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11929. }
  11930. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11931. $path = rtrim($path, "/");
  11932. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11933. if ($transportOptions['relative']) {
  11934. $fileSystem->symlink($shortestPath, $path);
  11935. } else {
  11936. $fileSystem->symlink($realUrl, $path);
  11937. }
  11938. }
  11939. } catch (IOException $e) {
  11940. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11941. $this->io->writeError('');
  11942. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11943. $currentStrategy = self::STRATEGY_MIRROR;
  11944. $isFallback = true;
  11945. } else {
  11946. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11947. }
  11948. }
  11949. }
  11950. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11951. $fs = new ComposerFilesystem();
  11952. $realUrl = $fs->normalizePath($realUrl);
  11953. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11954. $iterator = new ArchivableFilesFinder($realUrl, array());
  11955. $fileSystem->mirror($realUrl, $path, $iterator);
  11956. }
  11957. $this->io->writeError('');
  11958. }
  11959. public function remove(PackageInterface $package, $path, $output = true)
  11960. {
  11961. $realUrl = realpath($package->getDistUrl());
  11962. if (realpath($path) === $realUrl) {
  11963. if ($output) {
  11964. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11965. }
  11966. return;
  11967. }
  11968. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11969. if ($output) {
  11970. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11971. }
  11972. if (!$this->filesystem->removeJunction($path)) {
  11973. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11974. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11975. }
  11976. } else {
  11977. parent::remove($package, $path, $output);
  11978. }
  11979. }
  11980. public function getVcsReference(PackageInterface $package, $path)
  11981. {
  11982. $parser = new VersionParser;
  11983. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11984. $dumper = new ArrayDumper;
  11985. $packageConfig = $dumper->dump($package);
  11986. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11987. return $packageVersion['commit'];
  11988. }
  11989. }
  11990. private function safeJunctions()
  11991. {
  11992. return function_exists('proc_open') &&
  11993. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11994. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11995. }
  11996. }
  11997. <?php
  11998. namespace Composer\Downloader;
  11999. use Composer\Util\Filesystem;
  12000. class PearPackageExtractor
  12001. {
  12002. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  12003. private $filesystem;
  12004. private $file;
  12005. public function __construct($file)
  12006. {
  12007. if (!is_file($file)) {
  12008. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  12009. }
  12010. $this->filesystem = new Filesystem();
  12011. $this->file = $file;
  12012. }
  12013. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  12014. {
  12015. $extractionPath = $target.'/tarball';
  12016. try {
  12017. $archive = new \PharData($this->file);
  12018. $archive->extractTo($extractionPath, null, true);
  12019. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  12020. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  12021. }
  12022. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  12023. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  12024. $this->filesystem->removeDirectory($extractionPath);
  12025. } catch (\Exception $exception) {
  12026. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  12027. }
  12028. }
  12029. private function copyFiles($files, $source, $target, $roles, $vars)
  12030. {
  12031. foreach ($files as $file) {
  12032. $from = $this->combine($source, $file['from']);
  12033. $to = $this->combine($target, $roles[$file['role']]);
  12034. $to = $this->combine($to, $file['to']);
  12035. $tasks = $file['tasks'];
  12036. $this->copyFile($from, $to, $tasks, $vars);
  12037. }
  12038. }
  12039. private function copyFile($from, $to, $tasks, $vars)
  12040. {
  12041. if (!is_file($from)) {
  12042. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  12043. }
  12044. $this->filesystem->ensureDirectoryExists(dirname($to));
  12045. if (0 == count($tasks)) {
  12046. $copied = copy($from, $to);
  12047. } else {
  12048. $content = file_get_contents($from);
  12049. $replacements = array();
  12050. foreach ($tasks as $task) {
  12051. $pattern = $task['from'];
  12052. $varName = $task['to'];
  12053. if (isset($vars[$varName])) {
  12054. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  12055. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  12056. } else {
  12057. $replacements[$pattern] = $vars[$varName];
  12058. }
  12059. }
  12060. }
  12061. $content = strtr($content, $replacements);
  12062. $copied = file_put_contents($to, $content);
  12063. }
  12064. if (false === $copied) {
  12065. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  12066. }
  12067. }
  12068. private function buildCopyActions($source, array $roles, $vars)
  12069. {
  12070. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  12071. if (false === $package) {
  12072. throw new \RuntimeException('Package definition file is not valid.');
  12073. }
  12074. $packageSchemaVersion = $package['version'];
  12075. if ('1.0' == $packageSchemaVersion) {
  12076. $children = $package->release->filelist->children();
  12077. $packageName = (string) $package->name;
  12078. $packageVersion = (string) $package->release->version;
  12079. $sourceDir = $packageName . '-' . $packageVersion;
  12080. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  12081. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  12082. $children = $package->contents->children();
  12083. $packageName = (string) $package->name;
  12084. $packageVersion = (string) $package->version->release;
  12085. $sourceDir = $packageName . '-' . $packageVersion;
  12086. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  12087. $namespaces = $package->getNamespaces();
  12088. $package->registerXPathNamespace('ns', $namespaces['']);
  12089. $releaseNodes = $package->xpath('ns:phprelease');
  12090. $this->applyRelease($result, $releaseNodes, $vars);
  12091. } else {
  12092. throw new \RuntimeException('Unsupported schema version of package definition file.');
  12093. }
  12094. return $result;
  12095. }
  12096. private function applyRelease(&$actions, $releaseNodes, $vars)
  12097. {
  12098. foreach ($releaseNodes as $releaseNode) {
  12099. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  12100. if ($requiredOs && $vars['os'] != $requiredOs) {
  12101. continue;
  12102. }
  12103. if ($releaseNode->filelist) {
  12104. foreach ($releaseNode->filelist->children() as $action) {
  12105. if ('install' == $action->getName()) {
  12106. $name = (string) $action['name'];
  12107. $as = (string) $action['as'];
  12108. if (isset($actions[$name])) {
  12109. $actions[$name]['to'] = $as;
  12110. }
  12111. } elseif ('ignore' == $action->getName()) {
  12112. $name = (string) $action['name'];
  12113. unset($actions[$name]);
  12114. } else {
  12115. }
  12116. }
  12117. }
  12118. break;
  12119. }
  12120. }
  12121. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  12122. {
  12123. $result = array();
  12124. foreach ($children as $child) {
  12125. if ($child->getName() == 'dir') {
  12126. $dirSource = $this->combine($source, (string) $child['name']);
  12127. $dirTarget = $child['baseinstalldir'] ?: $target;
  12128. $dirRole = $child['role'] ?: $role;
  12129. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12130. $result = array_merge($result, $dirFiles);
  12131. } elseif ($child->getName() == 'file') {
  12132. $fileRole = (string) $child['role'] ?: $role;
  12133. if (isset($targetRoles[$fileRole])) {
  12134. $fileName = (string) ($child['name'] ?: $child[0]);
  12135. $fileSource = $this->combine($source, $fileName);
  12136. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  12137. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12138. $fileTarget = $packageName . '/' . $fileTarget;
  12139. }
  12140. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  12141. }
  12142. }
  12143. }
  12144. return $result;
  12145. }
  12146. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  12147. {
  12148. $result = array();
  12149. foreach ($children as $child) {
  12150. if ('dir' == $child->getName()) {
  12151. $dirSource = $this->combine($source, $child['name']);
  12152. $dirTarget = $child['baseinstalldir'] ?: $target;
  12153. $dirRole = $child['role'] ?: $role;
  12154. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12155. $result = array_merge($result, $dirFiles);
  12156. } elseif ('file' == $child->getName()) {
  12157. $fileRole = (string) $child['role'] ?: $role;
  12158. if (isset($targetRoles[$fileRole])) {
  12159. $fileSource = $this->combine($source, (string) $child['name']);
  12160. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  12161. $fileTasks = array();
  12162. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  12163. if ('replace' == $taskNode->getName()) {
  12164. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  12165. }
  12166. }
  12167. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12168. $fileTarget = $packageName . '/' . $fileTarget;
  12169. }
  12170. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  12171. }
  12172. }
  12173. }
  12174. return $result;
  12175. }
  12176. private function combine($left, $right)
  12177. {
  12178. return rtrim($left, '/') . '/' . ltrim($right, '/');
  12179. }
  12180. }
  12181. <?php
  12182. namespace Composer\Downloader;
  12183. use Composer\Package\PackageInterface;
  12184. use Composer\Repository\VcsRepository;
  12185. use Composer\Util\Perforce;
  12186. class PerforceDownloader extends VcsDownloader
  12187. {
  12188. protected $perforce;
  12189. public function doDownload(PackageInterface $package, $path, $url)
  12190. {
  12191. $ref = $package->getSourceReference();
  12192. $label = $this->getLabelFromSourceReference($ref);
  12193. $this->io->writeError('Cloning ' . $ref);
  12194. $this->initPerforce($package, $path, $url);
  12195. $this->perforce->setStream($ref);
  12196. $this->perforce->p4Login();
  12197. $this->perforce->writeP4ClientSpec();
  12198. $this->perforce->connectClient();
  12199. $this->perforce->syncCodeBase($label);
  12200. $this->perforce->cleanupClientSpec();
  12201. }
  12202. private function getLabelFromSourceReference($ref)
  12203. {
  12204. $pos = strpos($ref, '@');
  12205. if (false !== $pos) {
  12206. return substr($ref, $pos + 1);
  12207. }
  12208. return null;
  12209. }
  12210. public function initPerforce(PackageInterface $package, $path, $url)
  12211. {
  12212. if (!empty($this->perforce)) {
  12213. $this->perforce->initializePath($path);
  12214. return;
  12215. }
  12216. $repository = $package->getRepository();
  12217. $repoConfig = null;
  12218. if ($repository instanceof VcsRepository) {
  12219. $repoConfig = $this->getRepoConfig($repository);
  12220. }
  12221. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  12222. }
  12223. private function getRepoConfig(VcsRepository $repository)
  12224. {
  12225. return $repository->getRepoConfig();
  12226. }
  12227. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12228. {
  12229. $this->doDownload($target, $path, $url);
  12230. }
  12231. public function getLocalChanges(PackageInterface $package, $path)
  12232. {
  12233. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  12234. }
  12235. protected function getCommitLogs($fromReference, $toReference, $path)
  12236. {
  12237. return $this->perforce->getCommitLogs($fromReference, $toReference);
  12238. }
  12239. public function setPerforce($perforce)
  12240. {
  12241. $this->perforce = $perforce;
  12242. }
  12243. protected function hasMetadataRepository($path)
  12244. {
  12245. return true;
  12246. }
  12247. }
  12248. <?php
  12249. namespace Composer\Downloader;
  12250. class PharDownloader extends ArchiveDownloader
  12251. {
  12252. protected function extract($file, $path)
  12253. {
  12254. $archive = new \Phar($file);
  12255. $archive->extractTo($path, null, true);
  12256. }
  12257. }
  12258. <?php
  12259. namespace Composer\Downloader;
  12260. use Composer\Config;
  12261. use Composer\Cache;
  12262. use Composer\EventDispatcher\EventDispatcher;
  12263. use Composer\Util\IniHelper;
  12264. use Composer\Util\Platform;
  12265. use Composer\Util\ProcessExecutor;
  12266. use Composer\Util\RemoteFilesystem;
  12267. use Composer\IO\IOInterface;
  12268. use RarArchive;
  12269. class RarDownloader extends ArchiveDownloader
  12270. {
  12271. protected $process;
  12272. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12273. {
  12274. $this->process = $process ?: new ProcessExecutor($io);
  12275. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12276. }
  12277. protected function extract($file, $path)
  12278. {
  12279. $processError = null;
  12280. if (!Platform::isWindows()) {
  12281. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  12282. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12283. return;
  12284. }
  12285. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12286. }
  12287. if (!class_exists('RarArchive')) {
  12288. $iniMessage = IniHelper::getMessage();
  12289. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  12290. . $iniMessage . "\n" . $processError;
  12291. if (!Platform::isWindows()) {
  12292. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  12293. }
  12294. throw new \RuntimeException($error);
  12295. }
  12296. $rarArchive = RarArchive::open($file);
  12297. if (false === $rarArchive) {
  12298. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  12299. }
  12300. $entries = $rarArchive->getEntries();
  12301. if (false === $entries) {
  12302. throw new \RuntimeException('Could not retrieve RAR archive entries');
  12303. }
  12304. foreach ($entries as $entry) {
  12305. if (false === $entry->extract($path)) {
  12306. throw new \RuntimeException('Could not extract entry');
  12307. }
  12308. }
  12309. $rarArchive->close();
  12310. }
  12311. }
  12312. <?php
  12313. namespace Composer\Downloader;
  12314. use Composer\Package\PackageInterface;
  12315. use Composer\Util\Svn as SvnUtil;
  12316. use Composer\Repository\VcsRepository;
  12317. use Composer\Util\ProcessExecutor;
  12318. class SvnDownloader extends VcsDownloader
  12319. {
  12320. protected $cacheCredentials = true;
  12321. public function doDownload(PackageInterface $package, $path, $url)
  12322. {
  12323. SvnUtil::cleanEnv();
  12324. $ref = $package->getSourceReference();
  12325. $repo = $package->getRepository();
  12326. if ($repo instanceof VcsRepository) {
  12327. $repoConfig = $repo->getRepoConfig();
  12328. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  12329. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  12330. }
  12331. }
  12332. $this->io->writeError(" Checking out ".$package->getSourceReference());
  12333. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  12334. }
  12335. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12336. {
  12337. SvnUtil::cleanEnv();
  12338. $ref = $target->getSourceReference();
  12339. if (!$this->hasMetadataRepository($path)) {
  12340. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  12341. }
  12342. $util = new SvnUtil($url, $this->io, $this->config);
  12343. $flags = "";
  12344. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  12345. $flags .= ' --ignore-ancestry';
  12346. }
  12347. $this->io->writeError(" Checking out " . $ref);
  12348. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  12349. }
  12350. public function getLocalChanges(PackageInterface $package, $path)
  12351. {
  12352. if (!$this->hasMetadataRepository($path)) {
  12353. return null;
  12354. }
  12355. $this->process->execute('svn status --ignore-externals', $output, $path);
  12356. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  12357. }
  12358. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  12359. {
  12360. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12361. $util->setCacheCredentials($this->cacheCredentials);
  12362. try {
  12363. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  12364. } catch (\RuntimeException $e) {
  12365. throw new \RuntimeException(
  12366. 'Package could not be downloaded, '.$e->getMessage()
  12367. );
  12368. }
  12369. }
  12370. protected function cleanChanges(PackageInterface $package, $path, $update)
  12371. {
  12372. if (!$changes = $this->getLocalChanges($package, $path)) {
  12373. return;
  12374. }
  12375. if (!$this->io->isInteractive()) {
  12376. if (true === $this->config->get('discard-changes')) {
  12377. return $this->discardChanges($path);
  12378. }
  12379. return parent::cleanChanges($package, $path, $update);
  12380. }
  12381. $changes = array_map(function ($elem) {
  12382. return ' '.$elem;
  12383. }, preg_split('{\s*\r?\n\s*}', $changes));
  12384. $countChanges = count($changes);
  12385. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  12386. $this->io->writeError(array_slice($changes, 0, 10));
  12387. if ($countChanges > 10) {
  12388. $remainingChanges = $countChanges - 10;
  12389. $this->io->writeError(
  12390. sprintf(
  12391. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  12392. $remainingChanges === 1 ? '' : 's'
  12393. )
  12394. );
  12395. }
  12396. while (true) {
  12397. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  12398. case 'y':
  12399. $this->discardChanges($path);
  12400. break 2;
  12401. case 'n':
  12402. throw new \RuntimeException('Update aborted');
  12403. case 'v':
  12404. $this->io->writeError($changes);
  12405. break;
  12406. case '?':
  12407. default:
  12408. $this->io->writeError(array(
  12409. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  12410. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  12411. ' v - view modified files',
  12412. ' ? - print help',
  12413. ));
  12414. break;
  12415. }
  12416. }
  12417. }
  12418. protected function getCommitLogs($fromReference, $toReference, $path)
  12419. {
  12420. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  12421. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  12422. if (0 !== $this->process->execute($command, $output, $path)) {
  12423. throw new \RuntimeException(
  12424. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  12425. );
  12426. }
  12427. $urlPattern = '#<url>(.*)</url>#';
  12428. if (preg_match($urlPattern, $output, $matches)) {
  12429. $baseUrl = $matches[1];
  12430. } else {
  12431. throw new \RuntimeException(
  12432. 'Unable to determine svn url for path '. $path
  12433. );
  12434. }
  12435. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  12436. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  12437. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  12438. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12439. $util->setCacheCredentials($this->cacheCredentials);
  12440. try {
  12441. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  12442. } catch (\RuntimeException $e) {
  12443. throw new \RuntimeException(
  12444. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  12445. );
  12446. }
  12447. }
  12448. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  12449. }
  12450. protected function discardChanges($path)
  12451. {
  12452. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  12453. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  12454. }
  12455. }
  12456. protected function hasMetadataRepository($path)
  12457. {
  12458. return is_dir($path.'/.svn');
  12459. }
  12460. }
  12461. <?php
  12462. namespace Composer\Downloader;
  12463. class TarDownloader extends ArchiveDownloader
  12464. {
  12465. protected function extract($file, $path)
  12466. {
  12467. $archive = new \PharData($file);
  12468. $archive->extractTo($path, null, true);
  12469. }
  12470. }
  12471. <?php
  12472. namespace Composer\Downloader;
  12473. class TransportException extends \RuntimeException
  12474. {
  12475. protected $headers;
  12476. protected $response;
  12477. protected $statusCode;
  12478. public function setHeaders($headers)
  12479. {
  12480. $this->headers = $headers;
  12481. }
  12482. public function getHeaders()
  12483. {
  12484. return $this->headers;
  12485. }
  12486. public function setResponse($response)
  12487. {
  12488. $this->response = $response;
  12489. }
  12490. public function getResponse()
  12491. {
  12492. return $this->response;
  12493. }
  12494. public function setStatusCode($statusCode)
  12495. {
  12496. $this->statusCode = $statusCode;
  12497. }
  12498. public function getStatusCode()
  12499. {
  12500. return $this->statusCode;
  12501. }
  12502. }
  12503. <?php
  12504. namespace Composer\Downloader;
  12505. use Composer\Package\PackageInterface;
  12506. interface VcsCapableDownloaderInterface
  12507. {
  12508. public function getVcsReference(PackageInterface $package, $path);
  12509. }
  12510. <?php
  12511. namespace Composer\Downloader;
  12512. use Composer\Config;
  12513. use Composer\Package\Dumper\ArrayDumper;
  12514. use Composer\Package\PackageInterface;
  12515. use Composer\Package\Version\VersionGuesser;
  12516. use Composer\Package\Version\VersionParser;
  12517. use Composer\Util\ProcessExecutor;
  12518. use Composer\IO\IOInterface;
  12519. use Composer\Util\Filesystem;
  12520. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  12521. {
  12522. protected $io;
  12523. protected $config;
  12524. protected $process;
  12525. protected $filesystem;
  12526. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  12527. {
  12528. $this->io = $io;
  12529. $this->config = $config;
  12530. $this->process = $process ?: new ProcessExecutor($io);
  12531. $this->filesystem = $fs ?: new Filesystem($this->process);
  12532. }
  12533. public function getInstallationSource()
  12534. {
  12535. return 'source';
  12536. }
  12537. public function download(PackageInterface $package, $path)
  12538. {
  12539. if (!$package->getSourceReference()) {
  12540. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  12541. }
  12542. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  12543. $this->filesystem->emptyDirectory($path);
  12544. $urls = $package->getSourceUrls();
  12545. while ($url = array_shift($urls)) {
  12546. try {
  12547. if (Filesystem::isLocalPath($url)) {
  12548. $needle = 'file://';
  12549. $isFileProtocol = false;
  12550. if (0 === strpos($url, $needle)) {
  12551. $url = substr($url, strlen($needle));
  12552. $isFileProtocol = true;
  12553. }
  12554. if (false !== strpos($url, '%')) {
  12555. $url = rawurldecode($url);
  12556. }
  12557. $url = realpath($url);
  12558. if ($isFileProtocol) {
  12559. $url = $needle . $url;
  12560. }
  12561. }
  12562. $this->doDownload($package, $path, $url);
  12563. break;
  12564. } catch (\Exception $e) {
  12565. if ($e instanceof \PHPUnit_Framework_Exception) {
  12566. throw $e;
  12567. }
  12568. if ($this->io->isDebug()) {
  12569. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  12570. } elseif (count($urls)) {
  12571. $this->io->writeError(' Failed, trying the next URL');
  12572. }
  12573. if (!count($urls)) {
  12574. throw $e;
  12575. }
  12576. }
  12577. }
  12578. }
  12579. public function update(PackageInterface $initial, PackageInterface $target, $path)
  12580. {
  12581. if (!$target->getSourceReference()) {
  12582. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  12583. }
  12584. $name = $target->getName();
  12585. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  12586. if ($target->getSourceType() === 'svn') {
  12587. $from = $initial->getSourceReference();
  12588. $to = $target->getSourceReference();
  12589. } else {
  12590. $from = substr($initial->getSourceReference(), 0, 7);
  12591. $to = substr($target->getSourceReference(), 0, 7);
  12592. }
  12593. $name .= ' '.$initial->getPrettyVersion();
  12594. } else {
  12595. $from = $initial->getFullPrettyVersion();
  12596. $to = $target->getFullPrettyVersion();
  12597. }
  12598. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  12599. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  12600. $this->cleanChanges($initial, $path, true);
  12601. $urls = $target->getSourceUrls();
  12602. $exception = null;
  12603. while ($url = array_shift($urls)) {
  12604. try {
  12605. if (Filesystem::isLocalPath($url)) {
  12606. $url = realpath($url);
  12607. }
  12608. $this->doUpdate($initial, $target, $path, $url);
  12609. $exception = null;
  12610. break;
  12611. } catch (\Exception $exception) {
  12612. if ($exception instanceof \PHPUnit_Framework_Exception) {
  12613. throw $exception;
  12614. }
  12615. if ($this->io->isDebug()) {
  12616. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  12617. } elseif (count($urls)) {
  12618. $this->io->writeError(' Failed, trying the next URL');
  12619. }
  12620. }
  12621. }
  12622. $this->reapplyChanges($path);
  12623. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  12624. $message = 'Pulling in changes:';
  12625. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12626. if (!trim($logs)) {
  12627. $message = 'Rolling back changes:';
  12628. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12629. }
  12630. if (trim($logs)) {
  12631. $logs = implode("\n", array_map(function ($line) {
  12632. return ' ' . $line;
  12633. }, explode("\n", $logs)));
  12634. $logs = str_replace('<', '\<', $logs);
  12635. $this->io->writeError(' '.$message);
  12636. $this->io->writeError($logs);
  12637. }
  12638. }
  12639. if (!$urls && $exception) {
  12640. throw $exception;
  12641. }
  12642. }
  12643. public function remove(PackageInterface $package, $path)
  12644. {
  12645. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12646. $this->cleanChanges($package, $path, false);
  12647. if (!$this->filesystem->removeDirectory($path)) {
  12648. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12649. }
  12650. }
  12651. public function setOutputProgress($outputProgress)
  12652. {
  12653. return $this;
  12654. }
  12655. public function getVcsReference(PackageInterface $package, $path)
  12656. {
  12657. $parser = new VersionParser;
  12658. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12659. $dumper = new ArrayDumper;
  12660. $packageConfig = $dumper->dump($package);
  12661. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12662. return $packageVersion['commit'];
  12663. }
  12664. }
  12665. protected function cleanChanges(PackageInterface $package, $path, $update)
  12666. {
  12667. if (null !== $this->getLocalChanges($package, $path)) {
  12668. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12669. }
  12670. }
  12671. protected function reapplyChanges($path)
  12672. {
  12673. }
  12674. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12675. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12676. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12677. abstract protected function hasMetadataRepository($path);
  12678. }
  12679. <?php
  12680. namespace Composer\Downloader;
  12681. use Composer\Config;
  12682. use Composer\Cache;
  12683. use Composer\EventDispatcher\EventDispatcher;
  12684. use Composer\Package\PackageInterface;
  12685. use Composer\Util\ProcessExecutor;
  12686. use Composer\Util\RemoteFilesystem;
  12687. use Composer\IO\IOInterface;
  12688. class XzDownloader extends ArchiveDownloader
  12689. {
  12690. protected $process;
  12691. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12692. {
  12693. $this->process = $process ?: new ProcessExecutor($io);
  12694. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12695. }
  12696. protected function extract($file, $path)
  12697. {
  12698. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12699. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12700. return;
  12701. }
  12702. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12703. throw new \RuntimeException($processError);
  12704. }
  12705. protected function getFileName(PackageInterface $package, $path)
  12706. {
  12707. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12708. }
  12709. }
  12710. <?php
  12711. namespace Composer\Downloader;
  12712. use Composer\Config;
  12713. use Composer\Cache;
  12714. use Composer\EventDispatcher\EventDispatcher;
  12715. use Composer\Package\PackageInterface;
  12716. use Composer\Util\IniHelper;
  12717. use Composer\Util\Platform;
  12718. use Composer\Util\ProcessExecutor;
  12719. use Composer\Util\RemoteFilesystem;
  12720. use Composer\IO\IOInterface;
  12721. use Symfony\Component\Process\ExecutableFinder;
  12722. use ZipArchive;
  12723. class ZipDownloader extends ArchiveDownloader
  12724. {
  12725. protected static $hasSystemUnzip;
  12726. private static $hasZipArchive;
  12727. private static $isWindows;
  12728. protected $process;
  12729. private $zipArchiveObject;
  12730. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12731. {
  12732. $this->process = $process ?: new ProcessExecutor($io);
  12733. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12734. }
  12735. public function download(PackageInterface $package, $path, $output = true)
  12736. {
  12737. if (null === self::$hasSystemUnzip) {
  12738. $finder = new ExecutableFinder;
  12739. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12740. }
  12741. if (null === self::$hasZipArchive) {
  12742. self::$hasZipArchive = class_exists('ZipArchive');
  12743. }
  12744. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12745. $iniMessage = IniHelper::getMessage();
  12746. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12747. throw new \RuntimeException($error);
  12748. }
  12749. if (null === self::$isWindows) {
  12750. self::$isWindows = Platform::isWindows();
  12751. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12752. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12753. $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>");
  12754. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12755. }
  12756. }
  12757. return parent::download($package, $path, $output);
  12758. }
  12759. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12760. {
  12761. if (!self::$hasZipArchive) {
  12762. $isLastChance = true;
  12763. }
  12764. if (!self::$hasSystemUnzip && !$isLastChance) {
  12765. return $this->extractWithZipArchive($file, $path, true);
  12766. }
  12767. $processError = null;
  12768. $overwrite = $isLastChance ? '-o' : '';
  12769. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12770. try {
  12771. if (0 === $exitCode = $this->process->execute($command, $ignoredOutput)) {
  12772. return true;
  12773. }
  12774. $processError = new \RuntimeException('Failed to execute ('.$exitCode.') '.$command."\n\n".$this->process->getErrorOutput());
  12775. } catch (\Exception $e) {
  12776. $processError = $e;
  12777. }
  12778. if ($isLastChance) {
  12779. throw $processError;
  12780. }
  12781. $this->io->writeError(' '.$processError->getMessage());
  12782. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12783. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12784. return $this->extractWithZipArchive($file, $path, true);
  12785. }
  12786. protected function extractWithZipArchive($file, $path, $isLastChance)
  12787. {
  12788. if (!self::$hasSystemUnzip) {
  12789. $isLastChance = true;
  12790. }
  12791. if (!self::$hasZipArchive && !$isLastChance) {
  12792. return $this->extractWithSystemUnzip($file, $path, true);
  12793. }
  12794. $processError = null;
  12795. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12796. try {
  12797. if (true === ($retval = $zipArchive->open($file))) {
  12798. $extractResult = $zipArchive->extractTo($path);
  12799. if (true === $extractResult) {
  12800. $zipArchive->close();
  12801. return true;
  12802. }
  12803. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12804. } else {
  12805. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12806. }
  12807. } catch (\ErrorException $e) {
  12808. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12809. } catch (\Exception $e) {
  12810. $processError = $e;
  12811. }
  12812. if ($isLastChance) {
  12813. throw $processError;
  12814. }
  12815. $this->io->writeError(' '.$processError->getMessage());
  12816. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12817. return $this->extractWithSystemUnzip($file, $path, true);
  12818. }
  12819. public function extract($file, $path)
  12820. {
  12821. if (self::$isWindows) {
  12822. $this->extractWithZipArchive($file, $path, false);
  12823. } else {
  12824. $this->extractWithSystemUnzip($file, $path, false);
  12825. }
  12826. }
  12827. protected function getErrorMessage($retval, $file)
  12828. {
  12829. switch ($retval) {
  12830. case ZipArchive::ER_EXISTS:
  12831. return sprintf("File '%s' already exists.", $file);
  12832. case ZipArchive::ER_INCONS:
  12833. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12834. case ZipArchive::ER_INVAL:
  12835. return sprintf("Invalid argument (%s)", $file);
  12836. case ZipArchive::ER_MEMORY:
  12837. return sprintf("Malloc failure (%s)", $file);
  12838. case ZipArchive::ER_NOENT:
  12839. return sprintf("No such zip file: '%s'", $file);
  12840. case ZipArchive::ER_NOZIP:
  12841. return sprintf("'%s' is not a zip archive.", $file);
  12842. case ZipArchive::ER_OPEN:
  12843. return sprintf("Can't open zip file: %s", $file);
  12844. case ZipArchive::ER_READ:
  12845. return sprintf("Zip read error (%s)", $file);
  12846. case ZipArchive::ER_SEEK:
  12847. return sprintf("Zip seek error (%s)", $file);
  12848. default:
  12849. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12850. }
  12851. }
  12852. }
  12853. <?php
  12854. namespace Composer\EventDispatcher;
  12855. class Event
  12856. {
  12857. protected $name;
  12858. protected $args;
  12859. protected $flags;
  12860. private $propagationStopped = false;
  12861. public function __construct($name, array $args = array(), array $flags = array())
  12862. {
  12863. $this->name = $name;
  12864. $this->args = $args;
  12865. $this->flags = $flags;
  12866. }
  12867. public function getName()
  12868. {
  12869. return $this->name;
  12870. }
  12871. public function getArguments()
  12872. {
  12873. return $this->args;
  12874. }
  12875. public function getFlags()
  12876. {
  12877. return $this->flags;
  12878. }
  12879. public function isPropagationStopped()
  12880. {
  12881. return $this->propagationStopped;
  12882. }
  12883. public function stopPropagation()
  12884. {
  12885. $this->propagationStopped = true;
  12886. }
  12887. }
  12888. <?php
  12889. namespace Composer\EventDispatcher;
  12890. use Composer\DependencyResolver\PolicyInterface;
  12891. use Composer\DependencyResolver\Pool;
  12892. use Composer\DependencyResolver\Request;
  12893. use Composer\Installer\InstallerEvent;
  12894. use Composer\IO\IOInterface;
  12895. use Composer\Composer;
  12896. use Composer\DependencyResolver\Operation\OperationInterface;
  12897. use Composer\Repository\CompositeRepository;
  12898. use Composer\Script;
  12899. use Composer\Installer\PackageEvent;
  12900. use Composer\Installer\BinaryInstaller;
  12901. use Composer\Util\ProcessExecutor;
  12902. use Composer\Script\Event as ScriptEvent;
  12903. use Symfony\Component\Process\PhpExecutableFinder;
  12904. class EventDispatcher
  12905. {
  12906. protected $composer;
  12907. protected $io;
  12908. protected $loader;
  12909. protected $process;
  12910. protected $listeners;
  12911. private $eventStack;
  12912. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12913. {
  12914. $this->composer = $composer;
  12915. $this->io = $io;
  12916. $this->process = $process ?: new ProcessExecutor($io);
  12917. $this->eventStack = array();
  12918. }
  12919. public function dispatch($eventName, Event $event = null)
  12920. {
  12921. if (null === $event) {
  12922. $event = new Event($eventName);
  12923. }
  12924. return $this->doDispatch($event);
  12925. }
  12926. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12927. {
  12928. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12929. }
  12930. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12931. {
  12932. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12933. }
  12934. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12935. {
  12936. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12937. }
  12938. protected function doDispatch(Event $event)
  12939. {
  12940. $listeners = $this->getListeners($event);
  12941. $this->pushEvent($event);
  12942. $return = 0;
  12943. foreach ($listeners as $callable) {
  12944. $this->ensureBinDirIsInPath();
  12945. if (!is_string($callable)) {
  12946. if (!is_callable($callable)) {
  12947. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12948. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12949. }
  12950. $event = $this->checkListenerExpectedEvent($callable, $event);
  12951. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12952. } elseif ($this->isComposerScript($callable)) {
  12953. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12954. $script = explode(' ', substr($callable, 1));
  12955. $scriptName = $script[0];
  12956. unset($script[0]);
  12957. $args = array_merge($script, $event->getArguments());
  12958. $flags = $event->getFlags();
  12959. if (substr($callable, 0, 10) === '@composer ') {
  12960. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12961. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12962. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12963. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12964. }
  12965. } else {
  12966. if (!$this->getListeners(new Event($scriptName))) {
  12967. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12968. }
  12969. try {
  12970. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12971. $scriptEvent->setOriginatingEvent($event);
  12972. $return = $this->dispatch($scriptName, $scriptEvent);
  12973. } catch (ScriptExecutionException $e) {
  12974. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12975. throw $e;
  12976. }
  12977. }
  12978. } elseif ($this->isPhpScript($callable)) {
  12979. $className = substr($callable, 0, strpos($callable, '::'));
  12980. $methodName = substr($callable, strpos($callable, '::') + 2);
  12981. if (!class_exists($className)) {
  12982. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12983. continue;
  12984. }
  12985. if (!is_callable($callable)) {
  12986. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12987. continue;
  12988. }
  12989. try {
  12990. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12991. } catch (\Exception $e) {
  12992. $message = "Script %s handling the %s event terminated with an exception";
  12993. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12994. throw $e;
  12995. }
  12996. } else {
  12997. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12998. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12999. if ($this->io->isVerbose()) {
  13000. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  13001. } else {
  13002. $this->io->writeError(sprintf('> %s', $exec));
  13003. }
  13004. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  13005. if ($possibleLocalBinaries) {
  13006. foreach ($possibleLocalBinaries as $localExec) {
  13007. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  13008. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  13009. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  13010. break;
  13011. }
  13012. }
  13013. }
  13014. if (substr($exec, 0, 8) === '@putenv ') {
  13015. putenv(substr($exec, 8));
  13016. continue;
  13017. } elseif (substr($exec, 0, 5) === '@php ') {
  13018. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  13019. } else {
  13020. $finder = new PhpExecutableFinder();
  13021. $phpPath = $finder->find(false);
  13022. if ($phpPath) {
  13023. $_SERVER['PHP_BINARY'] = $phpPath;
  13024. putenv('PHP_BINARY=' . $_SERVER['PHP_BINARY']);
  13025. }
  13026. }
  13027. if (substr($exec, 0, 9) === 'composer ') {
  13028. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($exec, 8);
  13029. }
  13030. if (0 !== ($exitCode = $this->process->execute($exec))) {
  13031. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  13032. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  13033. }
  13034. }
  13035. if ($event->isPropagationStopped()) {
  13036. break;
  13037. }
  13038. }
  13039. $this->popEvent();
  13040. return $return;
  13041. }
  13042. protected function getPhpExecCommand()
  13043. {
  13044. $finder = new PhpExecutableFinder();
  13045. $phpPath = $finder->find(false);
  13046. if (!$phpPath) {
  13047. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  13048. }
  13049. $phpArgs = $finder->findArguments();
  13050. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  13051. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  13052. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  13053. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  13054. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  13055. }
  13056. protected function executeEventPhpScript($className, $methodName, Event $event)
  13057. {
  13058. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  13059. if ($this->io->isVerbose()) {
  13060. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  13061. } else {
  13062. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  13063. }
  13064. return $className::$methodName($event);
  13065. }
  13066. protected function checkListenerExpectedEvent($target, Event $event)
  13067. {
  13068. if (in_array($event->getName(), array(
  13069. 'init',
  13070. 'command',
  13071. 'pre-file-download',
  13072. ), true)) {
  13073. return $event;
  13074. }
  13075. try {
  13076. $reflected = new \ReflectionParameter($target, 0);
  13077. } catch (\Exception $e) {
  13078. return $event;
  13079. }
  13080. $expected = null;
  13081. $isClass = false;
  13082. if (\PHP_VERSION_ID >= 70000) {
  13083. $reflectionType = $reflected->getType();
  13084. if ($reflectionType) {
  13085. $expected = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  13086. $isClass = !$reflectionType->isBuiltin();
  13087. }
  13088. } else {
  13089. $expected = $reflected->getClass() ? $reflected->getClass()->getName() : null;
  13090. $isClass = null !== $expected;
  13091. }
  13092. if (!$isClass) {
  13093. return $event;
  13094. }
  13095. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  13096. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13097. $event = new \Composer\Script\CommandEvent(
  13098. $event->getName(),
  13099. $event->getComposer(),
  13100. $event->getIO(),
  13101. $event->isDevMode(),
  13102. $event->getArguments()
  13103. );
  13104. }
  13105. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  13106. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13107. $event = new \Composer\Script\PackageEvent(
  13108. $event->getName(),
  13109. $event->getComposer(),
  13110. $event->getIO(),
  13111. $event->isDevMode(),
  13112. $event->getPolicy(),
  13113. $event->getPool(),
  13114. $event->getInstalledRepo(),
  13115. $event->getRequest(),
  13116. $event->getOperations(),
  13117. $event->getOperation()
  13118. );
  13119. }
  13120. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  13121. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13122. $event = new \Composer\Script\Event(
  13123. $event->getName(),
  13124. $event->getComposer(),
  13125. $event->getIO(),
  13126. $event->isDevMode(),
  13127. $event->getArguments(),
  13128. $event->getFlags()
  13129. );
  13130. }
  13131. return $event;
  13132. }
  13133. private function serializeCallback($cb)
  13134. {
  13135. if (is_array($cb) && count($cb) === 2) {
  13136. if (is_object($cb[0])) {
  13137. $cb[0] = get_class($cb[0]);
  13138. }
  13139. if (is_string($cb[0]) && is_string($cb[1])) {
  13140. $cb = implode('::', $cb);
  13141. }
  13142. }
  13143. if (is_string($cb)) {
  13144. return $cb;
  13145. }
  13146. return var_export($cb, true);
  13147. }
  13148. public function addListener($eventName, $listener, $priority = 0)
  13149. {
  13150. $this->listeners[$eventName][$priority][] = $listener;
  13151. }
  13152. public function addSubscriber(EventSubscriberInterface $subscriber)
  13153. {
  13154. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  13155. if (is_string($params)) {
  13156. $this->addListener($eventName, array($subscriber, $params));
  13157. } elseif (is_string($params[0])) {
  13158. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  13159. } else {
  13160. foreach ($params as $listener) {
  13161. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  13162. }
  13163. }
  13164. }
  13165. }
  13166. protected function getListeners(Event $event)
  13167. {
  13168. $scriptListeners = $this->getScriptListeners($event);
  13169. if (!isset($this->listeners[$event->getName()][0])) {
  13170. $this->listeners[$event->getName()][0] = array();
  13171. }
  13172. krsort($this->listeners[$event->getName()]);
  13173. $listeners = $this->listeners;
  13174. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  13175. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  13176. }
  13177. public function hasEventListeners(Event $event)
  13178. {
  13179. $listeners = $this->getListeners($event);
  13180. return count($listeners) > 0;
  13181. }
  13182. protected function getScriptListeners(Event $event)
  13183. {
  13184. $package = $this->composer->getPackage();
  13185. $scripts = $package->getScripts();
  13186. if (empty($scripts[$event->getName()])) {
  13187. return array();
  13188. }
  13189. if ($this->loader) {
  13190. $this->loader->unregister();
  13191. }
  13192. $generator = $this->composer->getAutoloadGenerator();
  13193. if ($event instanceof ScriptEvent) {
  13194. $generator->setDevMode($event->isDevMode());
  13195. }
  13196. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  13197. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  13198. $map = $generator->parseAutoloads($packageMap, $package);
  13199. $this->loader = $generator->createLoader($map);
  13200. $this->loader->register();
  13201. return $scripts[$event->getName()];
  13202. }
  13203. protected function isPhpScript($callable)
  13204. {
  13205. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  13206. }
  13207. protected function isComposerScript($callable)
  13208. {
  13209. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5) && '@putenv ' !== substr($callable, 0, 8);
  13210. }
  13211. protected function pushEvent(Event $event)
  13212. {
  13213. $eventName = $event->getName();
  13214. if (in_array($eventName, $this->eventStack)) {
  13215. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  13216. }
  13217. return array_push($this->eventStack, $eventName);
  13218. }
  13219. protected function popEvent()
  13220. {
  13221. return array_pop($this->eventStack);
  13222. }
  13223. private function ensureBinDirIsInPath()
  13224. {
  13225. $pathStr = 'PATH';
  13226. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  13227. $pathStr = 'Path';
  13228. }
  13229. $binDir = $this->composer->getConfig()->get('bin-dir');
  13230. if (is_dir($binDir)) {
  13231. $binDir = realpath($binDir);
  13232. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  13233. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  13234. putenv($pathStr.'='.$_SERVER[$pathStr]);
  13235. }
  13236. }
  13237. }
  13238. }
  13239. <?php
  13240. namespace Composer\EventDispatcher;
  13241. interface EventSubscriberInterface
  13242. {
  13243. public static function getSubscribedEvents();
  13244. }
  13245. <?php
  13246. namespace Composer\EventDispatcher;
  13247. class ScriptExecutionException extends \RuntimeException
  13248. {
  13249. }
  13250. <?php
  13251. namespace Composer\Exception;
  13252. class NoSslException extends \RuntimeException
  13253. {
  13254. }
  13255. <?php
  13256. namespace Composer;
  13257. use Composer\Config\JsonConfigSource;
  13258. use Composer\Json\JsonFile;
  13259. use Composer\IO\IOInterface;
  13260. use Composer\Package\Archiver;
  13261. use Composer\Package\Version\VersionGuesser;
  13262. use Composer\Repository\RepositoryManager;
  13263. use Composer\Repository\RepositoryFactory;
  13264. use Composer\Repository\WritableRepositoryInterface;
  13265. use Composer\Util\Filesystem;
  13266. use Composer\Util\Platform;
  13267. use Composer\Util\ProcessExecutor;
  13268. use Composer\Util\RemoteFilesystem;
  13269. use Composer\Util\Silencer;
  13270. use Composer\Plugin\PluginEvents;
  13271. use Composer\EventDispatcher\Event;
  13272. use Seld\JsonLint\DuplicateKeyException;
  13273. use Symfony\Component\Console\Formatter\OutputFormatter;
  13274. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  13275. use Symfony\Component\Console\Output\ConsoleOutput;
  13276. use Composer\EventDispatcher\EventDispatcher;
  13277. use Composer\Autoload\AutoloadGenerator;
  13278. use Composer\Package\Version\VersionParser;
  13279. use Composer\Downloader\TransportException;
  13280. use Seld\JsonLint\JsonParser;
  13281. class Factory
  13282. {
  13283. protected static function getHomeDir()
  13284. {
  13285. $home = getenv('COMPOSER_HOME');
  13286. if ($home) {
  13287. return $home;
  13288. }
  13289. if (Platform::isWindows()) {
  13290. if (!getenv('APPDATA')) {
  13291. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13292. }
  13293. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  13294. }
  13295. $userDir = self::getUserDir();
  13296. if (is_dir($userDir . '/.composer')) {
  13297. return $userDir . '/.composer';
  13298. }
  13299. if (self::useXdg()) {
  13300. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  13301. return $xdgConfig . '/composer';
  13302. }
  13303. return $userDir . '/.composer';
  13304. }
  13305. protected static function getCacheDir($home)
  13306. {
  13307. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  13308. if ($cacheDir) {
  13309. return $cacheDir;
  13310. }
  13311. $homeEnv = getenv('COMPOSER_HOME');
  13312. if ($homeEnv) {
  13313. return $homeEnv . '/cache';
  13314. }
  13315. if (Platform::isWindows()) {
  13316. if ($cacheDir = getenv('LOCALAPPDATA')) {
  13317. $cacheDir .= '/Composer';
  13318. } else {
  13319. $cacheDir = $home . '/cache';
  13320. }
  13321. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  13322. }
  13323. $userDir = self::getUserDir();
  13324. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  13325. return $home . '/cache';
  13326. }
  13327. if (self::useXdg()) {
  13328. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  13329. return $xdgCache . '/composer';
  13330. }
  13331. return $home . '/cache';
  13332. }
  13333. protected static function getDataDir($home)
  13334. {
  13335. $homeEnv = getenv('COMPOSER_HOME');
  13336. if ($homeEnv) {
  13337. return $homeEnv;
  13338. }
  13339. if (Platform::isWindows()) {
  13340. return strtr($home, '\\', '/');
  13341. }
  13342. $userDir = self::getUserDir();
  13343. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  13344. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  13345. return $xdgData . '/composer';
  13346. }
  13347. return $home;
  13348. }
  13349. public static function createConfig(IOInterface $io = null, $cwd = null)
  13350. {
  13351. $cwd = $cwd ?: getcwd();
  13352. $config = new Config(true, $cwd);
  13353. $home = self::getHomeDir();
  13354. $config->merge(array('config' => array(
  13355. 'home' => $home,
  13356. 'cache-dir' => self::getCacheDir($home),
  13357. 'data-dir' => self::getDataDir($home),
  13358. )));
  13359. $file = new JsonFile($config->get('home').'/config.json');
  13360. if ($file->exists()) {
  13361. if ($io && $io->isDebug()) {
  13362. $io->writeError('Loading config file ' . $file->getPath());
  13363. }
  13364. $config->merge($file->read());
  13365. }
  13366. $config->setConfigSource(new JsonConfigSource($file));
  13367. $htaccessProtect = (bool) $config->get('htaccess-protect');
  13368. if ($htaccessProtect) {
  13369. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  13370. foreach ($dirs as $dir) {
  13371. if (!file_exists($dir . '/.htaccess')) {
  13372. if (!is_dir($dir)) {
  13373. Silencer::call('mkdir', $dir, 0777, true);
  13374. }
  13375. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  13376. }
  13377. }
  13378. }
  13379. $file = new JsonFile($config->get('home').'/auth.json');
  13380. if ($file->exists()) {
  13381. if ($io && $io->isDebug()) {
  13382. $io->writeError('Loading config file ' . $file->getPath());
  13383. }
  13384. $config->merge(array('config' => $file->read()));
  13385. }
  13386. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  13387. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  13388. $authData = json_decode($composerAuthEnv, true);
  13389. if (null === $authData) {
  13390. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  13391. }
  13392. if ($io && $io->isDebug()) {
  13393. $io->writeError('Loading auth config from COMPOSER_AUTH');
  13394. }
  13395. $config->merge(array('config' => $authData));
  13396. }
  13397. return $config;
  13398. }
  13399. public static function getComposerFile()
  13400. {
  13401. return trim(getenv('COMPOSER')) ?: './composer.json';
  13402. }
  13403. public static function createAdditionalStyles()
  13404. {
  13405. return array(
  13406. 'highlight' => new OutputFormatterStyle('red'),
  13407. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  13408. );
  13409. }
  13410. public static function createOutput()
  13411. {
  13412. $styles = self::createAdditionalStyles();
  13413. $formatter = new OutputFormatter(false, $styles);
  13414. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  13415. }
  13416. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  13417. {
  13418. return RepositoryFactory::defaultRepos($io, $config, $rm);
  13419. }
  13420. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  13421. {
  13422. $cwd = $cwd ?: getcwd();
  13423. if (null === $localConfig) {
  13424. $localConfig = static::getComposerFile();
  13425. }
  13426. if (is_string($localConfig)) {
  13427. $composerFile = $localConfig;
  13428. $file = new JsonFile($localConfig, null, $io);
  13429. if (!$file->exists()) {
  13430. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  13431. $message = 'Composer could not find a composer.json file in '.$cwd;
  13432. } else {
  13433. $message = 'Composer could not find the config file: '.$localConfig;
  13434. }
  13435. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  13436. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  13437. }
  13438. $file->validateSchema(JsonFile::LAX_SCHEMA);
  13439. $jsonParser = new JsonParser;
  13440. try {
  13441. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  13442. } catch (DuplicateKeyException $e) {
  13443. $details = $e->getDetails();
  13444. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  13445. }
  13446. $localConfig = $file->read();
  13447. }
  13448. $config = static::createConfig($io, $cwd);
  13449. $config->merge($localConfig);
  13450. if (isset($composerFile)) {
  13451. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  13452. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  13453. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  13454. if ($localAuthFile->exists()) {
  13455. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  13456. $config->merge(array('config' => $localAuthFile->read()));
  13457. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  13458. }
  13459. }
  13460. $vendorDir = $config->get('vendor-dir');
  13461. $composer = new Composer();
  13462. $composer->setConfig($config);
  13463. if ($fullLoad) {
  13464. $io->loadConfiguration($config);
  13465. }
  13466. $rfs = self::createRemoteFilesystem($io, $config);
  13467. $dispatcher = new EventDispatcher($composer, $io);
  13468. $composer->setEventDispatcher($dispatcher);
  13469. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  13470. $composer->setRepositoryManager($rm);
  13471. $this->addLocalRepository($io, $rm, $vendorDir);
  13472. if (!$fullLoad && !isset($localConfig['version'])) {
  13473. $localConfig['version'] = '1.0.0';
  13474. }
  13475. $parser = new VersionParser;
  13476. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  13477. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  13478. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  13479. $composer->setPackage($package);
  13480. $im = $this->createInstallationManager();
  13481. $composer->setInstallationManager($im);
  13482. if ($fullLoad) {
  13483. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  13484. $composer->setDownloadManager($dm);
  13485. $generator = new AutoloadGenerator($dispatcher, $io);
  13486. $composer->setAutoloadGenerator($generator);
  13487. $am = $this->createArchiveManager($config, $dm);
  13488. $composer->setArchiveManager($am);
  13489. }
  13490. $this->createDefaultInstallers($im, $composer, $io);
  13491. if ($fullLoad) {
  13492. $globalComposer = null;
  13493. if (realpath($config->get('home')) !== $cwd) {
  13494. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  13495. }
  13496. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  13497. $composer->setPluginManager($pm);
  13498. $pm->loadInstalledPlugins();
  13499. }
  13500. if ($fullLoad && isset($composerFile)) {
  13501. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  13502. ? substr($composerFile, 0, -4).'lock'
  13503. : $composerFile . '.lock';
  13504. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  13505. $composer->setLocker($locker);
  13506. }
  13507. if ($fullLoad) {
  13508. $initEvent = new Event(PluginEvents::INIT);
  13509. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  13510. if ($rm->getLocalRepository()) {
  13511. $this->purgePackages($rm->getLocalRepository(), $im);
  13512. }
  13513. }
  13514. return $composer;
  13515. }
  13516. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  13517. {
  13518. $factory = new static();
  13519. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  13520. }
  13521. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  13522. {
  13523. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  13524. }
  13525. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  13526. {
  13527. $composer = null;
  13528. try {
  13529. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  13530. } catch (\Exception $e) {
  13531. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  13532. }
  13533. return $composer;
  13534. }
  13535. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  13536. {
  13537. $cache = null;
  13538. if ($config->get('cache-files-ttl') > 0) {
  13539. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  13540. }
  13541. $dm = new Downloader\DownloadManager($io);
  13542. switch ($preferred = $config->get('preferred-install')) {
  13543. case 'dist':
  13544. $dm->setPreferDist(true);
  13545. break;
  13546. case 'source':
  13547. $dm->setPreferSource(true);
  13548. break;
  13549. case 'auto':
  13550. default:
  13551. break;
  13552. }
  13553. if (is_array($preferred)) {
  13554. $dm->setPreferences($preferred);
  13555. }
  13556. $executor = new ProcessExecutor($io);
  13557. $fs = new Filesystem($executor);
  13558. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  13559. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  13560. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  13561. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  13562. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  13563. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13564. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13565. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13566. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13567. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13568. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13569. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13570. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13571. return $dm;
  13572. }
  13573. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  13574. {
  13575. if (null === $dm) {
  13576. $io = new IO\NullIO();
  13577. $io->loadConfiguration($config);
  13578. $dm = $this->createDownloadManager($io, $config);
  13579. }
  13580. $am = new Archiver\ArchiveManager($dm);
  13581. $am->addArchiver(new Archiver\ZipArchiver);
  13582. $am->addArchiver(new Archiver\PharArchiver);
  13583. return $am;
  13584. }
  13585. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  13586. {
  13587. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  13588. }
  13589. protected function createInstallationManager()
  13590. {
  13591. return new Installer\InstallationManager();
  13592. }
  13593. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  13594. {
  13595. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  13596. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  13597. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  13598. $im->addInstaller(new Installer\MetapackageInstaller($io));
  13599. }
  13600. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  13601. {
  13602. foreach ($repo->getPackages() as $package) {
  13603. if (!$im->isPackageInstalled($repo, $package)) {
  13604. $repo->removePackage($package);
  13605. }
  13606. }
  13607. }
  13608. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  13609. {
  13610. $factory = new static();
  13611. return $factory->createComposer($io, $config, $disablePlugins);
  13612. }
  13613. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  13614. {
  13615. static $warned = false;
  13616. $disableTls = false;
  13617. if ($config && $config->get('disable-tls') === true) {
  13618. if (!$warned) {
  13619. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  13620. }
  13621. $warned = true;
  13622. $disableTls = true;
  13623. } elseif (!extension_loaded('openssl')) {
  13624. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  13625. . '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.');
  13626. }
  13627. $remoteFilesystemOptions = array();
  13628. if ($disableTls === false) {
  13629. if ($config && $config->get('cafile')) {
  13630. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  13631. }
  13632. if ($config && $config->get('capath')) {
  13633. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  13634. }
  13635. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  13636. }
  13637. try {
  13638. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  13639. } catch (TransportException $e) {
  13640. if (false !== strpos($e->getMessage(), 'cafile')) {
  13641. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  13642. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  13643. if (PHP_VERSION_ID < 50600) {
  13644. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  13645. }
  13646. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13647. }
  13648. throw $e;
  13649. }
  13650. return $remoteFilesystem;
  13651. }
  13652. private static function useXdg()
  13653. {
  13654. foreach (array_keys($_SERVER) as $key) {
  13655. if (substr($key, 0, 4) === 'XDG_') {
  13656. return true;
  13657. }
  13658. }
  13659. return false;
  13660. }
  13661. private static function getUserDir()
  13662. {
  13663. $home = getenv('HOME');
  13664. if (!$home) {
  13665. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13666. }
  13667. return rtrim(strtr($home, '\\', '/'), '/');
  13668. }
  13669. }
  13670. <?php
  13671. namespace Composer\IO;
  13672. use Composer\Config;
  13673. use Composer\Util\ProcessExecutor;
  13674. use Psr\Log\LoggerInterface;
  13675. use Psr\Log\LogLevel;
  13676. abstract class BaseIO implements IOInterface, LoggerInterface
  13677. {
  13678. protected $authentications = array();
  13679. public function getAuthentications()
  13680. {
  13681. return $this->authentications;
  13682. }
  13683. public function resetAuthentications()
  13684. {
  13685. $this->authentications = array();
  13686. }
  13687. public function hasAuthentication($repositoryName)
  13688. {
  13689. return isset($this->authentications[$repositoryName]);
  13690. }
  13691. public function getAuthentication($repositoryName)
  13692. {
  13693. if (isset($this->authentications[$repositoryName])) {
  13694. return $this->authentications[$repositoryName];
  13695. }
  13696. return array('username' => null, 'password' => null);
  13697. }
  13698. public function setAuthentication($repositoryName, $username, $password = null)
  13699. {
  13700. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13701. }
  13702. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13703. {
  13704. $this->write($messages, $newline, $verbosity);
  13705. }
  13706. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13707. {
  13708. $this->writeError($messages, $newline, $verbosity);
  13709. }
  13710. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13711. {
  13712. if ($this->hasAuthentication($repositoryName)) {
  13713. $auth = $this->getAuthentication($repositoryName);
  13714. if ($auth['username'] === $username && $auth['password'] === $password) {
  13715. return;
  13716. }
  13717. $this->writeError(
  13718. sprintf(
  13719. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13720. $repositoryName
  13721. )
  13722. );
  13723. }
  13724. $this->setAuthentication($repositoryName, $username, $password);
  13725. }
  13726. public function loadConfiguration(Config $config)
  13727. {
  13728. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13729. $githubOauth = $config->get('github-oauth') ?: array();
  13730. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13731. $gitlabToken = $config->get('gitlab-token') ?: array();
  13732. $httpBasic = $config->get('http-basic') ?: array();
  13733. $bearerToken = $config->get('bearer') ?: array();
  13734. foreach ($bitbucketOauth as $domain => $cred) {
  13735. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13736. }
  13737. foreach ($githubOauth as $domain => $token) {
  13738. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13739. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13740. }
  13741. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13742. }
  13743. foreach ($gitlabOauth as $domain => $token) {
  13744. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13745. }
  13746. foreach ($gitlabToken as $domain => $token) {
  13747. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13748. }
  13749. foreach ($httpBasic as $domain => $cred) {
  13750. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13751. }
  13752. foreach ($bearerToken as $domain => $token) {
  13753. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  13754. }
  13755. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13756. }
  13757. public function emergency($message, array $context = array())
  13758. {
  13759. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13760. }
  13761. public function alert($message, array $context = array())
  13762. {
  13763. return $this->log(LogLevel::ALERT, $message, $context);
  13764. }
  13765. public function critical($message, array $context = array())
  13766. {
  13767. return $this->log(LogLevel::CRITICAL, $message, $context);
  13768. }
  13769. public function error($message, array $context = array())
  13770. {
  13771. return $this->log(LogLevel::ERROR, $message, $context);
  13772. }
  13773. public function warning($message, array $context = array())
  13774. {
  13775. return $this->log(LogLevel::WARNING, $message, $context);
  13776. }
  13777. public function notice($message, array $context = array())
  13778. {
  13779. return $this->log(LogLevel::NOTICE, $message, $context);
  13780. }
  13781. public function info($message, array $context = array())
  13782. {
  13783. return $this->log(LogLevel::INFO, $message, $context);
  13784. }
  13785. public function debug($message, array $context = array())
  13786. {
  13787. return $this->log(LogLevel::DEBUG, $message, $context);
  13788. }
  13789. public function log($level, $message, array $context = array())
  13790. {
  13791. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13792. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13793. } elseif ($level === LogLevel::WARNING) {
  13794. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13795. } elseif ($level === LogLevel::NOTICE) {
  13796. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13797. } elseif ($level === LogLevel::INFO) {
  13798. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13799. } else {
  13800. $this->writeError($message, true, self::DEBUG);
  13801. }
  13802. }
  13803. }
  13804. <?php
  13805. namespace Composer\IO;
  13806. use Symfony\Component\Console\Helper\QuestionHelper;
  13807. use Symfony\Component\Console\Output\StreamOutput;
  13808. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13809. use Symfony\Component\Console\Input\StreamableInputInterface;
  13810. use Symfony\Component\Console\Input\StringInput;
  13811. use Symfony\Component\Console\Helper\HelperSet;
  13812. class BufferIO extends ConsoleIO
  13813. {
  13814. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13815. {
  13816. $input = new StringInput($input);
  13817. $input->setInteractive(false);
  13818. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13819. parent::__construct($input, $output, new HelperSet(array(
  13820. new QuestionHelper(),
  13821. )));
  13822. }
  13823. public function getOutput()
  13824. {
  13825. fseek($this->output->getStream(), 0);
  13826. $output = stream_get_contents($this->output->getStream());
  13827. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13828. $pre = strip_tags($matches[1]);
  13829. if (strlen($pre) === strlen($matches[2])) {
  13830. return '';
  13831. }
  13832. return rtrim($matches[1])."\n";
  13833. }, $output);
  13834. return $output;
  13835. }
  13836. public function setUserInputs(array $inputs)
  13837. {
  13838. if (!$this->input instanceof StreamableInputInterface) {
  13839. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13840. }
  13841. $this->input->setStream($this->createStream($inputs));
  13842. $this->input->setInteractive(true);
  13843. }
  13844. private function createStream(array $inputs)
  13845. {
  13846. $stream = fopen('php://memory', 'r+', false);
  13847. foreach ($inputs as $input) {
  13848. fwrite($stream, $input.PHP_EOL);
  13849. }
  13850. rewind($stream);
  13851. return $stream;
  13852. }
  13853. }
  13854. <?php
  13855. namespace Composer\IO;
  13856. use Composer\Question\StrictConfirmationQuestion;
  13857. use Symfony\Component\Console\Helper\HelperSet;
  13858. use Symfony\Component\Console\Input\InputInterface;
  13859. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13860. use Symfony\Component\Console\Output\OutputInterface;
  13861. use Symfony\Component\Console\Question\ChoiceQuestion;
  13862. use Symfony\Component\Console\Question\Question;
  13863. class ConsoleIO extends BaseIO
  13864. {
  13865. protected $input;
  13866. protected $output;
  13867. protected $helperSet;
  13868. protected $lastMessage;
  13869. protected $lastMessageErr;
  13870. private $startTime;
  13871. private $verbosityMap;
  13872. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13873. {
  13874. $this->input = $input;
  13875. $this->output = $output;
  13876. $this->helperSet = $helperSet;
  13877. $this->verbosityMap = array(
  13878. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13879. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13880. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13881. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13882. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13883. );
  13884. }
  13885. public function enableDebugging($startTime)
  13886. {
  13887. $this->startTime = $startTime;
  13888. }
  13889. public function isInteractive()
  13890. {
  13891. return $this->input->isInteractive();
  13892. }
  13893. public function isDecorated()
  13894. {
  13895. return $this->output->isDecorated();
  13896. }
  13897. public function isVerbose()
  13898. {
  13899. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13900. }
  13901. public function isVeryVerbose()
  13902. {
  13903. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13904. }
  13905. public function isDebug()
  13906. {
  13907. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13908. }
  13909. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13910. {
  13911. $this->doWrite($messages, $newline, false, $verbosity);
  13912. }
  13913. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13914. {
  13915. $this->doWrite($messages, $newline, true, $verbosity);
  13916. }
  13917. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13918. {
  13919. $this->doWrite($messages, $newline, false, $verbosity, true);
  13920. }
  13921. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13922. {
  13923. $this->doWrite($messages, $newline, true, $verbosity, true);
  13924. }
  13925. private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false)
  13926. {
  13927. $sfVerbosity = $this->verbosityMap[$verbosity];
  13928. if ($sfVerbosity > $this->output->getVerbosity()) {
  13929. return;
  13930. }
  13931. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13932. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13933. }
  13934. if ($raw) {
  13935. if ($sfVerbosity === OutputInterface::OUTPUT_NORMAL) {
  13936. $sfVerbosity = OutputInterface::OUTPUT_RAW;
  13937. } else {
  13938. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  13939. }
  13940. }
  13941. if (null !== $this->startTime) {
  13942. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13943. $timeSpent = microtime(true) - $this->startTime;
  13944. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13945. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13946. }, (array) $messages);
  13947. }
  13948. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13949. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13950. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13951. return;
  13952. }
  13953. $this->output->write($messages, $newline, $sfVerbosity);
  13954. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13955. }
  13956. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13957. {
  13958. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13959. }
  13960. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13961. {
  13962. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13963. }
  13964. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13965. {
  13966. $messages = implode($newline ? "\n" : '', (array) $messages);
  13967. if (!isset($size)) {
  13968. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13969. }
  13970. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13971. $this->doWrite($messages, false, $stderr, $verbosity);
  13972. $fill = $size - strlen(strip_tags($messages));
  13973. if ($fill > 0) {
  13974. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13975. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13976. }
  13977. if ($newline) {
  13978. $this->doWrite('', true, $stderr, $verbosity);
  13979. }
  13980. if ($stderr) {
  13981. $this->lastMessageErr = $messages;
  13982. } else {
  13983. $this->lastMessage = $messages;
  13984. }
  13985. }
  13986. public function ask($question, $default = null)
  13987. {
  13988. $helper = $this->helperSet->get('question');
  13989. $question = new Question($question, $default);
  13990. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13991. }
  13992. public function askConfirmation($question, $default = true)
  13993. {
  13994. $helper = $this->helperSet->get('question');
  13995. $question = new StrictConfirmationQuestion($question, $default);
  13996. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13997. }
  13998. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13999. {
  14000. $helper = $this->helperSet->get('question');
  14001. $question = new Question($question, $default);
  14002. $question->setValidator($validator);
  14003. $question->setMaxAttempts($attempts);
  14004. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14005. }
  14006. public function askAndHideAnswer($question)
  14007. {
  14008. $helper = $this->helperSet->get('question');
  14009. $question = new Question($question);
  14010. $question->setHidden(true);
  14011. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14012. }
  14013. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14014. {
  14015. $helper = $this->helperSet->get('question');
  14016. $question = new ChoiceQuestion($question, $choices, $default);
  14017. $question->setMaxAttempts($attempts ?: null);
  14018. $question->setErrorMessage($errorMessage);
  14019. $question->setMultiselect($multiselect);
  14020. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  14021. if (!is_array($result)) {
  14022. return (string) array_search($result, $choices, true);
  14023. }
  14024. $results = array();
  14025. foreach ($choices as $index => $choice) {
  14026. if (in_array($choice, $result, true)) {
  14027. $results[] = (string) $index;
  14028. }
  14029. }
  14030. return $results;
  14031. }
  14032. private function getErrorOutput()
  14033. {
  14034. if ($this->output instanceof ConsoleOutputInterface) {
  14035. return $this->output->getErrorOutput();
  14036. }
  14037. return $this->output;
  14038. }
  14039. }
  14040. <?php
  14041. namespace Composer\IO;
  14042. use Composer\Config;
  14043. interface IOInterface
  14044. {
  14045. const QUIET = 1;
  14046. const NORMAL = 2;
  14047. const VERBOSE = 4;
  14048. const VERY_VERBOSE = 8;
  14049. const DEBUG = 16;
  14050. public function isInteractive();
  14051. public function isVerbose();
  14052. public function isVeryVerbose();
  14053. public function isDebug();
  14054. public function isDecorated();
  14055. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  14056. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  14057. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14058. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14059. public function ask($question, $default = null);
  14060. public function askConfirmation($question, $default = true);
  14061. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  14062. public function askAndHideAnswer($question);
  14063. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  14064. public function getAuthentications();
  14065. public function hasAuthentication($repositoryName);
  14066. public function getAuthentication($repositoryName);
  14067. public function setAuthentication($repositoryName, $username, $password = null);
  14068. public function loadConfiguration(Config $config);
  14069. }
  14070. <?php
  14071. namespace Composer\IO;
  14072. class NullIO extends BaseIO
  14073. {
  14074. public function isInteractive()
  14075. {
  14076. return false;
  14077. }
  14078. public function isVerbose()
  14079. {
  14080. return false;
  14081. }
  14082. public function isVeryVerbose()
  14083. {
  14084. return false;
  14085. }
  14086. public function isDebug()
  14087. {
  14088. return false;
  14089. }
  14090. public function isDecorated()
  14091. {
  14092. return false;
  14093. }
  14094. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  14095. {
  14096. }
  14097. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  14098. {
  14099. }
  14100. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14101. {
  14102. }
  14103. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14104. {
  14105. }
  14106. public function ask($question, $default = null)
  14107. {
  14108. return $default;
  14109. }
  14110. public function askConfirmation($question, $default = true)
  14111. {
  14112. return $default;
  14113. }
  14114. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  14115. {
  14116. return $default;
  14117. }
  14118. public function askAndHideAnswer($question)
  14119. {
  14120. return null;
  14121. }
  14122. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14123. {
  14124. return $default;
  14125. }
  14126. }
  14127. <?php
  14128. namespace Composer;
  14129. use Composer\Autoload\AutoloadGenerator;
  14130. use Composer\DependencyResolver\DefaultPolicy;
  14131. use Composer\DependencyResolver\Operation\UpdateOperation;
  14132. use Composer\DependencyResolver\Operation\InstallOperation;
  14133. use Composer\DependencyResolver\Operation\UninstallOperation;
  14134. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14135. use Composer\DependencyResolver\Operation\OperationInterface;
  14136. use Composer\DependencyResolver\PolicyInterface;
  14137. use Composer\DependencyResolver\Pool;
  14138. use Composer\DependencyResolver\Request;
  14139. use Composer\DependencyResolver\Rule;
  14140. use Composer\DependencyResolver\Solver;
  14141. use Composer\DependencyResolver\SolverProblemsException;
  14142. use Composer\Downloader\DownloadManager;
  14143. use Composer\EventDispatcher\EventDispatcher;
  14144. use Composer\Installer\InstallationManager;
  14145. use Composer\Installer\InstallerEvents;
  14146. use Composer\Installer\NoopInstaller;
  14147. use Composer\Installer\SuggestedPackagesReporter;
  14148. use Composer\IO\IOInterface;
  14149. use Composer\Package\AliasPackage;
  14150. use Composer\Package\BasePackage;
  14151. use Composer\Package\CompletePackage;
  14152. use Composer\Package\CompletePackageInterface;
  14153. use Composer\Package\Link;
  14154. use Composer\Package\Loader\ArrayLoader;
  14155. use Composer\Package\Dumper\ArrayDumper;
  14156. use Composer\Semver\Constraint\Constraint;
  14157. use Composer\Package\Locker;
  14158. use Composer\Package\PackageInterface;
  14159. use Composer\Package\RootPackageInterface;
  14160. use Composer\Repository\CompositeRepository;
  14161. use Composer\Repository\InstalledArrayRepository;
  14162. use Composer\Repository\PlatformRepository;
  14163. use Composer\Repository\RepositoryInterface;
  14164. use Composer\Repository\RepositoryManager;
  14165. use Composer\Repository\WritableRepositoryInterface;
  14166. use Composer\Script\ScriptEvents;
  14167. class Installer
  14168. {
  14169. protected $io;
  14170. protected $config;
  14171. protected $package;
  14172. protected $downloadManager;
  14173. protected $repositoryManager;
  14174. protected $locker;
  14175. protected $installationManager;
  14176. protected $eventDispatcher;
  14177. protected $autoloadGenerator;
  14178. protected $preferSource = false;
  14179. protected $preferDist = false;
  14180. protected $optimizeAutoloader = false;
  14181. protected $classMapAuthoritative = false;
  14182. protected $apcuAutoloader = false;
  14183. protected $devMode = false;
  14184. protected $dryRun = false;
  14185. protected $verbose = false;
  14186. protected $update = false;
  14187. protected $dumpAutoloader = true;
  14188. protected $runScripts = true;
  14189. protected $ignorePlatformReqs = false;
  14190. protected $preferStable = false;
  14191. protected $preferLowest = false;
  14192. protected $skipSuggest = false;
  14193. protected $writeLock;
  14194. protected $executeOperations = true;
  14195. protected $updateWhitelist = null;
  14196. protected $whitelistDependencies = false;
  14197. protected $whitelistAllDependencies = false;
  14198. protected $suggestedPackagesReporter;
  14199. protected $additionalInstalledRepository;
  14200. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  14201. {
  14202. $this->io = $io;
  14203. $this->config = $config;
  14204. $this->package = $package;
  14205. $this->downloadManager = $downloadManager;
  14206. $this->repositoryManager = $repositoryManager;
  14207. $this->locker = $locker;
  14208. $this->installationManager = $installationManager;
  14209. $this->eventDispatcher = $eventDispatcher;
  14210. $this->autoloadGenerator = $autoloadGenerator;
  14211. $this->writeLock = $config->get('lock');
  14212. }
  14213. public function run()
  14214. {
  14215. gc_collect_cycles();
  14216. gc_disable();
  14217. if (!$this->update && !$this->locker->isLocked()) {
  14218. $this->update = true;
  14219. }
  14220. if ($this->dryRun) {
  14221. $this->verbose = true;
  14222. $this->runScripts = false;
  14223. $this->executeOperations = false;
  14224. $this->writeLock = false;
  14225. $this->dumpAutoloader = false;
  14226. $this->installationManager->addInstaller(new NoopInstaller);
  14227. $this->mockLocalRepositories($this->repositoryManager);
  14228. }
  14229. if ($this->runScripts) {
  14230. $_SERVER['COMPOSER_DEV_MODE'] = $this->devMode ? '1' : '0';
  14231. putenv('COMPOSER_DEV_MODE='.$_SERVER['COMPOSER_DEV_MODE']);
  14232. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  14233. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14234. }
  14235. $this->downloadManager->setPreferSource($this->preferSource);
  14236. $this->downloadManager->setPreferDist($this->preferDist);
  14237. $localRepo = $this->repositoryManager->getLocalRepository();
  14238. if ($this->update) {
  14239. $platformOverrides = $this->config->get('platform') ?: array();
  14240. } else {
  14241. $platformOverrides = $this->locker->getPlatformOverrides();
  14242. }
  14243. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  14244. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14245. $aliases = $this->getRootAliases();
  14246. $this->aliasPlatformPackages($platformRepo, $aliases);
  14247. if (!$this->suggestedPackagesReporter) {
  14248. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  14249. }
  14250. try {
  14251. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  14252. if ($res !== 0) {
  14253. return $res;
  14254. }
  14255. } catch (\Exception $e) {
  14256. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14257. $this->installationManager->notifyInstalls($this->io);
  14258. }
  14259. throw $e;
  14260. }
  14261. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14262. $this->installationManager->notifyInstalls($this->io);
  14263. }
  14264. if ($this->devMode && !$this->skipSuggest) {
  14265. $this->suggestedPackagesReporter->output($installedRepo);
  14266. }
  14267. foreach ($localRepo->getPackages() as $package) {
  14268. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  14269. continue;
  14270. }
  14271. $replacement = is_string($package->getReplacementPackage())
  14272. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  14273. : 'No replacement was suggested';
  14274. $this->io->writeError(
  14275. sprintf(
  14276. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  14277. $package->getPrettyName(),
  14278. $replacement
  14279. )
  14280. );
  14281. }
  14282. if ($this->update && $this->writeLock) {
  14283. $localRepo->reload();
  14284. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  14285. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  14286. $updatedLock = $this->locker->setLockData(
  14287. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  14288. $devPackages,
  14289. $platformReqs,
  14290. $platformDevReqs,
  14291. $aliases,
  14292. $this->package->getMinimumStability(),
  14293. $this->package->getStabilityFlags(),
  14294. $this->preferStable || $this->package->getPreferStable(),
  14295. $this->preferLowest,
  14296. $this->config->get('platform') ?: array()
  14297. );
  14298. if ($updatedLock) {
  14299. $this->io->writeError('<info>Writing lock file</info>');
  14300. }
  14301. }
  14302. if ($this->dumpAutoloader) {
  14303. if ($this->optimizeAutoloader) {
  14304. $this->io->writeError('<info>Generating optimized autoload files</info>');
  14305. } else {
  14306. $this->io->writeError('<info>Generating autoload files</info>');
  14307. }
  14308. $this->autoloadGenerator->setDevMode($this->devMode);
  14309. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  14310. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  14311. $this->autoloadGenerator->setRunScripts($this->runScripts);
  14312. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  14313. }
  14314. if ($this->executeOperations) {
  14315. foreach ($localRepo->getPackages() as $package) {
  14316. $this->installationManager->ensureBinariesPresence($package);
  14317. }
  14318. }
  14319. $fundingCount = 0;
  14320. foreach ($localRepo->getPackages() as $package) {
  14321. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  14322. $fundingCount++;
  14323. }
  14324. }
  14325. if ($fundingCount) {
  14326. $this->io->writeError(array(
  14327. sprintf(
  14328. "<info>%d package%s you are using %s looking for funding.</info>",
  14329. $fundingCount,
  14330. 1 === $fundingCount ? '' : 's',
  14331. 1 === $fundingCount ? 'is' : 'are'
  14332. ),
  14333. '<info>Use the `composer fund` command to find out more!</info>',
  14334. ));
  14335. }
  14336. if ($this->runScripts) {
  14337. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  14338. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14339. }
  14340. if (!defined('HHVM_VERSION')) {
  14341. gc_enable();
  14342. }
  14343. return 0;
  14344. }
  14345. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  14346. {
  14347. $lockedRepository = null;
  14348. $repositories = null;
  14349. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  14350. try {
  14351. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  14352. } catch (\RuntimeException $e) {
  14353. if ($this->package->getDevRequires()) {
  14354. throw $e;
  14355. }
  14356. $lockedRepository = $this->locker->getLockedRepository();
  14357. }
  14358. }
  14359. $this->allowListUpdateDependencies(
  14360. $lockedRepository ?: $localRepo,
  14361. $this->package->getRequires(),
  14362. $this->package->getDevRequires()
  14363. );
  14364. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  14365. $policy = $this->createPolicy();
  14366. $pool = $this->createPool($this->update ? null : $lockedRepository);
  14367. $pool->addRepository($installedRepo, $aliases);
  14368. if ($this->update) {
  14369. $repositories = $this->repositoryManager->getRepositories();
  14370. foreach ($repositories as $repository) {
  14371. $pool->addRepository($repository, $aliases);
  14372. }
  14373. }
  14374. if ($lockedRepository) {
  14375. $pool->addRepository($lockedRepository, $aliases);
  14376. }
  14377. $request = $this->createRequest($this->package, $platformRepo);
  14378. if ($this->update) {
  14379. $removedUnstablePackages = array();
  14380. foreach ($localRepo->getPackages() as $package) {
  14381. if (
  14382. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  14383. && $this->installationManager->isPackageInstalled($localRepo, $package)
  14384. ) {
  14385. $removedUnstablePackages[$package->getName()] = true;
  14386. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  14387. }
  14388. }
  14389. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  14390. $request->updateAll();
  14391. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14392. foreach ($links as $link) {
  14393. $request->install($link->getTarget(), $link->getConstraint());
  14394. }
  14395. if ($this->updateWhitelist) {
  14396. $currentPackages = $this->getCurrentPackages($installedRepo);
  14397. $candidates = array();
  14398. foreach ($links as $link) {
  14399. $candidates[$link->getTarget()] = true;
  14400. $rootRequires[$link->getTarget()] = $link;
  14401. }
  14402. foreach ($currentPackages as $package) {
  14403. $candidates[$package->getName()] = true;
  14404. }
  14405. foreach ($candidates as $candidate => $dummy) {
  14406. foreach ($currentPackages as $curPackage) {
  14407. if ($curPackage->getName() === $candidate) {
  14408. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  14409. $constraint = new Constraint('=', $curPackage->getVersion());
  14410. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  14411. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  14412. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  14413. $request->install($curPackage->getName(), $constraint);
  14414. }
  14415. break;
  14416. }
  14417. }
  14418. }
  14419. }
  14420. } else {
  14421. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  14422. if (!$this->locker->isFresh()) {
  14423. $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);
  14424. }
  14425. foreach ($lockedRepository->getPackages() as $package) {
  14426. $version = $package->getVersion();
  14427. if (isset($aliases[$package->getName()][$version])) {
  14428. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  14429. }
  14430. $constraint = new Constraint('=', $version);
  14431. $constraint->setPrettyString($package->getPrettyVersion());
  14432. $request->install($package->getName(), $constraint);
  14433. }
  14434. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  14435. $request->install($link->getTarget(), $link->getConstraint());
  14436. }
  14437. }
  14438. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  14439. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  14440. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14441. try {
  14442. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  14443. $ruleSetSize = $solver->getRuleSetSize();
  14444. $solver = null;
  14445. } catch (SolverProblemsException $e) {
  14446. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  14447. $this->io->writeError($e->getMessage());
  14448. if ($this->update && !$this->devMode) {
  14449. $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);
  14450. }
  14451. return array(max(1, $e->getCode()), array());
  14452. }
  14453. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  14454. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  14455. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  14456. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  14457. if (!$operations) {
  14458. $this->io->writeError('Nothing to install or update');
  14459. }
  14460. $operations = $this->movePluginsToFront($operations);
  14461. $operations = $this->moveUninstallsToFront($operations);
  14462. if ($this->update) {
  14463. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  14464. if (!$this->devMode) {
  14465. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  14466. }
  14467. } else {
  14468. $devPackages = null;
  14469. }
  14470. if ($operations) {
  14471. $installs = $updates = $uninstalls = array();
  14472. foreach ($operations as $operation) {
  14473. if ($operation instanceof InstallOperation) {
  14474. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  14475. } elseif ($operation instanceof UpdateOperation) {
  14476. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  14477. } elseif ($operation instanceof UninstallOperation) {
  14478. $uninstalls[] = $operation->getPackage()->getPrettyName();
  14479. }
  14480. }
  14481. $this->io->writeError(sprintf(
  14482. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  14483. count($installs),
  14484. 1 === count($installs) ? '' : 's',
  14485. count($updates),
  14486. 1 === count($updates) ? '' : 's',
  14487. count($uninstalls),
  14488. 1 === count($uninstalls) ? '' : 's'
  14489. ));
  14490. if ($installs) {
  14491. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  14492. }
  14493. if ($updates) {
  14494. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  14495. }
  14496. if ($uninstalls) {
  14497. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  14498. }
  14499. }
  14500. foreach ($operations as $operation) {
  14501. $jobType = $operation->getJobType();
  14502. if ('install' === $jobType) {
  14503. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  14504. }
  14505. if ($this->update) {
  14506. $package = null;
  14507. if ('update' === $jobType) {
  14508. $package = $operation->getTargetPackage();
  14509. } elseif ('install' === $jobType) {
  14510. $package = $operation->getPackage();
  14511. }
  14512. if ($package && $package->isDev()) {
  14513. $references = $this->package->getReferences();
  14514. if (isset($references[$package->getName()])) {
  14515. $this->updateInstallReferences($package, $references[$package->getName()]);
  14516. }
  14517. }
  14518. if ('update' === $jobType) {
  14519. $targetPackage = $operation->getTargetPackage();
  14520. if ($targetPackage->isDev()) {
  14521. $initialPackage = $operation->getInitialPackage();
  14522. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  14523. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  14524. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  14525. ) {
  14526. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  14527. $this->io->writeError('', true, IOInterface::DEBUG);
  14528. continue;
  14529. }
  14530. }
  14531. }
  14532. }
  14533. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  14534. if (defined($event) && $this->runScripts) {
  14535. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14536. }
  14537. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  14538. $this->io->writeError(' - ' . $operation);
  14539. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  14540. $this->io->writeError(' - ' . $operation);
  14541. }
  14542. $this->installationManager->execute($localRepo, $operation);
  14543. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  14544. $reason = $operation->getReason();
  14545. if ($reason instanceof Rule) {
  14546. switch ($reason->getReason()) {
  14547. case Rule::RULE_JOB_INSTALL:
  14548. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  14549. $this->io->writeError('');
  14550. break;
  14551. case Rule::RULE_PACKAGE_REQUIRES:
  14552. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  14553. $this->io->writeError('');
  14554. break;
  14555. }
  14556. }
  14557. }
  14558. if ($this->executeOperations || $this->writeLock) {
  14559. $localRepo->write();
  14560. }
  14561. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  14562. if (defined($event) && $this->runScripts) {
  14563. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14564. }
  14565. }
  14566. if ($this->executeOperations) {
  14567. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  14568. $localRepo->write();
  14569. }
  14570. if ($operations) {
  14571. $vendorDir = $this->config->get('vendor-dir');
  14572. if (is_dir($vendorDir)) {
  14573. @touch($vendorDir);
  14574. }
  14575. }
  14576. return array(0, $devPackages);
  14577. }
  14578. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  14579. {
  14580. if (!$this->package->getDevRequires()) {
  14581. return array();
  14582. }
  14583. $tempLocalRepo = clone $localRepo;
  14584. foreach ($operations as $operation) {
  14585. switch ($operation->getJobType()) {
  14586. case 'install':
  14587. case 'markAliasInstalled':
  14588. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  14589. $tempLocalRepo->addPackage(clone $operation->getPackage());
  14590. }
  14591. break;
  14592. case 'uninstall':
  14593. case 'markAliasUninstalled':
  14594. $tempLocalRepo->removePackage($operation->getPackage());
  14595. break;
  14596. case 'update':
  14597. $tempLocalRepo->removePackage($operation->getInitialPackage());
  14598. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  14599. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  14600. }
  14601. break;
  14602. default:
  14603. throw new \LogicException('Unknown type: '.$operation->getJobType());
  14604. }
  14605. }
  14606. $localRepo = new InstalledArrayRepository(array());
  14607. $loader = new ArrayLoader(null, true);
  14608. $dumper = new ArrayDumper();
  14609. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  14610. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  14611. }
  14612. unset($tempLocalRepo, $loader, $dumper);
  14613. $policy = $this->createPolicy();
  14614. $pool = $this->createPool();
  14615. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14616. $pool->addRepository($installedRepo, $aliases);
  14617. $request = $this->createRequest($this->package, $platformRepo);
  14618. $request->updateAll();
  14619. foreach ($this->package->getRequires() as $link) {
  14620. $request->install($link->getTarget(), $link->getConstraint());
  14621. }
  14622. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  14623. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14624. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  14625. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  14626. $devPackages = array();
  14627. foreach ($ops as $op) {
  14628. if ($op->getJobType() === 'uninstall') {
  14629. $devPackages[] = $op->getPackage();
  14630. }
  14631. }
  14632. return $devPackages;
  14633. }
  14634. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  14635. {
  14636. $finalOps = array();
  14637. $packagesToSkip = array();
  14638. foreach ($devPackages as $pkg) {
  14639. $packagesToSkip[$pkg->getName()] = true;
  14640. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  14641. if ($installedDevPkg instanceof AliasPackage) {
  14642. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  14643. $installedDevPkg = $installedDevPkg->getAliasOf();
  14644. }
  14645. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  14646. }
  14647. }
  14648. foreach ($operations as $op) {
  14649. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  14650. if (isset($packagesToSkip[$package->getName()])) {
  14651. continue;
  14652. }
  14653. $finalOps[] = $op;
  14654. }
  14655. return $finalOps;
  14656. }
  14657. private function movePluginsToFront(array $operations)
  14658. {
  14659. $pluginsNoDeps = array();
  14660. $pluginsWithDeps = array();
  14661. $pluginRequires = array();
  14662. foreach (array_reverse($operations, true) as $idx => $op) {
  14663. if ($op instanceof InstallOperation) {
  14664. $package = $op->getPackage();
  14665. } elseif ($op instanceof UpdateOperation) {
  14666. $package = $op->getTargetPackage();
  14667. } else {
  14668. continue;
  14669. }
  14670. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  14671. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  14672. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  14673. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  14674. });
  14675. if ($isPlugin && !count($requires)) {
  14676. array_unshift($pluginsNoDeps, $op);
  14677. } else {
  14678. $pluginRequires = array_merge($pluginRequires, $requires);
  14679. array_unshift($pluginsWithDeps, $op);
  14680. }
  14681. unset($operations[$idx]);
  14682. }
  14683. }
  14684. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  14685. }
  14686. private function moveUninstallsToFront(array $operations)
  14687. {
  14688. $uninstOps = array();
  14689. foreach ($operations as $idx => $op) {
  14690. if ($op instanceof UninstallOperation) {
  14691. $uninstOps[] = $op;
  14692. unset($operations[$idx]);
  14693. }
  14694. }
  14695. return array_merge($uninstOps, $operations);
  14696. }
  14697. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14698. {
  14699. $installedRootPackage = clone $this->package;
  14700. $installedRootPackage->setRequires(array());
  14701. $installedRootPackage->setDevRequires(array());
  14702. $repos = array(
  14703. $localRepo,
  14704. new InstalledArrayRepository(array($installedRootPackage)),
  14705. $platformRepo,
  14706. );
  14707. $installedRepo = new CompositeRepository($repos);
  14708. if ($this->additionalInstalledRepository) {
  14709. $installedRepo->addRepository($this->additionalInstalledRepository);
  14710. }
  14711. return $installedRepo;
  14712. }
  14713. private function createPool(RepositoryInterface $lockedRepository = null)
  14714. {
  14715. if ($this->update) {
  14716. $minimumStability = $this->package->getMinimumStability();
  14717. $stabilityFlags = $this->package->getStabilityFlags();
  14718. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14719. } else {
  14720. $minimumStability = $this->locker->getMinimumStability();
  14721. $stabilityFlags = $this->locker->getStabilityFlags();
  14722. $requires = array();
  14723. foreach ($lockedRepository->getPackages() as $package) {
  14724. $constraint = new Constraint('=', $package->getVersion());
  14725. $constraint->setPrettyString($package->getPrettyVersion());
  14726. $requires[$package->getName()] = $constraint;
  14727. }
  14728. }
  14729. $rootConstraints = array();
  14730. foreach ($requires as $req => $constraint) {
  14731. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14732. continue;
  14733. }
  14734. if ($constraint instanceof Link) {
  14735. $rootConstraints[$req] = $constraint->getConstraint();
  14736. } else {
  14737. $rootConstraints[$req] = $constraint;
  14738. }
  14739. }
  14740. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14741. }
  14742. private function createPolicy()
  14743. {
  14744. $preferStable = null;
  14745. $preferLowest = null;
  14746. if (!$this->update) {
  14747. $preferStable = $this->locker->getPreferStable();
  14748. $preferLowest = $this->locker->getPreferLowest();
  14749. }
  14750. if (null === $preferStable) {
  14751. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14752. }
  14753. if (null === $preferLowest) {
  14754. $preferLowest = $this->preferLowest;
  14755. }
  14756. return new DefaultPolicy($preferStable, $preferLowest);
  14757. }
  14758. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14759. {
  14760. $request = new Request();
  14761. $constraint = new Constraint('=', $rootPackage->getVersion());
  14762. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14763. $request->install($rootPackage->getName(), $constraint);
  14764. $fixedPackages = $platformRepo->getPackages();
  14765. if ($this->additionalInstalledRepository) {
  14766. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14767. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14768. }
  14769. $provided = $rootPackage->getProvides();
  14770. foreach ($fixedPackages as $package) {
  14771. $constraint = new Constraint('=', $package->getVersion());
  14772. $constraint->setPrettyString($package->getPrettyVersion());
  14773. if ($package->getRepository() !== $platformRepo
  14774. || !isset($provided[$package->getName()])
  14775. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14776. ) {
  14777. $request->fix($package->getName(), $constraint);
  14778. }
  14779. }
  14780. return $request;
  14781. }
  14782. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14783. {
  14784. if ($task === 'force-updates' && null === $operations) {
  14785. throw new \InvalidArgumentException('Missing operations argument');
  14786. }
  14787. if ($task === 'force-links') {
  14788. $operations = array();
  14789. }
  14790. if ($this->update && $this->updateWhitelist) {
  14791. $currentPackages = $this->getCurrentPackages($installedRepo);
  14792. }
  14793. foreach ($localRepo->getCanonicalPackages() as $package) {
  14794. if (!$package->isDev()) {
  14795. continue;
  14796. }
  14797. foreach ($operations as $operation) {
  14798. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14799. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14800. ) {
  14801. continue 2;
  14802. }
  14803. }
  14804. if ($this->update) {
  14805. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14806. foreach ($currentPackages as $curPackage) {
  14807. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14808. if ($task === 'force-links') {
  14809. $package->setRequires($curPackage->getRequires());
  14810. $package->setConflicts($curPackage->getConflicts());
  14811. $package->setProvides($curPackage->getProvides());
  14812. $package->setReplaces($curPackage->getReplaces());
  14813. } elseif ($task === 'force-updates') {
  14814. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14815. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14816. ) {
  14817. $operations[] = new UpdateOperation($package, $curPackage);
  14818. }
  14819. }
  14820. break;
  14821. }
  14822. }
  14823. continue;
  14824. }
  14825. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14826. foreach ($matches as $index => $match) {
  14827. if (!in_array($match->getRepository(), $repositories, true)) {
  14828. unset($matches[$index]);
  14829. continue;
  14830. }
  14831. if ($match->getName() !== $package->getName()) {
  14832. unset($matches[$index]);
  14833. continue;
  14834. }
  14835. $matches[$index] = $match->getId();
  14836. }
  14837. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14838. $newPackage = $pool->literalToPackage($matches[0]);
  14839. if ($task === 'force-links' && $newPackage) {
  14840. $package->setRequires($newPackage->getRequires());
  14841. $package->setConflicts($newPackage->getConflicts());
  14842. $package->setProvides($newPackage->getProvides());
  14843. $package->setReplaces($newPackage->getReplaces());
  14844. }
  14845. if (
  14846. $task === 'force-updates'
  14847. && $newPackage
  14848. && (
  14849. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14850. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14851. )
  14852. ) {
  14853. $operations[] = new UpdateOperation($package, $newPackage);
  14854. continue;
  14855. }
  14856. }
  14857. if ($task === 'force-updates') {
  14858. $references = $this->package->getReferences();
  14859. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14860. $operations[] = new UpdateOperation($package, clone $package);
  14861. }
  14862. }
  14863. } else {
  14864. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14865. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14866. if ($task === 'force-links') {
  14867. $package->setRequires($lockedPackage->getRequires());
  14868. $package->setConflicts($lockedPackage->getConflicts());
  14869. $package->setProvides($lockedPackage->getProvides());
  14870. $package->setReplaces($lockedPackage->getReplaces());
  14871. } elseif ($task === 'force-updates') {
  14872. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14873. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14874. ) {
  14875. $operations[] = new UpdateOperation($package, $lockedPackage);
  14876. }
  14877. }
  14878. break;
  14879. }
  14880. }
  14881. }
  14882. }
  14883. return $operations;
  14884. }
  14885. private function getCurrentPackages($installedRepo)
  14886. {
  14887. if ($this->locker->isLocked()) {
  14888. try {
  14889. return $this->locker->getLockedRepository(true)->getPackages();
  14890. } catch (\RuntimeException $e) {
  14891. return $this->locker->getLockedRepository()->getPackages();
  14892. }
  14893. }
  14894. return $installedRepo->getPackages();
  14895. }
  14896. private function getRootAliases()
  14897. {
  14898. if ($this->update) {
  14899. $aliases = $this->package->getAliases();
  14900. } else {
  14901. $aliases = $this->locker->getAliases();
  14902. }
  14903. $normalizedAliases = array();
  14904. foreach ($aliases as $alias) {
  14905. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14906. 'alias' => $alias['alias'],
  14907. 'alias_normalized' => $alias['alias_normalized'],
  14908. );
  14909. }
  14910. return $normalizedAliases;
  14911. }
  14912. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14913. {
  14914. if (!$this->update) {
  14915. return;
  14916. }
  14917. $rootRefs = $this->package->getReferences();
  14918. foreach ($localRepo->getCanonicalPackages() as $package) {
  14919. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14920. foreach ($matches as $index => $match) {
  14921. if (!in_array($match->getRepository(), $repositories, true)) {
  14922. unset($matches[$index]);
  14923. continue;
  14924. }
  14925. if ($match->getName() !== $package->getName()) {
  14926. unset($matches[$index]);
  14927. continue;
  14928. }
  14929. $matches[$index] = $match->getId();
  14930. }
  14931. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14932. $newPackage = $pool->literalToPackage($matches[0]);
  14933. $sourceUrl = $package->getSourceUrl();
  14934. $newSourceUrl = $newPackage->getSourceUrl();
  14935. $newReference = $newPackage->getSourceReference();
  14936. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14937. $newReference = $rootRefs[$package->getName()];
  14938. }
  14939. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14940. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14941. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14942. }
  14943. $package->setDistMirrors($newPackage->getDistMirrors());
  14944. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14945. $package->setTransportOptions($newPackage->getTransportOptions());
  14946. }
  14947. }
  14948. }
  14949. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14950. {
  14951. $oldSourceRef = $package->getSourceReference();
  14952. if ($package->getSourceUrl() !== $sourceUrl) {
  14953. $package->setSourceType($sourceType);
  14954. $package->setSourceUrl($sourceUrl);
  14955. $package->setSourceReference($sourceReference);
  14956. }
  14957. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14958. $package->setDistUrl($distUrl);
  14959. $package->setDistType($distType);
  14960. $package->setDistSha1Checksum($distShaSum);
  14961. $this->updateInstallReferences($package, $sourceReference);
  14962. }
  14963. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14964. $this->updateInstallReferences($package, $oldSourceRef);
  14965. }
  14966. }
  14967. private function updateInstallReferences(PackageInterface $package, $reference)
  14968. {
  14969. if (!$reference) {
  14970. return;
  14971. }
  14972. $package->setSourceReference($reference);
  14973. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14974. $package->setDistReference($reference);
  14975. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14976. } elseif ($package->getDistReference()) {
  14977. $package->setDistReference($reference);
  14978. }
  14979. }
  14980. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14981. {
  14982. foreach ($aliases as $package => $versions) {
  14983. foreach ($versions as $version => $alias) {
  14984. $packages = $platformRepo->findPackages($package, $version);
  14985. foreach ($packages as $package) {
  14986. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14987. $aliasPackage->setRootPackageAlias(true);
  14988. $platformRepo->addPackage($aliasPackage);
  14989. }
  14990. }
  14991. }
  14992. }
  14993. private function isUpdateable(PackageInterface $package)
  14994. {
  14995. if (!$this->updateWhitelist) {
  14996. throw new \LogicException('isUpdateable should only be called when an allow list is present');
  14997. }
  14998. foreach ($this->updateWhitelist as $pattern => $void) {
  14999. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  15000. if (preg_match($patternRegexp, $package->getName())) {
  15001. return true;
  15002. }
  15003. }
  15004. return false;
  15005. }
  15006. private function extractPlatformRequirements($links)
  15007. {
  15008. $platformReqs = array();
  15009. foreach ($links as $link) {
  15010. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  15011. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  15012. }
  15013. }
  15014. return $platformReqs;
  15015. }
  15016. private function allowListUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  15017. {
  15018. if (!$this->updateWhitelist) {
  15019. return;
  15020. }
  15021. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  15022. $skipPackages = array();
  15023. if (!$this->whitelistAllDependencies) {
  15024. foreach ($rootRequires as $require) {
  15025. $skipPackages[$require->getTarget()] = true;
  15026. }
  15027. }
  15028. $pool = new Pool('dev');
  15029. $pool->addRepository($localOrLockRepo);
  15030. $seen = array();
  15031. $rootRequiredPackageNames = array_keys($rootRequires);
  15032. foreach ($this->updateWhitelist as $packageName => $void) {
  15033. $packageQueue = new \SplQueue;
  15034. $nameMatchesRequiredPackage = false;
  15035. $depPackages = $pool->whatProvides($packageName);
  15036. $matchesByPattern = array();
  15037. if (empty($depPackages)) {
  15038. $allowListPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  15039. foreach ($localOrLockRepo->search($allowListPatternSearchRegexp) as $installedPackage) {
  15040. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  15041. }
  15042. $allowListPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  15043. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  15044. if (preg_match($allowListPatternRegexp, $rootRequiredPackageName)) {
  15045. $nameMatchesRequiredPackage = true;
  15046. break;
  15047. }
  15048. }
  15049. }
  15050. if (!empty($matchesByPattern)) {
  15051. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  15052. }
  15053. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  15054. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  15055. }
  15056. foreach ($depPackages as $depPackage) {
  15057. $packageQueue->enqueue($depPackage);
  15058. }
  15059. while (!$packageQueue->isEmpty()) {
  15060. $package = $packageQueue->dequeue();
  15061. if (isset($seen[$package->getId()])) {
  15062. continue;
  15063. }
  15064. $seen[$package->getId()] = true;
  15065. $this->updateWhitelist[$package->getName()] = true;
  15066. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  15067. continue;
  15068. }
  15069. $requires = $package->getRequires();
  15070. foreach ($requires as $require) {
  15071. $requirePackages = $pool->whatProvides($require->getTarget());
  15072. foreach ($requirePackages as $requirePackage) {
  15073. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  15074. continue;
  15075. }
  15076. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  15077. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly allowed. Ignoring.</warning>');
  15078. continue;
  15079. }
  15080. $packageQueue->enqueue($requirePackage);
  15081. }
  15082. }
  15083. }
  15084. }
  15085. }
  15086. private function mockLocalRepositories(RepositoryManager $rm)
  15087. {
  15088. $packages = array();
  15089. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  15090. $packages[(string) $package] = clone $package;
  15091. }
  15092. foreach ($packages as $key => $package) {
  15093. if ($package instanceof AliasPackage) {
  15094. $alias = (string) $package->getAliasOf();
  15095. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  15096. }
  15097. }
  15098. $rm->setLocalRepository(
  15099. new InstalledArrayRepository($packages)
  15100. );
  15101. }
  15102. public static function create(IOInterface $io, Composer $composer)
  15103. {
  15104. return new static(
  15105. $io,
  15106. $composer->getConfig(),
  15107. $composer->getPackage(),
  15108. $composer->getDownloadManager(),
  15109. $composer->getRepositoryManager(),
  15110. $composer->getLocker(),
  15111. $composer->getInstallationManager(),
  15112. $composer->getEventDispatcher(),
  15113. $composer->getAutoloadGenerator()
  15114. );
  15115. }
  15116. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  15117. {
  15118. $this->additionalInstalledRepository = $additionalInstalledRepository;
  15119. return $this;
  15120. }
  15121. public function setDryRun($dryRun = true)
  15122. {
  15123. $this->dryRun = (bool) $dryRun;
  15124. return $this;
  15125. }
  15126. public function isDryRun()
  15127. {
  15128. return $this->dryRun;
  15129. }
  15130. public function setPreferSource($preferSource = true)
  15131. {
  15132. $this->preferSource = (bool) $preferSource;
  15133. return $this;
  15134. }
  15135. public function setPreferDist($preferDist = true)
  15136. {
  15137. $this->preferDist = (bool) $preferDist;
  15138. return $this;
  15139. }
  15140. public function setOptimizeAutoloader($optimizeAutoloader = false)
  15141. {
  15142. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  15143. if (!$this->optimizeAutoloader) {
  15144. $this->setClassMapAuthoritative(false);
  15145. }
  15146. return $this;
  15147. }
  15148. public function setClassMapAuthoritative($classMapAuthoritative = false)
  15149. {
  15150. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  15151. if ($this->classMapAuthoritative) {
  15152. $this->setOptimizeAutoloader(true);
  15153. }
  15154. return $this;
  15155. }
  15156. public function setApcuAutoloader($apcuAutoloader = false)
  15157. {
  15158. $this->apcuAutoloader = (bool) $apcuAutoloader;
  15159. return $this;
  15160. }
  15161. public function setUpdate($update = true)
  15162. {
  15163. $this->update = (bool) $update;
  15164. return $this;
  15165. }
  15166. public function setDevMode($devMode = true)
  15167. {
  15168. $this->devMode = (bool) $devMode;
  15169. return $this;
  15170. }
  15171. public function setDumpAutoloader($dumpAutoloader = true)
  15172. {
  15173. $this->dumpAutoloader = (bool) $dumpAutoloader;
  15174. return $this;
  15175. }
  15176. public function setRunScripts($runScripts = true)
  15177. {
  15178. $this->runScripts = (bool) $runScripts;
  15179. return $this;
  15180. }
  15181. public function setConfig(Config $config)
  15182. {
  15183. $this->config = $config;
  15184. return $this;
  15185. }
  15186. public function setVerbose($verbose = true)
  15187. {
  15188. $this->verbose = (bool) $verbose;
  15189. return $this;
  15190. }
  15191. public function isVerbose()
  15192. {
  15193. return $this->verbose;
  15194. }
  15195. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  15196. {
  15197. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  15198. return $this;
  15199. }
  15200. public function setUpdateWhitelist(array $packages)
  15201. {
  15202. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  15203. return $this;
  15204. }
  15205. public function setUpdateAllowList(array $packages)
  15206. {
  15207. return $this->setUpdateWhitelist($packages);
  15208. }
  15209. public function setWhitelistDependencies($updateDependencies = true)
  15210. {
  15211. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  15212. }
  15213. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  15214. {
  15215. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  15216. return $this;
  15217. }
  15218. public function setAllowListTransitiveDependencies($updateTransitiveDependencies = true)
  15219. {
  15220. return $this->setWhitelistTransitiveDependencies($updateTransitiveDependencies);
  15221. }
  15222. public function setWhitelistAllDependencies($updateAllDependencies = true)
  15223. {
  15224. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  15225. return $this;
  15226. }
  15227. public function setAllowListAllDependencies($updateAllDependencies = true)
  15228. {
  15229. return $this->setWhitelistAllDependencies($updateAllDependencies);
  15230. }
  15231. public function setPreferStable($preferStable = true)
  15232. {
  15233. $this->preferStable = (bool) $preferStable;
  15234. return $this;
  15235. }
  15236. public function setPreferLowest($preferLowest = true)
  15237. {
  15238. $this->preferLowest = (bool) $preferLowest;
  15239. return $this;
  15240. }
  15241. public function setWriteLock($writeLock = true)
  15242. {
  15243. $this->writeLock = (bool) $writeLock;
  15244. return $this;
  15245. }
  15246. public function setExecuteOperations($executeOperations = true)
  15247. {
  15248. $this->executeOperations = (bool) $executeOperations;
  15249. return $this;
  15250. }
  15251. public function setSkipSuggest($skipSuggest = true)
  15252. {
  15253. $this->skipSuggest = (bool) $skipSuggest;
  15254. return $this;
  15255. }
  15256. public function disablePlugins()
  15257. {
  15258. $this->installationManager->disablePlugins();
  15259. return $this;
  15260. }
  15261. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  15262. {
  15263. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  15264. return $this;
  15265. }
  15266. }
  15267. <?php
  15268. namespace Composer\Installer;
  15269. use Composer\IO\IOInterface;
  15270. use Composer\Package\PackageInterface;
  15271. use Composer\Util\Filesystem;
  15272. use Composer\Util\Platform;
  15273. use Composer\Util\ProcessExecutor;
  15274. use Composer\Util\Silencer;
  15275. class BinaryInstaller
  15276. {
  15277. protected $binDir;
  15278. protected $binCompat;
  15279. protected $io;
  15280. protected $filesystem;
  15281. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  15282. {
  15283. $this->binDir = $binDir;
  15284. $this->binCompat = $binCompat;
  15285. $this->io = $io;
  15286. $this->filesystem = $filesystem ?: new Filesystem();
  15287. }
  15288. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  15289. {
  15290. $binaries = $this->getBinaries($package);
  15291. if (!$binaries) {
  15292. return;
  15293. }
  15294. foreach ($binaries as $bin) {
  15295. $binPath = $installPath.'/'.$bin;
  15296. if (!file_exists($binPath)) {
  15297. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  15298. continue;
  15299. }
  15300. $binPath = realpath($binPath);
  15301. $this->initializeBinDir();
  15302. $link = $this->binDir.'/'.basename($bin);
  15303. if (file_exists($link)) {
  15304. if (is_link($link)) {
  15305. Silencer::call('chmod', $link, 0777 & ~umask());
  15306. }
  15307. if ($warnOnOverwrite) {
  15308. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  15309. }
  15310. continue;
  15311. }
  15312. if ($this->binCompat === "auto") {
  15313. if (Platform::isWindows()) {
  15314. $this->installFullBinaries($binPath, $link, $bin, $package);
  15315. } else {
  15316. $this->installSymlinkBinaries($binPath, $link);
  15317. }
  15318. } elseif ($this->binCompat === "full") {
  15319. $this->installFullBinaries($binPath, $link, $bin, $package);
  15320. }
  15321. Silencer::call('chmod', $link, 0777 & ~umask());
  15322. }
  15323. }
  15324. public function removeBinaries(PackageInterface $package)
  15325. {
  15326. $this->initializeBinDir();
  15327. $binaries = $this->getBinaries($package);
  15328. if (!$binaries) {
  15329. return;
  15330. }
  15331. foreach ($binaries as $bin) {
  15332. $link = $this->binDir.'/'.basename($bin);
  15333. if (is_link($link) || file_exists($link)) {
  15334. $this->filesystem->unlink($link);
  15335. }
  15336. if (file_exists($link.'.bat')) {
  15337. $this->filesystem->unlink($link.'.bat');
  15338. }
  15339. }
  15340. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  15341. Silencer::call('rmdir', $this->binDir);
  15342. }
  15343. }
  15344. public static function determineBinaryCaller($bin)
  15345. {
  15346. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  15347. return 'call';
  15348. }
  15349. $handle = fopen($bin, 'r');
  15350. $line = fgets($handle);
  15351. fclose($handle);
  15352. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15353. return trim($match[1]);
  15354. }
  15355. return 'php';
  15356. }
  15357. protected function getBinaries(PackageInterface $package)
  15358. {
  15359. return $package->getBinaries();
  15360. }
  15361. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  15362. {
  15363. if ('.bat' !== substr($binPath, -4)) {
  15364. $this->installUnixyProxyBinaries($binPath, $link);
  15365. @chmod($link, 0777 & ~umask());
  15366. $link .= '.bat';
  15367. if (file_exists($link)) {
  15368. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  15369. }
  15370. }
  15371. if (!file_exists($link)) {
  15372. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  15373. }
  15374. }
  15375. protected function installSymlinkBinaries($binPath, $link)
  15376. {
  15377. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  15378. $this->installUnixyProxyBinaries($binPath, $link);
  15379. }
  15380. }
  15381. protected function installUnixyProxyBinaries($binPath, $link)
  15382. {
  15383. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  15384. }
  15385. protected function initializeBinDir()
  15386. {
  15387. $this->filesystem->ensureDirectoryExists($this->binDir);
  15388. $this->binDir = realpath($this->binDir);
  15389. }
  15390. protected function generateWindowsProxyCode($bin, $link)
  15391. {
  15392. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15393. $caller = self::determineBinaryCaller($bin);
  15394. return "@ECHO OFF\r\n".
  15395. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  15396. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  15397. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  15398. }
  15399. protected function generateUnixyProxyCode($bin, $link)
  15400. {
  15401. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15402. $binDir = ProcessExecutor::escape(dirname($binPath));
  15403. $binFile = basename($binPath);
  15404. $proxyCode = <<<PROXY
  15405. #!/usr/bin/env sh
  15406. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  15407. if [ -d /proc/cygdrive ]; then
  15408. case \$(which php) in
  15409. \$(readlink -n /proc/cygdrive)/*)
  15410. # We are in Cygwin using Windows php, so the path must be translated
  15411. dir=\$(cygpath -m "\$dir");
  15412. ;;
  15413. esac
  15414. fi
  15415. "\${dir}/$binFile" "\$@"
  15416. PROXY;
  15417. return $proxyCode;
  15418. }
  15419. }
  15420. <?php
  15421. namespace Composer\Installer;
  15422. use Composer\Package\PackageInterface;
  15423. interface BinaryPresenceInterface
  15424. {
  15425. public function ensureBinariesPresence(PackageInterface $package);
  15426. }
  15427. <?php
  15428. namespace Composer\Installer;
  15429. use Composer\IO\IOInterface;
  15430. use Composer\Package\PackageInterface;
  15431. use Composer\Package\AliasPackage;
  15432. use Composer\Repository\RepositoryInterface;
  15433. use Composer\Repository\InstalledRepositoryInterface;
  15434. use Composer\DependencyResolver\Operation\OperationInterface;
  15435. use Composer\DependencyResolver\Operation\InstallOperation;
  15436. use Composer\DependencyResolver\Operation\UpdateOperation;
  15437. use Composer\DependencyResolver\Operation\UninstallOperation;
  15438. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  15439. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  15440. use Composer\Util\StreamContextFactory;
  15441. class InstallationManager
  15442. {
  15443. private $installers = array();
  15444. private $cache = array();
  15445. private $notifiablePackages = array();
  15446. public function reset()
  15447. {
  15448. $this->notifiablePackages = array();
  15449. }
  15450. public function addInstaller(InstallerInterface $installer)
  15451. {
  15452. array_unshift($this->installers, $installer);
  15453. $this->cache = array();
  15454. }
  15455. public function removeInstaller(InstallerInterface $installer)
  15456. {
  15457. if (false !== ($key = array_search($installer, $this->installers, true))) {
  15458. array_splice($this->installers, $key, 1);
  15459. $this->cache = array();
  15460. }
  15461. }
  15462. public function disablePlugins()
  15463. {
  15464. foreach ($this->installers as $i => $installer) {
  15465. if (!$installer instanceof PluginInstaller) {
  15466. continue;
  15467. }
  15468. unset($this->installers[$i]);
  15469. }
  15470. }
  15471. public function getInstaller($type)
  15472. {
  15473. $type = strtolower($type);
  15474. if (isset($this->cache[$type])) {
  15475. return $this->cache[$type];
  15476. }
  15477. foreach ($this->installers as $installer) {
  15478. if ($installer->supports($type)) {
  15479. return $this->cache[$type] = $installer;
  15480. }
  15481. }
  15482. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  15483. }
  15484. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15485. {
  15486. if ($package instanceof AliasPackage) {
  15487. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  15488. }
  15489. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  15490. }
  15491. public function ensureBinariesPresence(PackageInterface $package)
  15492. {
  15493. try {
  15494. $installer = $this->getInstaller($package->getType());
  15495. } catch (\InvalidArgumentException $e) {
  15496. return;
  15497. }
  15498. if ($installer instanceof BinaryPresenceInterface) {
  15499. $installer->ensureBinariesPresence($package);
  15500. }
  15501. }
  15502. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  15503. {
  15504. $method = $operation->getJobType();
  15505. $this->$method($repo, $operation);
  15506. }
  15507. public function install(RepositoryInterface $repo, InstallOperation $operation)
  15508. {
  15509. $package = $operation->getPackage();
  15510. $installer = $this->getInstaller($package->getType());
  15511. $installer->install($repo, $package);
  15512. $this->markForNotification($package);
  15513. }
  15514. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  15515. {
  15516. $initial = $operation->getInitialPackage();
  15517. $target = $operation->getTargetPackage();
  15518. $initialType = $initial->getType();
  15519. $targetType = $target->getType();
  15520. if ($initialType === $targetType) {
  15521. $installer = $this->getInstaller($initialType);
  15522. $installer->update($repo, $initial, $target);
  15523. $this->markForNotification($target);
  15524. } else {
  15525. $this->getInstaller($initialType)->uninstall($repo, $initial);
  15526. $this->getInstaller($targetType)->install($repo, $target);
  15527. }
  15528. }
  15529. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  15530. {
  15531. $package = $operation->getPackage();
  15532. $installer = $this->getInstaller($package->getType());
  15533. $installer->uninstall($repo, $package);
  15534. }
  15535. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  15536. {
  15537. $package = $operation->getPackage();
  15538. if (!$repo->hasPackage($package)) {
  15539. $repo->addPackage(clone $package);
  15540. }
  15541. }
  15542. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  15543. {
  15544. $package = $operation->getPackage();
  15545. $repo->removePackage($package);
  15546. }
  15547. public function getInstallPath(PackageInterface $package)
  15548. {
  15549. $installer = $this->getInstaller($package->getType());
  15550. return $installer->getInstallPath($package);
  15551. }
  15552. public function notifyInstalls(IOInterface $io)
  15553. {
  15554. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  15555. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  15556. if ($io->hasAuthentication($repositoryName)) {
  15557. $auth = $io->getAuthentication($repositoryName);
  15558. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  15559. $authHeader = 'Authorization: Basic '.$authStr;
  15560. }
  15561. if (strpos($repoUrl, '%package%')) {
  15562. foreach ($packages as $package) {
  15563. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  15564. $params = array(
  15565. 'version' => $package->getPrettyVersion(),
  15566. 'version_normalized' => $package->getVersion(),
  15567. );
  15568. $opts = array('http' =>
  15569. array(
  15570. 'method' => 'POST',
  15571. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  15572. 'content' => http_build_query($params, '', '&'),
  15573. 'timeout' => 3,
  15574. ),
  15575. );
  15576. if (isset($authHeader)) {
  15577. $opts['http']['header'][] = $authHeader;
  15578. }
  15579. $context = StreamContextFactory::getContext($url, $opts);
  15580. @file_get_contents($url, false, $context);
  15581. }
  15582. continue;
  15583. }
  15584. $postData = array('downloads' => array());
  15585. foreach ($packages as $package) {
  15586. $postData['downloads'][] = array(
  15587. 'name' => $package->getPrettyName(),
  15588. 'version' => $package->getVersion(),
  15589. );
  15590. }
  15591. $opts = array('http' =>
  15592. array(
  15593. 'method' => 'POST',
  15594. 'header' => array('Content-Type: application/json'),
  15595. 'content' => json_encode($postData),
  15596. 'timeout' => 6,
  15597. ),
  15598. );
  15599. if (isset($authHeader)) {
  15600. $opts['http']['header'][] = $authHeader;
  15601. }
  15602. $context = StreamContextFactory::getContext($repoUrl, $opts);
  15603. @file_get_contents($repoUrl, false, $context);
  15604. }
  15605. $this->reset();
  15606. }
  15607. private function markForNotification(PackageInterface $package)
  15608. {
  15609. if ($package->getNotificationUrl()) {
  15610. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  15611. }
  15612. }
  15613. }
  15614. <?php
  15615. namespace Composer\Installer;
  15616. use Composer\Composer;
  15617. use Composer\DependencyResolver\PolicyInterface;
  15618. use Composer\DependencyResolver\Operation\OperationInterface;
  15619. use Composer\DependencyResolver\Pool;
  15620. use Composer\DependencyResolver\Request;
  15621. use Composer\EventDispatcher\Event;
  15622. use Composer\IO\IOInterface;
  15623. use Composer\Repository\CompositeRepository;
  15624. class InstallerEvent extends Event
  15625. {
  15626. private $composer;
  15627. private $io;
  15628. private $devMode;
  15629. private $policy;
  15630. private $pool;
  15631. private $installedRepo;
  15632. private $request;
  15633. private $operations;
  15634. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  15635. {
  15636. parent::__construct($eventName);
  15637. $this->composer = $composer;
  15638. $this->io = $io;
  15639. $this->devMode = $devMode;
  15640. $this->policy = $policy;
  15641. $this->pool = $pool;
  15642. $this->installedRepo = $installedRepo;
  15643. $this->request = $request;
  15644. $this->operations = $operations;
  15645. }
  15646. public function getComposer()
  15647. {
  15648. return $this->composer;
  15649. }
  15650. public function getIO()
  15651. {
  15652. return $this->io;
  15653. }
  15654. public function isDevMode()
  15655. {
  15656. return $this->devMode;
  15657. }
  15658. public function getPolicy()
  15659. {
  15660. return $this->policy;
  15661. }
  15662. public function getPool()
  15663. {
  15664. return $this->pool;
  15665. }
  15666. public function getInstalledRepo()
  15667. {
  15668. return $this->installedRepo;
  15669. }
  15670. public function getRequest()
  15671. {
  15672. return $this->request;
  15673. }
  15674. public function getOperations()
  15675. {
  15676. return $this->operations;
  15677. }
  15678. }
  15679. <?php
  15680. namespace Composer\Installer;
  15681. class InstallerEvents
  15682. {
  15683. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  15684. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  15685. }
  15686. <?php
  15687. namespace Composer\Installer;
  15688. use Composer\Package\PackageInterface;
  15689. use Composer\Repository\InstalledRepositoryInterface;
  15690. use InvalidArgumentException;
  15691. interface InstallerInterface
  15692. {
  15693. public function supports($packageType);
  15694. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  15695. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  15696. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  15697. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  15698. public function getInstallPath(PackageInterface $package);
  15699. }
  15700. <?php
  15701. namespace Composer\Installer;
  15702. use Composer\Composer;
  15703. use Composer\IO\IOInterface;
  15704. use Composer\Repository\InstalledRepositoryInterface;
  15705. use Composer\Package\PackageInterface;
  15706. use Composer\Util\Filesystem;
  15707. use Composer\Util\Silencer;
  15708. use Composer\Util\Platform;
  15709. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15710. {
  15711. protected $composer;
  15712. protected $vendorDir;
  15713. protected $binDir;
  15714. protected $downloadManager;
  15715. protected $io;
  15716. protected $type;
  15717. protected $filesystem;
  15718. protected $binCompat;
  15719. protected $binaryInstaller;
  15720. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15721. {
  15722. $this->composer = $composer;
  15723. $this->downloadManager = $composer->getDownloadManager();
  15724. $this->io = $io;
  15725. $this->type = $type;
  15726. $this->filesystem = $filesystem ?: new Filesystem();
  15727. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15728. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15729. }
  15730. public function supports($packageType)
  15731. {
  15732. return $packageType === $this->type || null === $this->type;
  15733. }
  15734. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15735. {
  15736. if (!$repo->hasPackage($package)) {
  15737. return false;
  15738. }
  15739. $installPath = $this->getInstallPath($package);
  15740. if (is_readable($installPath)) {
  15741. return true;
  15742. }
  15743. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15744. }
  15745. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15746. {
  15747. $this->initializeVendorDir();
  15748. $downloadPath = $this->getInstallPath($package);
  15749. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15750. $this->binaryInstaller->removeBinaries($package);
  15751. }
  15752. $this->installCode($package);
  15753. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15754. if (!$repo->hasPackage($package)) {
  15755. $repo->addPackage(clone $package);
  15756. }
  15757. }
  15758. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15759. {
  15760. if (!$repo->hasPackage($initial)) {
  15761. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15762. }
  15763. $this->initializeVendorDir();
  15764. $this->binaryInstaller->removeBinaries($initial);
  15765. $this->updateCode($initial, $target);
  15766. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15767. $repo->removePackage($initial);
  15768. if (!$repo->hasPackage($target)) {
  15769. $repo->addPackage(clone $target);
  15770. }
  15771. }
  15772. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15773. {
  15774. if (!$repo->hasPackage($package)) {
  15775. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15776. }
  15777. $this->removeCode($package);
  15778. $this->binaryInstaller->removeBinaries($package);
  15779. $repo->removePackage($package);
  15780. $downloadPath = $this->getPackageBasePath($package);
  15781. if (strpos($package->getName(), '/')) {
  15782. $packageVendorDir = dirname($downloadPath);
  15783. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15784. Silencer::call('rmdir', $packageVendorDir);
  15785. }
  15786. }
  15787. }
  15788. public function getInstallPath(PackageInterface $package)
  15789. {
  15790. $this->initializeVendorDir();
  15791. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15792. $targetDir = $package->getTargetDir();
  15793. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15794. }
  15795. public function ensureBinariesPresence(PackageInterface $package)
  15796. {
  15797. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15798. }
  15799. protected function getPackageBasePath(PackageInterface $package)
  15800. {
  15801. $installPath = $this->getInstallPath($package);
  15802. $targetDir = $package->getTargetDir();
  15803. if ($targetDir) {
  15804. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15805. }
  15806. return $installPath;
  15807. }
  15808. protected function installCode(PackageInterface $package)
  15809. {
  15810. $downloadPath = $this->getInstallPath($package);
  15811. $this->downloadManager->download($package, $downloadPath);
  15812. }
  15813. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15814. {
  15815. $initialDownloadPath = $this->getInstallPath($initial);
  15816. $targetDownloadPath = $this->getInstallPath($target);
  15817. if ($targetDownloadPath !== $initialDownloadPath) {
  15818. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15819. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15820. ) {
  15821. $this->removeCode($initial);
  15822. $this->installCode($target);
  15823. return;
  15824. }
  15825. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15826. }
  15827. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15828. }
  15829. protected function removeCode(PackageInterface $package)
  15830. {
  15831. $downloadPath = $this->getPackageBasePath($package);
  15832. $this->downloadManager->remove($package, $downloadPath);
  15833. }
  15834. protected function initializeVendorDir()
  15835. {
  15836. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15837. $this->vendorDir = realpath($this->vendorDir);
  15838. }
  15839. }
  15840. <?php
  15841. namespace Composer\Installer;
  15842. use Composer\Repository\InstalledRepositoryInterface;
  15843. use Composer\Package\PackageInterface;
  15844. use Composer\Package\Version\VersionParser;
  15845. use Composer\IO\IOInterface;
  15846. class MetapackageInstaller implements InstallerInterface
  15847. {
  15848. private $io;
  15849. public function __construct(IOInterface $io)
  15850. {
  15851. $this->io = $io;
  15852. }
  15853. public function supports($packageType)
  15854. {
  15855. return $packageType === 'metapackage';
  15856. }
  15857. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15858. {
  15859. return $repo->hasPackage($package);
  15860. }
  15861. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15862. {
  15863. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15864. $repo->addPackage(clone $package);
  15865. }
  15866. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15867. {
  15868. if (!$repo->hasPackage($initial)) {
  15869. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15870. }
  15871. $name = $target->getName();
  15872. $from = $initial->getFullPrettyVersion();
  15873. $to = $target->getFullPrettyVersion();
  15874. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15875. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15876. $repo->removePackage($initial);
  15877. $repo->addPackage(clone $target);
  15878. }
  15879. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15880. {
  15881. if (!$repo->hasPackage($package)) {
  15882. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15883. }
  15884. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15885. $repo->removePackage($package);
  15886. }
  15887. public function getInstallPath(PackageInterface $package)
  15888. {
  15889. return '';
  15890. }
  15891. }
  15892. <?php
  15893. namespace Composer\Installer;
  15894. use Composer\Repository\InstalledRepositoryInterface;
  15895. use Composer\Package\PackageInterface;
  15896. class NoopInstaller implements InstallerInterface
  15897. {
  15898. public function supports($packageType)
  15899. {
  15900. return true;
  15901. }
  15902. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15903. {
  15904. return $repo->hasPackage($package);
  15905. }
  15906. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15907. {
  15908. if (!$repo->hasPackage($package)) {
  15909. $repo->addPackage(clone $package);
  15910. }
  15911. }
  15912. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15913. {
  15914. if (!$repo->hasPackage($initial)) {
  15915. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15916. }
  15917. $repo->removePackage($initial);
  15918. if (!$repo->hasPackage($target)) {
  15919. $repo->addPackage(clone $target);
  15920. }
  15921. }
  15922. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15923. {
  15924. if (!$repo->hasPackage($package)) {
  15925. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15926. }
  15927. $repo->removePackage($package);
  15928. }
  15929. public function getInstallPath(PackageInterface $package)
  15930. {
  15931. $targetDir = $package->getTargetDir();
  15932. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15933. }
  15934. }
  15935. <?php
  15936. namespace Composer\Installer;
  15937. use Composer\Composer;
  15938. use Composer\IO\IOInterface;
  15939. use Composer\DependencyResolver\Operation\OperationInterface;
  15940. use Composer\DependencyResolver\PolicyInterface;
  15941. use Composer\DependencyResolver\Pool;
  15942. use Composer\DependencyResolver\Request;
  15943. use Composer\Repository\CompositeRepository;
  15944. class PackageEvent extends InstallerEvent
  15945. {
  15946. private $operation;
  15947. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15948. {
  15949. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15950. $this->operation = $operation;
  15951. }
  15952. public function getOperation()
  15953. {
  15954. return $this->operation;
  15955. }
  15956. }
  15957. <?php
  15958. namespace Composer\Installer;
  15959. class PackageEvents
  15960. {
  15961. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15962. const POST_PACKAGE_INSTALL = 'post-package-install';
  15963. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15964. const POST_PACKAGE_UPDATE = 'post-package-update';
  15965. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15966. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15967. }
  15968. <?php
  15969. namespace Composer\Installer;
  15970. use Composer\IO\IOInterface;
  15971. use Composer\Package\PackageInterface;
  15972. use Composer\Util\Filesystem;
  15973. use Composer\Util\ProcessExecutor;
  15974. class PearBinaryInstaller extends BinaryInstaller
  15975. {
  15976. private $installer;
  15977. private $vendorDir;
  15978. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15979. {
  15980. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15981. $this->installer = $installer;
  15982. $this->vendorDir = $vendorDir;
  15983. }
  15984. protected function getBinaries(PackageInterface $package)
  15985. {
  15986. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15987. $binaries = array();
  15988. if (file_exists($binariesPath)) {
  15989. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15990. if (!$value->isDir()) {
  15991. $binaries[] = 'bin/'.$fileName;
  15992. }
  15993. }
  15994. }
  15995. return $binaries;
  15996. }
  15997. protected function initializeBinDir()
  15998. {
  15999. parent::initializeBinDir();
  16000. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  16001. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  16002. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  16003. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  16004. }
  16005. protected function generateWindowsProxyCode($bin, $link)
  16006. {
  16007. $binPath = $this->filesystem->findShortestPath($link, $bin);
  16008. if ('.bat' === substr($bin, -4)) {
  16009. $caller = 'call';
  16010. } else {
  16011. $handle = fopen($bin, 'r');
  16012. $line = fgets($handle);
  16013. fclose($handle);
  16014. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  16015. $caller = trim($match[1]);
  16016. } else {
  16017. $caller = 'php';
  16018. }
  16019. if ($caller === 'php') {
  16020. return "@echo off\r\n".
  16021. "pushd .\r\n".
  16022. "cd %~dp0\r\n".
  16023. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  16024. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16025. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16026. "popd\r\n".
  16027. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  16028. }
  16029. }
  16030. return "@echo off\r\n".
  16031. "pushd .\r\n".
  16032. "cd %~dp0\r\n".
  16033. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16034. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16035. "popd\r\n".
  16036. $caller." \"%BIN_TARGET%\" %*\r\n";
  16037. }
  16038. private function generateWindowsPhpProxyCode()
  16039. {
  16040. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16041. return
  16042. "@echo off\r\n" .
  16043. "setlocal enabledelayedexpansion\r\n" .
  16044. "set BIN_DIR=%~dp0\r\n" .
  16045. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  16046. "set DIRS=.\r\n" .
  16047. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  16048. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  16049. " set DIRS=!DIRS!;%%~fP\r\n" .
  16050. " )\r\n" .
  16051. ")\r\n" .
  16052. "php.exe -d include_path=!DIRS! %*\r\n";
  16053. }
  16054. private function generateUnixyPhpProxyCode()
  16055. {
  16056. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16057. return
  16058. "#!/usr/bin/env sh\n".
  16059. "SRC_DIR=`pwd`\n".
  16060. "BIN_DIR=`dirname $0`\n".
  16061. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  16062. "DIRS=\"\"\n".
  16063. "for vendor in \$VENDOR_DIR/*; do\n".
  16064. " if [ -d \"\$vendor\" ]; then\n".
  16065. " for package in \$vendor/*; do\n".
  16066. " if [ -d \"\$package\" ]; then\n".
  16067. " DIRS=\"\${DIRS}:\${package}\"\n".
  16068. " fi\n".
  16069. " done\n".
  16070. " fi\n".
  16071. "done\n".
  16072. "php -d include_path=\".\$DIRS\" $@\n";
  16073. }
  16074. }
  16075. <?php
  16076. namespace Composer\Installer;
  16077. use Composer\IO\IOInterface;
  16078. use Composer\Composer;
  16079. use Composer\Downloader\PearPackageExtractor;
  16080. use Composer\Repository\InstalledRepositoryInterface;
  16081. use Composer\Package\PackageInterface;
  16082. use Composer\Util\Platform;
  16083. use Composer\Util\Filesystem;
  16084. class PearInstaller extends LibraryInstaller
  16085. {
  16086. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  16087. {
  16088. $filesystem = new Filesystem();
  16089. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  16090. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  16091. }
  16092. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16093. {
  16094. $this->uninstall($repo, $initial);
  16095. $this->install($repo, $target);
  16096. }
  16097. protected function installCode(PackageInterface $package)
  16098. {
  16099. parent::installCode($package);
  16100. $isWindows = Platform::isWindows();
  16101. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  16102. if (!$isWindows) {
  16103. $php_bin = '/usr/bin/env ' . $php_bin;
  16104. }
  16105. $installPath = $this->getInstallPath($package);
  16106. $vars = array(
  16107. 'os' => $isWindows ? 'windows' : 'linux',
  16108. 'php_bin' => $php_bin,
  16109. 'pear_php' => $installPath,
  16110. 'php_dir' => $installPath,
  16111. 'bin_dir' => $installPath . '/bin',
  16112. 'data_dir' => $installPath . '/data',
  16113. 'version' => $package->getPrettyVersion(),
  16114. );
  16115. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  16116. $pearExtractor = new PearPackageExtractor($packageArchive);
  16117. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  16118. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  16119. $this->filesystem->unlink($packageArchive);
  16120. }
  16121. }
  16122. <?php
  16123. namespace Composer\Installer;
  16124. use Composer\Composer;
  16125. use Composer\IO\IOInterface;
  16126. use Composer\Repository\InstalledRepositoryInterface;
  16127. use Composer\Package\PackageInterface;
  16128. class PluginInstaller extends LibraryInstaller
  16129. {
  16130. private $installationManager;
  16131. public function __construct(IOInterface $io, Composer $composer)
  16132. {
  16133. parent::__construct($io, $composer, 'composer-plugin');
  16134. $this->installationManager = $composer->getInstallationManager();
  16135. }
  16136. public function supports($packageType)
  16137. {
  16138. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  16139. }
  16140. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16141. {
  16142. $extra = $package->getExtra();
  16143. if (empty($extra['class'])) {
  16144. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16145. }
  16146. parent::install($repo, $package);
  16147. try {
  16148. $this->composer->getPluginManager()->registerPackage($package, true);
  16149. } catch (\Exception $e) {
  16150. $this->io->writeError('Plugin installation failed ('.$e->getMessage().'), rolling back');
  16151. parent::uninstall($repo, $package);
  16152. throw $e;
  16153. }
  16154. }
  16155. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16156. {
  16157. $extra = $target->getExtra();
  16158. if (empty($extra['class'])) {
  16159. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16160. }
  16161. parent::update($repo, $initial, $target);
  16162. $this->composer->getPluginManager()->registerPackage($target, true);
  16163. }
  16164. }
  16165. <?php
  16166. namespace Composer\Installer;
  16167. use Composer\Package\PackageInterface;
  16168. use Composer\Downloader\DownloadManager;
  16169. use Composer\Repository\InstalledRepositoryInterface;
  16170. use Composer\Util\Filesystem;
  16171. class ProjectInstaller implements InstallerInterface
  16172. {
  16173. private $installPath;
  16174. private $downloadManager;
  16175. private $filesystem;
  16176. public function __construct($installPath, DownloadManager $dm)
  16177. {
  16178. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  16179. $this->downloadManager = $dm;
  16180. $this->filesystem = new Filesystem;
  16181. }
  16182. public function supports($packageType)
  16183. {
  16184. return true;
  16185. }
  16186. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  16187. {
  16188. return false;
  16189. }
  16190. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16191. {
  16192. $installPath = $this->installPath;
  16193. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  16194. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  16195. }
  16196. if (!is_dir($installPath)) {
  16197. mkdir($installPath, 0777, true);
  16198. }
  16199. $this->downloadManager->download($package, $installPath);
  16200. }
  16201. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16202. {
  16203. throw new \InvalidArgumentException("not supported");
  16204. }
  16205. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  16206. {
  16207. throw new \InvalidArgumentException("not supported");
  16208. }
  16209. public function getInstallPath(PackageInterface $package)
  16210. {
  16211. return $this->installPath;
  16212. }
  16213. }
  16214. <?php
  16215. namespace Composer\Installer;
  16216. use Composer\IO\IOInterface;
  16217. use Composer\Package\PackageInterface;
  16218. use Composer\Repository\RepositoryInterface;
  16219. use Symfony\Component\Console\Formatter\OutputFormatter;
  16220. class SuggestedPackagesReporter
  16221. {
  16222. protected $suggestedPackages = array();
  16223. private $io;
  16224. public function __construct(IOInterface $io)
  16225. {
  16226. $this->io = $io;
  16227. }
  16228. public function getPackages()
  16229. {
  16230. return $this->suggestedPackages;
  16231. }
  16232. public function addPackage($source, $target, $reason)
  16233. {
  16234. $this->suggestedPackages[] = array(
  16235. 'source' => $source,
  16236. 'target' => $target,
  16237. 'reason' => $reason,
  16238. );
  16239. return $this;
  16240. }
  16241. public function addSuggestionsFromPackage(PackageInterface $package)
  16242. {
  16243. $source = $package->getPrettyName();
  16244. foreach ($package->getSuggests() as $target => $reason) {
  16245. $this->addPackage(
  16246. $source,
  16247. $target,
  16248. $reason
  16249. );
  16250. }
  16251. return $this;
  16252. }
  16253. public function output(RepositoryInterface $installedRepo = null)
  16254. {
  16255. $suggestedPackages = $this->getPackages();
  16256. $installedPackages = array();
  16257. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  16258. foreach ($installedRepo->getPackages() as $package) {
  16259. $installedPackages = array_merge(
  16260. $installedPackages,
  16261. $package->getNames()
  16262. );
  16263. }
  16264. }
  16265. foreach ($suggestedPackages as $suggestion) {
  16266. if (in_array($suggestion['target'], $installedPackages)) {
  16267. continue;
  16268. }
  16269. $this->io->writeError(sprintf(
  16270. '%s suggests installing %s%s',
  16271. $suggestion['source'],
  16272. $this->escapeOutput($suggestion['target']),
  16273. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  16274. ));
  16275. }
  16276. return $this;
  16277. }
  16278. private function escapeOutput($string)
  16279. {
  16280. return OutputFormatter::escape(
  16281. $this->removeControlCharacters($string)
  16282. );
  16283. }
  16284. private function removeControlCharacters($string)
  16285. {
  16286. return preg_replace(
  16287. '/[[:cntrl:]]/',
  16288. '',
  16289. str_replace("\n", ' ', $string)
  16290. );
  16291. }
  16292. }
  16293. <?php
  16294. namespace Composer\Json;
  16295. use JsonSchema\Validator;
  16296. use Seld\JsonLint\JsonParser;
  16297. use Seld\JsonLint\ParsingException;
  16298. use Composer\Util\RemoteFilesystem;
  16299. use Composer\IO\IOInterface;
  16300. use Composer\Downloader\TransportException;
  16301. class JsonFile
  16302. {
  16303. const LAX_SCHEMA = 1;
  16304. const STRICT_SCHEMA = 2;
  16305. const JSON_UNESCAPED_SLASHES = 64;
  16306. const JSON_PRETTY_PRINT = 128;
  16307. const JSON_UNESCAPED_UNICODE = 256;
  16308. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  16309. private $path;
  16310. private $rfs;
  16311. private $io;
  16312. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  16313. {
  16314. $this->path = $path;
  16315. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  16316. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  16317. }
  16318. $this->rfs = $rfs;
  16319. $this->io = $io;
  16320. }
  16321. public function getPath()
  16322. {
  16323. return $this->path;
  16324. }
  16325. public function exists()
  16326. {
  16327. return is_file($this->path);
  16328. }
  16329. public function read()
  16330. {
  16331. try {
  16332. if ($this->rfs) {
  16333. $json = $this->rfs->getContents($this->path, $this->path, false);
  16334. } else {
  16335. if ($this->io && $this->io->isDebug()) {
  16336. $this->io->writeError('Reading ' . $this->path);
  16337. }
  16338. $json = file_get_contents($this->path);
  16339. }
  16340. } catch (TransportException $e) {
  16341. throw new \RuntimeException($e->getMessage(), 0, $e);
  16342. } catch (\Exception $e) {
  16343. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  16344. }
  16345. return static::parseJson($json, $this->path);
  16346. }
  16347. public function write(array $hash, $options = 448)
  16348. {
  16349. $dir = dirname($this->path);
  16350. if (!is_dir($dir)) {
  16351. if (file_exists($dir)) {
  16352. throw new \UnexpectedValueException(
  16353. $dir.' exists and is not a directory.'
  16354. );
  16355. }
  16356. if (!@mkdir($dir, 0777, true)) {
  16357. throw new \UnexpectedValueException(
  16358. $dir.' does not exist and could not be created.'
  16359. );
  16360. }
  16361. }
  16362. $retries = 3;
  16363. while ($retries--) {
  16364. try {
  16365. $this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  16366. break;
  16367. } catch (\Exception $e) {
  16368. if ($retries) {
  16369. usleep(500000);
  16370. continue;
  16371. }
  16372. throw $e;
  16373. }
  16374. }
  16375. }
  16376. private function filePutContentsIfModified($path, $content)
  16377. {
  16378. $currentContent = @file_get_contents($path);
  16379. if (!$currentContent || ($currentContent != $content)) {
  16380. return file_put_contents($path, $content);
  16381. }
  16382. return 0;
  16383. }
  16384. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  16385. {
  16386. $content = file_get_contents($this->path);
  16387. $data = json_decode($content);
  16388. if (null === $data && 'null' !== $content) {
  16389. self::validateSyntax($content, $this->path);
  16390. }
  16391. if (null === $schemaFile) {
  16392. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  16393. }
  16394. if (false === strpos($schemaFile, '://')) {
  16395. $schemaFile = 'file://' . $schemaFile;
  16396. }
  16397. $schemaData = (object) array('$ref' => $schemaFile);
  16398. if ($schema === self::LAX_SCHEMA) {
  16399. $schemaData->additionalProperties = true;
  16400. $schemaData->required = array();
  16401. }
  16402. $validator = new Validator();
  16403. $validator->check($data, $schemaData);
  16404. if (!$validator->isValid()) {
  16405. $errors = array();
  16406. foreach ((array) $validator->getErrors() as $error) {
  16407. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  16408. }
  16409. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  16410. }
  16411. return true;
  16412. }
  16413. public static function encode($data, $options = 448)
  16414. {
  16415. if (PHP_VERSION_ID >= 50400) {
  16416. $json = json_encode($data, $options);
  16417. if (false === $json) {
  16418. self::throwEncodeError(json_last_error());
  16419. }
  16420. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  16421. $json = preg_replace('/\[\s+\]/', '[]', $json);
  16422. $json = preg_replace('/\{\s+\}/', '{}', $json);
  16423. }
  16424. return $json;
  16425. }
  16426. $json = json_encode($data);
  16427. if (false === $json) {
  16428. self::throwEncodeError(json_last_error());
  16429. }
  16430. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  16431. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  16432. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  16433. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  16434. return $json;
  16435. }
  16436. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  16437. }
  16438. private static function throwEncodeError($code)
  16439. {
  16440. switch ($code) {
  16441. case JSON_ERROR_DEPTH:
  16442. $msg = 'Maximum stack depth exceeded';
  16443. break;
  16444. case JSON_ERROR_STATE_MISMATCH:
  16445. $msg = 'Underflow or the modes mismatch';
  16446. break;
  16447. case JSON_ERROR_CTRL_CHAR:
  16448. $msg = 'Unexpected control character found';
  16449. break;
  16450. case JSON_ERROR_UTF8:
  16451. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  16452. break;
  16453. default:
  16454. $msg = 'Unknown error';
  16455. }
  16456. throw new \RuntimeException('JSON encoding failed: '.$msg);
  16457. }
  16458. public static function parseJson($json, $file = null)
  16459. {
  16460. if (null === $json) {
  16461. return;
  16462. }
  16463. $data = json_decode($json, true);
  16464. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  16465. self::validateSyntax($json, $file);
  16466. }
  16467. return $data;
  16468. }
  16469. protected static function validateSyntax($json, $file = null)
  16470. {
  16471. $parser = new JsonParser();
  16472. $result = $parser->lint($json);
  16473. if (null === $result) {
  16474. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  16475. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  16476. }
  16477. return true;
  16478. }
  16479. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  16480. }
  16481. }
  16482. <?php
  16483. namespace Composer\Json;
  16484. class JsonFormatter
  16485. {
  16486. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  16487. {
  16488. $result = '';
  16489. $pos = 0;
  16490. $strLen = strlen($json);
  16491. $indentStr = ' ';
  16492. $newLine = "\n";
  16493. $outOfQuotes = true;
  16494. $buffer = '';
  16495. $noescape = true;
  16496. for ($i = 0; $i < $strLen; $i++) {
  16497. $char = substr($json, $i, 1);
  16498. if ('"' === $char && $noescape) {
  16499. $outOfQuotes = !$outOfQuotes;
  16500. }
  16501. if (!$outOfQuotes) {
  16502. $buffer .= $char;
  16503. $noescape = '\\' === $char ? !$noescape : true;
  16504. continue;
  16505. } elseif ('' !== $buffer) {
  16506. if ($unescapeSlashes) {
  16507. $buffer = str_replace('\\/', '/', $buffer);
  16508. }
  16509. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  16510. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  16511. $l = strlen($match[1]);
  16512. if ($l % 2) {
  16513. $code = hexdec($match[2]);
  16514. if (0xD800 <= $code && 0xDFFF >= $code) {
  16515. return $match[0];
  16516. }
  16517. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  16518. pack('H*', $match[2]),
  16519. 'UTF-8',
  16520. 'UCS-2BE'
  16521. );
  16522. }
  16523. return $match[0];
  16524. }, $buffer);
  16525. }
  16526. $result .= $buffer.$char;
  16527. $buffer = '';
  16528. continue;
  16529. }
  16530. if (':' === $char) {
  16531. $char .= ' ';
  16532. } elseif ('}' === $char || ']' === $char) {
  16533. $pos--;
  16534. $prevChar = substr($json, $i - 1, 1);
  16535. if ('{' !== $prevChar && '[' !== $prevChar) {
  16536. $result .= $newLine;
  16537. for ($j = 0; $j < $pos; $j++) {
  16538. $result .= $indentStr;
  16539. }
  16540. } else {
  16541. $result = rtrim($result);
  16542. }
  16543. }
  16544. $result .= $char;
  16545. if (',' === $char || '{' === $char || '[' === $char) {
  16546. $result .= $newLine;
  16547. if ('{' === $char || '[' === $char) {
  16548. $pos++;
  16549. }
  16550. for ($j = 0; $j < $pos; $j++) {
  16551. $result .= $indentStr;
  16552. }
  16553. }
  16554. }
  16555. return $result;
  16556. }
  16557. }
  16558. <?php
  16559. namespace Composer\Json;
  16560. use Composer\Repository\PlatformRepository;
  16561. class JsonManipulator
  16562. {
  16563. private static $DEFINES = '(?(DEFINE)
  16564. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  16565. (?<boolean> true | false | null )
  16566. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  16567. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  16568. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  16569. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  16570. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  16571. )';
  16572. private $contents;
  16573. private $newline;
  16574. private $indent;
  16575. public function __construct($contents)
  16576. {
  16577. $contents = trim($contents);
  16578. if ($contents === '') {
  16579. $contents = '{}';
  16580. }
  16581. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  16582. throw new \InvalidArgumentException('The json file must be an object ({})');
  16583. }
  16584. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  16585. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  16586. $this->detectIndenting();
  16587. }
  16588. public function getContents()
  16589. {
  16590. return $this->contents . $this->newline;
  16591. }
  16592. public function addLink($type, $package, $constraint, $sortPackages = false)
  16593. {
  16594. $decoded = JsonFile::parseJson($this->contents);
  16595. if (!isset($decoded[$type])) {
  16596. return $this->addMainKey($type, array($package => $constraint));
  16597. }
  16598. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16599. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  16600. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  16601. return false;
  16602. }
  16603. $links = $matches['value'];
  16604. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  16605. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  16606. if ($this->pregMatch($regex, $links, $packageMatches)) {
  16607. $existingPackage = $packageMatches['package'];
  16608. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  16609. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  16610. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  16611. }, $links);
  16612. } else {
  16613. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  16614. $links = preg_replace(
  16615. '{'.preg_quote($match[1]).'$}',
  16616. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  16617. $links
  16618. );
  16619. } else {
  16620. $links = '{' . $this->newline .
  16621. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  16622. $this->indent . '}';
  16623. }
  16624. }
  16625. if (true === $sortPackages) {
  16626. $requirements = json_decode($links, true);
  16627. $this->sortPackages($requirements);
  16628. $links = $this->format($requirements);
  16629. }
  16630. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  16631. return true;
  16632. }
  16633. private function sortPackages(array &$packages = array())
  16634. {
  16635. $prefix = function ($requirement) {
  16636. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  16637. return preg_replace(
  16638. array(
  16639. '/^php/',
  16640. '/^hhvm/',
  16641. '/^ext/',
  16642. '/^lib/',
  16643. '/^\D/',
  16644. ),
  16645. array(
  16646. '0-$0',
  16647. '1-$0',
  16648. '2-$0',
  16649. '3-$0',
  16650. '4-$0',
  16651. ),
  16652. $requirement
  16653. );
  16654. }
  16655. return '5-'.$requirement;
  16656. };
  16657. uksort($packages, function ($a, $b) use ($prefix) {
  16658. return strnatcmp($prefix($a), $prefix($b));
  16659. });
  16660. }
  16661. public function addRepository($name, $config)
  16662. {
  16663. return $this->addSubNode('repositories', $name, $config);
  16664. }
  16665. public function removeRepository($name)
  16666. {
  16667. return $this->removeSubNode('repositories', $name);
  16668. }
  16669. public function addConfigSetting($name, $value)
  16670. {
  16671. return $this->addSubNode('config', $name, $value);
  16672. }
  16673. public function removeConfigSetting($name)
  16674. {
  16675. return $this->removeSubNode('config', $name);
  16676. }
  16677. public function addProperty($name, $value)
  16678. {
  16679. if (substr($name, 0, 8) === 'suggest.') {
  16680. return $this->addSubNode('suggest', substr($name, 8), $value);
  16681. }
  16682. if (substr($name, 0, 6) === 'extra.') {
  16683. return $this->addSubNode('extra', substr($name, 6), $value);
  16684. }
  16685. if (substr($name, 0, 8) === 'scripts.') {
  16686. return $this->addSubNode('scripts', substr($name, 8), $value);
  16687. }
  16688. return $this->addMainKey($name, $value);
  16689. }
  16690. public function removeProperty($name)
  16691. {
  16692. if (substr($name, 0, 8) === 'suggest.') {
  16693. return $this->removeSubNode('suggest', substr($name, 8));
  16694. }
  16695. if (substr($name, 0, 6) === 'extra.') {
  16696. return $this->removeSubNode('extra', substr($name, 6));
  16697. }
  16698. if (substr($name, 0, 8) === 'scripts.') {
  16699. return $this->removeSubNode('scripts', substr($name, 8));
  16700. }
  16701. return $this->removeMainKey($name);
  16702. }
  16703. public function addSubNode($mainNode, $name, $value)
  16704. {
  16705. $decoded = JsonFile::parseJson($this->contents);
  16706. $subName = null;
  16707. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16708. list($name, $subName) = explode('.', $name, 2);
  16709. }
  16710. if (!isset($decoded[$mainNode])) {
  16711. if ($subName !== null) {
  16712. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  16713. } else {
  16714. $this->addMainKey($mainNode, array($name => $value));
  16715. }
  16716. return true;
  16717. }
  16718. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16719. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16720. try {
  16721. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16722. return false;
  16723. }
  16724. } catch (\RuntimeException $e) {
  16725. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16726. return false;
  16727. }
  16728. throw $e;
  16729. }
  16730. $children = $match['content'];
  16731. if (!@json_decode($children)) {
  16732. return false;
  16733. }
  16734. $that = $this;
  16735. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16736. if ($this->pregMatch($childRegex, $children, $matches)) {
  16737. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16738. if ($subName !== null) {
  16739. $curVal = json_decode($matches['content'], true);
  16740. if (!is_array($curVal)) {
  16741. $curVal = array();
  16742. }
  16743. $curVal[$subName] = $value;
  16744. $value = $curVal;
  16745. }
  16746. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16747. }, $children);
  16748. } else {
  16749. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16750. $whitespace = '';
  16751. if (!empty($match['trailingspace'])) {
  16752. $whitespace = $match['trailingspace'];
  16753. }
  16754. if (!empty($match['content'])) {
  16755. if ($subName !== null) {
  16756. $value = array($subName => $value);
  16757. }
  16758. $children = preg_replace(
  16759. '#'.$whitespace.'}$#',
  16760. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16761. $children
  16762. );
  16763. } else {
  16764. if ($subName !== null) {
  16765. $value = array($subName => $value);
  16766. }
  16767. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16768. }
  16769. }
  16770. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16771. return $m['start'] . $children . $m['end'];
  16772. }, $this->contents);
  16773. return true;
  16774. }
  16775. public function removeSubNode($mainNode, $name)
  16776. {
  16777. $decoded = JsonFile::parseJson($this->contents);
  16778. if (empty($decoded[$mainNode])) {
  16779. return true;
  16780. }
  16781. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16782. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16783. try {
  16784. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16785. return false;
  16786. }
  16787. } catch (\RuntimeException $e) {
  16788. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16789. return false;
  16790. }
  16791. throw $e;
  16792. }
  16793. $children = $match['content'];
  16794. if (!@json_decode($children, true)) {
  16795. return false;
  16796. }
  16797. $subName = null;
  16798. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16799. list($name, $subName) = explode('.', $name, 2);
  16800. }
  16801. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16802. return true;
  16803. }
  16804. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16805. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16806. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16807. $bestMatch = '';
  16808. foreach ($matches[0] as $match) {
  16809. if (strlen($bestMatch) < strlen($match)) {
  16810. $bestMatch = $match;
  16811. }
  16812. }
  16813. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16814. if (1 !== $count) {
  16815. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16816. if (1 !== $count) {
  16817. return false;
  16818. }
  16819. }
  16820. }
  16821. } else {
  16822. $childrenClean = $children;
  16823. }
  16824. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16825. if (empty($match['content'])) {
  16826. $newline = $this->newline;
  16827. $indent = $this->indent;
  16828. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16829. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16830. }, $this->contents);
  16831. if ($subName !== null) {
  16832. $curVal = json_decode($children, true);
  16833. unset($curVal[$name][$subName]);
  16834. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16835. }
  16836. return true;
  16837. }
  16838. $that = $this;
  16839. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16840. if ($subName !== null) {
  16841. $curVal = json_decode($matches['content'], true);
  16842. unset($curVal[$name][$subName]);
  16843. $childrenClean = $that->format($curVal, 0);
  16844. }
  16845. return $matches['start'] . $childrenClean . $matches['end'];
  16846. }, $this->contents);
  16847. return true;
  16848. }
  16849. public function addMainKey($key, $content)
  16850. {
  16851. $decoded = JsonFile::parseJson($this->contents);
  16852. $content = $this->format($content);
  16853. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16854. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16855. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16856. if (!@json_decode('{'.$matches['key'].'}')) {
  16857. return false;
  16858. }
  16859. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16860. return true;
  16861. }
  16862. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16863. $this->contents = preg_replace(
  16864. '#'.$match[1].'\}$#',
  16865. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16866. $this->contents
  16867. );
  16868. return true;
  16869. }
  16870. $this->contents = preg_replace(
  16871. '#\}$#',
  16872. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16873. $this->contents
  16874. );
  16875. return true;
  16876. }
  16877. public function removeMainKey($key)
  16878. {
  16879. $decoded = JsonFile::parseJson($this->contents);
  16880. if (!array_key_exists($key, $decoded)) {
  16881. return true;
  16882. }
  16883. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16884. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16885. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16886. if (!@json_decode('{'.$matches['removal'].'}')) {
  16887. return false;
  16888. }
  16889. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16890. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16891. }
  16892. $this->contents = $matches['start'] . $matches['end'];
  16893. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16894. $this->contents = "{\n}";
  16895. }
  16896. return true;
  16897. }
  16898. return false;
  16899. }
  16900. public function format($data, $depth = 0)
  16901. {
  16902. if (is_array($data)) {
  16903. reset($data);
  16904. if (is_numeric(key($data))) {
  16905. foreach ($data as $key => $val) {
  16906. $data[$key] = $this->format($val, $depth + 1);
  16907. }
  16908. return '['.implode(', ', $data).']';
  16909. }
  16910. $out = '{' . $this->newline;
  16911. $elems = array();
  16912. foreach ($data as $key => $val) {
  16913. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16914. }
  16915. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16916. }
  16917. return JsonFile::encode($data);
  16918. }
  16919. protected function detectIndenting()
  16920. {
  16921. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16922. $this->indent = $match[1];
  16923. } else {
  16924. $this->indent = ' ';
  16925. }
  16926. }
  16927. protected function pregMatch($re, $str, &$matches = array())
  16928. {
  16929. $count = preg_match($re, $str, $matches);
  16930. if ($count === false) {
  16931. switch (preg_last_error()) {
  16932. case PREG_NO_ERROR:
  16933. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16934. case PREG_INTERNAL_ERROR:
  16935. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16936. case PREG_BACKTRACK_LIMIT_ERROR:
  16937. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16938. case PREG_RECURSION_LIMIT_ERROR:
  16939. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16940. case PREG_BAD_UTF8_ERROR:
  16941. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16942. case PREG_BAD_UTF8_OFFSET_ERROR:
  16943. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16944. case 6:
  16945. if (PHP_VERSION_ID > 70000) {
  16946. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16947. }
  16948. default:
  16949. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16950. }
  16951. }
  16952. return $count;
  16953. }
  16954. }
  16955. <?php
  16956. namespace Composer\Json;
  16957. use Exception;
  16958. class JsonValidationException extends Exception
  16959. {
  16960. protected $errors;
  16961. public function __construct($message, $errors = array(), Exception $previous = null)
  16962. {
  16963. $this->errors = $errors;
  16964. parent::__construct($message, 0, $previous);
  16965. }
  16966. public function getErrors()
  16967. {
  16968. return $this->errors;
  16969. }
  16970. }
  16971. <?php
  16972. namespace Composer\Package;
  16973. use Composer\Semver\Constraint\Constraint;
  16974. use Composer\Package\Version\VersionParser;
  16975. class AliasPackage extends BasePackage implements CompletePackageInterface
  16976. {
  16977. protected $version;
  16978. protected $prettyVersion;
  16979. protected $dev;
  16980. protected $rootPackageAlias = false;
  16981. protected $stability;
  16982. protected $aliasOf;
  16983. protected $requires;
  16984. protected $devRequires;
  16985. protected $conflicts;
  16986. protected $provides;
  16987. protected $replaces;
  16988. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16989. {
  16990. parent::__construct($aliasOf->getName());
  16991. $this->version = $version;
  16992. $this->prettyVersion = $prettyVersion;
  16993. $this->aliasOf = $aliasOf;
  16994. $this->stability = VersionParser::parseStability($version);
  16995. $this->dev = $this->stability === 'dev';
  16996. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16997. $links = $aliasOf->{'get' . ucfirst($type)}();
  16998. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16999. }
  17000. }
  17001. public function getAliasOf()
  17002. {
  17003. return $this->aliasOf;
  17004. }
  17005. public function getVersion()
  17006. {
  17007. return $this->version;
  17008. }
  17009. public function getStability()
  17010. {
  17011. return $this->stability;
  17012. }
  17013. public function getPrettyVersion()
  17014. {
  17015. return $this->prettyVersion;
  17016. }
  17017. public function isDev()
  17018. {
  17019. return $this->dev;
  17020. }
  17021. public function getRequires()
  17022. {
  17023. return $this->requires;
  17024. }
  17025. public function getConflicts()
  17026. {
  17027. return $this->conflicts;
  17028. }
  17029. public function getProvides()
  17030. {
  17031. return $this->provides;
  17032. }
  17033. public function getReplaces()
  17034. {
  17035. return $this->replaces;
  17036. }
  17037. public function getDevRequires()
  17038. {
  17039. return $this->devRequires;
  17040. }
  17041. public function setRootPackageAlias($value)
  17042. {
  17043. return $this->rootPackageAlias = $value;
  17044. }
  17045. public function isRootPackageAlias()
  17046. {
  17047. return $this->rootPackageAlias;
  17048. }
  17049. protected function replaceSelfVersionDependencies(array $links, $linkType)
  17050. {
  17051. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  17052. $newLinks = array();
  17053. foreach ($links as $link) {
  17054. if ('self.version' === $link->getPrettyConstraint()) {
  17055. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17056. }
  17057. }
  17058. $links = array_merge($links, $newLinks);
  17059. } else {
  17060. foreach ($links as $index => $link) {
  17061. if ('self.version' === $link->getPrettyConstraint()) {
  17062. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17063. }
  17064. }
  17065. }
  17066. return $links;
  17067. }
  17068. public function getType()
  17069. {
  17070. return $this->aliasOf->getType();
  17071. }
  17072. public function getTargetDir()
  17073. {
  17074. return $this->aliasOf->getTargetDir();
  17075. }
  17076. public function getExtra()
  17077. {
  17078. return $this->aliasOf->getExtra();
  17079. }
  17080. public function setInstallationSource($type)
  17081. {
  17082. $this->aliasOf->setInstallationSource($type);
  17083. }
  17084. public function getInstallationSource()
  17085. {
  17086. return $this->aliasOf->getInstallationSource();
  17087. }
  17088. public function getSourceType()
  17089. {
  17090. return $this->aliasOf->getSourceType();
  17091. }
  17092. public function getSourceUrl()
  17093. {
  17094. return $this->aliasOf->getSourceUrl();
  17095. }
  17096. public function getSourceUrls()
  17097. {
  17098. return $this->aliasOf->getSourceUrls();
  17099. }
  17100. public function getSourceReference()
  17101. {
  17102. return $this->aliasOf->getSourceReference();
  17103. }
  17104. public function setSourceReference($reference)
  17105. {
  17106. return $this->aliasOf->setSourceReference($reference);
  17107. }
  17108. public function setSourceMirrors($mirrors)
  17109. {
  17110. return $this->aliasOf->setSourceMirrors($mirrors);
  17111. }
  17112. public function getSourceMirrors()
  17113. {
  17114. return $this->aliasOf->getSourceMirrors();
  17115. }
  17116. public function getDistType()
  17117. {
  17118. return $this->aliasOf->getDistType();
  17119. }
  17120. public function getDistUrl()
  17121. {
  17122. return $this->aliasOf->getDistUrl();
  17123. }
  17124. public function getDistUrls()
  17125. {
  17126. return $this->aliasOf->getDistUrls();
  17127. }
  17128. public function getDistReference()
  17129. {
  17130. return $this->aliasOf->getDistReference();
  17131. }
  17132. public function setDistReference($reference)
  17133. {
  17134. return $this->aliasOf->setDistReference($reference);
  17135. }
  17136. public function getDistSha1Checksum()
  17137. {
  17138. return $this->aliasOf->getDistSha1Checksum();
  17139. }
  17140. public function setTransportOptions(array $options)
  17141. {
  17142. return $this->aliasOf->setTransportOptions($options);
  17143. }
  17144. public function getTransportOptions()
  17145. {
  17146. return $this->aliasOf->getTransportOptions();
  17147. }
  17148. public function setDistMirrors($mirrors)
  17149. {
  17150. return $this->aliasOf->setDistMirrors($mirrors);
  17151. }
  17152. public function getDistMirrors()
  17153. {
  17154. return $this->aliasOf->getDistMirrors();
  17155. }
  17156. public function getScripts()
  17157. {
  17158. return $this->aliasOf->getScripts();
  17159. }
  17160. public function getLicense()
  17161. {
  17162. return $this->aliasOf->getLicense();
  17163. }
  17164. public function getAutoload()
  17165. {
  17166. return $this->aliasOf->getAutoload();
  17167. }
  17168. public function getDevAutoload()
  17169. {
  17170. return $this->aliasOf->getDevAutoload();
  17171. }
  17172. public function getIncludePaths()
  17173. {
  17174. return $this->aliasOf->getIncludePaths();
  17175. }
  17176. public function getRepositories()
  17177. {
  17178. return $this->aliasOf->getRepositories();
  17179. }
  17180. public function getReleaseDate()
  17181. {
  17182. return $this->aliasOf->getReleaseDate();
  17183. }
  17184. public function getBinaries()
  17185. {
  17186. return $this->aliasOf->getBinaries();
  17187. }
  17188. public function getKeywords()
  17189. {
  17190. return $this->aliasOf->getKeywords();
  17191. }
  17192. public function getDescription()
  17193. {
  17194. return $this->aliasOf->getDescription();
  17195. }
  17196. public function getHomepage()
  17197. {
  17198. return $this->aliasOf->getHomepage();
  17199. }
  17200. public function getSuggests()
  17201. {
  17202. return $this->aliasOf->getSuggests();
  17203. }
  17204. public function getAuthors()
  17205. {
  17206. return $this->aliasOf->getAuthors();
  17207. }
  17208. public function getSupport()
  17209. {
  17210. return $this->aliasOf->getSupport();
  17211. }
  17212. public function getFunding()
  17213. {
  17214. return $this->aliasOf->getFunding();
  17215. }
  17216. public function getNotificationUrl()
  17217. {
  17218. return $this->aliasOf->getNotificationUrl();
  17219. }
  17220. public function getArchiveExcludes()
  17221. {
  17222. return $this->aliasOf->getArchiveExcludes();
  17223. }
  17224. public function isAbandoned()
  17225. {
  17226. return $this->aliasOf->isAbandoned();
  17227. }
  17228. public function getReplacementPackage()
  17229. {
  17230. return $this->aliasOf->getReplacementPackage();
  17231. }
  17232. public function __toString()
  17233. {
  17234. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  17235. }
  17236. public function setDistUrl($url)
  17237. {
  17238. return $this->aliasOf->setDistUrl($url);
  17239. }
  17240. public function setDistType($type)
  17241. {
  17242. return $this->aliasOf->setDistType($type);
  17243. }
  17244. }
  17245. <?php
  17246. namespace Composer\Package\Archiver;
  17247. use FilterIterator;
  17248. use PharData;
  17249. class ArchivableFilesFilter extends FilterIterator
  17250. {
  17251. private $dirs = array();
  17252. public function accept()
  17253. {
  17254. $file = $this->getInnerIterator()->current();
  17255. if ($file->isDir()) {
  17256. $this->dirs[] = (string) $file;
  17257. return false;
  17258. }
  17259. return true;
  17260. }
  17261. public function addEmptyDir(PharData $phar, $sources)
  17262. {
  17263. foreach ($this->dirs as $filepath) {
  17264. $localname = str_replace($sources . "/", '', $filepath);
  17265. $phar->addEmptyDir($localname);
  17266. }
  17267. }
  17268. }
  17269. <?php
  17270. namespace Composer\Package\Archiver;
  17271. use Composer\Util\Filesystem;
  17272. use FilesystemIterator;
  17273. use Symfony\Component\Finder\Finder;
  17274. use Symfony\Component\Finder\SplFileInfo;
  17275. class ArchivableFilesFinder extends \FilterIterator
  17276. {
  17277. protected $finder;
  17278. public function __construct($sources, array $excludes, $ignoreFilters = false)
  17279. {
  17280. $fs = new Filesystem();
  17281. $sources = $fs->normalizePath($sources);
  17282. if ($ignoreFilters) {
  17283. $filters = array();
  17284. } else {
  17285. $filters = array(
  17286. new HgExcludeFilter($sources),
  17287. new GitExcludeFilter($sources),
  17288. new ComposerExcludeFilter($sources, $excludes),
  17289. );
  17290. }
  17291. $this->finder = new Finder();
  17292. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  17293. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  17294. return false;
  17295. }
  17296. $relativePath = preg_replace(
  17297. '#^'.preg_quote($sources, '#').'#',
  17298. '',
  17299. $fs->normalizePath($file->getRealPath())
  17300. );
  17301. $exclude = false;
  17302. foreach ($filters as $filter) {
  17303. $exclude = $filter->filter($relativePath, $exclude);
  17304. }
  17305. return !$exclude;
  17306. };
  17307. if (method_exists($filter, 'bindTo')) {
  17308. $filter = $filter->bindTo(null);
  17309. }
  17310. $this->finder
  17311. ->in($sources)
  17312. ->filter($filter)
  17313. ->ignoreVCS(true)
  17314. ->ignoreDotFiles(false);
  17315. parent::__construct($this->finder->getIterator());
  17316. }
  17317. public function accept()
  17318. {
  17319. $current = $this->getInnerIterator()->current();
  17320. if (!$current->isDir()) {
  17321. return true;
  17322. }
  17323. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  17324. return !$iterator->valid();
  17325. }
  17326. }
  17327. <?php
  17328. namespace Composer\Package\Archiver;
  17329. use Composer\Downloader\DownloadManager;
  17330. use Composer\Package\PackageInterface;
  17331. use Composer\Package\RootPackageInterface;
  17332. use Composer\Util\Filesystem;
  17333. use Composer\Json\JsonFile;
  17334. class ArchiveManager
  17335. {
  17336. protected $downloadManager;
  17337. protected $archivers = array();
  17338. protected $overwriteFiles = true;
  17339. public function __construct(DownloadManager $downloadManager)
  17340. {
  17341. $this->downloadManager = $downloadManager;
  17342. }
  17343. public function addArchiver(ArchiverInterface $archiver)
  17344. {
  17345. $this->archivers[] = $archiver;
  17346. }
  17347. public function setOverwriteFiles($overwriteFiles)
  17348. {
  17349. $this->overwriteFiles = $overwriteFiles;
  17350. return $this;
  17351. }
  17352. public function getPackageFilename(PackageInterface $package)
  17353. {
  17354. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  17355. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  17356. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  17357. } else {
  17358. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  17359. }
  17360. if ($package->getSourceReference()) {
  17361. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  17362. }
  17363. $name = implode('-', array_filter($nameParts, function ($p) {
  17364. return !empty($p);
  17365. }));
  17366. return str_replace('/', '-', $name);
  17367. }
  17368. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  17369. {
  17370. if (empty($format)) {
  17371. throw new \InvalidArgumentException('Format must be specified');
  17372. }
  17373. $usableArchiver = null;
  17374. foreach ($this->archivers as $archiver) {
  17375. if ($archiver->supports($format, $package->getSourceType())) {
  17376. $usableArchiver = $archiver;
  17377. break;
  17378. }
  17379. }
  17380. if (null === $usableArchiver) {
  17381. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  17382. }
  17383. $filesystem = new Filesystem();
  17384. if (null === $fileName) {
  17385. $packageName = $this->getPackageFilename($package);
  17386. } else {
  17387. $packageName = $fileName;
  17388. }
  17389. $filesystem->ensureDirectoryExists($targetDir);
  17390. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  17391. $filesystem->ensureDirectoryExists(dirname($target));
  17392. if (!$this->overwriteFiles && file_exists($target)) {
  17393. return $target;
  17394. }
  17395. if ($package instanceof RootPackageInterface) {
  17396. $sourcePath = realpath('.');
  17397. } else {
  17398. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  17399. $filesystem->ensureDirectoryExists($sourcePath);
  17400. try {
  17401. $this->downloadManager->download($package, $sourcePath);
  17402. } catch (\Exception $e) {
  17403. $filesystem->removeDirectory($sourcePath);
  17404. throw $e;
  17405. }
  17406. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  17407. $jsonFile = new JsonFile($composerJsonPath);
  17408. $jsonData = $jsonFile->read();
  17409. if (!empty($jsonData['archive']['exclude'])) {
  17410. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  17411. }
  17412. }
  17413. }
  17414. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  17415. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  17416. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  17417. $filesystem->rename($archivePath, $target);
  17418. if (!$package instanceof RootPackageInterface) {
  17419. $filesystem->removeDirectory($sourcePath);
  17420. }
  17421. $filesystem->remove($tempTarget);
  17422. return $target;
  17423. }
  17424. }
  17425. <?php
  17426. namespace Composer\Package\Archiver;
  17427. interface ArchiverInterface
  17428. {
  17429. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  17430. public function supports($format, $sourceType);
  17431. }
  17432. <?php
  17433. namespace Composer\Package\Archiver;
  17434. use Symfony\Component\Finder;
  17435. abstract class BaseExcludeFilter
  17436. {
  17437. protected $sourcePath;
  17438. protected $excludePatterns;
  17439. public function __construct($sourcePath)
  17440. {
  17441. $this->sourcePath = $sourcePath;
  17442. $this->excludePatterns = array();
  17443. }
  17444. public function filter($relativePath, $exclude)
  17445. {
  17446. foreach ($this->excludePatterns as $patternData) {
  17447. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  17448. if ($stripLeadingSlash) {
  17449. $path = substr($relativePath, 1);
  17450. } else {
  17451. $path = $relativePath;
  17452. }
  17453. if (preg_match($pattern, $path)) {
  17454. $exclude = !$negate;
  17455. }
  17456. }
  17457. return $exclude;
  17458. }
  17459. protected function parseLines(array $lines, $lineParser)
  17460. {
  17461. return array_filter(
  17462. array_map(
  17463. function ($line) use ($lineParser) {
  17464. $line = trim($line);
  17465. if (!$line || 0 === strpos($line, '#')) {
  17466. return null;
  17467. }
  17468. return call_user_func($lineParser, $line);
  17469. },
  17470. $lines
  17471. ),
  17472. function ($pattern) {
  17473. return $pattern !== null;
  17474. }
  17475. );
  17476. }
  17477. protected function generatePatterns($rules)
  17478. {
  17479. $patterns = array();
  17480. foreach ($rules as $rule) {
  17481. $patterns[] = $this->generatePattern($rule);
  17482. }
  17483. return $patterns;
  17484. }
  17485. protected function generatePattern($rule)
  17486. {
  17487. $negate = false;
  17488. $pattern = '{';
  17489. if (strlen($rule) && $rule[0] === '!') {
  17490. $negate = true;
  17491. $rule = substr($rule, 1);
  17492. }
  17493. if (strlen($rule) && $rule[0] === '/') {
  17494. $pattern .= '^/';
  17495. $rule = substr($rule, 1);
  17496. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  17497. $pattern .= '/';
  17498. $rule = substr($rule, 0, -1);
  17499. } elseif (false === strpos($rule, '/')) {
  17500. $pattern .= '/';
  17501. }
  17502. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  17503. return array($pattern . '}', $negate, false);
  17504. }
  17505. }
  17506. <?php
  17507. namespace Composer\Package\Archiver;
  17508. class ComposerExcludeFilter extends BaseExcludeFilter
  17509. {
  17510. public function __construct($sourcePath, array $excludeRules)
  17511. {
  17512. parent::__construct($sourcePath);
  17513. $this->excludePatterns = $this->generatePatterns($excludeRules);
  17514. }
  17515. }
  17516. <?php
  17517. namespace Composer\Package\Archiver;
  17518. class GitExcludeFilter extends BaseExcludeFilter
  17519. {
  17520. public function __construct($sourcePath)
  17521. {
  17522. parent::__construct($sourcePath);
  17523. if (file_exists($sourcePath.'/.gitignore')) {
  17524. $this->excludePatterns = $this->parseLines(
  17525. file($sourcePath.'/.gitignore'),
  17526. array($this, 'parseGitIgnoreLine')
  17527. );
  17528. }
  17529. if (file_exists($sourcePath.'/.gitattributes')) {
  17530. $this->excludePatterns = array_merge(
  17531. $this->excludePatterns,
  17532. $this->parseLines(
  17533. file($sourcePath.'/.gitattributes'),
  17534. array($this, 'parseGitAttributesLine')
  17535. )
  17536. );
  17537. }
  17538. }
  17539. public function parseGitIgnoreLine($line)
  17540. {
  17541. return $this->generatePattern($line);
  17542. }
  17543. public function parseGitAttributesLine($line)
  17544. {
  17545. $parts = preg_split('#\s+#', $line);
  17546. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  17547. return $this->generatePattern($parts[0]);
  17548. }
  17549. return null;
  17550. }
  17551. }
  17552. <?php
  17553. namespace Composer\Package\Archiver;
  17554. use Symfony\Component\Finder;
  17555. class HgExcludeFilter extends BaseExcludeFilter
  17556. {
  17557. const HG_IGNORE_REGEX = 1;
  17558. const HG_IGNORE_GLOB = 2;
  17559. protected $patternMode;
  17560. public function __construct($sourcePath)
  17561. {
  17562. parent::__construct($sourcePath);
  17563. $this->patternMode = self::HG_IGNORE_REGEX;
  17564. if (file_exists($sourcePath.'/.hgignore')) {
  17565. $this->excludePatterns = $this->parseLines(
  17566. file($sourcePath.'/.hgignore'),
  17567. array($this, 'parseHgIgnoreLine')
  17568. );
  17569. }
  17570. }
  17571. public function parseHgIgnoreLine($line)
  17572. {
  17573. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  17574. if ($matches[1] === 'glob') {
  17575. $this->patternMode = self::HG_IGNORE_GLOB;
  17576. } else {
  17577. $this->patternMode = self::HG_IGNORE_REGEX;
  17578. }
  17579. return null;
  17580. }
  17581. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  17582. return $this->patternFromGlob($line);
  17583. }
  17584. return $this->patternFromRegex($line);
  17585. }
  17586. protected function patternFromGlob($line)
  17587. {
  17588. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  17589. $pattern = str_replace('[^/]*', '.*', $pattern);
  17590. return array($pattern, false, true);
  17591. }
  17592. public function patternFromRegex($line)
  17593. {
  17594. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  17595. return array($pattern, false, true);
  17596. }
  17597. }
  17598. <?php
  17599. namespace Composer\Package\Archiver;
  17600. class PharArchiver implements ArchiverInterface
  17601. {
  17602. protected static $formats = array(
  17603. 'zip' => \Phar::ZIP,
  17604. 'tar' => \Phar::TAR,
  17605. 'tar.gz' => \Phar::TAR,
  17606. 'tar.bz2' => \Phar::TAR,
  17607. );
  17608. protected static $compressFormats = array(
  17609. 'tar.gz' => \Phar::GZ,
  17610. 'tar.bz2' => \Phar::BZ2,
  17611. );
  17612. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17613. {
  17614. $sources = realpath($sources);
  17615. if (file_exists($target)) {
  17616. unlink($target);
  17617. }
  17618. try {
  17619. $filename = substr($target, 0, strrpos($target, $format) - 1);
  17620. if (isset(static::$compressFormats[$format])) {
  17621. $target = $filename . '.tar';
  17622. }
  17623. $phar = new \PharData($target, null, null, static::$formats[$format]);
  17624. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17625. $filesOnly = new ArchivableFilesFilter($files);
  17626. $phar->buildFromIterator($filesOnly, $sources);
  17627. $filesOnly->addEmptyDir($phar, $sources);
  17628. if (isset(static::$compressFormats[$format])) {
  17629. if (!$phar->canCompress(static::$compressFormats[$format])) {
  17630. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  17631. }
  17632. unlink($target);
  17633. $phar->compress(static::$compressFormats[$format]);
  17634. $target = $filename . '.' . $format;
  17635. }
  17636. return $target;
  17637. } catch (\UnexpectedValueException $e) {
  17638. $message = sprintf(
  17639. "Could not create archive '%s' from '%s': %s",
  17640. $target,
  17641. $sources,
  17642. $e->getMessage()
  17643. );
  17644. throw new \RuntimeException($message, $e->getCode(), $e);
  17645. }
  17646. }
  17647. public function supports($format, $sourceType)
  17648. {
  17649. return isset(static::$formats[$format]);
  17650. }
  17651. }
  17652. <?php
  17653. namespace Composer\Package\Archiver;
  17654. use ZipArchive;
  17655. use Composer\Util\Filesystem;
  17656. class ZipArchiver implements ArchiverInterface
  17657. {
  17658. protected static $formats = array(
  17659. 'zip' => 1,
  17660. );
  17661. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17662. {
  17663. $fs = new Filesystem();
  17664. $sources = $fs->normalizePath($sources);
  17665. $zip = new ZipArchive();
  17666. $res = $zip->open($target, ZipArchive::CREATE);
  17667. if ($res === true) {
  17668. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17669. foreach ($files as $file) {
  17670. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  17671. $localname = str_replace($sources.'/', '', $filepath);
  17672. if ($file->isDir()) {
  17673. $zip->addEmptyDir($localname);
  17674. } else {
  17675. $zip->addFile($filepath, $localname);
  17676. }
  17677. if (PHP_VERSION_ID >= 50600) {
  17678. $perms = fileperms($filepath);
  17679. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  17680. }
  17681. }
  17682. if ($zip->close()) {
  17683. return $target;
  17684. }
  17685. }
  17686. $message = sprintf(
  17687. "Could not create archive '%s' from '%s': %s",
  17688. $target,
  17689. $sources,
  17690. $zip->getStatusString()
  17691. );
  17692. throw new \RuntimeException($message);
  17693. }
  17694. public function supports($format, $sourceType)
  17695. {
  17696. return isset(static::$formats[$format]) && $this->compressionAvailable();
  17697. }
  17698. private function compressionAvailable()
  17699. {
  17700. return class_exists('ZipArchive');
  17701. }
  17702. }
  17703. <?php
  17704. namespace Composer\Package;
  17705. use Composer\Repository\RepositoryInterface;
  17706. use Composer\Repository\PlatformRepository;
  17707. abstract class BasePackage implements PackageInterface
  17708. {
  17709. public static $supportedLinkTypes = array(
  17710. 'require' => array('description' => 'requires', 'method' => 'requires'),
  17711. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  17712. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  17713. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  17714. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  17715. );
  17716. const STABILITY_STABLE = 0;
  17717. const STABILITY_RC = 5;
  17718. const STABILITY_BETA = 10;
  17719. const STABILITY_ALPHA = 15;
  17720. const STABILITY_DEV = 20;
  17721. public static $stabilities = array(
  17722. 'stable' => self::STABILITY_STABLE,
  17723. 'RC' => self::STABILITY_RC,
  17724. 'beta' => self::STABILITY_BETA,
  17725. 'alpha' => self::STABILITY_ALPHA,
  17726. 'dev' => self::STABILITY_DEV,
  17727. );
  17728. public $id;
  17729. protected $name;
  17730. protected $prettyName;
  17731. protected $repository;
  17732. protected $transportOptions = array();
  17733. public function __construct($name)
  17734. {
  17735. $this->prettyName = $name;
  17736. $this->name = strtolower($name);
  17737. $this->id = -1;
  17738. }
  17739. public function getName()
  17740. {
  17741. return $this->name;
  17742. }
  17743. public function getPrettyName()
  17744. {
  17745. return $this->prettyName;
  17746. }
  17747. public function getNames()
  17748. {
  17749. $names = array(
  17750. $this->getName() => true,
  17751. );
  17752. foreach ($this->getProvides() as $link) {
  17753. $names[$link->getTarget()] = true;
  17754. }
  17755. foreach ($this->getReplaces() as $link) {
  17756. $names[$link->getTarget()] = true;
  17757. }
  17758. return array_keys($names);
  17759. }
  17760. public function setId($id)
  17761. {
  17762. $this->id = $id;
  17763. }
  17764. public function getId()
  17765. {
  17766. return $this->id;
  17767. }
  17768. public function setRepository(RepositoryInterface $repository)
  17769. {
  17770. if ($this->repository && $repository !== $this->repository) {
  17771. throw new \LogicException('A package can only be added to one repository');
  17772. }
  17773. $this->repository = $repository;
  17774. }
  17775. public function getRepository()
  17776. {
  17777. return $this->repository;
  17778. }
  17779. public function getTransportOptions()
  17780. {
  17781. return $this->transportOptions;
  17782. }
  17783. public function setTransportOptions(array $options)
  17784. {
  17785. $this->transportOptions = $options;
  17786. }
  17787. public function isPlatform()
  17788. {
  17789. return $this->getRepository() instanceof PlatformRepository;
  17790. }
  17791. public function getUniqueName()
  17792. {
  17793. return $this->getName().'-'.$this->getVersion();
  17794. }
  17795. public function equals(PackageInterface $package)
  17796. {
  17797. $self = $this;
  17798. if ($this instanceof AliasPackage) {
  17799. $self = $this->getAliasOf();
  17800. }
  17801. if ($package instanceof AliasPackage) {
  17802. $package = $package->getAliasOf();
  17803. }
  17804. return $package === $self;
  17805. }
  17806. public function __toString()
  17807. {
  17808. return $this->getUniqueName();
  17809. }
  17810. public function getPrettyString()
  17811. {
  17812. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17813. }
  17814. public function getFullPrettyVersion($truncate = true)
  17815. {
  17816. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17817. return $this->getPrettyVersion();
  17818. }
  17819. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17820. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17821. }
  17822. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17823. }
  17824. public function getStabilityPriority()
  17825. {
  17826. return self::$stabilities[$this->getStability()];
  17827. }
  17828. public function __clone()
  17829. {
  17830. $this->repository = null;
  17831. $this->id = -1;
  17832. }
  17833. public static function packageNameToRegexp($allowListPattern, $wrap = '{^%s$}i')
  17834. {
  17835. $cleanedAllowListPattern = str_replace('\\*', '.*', preg_quote($allowListPattern));
  17836. return sprintf($wrap, $cleanedAllowListPattern);
  17837. }
  17838. }
  17839. <?php
  17840. namespace Composer\Package\Comparer;
  17841. class Comparer
  17842. {
  17843. private $source;
  17844. private $update;
  17845. private $changed;
  17846. public function setSource($source)
  17847. {
  17848. $this->source = $source;
  17849. }
  17850. public function setUpdate($update)
  17851. {
  17852. $this->update = $update;
  17853. }
  17854. public function getChanged($toString = false, $explicated = false)
  17855. {
  17856. $changed = $this->changed;
  17857. if (!count($changed)) {
  17858. return false;
  17859. }
  17860. if ($explicated) {
  17861. foreach ($changed as $sectionKey => $itemSection) {
  17862. foreach ($itemSection as $itemKey => $item) {
  17863. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17864. }
  17865. }
  17866. }
  17867. if ($toString) {
  17868. foreach ($changed as $sectionKey => $itemSection) {
  17869. foreach ($itemSection as $itemKey => $item) {
  17870. $changed['string'][] = $item."\r\n";
  17871. }
  17872. }
  17873. $changed = implode("\r\n", $changed['string']);
  17874. }
  17875. return $changed;
  17876. }
  17877. public function doCompare()
  17878. {
  17879. $source = array();
  17880. $destination = array();
  17881. $this->changed = array();
  17882. $currentDirectory = getcwd();
  17883. chdir($this->source);
  17884. $source = $this->doTree('.', $source);
  17885. if (!is_array($source)) {
  17886. return;
  17887. }
  17888. chdir($currentDirectory);
  17889. chdir($this->update);
  17890. $destination = $this->doTree('.', $destination);
  17891. if (!is_array($destination)) {
  17892. exit;
  17893. }
  17894. chdir($currentDirectory);
  17895. foreach ($source as $dir => $value) {
  17896. foreach ($value as $file => $hash) {
  17897. if (isset($destination[$dir][$file])) {
  17898. if ($hash !== $destination[$dir][$file]) {
  17899. $this->changed['changed'][] = $dir.'/'.$file;
  17900. }
  17901. } else {
  17902. $this->changed['removed'][] = $dir.'/'.$file;
  17903. }
  17904. }
  17905. }
  17906. foreach ($destination as $dir => $value) {
  17907. foreach ($value as $file => $hash) {
  17908. if (!isset($source[$dir][$file])) {
  17909. $this->changed['added'][] = $dir.'/'.$file;
  17910. }
  17911. }
  17912. }
  17913. }
  17914. private function doTree($dir, &$array)
  17915. {
  17916. if ($dh = opendir($dir)) {
  17917. while ($file = readdir($dh)) {
  17918. if ($file !== '.' && $file !== '..') {
  17919. if (is_dir($dir.'/'.$file)) {
  17920. if (!count($array)) {
  17921. $array[0] = 'Temp';
  17922. }
  17923. if (!$this->doTree($dir.'/'.$file, $array)) {
  17924. return false;
  17925. }
  17926. } else {
  17927. if (filesize($dir.'/'.$file)) {
  17928. set_time_limit(30);
  17929. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17930. }
  17931. }
  17932. }
  17933. }
  17934. if (count($array) > 1 && isset($array['0'])) {
  17935. unset($array['0']);
  17936. }
  17937. return $array;
  17938. }
  17939. return false;
  17940. }
  17941. }
  17942. <?php
  17943. namespace Composer\Package;
  17944. class CompletePackage extends Package implements CompletePackageInterface
  17945. {
  17946. protected $repositories;
  17947. protected $license = array();
  17948. protected $keywords;
  17949. protected $authors;
  17950. protected $description;
  17951. protected $homepage;
  17952. protected $scripts = array();
  17953. protected $support = array();
  17954. protected $funding = array();
  17955. protected $abandoned = false;
  17956. public function setScripts(array $scripts)
  17957. {
  17958. $this->scripts = $scripts;
  17959. }
  17960. public function getScripts()
  17961. {
  17962. return $this->scripts;
  17963. }
  17964. public function setRepositories($repositories)
  17965. {
  17966. $this->repositories = $repositories;
  17967. }
  17968. public function getRepositories()
  17969. {
  17970. return $this->repositories;
  17971. }
  17972. public function setLicense(array $license)
  17973. {
  17974. $this->license = $license;
  17975. }
  17976. public function getLicense()
  17977. {
  17978. return $this->license;
  17979. }
  17980. public function setKeywords(array $keywords)
  17981. {
  17982. $this->keywords = $keywords;
  17983. }
  17984. public function getKeywords()
  17985. {
  17986. return $this->keywords;
  17987. }
  17988. public function setAuthors(array $authors)
  17989. {
  17990. $this->authors = $authors;
  17991. }
  17992. public function getAuthors()
  17993. {
  17994. return $this->authors;
  17995. }
  17996. public function setDescription($description)
  17997. {
  17998. $this->description = $description;
  17999. }
  18000. public function getDescription()
  18001. {
  18002. return $this->description;
  18003. }
  18004. public function setHomepage($homepage)
  18005. {
  18006. $this->homepage = $homepage;
  18007. }
  18008. public function getHomepage()
  18009. {
  18010. return $this->homepage;
  18011. }
  18012. public function setSupport(array $support)
  18013. {
  18014. $this->support = $support;
  18015. }
  18016. public function getSupport()
  18017. {
  18018. return $this->support;
  18019. }
  18020. public function setFunding(array $funding)
  18021. {
  18022. $this->funding = $funding;
  18023. }
  18024. public function getFunding()
  18025. {
  18026. return $this->funding;
  18027. }
  18028. public function isAbandoned()
  18029. {
  18030. return (bool) $this->abandoned;
  18031. }
  18032. public function setAbandoned($abandoned)
  18033. {
  18034. $this->abandoned = $abandoned;
  18035. }
  18036. public function getReplacementPackage()
  18037. {
  18038. return is_string($this->abandoned) ? $this->abandoned : null;
  18039. }
  18040. }
  18041. <?php
  18042. namespace Composer\Package;
  18043. interface CompletePackageInterface extends PackageInterface
  18044. {
  18045. public function getScripts();
  18046. public function getRepositories();
  18047. public function getLicense();
  18048. public function getKeywords();
  18049. public function getDescription();
  18050. public function getHomepage();
  18051. public function getAuthors();
  18052. public function getSupport();
  18053. public function getFunding();
  18054. public function isAbandoned();
  18055. public function getReplacementPackage();
  18056. }
  18057. <?php
  18058. namespace Composer\Package\Dumper;
  18059. use Composer\Package\BasePackage;
  18060. use Composer\Package\PackageInterface;
  18061. use Composer\Package\CompletePackageInterface;
  18062. use Composer\Package\RootPackageInterface;
  18063. class ArrayDumper
  18064. {
  18065. public function dump(PackageInterface $package)
  18066. {
  18067. $keys = array(
  18068. 'binaries' => 'bin',
  18069. 'type',
  18070. 'extra',
  18071. 'installationSource' => 'installation-source',
  18072. 'autoload',
  18073. 'devAutoload' => 'autoload-dev',
  18074. 'notificationUrl' => 'notification-url',
  18075. 'includePaths' => 'include-path',
  18076. );
  18077. $data = array();
  18078. $data['name'] = $package->getPrettyName();
  18079. $data['version'] = $package->getPrettyVersion();
  18080. $data['version_normalized'] = $package->getVersion();
  18081. if ($package->getTargetDir()) {
  18082. $data['target-dir'] = $package->getTargetDir();
  18083. }
  18084. if ($package->getSourceType()) {
  18085. $data['source']['type'] = $package->getSourceType();
  18086. $data['source']['url'] = $package->getSourceUrl();
  18087. if (null !== ($value = $package->getSourceReference())) {
  18088. $data['source']['reference'] = $value;
  18089. }
  18090. if ($mirrors = $package->getSourceMirrors()) {
  18091. $data['source']['mirrors'] = $mirrors;
  18092. }
  18093. }
  18094. if ($package->getDistType()) {
  18095. $data['dist']['type'] = $package->getDistType();
  18096. $data['dist']['url'] = $package->getDistUrl();
  18097. if (null !== ($value = $package->getDistReference())) {
  18098. $data['dist']['reference'] = $value;
  18099. }
  18100. if (null !== ($value = $package->getDistSha1Checksum())) {
  18101. $data['dist']['shasum'] = $value;
  18102. }
  18103. if ($mirrors = $package->getDistMirrors()) {
  18104. $data['dist']['mirrors'] = $mirrors;
  18105. }
  18106. }
  18107. if ($package->getArchiveExcludes()) {
  18108. $data['archive']['exclude'] = $package->getArchiveExcludes();
  18109. }
  18110. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  18111. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  18112. foreach ($links as $link) {
  18113. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  18114. }
  18115. ksort($data[$type]);
  18116. }
  18117. }
  18118. if ($packages = $package->getSuggests()) {
  18119. ksort($packages);
  18120. $data['suggest'] = $packages;
  18121. }
  18122. if ($package->getReleaseDate()) {
  18123. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  18124. }
  18125. $data = $this->dumpValues($package, $keys, $data);
  18126. if ($package instanceof CompletePackageInterface) {
  18127. $keys = array(
  18128. 'scripts',
  18129. 'license',
  18130. 'authors',
  18131. 'description',
  18132. 'homepage',
  18133. 'keywords',
  18134. 'repositories',
  18135. 'support',
  18136. 'funding',
  18137. );
  18138. $data = $this->dumpValues($package, $keys, $data);
  18139. if (isset($data['keywords']) && is_array($data['keywords'])) {
  18140. sort($data['keywords']);
  18141. }
  18142. if ($package->isAbandoned()) {
  18143. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  18144. }
  18145. }
  18146. if ($package instanceof RootPackageInterface) {
  18147. $minimumStability = $package->getMinimumStability();
  18148. if ($minimumStability) {
  18149. $data['minimum-stability'] = $minimumStability;
  18150. }
  18151. }
  18152. if (count($package->getTransportOptions()) > 0) {
  18153. $data['transport-options'] = $package->getTransportOptions();
  18154. }
  18155. return $data;
  18156. }
  18157. private function dumpValues(PackageInterface $package, array $keys, array $data)
  18158. {
  18159. foreach ($keys as $method => $key) {
  18160. if (is_numeric($method)) {
  18161. $method = $key;
  18162. }
  18163. $getter = 'get'.ucfirst($method);
  18164. $value = $package->$getter();
  18165. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  18166. $data[$key] = $value;
  18167. }
  18168. }
  18169. return $data;
  18170. }
  18171. }
  18172. <?php
  18173. namespace Composer\Package;
  18174. use Composer\Semver\Constraint\ConstraintInterface;
  18175. class Link
  18176. {
  18177. protected $source;
  18178. protected $target;
  18179. protected $constraint;
  18180. protected $description;
  18181. protected $prettyConstraint;
  18182. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  18183. {
  18184. $this->source = strtolower($source);
  18185. $this->target = strtolower($target);
  18186. $this->constraint = $constraint;
  18187. $this->description = $description;
  18188. $this->prettyConstraint = $prettyConstraint;
  18189. }
  18190. public function getDescription()
  18191. {
  18192. return $this->description;
  18193. }
  18194. public function getSource()
  18195. {
  18196. return $this->source;
  18197. }
  18198. public function getTarget()
  18199. {
  18200. return $this->target;
  18201. }
  18202. public function getConstraint()
  18203. {
  18204. return $this->constraint;
  18205. }
  18206. public function getPrettyConstraint()
  18207. {
  18208. if (null === $this->prettyConstraint) {
  18209. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  18210. }
  18211. return $this->prettyConstraint;
  18212. }
  18213. public function __toString()
  18214. {
  18215. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  18216. }
  18217. public function getPrettyString(PackageInterface $sourcePackage)
  18218. {
  18219. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  18220. }
  18221. }
  18222. <?php
  18223. namespace Composer\Package\LinkConstraint;
  18224. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  18225. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  18226. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  18227. {
  18228. }
  18229. <?php
  18230. namespace Composer\Package\LinkConstraint;
  18231. use Composer\Semver\Constraint\ConstraintInterface;
  18232. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  18233. interface LinkConstraintInterface extends ConstraintInterface
  18234. {
  18235. }
  18236. <?php
  18237. namespace Composer\Package\LinkConstraint;
  18238. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  18239. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  18240. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  18241. {
  18242. }
  18243. <?php
  18244. namespace Composer\Package\LinkConstraint;
  18245. use Composer\Semver\Constraint\AbstractConstraint;
  18246. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  18247. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  18248. {
  18249. }
  18250. <?php
  18251. namespace Composer\Package\LinkConstraint;
  18252. use Composer\Semver\Constraint\Constraint;
  18253. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  18254. class VersionConstraint extends Constraint implements LinkConstraintInterface
  18255. {
  18256. }
  18257. <?php
  18258. namespace Composer\Package\Loader;
  18259. use Composer\Package;
  18260. use Composer\Package\AliasPackage;
  18261. use Composer\Package\Link;
  18262. use Composer\Package\RootAliasPackage;
  18263. use Composer\Package\RootPackageInterface;
  18264. use Composer\Package\Version\VersionParser;
  18265. use Composer\Semver\VersionParser as SemverVersionParser;
  18266. class ArrayLoader implements LoaderInterface
  18267. {
  18268. protected $versionParser;
  18269. protected $loadOptions;
  18270. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  18271. {
  18272. if (!$parser) {
  18273. $parser = new VersionParser;
  18274. }
  18275. $this->versionParser = $parser;
  18276. $this->loadOptions = $loadOptions;
  18277. }
  18278. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18279. {
  18280. if (!isset($config['name'])) {
  18281. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  18282. }
  18283. if (!isset($config['version'])) {
  18284. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  18285. }
  18286. if (isset($config['version_normalized'])) {
  18287. $version = $config['version_normalized'];
  18288. } else {
  18289. $version = $this->versionParser->normalize($config['version']);
  18290. }
  18291. $package = new $class($config['name'], $version, $config['version']);
  18292. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  18293. if (isset($config['target-dir'])) {
  18294. $package->setTargetDir($config['target-dir']);
  18295. }
  18296. if (isset($config['extra']) && is_array($config['extra'])) {
  18297. $package->setExtra($config['extra']);
  18298. }
  18299. if (isset($config['bin'])) {
  18300. foreach ((array) $config['bin'] as $key => $bin) {
  18301. $config['bin'][$key] = ltrim($bin, '/');
  18302. }
  18303. $package->setBinaries((array) $config['bin']);
  18304. }
  18305. if (isset($config['installation-source'])) {
  18306. $package->setInstallationSource($config['installation-source']);
  18307. }
  18308. if (isset($config['source'])) {
  18309. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  18310. throw new \UnexpectedValueException(sprintf(
  18311. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  18312. $config['name'],
  18313. json_encode($config['source'])
  18314. ));
  18315. }
  18316. $package->setSourceType($config['source']['type']);
  18317. $package->setSourceUrl($config['source']['url']);
  18318. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  18319. if (isset($config['source']['mirrors'])) {
  18320. $package->setSourceMirrors($config['source']['mirrors']);
  18321. }
  18322. }
  18323. if (isset($config['dist'])) {
  18324. if (!isset($config['dist']['type'])
  18325. || !isset($config['dist']['url'])) {
  18326. throw new \UnexpectedValueException(sprintf(
  18327. "Package %s's dist key should be specified as ".
  18328. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  18329. $config['name'],
  18330. json_encode($config['dist'])
  18331. ));
  18332. }
  18333. $package->setDistType($config['dist']['type']);
  18334. $package->setDistUrl($config['dist']['url']);
  18335. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  18336. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  18337. if (isset($config['dist']['mirrors'])) {
  18338. $package->setDistMirrors($config['dist']['mirrors']);
  18339. }
  18340. }
  18341. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  18342. if (isset($config[$type])) {
  18343. $method = 'set'.ucfirst($opts['method']);
  18344. $package->{$method}(
  18345. $this->parseLinks(
  18346. $package->getName(),
  18347. $package->getPrettyVersion(),
  18348. $opts['description'],
  18349. $config[$type]
  18350. )
  18351. );
  18352. }
  18353. }
  18354. if (isset($config['suggest']) && is_array($config['suggest'])) {
  18355. foreach ($config['suggest'] as $target => $reason) {
  18356. if ('self.version' === trim($reason)) {
  18357. $config['suggest'][$target] = $package->getPrettyVersion();
  18358. }
  18359. }
  18360. $package->setSuggests($config['suggest']);
  18361. }
  18362. if (isset($config['autoload'])) {
  18363. $package->setAutoload($config['autoload']);
  18364. }
  18365. if (isset($config['autoload-dev'])) {
  18366. $package->setDevAutoload($config['autoload-dev']);
  18367. }
  18368. if (isset($config['include-path'])) {
  18369. $package->setIncludePaths($config['include-path']);
  18370. }
  18371. if (!empty($config['time'])) {
  18372. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  18373. try {
  18374. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  18375. $package->setReleaseDate($date);
  18376. } catch (\Exception $e) {
  18377. }
  18378. }
  18379. if (!empty($config['notification-url'])) {
  18380. $package->setNotificationUrl($config['notification-url']);
  18381. }
  18382. if (!empty($config['archive']['exclude'])) {
  18383. $package->setArchiveExcludes($config['archive']['exclude']);
  18384. }
  18385. if ($package instanceof Package\CompletePackageInterface) {
  18386. if (isset($config['scripts']) && is_array($config['scripts'])) {
  18387. foreach ($config['scripts'] as $event => $listeners) {
  18388. $config['scripts'][$event] = (array) $listeners;
  18389. }
  18390. if (isset($config['scripts']['composer'])) {
  18391. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  18392. }
  18393. $package->setScripts($config['scripts']);
  18394. }
  18395. if (!empty($config['description']) && is_string($config['description'])) {
  18396. $package->setDescription($config['description']);
  18397. }
  18398. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  18399. $package->setHomepage($config['homepage']);
  18400. }
  18401. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  18402. $package->setKeywords($config['keywords']);
  18403. }
  18404. if (!empty($config['license'])) {
  18405. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  18406. }
  18407. if (!empty($config['authors']) && is_array($config['authors'])) {
  18408. $package->setAuthors($config['authors']);
  18409. }
  18410. if (isset($config['support'])) {
  18411. $package->setSupport($config['support']);
  18412. }
  18413. if (!empty($config['funding']) && is_array($config['funding'])) {
  18414. $package->setFunding($config['funding']);
  18415. }
  18416. if (isset($config['abandoned'])) {
  18417. $package->setAbandoned($config['abandoned']);
  18418. }
  18419. }
  18420. if ($aliasNormalized = $this->getBranchAlias($config)) {
  18421. if ($package instanceof RootPackageInterface) {
  18422. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18423. } else {
  18424. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18425. }
  18426. }
  18427. if ($this->loadOptions && isset($config['transport-options'])) {
  18428. $package->setTransportOptions($config['transport-options']);
  18429. }
  18430. return $package;
  18431. }
  18432. public function parseLinks($source, $sourceVersion, $description, $links)
  18433. {
  18434. $res = array();
  18435. foreach ($links as $target => $constraint) {
  18436. if (!is_string($constraint)) {
  18437. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  18438. }
  18439. if ('self.version' === $constraint) {
  18440. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  18441. } else {
  18442. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  18443. }
  18444. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  18445. }
  18446. return $res;
  18447. }
  18448. public function getBranchAlias(array $config)
  18449. {
  18450. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  18451. || !isset($config['extra']['branch-alias'])
  18452. || !is_array($config['extra']['branch-alias'])
  18453. ) {
  18454. return;
  18455. }
  18456. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18457. if ('-dev' !== substr($targetBranch, -4)) {
  18458. continue;
  18459. }
  18460. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18461. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18462. continue;
  18463. }
  18464. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  18465. continue;
  18466. }
  18467. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18468. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18469. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18470. ) {
  18471. continue;
  18472. }
  18473. return $validatedTargetBranch;
  18474. }
  18475. }
  18476. }
  18477. <?php
  18478. namespace Composer\Package\Loader;
  18479. class InvalidPackageException extends \Exception
  18480. {
  18481. private $errors;
  18482. private $warnings;
  18483. private $data;
  18484. public function __construct(array $errors, array $warnings, array $data)
  18485. {
  18486. $this->errors = $errors;
  18487. $this->warnings = $warnings;
  18488. $this->data = $data;
  18489. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  18490. }
  18491. public function getData()
  18492. {
  18493. return $this->data;
  18494. }
  18495. public function getErrors()
  18496. {
  18497. return $this->errors;
  18498. }
  18499. public function getWarnings()
  18500. {
  18501. return $this->warnings;
  18502. }
  18503. }
  18504. <?php
  18505. namespace Composer\Package\Loader;
  18506. use Composer\Json\JsonFile;
  18507. class JsonLoader
  18508. {
  18509. private $loader;
  18510. public function __construct(LoaderInterface $loader)
  18511. {
  18512. $this->loader = $loader;
  18513. }
  18514. public function load($json)
  18515. {
  18516. if ($json instanceof JsonFile) {
  18517. $config = $json->read();
  18518. } elseif (file_exists($json)) {
  18519. $config = JsonFile::parseJson(file_get_contents($json), $json);
  18520. } elseif (is_string($json)) {
  18521. $config = JsonFile::parseJson($json);
  18522. }
  18523. return $this->loader->load($config);
  18524. }
  18525. }
  18526. <?php
  18527. namespace Composer\Package\Loader;
  18528. interface LoaderInterface
  18529. {
  18530. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  18531. }
  18532. <?php
  18533. namespace Composer\Package\Loader;
  18534. use Composer\Package\BasePackage;
  18535. use Composer\Package\AliasPackage;
  18536. use Composer\Config;
  18537. use Composer\IO\IOInterface;
  18538. use Composer\Package\RootPackageInterface;
  18539. use Composer\Repository\RepositoryFactory;
  18540. use Composer\Package\Version\VersionGuesser;
  18541. use Composer\Package\Version\VersionParser;
  18542. use Composer\Repository\RepositoryManager;
  18543. use Composer\Util\ProcessExecutor;
  18544. class RootPackageLoader extends ArrayLoader
  18545. {
  18546. private $manager;
  18547. private $config;
  18548. private $versionGuesser;
  18549. private $io;
  18550. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  18551. {
  18552. parent::__construct($parser);
  18553. $this->manager = $manager;
  18554. $this->config = $config;
  18555. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  18556. $this->io = $io;
  18557. }
  18558. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  18559. {
  18560. if (!isset($config['name'])) {
  18561. $config['name'] = '__root__';
  18562. } elseif ($this->io) {
  18563. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  18564. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18565. }
  18566. }
  18567. $autoVersioned = false;
  18568. if (!isset($config['version'])) {
  18569. $commit = null;
  18570. if (getenv('COMPOSER_ROOT_VERSION')) {
  18571. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  18572. } else {
  18573. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  18574. if ($versionData) {
  18575. $config['version'] = $versionData['pretty_version'];
  18576. $config['version_normalized'] = $versionData['version'];
  18577. $commit = $versionData['commit'];
  18578. }
  18579. }
  18580. if (!isset($config['version'])) {
  18581. $config['version'] = '1.0.0';
  18582. $autoVersioned = true;
  18583. }
  18584. if ($commit) {
  18585. $config['source'] = array(
  18586. 'type' => '',
  18587. 'url' => '',
  18588. 'reference' => $commit,
  18589. );
  18590. $config['dist'] = array(
  18591. 'type' => '',
  18592. 'url' => '',
  18593. 'reference' => $commit,
  18594. );
  18595. }
  18596. }
  18597. $realPackage = $package = parent::load($config, $class);
  18598. if ($realPackage instanceof AliasPackage) {
  18599. $realPackage = $package->getAliasOf();
  18600. }
  18601. if ($autoVersioned) {
  18602. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  18603. }
  18604. if (isset($config['minimum-stability'])) {
  18605. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  18606. }
  18607. $aliases = array();
  18608. $stabilityFlags = array();
  18609. $references = array();
  18610. foreach (array('require', 'require-dev') as $linkType) {
  18611. if (isset($config[$linkType])) {
  18612. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  18613. $method = 'get'.ucfirst($linkInfo['method']);
  18614. $links = array();
  18615. foreach ($realPackage->$method() as $link) {
  18616. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  18617. }
  18618. $aliases = $this->extractAliases($links, $aliases);
  18619. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  18620. $references = $this->extractReferences($links, $references);
  18621. if (isset($links[$config['name']])) {
  18622. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  18623. 'Did you accidentally name your root package after an external package?', $config['name']));
  18624. }
  18625. }
  18626. }
  18627. if ($this->io) {
  18628. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18629. if (isset($config[$linkType])) {
  18630. foreach ($config[$linkType] as $linkName => $constraint) {
  18631. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  18632. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18633. }
  18634. }
  18635. }
  18636. }
  18637. }
  18638. $realPackage->setAliases($aliases);
  18639. $realPackage->setStabilityFlags($stabilityFlags);
  18640. $realPackage->setReferences($references);
  18641. if (isset($config['prefer-stable'])) {
  18642. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  18643. }
  18644. if (isset($config['config'])) {
  18645. $realPackage->setConfig($config['config']);
  18646. }
  18647. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  18648. foreach ($repos as $repo) {
  18649. $this->manager->addRepository($repo);
  18650. }
  18651. $realPackage->setRepositories($this->config->getRepositories());
  18652. return $package;
  18653. }
  18654. private function extractAliases(array $requires, array $aliases)
  18655. {
  18656. foreach ($requires as $reqName => $reqVersion) {
  18657. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  18658. $aliases[] = array(
  18659. 'package' => strtolower($reqName),
  18660. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  18661. 'alias' => $match[2],
  18662. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  18663. );
  18664. }
  18665. }
  18666. return $aliases;
  18667. }
  18668. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  18669. {
  18670. $stabilities = BasePackage::$stabilities;
  18671. $minimumStability = $stabilities[$minimumStability];
  18672. foreach ($requires as $reqName => $reqVersion) {
  18673. $constraints = array();
  18674. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  18675. foreach ($orSplit as $orConstraint) {
  18676. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  18677. foreach ($andSplit as $andConstraint) {
  18678. $constraints[] = $andConstraint;
  18679. }
  18680. }
  18681. $match = false;
  18682. foreach ($constraints as $constraint) {
  18683. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  18684. $name = strtolower($reqName);
  18685. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  18686. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  18687. continue;
  18688. }
  18689. $stabilityFlags[$name] = $stability;
  18690. $match = true;
  18691. }
  18692. }
  18693. if ($match) {
  18694. continue;
  18695. }
  18696. foreach ($constraints as $constraint) {
  18697. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  18698. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  18699. $name = strtolower($reqName);
  18700. $stability = $stabilities[$stabilityName];
  18701. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  18702. continue;
  18703. }
  18704. $stabilityFlags[$name] = $stability;
  18705. }
  18706. }
  18707. }
  18708. return $stabilityFlags;
  18709. }
  18710. private function extractReferences(array $requires, array $references)
  18711. {
  18712. foreach ($requires as $reqName => $reqVersion) {
  18713. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  18714. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  18715. $name = strtolower($reqName);
  18716. $references[$name] = $match[1];
  18717. }
  18718. }
  18719. return $references;
  18720. }
  18721. }
  18722. <?php
  18723. namespace Composer\Package\Loader;
  18724. use Composer\Package\BasePackage;
  18725. use Composer\Semver\Constraint\Constraint;
  18726. use Composer\Package\Version\VersionParser;
  18727. use Composer\Repository\PlatformRepository;
  18728. use Composer\Spdx\SpdxLicenses;
  18729. class ValidatingArrayLoader implements LoaderInterface
  18730. {
  18731. const CHECK_ALL = 3;
  18732. const CHECK_UNBOUND_CONSTRAINTS = 1;
  18733. const CHECK_STRICT_CONSTRAINTS = 2;
  18734. private $loader;
  18735. private $versionParser;
  18736. private $errors;
  18737. private $warnings;
  18738. private $config;
  18739. private $strictName;
  18740. private $flags;
  18741. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  18742. {
  18743. $this->loader = $loader;
  18744. $this->versionParser = $parser ?: new VersionParser();
  18745. $this->strictName = $strictName;
  18746. $this->flags = $flags;
  18747. }
  18748. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18749. {
  18750. $this->errors = array();
  18751. $this->warnings = array();
  18752. $this->config = $config;
  18753. if ($err = self::hasPackageNamingError($config['name'])) {
  18754. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18755. }
  18756. if ($this->strictName) {
  18757. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18758. } else {
  18759. $this->validateString('name', true);
  18760. }
  18761. if (!empty($this->config['version'])) {
  18762. try {
  18763. $this->versionParser->normalize($this->config['version']);
  18764. } catch (\Exception $e) {
  18765. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18766. unset($this->config['version']);
  18767. }
  18768. }
  18769. if (!empty($this->config['config']['platform'])) {
  18770. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18771. try {
  18772. $this->versionParser->normalize($platform);
  18773. } catch (\Exception $e) {
  18774. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18775. }
  18776. }
  18777. }
  18778. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18779. $this->validateString('target-dir');
  18780. $this->validateArray('extra');
  18781. if (isset($this->config['bin'])) {
  18782. if (is_string($this->config['bin'])) {
  18783. $this->validateString('bin');
  18784. } else {
  18785. $this->validateFlatArray('bin');
  18786. }
  18787. }
  18788. $this->validateArray('scripts');
  18789. $this->validateString('description');
  18790. $this->validateUrl('homepage');
  18791. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18792. $releaseDate = null;
  18793. $this->validateString('time');
  18794. if (!empty($this->config['time'])) {
  18795. try {
  18796. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18797. } catch (\Exception $e) {
  18798. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18799. unset($this->config['time']);
  18800. }
  18801. }
  18802. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18803. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18804. $licenses = (array) $this->config['license'];
  18805. foreach ($licenses as $key => $license) {
  18806. if ('proprietary' === $license) {
  18807. unset($licenses[$key]);
  18808. }
  18809. }
  18810. $licenseValidator = new SpdxLicenses();
  18811. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  18812. $this->warnings[] = sprintf(
  18813. 'License %s must not contain extra spaces, make sure to trim it.',
  18814. json_encode($this->config['license'])
  18815. );
  18816. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  18817. $this->warnings[] = sprintf(
  18818. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18819. 'If the software is closed-source, you may use "proprietary" as license.',
  18820. json_encode($this->config['license'])
  18821. );
  18822. }
  18823. }
  18824. }
  18825. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18826. foreach ($this->config['authors'] as $key => $author) {
  18827. if (!is_array($author)) {
  18828. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18829. unset($this->config['authors'][$key]);
  18830. continue;
  18831. }
  18832. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18833. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18834. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18835. unset($this->config['authors'][$key][$authorData]);
  18836. }
  18837. }
  18838. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18839. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18840. unset($this->config['authors'][$key]['homepage']);
  18841. }
  18842. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18843. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18844. unset($this->config['authors'][$key]['email']);
  18845. }
  18846. if (empty($this->config['authors'][$key])) {
  18847. unset($this->config['authors'][$key]);
  18848. }
  18849. }
  18850. if (empty($this->config['authors'])) {
  18851. unset($this->config['authors']);
  18852. }
  18853. }
  18854. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18855. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18856. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18857. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18858. unset($this->config['support'][$key]);
  18859. }
  18860. }
  18861. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18862. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18863. unset($this->config['support']['email']);
  18864. }
  18865. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18866. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18867. unset($this->config['support']['irc']);
  18868. }
  18869. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18870. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18871. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18872. unset($this->config['support'][$key]);
  18873. }
  18874. }
  18875. if (empty($this->config['support'])) {
  18876. unset($this->config['support']);
  18877. }
  18878. }
  18879. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  18880. foreach ($this->config['funding'] as $key => $fundingOption) {
  18881. if (!is_array($fundingOption)) {
  18882. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  18883. unset($this->config['funding'][$key]);
  18884. continue;
  18885. }
  18886. foreach (array('type', 'url') as $fundingData) {
  18887. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  18888. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  18889. unset($this->config['funding'][$key][$fundingData]);
  18890. }
  18891. }
  18892. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  18893. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  18894. unset($this->config['funding'][$key]['url']);
  18895. }
  18896. if (empty($this->config['funding'][$key])) {
  18897. unset($this->config['funding'][$key]);
  18898. }
  18899. }
  18900. if (empty($this->config['funding'])) {
  18901. unset($this->config['funding']);
  18902. }
  18903. }
  18904. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18905. $stableConstraint = new Constraint('=', '1.0.0');
  18906. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18907. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18908. foreach ($this->config[$linkType] as $package => $constraint) {
  18909. if ($err = self::hasPackageNamingError($package, true)) {
  18910. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18911. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18912. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18913. }
  18914. if (!is_string($constraint)) {
  18915. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18916. unset($this->config[$linkType][$package]);
  18917. } elseif ('self.version' !== $constraint) {
  18918. try {
  18919. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18920. } catch (\Exception $e) {
  18921. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18922. unset($this->config[$linkType][$package]);
  18923. continue;
  18924. }
  18925. if (
  18926. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18927. && 'require' === $linkType
  18928. && $linkConstraint->matches($unboundConstraint)
  18929. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18930. ) {
  18931. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18932. } elseif (
  18933. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18934. && 'require' === $linkType
  18935. && substr($linkConstraint, 0, 1) === '='
  18936. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18937. ) {
  18938. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18939. }
  18940. }
  18941. }
  18942. }
  18943. }
  18944. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18945. foreach ($this->config['suggest'] as $package => $description) {
  18946. if (!is_string($description)) {
  18947. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18948. unset($this->config['suggest'][$package]);
  18949. }
  18950. }
  18951. }
  18952. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18953. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18954. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18955. unset($this->config['minimum-stability']);
  18956. }
  18957. }
  18958. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18959. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18960. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18961. if (!in_array($type, $types)) {
  18962. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18963. unset($this->config['autoload'][$type]);
  18964. }
  18965. if ($type === 'psr-4') {
  18966. foreach ($typeConfig as $namespace => $dirs) {
  18967. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18968. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18969. }
  18970. }
  18971. }
  18972. }
  18973. }
  18974. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18975. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18976. unset($this->config['autoload']['psr-4']);
  18977. }
  18978. $this->validateFlatArray('include-path');
  18979. $this->validateArray('transport-options');
  18980. if (isset($this->config['extra']['branch-alias'])) {
  18981. if (!is_array($this->config['extra']['branch-alias'])) {
  18982. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18983. } else {
  18984. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18985. if ('-dev' !== substr($targetBranch, -4)) {
  18986. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18987. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18988. continue;
  18989. }
  18990. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18991. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18992. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18993. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18994. continue;
  18995. }
  18996. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18997. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18998. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18999. ) {
  19000. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  19001. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19002. }
  19003. }
  19004. }
  19005. }
  19006. if ($this->errors) {
  19007. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  19008. }
  19009. $package = $this->loader->load($this->config, $class);
  19010. $this->config = null;
  19011. return $package;
  19012. }
  19013. public function getWarnings()
  19014. {
  19015. return $this->warnings;
  19016. }
  19017. public function getErrors()
  19018. {
  19019. return $this->errors;
  19020. }
  19021. public static function hasPackageNamingError($name, $isLink = false)
  19022. {
  19023. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  19024. return;
  19025. }
  19026. if (!preg_match('{^[a-z0-9](?:[_.-]?[a-z0-9]+)*/[a-z0-9](?:(?:[_.]?|-{0,2})[a-z0-9]+)*$}iD', $name)) {
  19027. 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]+)*$".';
  19028. }
  19029. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  19030. $bits = explode('/', strtolower($name));
  19031. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  19032. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  19033. }
  19034. if (preg_match('{\.json$}', $name)) {
  19035. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  19036. }
  19037. if (preg_match('{[A-Z]}', $name)) {
  19038. if ($isLink) {
  19039. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  19040. }
  19041. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  19042. $suggestName = strtolower($suggestName);
  19043. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  19044. }
  19045. }
  19046. private function validateRegex($property, $regex, $mandatory = false)
  19047. {
  19048. if (!$this->validateString($property, $mandatory)) {
  19049. return false;
  19050. }
  19051. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  19052. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  19053. if ($mandatory) {
  19054. $this->errors[] = $message;
  19055. } else {
  19056. $this->warnings[] = $message;
  19057. }
  19058. unset($this->config[$property]);
  19059. return false;
  19060. }
  19061. return true;
  19062. }
  19063. private function validateString($property, $mandatory = false)
  19064. {
  19065. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  19066. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  19067. unset($this->config[$property]);
  19068. return false;
  19069. }
  19070. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  19071. if ($mandatory) {
  19072. $this->errors[] = $property.' : must be present';
  19073. }
  19074. unset($this->config[$property]);
  19075. return false;
  19076. }
  19077. return true;
  19078. }
  19079. private function validateArray($property, $mandatory = false)
  19080. {
  19081. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  19082. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  19083. unset($this->config[$property]);
  19084. return false;
  19085. }
  19086. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  19087. if ($mandatory) {
  19088. $this->errors[] = $property.' : must be present and contain at least one element';
  19089. }
  19090. unset($this->config[$property]);
  19091. return false;
  19092. }
  19093. return true;
  19094. }
  19095. private function validateFlatArray($property, $regex = null, $mandatory = false)
  19096. {
  19097. if (!$this->validateArray($property, $mandatory)) {
  19098. return false;
  19099. }
  19100. $pass = true;
  19101. foreach ($this->config[$property] as $key => $value) {
  19102. if (!is_string($value) && !is_numeric($value)) {
  19103. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  19104. unset($this->config[$property][$key]);
  19105. $pass = false;
  19106. continue;
  19107. }
  19108. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  19109. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  19110. unset($this->config[$property][$key]);
  19111. $pass = false;
  19112. }
  19113. }
  19114. return $pass;
  19115. }
  19116. private function validateUrl($property, $mandatory = false)
  19117. {
  19118. if (!$this->validateString($property, $mandatory)) {
  19119. return false;
  19120. }
  19121. if (!$this->filterUrl($this->config[$property])) {
  19122. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  19123. unset($this->config[$property]);
  19124. return false;
  19125. }
  19126. return true;
  19127. }
  19128. private function filterUrl($value, array $schemes = array('http', 'https'))
  19129. {
  19130. if ($value === '') {
  19131. return true;
  19132. }
  19133. $bits = parse_url($value);
  19134. if (empty($bits['scheme']) || empty($bits['host'])) {
  19135. return false;
  19136. }
  19137. if (!in_array($bits['scheme'], $schemes, true)) {
  19138. return false;
  19139. }
  19140. return true;
  19141. }
  19142. }
  19143. <?php
  19144. namespace Composer\Package;
  19145. use Composer\Json\JsonFile;
  19146. use Composer\Installer\InstallationManager;
  19147. use Composer\Repository\RepositoryManager;
  19148. use Composer\Util\ProcessExecutor;
  19149. use Composer\Repository\ArrayRepository;
  19150. use Composer\Package\Dumper\ArrayDumper;
  19151. use Composer\Package\Loader\ArrayLoader;
  19152. use Composer\Plugin\PluginInterface;
  19153. use Composer\Util\Git as GitUtil;
  19154. use Composer\IO\IOInterface;
  19155. use Seld\JsonLint\ParsingException;
  19156. class Locker
  19157. {
  19158. private $lockFile;
  19159. private $repositoryManager;
  19160. private $installationManager;
  19161. private $hash;
  19162. private $contentHash;
  19163. private $loader;
  19164. private $dumper;
  19165. private $process;
  19166. private $lockDataCache;
  19167. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  19168. {
  19169. $this->lockFile = $lockFile;
  19170. $this->repositoryManager = $repositoryManager;
  19171. $this->installationManager = $installationManager;
  19172. $this->hash = md5($composerFileContents);
  19173. $this->contentHash = self::getContentHash($composerFileContents);
  19174. $this->loader = new ArrayLoader(null, true);
  19175. $this->dumper = new ArrayDumper();
  19176. $this->process = new ProcessExecutor($io);
  19177. }
  19178. public static function getContentHash($composerFileContents)
  19179. {
  19180. $content = json_decode($composerFileContents, true);
  19181. $relevantKeys = array(
  19182. 'name',
  19183. 'version',
  19184. 'require',
  19185. 'require-dev',
  19186. 'conflict',
  19187. 'replace',
  19188. 'provide',
  19189. 'minimum-stability',
  19190. 'prefer-stable',
  19191. 'repositories',
  19192. 'extra',
  19193. );
  19194. $relevantContent = array();
  19195. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  19196. $relevantContent[$key] = $content[$key];
  19197. }
  19198. if (isset($content['config']['platform'])) {
  19199. $relevantContent['config']['platform'] = $content['config']['platform'];
  19200. }
  19201. ksort($relevantContent);
  19202. return md5(json_encode($relevantContent));
  19203. }
  19204. public function isLocked()
  19205. {
  19206. if (!$this->lockFile->exists()) {
  19207. return false;
  19208. }
  19209. $data = $this->getLockData();
  19210. return isset($data['packages']);
  19211. }
  19212. public function isFresh()
  19213. {
  19214. $lock = $this->lockFile->read();
  19215. if (!empty($lock['content-hash'])) {
  19216. return $this->contentHash === $lock['content-hash'];
  19217. }
  19218. if (!empty($lock['hash'])) {
  19219. return $this->hash === $lock['hash'];
  19220. }
  19221. return false;
  19222. }
  19223. public function getLockedRepository($withDevReqs = false)
  19224. {
  19225. $lockData = $this->getLockData();
  19226. $packages = new ArrayRepository();
  19227. $lockedPackages = $lockData['packages'];
  19228. if ($withDevReqs) {
  19229. if (isset($lockData['packages-dev'])) {
  19230. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  19231. } else {
  19232. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  19233. }
  19234. }
  19235. if (empty($lockedPackages)) {
  19236. return $packages;
  19237. }
  19238. if (isset($lockedPackages[0]['name'])) {
  19239. foreach ($lockedPackages as $info) {
  19240. $packages->addPackage($this->loader->load($info));
  19241. }
  19242. return $packages;
  19243. }
  19244. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  19245. }
  19246. public function getPlatformRequirements($withDevReqs = false)
  19247. {
  19248. $lockData = $this->getLockData();
  19249. $requirements = array();
  19250. if (!empty($lockData['platform'])) {
  19251. $requirements = $this->loader->parseLinks(
  19252. '__ROOT__',
  19253. '1.0.0',
  19254. 'requires',
  19255. isset($lockData['platform']) ? $lockData['platform'] : array()
  19256. );
  19257. }
  19258. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  19259. $devRequirements = $this->loader->parseLinks(
  19260. '__ROOT__',
  19261. '1.0.0',
  19262. 'requires',
  19263. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  19264. );
  19265. $requirements = array_merge($requirements, $devRequirements);
  19266. }
  19267. return $requirements;
  19268. }
  19269. public function getMinimumStability()
  19270. {
  19271. $lockData = $this->getLockData();
  19272. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  19273. }
  19274. public function getStabilityFlags()
  19275. {
  19276. $lockData = $this->getLockData();
  19277. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  19278. }
  19279. public function getPreferStable()
  19280. {
  19281. $lockData = $this->getLockData();
  19282. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  19283. }
  19284. public function getPreferLowest()
  19285. {
  19286. $lockData = $this->getLockData();
  19287. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  19288. }
  19289. public function getPlatformOverrides()
  19290. {
  19291. $lockData = $this->getLockData();
  19292. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  19293. }
  19294. public function getAliases()
  19295. {
  19296. $lockData = $this->getLockData();
  19297. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  19298. }
  19299. public function getLockData()
  19300. {
  19301. if (null !== $this->lockDataCache) {
  19302. return $this->lockDataCache;
  19303. }
  19304. if (!$this->lockFile->exists()) {
  19305. throw new \LogicException('No lockfile found. Unable to read locked packages');
  19306. }
  19307. return $this->lockDataCache = $this->lockFile->read();
  19308. }
  19309. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  19310. {
  19311. $lock = array(
  19312. '_readme' => array('This file locks the dependencies of your project to a known state',
  19313. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  19314. 'This file is @gener'.'ated automatically', ),
  19315. 'content-hash' => $this->contentHash,
  19316. 'packages' => null,
  19317. 'packages-dev' => null,
  19318. 'aliases' => array(),
  19319. 'minimum-stability' => $minimumStability,
  19320. 'stability-flags' => $stabilityFlags,
  19321. 'prefer-stable' => $preferStable,
  19322. 'prefer-lowest' => $preferLowest,
  19323. );
  19324. foreach ($aliases as $package => $versions) {
  19325. foreach ($versions as $version => $alias) {
  19326. $lock['aliases'][] = array(
  19327. 'alias' => $alias['alias'],
  19328. 'alias_normalized' => $alias['alias_normalized'],
  19329. 'version' => $version,
  19330. 'package' => $package,
  19331. );
  19332. }
  19333. }
  19334. $lock['packages'] = $this->lockPackages($packages);
  19335. if (null !== $devPackages) {
  19336. $lock['packages-dev'] = $this->lockPackages($devPackages);
  19337. }
  19338. $lock['platform'] = $platformReqs;
  19339. $lock['platform-dev'] = $platformDevReqs;
  19340. if ($platformOverrides) {
  19341. $lock['platform-overrides'] = $platformOverrides;
  19342. }
  19343. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  19344. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  19345. if ($this->lockFile->exists()) {
  19346. unlink($this->lockFile->getPath());
  19347. }
  19348. return false;
  19349. }
  19350. try {
  19351. $isLocked = $this->isLocked();
  19352. } catch (ParsingException $e) {
  19353. $isLocked = false;
  19354. }
  19355. if (!$isLocked || $lock !== $this->getLockData()) {
  19356. $this->lockFile->write($lock);
  19357. $this->lockDataCache = null;
  19358. return true;
  19359. }
  19360. return false;
  19361. }
  19362. private function lockPackages(array $packages)
  19363. {
  19364. $locked = array();
  19365. foreach ($packages as $package) {
  19366. if ($package instanceof AliasPackage) {
  19367. continue;
  19368. }
  19369. $name = $package->getPrettyName();
  19370. $version = $package->getPrettyVersion();
  19371. if (!$name || !$version) {
  19372. throw new \LogicException(sprintf(
  19373. 'Package "%s" has no version or name and can not be locked',
  19374. $package
  19375. ));
  19376. }
  19377. $spec = $this->dumper->dump($package);
  19378. unset($spec['version_normalized']);
  19379. $time = isset($spec['time']) ? $spec['time'] : null;
  19380. unset($spec['time']);
  19381. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  19382. $time = $this->getPackageTime($package) ?: $time;
  19383. }
  19384. if (null !== $time) {
  19385. $spec['time'] = $time;
  19386. }
  19387. unset($spec['installation-source']);
  19388. $locked[] = $spec;
  19389. }
  19390. usort($locked, function ($a, $b) {
  19391. $comparison = strcmp($a['name'], $b['name']);
  19392. if (0 !== $comparison) {
  19393. return $comparison;
  19394. }
  19395. return strcmp($a['version'], $b['version']);
  19396. });
  19397. return $locked;
  19398. }
  19399. private function getPackageTime(PackageInterface $package)
  19400. {
  19401. if (!function_exists('proc_open')) {
  19402. return null;
  19403. }
  19404. $path = realpath($this->installationManager->getInstallPath($package));
  19405. $sourceType = $package->getSourceType();
  19406. $datetime = null;
  19407. if ($path && in_array($sourceType, array('git', 'hg'))) {
  19408. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  19409. switch ($sourceType) {
  19410. case 'git':
  19411. GitUtil::cleanEnv();
  19412. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  19413. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  19414. }
  19415. break;
  19416. case 'hg':
  19417. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  19418. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  19419. }
  19420. break;
  19421. }
  19422. }
  19423. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  19424. }
  19425. }
  19426. <?php
  19427. namespace Composer\Package;
  19428. use Composer\Package\Version\VersionParser;
  19429. use Composer\Util\ComposerMirror;
  19430. class Package extends BasePackage
  19431. {
  19432. protected $type;
  19433. protected $targetDir;
  19434. protected $installationSource;
  19435. protected $sourceType;
  19436. protected $sourceUrl;
  19437. protected $sourceReference;
  19438. protected $sourceMirrors;
  19439. protected $distType;
  19440. protected $distUrl;
  19441. protected $distReference;
  19442. protected $distSha1Checksum;
  19443. protected $distMirrors;
  19444. protected $version;
  19445. protected $prettyVersion;
  19446. protected $releaseDate;
  19447. protected $extra = array();
  19448. protected $binaries = array();
  19449. protected $dev;
  19450. protected $stability;
  19451. protected $notificationUrl;
  19452. protected $requires = array();
  19453. protected $conflicts = array();
  19454. protected $provides = array();
  19455. protected $replaces = array();
  19456. protected $devRequires = array();
  19457. protected $suggests = array();
  19458. protected $autoload = array();
  19459. protected $devAutoload = array();
  19460. protected $includePaths = array();
  19461. protected $archiveExcludes = array();
  19462. public function __construct($name, $version, $prettyVersion)
  19463. {
  19464. parent::__construct($name);
  19465. $this->version = $version;
  19466. $this->prettyVersion = $prettyVersion;
  19467. $this->stability = VersionParser::parseStability($version);
  19468. $this->dev = $this->stability === 'dev';
  19469. }
  19470. public function isDev()
  19471. {
  19472. return $this->dev;
  19473. }
  19474. public function setType($type)
  19475. {
  19476. $this->type = $type;
  19477. }
  19478. public function getType()
  19479. {
  19480. return $this->type ?: 'library';
  19481. }
  19482. public function getStability()
  19483. {
  19484. return $this->stability;
  19485. }
  19486. public function setTargetDir($targetDir)
  19487. {
  19488. $this->targetDir = $targetDir;
  19489. }
  19490. public function getTargetDir()
  19491. {
  19492. if (null === $this->targetDir) {
  19493. return;
  19494. }
  19495. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  19496. }
  19497. public function setExtra(array $extra)
  19498. {
  19499. $this->extra = $extra;
  19500. }
  19501. public function getExtra()
  19502. {
  19503. return $this->extra;
  19504. }
  19505. public function setBinaries(array $binaries)
  19506. {
  19507. $this->binaries = $binaries;
  19508. }
  19509. public function getBinaries()
  19510. {
  19511. return $this->binaries;
  19512. }
  19513. public function setInstallationSource($type)
  19514. {
  19515. $this->installationSource = $type;
  19516. }
  19517. public function getInstallationSource()
  19518. {
  19519. return $this->installationSource;
  19520. }
  19521. public function setSourceType($type)
  19522. {
  19523. $this->sourceType = $type;
  19524. }
  19525. public function getSourceType()
  19526. {
  19527. return $this->sourceType;
  19528. }
  19529. public function setSourceUrl($url)
  19530. {
  19531. $this->sourceUrl = $url;
  19532. }
  19533. public function getSourceUrl()
  19534. {
  19535. return $this->sourceUrl;
  19536. }
  19537. public function setSourceReference($reference)
  19538. {
  19539. $this->sourceReference = $reference;
  19540. }
  19541. public function getSourceReference()
  19542. {
  19543. return $this->sourceReference;
  19544. }
  19545. public function setSourceMirrors($mirrors)
  19546. {
  19547. $this->sourceMirrors = $mirrors;
  19548. }
  19549. public function getSourceMirrors()
  19550. {
  19551. return $this->sourceMirrors;
  19552. }
  19553. public function getSourceUrls()
  19554. {
  19555. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  19556. }
  19557. public function setDistType($type)
  19558. {
  19559. $this->distType = $type;
  19560. }
  19561. public function getDistType()
  19562. {
  19563. return $this->distType;
  19564. }
  19565. public function setDistUrl($url)
  19566. {
  19567. $this->distUrl = $url;
  19568. }
  19569. public function getDistUrl()
  19570. {
  19571. return $this->distUrl;
  19572. }
  19573. public function setDistReference($reference)
  19574. {
  19575. $this->distReference = $reference;
  19576. }
  19577. public function getDistReference()
  19578. {
  19579. return $this->distReference;
  19580. }
  19581. public function setDistSha1Checksum($sha1checksum)
  19582. {
  19583. $this->distSha1Checksum = $sha1checksum;
  19584. }
  19585. public function getDistSha1Checksum()
  19586. {
  19587. return $this->distSha1Checksum;
  19588. }
  19589. public function setDistMirrors($mirrors)
  19590. {
  19591. $this->distMirrors = $mirrors;
  19592. }
  19593. public function getDistMirrors()
  19594. {
  19595. return $this->distMirrors;
  19596. }
  19597. public function getDistUrls()
  19598. {
  19599. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  19600. }
  19601. public function getVersion()
  19602. {
  19603. return $this->version;
  19604. }
  19605. public function getPrettyVersion()
  19606. {
  19607. return $this->prettyVersion;
  19608. }
  19609. public function setReleaseDate(\DateTime $releaseDate)
  19610. {
  19611. $this->releaseDate = $releaseDate;
  19612. }
  19613. public function getReleaseDate()
  19614. {
  19615. return $this->releaseDate;
  19616. }
  19617. public function setRequires(array $requires)
  19618. {
  19619. $this->requires = $requires;
  19620. }
  19621. public function getRequires()
  19622. {
  19623. return $this->requires;
  19624. }
  19625. public function setConflicts(array $conflicts)
  19626. {
  19627. $this->conflicts = $conflicts;
  19628. }
  19629. public function getConflicts()
  19630. {
  19631. return $this->conflicts;
  19632. }
  19633. public function setProvides(array $provides)
  19634. {
  19635. $this->provides = $provides;
  19636. }
  19637. public function getProvides()
  19638. {
  19639. return $this->provides;
  19640. }
  19641. public function setReplaces(array $replaces)
  19642. {
  19643. $this->replaces = $replaces;
  19644. }
  19645. public function getReplaces()
  19646. {
  19647. return $this->replaces;
  19648. }
  19649. public function setDevRequires(array $devRequires)
  19650. {
  19651. $this->devRequires = $devRequires;
  19652. }
  19653. public function getDevRequires()
  19654. {
  19655. return $this->devRequires;
  19656. }
  19657. public function setSuggests(array $suggests)
  19658. {
  19659. $this->suggests = $suggests;
  19660. }
  19661. public function getSuggests()
  19662. {
  19663. return $this->suggests;
  19664. }
  19665. public function setAutoload(array $autoload)
  19666. {
  19667. $this->autoload = $autoload;
  19668. }
  19669. public function getAutoload()
  19670. {
  19671. return $this->autoload;
  19672. }
  19673. public function setDevAutoload(array $devAutoload)
  19674. {
  19675. $this->devAutoload = $devAutoload;
  19676. }
  19677. public function getDevAutoload()
  19678. {
  19679. return $this->devAutoload;
  19680. }
  19681. public function setIncludePaths(array $includePaths)
  19682. {
  19683. $this->includePaths = $includePaths;
  19684. }
  19685. public function getIncludePaths()
  19686. {
  19687. return $this->includePaths;
  19688. }
  19689. public function setNotificationUrl($notificationUrl)
  19690. {
  19691. $this->notificationUrl = $notificationUrl;
  19692. }
  19693. public function getNotificationUrl()
  19694. {
  19695. return $this->notificationUrl;
  19696. }
  19697. public function setArchiveExcludes(array $excludes)
  19698. {
  19699. $this->archiveExcludes = $excludes;
  19700. }
  19701. public function getArchiveExcludes()
  19702. {
  19703. return $this->archiveExcludes;
  19704. }
  19705. public function replaceVersion($version, $prettyVersion)
  19706. {
  19707. $this->version = $version;
  19708. $this->prettyVersion = $prettyVersion;
  19709. $this->stability = VersionParser::parseStability($version);
  19710. $this->dev = $this->stability === 'dev';
  19711. }
  19712. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  19713. {
  19714. if (!$url) {
  19715. return array();
  19716. }
  19717. $urls = array($url);
  19718. if ($mirrors) {
  19719. foreach ($mirrors as $mirror) {
  19720. if ($urlType === 'dist') {
  19721. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  19722. } elseif ($urlType === 'source' && $type === 'git') {
  19723. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  19724. } elseif ($urlType === 'source' && $type === 'hg') {
  19725. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  19726. }
  19727. if (!in_array($mirrorUrl, $urls)) {
  19728. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  19729. $func($urls, $mirrorUrl);
  19730. }
  19731. }
  19732. }
  19733. return $urls;
  19734. }
  19735. }
  19736. <?php
  19737. namespace Composer\Package;
  19738. use Composer\Repository\RepositoryInterface;
  19739. interface PackageInterface
  19740. {
  19741. public function getName();
  19742. public function getPrettyName();
  19743. public function getNames();
  19744. public function setId($id);
  19745. public function getId();
  19746. public function isDev();
  19747. public function getType();
  19748. public function getTargetDir();
  19749. public function getExtra();
  19750. public function setInstallationSource($type);
  19751. public function getInstallationSource();
  19752. public function getSourceType();
  19753. public function getSourceUrl();
  19754. public function getSourceUrls();
  19755. public function getSourceReference();
  19756. public function getSourceMirrors();
  19757. public function getDistType();
  19758. public function getDistUrl();
  19759. public function getDistUrls();
  19760. public function getDistReference();
  19761. public function getDistSha1Checksum();
  19762. public function getDistMirrors();
  19763. public function getVersion();
  19764. public function getPrettyVersion();
  19765. public function getFullPrettyVersion($truncate = true);
  19766. public function getReleaseDate();
  19767. public function getStability();
  19768. public function getRequires();
  19769. public function getConflicts();
  19770. public function getProvides();
  19771. public function getReplaces();
  19772. public function getDevRequires();
  19773. public function getSuggests();
  19774. public function getAutoload();
  19775. public function getDevAutoload();
  19776. public function getIncludePaths();
  19777. public function setRepository(RepositoryInterface $repository);
  19778. public function getRepository();
  19779. public function getBinaries();
  19780. public function getUniqueName();
  19781. public function getNotificationUrl();
  19782. public function __toString();
  19783. public function getPrettyString();
  19784. public function getArchiveExcludes();
  19785. public function getTransportOptions();
  19786. public function setSourceReference($reference);
  19787. public function setDistUrl($url);
  19788. public function setDistType($type);
  19789. public function setDistReference($reference);
  19790. }
  19791. <?php
  19792. namespace Composer\Package;
  19793. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19794. {
  19795. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19796. {
  19797. parent::__construct($aliasOf, $version, $prettyVersion);
  19798. }
  19799. public function getAliases()
  19800. {
  19801. return $this->aliasOf->getAliases();
  19802. }
  19803. public function getMinimumStability()
  19804. {
  19805. return $this->aliasOf->getMinimumStability();
  19806. }
  19807. public function getStabilityFlags()
  19808. {
  19809. return $this->aliasOf->getStabilityFlags();
  19810. }
  19811. public function getReferences()
  19812. {
  19813. return $this->aliasOf->getReferences();
  19814. }
  19815. public function getPreferStable()
  19816. {
  19817. return $this->aliasOf->getPreferStable();
  19818. }
  19819. public function getConfig()
  19820. {
  19821. return $this->aliasOf->getConfig();
  19822. }
  19823. public function setRequires(array $require)
  19824. {
  19825. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19826. $this->aliasOf->setRequires($require);
  19827. }
  19828. public function setDevRequires(array $devRequire)
  19829. {
  19830. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19831. $this->aliasOf->setDevRequires($devRequire);
  19832. }
  19833. public function setConflicts(array $conflicts)
  19834. {
  19835. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19836. $this->aliasOf->setConflicts($conflicts);
  19837. }
  19838. public function setProvides(array $provides)
  19839. {
  19840. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19841. $this->aliasOf->setProvides($provides);
  19842. }
  19843. public function setReplaces(array $replaces)
  19844. {
  19845. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19846. $this->aliasOf->setReplaces($replaces);
  19847. }
  19848. public function setRepositories($repositories)
  19849. {
  19850. $this->aliasOf->setRepositories($repositories);
  19851. }
  19852. public function setAutoload(array $autoload)
  19853. {
  19854. $this->aliasOf->setAutoload($autoload);
  19855. }
  19856. public function setDevAutoload(array $devAutoload)
  19857. {
  19858. $this->aliasOf->setDevAutoload($devAutoload);
  19859. }
  19860. public function setStabilityFlags(array $stabilityFlags)
  19861. {
  19862. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19863. }
  19864. public function setSuggests(array $suggests)
  19865. {
  19866. $this->aliasOf->setSuggests($suggests);
  19867. }
  19868. public function setExtra(array $extra)
  19869. {
  19870. $this->aliasOf->setExtra($extra);
  19871. }
  19872. public function __clone()
  19873. {
  19874. parent::__clone();
  19875. $this->aliasOf = clone $this->aliasOf;
  19876. }
  19877. }
  19878. <?php
  19879. namespace Composer\Package;
  19880. class RootPackage extends CompletePackage implements RootPackageInterface
  19881. {
  19882. protected $minimumStability = 'stable';
  19883. protected $preferStable = false;
  19884. protected $stabilityFlags = array();
  19885. protected $config = array();
  19886. protected $references = array();
  19887. protected $aliases = array();
  19888. public function setMinimumStability($minimumStability)
  19889. {
  19890. $this->minimumStability = $minimumStability;
  19891. }
  19892. public function getMinimumStability()
  19893. {
  19894. return $this->minimumStability;
  19895. }
  19896. public function setStabilityFlags(array $stabilityFlags)
  19897. {
  19898. $this->stabilityFlags = $stabilityFlags;
  19899. }
  19900. public function getStabilityFlags()
  19901. {
  19902. return $this->stabilityFlags;
  19903. }
  19904. public function setPreferStable($preferStable)
  19905. {
  19906. $this->preferStable = $preferStable;
  19907. }
  19908. public function getPreferStable()
  19909. {
  19910. return $this->preferStable;
  19911. }
  19912. public function setConfig(array $config)
  19913. {
  19914. $this->config = $config;
  19915. }
  19916. public function getConfig()
  19917. {
  19918. return $this->config;
  19919. }
  19920. public function setReferences(array $references)
  19921. {
  19922. $this->references = $references;
  19923. }
  19924. public function getReferences()
  19925. {
  19926. return $this->references;
  19927. }
  19928. public function setAliases(array $aliases)
  19929. {
  19930. $this->aliases = $aliases;
  19931. }
  19932. public function getAliases()
  19933. {
  19934. return $this->aliases;
  19935. }
  19936. }
  19937. <?php
  19938. namespace Composer\Package;
  19939. interface RootPackageInterface extends CompletePackageInterface
  19940. {
  19941. public function getAliases();
  19942. public function getMinimumStability();
  19943. public function getStabilityFlags();
  19944. public function getReferences();
  19945. public function getPreferStable();
  19946. public function getConfig();
  19947. public function setRequires(array $requires);
  19948. public function setDevRequires(array $devRequires);
  19949. public function setConflicts(array $conflicts);
  19950. public function setProvides(array $provides);
  19951. public function setReplaces(array $replaces);
  19952. public function setRepositories($repositories);
  19953. public function setAutoload(array $autoload);
  19954. public function setDevAutoload(array $devAutoload);
  19955. public function setStabilityFlags(array $stabilityFlags);
  19956. public function setSuggests(array $suggests);
  19957. public function setExtra(array $extra);
  19958. }
  19959. <?php
  19960. namespace Composer\Package\Version;
  19961. use Composer\Config;
  19962. use Composer\Repository\Vcs\HgDriver;
  19963. use Composer\IO\NullIO;
  19964. use Composer\Semver\VersionParser as SemverVersionParser;
  19965. use Composer\Util\Git as GitUtil;
  19966. use Composer\Util\ProcessExecutor;
  19967. use Composer\Util\Svn as SvnUtil;
  19968. class VersionGuesser
  19969. {
  19970. private $config;
  19971. private $process;
  19972. private $versionParser;
  19973. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19974. {
  19975. $this->config = $config;
  19976. $this->process = $process;
  19977. $this->versionParser = $versionParser;
  19978. }
  19979. public function guessVersion(array $packageConfig, $path)
  19980. {
  19981. if (!function_exists('proc_open')) {
  19982. return null;
  19983. }
  19984. $versionData = $this->guessGitVersion($packageConfig, $path);
  19985. if (null !== $versionData && null !== $versionData['version']) {
  19986. return $this->postprocess($versionData);
  19987. }
  19988. $versionData = $this->guessHgVersion($packageConfig, $path);
  19989. if (null !== $versionData && null !== $versionData['version']) {
  19990. return $this->postprocess($versionData);
  19991. }
  19992. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19993. if (null !== $versionData && null !== $versionData['version']) {
  19994. return $this->postprocess($versionData);
  19995. }
  19996. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19997. if (null !== $versionData && null !== $versionData['version']) {
  19998. return $this->postprocess($versionData);
  19999. }
  20000. return null;
  20001. }
  20002. private function postprocess(array $versionData)
  20003. {
  20004. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['feature_pretty_version']) {
  20005. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  20006. }
  20007. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  20008. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  20009. }
  20010. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && preg_match('{\.9{7}}', $versionData['feature_version'])) {
  20011. $versionData['feature_pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  20012. }
  20013. return $versionData;
  20014. }
  20015. private function guessGitVersion(array $packageConfig, $path)
  20016. {
  20017. GitUtil::cleanEnv();
  20018. $commit = null;
  20019. $version = null;
  20020. $prettyVersion = null;
  20021. $featureVersion = null;
  20022. $featurePrettyVersion = null;
  20023. $isDetached = false;
  20024. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  20025. $branches = array();
  20026. $isFeatureBranch = false;
  20027. foreach ($this->process->splitLines($output) as $branch) {
  20028. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20029. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  20030. $version = 'dev-' . $match[2];
  20031. $prettyVersion = $version;
  20032. $isFeatureBranch = true;
  20033. $isDetached = true;
  20034. } else {
  20035. $version = $this->versionParser->normalizeBranch($match[1]);
  20036. $prettyVersion = 'dev-' . $match[1];
  20037. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20038. }
  20039. if ($match[2]) {
  20040. $commit = $match[2];
  20041. }
  20042. }
  20043. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  20044. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20045. $branches[] = $match[1];
  20046. }
  20047. }
  20048. }
  20049. if ($isFeatureBranch) {
  20050. $featureVersion = $version;
  20051. $featurePrettyVersion = $prettyVersion;
  20052. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  20053. $version = $result['version'];
  20054. $prettyVersion = $result['pretty_version'];
  20055. }
  20056. }
  20057. if (!$version || $isDetached) {
  20058. $result = $this->versionFromGitTags($path);
  20059. if ($result) {
  20060. $version = $result['version'];
  20061. $prettyVersion = $result['pretty_version'];
  20062. $featureVersion = null;
  20063. $featurePrettyVersion = null;
  20064. }
  20065. }
  20066. if (!$commit) {
  20067. $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
  20068. if (0 === $this->process->execute($command, $output, $path)) {
  20069. $commit = trim($output) ?: null;
  20070. }
  20071. }
  20072. if ($featureVersion) {
  20073. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion);
  20074. }
  20075. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  20076. }
  20077. private function versionFromGitTags($path)
  20078. {
  20079. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  20080. try {
  20081. $version = $this->versionParser->normalize(trim($output));
  20082. return array('version' => $version, 'pretty_version' => trim($output));
  20083. } catch (\Exception $e) {
  20084. }
  20085. }
  20086. return null;
  20087. }
  20088. private function guessHgVersion(array $packageConfig, $path)
  20089. {
  20090. if (0 === $this->process->execute('hg branch', $output, $path)) {
  20091. $branch = trim($output);
  20092. $version = $this->versionParser->normalizeBranch($branch);
  20093. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20094. if ('9999999-dev' === $version) {
  20095. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  20096. }
  20097. if (!$isFeatureBranch) {
  20098. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  20099. }
  20100. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  20101. $branches = array_keys($driver->getBranches());
  20102. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  20103. $result['commit'] = '';
  20104. $result['feature_version'] = $version;
  20105. $result['feature_pretty_version'] = $version;
  20106. return $result;
  20107. }
  20108. }
  20109. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  20110. {
  20111. $prettyVersion = $version;
  20112. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  20113. || strpos(json_encode($packageConfig), '"self.version"')
  20114. ) {
  20115. $branch = preg_replace('{^dev-}', '', $version);
  20116. $length = PHP_INT_MAX;
  20117. $nonFeatureBranches = '';
  20118. if (!empty($packageConfig['non-feature-branches'])) {
  20119. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  20120. }
  20121. foreach ($branches as $candidate) {
  20122. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  20123. break;
  20124. }
  20125. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  20126. continue;
  20127. }
  20128. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  20129. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  20130. continue;
  20131. }
  20132. if (strlen($output) < $length) {
  20133. $length = strlen($output);
  20134. $version = $this->versionParser->normalizeBranch($candidate);
  20135. $prettyVersion = 'dev-' . $match[1];
  20136. }
  20137. }
  20138. }
  20139. return array('version' => $version, 'pretty_version' => $prettyVersion);
  20140. }
  20141. private function guessFossilVersion(array $packageConfig, $path)
  20142. {
  20143. $version = null;
  20144. $prettyVersion = null;
  20145. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  20146. $branch = trim($output);
  20147. $version = $this->versionParser->normalizeBranch($branch);
  20148. $prettyVersion = 'dev-' . $branch;
  20149. }
  20150. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  20151. try {
  20152. $version = $this->versionParser->normalize(trim($output));
  20153. $prettyVersion = trim($output);
  20154. } catch (\Exception $e) {
  20155. }
  20156. }
  20157. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20158. }
  20159. private function guessSvnVersion(array $packageConfig, $path)
  20160. {
  20161. SvnUtil::cleanEnv();
  20162. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  20163. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  20164. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  20165. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  20166. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  20167. if (preg_match($urlPattern, $output, $matches)) {
  20168. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  20169. $version = $this->versionParser->normalizeBranch($matches[3]);
  20170. $prettyVersion = 'dev-' . $matches[3];
  20171. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20172. }
  20173. $prettyVersion = trim($matches[1]);
  20174. $version = $this->versionParser->normalize($prettyVersion);
  20175. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20176. }
  20177. }
  20178. }
  20179. }
  20180. <?php
  20181. namespace Composer\Package\Version;
  20182. use Composer\Repository\PlatformRepository;
  20183. use Composer\Semver\VersionParser as SemverVersionParser;
  20184. use Composer\Semver\Semver;
  20185. class VersionParser extends SemverVersionParser
  20186. {
  20187. private static $constraints = array();
  20188. public function parseConstraints($constraints)
  20189. {
  20190. if (!isset(self::$constraints[$constraints])) {
  20191. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  20192. }
  20193. return self::$constraints[$constraints];
  20194. }
  20195. public function parseNameVersionPairs(array $pairs)
  20196. {
  20197. $pairs = array_values($pairs);
  20198. $result = array();
  20199. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  20200. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  20201. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  20202. $pair .= ' '.$pairs[$i + 1];
  20203. $i++;
  20204. }
  20205. if (strpos($pair, ' ')) {
  20206. list($name, $version) = explode(' ', $pair, 2);
  20207. $result[] = array('name' => $name, 'version' => $version);
  20208. } else {
  20209. $result[] = array('name' => $pair);
  20210. }
  20211. }
  20212. return $result;
  20213. }
  20214. public static function isUpgrade($normalizedFrom, $normalizedTo)
  20215. {
  20216. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  20217. return true;
  20218. }
  20219. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  20220. return $sorted[0] === $normalizedFrom;
  20221. }
  20222. }
  20223. <?php
  20224. namespace Composer\Package\Version;
  20225. use Composer\DependencyResolver\Pool;
  20226. use Composer\Package\BasePackage;
  20227. use Composer\Package\PackageInterface;
  20228. use Composer\Plugin\PluginInterface;
  20229. use Composer\Composer;
  20230. use Composer\Package\Loader\ArrayLoader;
  20231. use Composer\Package\Dumper\ArrayDumper;
  20232. use Composer\Semver\Constraint\Constraint;
  20233. class VersionSelector
  20234. {
  20235. private $pool;
  20236. private $parser;
  20237. public function __construct(Pool $pool)
  20238. {
  20239. $this->pool = $pool;
  20240. }
  20241. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  20242. {
  20243. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  20244. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  20245. if ($targetPhpVersion) {
  20246. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  20247. $composerRuntimeConstraint = new Constraint('==', $this->getParser()->normalize(Composer::RUNTIME_API_VERSION));
  20248. $composerPluginConstraint = new Constraint('==', $this->getParser()->normalize(PluginInterface::PLUGIN_API_VERSION));
  20249. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint, $composerPluginConstraint, $composerRuntimeConstraint) {
  20250. $reqs = $pkg->getRequires();
  20251. return (!isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint))
  20252. && (!isset($reqs['composer-plugin-api']) || $reqs['composer-plugin-api']->getConstraint()->matches($composerPluginConstraint))
  20253. && (!isset($reqs['composer-runtime-api']) || $reqs['composer-runtime-api']->getConstraint()->matches($composerRuntimeConstraint));
  20254. });
  20255. }
  20256. if (!$candidates) {
  20257. return false;
  20258. }
  20259. $package = reset($candidates);
  20260. $minPriority = BasePackage::$stabilities[$preferredStability];
  20261. foreach ($candidates as $candidate) {
  20262. $candidatePriority = $candidate->getStabilityPriority();
  20263. $currentPriority = $package->getStabilityPriority();
  20264. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  20265. continue;
  20266. }
  20267. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  20268. $package = $candidate;
  20269. continue;
  20270. }
  20271. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  20272. $package = $candidate;
  20273. continue;
  20274. }
  20275. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  20276. $package = $candidate;
  20277. }
  20278. }
  20279. return $package;
  20280. }
  20281. public function findRecommendedRequireVersion(PackageInterface $package)
  20282. {
  20283. $version = $package->getVersion();
  20284. if (!$package->isDev()) {
  20285. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  20286. }
  20287. $loader = new ArrayLoader($this->getParser());
  20288. $dumper = new ArrayDumper();
  20289. $extra = $loader->getBranchAlias($dumper->dump($package));
  20290. if ($extra) {
  20291. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  20292. if ($count) {
  20293. $extra = str_replace('.9999999', '.0', $extra);
  20294. return $this->transformVersion($extra, $extra, 'dev');
  20295. }
  20296. }
  20297. return $package->getPrettyVersion();
  20298. }
  20299. private function transformVersion($version, $prettyVersion, $stability)
  20300. {
  20301. $semanticVersionParts = explode('.', $version);
  20302. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  20303. if ($semanticVersionParts[0] === '0') {
  20304. unset($semanticVersionParts[3]);
  20305. } else {
  20306. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  20307. }
  20308. $version = implode('.', $semanticVersionParts);
  20309. } else {
  20310. return $prettyVersion;
  20311. }
  20312. if ($stability != 'stable') {
  20313. $version .= '@'.$stability;
  20314. }
  20315. return '^' . $version;
  20316. }
  20317. private function getParser()
  20318. {
  20319. if ($this->parser === null) {
  20320. $this->parser = new VersionParser();
  20321. }
  20322. return $this->parser;
  20323. }
  20324. }
  20325. <?php
  20326. namespace Composer\Plugin\Capability;
  20327. interface Capability
  20328. {
  20329. }
  20330. <?php
  20331. namespace Composer\Plugin\Capability;
  20332. interface CommandProvider extends Capability
  20333. {
  20334. public function getCommands();
  20335. }
  20336. <?php
  20337. namespace Composer\Plugin;
  20338. interface Capable
  20339. {
  20340. public function getCapabilities();
  20341. }
  20342. <?php
  20343. namespace Composer\Plugin;
  20344. use Composer\EventDispatcher\Event;
  20345. use Symfony\Component\Console\Input\InputInterface;
  20346. use Symfony\Component\Console\Output\OutputInterface;
  20347. class CommandEvent extends Event
  20348. {
  20349. private $commandName;
  20350. private $input;
  20351. private $output;
  20352. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  20353. {
  20354. parent::__construct($name, $args, $flags);
  20355. $this->commandName = $commandName;
  20356. $this->input = $input;
  20357. $this->output = $output;
  20358. }
  20359. public function getInput()
  20360. {
  20361. return $this->input;
  20362. }
  20363. public function getOutput()
  20364. {
  20365. return $this->output;
  20366. }
  20367. public function getCommandName()
  20368. {
  20369. return $this->commandName;
  20370. }
  20371. }
  20372. <?php
  20373. namespace Composer\Plugin;
  20374. class PluginEvents
  20375. {
  20376. const INIT = 'init';
  20377. const COMMAND = 'command';
  20378. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  20379. const PRE_COMMAND_RUN = 'pre-command-run';
  20380. }
  20381. <?php
  20382. namespace Composer\Plugin;
  20383. use Composer\Composer;
  20384. use Composer\IO\IOInterface;
  20385. interface PluginInterface
  20386. {
  20387. const PLUGIN_API_VERSION = '1.1.0';
  20388. public function activate(Composer $composer, IOInterface $io);
  20389. }
  20390. <?php
  20391. namespace Composer\Plugin;
  20392. use Composer\Composer;
  20393. use Composer\EventDispatcher\EventSubscriberInterface;
  20394. use Composer\IO\IOInterface;
  20395. use Composer\Package\CompletePackage;
  20396. use Composer\Package\Package;
  20397. use Composer\Package\Version\VersionParser;
  20398. use Composer\Repository\RepositoryInterface;
  20399. use Composer\Package\PackageInterface;
  20400. use Composer\Package\Link;
  20401. use Composer\Semver\Constraint\Constraint;
  20402. use Composer\DependencyResolver\Pool;
  20403. use Composer\Plugin\Capability\Capability;
  20404. use Composer\Util\PackageSorter;
  20405. class PluginManager
  20406. {
  20407. protected $composer;
  20408. protected $io;
  20409. protected $globalComposer;
  20410. protected $versionParser;
  20411. protected $disablePlugins = false;
  20412. protected $plugins = array();
  20413. protected $registeredPlugins = array();
  20414. private static $classCounter = 0;
  20415. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  20416. {
  20417. $this->io = $io;
  20418. $this->composer = $composer;
  20419. $this->globalComposer = $globalComposer;
  20420. $this->versionParser = new VersionParser();
  20421. $this->disablePlugins = $disablePlugins;
  20422. }
  20423. public function loadInstalledPlugins()
  20424. {
  20425. if ($this->disablePlugins) {
  20426. return;
  20427. }
  20428. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  20429. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20430. if ($repo) {
  20431. $this->loadRepository($repo);
  20432. }
  20433. if ($globalRepo) {
  20434. $this->loadRepository($globalRepo);
  20435. }
  20436. }
  20437. public function getPlugins()
  20438. {
  20439. return $this->plugins;
  20440. }
  20441. public function getGlobalComposer()
  20442. {
  20443. return $this->globalComposer;
  20444. }
  20445. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  20446. {
  20447. if ($this->disablePlugins) {
  20448. return;
  20449. }
  20450. if ($package->getType() === 'composer-plugin') {
  20451. $requiresComposer = null;
  20452. foreach ($package->getRequires() as $link) {
  20453. if ('composer-plugin-api' === $link->getTarget()) {
  20454. $requiresComposer = $link->getConstraint();
  20455. break;
  20456. }
  20457. }
  20458. if (!$requiresComposer) {
  20459. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  20460. }
  20461. $currentPluginApiVersion = $this->getPluginApiVersion();
  20462. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  20463. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  20464. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  20465. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  20466. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin 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>');
  20467. return;
  20468. }
  20469. }
  20470. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  20471. if (in_array($package->getName(), $this->registeredPlugins)) {
  20472. return;
  20473. }
  20474. $extra = $package->getExtra();
  20475. if (empty($extra['class'])) {
  20476. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  20477. }
  20478. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  20479. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  20480. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20481. $pool = new Pool('dev');
  20482. $pool->addRepository($localRepo);
  20483. if ($globalRepo) {
  20484. $pool->addRepository($globalRepo);
  20485. }
  20486. $autoloadPackages = array($package->getName() => $package);
  20487. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  20488. $generator = $this->composer->getAutoloadGenerator();
  20489. $autoloads = array();
  20490. foreach ($autoloadPackages as $autoloadPackage) {
  20491. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  20492. $autoloads[] = array($autoloadPackage, $downloadPath);
  20493. }
  20494. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  20495. $classLoader = $generator->createLoader($map);
  20496. $classLoader->register();
  20497. foreach ($classes as $class) {
  20498. if (class_exists($class, false)) {
  20499. $class = trim($class, '\\');
  20500. $path = $classLoader->findFile($class);
  20501. $code = file_get_contents($path);
  20502. $separatorPos = strrpos($class, '\\');
  20503. $className = $class;
  20504. if ($separatorPos) {
  20505. $className = substr($class, $separatorPos + 1);
  20506. }
  20507. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  20508. $code = str_replace('__FILE__', var_export($path, true), $code);
  20509. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  20510. $code = str_replace('__CLASS__', var_export($class, true), $code);
  20511. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  20512. eval($code);
  20513. $class .= '_composer_tmp'.self::$classCounter;
  20514. self::$classCounter++;
  20515. }
  20516. if ($oldInstallerPlugin) {
  20517. $installer = new $class($this->io, $this->composer);
  20518. $this->composer->getInstallationManager()->addInstaller($installer);
  20519. } elseif (class_exists($class)) {
  20520. $plugin = new $class();
  20521. $this->addPlugin($plugin);
  20522. $this->registeredPlugins[] = $package->getName();
  20523. } elseif ($failOnMissingClasses) {
  20524. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  20525. }
  20526. }
  20527. }
  20528. protected function getPluginApiVersion()
  20529. {
  20530. return PluginInterface::PLUGIN_API_VERSION;
  20531. }
  20532. public function addPlugin(PluginInterface $plugin)
  20533. {
  20534. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  20535. $this->plugins[] = $plugin;
  20536. $plugin->activate($this->composer, $this->io);
  20537. if ($plugin instanceof EventSubscriberInterface) {
  20538. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  20539. }
  20540. }
  20541. private function loadRepository(RepositoryInterface $repo)
  20542. {
  20543. $packages = $repo->getPackages();
  20544. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  20545. foreach ($sortedPackages as $package) {
  20546. if (!($package instanceof CompletePackage)) {
  20547. continue;
  20548. }
  20549. if ('composer-plugin' === $package->getType()) {
  20550. $this->registerPackage($package);
  20551. } elseif ('composer-installer' === $package->getType()) {
  20552. $this->registerPackage($package);
  20553. }
  20554. }
  20555. }
  20556. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  20557. {
  20558. $requires = array_merge(
  20559. $package->getRequires(),
  20560. $package->getDevRequires()
  20561. );
  20562. foreach ($requires as $requireLink) {
  20563. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  20564. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  20565. $collected[$requiredPackage->getName()] = $requiredPackage;
  20566. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  20567. }
  20568. }
  20569. return $collected;
  20570. }
  20571. private function lookupInstalledPackage(Pool $pool, Link $link)
  20572. {
  20573. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  20574. return !empty($packages) ? $packages[0] : null;
  20575. }
  20576. private function getInstallPath(PackageInterface $package, $global = false)
  20577. {
  20578. if (!$global) {
  20579. return $this->composer->getInstallationManager()->getInstallPath($package);
  20580. }
  20581. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  20582. }
  20583. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  20584. {
  20585. if (!($plugin instanceof Capable)) {
  20586. return null;
  20587. }
  20588. $capabilities = (array) $plugin->getCapabilities();
  20589. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  20590. return trim($capabilities[$capability]);
  20591. }
  20592. if (
  20593. array_key_exists($capability, $capabilities)
  20594. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  20595. ) {
  20596. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  20597. }
  20598. }
  20599. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  20600. {
  20601. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  20602. if (!class_exists($capabilityClass)) {
  20603. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  20604. }
  20605. $ctorArgs['plugin'] = $plugin;
  20606. $capabilityObj = new $capabilityClass($ctorArgs);
  20607. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  20608. throw new \RuntimeException(
  20609. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  20610. );
  20611. }
  20612. return $capabilityObj;
  20613. }
  20614. }
  20615. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  20616. {
  20617. $capabilities = array();
  20618. foreach ($this->getPlugins() as $plugin) {
  20619. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  20620. $capabilities[] = $capability;
  20621. }
  20622. }
  20623. return $capabilities;
  20624. }
  20625. }
  20626. <?php
  20627. namespace Composer\Plugin;
  20628. use Composer\EventDispatcher\Event;
  20629. use Symfony\Component\Console\Input\InputInterface;
  20630. class PreCommandRunEvent extends Event
  20631. {
  20632. private $input;
  20633. private $command;
  20634. public function __construct($name, InputInterface $input, $command)
  20635. {
  20636. parent::__construct($name);
  20637. $this->input = $input;
  20638. $this->command = $command;
  20639. }
  20640. public function getInput()
  20641. {
  20642. return $this->input;
  20643. }
  20644. public function getCommand()
  20645. {
  20646. return $this->command;
  20647. }
  20648. }
  20649. <?php
  20650. namespace Composer\Plugin;
  20651. use Composer\EventDispatcher\Event;
  20652. use Composer\Util\RemoteFilesystem;
  20653. class PreFileDownloadEvent extends Event
  20654. {
  20655. private $rfs;
  20656. private $processedUrl;
  20657. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  20658. {
  20659. parent::__construct($name);
  20660. $this->rfs = $rfs;
  20661. $this->processedUrl = $processedUrl;
  20662. }
  20663. public function getRemoteFilesystem()
  20664. {
  20665. return $this->rfs;
  20666. }
  20667. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  20668. {
  20669. $this->rfs = $rfs;
  20670. }
  20671. public function getProcessedUrl()
  20672. {
  20673. return $this->processedUrl;
  20674. }
  20675. }
  20676. <?php
  20677. namespace Composer\Question;
  20678. use Symfony\Component\Console\Exception\InvalidArgumentException;
  20679. use Symfony\Component\Console\Question\Question;
  20680. class StrictConfirmationQuestion extends Question
  20681. {
  20682. private $trueAnswerRegex;
  20683. private $falseAnswerRegex;
  20684. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  20685. {
  20686. parent::__construct($question, (bool) $default);
  20687. $this->trueAnswerRegex = $trueAnswerRegex;
  20688. $this->falseAnswerRegex = $falseAnswerRegex;
  20689. $this->setNormalizer($this->getDefaultNormalizer());
  20690. $this->setValidator($this->getDefaultValidator());
  20691. }
  20692. private function getDefaultNormalizer()
  20693. {
  20694. $default = $this->getDefault();
  20695. $trueRegex = $this->trueAnswerRegex;
  20696. $falseRegex = $this->falseAnswerRegex;
  20697. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  20698. if (is_bool($answer)) {
  20699. return $answer;
  20700. }
  20701. if (empty($answer) && !empty($default)) {
  20702. return $default;
  20703. }
  20704. if (preg_match($trueRegex, $answer)) {
  20705. return true;
  20706. }
  20707. if (preg_match($falseRegex, $answer)) {
  20708. return false;
  20709. }
  20710. return null;
  20711. };
  20712. }
  20713. private function getDefaultValidator()
  20714. {
  20715. return function ($answer) {
  20716. if (!is_bool($answer)) {
  20717. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  20718. }
  20719. return $answer;
  20720. };
  20721. }
  20722. }
  20723. <?php
  20724. namespace Composer\Repository;
  20725. use Composer\Package\AliasPackage;
  20726. use Composer\Package\PackageInterface;
  20727. use Composer\Package\CompletePackageInterface;
  20728. use Composer\Package\Version\VersionParser;
  20729. use Composer\Semver\Constraint\ConstraintInterface;
  20730. use Composer\Semver\Constraint\Constraint;
  20731. class ArrayRepository extends BaseRepository
  20732. {
  20733. protected $packages;
  20734. protected $packageMap;
  20735. public function __construct(array $packages = array())
  20736. {
  20737. foreach ($packages as $package) {
  20738. $this->addPackage($package);
  20739. }
  20740. }
  20741. public function findPackage($name, $constraint)
  20742. {
  20743. $name = strtolower($name);
  20744. if (!$constraint instanceof ConstraintInterface) {
  20745. $versionParser = new VersionParser();
  20746. $constraint = $versionParser->parseConstraints($constraint);
  20747. }
  20748. foreach ($this->getPackages() as $package) {
  20749. if ($name === $package->getName()) {
  20750. $pkgConstraint = new Constraint('==', $package->getVersion());
  20751. if ($constraint->matches($pkgConstraint)) {
  20752. return $package;
  20753. }
  20754. }
  20755. }
  20756. return null;
  20757. }
  20758. public function findPackages($name, $constraint = null)
  20759. {
  20760. $name = strtolower($name);
  20761. $packages = array();
  20762. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20763. $versionParser = new VersionParser();
  20764. $constraint = $versionParser->parseConstraints($constraint);
  20765. }
  20766. foreach ($this->getPackages() as $package) {
  20767. if ($name === $package->getName()) {
  20768. $pkgConstraint = new Constraint('==', $package->getVersion());
  20769. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20770. $packages[] = $package;
  20771. }
  20772. }
  20773. }
  20774. return $packages;
  20775. }
  20776. public function search($query, $mode = 0, $type = null)
  20777. {
  20778. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20779. $matches = array();
  20780. foreach ($this->getPackages() as $package) {
  20781. $name = $package->getName();
  20782. if (isset($matches[$name])) {
  20783. continue;
  20784. }
  20785. if (preg_match($regex, $name)
  20786. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  20787. ) {
  20788. if (null !== $type && $package->getType() !== $type) {
  20789. continue;
  20790. }
  20791. $matches[$name] = array(
  20792. 'name' => $package->getPrettyName(),
  20793. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  20794. );
  20795. }
  20796. }
  20797. return array_values($matches);
  20798. }
  20799. public function hasPackage(PackageInterface $package)
  20800. {
  20801. if ($this->packageMap === null) {
  20802. $this->packageMap = array();
  20803. foreach ($this->getPackages() as $repoPackage) {
  20804. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  20805. }
  20806. }
  20807. return isset($this->packageMap[$package->getUniqueName()]);
  20808. }
  20809. public function addPackage(PackageInterface $package)
  20810. {
  20811. if (null === $this->packages) {
  20812. $this->initialize();
  20813. }
  20814. $package->setRepository($this);
  20815. $this->packages[] = $package;
  20816. if ($package instanceof AliasPackage) {
  20817. $aliasedPackage = $package->getAliasOf();
  20818. if (null === $aliasedPackage->getRepository()) {
  20819. $this->addPackage($aliasedPackage);
  20820. }
  20821. }
  20822. $this->packageMap = null;
  20823. }
  20824. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20825. {
  20826. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20827. }
  20828. public function removePackage(PackageInterface $package)
  20829. {
  20830. $packageId = $package->getUniqueName();
  20831. foreach ($this->getPackages() as $key => $repoPackage) {
  20832. if ($packageId === $repoPackage->getUniqueName()) {
  20833. array_splice($this->packages, $key, 1);
  20834. $this->packageMap = null;
  20835. return;
  20836. }
  20837. }
  20838. }
  20839. public function getPackages()
  20840. {
  20841. if (null === $this->packages) {
  20842. $this->initialize();
  20843. }
  20844. return $this->packages;
  20845. }
  20846. public function count()
  20847. {
  20848. return count($this->packages);
  20849. }
  20850. protected function initialize()
  20851. {
  20852. $this->packages = array();
  20853. }
  20854. }
  20855. <?php
  20856. namespace Composer\Repository;
  20857. use Composer\IO\IOInterface;
  20858. use Composer\Json\JsonFile;
  20859. use Composer\Package\Loader\ArrayLoader;
  20860. use Composer\Package\Loader\LoaderInterface;
  20861. use Composer\Util\Zip;
  20862. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20863. {
  20864. protected $loader;
  20865. protected $lookup;
  20866. protected $repoConfig;
  20867. private $io;
  20868. public function __construct(array $repoConfig, IOInterface $io)
  20869. {
  20870. parent::__construct();
  20871. if (!extension_loaded('zip')) {
  20872. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20873. }
  20874. $this->loader = new ArrayLoader();
  20875. $this->lookup = $repoConfig['url'];
  20876. $this->io = $io;
  20877. $this->repoConfig = $repoConfig;
  20878. }
  20879. public function getRepoConfig()
  20880. {
  20881. return $this->repoConfig;
  20882. }
  20883. protected function initialize()
  20884. {
  20885. parent::initialize();
  20886. $this->scanDirectory($this->lookup);
  20887. }
  20888. private function scanDirectory($path)
  20889. {
  20890. $io = $this->io;
  20891. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20892. $iterator = new \RecursiveIteratorIterator($directory);
  20893. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20894. foreach ($regex as $file) {
  20895. if (!$file->isFile()) {
  20896. continue;
  20897. }
  20898. $package = $this->getComposerInformation($file);
  20899. if (!$package) {
  20900. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20901. continue;
  20902. }
  20903. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20904. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20905. $this->addPackage($package);
  20906. }
  20907. }
  20908. private function getComposerInformation(\SplFileInfo $file)
  20909. {
  20910. $json = Zip::getComposerJson($file->getPathname());
  20911. if (null === $json) {
  20912. return false;
  20913. }
  20914. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20915. $package['dist'] = array(
  20916. 'type' => 'zip',
  20917. 'url' => strtr($file->getPathname(), '\\', '/'),
  20918. 'shasum' => sha1_file($file->getRealPath()),
  20919. );
  20920. try {
  20921. $package = $this->loader->load($package);
  20922. } catch (\UnexpectedValueException $e) {
  20923. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20924. }
  20925. return $package;
  20926. }
  20927. }
  20928. <?php
  20929. namespace Composer\Repository;
  20930. use Composer\Package\RootPackageInterface;
  20931. use Composer\Semver\Constraint\ConstraintInterface;
  20932. use Composer\Semver\Constraint\Constraint;
  20933. use Composer\Package\Link;
  20934. abstract class BaseRepository implements RepositoryInterface
  20935. {
  20936. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20937. {
  20938. $needles = array_map('strtolower', (array) $needle);
  20939. $results = array();
  20940. if (null === $packagesFound) {
  20941. $packagesFound = $needles;
  20942. }
  20943. $rootPackage = null;
  20944. foreach ($this->getPackages() as $package) {
  20945. if ($package instanceof RootPackageInterface) {
  20946. $rootPackage = $package;
  20947. break;
  20948. }
  20949. }
  20950. foreach ($this->getPackages() as $package) {
  20951. $links = $package->getRequires();
  20952. $packagesInTree = $packagesFound;
  20953. if (!$invert) {
  20954. $links += $package->getReplaces();
  20955. foreach ($package->getReplaces() as $link) {
  20956. foreach ($needles as $needle) {
  20957. if ($link->getSource() === $needle) {
  20958. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20959. if (in_array($link->getTarget(), $packagesInTree)) {
  20960. $results[] = array($package, $link, false);
  20961. continue;
  20962. }
  20963. $packagesInTree[] = $link->getTarget();
  20964. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  20965. $results[] = array($package, $link, $dependents);
  20966. $needles[] = $link->getTarget();
  20967. }
  20968. }
  20969. }
  20970. }
  20971. }
  20972. if ($package instanceof RootPackageInterface) {
  20973. $links += $package->getDevRequires();
  20974. }
  20975. foreach ($links as $link) {
  20976. foreach ($needles as $needle) {
  20977. if ($link->getTarget() === $needle) {
  20978. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20979. if (in_array($link->getSource(), $packagesInTree)) {
  20980. $results[] = array($package, $link, false);
  20981. continue;
  20982. }
  20983. $packagesInTree[] = $link->getSource();
  20984. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20985. $results[] = array($package, $link, $dependents);
  20986. }
  20987. }
  20988. }
  20989. }
  20990. if ($invert && in_array($package->getName(), $needles)) {
  20991. foreach ($package->getConflicts() as $link) {
  20992. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20993. $version = new Constraint('=', $pkg->getVersion());
  20994. if ($link->getConstraint()->matches($version) === $invert) {
  20995. $results[] = array($package, $link, false);
  20996. }
  20997. }
  20998. }
  20999. }
  21000. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  21001. foreach ($package->getRequires() as $link) {
  21002. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  21003. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  21004. continue;
  21005. }
  21006. $platformPkg = $this->findPackage($link->getTarget(), '*');
  21007. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  21008. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  21009. continue;
  21010. }
  21011. foreach ($this->getPackages() as $pkg) {
  21012. if (!in_array($link->getTarget(), $pkg->getNames())) {
  21013. continue;
  21014. }
  21015. $version = new Constraint('=', $pkg->getVersion());
  21016. if (!$link->getConstraint()->matches($version)) {
  21017. if ($rootPackage) {
  21018. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  21019. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  21020. $results[] = array($package, $link, false);
  21021. $results[] = array($rootPackage, $rootReq, false);
  21022. continue 3;
  21023. }
  21024. }
  21025. $results[] = array($package, $link, false);
  21026. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  21027. } else {
  21028. $results[] = array($package, $link, false);
  21029. }
  21030. }
  21031. continue 2;
  21032. }
  21033. }
  21034. }
  21035. }
  21036. ksort($results);
  21037. return $results;
  21038. }
  21039. }
  21040. <?php
  21041. namespace Composer\Repository;
  21042. use Composer\Package\Loader\ArrayLoader;
  21043. use Composer\Package\PackageInterface;
  21044. use Composer\Package\AliasPackage;
  21045. use Composer\Package\Version\VersionParser;
  21046. use Composer\DependencyResolver\Pool;
  21047. use Composer\Json\JsonFile;
  21048. use Composer\Cache;
  21049. use Composer\Config;
  21050. use Composer\Composer;
  21051. use Composer\Factory;
  21052. use Composer\IO\IOInterface;
  21053. use Composer\Util\RemoteFilesystem;
  21054. use Composer\Plugin\PluginEvents;
  21055. use Composer\Plugin\PreFileDownloadEvent;
  21056. use Composer\EventDispatcher\EventDispatcher;
  21057. use Composer\Downloader\TransportException;
  21058. use Composer\Semver\Constraint\ConstraintInterface;
  21059. use Composer\Semver\Constraint\Constraint;
  21060. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21061. {
  21062. protected $config;
  21063. protected $repoConfig;
  21064. protected $options;
  21065. protected $url;
  21066. protected $baseUrl;
  21067. protected $io;
  21068. protected $rfs;
  21069. protected $cache;
  21070. protected $notifyUrl;
  21071. protected $searchUrl;
  21072. protected $hasProviders = false;
  21073. protected $providersUrl;
  21074. protected $lazyProvidersUrl;
  21075. protected $providerListing;
  21076. protected $providers = array();
  21077. protected $providersByUid = array();
  21078. protected $loader;
  21079. protected $rootAliases;
  21080. protected $allowSslDowngrade = false;
  21081. protected $eventDispatcher;
  21082. protected $sourceMirrors;
  21083. protected $distMirrors;
  21084. private $degradedMode = false;
  21085. private $rootData;
  21086. private $hasPartialPackages;
  21087. private $partialPackagesByName;
  21088. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21089. {
  21090. parent::__construct();
  21091. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  21092. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21093. }
  21094. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  21095. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  21096. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  21097. }
  21098. $urlBits = parse_url($repoConfig['url']);
  21099. if ($urlBits === false || empty($urlBits['scheme'])) {
  21100. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  21101. }
  21102. if (!isset($repoConfig['options'])) {
  21103. $repoConfig['options'] = array();
  21104. }
  21105. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  21106. $this->allowSslDowngrade = true;
  21107. }
  21108. $this->config = $config;
  21109. $this->options = $repoConfig['options'];
  21110. $this->url = $repoConfig['url'];
  21111. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  21112. $this->url = $match['proto'].'://repo.packagist.org';
  21113. }
  21114. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  21115. $this->io = $io;
  21116. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  21117. $this->loader = new ArrayLoader();
  21118. if ($rfs && $this->options) {
  21119. $rfs = clone $rfs;
  21120. $rfs->setOptions($this->options);
  21121. }
  21122. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  21123. $this->eventDispatcher = $eventDispatcher;
  21124. $this->repoConfig = $repoConfig;
  21125. }
  21126. public function getRepoConfig()
  21127. {
  21128. return $this->repoConfig;
  21129. }
  21130. public function setRootAliases(array $rootAliases)
  21131. {
  21132. $this->rootAliases = $rootAliases;
  21133. }
  21134. public function findPackage($name, $constraint)
  21135. {
  21136. if (!$this->hasProviders()) {
  21137. return parent::findPackage($name, $constraint);
  21138. }
  21139. $name = strtolower($name);
  21140. if (!$constraint instanceof ConstraintInterface) {
  21141. $versionParser = new VersionParser();
  21142. $constraint = $versionParser->parseConstraints($constraint);
  21143. }
  21144. foreach ($this->getProviderNames() as $providerName) {
  21145. if ($name === $providerName) {
  21146. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  21147. foreach ($packages as $package) {
  21148. if ($name === $package->getName()) {
  21149. $pkgConstraint = new Constraint('==', $package->getVersion());
  21150. if ($constraint->matches($pkgConstraint)) {
  21151. return $package;
  21152. }
  21153. }
  21154. }
  21155. break;
  21156. }
  21157. }
  21158. }
  21159. public function findPackages($name, $constraint = null)
  21160. {
  21161. if (!$this->hasProviders()) {
  21162. return parent::findPackages($name, $constraint);
  21163. }
  21164. $name = strtolower($name);
  21165. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  21166. $versionParser = new VersionParser();
  21167. $constraint = $versionParser->parseConstraints($constraint);
  21168. }
  21169. $packages = array();
  21170. foreach ($this->getProviderNames() as $providerName) {
  21171. if ($name === $providerName) {
  21172. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  21173. foreach ($candidates as $package) {
  21174. if ($name === $package->getName()) {
  21175. $pkgConstraint = new Constraint('==', $package->getVersion());
  21176. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  21177. $packages[] = $package;
  21178. }
  21179. }
  21180. }
  21181. break;
  21182. }
  21183. }
  21184. return $packages;
  21185. }
  21186. public function getPackages()
  21187. {
  21188. if ($this->hasProviders()) {
  21189. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  21190. }
  21191. return parent::getPackages();
  21192. }
  21193. public function search($query, $mode = 0, $type = null)
  21194. {
  21195. $this->loadRootServerFile();
  21196. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  21197. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  21198. $origin = RemoteFilesystem::getOrigin($url);
  21199. $json = $this->rfs->getContents($origin, $url, false);
  21200. $search = JsonFile::parseJson($json, $url);
  21201. if (empty($search['results'])) {
  21202. return array();
  21203. }
  21204. $results = array();
  21205. foreach ($search['results'] as $result) {
  21206. if (empty($result['virtual'])) {
  21207. $results[] = $result;
  21208. }
  21209. }
  21210. return $results;
  21211. }
  21212. if ($this->hasProviders()) {
  21213. $results = array();
  21214. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  21215. foreach ($this->getProviderNames() as $name) {
  21216. if (preg_match($regex, $name)) {
  21217. $results[] = array('name' => $name);
  21218. }
  21219. }
  21220. return $results;
  21221. }
  21222. return parent::search($query, $mode);
  21223. }
  21224. public function getProviderNames()
  21225. {
  21226. $this->loadRootServerFile();
  21227. if (null === $this->providerListing) {
  21228. $this->loadProviderListings($this->loadRootServerFile());
  21229. }
  21230. if ($this->hasPartialPackages) {
  21231. if (null === $this->partialPackagesByName) {
  21232. $this->initializePartialPackages();
  21233. }
  21234. return array_keys($this->partialPackagesByName);
  21235. }
  21236. if ($this->lazyProvidersUrl) {
  21237. return array();
  21238. }
  21239. if ($this->providersUrl) {
  21240. return array_keys($this->providerListing);
  21241. }
  21242. return array();
  21243. }
  21244. protected function configurePackageTransportOptions(PackageInterface $package)
  21245. {
  21246. foreach ($package->getDistUrls() as $url) {
  21247. if (strpos($url, $this->baseUrl) === 0) {
  21248. $package->setTransportOptions($this->options);
  21249. return;
  21250. }
  21251. }
  21252. }
  21253. public function hasProviders()
  21254. {
  21255. $this->loadRootServerFile();
  21256. return $this->hasProviders;
  21257. }
  21258. public function resetPackageIds()
  21259. {
  21260. foreach ($this->providersByUid as $package) {
  21261. if ($package instanceof AliasPackage) {
  21262. $package->getAliasOf()->setId(-1);
  21263. }
  21264. $package->setId(-1);
  21265. }
  21266. }
  21267. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  21268. {
  21269. if (isset($this->providers[$name]) && !$bypassFilters) {
  21270. return $this->providers[$name];
  21271. }
  21272. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  21273. $this->initializePartialPackages();
  21274. }
  21275. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  21276. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  21277. return array();
  21278. }
  21279. if (null === $this->providerListing) {
  21280. $this->loadProviderListings($this->loadRootServerFile());
  21281. }
  21282. $useLastModifiedCheck = false;
  21283. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  21284. $hash = null;
  21285. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  21286. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21287. $useLastModifiedCheck = true;
  21288. } elseif ($this->providersUrl) {
  21289. if (!isset($this->providerListing[$name])) {
  21290. return array();
  21291. }
  21292. $hash = $this->providerListing[$name]['sha256'];
  21293. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  21294. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21295. } else {
  21296. return array();
  21297. }
  21298. $packages = null;
  21299. if ($cacheKey) {
  21300. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  21301. $packages = json_decode($this->cache->read($cacheKey), true);
  21302. } elseif ($useLastModifiedCheck) {
  21303. if ($contents = $this->cache->read($cacheKey)) {
  21304. $contents = json_decode($contents, true);
  21305. if (isset($contents['last-modified'])) {
  21306. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  21307. if (true === $response) {
  21308. $packages = $contents;
  21309. } elseif ($response) {
  21310. $packages = $response;
  21311. }
  21312. }
  21313. }
  21314. }
  21315. }
  21316. if (!$packages) {
  21317. try {
  21318. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  21319. } catch (TransportException $e) {
  21320. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  21321. $packages = array('packages' => array());
  21322. } else {
  21323. throw $e;
  21324. }
  21325. }
  21326. }
  21327. $loadingPartialPackage = false;
  21328. } else {
  21329. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  21330. $loadingPartialPackage = true;
  21331. }
  21332. $this->providers[$name] = array();
  21333. foreach ($packages['packages'] as $versions) {
  21334. foreach ($versions as $version) {
  21335. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  21336. continue;
  21337. }
  21338. if (isset($this->providersByUid[$version['uid']])) {
  21339. if (!isset($this->providers[$name][$version['uid']])) {
  21340. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  21341. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  21342. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  21343. } else {
  21344. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  21345. }
  21346. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  21347. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  21348. }
  21349. }
  21350. } else {
  21351. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  21352. continue;
  21353. }
  21354. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  21355. $package->setRepository($this);
  21356. if ($package instanceof AliasPackage) {
  21357. $aliased = $package->getAliasOf();
  21358. $aliased->setRepository($this);
  21359. $this->providers[$name][$version['uid']] = $aliased;
  21360. $this->providers[$name][$version['uid'].'-alias'] = $package;
  21361. $this->providersByUid[$version['uid']] = $package;
  21362. } else {
  21363. $this->providers[$name][$version['uid']] = $package;
  21364. $this->providersByUid[$version['uid']] = $package;
  21365. }
  21366. unset($rootAliasData);
  21367. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  21368. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  21369. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  21370. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  21371. }
  21372. if (isset($rootAliasData)) {
  21373. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  21374. $alias->setRepository($this);
  21375. $this->providers[$name][$version['uid'].'-root'] = $alias;
  21376. $this->providersByUid[$version['uid'].'-root'] = $alias;
  21377. }
  21378. }
  21379. }
  21380. }
  21381. $result = $this->providers[$name];
  21382. if ($bypassFilters) {
  21383. foreach ($this->providers[$name] as $uid => $provider) {
  21384. unset($this->providersByUid[$uid]);
  21385. }
  21386. unset($this->providers[$name]);
  21387. }
  21388. return $result;
  21389. }
  21390. protected function initialize()
  21391. {
  21392. parent::initialize();
  21393. $repoData = $this->loadDataFromServer();
  21394. foreach ($repoData as $package) {
  21395. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  21396. }
  21397. }
  21398. public function addPackage(PackageInterface $package)
  21399. {
  21400. parent::addPackage($package);
  21401. $this->configurePackageTransportOptions($package);
  21402. }
  21403. protected function loadRootServerFile()
  21404. {
  21405. if (null !== $this->rootData) {
  21406. return $this->rootData;
  21407. }
  21408. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  21409. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  21410. }
  21411. $jsonUrlParts = parse_url($this->url);
  21412. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  21413. $jsonUrl = $this->url;
  21414. } else {
  21415. $jsonUrl = $this->url . '/packages.json';
  21416. }
  21417. $data = $this->fetchFile($jsonUrl, 'packages.json');
  21418. if (!empty($data['notify-batch'])) {
  21419. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  21420. } elseif (!empty($data['notify'])) {
  21421. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  21422. }
  21423. if (!empty($data['search'])) {
  21424. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  21425. }
  21426. if (!empty($data['mirrors'])) {
  21427. foreach ($data['mirrors'] as $mirror) {
  21428. if (!empty($mirror['git-url'])) {
  21429. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  21430. }
  21431. if (!empty($mirror['hg-url'])) {
  21432. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  21433. }
  21434. if (!empty($mirror['dist-url'])) {
  21435. $this->distMirrors[] = array(
  21436. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  21437. 'preferred' => !empty($mirror['preferred']),
  21438. );
  21439. }
  21440. }
  21441. }
  21442. if (!empty($data['providers-lazy-url'])) {
  21443. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  21444. $this->hasProviders = true;
  21445. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  21446. }
  21447. if ($this->allowSslDowngrade) {
  21448. $this->url = str_replace('https://', 'http://', $this->url);
  21449. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  21450. }
  21451. if (!empty($data['providers-url'])) {
  21452. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  21453. $this->hasProviders = true;
  21454. }
  21455. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  21456. $this->hasProviders = true;
  21457. }
  21458. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  21459. $this->url = 'https://repo.packagist.org';
  21460. $this->baseUrl = 'https://repo.packagist.org';
  21461. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  21462. $this->providersUrl = null;
  21463. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  21464. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  21465. $this->providersUrl = null;
  21466. }
  21467. return $this->rootData = $data;
  21468. }
  21469. protected function canonicalizeUrl($url)
  21470. {
  21471. if ('/' === $url[0]) {
  21472. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  21473. return $matches[0] . $url;
  21474. }
  21475. return $this->url;
  21476. }
  21477. return $url;
  21478. }
  21479. protected function loadDataFromServer()
  21480. {
  21481. $data = $this->loadRootServerFile();
  21482. return $this->loadIncludes($data);
  21483. }
  21484. protected function loadProviderListings($data)
  21485. {
  21486. if (isset($data['providers'])) {
  21487. if (!is_array($this->providerListing)) {
  21488. $this->providerListing = array();
  21489. }
  21490. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  21491. }
  21492. if ($this->providersUrl && isset($data['provider-includes'])) {
  21493. $includes = $data['provider-includes'];
  21494. foreach ($includes as $include => $metadata) {
  21495. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  21496. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  21497. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  21498. $includedData = json_decode($this->cache->read($cacheKey), true);
  21499. } else {
  21500. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  21501. }
  21502. $this->loadProviderListings($includedData);
  21503. }
  21504. }
  21505. }
  21506. protected function loadIncludes($data)
  21507. {
  21508. $packages = array();
  21509. if (!isset($data['packages']) && !isset($data['includes'])) {
  21510. foreach ($data as $pkg) {
  21511. foreach ($pkg['versions'] as $metadata) {
  21512. $packages[] = $metadata;
  21513. }
  21514. }
  21515. return $packages;
  21516. }
  21517. if (isset($data['packages'])) {
  21518. foreach ($data['packages'] as $package => $versions) {
  21519. foreach ($versions as $version => $metadata) {
  21520. $packages[] = $metadata;
  21521. }
  21522. }
  21523. }
  21524. if (isset($data['includes'])) {
  21525. foreach ($data['includes'] as $include => $metadata) {
  21526. if ($this->cache->sha1($include) === $metadata['sha1']) {
  21527. $includedData = json_decode($this->cache->read($include), true);
  21528. } else {
  21529. $includedData = $this->fetchFile($include);
  21530. }
  21531. $packages = array_merge($packages, $this->loadIncludes($includedData));
  21532. }
  21533. }
  21534. return $packages;
  21535. }
  21536. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  21537. {
  21538. try {
  21539. if (!isset($data['notification-url'])) {
  21540. $data['notification-url'] = $this->notifyUrl;
  21541. }
  21542. $package = $this->loader->load($data, $class);
  21543. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  21544. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  21545. }
  21546. $package->setDistMirrors($this->distMirrors);
  21547. $this->configurePackageTransportOptions($package);
  21548. return $package;
  21549. } catch (\Exception $e) {
  21550. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  21551. }
  21552. }
  21553. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  21554. {
  21555. if (null === $cacheKey) {
  21556. $cacheKey = $filename;
  21557. $filename = $this->baseUrl.'/'.$filename;
  21558. }
  21559. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  21560. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  21561. }
  21562. $retries = 3;
  21563. while ($retries--) {
  21564. try {
  21565. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21566. if ($this->eventDispatcher) {
  21567. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21568. }
  21569. $origin = RemoteFilesystem::getOrigin($filename);
  21570. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21571. $json = $rfs->getContents($origin, $filename, false);
  21572. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  21573. if ($this->allowSslDowngrade) {
  21574. $this->url = str_replace('http://', 'https://', $this->url);
  21575. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  21576. $filename = str_replace('http://', 'https://', $filename);
  21577. }
  21578. if ($retries) {
  21579. usleep(100000);
  21580. continue;
  21581. }
  21582. 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.');
  21583. }
  21584. $data = JsonFile::parseJson($json, $filename);
  21585. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21586. if ($cacheKey) {
  21587. if ($storeLastModifiedTime) {
  21588. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21589. if ($lastModifiedDate) {
  21590. $data['last-modified'] = $lastModifiedDate;
  21591. $json = json_encode($data);
  21592. }
  21593. }
  21594. $this->cache->write($cacheKey, $json);
  21595. }
  21596. break;
  21597. } catch (\Exception $e) {
  21598. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21599. throw $e;
  21600. }
  21601. if ($retries) {
  21602. usleep(100000);
  21603. continue;
  21604. }
  21605. if ($e instanceof RepositorySecurityException) {
  21606. throw $e;
  21607. }
  21608. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  21609. if (!$this->degradedMode) {
  21610. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21611. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  21612. }
  21613. $this->degradedMode = true;
  21614. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  21615. break;
  21616. }
  21617. throw $e;
  21618. }
  21619. }
  21620. return $data;
  21621. }
  21622. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  21623. {
  21624. $retries = 3;
  21625. while ($retries--) {
  21626. try {
  21627. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21628. if ($this->eventDispatcher) {
  21629. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21630. }
  21631. $origin = RemoteFilesystem::getOrigin($filename);
  21632. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21633. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  21634. $json = $rfs->getContents($origin, $filename, false, $options);
  21635. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  21636. return true;
  21637. }
  21638. $data = JsonFile::parseJson($json, $filename);
  21639. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21640. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21641. if ($lastModifiedDate) {
  21642. $data['last-modified'] = $lastModifiedDate;
  21643. $json = json_encode($data);
  21644. }
  21645. $this->cache->write($cacheKey, $json);
  21646. return $data;
  21647. } catch (\Exception $e) {
  21648. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21649. throw $e;
  21650. }
  21651. if ($retries) {
  21652. usleep(100000);
  21653. continue;
  21654. }
  21655. if (!$this->degradedMode) {
  21656. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21657. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  21658. }
  21659. $this->degradedMode = true;
  21660. return true;
  21661. }
  21662. }
  21663. }
  21664. private function initializePartialPackages()
  21665. {
  21666. $rootData = $this->loadRootServerFile();
  21667. $this->partialPackagesByName = array();
  21668. foreach ($rootData['packages'] as $package => $versions) {
  21669. $package = strtolower($package);
  21670. foreach ($versions as $version) {
  21671. $this->partialPackagesByName[$package][] = $version;
  21672. if (!empty($version['provide']) && is_array($version['provide'])) {
  21673. foreach ($version['provide'] as $provided => $providedVersion) {
  21674. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21675. }
  21676. }
  21677. if (!empty($version['replace']) && is_array($version['replace'])) {
  21678. foreach ($version['replace'] as $provided => $providedVersion) {
  21679. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21680. }
  21681. }
  21682. }
  21683. }
  21684. $this->rootData = true;
  21685. }
  21686. }
  21687. <?php
  21688. namespace Composer\Repository;
  21689. use Composer\Package\PackageInterface;
  21690. class CompositeRepository extends BaseRepository
  21691. {
  21692. private $repositories;
  21693. public function __construct(array $repositories)
  21694. {
  21695. $this->repositories = array();
  21696. foreach ($repositories as $repo) {
  21697. $this->addRepository($repo);
  21698. }
  21699. }
  21700. public function getRepositories()
  21701. {
  21702. return $this->repositories;
  21703. }
  21704. public function hasPackage(PackageInterface $package)
  21705. {
  21706. foreach ($this->repositories as $repository) {
  21707. if ($repository->hasPackage($package)) {
  21708. return true;
  21709. }
  21710. }
  21711. return false;
  21712. }
  21713. public function findPackage($name, $constraint)
  21714. {
  21715. foreach ($this->repositories as $repository) {
  21716. $package = $repository->findPackage($name, $constraint);
  21717. if (null !== $package) {
  21718. return $package;
  21719. }
  21720. }
  21721. return null;
  21722. }
  21723. public function findPackages($name, $constraint = null)
  21724. {
  21725. $packages = array();
  21726. foreach ($this->repositories as $repository) {
  21727. $packages[] = $repository->findPackages($name, $constraint);
  21728. }
  21729. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21730. }
  21731. public function search($query, $mode = 0, $type = null)
  21732. {
  21733. $matches = array();
  21734. foreach ($this->repositories as $repository) {
  21735. $matches[] = $repository->search($query, $mode, $type);
  21736. }
  21737. return $matches ? call_user_func_array('array_merge', $matches) : array();
  21738. }
  21739. public function getPackages()
  21740. {
  21741. $packages = array();
  21742. foreach ($this->repositories as $repository) {
  21743. $packages[] = $repository->getPackages();
  21744. }
  21745. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21746. }
  21747. public function removePackage(PackageInterface $package)
  21748. {
  21749. foreach ($this->repositories as $repository) {
  21750. $repository->removePackage($package);
  21751. }
  21752. }
  21753. public function count()
  21754. {
  21755. $total = 0;
  21756. foreach ($this->repositories as $repository) {
  21757. $total += $repository->count();
  21758. }
  21759. return $total;
  21760. }
  21761. public function addRepository(RepositoryInterface $repository)
  21762. {
  21763. if ($repository instanceof self) {
  21764. foreach ($repository->getRepositories() as $repo) {
  21765. $this->addRepository($repo);
  21766. }
  21767. } else {
  21768. $this->repositories[] = $repository;
  21769. }
  21770. }
  21771. }
  21772. <?php
  21773. namespace Composer\Repository;
  21774. interface ConfigurableRepositoryInterface
  21775. {
  21776. public function getRepoConfig();
  21777. }
  21778. <?php
  21779. namespace Composer\Repository;
  21780. use Composer\Json\JsonFile;
  21781. use Composer\Package\Loader\ArrayLoader;
  21782. use Composer\Package\Dumper\ArrayDumper;
  21783. class FilesystemRepository extends WritableArrayRepository
  21784. {
  21785. private $file;
  21786. public function __construct(JsonFile $repositoryFile)
  21787. {
  21788. parent::__construct();
  21789. $this->file = $repositoryFile;
  21790. }
  21791. protected function initialize()
  21792. {
  21793. parent::initialize();
  21794. if (!$this->file->exists()) {
  21795. return;
  21796. }
  21797. try {
  21798. $packages = $this->file->read();
  21799. if (isset($packages['packages'])) {
  21800. $packages = $packages['packages'];
  21801. }
  21802. if (!is_array($packages)) {
  21803. throw new \UnexpectedValueException('Could not parse package list from the repository');
  21804. }
  21805. } catch (\Exception $e) {
  21806. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  21807. }
  21808. $loader = new ArrayLoader(null, true);
  21809. foreach ($packages as $packageData) {
  21810. $package = $loader->load($packageData);
  21811. $this->addPackage($package);
  21812. }
  21813. }
  21814. public function reload()
  21815. {
  21816. $this->packages = null;
  21817. $this->initialize();
  21818. }
  21819. public function write()
  21820. {
  21821. $data = array();
  21822. $dumper = new ArrayDumper();
  21823. foreach ($this->getCanonicalPackages() as $package) {
  21824. $data[] = $dumper->dump($package);
  21825. }
  21826. usort($data, function ($a, $b) {
  21827. return strcmp($a['name'], $b['name']);
  21828. });
  21829. $this->file->write($data);
  21830. }
  21831. }
  21832. <?php
  21833. namespace Composer\Repository;
  21834. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21835. {
  21836. }
  21837. <?php
  21838. namespace Composer\Repository;
  21839. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21840. {
  21841. }
  21842. <?php
  21843. namespace Composer\Repository;
  21844. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21845. {
  21846. }
  21847. <?php
  21848. namespace Composer\Repository;
  21849. class InvalidRepositoryException extends \Exception
  21850. {
  21851. }
  21852. <?php
  21853. namespace Composer\Repository;
  21854. use Composer\Package\Loader\ArrayLoader;
  21855. use Composer\Package\Loader\ValidatingArrayLoader;
  21856. class PackageRepository extends ArrayRepository
  21857. {
  21858. private $config;
  21859. public function __construct(array $config)
  21860. {
  21861. parent::__construct();
  21862. $this->config = $config['package'];
  21863. if (!is_numeric(key($this->config))) {
  21864. $this->config = array($this->config);
  21865. }
  21866. }
  21867. protected function initialize()
  21868. {
  21869. parent::initialize();
  21870. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21871. foreach ($this->config as $package) {
  21872. try {
  21873. $package = $loader->load($package);
  21874. } catch (\Exception $e) {
  21875. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21876. }
  21877. $this->addPackage($package);
  21878. }
  21879. }
  21880. }
  21881. <?php
  21882. namespace Composer\Repository;
  21883. use Composer\Config;
  21884. use Composer\IO\IOInterface;
  21885. use Composer\Json\JsonFile;
  21886. use Composer\Package\Loader\ArrayLoader;
  21887. use Composer\Package\Version\VersionGuesser;
  21888. use Composer\Package\Version\VersionParser;
  21889. use Composer\Util\Platform;
  21890. use Composer\Util\ProcessExecutor;
  21891. use Composer\Util\Filesystem;
  21892. use Composer\Util\Git as GitUtil;
  21893. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21894. {
  21895. private $loader;
  21896. private $versionGuesser;
  21897. private $url;
  21898. private $repoConfig;
  21899. private $process;
  21900. private $options;
  21901. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21902. {
  21903. if (!isset($repoConfig['url'])) {
  21904. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21905. }
  21906. $this->loader = new ArrayLoader(null, true);
  21907. $this->url = Platform::expandPath($repoConfig['url']);
  21908. $this->process = new ProcessExecutor($io);
  21909. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21910. $this->repoConfig = $repoConfig;
  21911. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21912. if (!isset($this->options['relative'])) {
  21913. $filesystem = new Filesystem();
  21914. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  21915. }
  21916. parent::__construct();
  21917. }
  21918. public function getRepoConfig()
  21919. {
  21920. return $this->repoConfig;
  21921. }
  21922. protected function initialize()
  21923. {
  21924. parent::initialize();
  21925. $urlMatches = $this->getUrlMatches();
  21926. if (empty($urlMatches)) {
  21927. if (preg_match('{[*{}]}', $this->url)) {
  21928. $url = $this->url;
  21929. while (preg_match('{[*{}]}', $url)) {
  21930. $url = dirname($url);
  21931. }
  21932. if (is_dir($url)) {
  21933. return;
  21934. }
  21935. }
  21936. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  21937. }
  21938. foreach ($urlMatches as $url) {
  21939. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21940. $composerFilePath = $path.'composer.json';
  21941. if (!file_exists($composerFilePath)) {
  21942. continue;
  21943. }
  21944. $json = file_get_contents($composerFilePath);
  21945. $package = JsonFile::parseJson($json, $composerFilePath);
  21946. $package['dist'] = array(
  21947. 'type' => 'path',
  21948. 'url' => $url,
  21949. 'reference' => sha1($json . serialize($this->options)),
  21950. );
  21951. $package['transport-options'] = $this->options;
  21952. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21953. if (
  21954. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21955. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21956. && $ref1 === $ref2
  21957. ) {
  21958. $package['version'] = $rootVersion;
  21959. }
  21960. }
  21961. $output = '';
  21962. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
  21963. $package['dist']['reference'] = trim($output);
  21964. }
  21965. if (!isset($package['version'])) {
  21966. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21967. if (is_array($versionData) && $versionData['pretty_version']) {
  21968. if (!empty($versionData['feature_pretty_version'])) {
  21969. $package['version'] = $versionData['feature_pretty_version'];
  21970. $this->addPackage($this->loader->load($package));
  21971. }
  21972. $package['version'] = $versionData['pretty_version'];
  21973. } else {
  21974. $package['version'] = 'dev-master';
  21975. }
  21976. }
  21977. $package = $this->loader->load($package);
  21978. $this->addPackage($package);
  21979. }
  21980. }
  21981. private function getUrlMatches()
  21982. {
  21983. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21984. if (defined('GLOB_BRACE')) {
  21985. $flags |= GLOB_BRACE;
  21986. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21987. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21988. }
  21989. return array_map(function ($val) {
  21990. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21991. }, glob($this->url, $flags));
  21992. }
  21993. }
  21994. <?php
  21995. namespace Composer\Repository\Pear;
  21996. use Composer\Util\RemoteFilesystem;
  21997. abstract class BaseChannelReader
  21998. {
  21999. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  22000. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  22001. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  22002. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  22003. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  22004. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  22005. private $rfs;
  22006. protected function __construct(RemoteFilesystem $rfs)
  22007. {
  22008. $this->rfs = $rfs;
  22009. }
  22010. protected function requestContent($origin, $path)
  22011. {
  22012. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  22013. $content = $this->rfs->getContents($origin, $url, false);
  22014. if (!$content) {
  22015. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  22016. }
  22017. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  22018. }
  22019. protected function requestXml($origin, $path)
  22020. {
  22021. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  22022. if (false === $xml) {
  22023. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  22024. }
  22025. return $xml;
  22026. }
  22027. }
  22028. <?php
  22029. namespace Composer\Repository\Pear;
  22030. class ChannelInfo
  22031. {
  22032. private $name;
  22033. private $alias;
  22034. private $packages;
  22035. public function __construct($name, $alias, array $packages)
  22036. {
  22037. $this->name = $name;
  22038. $this->alias = $alias;
  22039. $this->packages = $packages;
  22040. }
  22041. public function getName()
  22042. {
  22043. return $this->name;
  22044. }
  22045. public function getAlias()
  22046. {
  22047. return $this->alias;
  22048. }
  22049. public function getPackages()
  22050. {
  22051. return $this->packages;
  22052. }
  22053. }
  22054. <?php
  22055. namespace Composer\Repository\Pear;
  22056. use Composer\Util\RemoteFilesystem;
  22057. class ChannelReader extends BaseChannelReader
  22058. {
  22059. private $readerMap;
  22060. public function __construct(RemoteFilesystem $rfs)
  22061. {
  22062. parent::__construct($rfs);
  22063. $rest10reader = new ChannelRest10Reader($rfs);
  22064. $rest11reader = new ChannelRest11Reader($rfs);
  22065. $this->readerMap = array(
  22066. 'REST1.3' => $rest11reader,
  22067. 'REST1.2' => $rest11reader,
  22068. 'REST1.1' => $rest11reader,
  22069. 'REST1.0' => $rest10reader,
  22070. );
  22071. }
  22072. public function read($url)
  22073. {
  22074. $xml = $this->requestXml($url, "/channel.xml");
  22075. $channelName = (string) $xml->name;
  22076. $channelAlias = (string) $xml->suggestedalias;
  22077. $supportedVersions = array_keys($this->readerMap);
  22078. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  22079. if (!$selectedRestVersion) {
  22080. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  22081. }
  22082. $reader = $this->readerMap[$selectedRestVersion['version']];
  22083. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  22084. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  22085. }
  22086. private function selectRestVersion($channelXml, $supportedVersions)
  22087. {
  22088. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  22089. foreach ($supportedVersions as $version) {
  22090. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  22091. $testResult = $channelXml->xpath($xpathTest);
  22092. foreach ($testResult as $result) {
  22093. $result = (string) $result;
  22094. if (preg_match('{^https://}i', $result)) {
  22095. return array('version' => $version, 'baseUrl' => $result);
  22096. }
  22097. }
  22098. if (count($testResult) > 0) {
  22099. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  22100. }
  22101. }
  22102. return null;
  22103. }
  22104. }
  22105. <?php
  22106. namespace Composer\Repository\Pear;
  22107. use Composer\Downloader\TransportException;
  22108. class ChannelRest10Reader extends BaseChannelReader
  22109. {
  22110. private $dependencyReader;
  22111. public function __construct($rfs)
  22112. {
  22113. parent::__construct($rfs);
  22114. $this->dependencyReader = new PackageDependencyParser();
  22115. }
  22116. public function read($baseUrl)
  22117. {
  22118. return $this->readPackages($baseUrl);
  22119. }
  22120. private function readPackages($baseUrl)
  22121. {
  22122. $result = array();
  22123. $xmlPath = '/p/packages.xml';
  22124. $xml = $this->requestXml($baseUrl, $xmlPath);
  22125. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  22126. foreach ($xml->xpath('ns:p') as $node) {
  22127. $packageName = (string) $node;
  22128. $packageInfo = $this->readPackage($baseUrl, $packageName);
  22129. $result[] = $packageInfo;
  22130. }
  22131. return $result;
  22132. }
  22133. private function readPackage($baseUrl, $packageName)
  22134. {
  22135. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  22136. $xml = $this->requestXml($baseUrl, $xmlPath);
  22137. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  22138. $channelName = (string) $xml->c;
  22139. $packageName = (string) $xml->n;
  22140. $license = (string) $xml->l;
  22141. $shortDescription = (string) $xml->s;
  22142. $description = (string) $xml->d;
  22143. return new PackageInfo(
  22144. $channelName,
  22145. $packageName,
  22146. $license,
  22147. $shortDescription,
  22148. $description,
  22149. $this->readPackageReleases($baseUrl, $packageName)
  22150. );
  22151. }
  22152. private function readPackageReleases($baseUrl, $packageName)
  22153. {
  22154. $result = array();
  22155. try {
  22156. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  22157. $xml = $this->requestXml($baseUrl, $xmlPath);
  22158. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  22159. foreach ($xml->xpath('ns:r') as $node) {
  22160. $releaseVersion = (string) $node->v;
  22161. $releaseStability = (string) $node->s;
  22162. try {
  22163. $result[$releaseVersion] = new ReleaseInfo(
  22164. $releaseStability,
  22165. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  22166. );
  22167. } catch (TransportException $exception) {
  22168. if ($exception->getCode() != 404) {
  22169. throw $exception;
  22170. }
  22171. }
  22172. }
  22173. } catch (TransportException $exception) {
  22174. if ($exception->getCode() != 404) {
  22175. throw $exception;
  22176. }
  22177. }
  22178. return $result;
  22179. }
  22180. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  22181. {
  22182. $dependencyReader = new PackageDependencyParser();
  22183. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  22184. $content = $this->requestContent($baseUrl, $depthPath);
  22185. $dependencyArray = unserialize($content);
  22186. return $dependencyReader->buildDependencyInfo($dependencyArray);
  22187. }
  22188. }
  22189. <?php
  22190. namespace Composer\Repository\Pear;
  22191. class ChannelRest11Reader extends BaseChannelReader
  22192. {
  22193. private $dependencyReader;
  22194. public function __construct($rfs)
  22195. {
  22196. parent::__construct($rfs);
  22197. $this->dependencyReader = new PackageDependencyParser();
  22198. }
  22199. public function read($baseUrl)
  22200. {
  22201. return $this->readChannelPackages($baseUrl);
  22202. }
  22203. private function readChannelPackages($baseUrl)
  22204. {
  22205. $result = array();
  22206. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  22207. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  22208. foreach ($xml->xpath('ns:c') as $node) {
  22209. $categoryName = (string) $node;
  22210. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  22211. $result = array_merge($result, $categoryPackages);
  22212. }
  22213. return $result;
  22214. }
  22215. private function readCategoryPackages($baseUrl, $categoryName)
  22216. {
  22217. $result = array();
  22218. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  22219. $xml = $this->requestXml($baseUrl, $categoryPath);
  22220. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22221. foreach ($xml->xpath('ns:pi') as $node) {
  22222. $packageInfo = $this->parsePackage($node);
  22223. $result[] = $packageInfo;
  22224. }
  22225. return $result;
  22226. }
  22227. private function parsePackage($packageInfo)
  22228. {
  22229. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22230. $channelName = (string) $packageInfo->p->c;
  22231. $packageName = (string) $packageInfo->p->n;
  22232. $license = (string) $packageInfo->p->l;
  22233. $shortDescription = (string) $packageInfo->p->s;
  22234. $description = (string) $packageInfo->p->d;
  22235. $dependencies = array();
  22236. foreach ($packageInfo->xpath('ns:deps') as $node) {
  22237. $dependencyVersion = (string) $node->v;
  22238. $dependencyArray = unserialize((string) $node->d);
  22239. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  22240. $dependencies[$dependencyVersion] = $dependencyInfo;
  22241. }
  22242. $releases = array();
  22243. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  22244. if ($releasesInfo) {
  22245. foreach ($releasesInfo as $node) {
  22246. $releaseVersion = (string) $node->v;
  22247. $releaseStability = (string) $node->s;
  22248. $releases[$releaseVersion] = new ReleaseInfo(
  22249. $releaseStability,
  22250. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  22251. );
  22252. }
  22253. }
  22254. return new PackageInfo(
  22255. $channelName,
  22256. $packageName,
  22257. $license,
  22258. $shortDescription,
  22259. $description,
  22260. $releases
  22261. );
  22262. }
  22263. }
  22264. <?php
  22265. namespace Composer\Repository\Pear;
  22266. class DependencyConstraint
  22267. {
  22268. private $type;
  22269. private $constraint;
  22270. private $channelName;
  22271. private $packageName;
  22272. public function __construct($type, $constraint, $channelName, $packageName)
  22273. {
  22274. $this->type = $type;
  22275. $this->constraint = $constraint;
  22276. $this->channelName = $channelName;
  22277. $this->packageName = $packageName;
  22278. }
  22279. public function getChannelName()
  22280. {
  22281. return $this->channelName;
  22282. }
  22283. public function getConstraint()
  22284. {
  22285. return $this->constraint;
  22286. }
  22287. public function getPackageName()
  22288. {
  22289. return $this->packageName;
  22290. }
  22291. public function getType()
  22292. {
  22293. return $this->type;
  22294. }
  22295. }
  22296. <?php
  22297. namespace Composer\Repository\Pear;
  22298. class DependencyInfo
  22299. {
  22300. private $requires;
  22301. private $optionals;
  22302. public function __construct($requires, $optionals)
  22303. {
  22304. $this->requires = $requires;
  22305. $this->optionals = $optionals;
  22306. }
  22307. public function getRequires()
  22308. {
  22309. return $this->requires;
  22310. }
  22311. public function getOptionals()
  22312. {
  22313. return $this->optionals;
  22314. }
  22315. }
  22316. <?php
  22317. namespace Composer\Repository\Pear;
  22318. class PackageDependencyParser
  22319. {
  22320. public function buildDependencyInfo($depArray)
  22321. {
  22322. if (!is_array($depArray)) {
  22323. return new DependencyInfo(array(), array());
  22324. }
  22325. if (!$this->isHash($depArray)) {
  22326. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  22327. }
  22328. return $this->buildDependency20Info($depArray);
  22329. }
  22330. private function buildDependency10Info($depArray)
  22331. {
  22332. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  22333. $result = array();
  22334. foreach ($depArray as $depItem) {
  22335. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  22336. continue;
  22337. }
  22338. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  22339. ? 'optional'
  22340. : 'required';
  22341. $depType = 'not' == $depItem['rel']
  22342. ? 'conflicts'
  22343. : $depType;
  22344. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  22345. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  22346. ? '*'
  22347. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  22348. switch ($depItem['type']) {
  22349. case 'php':
  22350. $depChannelName = 'php';
  22351. $depPackageName = '';
  22352. break;
  22353. case 'pkg':
  22354. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  22355. $depPackageName = $depItem['name'];
  22356. break;
  22357. case 'ext':
  22358. $depChannelName = 'ext';
  22359. $depPackageName = $depItem['name'];
  22360. break;
  22361. case 'os':
  22362. case 'sapi':
  22363. $depChannelName = '';
  22364. $depPackageName = '';
  22365. break;
  22366. default:
  22367. $depChannelName = '';
  22368. $depPackageName = '';
  22369. break;
  22370. }
  22371. if ('' != $depChannelName) {
  22372. $result[] = new DependencyConstraint(
  22373. $depType,
  22374. $depVersionConstraint,
  22375. $depChannelName,
  22376. $depPackageName
  22377. );
  22378. }
  22379. }
  22380. return $result;
  22381. }
  22382. private function buildDependency20Info($depArray)
  22383. {
  22384. $result = array();
  22385. $optionals = array();
  22386. $defaultOptionals = array();
  22387. foreach ($depArray as $depType => $depTypeGroup) {
  22388. if (!is_array($depTypeGroup)) {
  22389. continue;
  22390. }
  22391. if ('required' == $depType || 'optional' == $depType) {
  22392. foreach ($depTypeGroup as $depItemType => $depItem) {
  22393. switch ($depItemType) {
  22394. case 'php':
  22395. $result[] = new DependencyConstraint(
  22396. $depType,
  22397. $this->parse20VersionConstraint($depItem),
  22398. 'php',
  22399. ''
  22400. );
  22401. break;
  22402. case 'package':
  22403. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  22404. $result = array_merge($result, $deps);
  22405. break;
  22406. case 'extension':
  22407. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  22408. $result = array_merge($result, $deps);
  22409. break;
  22410. case 'subpackage':
  22411. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  22412. $defaultOptionals += $deps;
  22413. break;
  22414. case 'os':
  22415. case 'pearinstaller':
  22416. break;
  22417. default:
  22418. break;
  22419. }
  22420. }
  22421. } elseif ('group' == $depType) {
  22422. if ($this->isHash($depTypeGroup)) {
  22423. $depTypeGroup = array($depTypeGroup);
  22424. }
  22425. foreach ($depTypeGroup as $depItem) {
  22426. $groupName = $depItem['attribs']['name'];
  22427. if (!isset($optionals[$groupName])) {
  22428. $optionals[$groupName] = array();
  22429. }
  22430. if (isset($depItem['subpackage'])) {
  22431. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  22432. } else {
  22433. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  22434. }
  22435. }
  22436. }
  22437. }
  22438. if (count($defaultOptionals) > 0) {
  22439. $optionals['*'] = $defaultOptionals;
  22440. }
  22441. return new DependencyInfo($result, $optionals);
  22442. }
  22443. private function buildDepExtensionConstraints($depItem, $depType)
  22444. {
  22445. if ($this->isHash($depItem)) {
  22446. $depItem = array($depItem);
  22447. }
  22448. $result = array();
  22449. foreach ($depItem as $subDepItem) {
  22450. $depChannelName = 'ext';
  22451. $depPackageName = $subDepItem['name'];
  22452. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22453. $result[] = new DependencyConstraint(
  22454. $depType,
  22455. $depVersionConstraint,
  22456. $depChannelName,
  22457. $depPackageName
  22458. );
  22459. }
  22460. return $result;
  22461. }
  22462. private function buildDepPackageConstraints($depItem, $depType)
  22463. {
  22464. if ($this->isHash($depItem)) {
  22465. $depItem = array($depItem);
  22466. }
  22467. $result = array();
  22468. foreach ($depItem as $subDepItem) {
  22469. if (!array_key_exists('channel', $subDepItem)) {
  22470. $subDepItem['channel'] = $subDepItem['uri'];
  22471. }
  22472. $depChannelName = $subDepItem['channel'];
  22473. $depPackageName = $subDepItem['name'];
  22474. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22475. if (isset($subDepItem['conflicts'])) {
  22476. $depType = 'conflicts';
  22477. }
  22478. $result[] = new DependencyConstraint(
  22479. $depType,
  22480. $depVersionConstraint,
  22481. $depChannelName,
  22482. $depPackageName
  22483. );
  22484. }
  22485. return $result;
  22486. }
  22487. private function parse20VersionConstraint(array $data)
  22488. {
  22489. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  22490. $versions = array();
  22491. $values = array_intersect_key($data, $dep20toOperatorMap);
  22492. if (0 == count($values)) {
  22493. return '*';
  22494. }
  22495. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  22496. $versions[] = '>' . $this->parseVersion($values['min']);
  22497. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  22498. $versions[] = '<' . $this->parseVersion($values['max']);
  22499. } else {
  22500. foreach ($values as $op => $version) {
  22501. if ('exclude' == $op && is_array($version)) {
  22502. foreach ($version as $versionPart) {
  22503. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  22504. }
  22505. } else {
  22506. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  22507. }
  22508. }
  22509. }
  22510. return implode(',', $versions);
  22511. }
  22512. private function parseVersion($version)
  22513. {
  22514. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  22515. $version = $matches[1]
  22516. .(!empty($matches[2]) ? $matches[2] : '.0')
  22517. .(!empty($matches[3]) ? $matches[3] : '.0')
  22518. .(!empty($matches[4]) ? $matches[4] : '.0');
  22519. return $version;
  22520. }
  22521. return null;
  22522. }
  22523. private function isHash(array $array)
  22524. {
  22525. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  22526. }
  22527. }
  22528. <?php
  22529. namespace Composer\Repository\Pear;
  22530. class PackageInfo
  22531. {
  22532. private $channelName;
  22533. private $packageName;
  22534. private $license;
  22535. private $shortDescription;
  22536. private $description;
  22537. private $releases;
  22538. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  22539. {
  22540. $this->channelName = $channelName;
  22541. $this->packageName = $packageName;
  22542. $this->license = $license;
  22543. $this->shortDescription = $shortDescription;
  22544. $this->description = $description;
  22545. $this->releases = $releases;
  22546. }
  22547. public function getChannelName()
  22548. {
  22549. return $this->channelName;
  22550. }
  22551. public function getPackageName()
  22552. {
  22553. return $this->packageName;
  22554. }
  22555. public function getDescription()
  22556. {
  22557. return $this->description;
  22558. }
  22559. public function getShortDescription()
  22560. {
  22561. return $this->shortDescription;
  22562. }
  22563. public function getLicense()
  22564. {
  22565. return $this->license;
  22566. }
  22567. public function getReleases()
  22568. {
  22569. return $this->releases;
  22570. }
  22571. }
  22572. <?php
  22573. namespace Composer\Repository\Pear;
  22574. class ReleaseInfo
  22575. {
  22576. private $stability;
  22577. private $dependencyInfo;
  22578. public function __construct($stability, $dependencyInfo)
  22579. {
  22580. $this->stability = $stability;
  22581. $this->dependencyInfo = $dependencyInfo;
  22582. }
  22583. public function getDependencyInfo()
  22584. {
  22585. return $this->dependencyInfo;
  22586. }
  22587. public function getStability()
  22588. {
  22589. return $this->stability;
  22590. }
  22591. }
  22592. <?php
  22593. namespace Composer\Repository;
  22594. use Composer\IO\IOInterface;
  22595. use Composer\Semver\VersionParser as SemverVersionParser;
  22596. use Composer\Package\Version\VersionParser;
  22597. use Composer\Repository\Pear\ChannelReader;
  22598. use Composer\Package\CompletePackage;
  22599. use Composer\Repository\Pear\ChannelInfo;
  22600. use Composer\EventDispatcher\EventDispatcher;
  22601. use Composer\Package\Link;
  22602. use Composer\Semver\Constraint\Constraint;
  22603. use Composer\Util\RemoteFilesystem;
  22604. use Composer\Config;
  22605. use Composer\Factory;
  22606. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22607. {
  22608. private $url;
  22609. private $io;
  22610. private $rfs;
  22611. private $versionParser;
  22612. private $repoConfig;
  22613. private $vendorAlias;
  22614. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  22615. {
  22616. parent::__construct();
  22617. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  22618. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  22619. }
  22620. $urlBits = parse_url($repoConfig['url']);
  22621. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  22622. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  22623. }
  22624. $this->url = rtrim($repoConfig['url'], '/');
  22625. $this->io = $io;
  22626. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  22627. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  22628. $this->versionParser = new VersionParser();
  22629. $this->repoConfig = $repoConfig;
  22630. }
  22631. public function getRepoConfig()
  22632. {
  22633. return $this->repoConfig;
  22634. }
  22635. protected function initialize()
  22636. {
  22637. parent::initialize();
  22638. $this->io->writeError('Initializing PEAR repository '.$this->url);
  22639. $reader = new ChannelReader($this->rfs);
  22640. try {
  22641. $channelInfo = $reader->read($this->url);
  22642. } catch (\Exception $e) {
  22643. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  22644. return;
  22645. }
  22646. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  22647. foreach ($packages as $package) {
  22648. $this->addPackage($package);
  22649. }
  22650. }
  22651. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  22652. {
  22653. $result = array();
  22654. foreach ($channelInfo->getPackages() as $packageDefinition) {
  22655. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  22656. try {
  22657. $normalizedVersion = $versionParser->normalize($version);
  22658. } catch (\UnexpectedValueException $e) {
  22659. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  22660. continue;
  22661. }
  22662. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  22663. $urlBits = parse_url($this->url);
  22664. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  22665. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  22666. $requires = array();
  22667. $suggests = array();
  22668. $conflicts = array();
  22669. $replaces = array();
  22670. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  22671. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  22672. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22673. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22674. }
  22675. if (!empty($this->vendorAlias)
  22676. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  22677. ) {
  22678. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  22679. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22680. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22681. }
  22682. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  22683. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22684. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  22685. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  22686. switch ($dependencyConstraint->getType()) {
  22687. case 'required':
  22688. $requires[] = $link;
  22689. break;
  22690. case 'conflicts':
  22691. $conflicts[] = $link;
  22692. break;
  22693. case 'replaces':
  22694. $replaces[] = $link;
  22695. break;
  22696. }
  22697. }
  22698. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  22699. foreach ($dependencyConstraints as $dependencyConstraint) {
  22700. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22701. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  22702. }
  22703. }
  22704. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  22705. $package->setType('pear-library');
  22706. $package->setDescription($packageDefinition->getDescription());
  22707. $package->setLicense(array($packageDefinition->getLicense()));
  22708. $package->setDistType('file');
  22709. $package->setDistUrl($distUrl);
  22710. $package->setAutoload(array('classmap' => array('')));
  22711. $package->setIncludePaths(array('/'));
  22712. $package->setRequires($requires);
  22713. $package->setConflicts($conflicts);
  22714. $package->setSuggests($suggests);
  22715. $package->setReplaces($replaces);
  22716. $result[] = $package;
  22717. }
  22718. }
  22719. return $result;
  22720. }
  22721. private function buildComposerPackageName($channelName, $packageName)
  22722. {
  22723. if ('php' === $channelName) {
  22724. return "php";
  22725. }
  22726. if ('ext' === $channelName) {
  22727. return "ext-{$packageName}";
  22728. }
  22729. return "pear-{$channelName}/{$packageName}";
  22730. }
  22731. }
  22732. <?php
  22733. namespace Composer\Repository;
  22734. use Composer\Composer;
  22735. use Composer\Package\CompletePackage;
  22736. use Composer\Package\PackageInterface;
  22737. use Composer\Package\Version\VersionParser;
  22738. use Composer\Plugin\PluginInterface;
  22739. use Composer\Util\ProcessExecutor;
  22740. use Composer\Util\Silencer;
  22741. use Composer\Util\Platform;
  22742. use Composer\XdebugHandler\XdebugHandler;
  22743. use Symfony\Component\Process\ExecutableFinder;
  22744. class PlatformRepository extends ArrayRepository
  22745. {
  22746. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD';
  22747. private $versionParser;
  22748. private $overrides = array();
  22749. private $process;
  22750. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  22751. {
  22752. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  22753. foreach ($overrides as $name => $version) {
  22754. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  22755. }
  22756. parent::__construct($packages);
  22757. }
  22758. protected function initialize()
  22759. {
  22760. parent::initialize();
  22761. $this->versionParser = new VersionParser();
  22762. foreach ($this->overrides as $override) {
  22763. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  22764. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  22765. }
  22766. $this->addOverriddenPackage($override);
  22767. }
  22768. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  22769. $version = $this->versionParser->normalize($prettyVersion);
  22770. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  22771. $composerPluginApi->setDescription('The Composer Plugin API');
  22772. $this->addPackage($composerPluginApi);
  22773. $prettyVersion = Composer::RUNTIME_API_VERSION;
  22774. $version = $this->versionParser->normalize($prettyVersion);
  22775. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  22776. $composerRuntimeApi->setDescription('The Composer Runtime API');
  22777. $this->addPackage($composerRuntimeApi);
  22778. try {
  22779. $prettyVersion = PHP_VERSION;
  22780. $version = $this->versionParser->normalize($prettyVersion);
  22781. } catch (\UnexpectedValueException $e) {
  22782. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  22783. $version = $this->versionParser->normalize($prettyVersion);
  22784. }
  22785. $php = new CompletePackage('php', $version, $prettyVersion);
  22786. $php->setDescription('The PHP interpreter');
  22787. $this->addPackage($php);
  22788. if (PHP_DEBUG) {
  22789. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  22790. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  22791. $this->addPackage($phpdebug);
  22792. }
  22793. if (defined('PHP_ZTS') && PHP_ZTS) {
  22794. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  22795. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  22796. $this->addPackage($phpzts);
  22797. }
  22798. if (PHP_INT_SIZE === 8) {
  22799. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  22800. $php64->setDescription('The PHP interpreter, 64bit');
  22801. $this->addPackage($php64);
  22802. }
  22803. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  22804. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  22805. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  22806. $this->addPackage($phpIpv6);
  22807. }
  22808. $loadedExtensions = get_loaded_extensions();
  22809. foreach ($loadedExtensions as $name) {
  22810. if (in_array($name, array('standard', 'Core'))) {
  22811. continue;
  22812. }
  22813. $reflExt = new \ReflectionExtension($name);
  22814. $prettyVersion = $reflExt->getVersion();
  22815. $this->addExtension($name, $prettyVersion);
  22816. }
  22817. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  22818. $this->addExtension('xdebug', $prettyVersion);
  22819. }
  22820. foreach ($loadedExtensions as $name) {
  22821. $prettyVersion = null;
  22822. $description = 'The '.$name.' PHP library';
  22823. switch ($name) {
  22824. case 'curl':
  22825. $curlVersion = curl_version();
  22826. $prettyVersion = $curlVersion['version'];
  22827. break;
  22828. case 'iconv':
  22829. $prettyVersion = ICONV_VERSION;
  22830. break;
  22831. case 'intl':
  22832. $name = 'ICU';
  22833. if (defined('INTL_ICU_VERSION')) {
  22834. $prettyVersion = INTL_ICU_VERSION;
  22835. } else {
  22836. $reflector = new \ReflectionExtension('intl');
  22837. ob_start();
  22838. $reflector->info();
  22839. $output = ob_get_clean();
  22840. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  22841. $prettyVersion = $matches[1];
  22842. }
  22843. break;
  22844. case 'imagick':
  22845. $imagick = new \Imagick();
  22846. $imageMagickVersion = $imagick->getVersion();
  22847. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  22848. if (isset($matches[2])) {
  22849. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  22850. } else {
  22851. $prettyVersion = $matches[1];
  22852. }
  22853. break;
  22854. case 'libxml':
  22855. $prettyVersion = LIBXML_DOTTED_VERSION;
  22856. break;
  22857. case 'openssl':
  22858. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22859. if (empty($match[2])) {
  22860. return $match[1];
  22861. }
  22862. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22863. return 0;
  22864. }
  22865. $len = strlen($match[2]);
  22866. $patchVersion = ($len - 1) * 26;
  22867. $patchVersion += ord($match[2][$len - 1]) - 96;
  22868. return $match[1].'.'.$patchVersion;
  22869. }, OPENSSL_VERSION_TEXT);
  22870. $description = OPENSSL_VERSION_TEXT;
  22871. break;
  22872. case 'pcre':
  22873. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22874. break;
  22875. case 'uuid':
  22876. $prettyVersion = phpversion('uuid');
  22877. break;
  22878. case 'xsl':
  22879. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22880. break;
  22881. default:
  22882. continue 2;
  22883. }
  22884. try {
  22885. $version = $this->versionParser->normalize($prettyVersion);
  22886. } catch (\UnexpectedValueException $e) {
  22887. continue;
  22888. }
  22889. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22890. $lib->setDescription($description);
  22891. $this->addPackage($lib);
  22892. }
  22893. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22894. if ($hhvmVersion === null && !Platform::isWindows()) {
  22895. $finder = new ExecutableFinder();
  22896. $hhvm = $finder->find('hhvm');
  22897. if ($hhvm !== null) {
  22898. $exitCode = $this->process->execute(
  22899. ProcessExecutor::escape($hhvm).
  22900. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22901. $hhvmVersion
  22902. );
  22903. if ($exitCode !== 0) {
  22904. $hhvmVersion = null;
  22905. }
  22906. }
  22907. }
  22908. if ($hhvmVersion) {
  22909. try {
  22910. $prettyVersion = $hhvmVersion;
  22911. $version = $this->versionParser->normalize($prettyVersion);
  22912. } catch (\UnexpectedValueException $e) {
  22913. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22914. $version = $this->versionParser->normalize($prettyVersion);
  22915. }
  22916. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22917. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22918. $this->addPackage($hhvm);
  22919. }
  22920. }
  22921. public function addPackage(PackageInterface $package)
  22922. {
  22923. if (isset($this->overrides[$package->getName()])) {
  22924. $overrider = $this->findPackage($package->getName(), '*');
  22925. if ($package->getVersion() === $overrider->getVersion()) {
  22926. $actualText = 'same as actual';
  22927. } else {
  22928. $actualText = 'actual: '.$package->getPrettyVersion();
  22929. }
  22930. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22931. return;
  22932. }
  22933. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22934. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22935. if ($package->getVersion() === $overrider->getVersion()) {
  22936. $actualText = 'same as actual';
  22937. } else {
  22938. $actualText = 'actual: '.$package->getPrettyVersion();
  22939. }
  22940. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22941. return;
  22942. }
  22943. parent::addPackage($package);
  22944. }
  22945. private function addOverriddenPackage(array $override, $name = null)
  22946. {
  22947. $version = $this->versionParser->normalize($override['version']);
  22948. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22949. $package->setDescription('Package overridden via config.platform');
  22950. $package->setExtra(array('config.platform' => true));
  22951. parent::addPackage($package);
  22952. return $package;
  22953. }
  22954. private function addExtension($name, $prettyVersion)
  22955. {
  22956. $extraDescription = null;
  22957. try {
  22958. $version = $this->versionParser->normalize($prettyVersion);
  22959. } catch (\UnexpectedValueException $e) {
  22960. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22961. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22962. $prettyVersion = $match[1];
  22963. } else {
  22964. $prettyVersion = '0';
  22965. }
  22966. $version = $this->versionParser->normalize($prettyVersion);
  22967. }
  22968. $packageName = $this->buildPackageName($name);
  22969. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22970. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22971. $this->addPackage($ext);
  22972. }
  22973. private function buildPackageName($name)
  22974. {
  22975. return 'ext-' . str_replace(' ', '-', $name);
  22976. }
  22977. }
  22978. <?php
  22979. namespace Composer\Repository;
  22980. use Composer\Factory;
  22981. use Composer\IO\IOInterface;
  22982. use Composer\Config;
  22983. use Composer\EventDispatcher\EventDispatcher;
  22984. use Composer\Util\RemoteFilesystem;
  22985. use Composer\Json\JsonFile;
  22986. class RepositoryFactory
  22987. {
  22988. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22989. {
  22990. if (0 === strpos($repository, 'http')) {
  22991. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22992. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  22993. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  22994. $data = $json->read();
  22995. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  22996. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  22997. } elseif ($allowFilesystem) {
  22998. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22999. } else {
  23000. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  23001. }
  23002. } elseif ('{' === substr($repository, 0, 1)) {
  23003. $repoConfig = JsonFile::parseJson($repository);
  23004. } else {
  23005. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  23006. }
  23007. return $repoConfig;
  23008. }
  23009. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false, RepositoryManager $rm = null)
  23010. {
  23011. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  23012. return static::createRepo($io, $config, $repoConfig, $rm);
  23013. }
  23014. public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null)
  23015. {
  23016. if (!$rm) {
  23017. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23018. }
  23019. $repos = static::createRepos($rm, array($repoConfig));
  23020. return reset($repos);
  23021. }
  23022. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  23023. {
  23024. if (!$config) {
  23025. $config = Factory::createConfig($io);
  23026. }
  23027. if ($io) {
  23028. $io->loadConfiguration($config);
  23029. }
  23030. if (!$rm) {
  23031. if (!$io) {
  23032. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  23033. }
  23034. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23035. }
  23036. return static::createRepos($rm, $config->getRepositories());
  23037. }
  23038. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23039. {
  23040. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  23041. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  23042. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  23043. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  23044. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  23045. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  23046. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  23047. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  23048. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  23049. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  23050. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  23051. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  23052. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  23053. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  23054. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  23055. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  23056. return $rm;
  23057. }
  23058. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  23059. {
  23060. $repos = array();
  23061. foreach ($repoConfigs as $index => $repo) {
  23062. if (is_string($repo)) {
  23063. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  23064. }
  23065. if (!is_array($repo)) {
  23066. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  23067. }
  23068. if (!isset($repo['type'])) {
  23069. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  23070. }
  23071. $name = self::generateRepositoryName($index, $repo, $repos);
  23072. if ($repo['type'] === 'filesystem') {
  23073. $repos[$name] = new FilesystemRepository($repo['json']);
  23074. } else {
  23075. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  23076. }
  23077. }
  23078. return $repos;
  23079. }
  23080. public static function generateRepositoryName($index, array $repo, array $existingRepos)
  23081. {
  23082. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  23083. while (isset($existingRepos[$name])) {
  23084. $name .= '2';
  23085. }
  23086. return $name;
  23087. }
  23088. }
  23089. <?php
  23090. namespace Composer\Repository;
  23091. use Composer\Package\PackageInterface;
  23092. interface RepositoryInterface extends \Countable
  23093. {
  23094. const SEARCH_FULLTEXT = 0;
  23095. const SEARCH_NAME = 1;
  23096. public function hasPackage(PackageInterface $package);
  23097. public function findPackage($name, $constraint);
  23098. public function findPackages($name, $constraint = null);
  23099. public function getPackages();
  23100. public function search($query, $mode = 0);
  23101. }
  23102. <?php
  23103. namespace Composer\Repository;
  23104. use Composer\IO\IOInterface;
  23105. use Composer\Config;
  23106. use Composer\EventDispatcher\EventDispatcher;
  23107. use Composer\Package\PackageInterface;
  23108. use Composer\Util\RemoteFilesystem;
  23109. class RepositoryManager
  23110. {
  23111. private $localRepository;
  23112. private $repositories = array();
  23113. private $repositoryClasses = array();
  23114. private $io;
  23115. private $config;
  23116. private $eventDispatcher;
  23117. private $rfs;
  23118. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23119. {
  23120. $this->io = $io;
  23121. $this->config = $config;
  23122. $this->eventDispatcher = $eventDispatcher;
  23123. $this->rfs = $rfs;
  23124. }
  23125. public function findPackage($name, $constraint)
  23126. {
  23127. foreach ($this->repositories as $repository) {
  23128. if ($package = $repository->findPackage($name, $constraint)) {
  23129. return $package;
  23130. }
  23131. }
  23132. return null;
  23133. }
  23134. public function findPackages($name, $constraint)
  23135. {
  23136. $packages = array();
  23137. foreach ($this->getRepositories() as $repository) {
  23138. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  23139. }
  23140. return $packages;
  23141. }
  23142. public function addRepository(RepositoryInterface $repository)
  23143. {
  23144. $this->repositories[] = $repository;
  23145. }
  23146. public function prependRepository(RepositoryInterface $repository)
  23147. {
  23148. array_unshift($this->repositories, $repository);
  23149. }
  23150. public function createRepository($type, $config, $name = null)
  23151. {
  23152. if (!isset($this->repositoryClasses[$type])) {
  23153. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  23154. }
  23155. if (isset($config['packagist']) && false === $config['packagist']) {
  23156. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  23157. }
  23158. $class = $this->repositoryClasses[$type];
  23159. $reflMethod = new \ReflectionMethod($class, '__construct');
  23160. $params = $reflMethod->getParameters();
  23161. if (isset($params[4])) {
  23162. $paramType = null;
  23163. if (\PHP_VERSION_ID >= 70000) {
  23164. $reflectionType = $params[4]->getType();
  23165. if ($reflectionType) {
  23166. $paramType = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  23167. }
  23168. } else {
  23169. $paramType = $params[4]->getClass() ? $params[4]->getClass()->getName() : null;
  23170. }
  23171. if ($paramType === 'Composer\Util\RemoteFilesystem') {
  23172. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  23173. }
  23174. }
  23175. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  23176. }
  23177. public function setRepositoryClass($type, $class)
  23178. {
  23179. $this->repositoryClasses[$type] = $class;
  23180. }
  23181. public function getRepositories()
  23182. {
  23183. return $this->repositories;
  23184. }
  23185. public function setLocalRepository(WritableRepositoryInterface $repository)
  23186. {
  23187. $this->localRepository = $repository;
  23188. }
  23189. public function getLocalRepository()
  23190. {
  23191. return $this->localRepository;
  23192. }
  23193. }
  23194. <?php
  23195. namespace Composer\Repository;
  23196. class RepositorySecurityException extends \Exception
  23197. {
  23198. }
  23199. <?php
  23200. namespace Composer\Repository\Vcs;
  23201. use Composer\Cache;
  23202. use Composer\Downloader\TransportException;
  23203. use Composer\Json\JsonFile;
  23204. use Composer\Util\Bitbucket;
  23205. abstract class BitbucketDriver extends VcsDriver
  23206. {
  23207. protected $cache;
  23208. protected $owner;
  23209. protected $repository;
  23210. protected $hasIssues;
  23211. protected $rootIdentifier;
  23212. protected $tags;
  23213. protected $branches;
  23214. protected $infoCache = array();
  23215. protected $branchesUrl = '';
  23216. protected $tagsUrl = '';
  23217. protected $homeUrl = '';
  23218. protected $website = '';
  23219. protected $cloneHttpsUrl = '';
  23220. protected $fallbackDriver;
  23221. protected $vcsType;
  23222. public function initialize()
  23223. {
  23224. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
  23225. $this->owner = $match[1];
  23226. $this->repository = $match[2];
  23227. $this->originUrl = 'bitbucket.org';
  23228. $this->cache = new Cache(
  23229. $this->io,
  23230. implode('/', array(
  23231. $this->config->get('cache-repo-dir'),
  23232. $this->originUrl,
  23233. $this->owner,
  23234. $this->repository,
  23235. ))
  23236. );
  23237. }
  23238. public function getUrl()
  23239. {
  23240. if ($this->fallbackDriver) {
  23241. return $this->fallbackDriver->getUrl();
  23242. }
  23243. return $this->cloneHttpsUrl;
  23244. }
  23245. protected function getRepoData()
  23246. {
  23247. $resource = sprintf(
  23248. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  23249. $this->owner,
  23250. $this->repository,
  23251. http_build_query(
  23252. array('fields' => '-project,-owner'),
  23253. null,
  23254. '&'
  23255. )
  23256. );
  23257. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  23258. if ($this->fallbackDriver) {
  23259. return false;
  23260. }
  23261. $this->parseCloneUrls($repoData['links']['clone']);
  23262. $this->hasIssues = !empty($repoData['has_issues']);
  23263. $this->branchesUrl = $repoData['links']['branches']['href'];
  23264. $this->tagsUrl = $repoData['links']['tags']['href'];
  23265. $this->homeUrl = $repoData['links']['html']['href'];
  23266. $this->website = $repoData['website'];
  23267. $this->vcsType = $repoData['scm'];
  23268. return true;
  23269. }
  23270. public function getComposerInformation($identifier)
  23271. {
  23272. if ($this->fallbackDriver) {
  23273. return $this->fallbackDriver->getComposerInformation($identifier);
  23274. }
  23275. if (!isset($this->infoCache[$identifier])) {
  23276. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23277. $composer = JsonFile::parseJson($res);
  23278. } else {
  23279. $composer = $this->getBaseComposerInformation($identifier);
  23280. if ($this->shouldCache($identifier)) {
  23281. $this->cache->write($identifier, json_encode($composer));
  23282. }
  23283. }
  23284. if ($composer) {
  23285. if (!isset($composer['support']['source'])) {
  23286. $label = array_search(
  23287. $identifier,
  23288. $this->getTags()
  23289. ) ?: array_search(
  23290. $identifier,
  23291. $this->getBranches()
  23292. ) ?: $identifier;
  23293. if (array_key_exists($label, $tags = $this->getTags())) {
  23294. $hash = $tags[$label];
  23295. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  23296. $hash = $branches[$label];
  23297. }
  23298. if (! isset($hash)) {
  23299. $composer['support']['source'] = sprintf(
  23300. 'https://%s/%s/%s/src',
  23301. $this->originUrl,
  23302. $this->owner,
  23303. $this->repository
  23304. );
  23305. } else {
  23306. $composer['support']['source'] = sprintf(
  23307. 'https://%s/%s/%s/src/%s/?at=%s',
  23308. $this->originUrl,
  23309. $this->owner,
  23310. $this->repository,
  23311. $hash,
  23312. $label
  23313. );
  23314. }
  23315. }
  23316. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23317. $composer['support']['issues'] = sprintf(
  23318. 'https://%s/%s/%s/issues',
  23319. $this->originUrl,
  23320. $this->owner,
  23321. $this->repository
  23322. );
  23323. }
  23324. if (!isset($composer['homepage'])) {
  23325. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  23326. }
  23327. }
  23328. $this->infoCache[$identifier] = $composer;
  23329. }
  23330. return $this->infoCache[$identifier];
  23331. }
  23332. public function getFileContent($file, $identifier)
  23333. {
  23334. if ($this->fallbackDriver) {
  23335. return $this->fallbackDriver->getFileContent($file, $identifier);
  23336. }
  23337. if (strpos($identifier, '/') !== false) {
  23338. $branches = $this->getBranches();
  23339. if (isset($branches[$identifier])) {
  23340. $identifier = $branches[$identifier];
  23341. }
  23342. }
  23343. $resource = sprintf(
  23344. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  23345. $this->owner,
  23346. $this->repository,
  23347. $identifier,
  23348. $file
  23349. );
  23350. return $this->getContentsWithOAuthCredentials($resource);
  23351. }
  23352. public function getChangeDate($identifier)
  23353. {
  23354. if ($this->fallbackDriver) {
  23355. return $this->fallbackDriver->getChangeDate($identifier);
  23356. }
  23357. if (strpos($identifier, '/') !== false) {
  23358. $branches = $this->getBranches();
  23359. if (isset($branches[$identifier])) {
  23360. $identifier = $branches[$identifier];
  23361. }
  23362. }
  23363. $resource = sprintf(
  23364. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  23365. $this->owner,
  23366. $this->repository,
  23367. $identifier
  23368. );
  23369. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23370. return new \DateTime($commit['date']);
  23371. }
  23372. public function getSource($identifier)
  23373. {
  23374. if ($this->fallbackDriver) {
  23375. return $this->fallbackDriver->getSource($identifier);
  23376. }
  23377. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  23378. }
  23379. public function getDist($identifier)
  23380. {
  23381. if ($this->fallbackDriver) {
  23382. return $this->fallbackDriver->getDist($identifier);
  23383. }
  23384. $url = sprintf(
  23385. 'https://bitbucket.org/%s/%s/get/%s.zip',
  23386. $this->owner,
  23387. $this->repository,
  23388. $identifier
  23389. );
  23390. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23391. }
  23392. public function getTags()
  23393. {
  23394. if ($this->fallbackDriver) {
  23395. return $this->fallbackDriver->getTags();
  23396. }
  23397. if (null === $this->tags) {
  23398. $this->tags = array();
  23399. $resource = sprintf(
  23400. '%s?%s',
  23401. $this->tagsUrl,
  23402. http_build_query(
  23403. array(
  23404. 'pagelen' => 100,
  23405. 'fields' => 'values.name,values.target.hash,next',
  23406. 'sort' => '-target.date',
  23407. ),
  23408. null,
  23409. '&'
  23410. )
  23411. );
  23412. $hasNext = true;
  23413. while ($hasNext) {
  23414. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23415. foreach ($tagsData['values'] as $data) {
  23416. $this->tags[$data['name']] = $data['target']['hash'];
  23417. }
  23418. if (empty($tagsData['next'])) {
  23419. $hasNext = false;
  23420. } else {
  23421. $resource = $tagsData['next'];
  23422. }
  23423. }
  23424. if ($this->vcsType === 'hg') {
  23425. unset($this->tags['tip']);
  23426. }
  23427. }
  23428. return $this->tags;
  23429. }
  23430. public function getBranches()
  23431. {
  23432. if ($this->fallbackDriver) {
  23433. return $this->fallbackDriver->getBranches();
  23434. }
  23435. if (null === $this->branches) {
  23436. $this->branches = array();
  23437. $resource = sprintf(
  23438. '%s?%s',
  23439. $this->branchesUrl,
  23440. http_build_query(
  23441. array(
  23442. 'pagelen' => 100,
  23443. 'fields' => 'values.name,values.target.hash,values.heads,next',
  23444. 'sort' => '-target.date',
  23445. ),
  23446. null,
  23447. '&'
  23448. )
  23449. );
  23450. $hasNext = true;
  23451. while ($hasNext) {
  23452. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23453. foreach ($branchData['values'] as $data) {
  23454. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  23455. continue;
  23456. }
  23457. $this->branches[$data['name']] = $data['target']['hash'];
  23458. }
  23459. if (empty($branchData['next'])) {
  23460. $hasNext = false;
  23461. } else {
  23462. $resource = $branchData['next'];
  23463. }
  23464. }
  23465. }
  23466. return $this->branches;
  23467. }
  23468. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  23469. {
  23470. try {
  23471. return parent::getContents($url);
  23472. } catch (TransportException $e) {
  23473. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23474. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  23475. if (!$this->io->hasAuthentication($this->originUrl)
  23476. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  23477. ) {
  23478. return parent::getContents($url);
  23479. }
  23480. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23481. return $this->attemptCloneFallback();
  23482. }
  23483. }
  23484. throw $e;
  23485. }
  23486. }
  23487. abstract protected function generateSshUrl();
  23488. protected function attemptCloneFallback()
  23489. {
  23490. try {
  23491. $this->setupFallbackDriver($this->generateSshUrl());
  23492. } catch (\RuntimeException $e) {
  23493. $this->fallbackDriver = null;
  23494. $this->io->writeError(
  23495. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  23496. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  23497. );
  23498. throw $e;
  23499. }
  23500. }
  23501. abstract protected function setupFallbackDriver($url);
  23502. protected function parseCloneUrls(array $cloneLinks)
  23503. {
  23504. foreach ($cloneLinks as $cloneLink) {
  23505. if ($cloneLink['name'] === 'https') {
  23506. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  23507. }
  23508. }
  23509. }
  23510. protected function getMainBranchData()
  23511. {
  23512. $resource = sprintf(
  23513. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  23514. $this->owner,
  23515. $this->repository
  23516. );
  23517. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23518. if (isset($data['mainbranch'])) {
  23519. return $data['mainbranch'];
  23520. }
  23521. return null;
  23522. }
  23523. }
  23524. <?php
  23525. namespace Composer\Repository\Vcs;
  23526. use Composer\Cache;
  23527. use Composer\Config;
  23528. use Composer\Util\ProcessExecutor;
  23529. use Composer\Util\Filesystem;
  23530. use Composer\IO\IOInterface;
  23531. class FossilDriver extends VcsDriver
  23532. {
  23533. protected $tags;
  23534. protected $branches;
  23535. protected $rootIdentifier;
  23536. protected $repoFile;
  23537. protected $checkoutDir;
  23538. protected $infoCache = array();
  23539. public function initialize()
  23540. {
  23541. $this->checkFossil();
  23542. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23543. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  23544. $this->checkoutDir = $this->url;
  23545. } else {
  23546. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23547. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23548. }
  23549. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  23550. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  23551. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  23552. $this->updateLocalRepo();
  23553. }
  23554. $this->getTags();
  23555. $this->getBranches();
  23556. }
  23557. protected function checkFossil()
  23558. {
  23559. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  23560. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  23561. }
  23562. }
  23563. protected function updateLocalRepo()
  23564. {
  23565. $fs = new Filesystem();
  23566. $fs->ensureDirectoryExists($this->checkoutDir);
  23567. if (!is_writable(dirname($this->checkoutDir))) {
  23568. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  23569. }
  23570. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  23571. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  23572. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23573. }
  23574. } else {
  23575. $fs->removeDirectory($this->checkoutDir);
  23576. $fs->remove($this->repoFile);
  23577. $fs->ensureDirectoryExists($this->checkoutDir);
  23578. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  23579. $output = $this->process->getErrorOutput();
  23580. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  23581. }
  23582. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  23583. $output = $this->process->getErrorOutput();
  23584. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  23585. }
  23586. }
  23587. }
  23588. public function getRootIdentifier()
  23589. {
  23590. if (null === $this->rootIdentifier) {
  23591. $this->rootIdentifier = 'trunk';
  23592. }
  23593. return $this->rootIdentifier;
  23594. }
  23595. public function getUrl()
  23596. {
  23597. return $this->url;
  23598. }
  23599. public function getSource($identifier)
  23600. {
  23601. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  23602. }
  23603. public function getDist($identifier)
  23604. {
  23605. return null;
  23606. }
  23607. public function getFileContent($file, $identifier)
  23608. {
  23609. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23610. $this->process->execute($command, $content, $this->checkoutDir);
  23611. if (!trim($content)) {
  23612. return null;
  23613. }
  23614. return $content;
  23615. }
  23616. public function getChangeDate($identifier)
  23617. {
  23618. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  23619. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  23620. return new \DateTime($date, new \DateTimeZone('UTC'));
  23621. }
  23622. public function getTags()
  23623. {
  23624. if (null === $this->tags) {
  23625. $tags = array();
  23626. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  23627. foreach ($this->process->splitLines($output) as $tag) {
  23628. $tags[$tag] = $tag;
  23629. }
  23630. $this->tags = $tags;
  23631. }
  23632. return $this->tags;
  23633. }
  23634. public function getBranches()
  23635. {
  23636. if (null === $this->branches) {
  23637. $branches = array();
  23638. $bookmarks = array();
  23639. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  23640. foreach ($this->process->splitLines($output) as $branch) {
  23641. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  23642. $branches[$branch] = $branch;
  23643. }
  23644. $this->branches = $branches;
  23645. }
  23646. return $this->branches;
  23647. }
  23648. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23649. {
  23650. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  23651. return true;
  23652. }
  23653. if (preg_match('!/fossil/|\.fossil!', $url)) {
  23654. return true;
  23655. }
  23656. if (Filesystem::isLocalPath($url)) {
  23657. $url = Filesystem::getPlatformPath($url);
  23658. if (!is_dir($url)) {
  23659. return false;
  23660. }
  23661. $process = new ProcessExecutor($io);
  23662. if ($process->execute('fossil info', $output, $url) === 0) {
  23663. return true;
  23664. }
  23665. }
  23666. return false;
  23667. }
  23668. }
  23669. <?php
  23670. namespace Composer\Repository\Vcs;
  23671. use Composer\Config;
  23672. use Composer\IO\IOInterface;
  23673. class GitBitbucketDriver extends BitbucketDriver
  23674. {
  23675. public function getRootIdentifier()
  23676. {
  23677. if ($this->fallbackDriver) {
  23678. return $this->fallbackDriver->getRootIdentifier();
  23679. }
  23680. if (null === $this->rootIdentifier) {
  23681. if (! $this->getRepoData()) {
  23682. return $this->fallbackDriver->getRootIdentifier();
  23683. }
  23684. if ($this->vcsType !== 'git') {
  23685. throw new \RuntimeException(
  23686. $this->url.' does not appear to be a git repository, use '.
  23687. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  23688. );
  23689. }
  23690. $mainBranchData = $this->getMainBranchData();
  23691. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  23692. }
  23693. return $this->rootIdentifier;
  23694. }
  23695. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23696. {
  23697. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
  23698. return false;
  23699. }
  23700. if (!extension_loaded('openssl')) {
  23701. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23702. return false;
  23703. }
  23704. return true;
  23705. }
  23706. protected function setupFallbackDriver($url)
  23707. {
  23708. $this->fallbackDriver = new GitDriver(
  23709. array('url' => $url),
  23710. $this->io,
  23711. $this->config,
  23712. $this->process,
  23713. $this->remoteFilesystem
  23714. );
  23715. $this->fallbackDriver->initialize();
  23716. }
  23717. protected function generateSshUrl()
  23718. {
  23719. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  23720. }
  23721. }
  23722. <?php
  23723. namespace Composer\Repository\Vcs;
  23724. use Composer\Util\ProcessExecutor;
  23725. use Composer\Util\Filesystem;
  23726. use Composer\Util\Git as GitUtil;
  23727. use Composer\IO\IOInterface;
  23728. use Composer\Cache;
  23729. use Composer\Config;
  23730. class GitDriver extends VcsDriver
  23731. {
  23732. protected $cache;
  23733. protected $tags;
  23734. protected $branches;
  23735. protected $rootIdentifier;
  23736. protected $repoDir;
  23737. protected $infoCache = array();
  23738. public function initialize()
  23739. {
  23740. if (Filesystem::isLocalPath($this->url)) {
  23741. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  23742. $this->repoDir = $this->url;
  23743. $cacheUrl = realpath($this->url);
  23744. } else {
  23745. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23746. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23747. }
  23748. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  23749. GitUtil::cleanEnv();
  23750. $fs = new Filesystem();
  23751. $fs->ensureDirectoryExists(dirname($this->repoDir));
  23752. if (!is_writable(dirname($this->repoDir))) {
  23753. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  23754. }
  23755. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  23756. 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.');
  23757. }
  23758. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  23759. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  23760. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  23761. }
  23762. $cacheUrl = $this->url;
  23763. }
  23764. $this->getTags();
  23765. $this->getBranches();
  23766. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  23767. }
  23768. public function getRootIdentifier()
  23769. {
  23770. if (null === $this->rootIdentifier) {
  23771. $this->rootIdentifier = 'master';
  23772. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  23773. $branches = $this->process->splitLines($output);
  23774. if (!in_array('* master', $branches)) {
  23775. foreach ($branches as $branch) {
  23776. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  23777. $this->rootIdentifier = $match[1];
  23778. break;
  23779. }
  23780. }
  23781. }
  23782. }
  23783. return $this->rootIdentifier;
  23784. }
  23785. public function getUrl()
  23786. {
  23787. return $this->url;
  23788. }
  23789. public function getSource($identifier)
  23790. {
  23791. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  23792. }
  23793. public function getDist($identifier)
  23794. {
  23795. return null;
  23796. }
  23797. public function getFileContent($file, $identifier)
  23798. {
  23799. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23800. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  23801. if (!trim($content)) {
  23802. return null;
  23803. }
  23804. return $content;
  23805. }
  23806. public function getChangeDate($identifier)
  23807. {
  23808. $this->process->execute(sprintf(
  23809. 'git -c log.showSignature=false log -1 --format=%%at %s',
  23810. ProcessExecutor::escape($identifier)
  23811. ), $output, $this->repoDir);
  23812. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23813. }
  23814. public function getTags()
  23815. {
  23816. if (null === $this->tags) {
  23817. $this->tags = array();
  23818. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  23819. foreach ($output = $this->process->splitLines($output) as $tag) {
  23820. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  23821. $this->tags[$match[2]] = $match[1];
  23822. }
  23823. }
  23824. }
  23825. return $this->tags;
  23826. }
  23827. public function getBranches()
  23828. {
  23829. if (null === $this->branches) {
  23830. $branches = array();
  23831. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  23832. foreach ($this->process->splitLines($output) as $branch) {
  23833. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  23834. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  23835. $branches[$match[1]] = $match[2];
  23836. }
  23837. }
  23838. }
  23839. $this->branches = $branches;
  23840. }
  23841. return $this->branches;
  23842. }
  23843. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23844. {
  23845. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  23846. return true;
  23847. }
  23848. if (Filesystem::isLocalPath($url)) {
  23849. $url = Filesystem::getPlatformPath($url);
  23850. if (!is_dir($url)) {
  23851. return false;
  23852. }
  23853. $process = new ProcessExecutor($io);
  23854. if ($process->execute('git tag', $output, $url) === 0) {
  23855. return true;
  23856. }
  23857. }
  23858. if (!$deep) {
  23859. return false;
  23860. }
  23861. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  23862. GitUtil::cleanEnv();
  23863. try {
  23864. $gitUtil->runCommand(function ($url) {
  23865. return 'git ls-remote --heads ' . ProcessExecutor::escape($url);
  23866. }, $url, sys_get_temp_dir());
  23867. } catch (\RuntimeException $e) {
  23868. return false;
  23869. }
  23870. return true;
  23871. }
  23872. }
  23873. <?php
  23874. namespace Composer\Repository\Vcs;
  23875. use Composer\Config;
  23876. use Composer\Downloader\TransportException;
  23877. use Composer\Json\JsonFile;
  23878. use Composer\Cache;
  23879. use Composer\IO\IOInterface;
  23880. use Composer\Util\GitHub;
  23881. class GitHubDriver extends VcsDriver
  23882. {
  23883. protected $cache;
  23884. protected $owner;
  23885. protected $repository;
  23886. protected $tags;
  23887. protected $branches;
  23888. protected $rootIdentifier;
  23889. protected $repoData;
  23890. protected $hasIssues;
  23891. protected $infoCache = array();
  23892. protected $isPrivate = false;
  23893. private $isArchived = false;
  23894. private $fundingInfo;
  23895. protected $gitDriver;
  23896. public function initialize()
  23897. {
  23898. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23899. $this->owner = $match[3];
  23900. $this->repository = $match[4];
  23901. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  23902. if ($this->originUrl === 'www.github.com') {
  23903. $this->originUrl = 'github.com';
  23904. }
  23905. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23906. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23907. $this->setupGitDriver($this->url);
  23908. return;
  23909. }
  23910. $this->fetchRootIdentifier();
  23911. }
  23912. public function getRepositoryUrl()
  23913. {
  23914. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23915. }
  23916. public function getRootIdentifier()
  23917. {
  23918. if ($this->gitDriver) {
  23919. return $this->gitDriver->getRootIdentifier();
  23920. }
  23921. return $this->rootIdentifier;
  23922. }
  23923. public function getUrl()
  23924. {
  23925. if ($this->gitDriver) {
  23926. return $this->gitDriver->getUrl();
  23927. }
  23928. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23929. }
  23930. protected function getApiUrl()
  23931. {
  23932. if ('github.com' === $this->originUrl) {
  23933. $apiUrl = 'api.github.com';
  23934. } else {
  23935. $apiUrl = $this->originUrl . '/api/v3';
  23936. }
  23937. return 'https://' . $apiUrl;
  23938. }
  23939. public function getSource($identifier)
  23940. {
  23941. if ($this->gitDriver) {
  23942. return $this->gitDriver->getSource($identifier);
  23943. }
  23944. if ($this->isPrivate) {
  23945. $url = $this->generateSshUrl();
  23946. } else {
  23947. $url = $this->getUrl();
  23948. }
  23949. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23950. }
  23951. public function getDist($identifier)
  23952. {
  23953. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23954. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23955. }
  23956. public function getComposerInformation($identifier)
  23957. {
  23958. if ($this->gitDriver) {
  23959. return $this->gitDriver->getComposerInformation($identifier);
  23960. }
  23961. if (!isset($this->infoCache[$identifier])) {
  23962. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23963. $composer = JsonFile::parseJson($res);
  23964. } else {
  23965. $composer = $this->getBaseComposerInformation($identifier);
  23966. if ($this->shouldCache($identifier)) {
  23967. $this->cache->write($identifier, json_encode($composer));
  23968. }
  23969. }
  23970. if ($composer) {
  23971. if (!isset($composer['support']['source'])) {
  23972. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  23973. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  23974. }
  23975. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23976. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  23977. }
  23978. if (!isset($composer['abandoned']) && $this->isArchived) {
  23979. $composer['abandoned'] = true;
  23980. }
  23981. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  23982. $composer['funding'] = $funding;
  23983. }
  23984. }
  23985. $this->infoCache[$identifier] = $composer;
  23986. }
  23987. return $this->infoCache[$identifier];
  23988. }
  23989. private function getFundingInfo()
  23990. {
  23991. if (null !== $this->fundingInfo) {
  23992. return $this->fundingInfo;
  23993. }
  23994. if ($this->originUrl !== 'github.com') {
  23995. return $this->fundingInfo = false;
  23996. }
  23997. foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) {
  23998. try {
  23999. $result = $this->remoteFilesystem->getContents($this->originUrl, $file, false, array(
  24000. 'retry-auth-failure' => false,
  24001. ));
  24002. $response = json_decode($result, true);
  24003. } catch (TransportException $e) {
  24004. continue;
  24005. }
  24006. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  24007. continue;
  24008. }
  24009. break;
  24010. }
  24011. if (empty($funding)) {
  24012. return $this->fundingInfo = false;
  24013. }
  24014. $result = array();
  24015. $key = null;
  24016. foreach (preg_split('{\r?\n}', $funding) as $line) {
  24017. $line = trim($line);
  24018. if (preg_match('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  24019. if (preg_match('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
  24020. foreach (array_map('trim', preg_split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  24021. $result[] = array('type' => $match[1], 'url' => trim($item, '"\' '));
  24022. }
  24023. } elseif (preg_match('{^([^#].*?)(\s+#.*)?$}', $match[2], $match2)) {
  24024. $result[] = array('type' => $match[1], 'url' => trim($match2[1], '"\' '));
  24025. }
  24026. $key = null;
  24027. } elseif (preg_match('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  24028. $key = $match[1];
  24029. } elseif ($key && preg_match('{^-\s*(.+)(\s+#.*)?$}', $line, $match)) {
  24030. $result[] = array('type' => $key, 'url' => trim($match[1], '"\' '));
  24031. }
  24032. }
  24033. foreach ($result as $key => $item) {
  24034. switch ($item['type']) {
  24035. case 'tidelift':
  24036. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  24037. break;
  24038. case 'github':
  24039. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  24040. break;
  24041. case 'patreon':
  24042. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  24043. break;
  24044. case 'otechie':
  24045. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  24046. break;
  24047. case 'open_collective':
  24048. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  24049. break;
  24050. case 'liberapay':
  24051. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  24052. break;
  24053. case 'ko_fi':
  24054. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  24055. break;
  24056. case 'issuehunt':
  24057. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  24058. break;
  24059. case 'community_bridge':
  24060. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  24061. break;
  24062. }
  24063. }
  24064. return $this->fundingInfo = $result;
  24065. }
  24066. public function getFileContent($file, $identifier)
  24067. {
  24068. if ($this->gitDriver) {
  24069. return $this->gitDriver->getFileContent($file, $identifier);
  24070. }
  24071. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  24072. $resource = JsonFile::parseJson($this->getContents($resource));
  24073. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  24074. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  24075. }
  24076. return $content;
  24077. }
  24078. public function getChangeDate($identifier)
  24079. {
  24080. if ($this->gitDriver) {
  24081. return $this->gitDriver->getChangeDate($identifier);
  24082. }
  24083. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  24084. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  24085. return new \DateTime($commit['commit']['committer']['date']);
  24086. }
  24087. public function getTags()
  24088. {
  24089. if ($this->gitDriver) {
  24090. return $this->gitDriver->getTags();
  24091. }
  24092. if (null === $this->tags) {
  24093. $this->tags = array();
  24094. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  24095. do {
  24096. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  24097. foreach ($tagsData as $tag) {
  24098. $this->tags[$tag['name']] = $tag['commit']['sha'];
  24099. }
  24100. $resource = $this->getNextPage();
  24101. } while ($resource);
  24102. }
  24103. return $this->tags;
  24104. }
  24105. public function getBranches()
  24106. {
  24107. if ($this->gitDriver) {
  24108. return $this->gitDriver->getBranches();
  24109. }
  24110. if (null === $this->branches) {
  24111. $this->branches = array();
  24112. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  24113. do {
  24114. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  24115. foreach ($branchData as $branch) {
  24116. $name = substr($branch['ref'], 11);
  24117. if ($name !== 'gh-pages') {
  24118. $this->branches[$name] = $branch['object']['sha'];
  24119. }
  24120. }
  24121. $resource = $this->getNextPage();
  24122. } while ($resource);
  24123. }
  24124. return $this->branches;
  24125. }
  24126. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24127. {
  24128. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  24129. return false;
  24130. }
  24131. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  24132. if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  24133. return false;
  24134. }
  24135. if (!extension_loaded('openssl')) {
  24136. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24137. return false;
  24138. }
  24139. return true;
  24140. }
  24141. public function getRepoData()
  24142. {
  24143. $this->fetchRootIdentifier();
  24144. return $this->repoData;
  24145. }
  24146. protected function generateSshUrl()
  24147. {
  24148. if (false !== strpos($this->originUrl, ':')) {
  24149. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  24150. }
  24151. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  24152. }
  24153. protected function getContents($url, $fetchingRepoData = false)
  24154. {
  24155. try {
  24156. return parent::getContents($url);
  24157. } catch (TransportException $e) {
  24158. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24159. switch ($e->getCode()) {
  24160. case 401:
  24161. case 404:
  24162. if (!$fetchingRepoData) {
  24163. throw $e;
  24164. }
  24165. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  24166. return parent::getContents($url);
  24167. }
  24168. if (!$this->io->isInteractive()) {
  24169. return $this->attemptCloneFallback();
  24170. }
  24171. $scopesIssued = array();
  24172. $scopesNeeded = array();
  24173. if ($headers = $e->getHeaders()) {
  24174. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  24175. $scopesIssued = explode(' ', $scopes);
  24176. }
  24177. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  24178. $scopesNeeded = explode(' ', $scopes);
  24179. }
  24180. }
  24181. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  24182. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  24183. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24184. }
  24185. return parent::getContents($url);
  24186. case 403:
  24187. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  24188. return parent::getContents($url);
  24189. }
  24190. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24191. return $this->attemptCloneFallback();
  24192. }
  24193. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  24194. if (!$this->io->hasAuthentication($this->originUrl)) {
  24195. if (!$this->io->isInteractive()) {
  24196. $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>');
  24197. throw $e;
  24198. }
  24199. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  24200. return parent::getContents($url);
  24201. }
  24202. if ($rateLimited) {
  24203. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  24204. $this->io->writeError(sprintf(
  24205. '<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>',
  24206. $rateLimit['limit'],
  24207. $rateLimit['reset']
  24208. ));
  24209. }
  24210. throw $e;
  24211. default:
  24212. throw $e;
  24213. }
  24214. }
  24215. }
  24216. protected function fetchRootIdentifier()
  24217. {
  24218. if ($this->repoData) {
  24219. return;
  24220. }
  24221. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  24222. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  24223. if (null === $this->repoData && null !== $this->gitDriver) {
  24224. return;
  24225. }
  24226. $this->owner = $this->repoData['owner']['login'];
  24227. $this->repository = $this->repoData['name'];
  24228. $this->isPrivate = !empty($this->repoData['private']);
  24229. if (isset($this->repoData['default_branch'])) {
  24230. $this->rootIdentifier = $this->repoData['default_branch'];
  24231. } elseif (isset($this->repoData['master_branch'])) {
  24232. $this->rootIdentifier = $this->repoData['master_branch'];
  24233. } else {
  24234. $this->rootIdentifier = 'master';
  24235. }
  24236. $this->hasIssues = !empty($this->repoData['has_issues']);
  24237. $this->isArchived = !empty($this->repoData['archived']);
  24238. }
  24239. protected function attemptCloneFallback()
  24240. {
  24241. $this->isPrivate = true;
  24242. try {
  24243. $this->setupGitDriver($this->generateSshUrl());
  24244. return;
  24245. } catch (\RuntimeException $e) {
  24246. $this->gitDriver = null;
  24247. $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>');
  24248. throw $e;
  24249. }
  24250. }
  24251. protected function setupGitDriver($url)
  24252. {
  24253. $this->gitDriver = new GitDriver(
  24254. array('url' => $url),
  24255. $this->io,
  24256. $this->config,
  24257. $this->process,
  24258. $this->remoteFilesystem
  24259. );
  24260. $this->gitDriver->initialize();
  24261. }
  24262. protected function getNextPage()
  24263. {
  24264. $headers = $this->remoteFilesystem->getLastHeaders();
  24265. foreach ($headers as $header) {
  24266. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24267. $links = explode(',', $match[1]);
  24268. foreach ($links as $link) {
  24269. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24270. return $match[1];
  24271. }
  24272. }
  24273. }
  24274. }
  24275. }
  24276. }
  24277. <?php
  24278. namespace Composer\Repository\Vcs;
  24279. use Composer\Config;
  24280. use Composer\Cache;
  24281. use Composer\IO\IOInterface;
  24282. use Composer\Json\JsonFile;
  24283. use Composer\Downloader\TransportException;
  24284. use Composer\Util\RemoteFilesystem;
  24285. use Composer\Util\GitLab;
  24286. class GitLabDriver extends VcsDriver
  24287. {
  24288. private $scheme;
  24289. private $namespace;
  24290. private $repository;
  24291. private $project;
  24292. private $commits = array();
  24293. private $tags;
  24294. private $branches;
  24295. protected $gitDriver;
  24296. private $isPrivate = true;
  24297. private $hasNonstandardOrigin = false;
  24298. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  24299. public function initialize()
  24300. {
  24301. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  24302. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  24303. }
  24304. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24305. $configuredDomains = $this->config->get('gitlab-domains');
  24306. $urlParts = explode('/', $match['parts']);
  24307. $this->scheme = !empty($match['scheme'])
  24308. ? $match['scheme']
  24309. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  24310. ;
  24311. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  24312. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  24313. $this->hasNonstandardOrigin = true;
  24314. }
  24315. $this->namespace = implode('/', $urlParts);
  24316. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  24317. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  24318. $this->fetchProject();
  24319. }
  24320. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  24321. {
  24322. $this->remoteFilesystem = $remoteFilesystem;
  24323. }
  24324. public function getComposerInformation($identifier)
  24325. {
  24326. if ($this->gitDriver) {
  24327. return $this->gitDriver->getComposerInformation($identifier);
  24328. }
  24329. if (!isset($this->infoCache[$identifier])) {
  24330. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24331. $composer = JsonFile::parseJson($res);
  24332. } else {
  24333. $composer = $this->getBaseComposerInformation($identifier);
  24334. if ($this->shouldCache($identifier)) {
  24335. $this->cache->write($identifier, json_encode($composer));
  24336. }
  24337. }
  24338. if ($composer) {
  24339. if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) {
  24340. $composer['support']['issues'] = $this->project['_links']['issues'];
  24341. }
  24342. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  24343. $composer['abandoned'] = true;
  24344. }
  24345. }
  24346. $this->infoCache[$identifier] = $composer;
  24347. }
  24348. return $this->infoCache[$identifier];
  24349. }
  24350. public function getFileContent($file, $identifier)
  24351. {
  24352. if ($this->gitDriver) {
  24353. return $this->gitDriver->getFileContent($file, $identifier);
  24354. }
  24355. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  24356. $branches = $this->getBranches();
  24357. if (isset($branches[$identifier])) {
  24358. $identifier = $branches[$identifier];
  24359. }
  24360. }
  24361. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  24362. try {
  24363. $content = $this->getContents($resource);
  24364. } catch (TransportException $e) {
  24365. if ($e->getCode() !== 404) {
  24366. throw $e;
  24367. }
  24368. return null;
  24369. }
  24370. return $content;
  24371. }
  24372. public function getChangeDate($identifier)
  24373. {
  24374. if ($this->gitDriver) {
  24375. return $this->gitDriver->getChangeDate($identifier);
  24376. }
  24377. if (isset($this->commits[$identifier])) {
  24378. return new \DateTime($this->commits[$identifier]['committed_date']);
  24379. }
  24380. return new \DateTime();
  24381. }
  24382. public function getRepositoryUrl()
  24383. {
  24384. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  24385. }
  24386. public function getUrl()
  24387. {
  24388. if ($this->gitDriver) {
  24389. return $this->gitDriver->getUrl();
  24390. }
  24391. return $this->project['web_url'];
  24392. }
  24393. public function getDist($identifier)
  24394. {
  24395. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  24396. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  24397. }
  24398. public function getSource($identifier)
  24399. {
  24400. if ($this->gitDriver) {
  24401. return $this->gitDriver->getSource($identifier);
  24402. }
  24403. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  24404. }
  24405. public function getRootIdentifier()
  24406. {
  24407. if ($this->gitDriver) {
  24408. return $this->gitDriver->getRootIdentifier();
  24409. }
  24410. return $this->project['default_branch'];
  24411. }
  24412. public function getBranches()
  24413. {
  24414. if ($this->gitDriver) {
  24415. return $this->gitDriver->getBranches();
  24416. }
  24417. if (!$this->branches) {
  24418. $this->branches = $this->getReferences('branches');
  24419. }
  24420. return $this->branches;
  24421. }
  24422. public function getTags()
  24423. {
  24424. if ($this->gitDriver) {
  24425. return $this->gitDriver->getTags();
  24426. }
  24427. if (!$this->tags) {
  24428. $this->tags = $this->getReferences('tags');
  24429. }
  24430. return $this->tags;
  24431. }
  24432. public function getApiUrl()
  24433. {
  24434. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  24435. }
  24436. private function urlEncodeAll($string)
  24437. {
  24438. $encoded = '';
  24439. for ($i = 0; isset($string[$i]); $i++) {
  24440. $character = $string[$i];
  24441. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  24442. $character = '%' . sprintf('%02X', ord($character));
  24443. }
  24444. $encoded .= $character;
  24445. }
  24446. return $encoded;
  24447. }
  24448. protected function getReferences($type)
  24449. {
  24450. $perPage = 100;
  24451. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  24452. $references = array();
  24453. do {
  24454. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  24455. foreach ($data as $datum) {
  24456. $references[$datum['name']] = $datum['commit']['id'];
  24457. $this->commits[$datum['commit']['id']] = $datum['commit'];
  24458. }
  24459. if (count($data) >= $perPage) {
  24460. $resource = $this->getNextPage();
  24461. } else {
  24462. $resource = false;
  24463. }
  24464. } while ($resource);
  24465. return $references;
  24466. }
  24467. protected function fetchProject()
  24468. {
  24469. $resource = $this->getApiUrl();
  24470. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  24471. if (isset($this->project['visibility'])) {
  24472. $this->isPrivate = $this->project['visibility'] !== 'public';
  24473. } else {
  24474. $this->isPrivate = false;
  24475. }
  24476. }
  24477. protected function attemptCloneFallback()
  24478. {
  24479. try {
  24480. if ($this->isPrivate === false) {
  24481. $url = $this->generatePublicUrl();
  24482. } else {
  24483. $url = $this->generateSshUrl();
  24484. }
  24485. $this->setupGitDriver($url);
  24486. return;
  24487. } catch (\RuntimeException $e) {
  24488. $this->gitDriver = null;
  24489. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  24490. throw $e;
  24491. }
  24492. }
  24493. protected function generateSshUrl()
  24494. {
  24495. if ($this->hasNonstandardOrigin) {
  24496. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  24497. }
  24498. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  24499. }
  24500. protected function generatePublicUrl()
  24501. {
  24502. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  24503. }
  24504. protected function setupGitDriver($url)
  24505. {
  24506. $this->gitDriver = new GitDriver(
  24507. array('url' => $url),
  24508. $this->io,
  24509. $this->config,
  24510. $this->process,
  24511. $this->remoteFilesystem
  24512. );
  24513. $this->gitDriver->initialize();
  24514. }
  24515. protected function getContents($url, $fetchingRepoData = false)
  24516. {
  24517. try {
  24518. $res = parent::getContents($url);
  24519. if ($fetchingRepoData) {
  24520. $json = JsonFile::parseJson($res, $url);
  24521. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  24522. $this->isPrivate = $json['visibility'] !== 'public';
  24523. $moreThanGuestAccess = false;
  24524. foreach ($json['permissions'] as $permission) {
  24525. if ($permission && $permission['access_level'] > 10) {
  24526. $moreThanGuestAccess = true;
  24527. }
  24528. }
  24529. if (!$moreThanGuestAccess) {
  24530. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  24531. return $this->attemptCloneFallback();
  24532. }
  24533. }
  24534. if (!isset($json['default_branch'])) {
  24535. if (!empty($json['id'])) {
  24536. $this->isPrivate = false;
  24537. }
  24538. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  24539. }
  24540. }
  24541. return $res;
  24542. } catch (TransportException $e) {
  24543. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24544. switch ($e->getCode()) {
  24545. case 401:
  24546. case 404:
  24547. if (!$fetchingRepoData) {
  24548. throw $e;
  24549. }
  24550. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  24551. return parent::getContents($url);
  24552. }
  24553. if (!$this->io->isInteractive()) {
  24554. return $this->attemptCloneFallback();
  24555. }
  24556. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  24557. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24558. return parent::getContents($url);
  24559. case 403:
  24560. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  24561. return parent::getContents($url);
  24562. }
  24563. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24564. return $this->attemptCloneFallback();
  24565. }
  24566. throw $e;
  24567. default:
  24568. throw $e;
  24569. }
  24570. }
  24571. }
  24572. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24573. {
  24574. if (!preg_match(self::URL_REGEX, $url, $match)) {
  24575. return false;
  24576. }
  24577. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  24578. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24579. $urlParts = explode('/', $match['parts']);
  24580. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  24581. return false;
  24582. }
  24583. if ('https' === $scheme && !extension_loaded('openssl')) {
  24584. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24585. return false;
  24586. }
  24587. return true;
  24588. }
  24589. private function getNextPage()
  24590. {
  24591. $headers = $this->remoteFilesystem->getLastHeaders();
  24592. foreach ($headers as $header) {
  24593. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24594. $links = explode(',', $match[1]);
  24595. foreach ($links as $link) {
  24596. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24597. return $match[1];
  24598. }
  24599. }
  24600. }
  24601. }
  24602. }
  24603. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  24604. {
  24605. $guessedDomain = strtolower($guessedDomain);
  24606. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  24607. if ($portNumber) {
  24608. return $guessedDomain.':'.$portNumber;
  24609. }
  24610. return $guessedDomain;
  24611. }
  24612. if ($portNumber) {
  24613. $guessedDomain .= ':'.$portNumber;
  24614. }
  24615. while (null !== ($part = array_shift($urlParts))) {
  24616. $guessedDomain .= '/' . $part;
  24617. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  24618. return $guessedDomain;
  24619. }
  24620. }
  24621. return false;
  24622. }
  24623. }
  24624. <?php
  24625. namespace Composer\Repository\Vcs;
  24626. use Composer\Config;
  24627. use Composer\IO\IOInterface;
  24628. class HgBitbucketDriver extends BitbucketDriver
  24629. {
  24630. public function getRootIdentifier()
  24631. {
  24632. if ($this->fallbackDriver) {
  24633. return $this->fallbackDriver->getRootIdentifier();
  24634. }
  24635. if (null === $this->rootIdentifier) {
  24636. if (! $this->getRepoData()) {
  24637. return $this->fallbackDriver->getRootIdentifier();
  24638. }
  24639. if ($this->vcsType !== 'hg') {
  24640. throw new \RuntimeException(
  24641. $this->url.' does not appear to be a mercurial repository, use '.
  24642. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  24643. );
  24644. }
  24645. $mainBranchData = $this->getMainBranchData();
  24646. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  24647. }
  24648. return $this->rootIdentifier;
  24649. }
  24650. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24651. {
  24652. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
  24653. return false;
  24654. }
  24655. if (!extension_loaded('openssl')) {
  24656. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24657. return false;
  24658. }
  24659. return true;
  24660. }
  24661. protected function setupFallbackDriver($url)
  24662. {
  24663. $this->fallbackDriver = new HgDriver(
  24664. array('url' => $url),
  24665. $this->io,
  24666. $this->config,
  24667. $this->process,
  24668. $this->remoteFilesystem
  24669. );
  24670. $this->fallbackDriver->initialize();
  24671. }
  24672. protected function generateSshUrl()
  24673. {
  24674. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  24675. }
  24676. }
  24677. <?php
  24678. namespace Composer\Repository\Vcs;
  24679. use Composer\Config;
  24680. use Composer\Cache;
  24681. use Composer\Util\Hg as HgUtils;
  24682. use Composer\Util\ProcessExecutor;
  24683. use Composer\Util\Filesystem;
  24684. use Composer\IO\IOInterface;
  24685. class HgDriver extends VcsDriver
  24686. {
  24687. protected $tags;
  24688. protected $branches;
  24689. protected $rootIdentifier;
  24690. protected $repoDir;
  24691. protected $infoCache = array();
  24692. public function initialize()
  24693. {
  24694. if (Filesystem::isLocalPath($this->url)) {
  24695. $this->repoDir = $this->url;
  24696. } else {
  24697. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24698. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24699. }
  24700. $cacheDir = $this->config->get('cache-vcs-dir');
  24701. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  24702. $fs = new Filesystem();
  24703. $fs->ensureDirectoryExists($cacheDir);
  24704. if (!is_writable(dirname($this->repoDir))) {
  24705. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  24706. }
  24707. $this->config->prohibitUrlByConfig($this->url, $this->io);
  24708. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  24709. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  24710. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  24711. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  24712. }
  24713. } else {
  24714. $fs->removeDirectory($this->repoDir);
  24715. $repoDir = $this->repoDir;
  24716. $command = function ($url) use ($repoDir) {
  24717. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  24718. };
  24719. $hgUtils->runCommand($command, $this->url, null);
  24720. }
  24721. }
  24722. $this->getTags();
  24723. $this->getBranches();
  24724. }
  24725. public function getRootIdentifier()
  24726. {
  24727. if (null === $this->rootIdentifier) {
  24728. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  24729. $output = $this->process->splitLines($output);
  24730. $this->rootIdentifier = $output[0];
  24731. }
  24732. return $this->rootIdentifier;
  24733. }
  24734. public function getUrl()
  24735. {
  24736. return $this->url;
  24737. }
  24738. public function getSource($identifier)
  24739. {
  24740. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  24741. }
  24742. public function getDist($identifier)
  24743. {
  24744. return null;
  24745. }
  24746. public function getFileContent($file, $identifier)
  24747. {
  24748. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  24749. $this->process->execute($resource, $content, $this->repoDir);
  24750. if (!trim($content)) {
  24751. return;
  24752. }
  24753. return $content;
  24754. }
  24755. public function getChangeDate($identifier)
  24756. {
  24757. $this->process->execute(
  24758. sprintf(
  24759. 'hg log --template "{date|rfc3339date}" -r %s',
  24760. ProcessExecutor::escape($identifier)
  24761. ),
  24762. $output,
  24763. $this->repoDir
  24764. );
  24765. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  24766. }
  24767. public function getTags()
  24768. {
  24769. if (null === $this->tags) {
  24770. $tags = array();
  24771. $this->process->execute('hg tags', $output, $this->repoDir);
  24772. foreach ($this->process->splitLines($output) as $tag) {
  24773. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  24774. $tags[$match[1]] = $match[2];
  24775. }
  24776. }
  24777. unset($tags['tip']);
  24778. $this->tags = $tags;
  24779. }
  24780. return $this->tags;
  24781. }
  24782. public function getBranches()
  24783. {
  24784. if (null === $this->branches) {
  24785. $branches = array();
  24786. $bookmarks = array();
  24787. $this->process->execute('hg branches', $output, $this->repoDir);
  24788. foreach ($this->process->splitLines($output) as $branch) {
  24789. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  24790. $branches[$match[1]] = $match[2];
  24791. }
  24792. }
  24793. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  24794. foreach ($this->process->splitLines($output) as $branch) {
  24795. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  24796. $bookmarks[$match[1]] = $match[2];
  24797. }
  24798. }
  24799. $this->branches = array_merge($bookmarks, $branches);
  24800. }
  24801. return $this->branches;
  24802. }
  24803. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24804. {
  24805. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  24806. return true;
  24807. }
  24808. if (Filesystem::isLocalPath($url)) {
  24809. $url = Filesystem::getPlatformPath($url);
  24810. if (!is_dir($url)) {
  24811. return false;
  24812. }
  24813. $process = new ProcessExecutor($io);
  24814. if ($process->execute('hg summary', $output, $url) === 0) {
  24815. return true;
  24816. }
  24817. }
  24818. if (!$deep) {
  24819. return false;
  24820. }
  24821. $processExecutor = new ProcessExecutor($io);
  24822. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  24823. return $exit === 0;
  24824. }
  24825. }
  24826. <?php
  24827. namespace Composer\Repository\Vcs;
  24828. use Composer\Config;
  24829. use Composer\Cache;
  24830. use Composer\IO\IOInterface;
  24831. use Composer\Util\ProcessExecutor;
  24832. use Composer\Util\Perforce;
  24833. class PerforceDriver extends VcsDriver
  24834. {
  24835. protected $depot;
  24836. protected $branch;
  24837. protected $perforce;
  24838. public function initialize()
  24839. {
  24840. $this->depot = $this->repoConfig['depot'];
  24841. $this->branch = '';
  24842. if (!empty($this->repoConfig['branch'])) {
  24843. $this->branch = $this->repoConfig['branch'];
  24844. }
  24845. $this->initPerforce($this->repoConfig);
  24846. $this->perforce->p4Login();
  24847. $this->perforce->checkStream();
  24848. $this->perforce->writeP4ClientSpec();
  24849. $this->perforce->connectClient();
  24850. return true;
  24851. }
  24852. private function initPerforce($repoConfig)
  24853. {
  24854. if (!empty($this->perforce)) {
  24855. return;
  24856. }
  24857. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24858. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24859. }
  24860. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  24861. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  24862. }
  24863. public function getFileContent($file, $identifier)
  24864. {
  24865. return $this->perforce->getFileContent($file, $identifier);
  24866. }
  24867. public function getChangeDate($identifier)
  24868. {
  24869. return null;
  24870. }
  24871. public function getRootIdentifier()
  24872. {
  24873. return $this->branch;
  24874. }
  24875. public function getBranches()
  24876. {
  24877. return $this->perforce->getBranches();
  24878. }
  24879. public function getTags()
  24880. {
  24881. return $this->perforce->getTags();
  24882. }
  24883. public function getDist($identifier)
  24884. {
  24885. return null;
  24886. }
  24887. public function getSource($identifier)
  24888. {
  24889. $source = array(
  24890. 'type' => 'perforce',
  24891. 'url' => $this->repoConfig['url'],
  24892. 'reference' => $identifier,
  24893. 'p4user' => $this->perforce->getUser(),
  24894. );
  24895. return $source;
  24896. }
  24897. public function getUrl()
  24898. {
  24899. return $this->url;
  24900. }
  24901. public function hasComposerFile($identifier)
  24902. {
  24903. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  24904. $composerInfoIdentifier = $identifier;
  24905. return !empty($composerInfo);
  24906. }
  24907. public function getContents($url)
  24908. {
  24909. return false;
  24910. }
  24911. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24912. {
  24913. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  24914. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  24915. }
  24916. return false;
  24917. }
  24918. public function cleanup()
  24919. {
  24920. $this->perforce->cleanupClientSpec();
  24921. $this->perforce = null;
  24922. }
  24923. public function getDepot()
  24924. {
  24925. return $this->depot;
  24926. }
  24927. public function getBranch()
  24928. {
  24929. return $this->branch;
  24930. }
  24931. }
  24932. <?php
  24933. namespace Composer\Repository\Vcs;
  24934. use Composer\Cache;
  24935. use Composer\Config;
  24936. use Composer\Json\JsonFile;
  24937. use Composer\Util\ProcessExecutor;
  24938. use Composer\Util\Filesystem;
  24939. use Composer\Util\Svn as SvnUtil;
  24940. use Composer\IO\IOInterface;
  24941. use Composer\Downloader\TransportException;
  24942. class SvnDriver extends VcsDriver
  24943. {
  24944. protected $cache;
  24945. protected $baseUrl;
  24946. protected $tags;
  24947. protected $branches;
  24948. protected $rootIdentifier;
  24949. protected $infoCache = array();
  24950. protected $trunkPath = 'trunk';
  24951. protected $branchesPath = 'branches';
  24952. protected $tagsPath = 'tags';
  24953. protected $packagePath = '';
  24954. protected $cacheCredentials = true;
  24955. private $util;
  24956. public function initialize()
  24957. {
  24958. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  24959. SvnUtil::cleanEnv();
  24960. if (isset($this->repoConfig['trunk-path'])) {
  24961. $this->trunkPath = $this->repoConfig['trunk-path'];
  24962. }
  24963. if (isset($this->repoConfig['branches-path'])) {
  24964. $this->branchesPath = $this->repoConfig['branches-path'];
  24965. }
  24966. if (isset($this->repoConfig['tags-path'])) {
  24967. $this->tagsPath = $this->repoConfig['tags-path'];
  24968. }
  24969. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  24970. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  24971. }
  24972. if (isset($this->repoConfig['package-path'])) {
  24973. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  24974. }
  24975. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  24976. $this->baseUrl = substr($this->url, 0, $pos);
  24977. }
  24978. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  24979. $this->getBranches();
  24980. $this->getTags();
  24981. }
  24982. public function getRootIdentifier()
  24983. {
  24984. return $this->rootIdentifier ?: $this->trunkPath;
  24985. }
  24986. public function getUrl()
  24987. {
  24988. return $this->url;
  24989. }
  24990. public function getSource($identifier)
  24991. {
  24992. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  24993. }
  24994. public function getDist($identifier)
  24995. {
  24996. return null;
  24997. }
  24998. protected function shouldCache($identifier)
  24999. {
  25000. return $this->cache && preg_match('{@\d+$}', $identifier);
  25001. }
  25002. public function getComposerInformation($identifier)
  25003. {
  25004. if (!isset($this->infoCache[$identifier])) {
  25005. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  25006. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25007. }
  25008. try {
  25009. $composer = $this->getBaseComposerInformation($identifier);
  25010. } catch (TransportException $e) {
  25011. $message = $e->getMessage();
  25012. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  25013. throw $e;
  25014. }
  25015. $composer = '';
  25016. }
  25017. if ($this->shouldCache($identifier)) {
  25018. $this->cache->write($identifier.'.json', json_encode($composer));
  25019. }
  25020. $this->infoCache[$identifier] = $composer;
  25021. }
  25022. return $this->infoCache[$identifier];
  25023. }
  25024. public function getFileContent($file, $identifier)
  25025. {
  25026. $identifier = '/' . trim($identifier, '/') . '/';
  25027. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25028. if (!empty($match[2])) {
  25029. $path = $match[1];
  25030. $rev = $match[2];
  25031. } else {
  25032. $path = $identifier;
  25033. $rev = '';
  25034. }
  25035. try {
  25036. $resource = $path.$file;
  25037. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  25038. if (!trim($output)) {
  25039. return null;
  25040. }
  25041. } catch (\RuntimeException $e) {
  25042. throw new TransportException($e->getMessage());
  25043. }
  25044. return $output;
  25045. }
  25046. public function getChangeDate($identifier)
  25047. {
  25048. $identifier = '/' . trim($identifier, '/') . '/';
  25049. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25050. if (!empty($match[2])) {
  25051. $path = $match[1];
  25052. $rev = $match[2];
  25053. } else {
  25054. $path = $identifier;
  25055. $rev = '';
  25056. }
  25057. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  25058. foreach ($this->process->splitLines($output) as $line) {
  25059. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  25060. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  25061. }
  25062. }
  25063. return null;
  25064. }
  25065. public function getTags()
  25066. {
  25067. if (null === $this->tags) {
  25068. $this->tags = array();
  25069. if ($this->tagsPath !== false) {
  25070. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  25071. if ($output) {
  25072. foreach ($this->process->splitLines($output) as $line) {
  25073. $line = trim($line);
  25074. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25075. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25076. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  25077. '/' . $this->tagsPath . '/' . $match[2],
  25078. $match[1]
  25079. );
  25080. }
  25081. }
  25082. }
  25083. }
  25084. }
  25085. }
  25086. return $this->tags;
  25087. }
  25088. public function getBranches()
  25089. {
  25090. if (null === $this->branches) {
  25091. $this->branches = array();
  25092. if (false === $this->trunkPath) {
  25093. $trunkParent = $this->baseUrl . '/';
  25094. } else {
  25095. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  25096. }
  25097. $output = $this->execute('svn ls --verbose', $trunkParent);
  25098. if ($output) {
  25099. foreach ($this->process->splitLines($output) as $line) {
  25100. $line = trim($line);
  25101. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25102. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  25103. $this->branches['trunk'] = $this->buildIdentifier(
  25104. '/' . $this->trunkPath,
  25105. $match[1]
  25106. );
  25107. $this->rootIdentifier = $this->branches['trunk'];
  25108. break;
  25109. }
  25110. }
  25111. }
  25112. }
  25113. unset($output);
  25114. if ($this->branchesPath !== false) {
  25115. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  25116. if ($output) {
  25117. foreach ($this->process->splitLines(trim($output)) as $line) {
  25118. $line = trim($line);
  25119. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25120. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25121. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  25122. '/' . $this->branchesPath . '/' . $match[2],
  25123. $match[1]
  25124. );
  25125. }
  25126. }
  25127. }
  25128. }
  25129. }
  25130. }
  25131. return $this->branches;
  25132. }
  25133. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  25134. {
  25135. $url = self::normalizeUrl($url);
  25136. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  25137. return true;
  25138. }
  25139. if (!$deep && !Filesystem::isLocalPath($url)) {
  25140. return false;
  25141. }
  25142. $processExecutor = new ProcessExecutor($io);
  25143. $exit = $processExecutor->execute(
  25144. "svn info --non-interactive ".ProcessExecutor::escape($url),
  25145. $ignoredOutput
  25146. );
  25147. if ($exit === 0) {
  25148. return true;
  25149. }
  25150. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  25151. return true;
  25152. }
  25153. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  25154. return true;
  25155. }
  25156. return false;
  25157. }
  25158. protected static function normalizeUrl($url)
  25159. {
  25160. $fs = new Filesystem();
  25161. if ($fs->isAbsolutePath($url)) {
  25162. return 'file://' . strtr($url, '\\', '/');
  25163. }
  25164. return $url;
  25165. }
  25166. protected function execute($command, $url)
  25167. {
  25168. if (null === $this->util) {
  25169. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  25170. $this->util->setCacheCredentials($this->cacheCredentials);
  25171. }
  25172. try {
  25173. return $this->util->execute($command, $url);
  25174. } catch (\RuntimeException $e) {
  25175. if (null === $this->util->binaryVersion()) {
  25176. 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());
  25177. }
  25178. throw new \RuntimeException(
  25179. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  25180. );
  25181. }
  25182. }
  25183. protected function buildIdentifier($baseDir, $revision)
  25184. {
  25185. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  25186. }
  25187. }
  25188. <?php
  25189. namespace Composer\Repository\Vcs;
  25190. use Composer\Cache;
  25191. use Composer\Downloader\TransportException;
  25192. use Composer\Config;
  25193. use Composer\Factory;
  25194. use Composer\IO\IOInterface;
  25195. use Composer\Json\JsonFile;
  25196. use Composer\Util\ProcessExecutor;
  25197. use Composer\Util\RemoteFilesystem;
  25198. use Composer\Util\Filesystem;
  25199. abstract class VcsDriver implements VcsDriverInterface
  25200. {
  25201. protected $url;
  25202. protected $originUrl;
  25203. protected $repoConfig;
  25204. protected $io;
  25205. protected $config;
  25206. protected $process;
  25207. protected $remoteFilesystem;
  25208. protected $infoCache = array();
  25209. protected $cache;
  25210. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25211. {
  25212. if (Filesystem::isLocalPath($repoConfig['url'])) {
  25213. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  25214. }
  25215. $this->url = $repoConfig['url'];
  25216. $this->originUrl = $repoConfig['url'];
  25217. $this->repoConfig = $repoConfig;
  25218. $this->io = $io;
  25219. $this->config = $config;
  25220. $this->process = $process ?: new ProcessExecutor($io);
  25221. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25222. }
  25223. protected function shouldCache($identifier)
  25224. {
  25225. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  25226. }
  25227. public function getComposerInformation($identifier)
  25228. {
  25229. if (!isset($this->infoCache[$identifier])) {
  25230. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  25231. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25232. }
  25233. $composer = $this->getBaseComposerInformation($identifier);
  25234. if ($this->shouldCache($identifier)) {
  25235. $this->cache->write($identifier, json_encode($composer));
  25236. }
  25237. $this->infoCache[$identifier] = $composer;
  25238. }
  25239. return $this->infoCache[$identifier];
  25240. }
  25241. protected function getBaseComposerInformation($identifier)
  25242. {
  25243. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25244. if (!$composerFileContent) {
  25245. return null;
  25246. }
  25247. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  25248. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  25249. $composer['time'] = $changeDate->format(DATE_RFC3339);
  25250. }
  25251. return $composer;
  25252. }
  25253. public function hasComposerFile($identifier)
  25254. {
  25255. try {
  25256. return (bool) $this->getComposerInformation($identifier);
  25257. } catch (TransportException $e) {
  25258. }
  25259. return false;
  25260. }
  25261. protected function getScheme()
  25262. {
  25263. if (extension_loaded('openssl')) {
  25264. return 'https';
  25265. }
  25266. return 'http';
  25267. }
  25268. protected function getContents($url)
  25269. {
  25270. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  25271. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  25272. }
  25273. public function cleanup()
  25274. {
  25275. return;
  25276. }
  25277. }
  25278. <?php
  25279. namespace Composer\Repository\Vcs;
  25280. use Composer\Config;
  25281. use Composer\IO\IOInterface;
  25282. interface VcsDriverInterface
  25283. {
  25284. public function initialize();
  25285. public function getComposerInformation($identifier);
  25286. public function getFileContent($file, $identifier);
  25287. public function getChangeDate($identifier);
  25288. public function getRootIdentifier();
  25289. public function getBranches();
  25290. public function getTags();
  25291. public function getDist($identifier);
  25292. public function getSource($identifier);
  25293. public function getUrl();
  25294. public function hasComposerFile($identifier);
  25295. public function cleanup();
  25296. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  25297. }
  25298. <?php
  25299. namespace Composer\Repository;
  25300. use Composer\Downloader\TransportException;
  25301. use Composer\Repository\Vcs\VcsDriverInterface;
  25302. use Composer\Package\Version\VersionParser;
  25303. use Composer\Package\Loader\ArrayLoader;
  25304. use Composer\Package\Loader\ValidatingArrayLoader;
  25305. use Composer\Package\Loader\InvalidPackageException;
  25306. use Composer\Package\Loader\LoaderInterface;
  25307. use Composer\EventDispatcher\EventDispatcher;
  25308. use Composer\Semver\Constraint\Constraint;
  25309. use Composer\IO\IOInterface;
  25310. use Composer\Config;
  25311. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  25312. {
  25313. protected $url;
  25314. protected $packageName;
  25315. protected $isVerbose;
  25316. protected $isVeryVerbose;
  25317. protected $io;
  25318. protected $config;
  25319. protected $versionParser;
  25320. protected $type;
  25321. protected $loader;
  25322. protected $repoConfig;
  25323. protected $branchErrorOccurred = false;
  25324. private $drivers;
  25325. private $driver;
  25326. private $versionCache;
  25327. private $emptyReferences = array();
  25328. private $versionTransportExceptions = array();
  25329. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  25330. {
  25331. parent::__construct();
  25332. $this->drivers = $drivers ?: array(
  25333. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  25334. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  25335. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  25336. 'git' => 'Composer\Repository\Vcs\GitDriver',
  25337. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  25338. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  25339. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  25340. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  25341. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  25342. );
  25343. $this->url = $repoConfig['url'];
  25344. $this->io = $io;
  25345. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  25346. $this->isVerbose = $io->isVerbose();
  25347. $this->isVeryVerbose = $io->isVeryVerbose();
  25348. $this->config = $config;
  25349. $this->repoConfig = $repoConfig;
  25350. $this->versionCache = $versionCache;
  25351. }
  25352. public function getRepoConfig()
  25353. {
  25354. return $this->repoConfig;
  25355. }
  25356. public function setLoader(LoaderInterface $loader)
  25357. {
  25358. $this->loader = $loader;
  25359. }
  25360. public function getDriver()
  25361. {
  25362. if ($this->driver) {
  25363. return $this->driver;
  25364. }
  25365. if (isset($this->drivers[$this->type])) {
  25366. $class = $this->drivers[$this->type];
  25367. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  25368. $this->driver->initialize();
  25369. return $this->driver;
  25370. }
  25371. foreach ($this->drivers as $driver) {
  25372. if ($driver::supports($this->io, $this->config, $this->url)) {
  25373. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25374. $this->driver->initialize();
  25375. return $this->driver;
  25376. }
  25377. }
  25378. foreach ($this->drivers as $driver) {
  25379. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  25380. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25381. $this->driver->initialize();
  25382. return $this->driver;
  25383. }
  25384. }
  25385. }
  25386. public function hadInvalidBranches()
  25387. {
  25388. return $this->branchErrorOccurred;
  25389. }
  25390. public function getEmptyReferences()
  25391. {
  25392. return $this->emptyReferences;
  25393. }
  25394. public function getVersionTransportExceptions()
  25395. {
  25396. return $this->versionTransportExceptions;
  25397. }
  25398. protected function initialize()
  25399. {
  25400. parent::initialize();
  25401. $isVerbose = $this->isVerbose;
  25402. $isVeryVerbose = $this->isVeryVerbose;
  25403. $driver = $this->getDriver();
  25404. if (!$driver) {
  25405. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  25406. }
  25407. $this->versionParser = new VersionParser;
  25408. if (!$this->loader) {
  25409. $this->loader = new ArrayLoader($this->versionParser);
  25410. }
  25411. try {
  25412. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  25413. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  25414. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  25415. }
  25416. } catch (\Exception $e) {
  25417. if ($isVeryVerbose) {
  25418. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  25419. }
  25420. }
  25421. foreach ($driver->getTags() as $tag => $identifier) {
  25422. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  25423. if ($isVeryVerbose) {
  25424. $this->io->writeError($msg);
  25425. } elseif ($isVerbose) {
  25426. $this->io->overwriteError($msg, false);
  25427. }
  25428. $tag = str_replace('release-', '', $tag);
  25429. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  25430. if ($cachedPackage) {
  25431. $this->addPackage($cachedPackage);
  25432. continue;
  25433. } elseif ($cachedPackage === false) {
  25434. $this->emptyReferences[] = $identifier;
  25435. continue;
  25436. }
  25437. if (!$parsedTag = $this->validateTag($tag)) {
  25438. if ($isVeryVerbose) {
  25439. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  25440. }
  25441. continue;
  25442. }
  25443. try {
  25444. if (!$data = $driver->getComposerInformation($identifier)) {
  25445. if ($isVeryVerbose) {
  25446. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  25447. }
  25448. $this->emptyReferences[] = $identifier;
  25449. continue;
  25450. }
  25451. if (isset($data['version'])) {
  25452. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  25453. } else {
  25454. $data['version'] = $tag;
  25455. $data['version_normalized'] = $parsedTag;
  25456. }
  25457. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  25458. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  25459. if ($data['version_normalized'] !== $parsedTag) {
  25460. if ($isVeryVerbose) {
  25461. if (preg_match('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  25462. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  25463. } else {
  25464. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  25465. }
  25466. }
  25467. continue;
  25468. }
  25469. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  25470. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  25471. if ($isVeryVerbose) {
  25472. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  25473. }
  25474. continue;
  25475. }
  25476. if ($isVeryVerbose) {
  25477. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  25478. }
  25479. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  25480. } catch (\Exception $e) {
  25481. if ($e instanceof TransportException) {
  25482. $this->versionTransportExceptions['tags'][$tag] = $e;
  25483. if ($e->getCode() === 404) {
  25484. $this->emptyReferences[] = $identifier;
  25485. }
  25486. }
  25487. if ($isVeryVerbose) {
  25488. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  25489. }
  25490. continue;
  25491. }
  25492. }
  25493. if (!$isVeryVerbose) {
  25494. $this->io->overwriteError('', false);
  25495. }
  25496. $branches = $driver->getBranches();
  25497. foreach ($branches as $branch => $identifier) {
  25498. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  25499. if ($isVeryVerbose) {
  25500. $this->io->writeError($msg);
  25501. } elseif ($isVerbose) {
  25502. $this->io->overwriteError($msg, false);
  25503. }
  25504. if ($branch === 'trunk' && isset($branches['master'])) {
  25505. if ($isVeryVerbose) {
  25506. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  25507. }
  25508. continue;
  25509. }
  25510. if (!$parsedBranch = $this->validateBranch($branch)) {
  25511. if ($isVeryVerbose) {
  25512. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  25513. }
  25514. continue;
  25515. }
  25516. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  25517. $version = 'dev-' . $branch;
  25518. } else {
  25519. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  25520. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  25521. }
  25522. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  25523. if ($cachedPackage) {
  25524. $this->addPackage($cachedPackage);
  25525. continue;
  25526. } elseif ($cachedPackage === false) {
  25527. $this->emptyReferences[] = $identifier;
  25528. continue;
  25529. }
  25530. try {
  25531. if (!$data = $driver->getComposerInformation($identifier)) {
  25532. if ($isVeryVerbose) {
  25533. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  25534. }
  25535. $this->emptyReferences[] = $identifier;
  25536. continue;
  25537. }
  25538. $data['version'] = $version;
  25539. $data['version_normalized'] = $parsedBranch;
  25540. if ($isVeryVerbose) {
  25541. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  25542. }
  25543. $packageData = $this->preProcess($driver, $data, $identifier);
  25544. $package = $this->loader->load($packageData);
  25545. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  25546. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  25547. }
  25548. $this->addPackage($package);
  25549. } catch (TransportException $e) {
  25550. $this->versionTransportExceptions['branches'][$branch] = $e;
  25551. if ($e->getCode() === 404) {
  25552. $this->emptyReferences[] = $identifier;
  25553. }
  25554. if ($isVeryVerbose) {
  25555. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  25556. }
  25557. continue;
  25558. } catch (\Exception $e) {
  25559. if (!$isVeryVerbose) {
  25560. $this->io->writeError('');
  25561. }
  25562. $this->branchErrorOccurred = true;
  25563. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  25564. $this->io->writeError('');
  25565. continue;
  25566. }
  25567. }
  25568. $driver->cleanup();
  25569. if (!$isVeryVerbose) {
  25570. $this->io->overwriteError('', false);
  25571. }
  25572. if (!$this->getPackages()) {
  25573. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  25574. }
  25575. }
  25576. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  25577. {
  25578. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  25579. $data['name'] = $this->packageName ?: $dataPackageName;
  25580. if (!isset($data['dist'])) {
  25581. $data['dist'] = $driver->getDist($identifier);
  25582. }
  25583. if (!isset($data['source'])) {
  25584. $data['source'] = $driver->getSource($identifier);
  25585. }
  25586. return $data;
  25587. }
  25588. private function validateBranch($branch)
  25589. {
  25590. try {
  25591. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  25592. $this->versionParser->parseConstraints($normalizedBranch);
  25593. return $normalizedBranch;
  25594. } catch (\Exception $e) {
  25595. }
  25596. return false;
  25597. }
  25598. private function validateTag($version)
  25599. {
  25600. try {
  25601. return $this->versionParser->normalize($version);
  25602. } catch (\Exception $e) {
  25603. }
  25604. return false;
  25605. }
  25606. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  25607. {
  25608. if (!$this->versionCache) {
  25609. return;
  25610. }
  25611. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  25612. if ($cachedPackage === false) {
  25613. if ($isVeryVerbose) {
  25614. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  25615. }
  25616. return false;
  25617. }
  25618. if ($cachedPackage) {
  25619. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  25620. if ($isVeryVerbose) {
  25621. $this->io->writeError($msg);
  25622. } elseif ($isVerbose) {
  25623. $this->io->overwriteError($msg, false);
  25624. }
  25625. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  25626. if ($isVeryVerbose) {
  25627. $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>');
  25628. }
  25629. $cachedPackage = null;
  25630. }
  25631. }
  25632. if ($cachedPackage) {
  25633. return $this->loader->load($cachedPackage);
  25634. }
  25635. return null;
  25636. }
  25637. }
  25638. <?php
  25639. namespace Composer\Repository;
  25640. interface VersionCacheInterface
  25641. {
  25642. public function getVersionPackage($version, $identifier);
  25643. }
  25644. <?php
  25645. namespace Composer\Repository;
  25646. use Composer\Package\AliasPackage;
  25647. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  25648. {
  25649. public function write()
  25650. {
  25651. }
  25652. public function reload()
  25653. {
  25654. }
  25655. public function getCanonicalPackages()
  25656. {
  25657. $packages = $this->getPackages();
  25658. $packagesByName = array();
  25659. foreach ($packages as $package) {
  25660. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  25661. $packagesByName[$package->getName()] = $package;
  25662. }
  25663. }
  25664. $canonicalPackages = array();
  25665. foreach ($packagesByName as $package) {
  25666. while ($package instanceof AliasPackage) {
  25667. $package = $package->getAliasOf();
  25668. }
  25669. $canonicalPackages[] = $package;
  25670. }
  25671. return $canonicalPackages;
  25672. }
  25673. }
  25674. <?php
  25675. namespace Composer\Repository;
  25676. use Composer\Package\PackageInterface;
  25677. interface WritableRepositoryInterface extends RepositoryInterface
  25678. {
  25679. public function write();
  25680. public function addPackage(PackageInterface $package);
  25681. public function removePackage(PackageInterface $package);
  25682. public function getCanonicalPackages();
  25683. public function reload();
  25684. }
  25685. <?php
  25686. namespace Composer\Script;
  25687. class CommandEvent extends Event
  25688. {
  25689. }
  25690. <?php
  25691. namespace Composer\Script;
  25692. use Composer\Composer;
  25693. use Composer\IO\IOInterface;
  25694. use Composer\EventDispatcher\Event as BaseEvent;
  25695. class Event extends BaseEvent
  25696. {
  25697. private $composer;
  25698. private $io;
  25699. private $devMode;
  25700. private $originatingEvent;
  25701. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  25702. {
  25703. parent::__construct($name, $args, $flags);
  25704. $this->composer = $composer;
  25705. $this->io = $io;
  25706. $this->devMode = $devMode;
  25707. $this->originatingEvent = null;
  25708. }
  25709. public function getComposer()
  25710. {
  25711. return $this->composer;
  25712. }
  25713. public function getIO()
  25714. {
  25715. return $this->io;
  25716. }
  25717. public function isDevMode()
  25718. {
  25719. return $this->devMode;
  25720. }
  25721. public function getOriginatingEvent()
  25722. {
  25723. return $this->originatingEvent;
  25724. }
  25725. public function setOriginatingEvent(BaseEvent $event)
  25726. {
  25727. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  25728. return $this;
  25729. }
  25730. private function calculateOriginatingEvent(BaseEvent $event)
  25731. {
  25732. if ($event instanceof Event && $event->getOriginatingEvent()) {
  25733. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  25734. }
  25735. return $event;
  25736. }
  25737. }
  25738. <?php
  25739. namespace Composer\Script;
  25740. use Composer\Installer\PackageEvent as BasePackageEvent;
  25741. class PackageEvent extends BasePackageEvent
  25742. {
  25743. }
  25744. <?php
  25745. namespace Composer\Script;
  25746. class ScriptEvents
  25747. {
  25748. const PRE_INSTALL_CMD = 'pre-install-cmd';
  25749. const POST_INSTALL_CMD = 'post-install-cmd';
  25750. const PRE_UPDATE_CMD = 'pre-update-cmd';
  25751. const POST_UPDATE_CMD = 'post-update-cmd';
  25752. const PRE_STATUS_CMD = 'pre-status-cmd';
  25753. const POST_STATUS_CMD = 'post-status-cmd';
  25754. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  25755. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  25756. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  25757. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  25758. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  25759. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  25760. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  25761. const POST_PACKAGE_INSTALL = 'post-package-install';
  25762. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  25763. const POST_PACKAGE_UPDATE = 'post-package-update';
  25764. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  25765. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  25766. }
  25767. <?php
  25768. namespace Composer\SelfUpdate;
  25769. class Keys
  25770. {
  25771. public static function fingerprint($path)
  25772. {
  25773. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  25774. return implode(' ', array(
  25775. substr($hash, 0, 8),
  25776. substr($hash, 8, 8),
  25777. substr($hash, 16, 8),
  25778. substr($hash, 24, 8),
  25779. '',
  25780. substr($hash, 32, 8),
  25781. substr($hash, 40, 8),
  25782. substr($hash, 48, 8),
  25783. substr($hash, 56, 8),
  25784. ));
  25785. }
  25786. }
  25787. <?php
  25788. namespace Composer\SelfUpdate;
  25789. use Composer\Util\RemoteFilesystem;
  25790. use Composer\Config;
  25791. use Composer\Json\JsonFile;
  25792. class Versions
  25793. {
  25794. public static $channels = array('stable', 'preview', 'snapshot', '1', '2');
  25795. private $rfs;
  25796. private $config;
  25797. private $channel;
  25798. private $versionsData;
  25799. public function __construct(Config $config, RemoteFilesystem $rfs)
  25800. {
  25801. $this->rfs = $rfs;
  25802. $this->config = $config;
  25803. }
  25804. public function getChannel()
  25805. {
  25806. if ($this->channel) {
  25807. return $this->channel;
  25808. }
  25809. $channelFile = $this->config->get('home').'/update-channel';
  25810. if (file_exists($channelFile)) {
  25811. $channel = trim(file_get_contents($channelFile));
  25812. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  25813. return $this->channel = $channel;
  25814. }
  25815. }
  25816. return $this->channel = 'stable';
  25817. }
  25818. public function setChannel($channel)
  25819. {
  25820. if (!in_array($channel, self::$channels, true)) {
  25821. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));
  25822. }
  25823. $channelFile = $this->config->get('home').'/update-channel';
  25824. $this->channel = $channel;
  25825. file_put_contents($channelFile, (is_numeric($channel) ? 'stable' : $channel).PHP_EOL);
  25826. }
  25827. public function getLatest($channel = null)
  25828. {
  25829. $versions = $this->getVersionsData();
  25830. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  25831. if ($version['min-php'] <= PHP_VERSION_ID) {
  25832. return $version;
  25833. }
  25834. }
  25835. throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  25836. }
  25837. private function getVersionsData()
  25838. {
  25839. if (!$this->versionsData) {
  25840. if ($this->config->get('disable-tls') === true) {
  25841. $protocol = 'http';
  25842. } else {
  25843. $protocol = 'https';
  25844. }
  25845. $this->versionsData = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  25846. }
  25847. return $this->versionsData;
  25848. }
  25849. }
  25850. <?php
  25851. namespace Composer\Util;
  25852. use Composer\Config;
  25853. use Composer\IO\IOInterface;
  25854. class AuthHelper
  25855. {
  25856. protected $io;
  25857. protected $config;
  25858. public function __construct(IOInterface $io, Config $config)
  25859. {
  25860. $this->io = $io;
  25861. $this->config = $config;
  25862. }
  25863. public function storeAuth($originUrl, $storeAuth)
  25864. {
  25865. $store = false;
  25866. $configSource = $this->config->getAuthConfigSource();
  25867. if ($storeAuth === true) {
  25868. $store = $configSource;
  25869. } elseif ($storeAuth === 'prompt') {
  25870. $answer = $this->io->askAndValidate(
  25871. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  25872. function ($value) {
  25873. $input = strtolower(substr(trim($value), 0, 1));
  25874. if (in_array($input, array('y','n'))) {
  25875. return $input;
  25876. }
  25877. throw new \RuntimeException('Please answer (y)es or (n)o');
  25878. },
  25879. null,
  25880. 'y'
  25881. );
  25882. if ($answer === 'y') {
  25883. $store = $configSource;
  25884. }
  25885. }
  25886. if ($store) {
  25887. $store->addConfigSetting(
  25888. 'http-basic.'.$originUrl,
  25889. $this->io->getAuthentication($originUrl)
  25890. );
  25891. }
  25892. }
  25893. }
  25894. <?php
  25895. namespace Composer\Util;
  25896. use Composer\Factory;
  25897. use Composer\IO\IOInterface;
  25898. use Composer\Config;
  25899. use Composer\Downloader\TransportException;
  25900. class Bitbucket
  25901. {
  25902. private $io;
  25903. private $config;
  25904. private $process;
  25905. private $remoteFilesystem;
  25906. private $token = array();
  25907. private $time;
  25908. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  25909. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  25910. {
  25911. $this->io = $io;
  25912. $this->config = $config;
  25913. $this->process = $process ?: new ProcessExecutor($io);
  25914. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25915. $this->time = $time;
  25916. }
  25917. public function getToken()
  25918. {
  25919. if (!isset($this->token['access_token'])) {
  25920. return '';
  25921. }
  25922. return $this->token['access_token'];
  25923. }
  25924. public function authorizeOAuth($originUrl)
  25925. {
  25926. if ($originUrl !== 'bitbucket.org') {
  25927. return false;
  25928. }
  25929. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  25930. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  25931. return true;
  25932. }
  25933. return false;
  25934. }
  25935. private function requestAccessToken($originUrl)
  25936. {
  25937. try {
  25938. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  25939. 'retry-auth-failure' => false,
  25940. 'http' => array(
  25941. 'method' => 'POST',
  25942. 'content' => 'grant_type=client_credentials',
  25943. ),
  25944. ));
  25945. $this->token = json_decode($json, true);
  25946. } catch (TransportException $e) {
  25947. if ($e->getCode() === 400) {
  25948. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25949. $this->io->writeError('This can have two reasons:');
  25950. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  25951. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  25952. return false;
  25953. } elseif (in_array($e->getCode(), array(403, 401))) {
  25954. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25955. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25956. return false;
  25957. }
  25958. throw $e;
  25959. }
  25960. return true;
  25961. }
  25962. public function authorizeOAuthInteractively($originUrl, $message = null)
  25963. {
  25964. if ($message) {
  25965. $this->io->writeError($message);
  25966. }
  25967. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  25968. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  25969. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25970. $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)');
  25971. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  25972. if (!$consumerKey) {
  25973. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  25974. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25975. return false;
  25976. }
  25977. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  25978. if (!$consumerSecret) {
  25979. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  25980. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25981. return false;
  25982. }
  25983. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25984. if (!$this->requestAccessToken($originUrl)) {
  25985. return false;
  25986. }
  25987. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25988. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  25989. $this->io->writeError('<info>Consumer stored successfully.</info>');
  25990. return true;
  25991. }
  25992. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  25993. {
  25994. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  25995. return $this->token['access_token'];
  25996. }
  25997. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25998. if (!$this->requestAccessToken($originUrl)) {
  25999. return '';
  26000. }
  26001. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  26002. return $this->token['access_token'];
  26003. }
  26004. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  26005. {
  26006. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  26007. $time = null === $this->time ? time() : $this->time;
  26008. $consumer = array(
  26009. "consumer-key" => $consumerKey,
  26010. "consumer-secret" => $consumerSecret,
  26011. "access-token" => $this->token['access_token'],
  26012. "access-token-expiration" => $time + $this->token['expires_in'],
  26013. );
  26014. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  26015. }
  26016. private function getTokenFromConfig($originUrl)
  26017. {
  26018. $authConfig = $this->config->get('bitbucket-oauth');
  26019. if (
  26020. !isset($authConfig[$originUrl]['access-token'])
  26021. || !isset($authConfig[$originUrl]['access-token-expiration'])
  26022. || time() > $authConfig[$originUrl]['access-token-expiration']
  26023. ) {
  26024. return false;
  26025. }
  26026. $this->token = array(
  26027. 'access_token' => $authConfig[$originUrl]['access-token'],
  26028. );
  26029. return true;
  26030. }
  26031. }
  26032. <?php
  26033. namespace Composer\Util;
  26034. class ComposerMirror
  26035. {
  26036. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  26037. {
  26038. if ($reference) {
  26039. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  26040. }
  26041. $version = strpos($version, '/') === false ? $version : md5($version);
  26042. return str_replace(
  26043. array('%package%', '%version%', '%reference%', '%type%'),
  26044. array($packageName, $version, $reference, $type),
  26045. $mirrorUrl
  26046. );
  26047. }
  26048. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  26049. {
  26050. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  26051. $url = 'gh-'.$match[1].'/'.$match[2];
  26052. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  26053. $url = 'bb-'.$match[1].'/'.$match[2];
  26054. } else {
  26055. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  26056. }
  26057. return str_replace(
  26058. array('%package%', '%normalizedUrl%', '%type%'),
  26059. array($packageName, $url, $type),
  26060. $mirrorUrl
  26061. );
  26062. }
  26063. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  26064. {
  26065. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  26066. }
  26067. }
  26068. <?php
  26069. namespace Composer\Util;
  26070. use Composer\Package\Loader\ArrayLoader;
  26071. use Composer\Package\Loader\ValidatingArrayLoader;
  26072. use Composer\Package\Loader\InvalidPackageException;
  26073. use Composer\Json\JsonValidationException;
  26074. use Composer\IO\IOInterface;
  26075. use Composer\Json\JsonFile;
  26076. use Composer\Spdx\SpdxLicenses;
  26077. class ConfigValidator
  26078. {
  26079. private $io;
  26080. public function __construct(IOInterface $io)
  26081. {
  26082. $this->io = $io;
  26083. }
  26084. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  26085. {
  26086. $errors = array();
  26087. $publishErrors = array();
  26088. $warnings = array();
  26089. $laxValid = false;
  26090. try {
  26091. $json = new JsonFile($file, null, $this->io);
  26092. $manifest = $json->read();
  26093. $json->validateSchema(JsonFile::LAX_SCHEMA);
  26094. $laxValid = true;
  26095. $json->validateSchema();
  26096. } catch (JsonValidationException $e) {
  26097. foreach ($e->getErrors() as $message) {
  26098. if ($laxValid) {
  26099. $publishErrors[] = $message;
  26100. } else {
  26101. $errors[] = $message;
  26102. }
  26103. }
  26104. } catch (\Exception $e) {
  26105. $errors[] = $e->getMessage();
  26106. return array($errors, $publishErrors, $warnings);
  26107. }
  26108. if (empty($manifest['license'])) {
  26109. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  26110. } else {
  26111. $licenses = (array) $manifest['license'];
  26112. foreach ($licenses as $key => $license) {
  26113. if ('proprietary' === $license) {
  26114. unset($licenses[$key]);
  26115. }
  26116. }
  26117. $licenseValidator = new SpdxLicenses();
  26118. foreach ($licenses as $license) {
  26119. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  26120. if ($spdxLicense && $spdxLicense[3]) {
  26121. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  26122. $warnings[] = sprintf(
  26123. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  26124. $license
  26125. );
  26126. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  26127. $warnings[] = sprintf(
  26128. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  26129. $license
  26130. );
  26131. } else {
  26132. $warnings[] = sprintf(
  26133. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  26134. $license
  26135. );
  26136. }
  26137. }
  26138. }
  26139. }
  26140. if (isset($manifest['version'])) {
  26141. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  26142. }
  26143. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  26144. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  26145. $suggestName = strtolower($suggestName);
  26146. $publishErrors[] = sprintf(
  26147. '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.',
  26148. $manifest['name'],
  26149. $suggestName
  26150. );
  26151. }
  26152. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  26153. $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.";
  26154. }
  26155. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  26156. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  26157. if (!empty($requireOverrides)) {
  26158. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  26159. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  26160. }
  26161. }
  26162. $require = isset($manifest['require']) ? $manifest['require'] : array();
  26163. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  26164. $packages = array_merge($require, $requireDev);
  26165. foreach ($packages as $package => $version) {
  26166. if (preg_match('/#/', $version) === 1) {
  26167. $warnings[] = sprintf(
  26168. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  26169. $package
  26170. );
  26171. }
  26172. }
  26173. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  26174. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  26175. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  26176. if (!array_key_exists($scriptName, $scripts)) {
  26177. $warnings[] = sprintf(
  26178. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  26179. $scriptName
  26180. );
  26181. }
  26182. }
  26183. if (isset($manifest['autoload']['psr-0'][''])) {
  26184. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  26185. }
  26186. if (isset($manifest['autoload']['psr-4'][''])) {
  26187. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  26188. }
  26189. try {
  26190. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  26191. if (!isset($manifest['version'])) {
  26192. $manifest['version'] = '1.0.0';
  26193. }
  26194. if (!isset($manifest['name'])) {
  26195. $manifest['name'] = 'dummy/dummy';
  26196. }
  26197. $loader->load($manifest);
  26198. } catch (InvalidPackageException $e) {
  26199. $errors = array_merge($errors, $e->getErrors());
  26200. }
  26201. $warnings = array_merge($warnings, $loader->getWarnings());
  26202. return array($errors, $publishErrors, $warnings);
  26203. }
  26204. }
  26205. <?php
  26206. namespace Composer\Util;
  26207. use Composer\IO\IOInterface;
  26208. class ErrorHandler
  26209. {
  26210. private static $io;
  26211. public static function handle($level, $message, $file, $line)
  26212. {
  26213. if (!(error_reporting() & $level)) {
  26214. return;
  26215. }
  26216. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  26217. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  26218. "\na legitimately suppressed error that you were not supposed to see.";
  26219. }
  26220. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  26221. throw new \ErrorException($message, 0, $level, $file, $line);
  26222. }
  26223. if (self::$io) {
  26224. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  26225. if (self::$io->isVerbose()) {
  26226. self::$io->writeError('<warning>Stack trace:</warning>');
  26227. self::$io->writeError(array_filter(array_map(function ($a) {
  26228. if (isset($a['line'], $a['file'])) {
  26229. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  26230. }
  26231. return null;
  26232. }, array_slice(debug_backtrace(), 2))));
  26233. }
  26234. }
  26235. return true;
  26236. }
  26237. public static function register(IOInterface $io = null)
  26238. {
  26239. set_error_handler(array(__CLASS__, 'handle'));
  26240. error_reporting(E_ALL | E_STRICT);
  26241. self::$io = $io;
  26242. }
  26243. }
  26244. <?php
  26245. namespace Composer\Util;
  26246. use RecursiveDirectoryIterator;
  26247. use RecursiveIteratorIterator;
  26248. use Symfony\Component\Filesystem\Exception\IOException;
  26249. use Symfony\Component\Finder\Finder;
  26250. class Filesystem
  26251. {
  26252. private $processExecutor;
  26253. public function __construct(ProcessExecutor $executor = null)
  26254. {
  26255. $this->processExecutor = $executor ?: new ProcessExecutor();
  26256. }
  26257. public function remove($file)
  26258. {
  26259. if (is_dir($file)) {
  26260. return $this->removeDirectory($file);
  26261. }
  26262. if (file_exists($file)) {
  26263. return $this->unlink($file);
  26264. }
  26265. return false;
  26266. }
  26267. public function isDirEmpty($dir)
  26268. {
  26269. $finder = Finder::create()
  26270. ->ignoreVCS(false)
  26271. ->ignoreDotFiles(false)
  26272. ->depth(0)
  26273. ->in($dir);
  26274. return count($finder) === 0;
  26275. }
  26276. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  26277. {
  26278. if (file_exists($dir) && is_link($dir)) {
  26279. $this->unlink($dir);
  26280. }
  26281. if ($ensureDirectoryExists) {
  26282. $this->ensureDirectoryExists($dir);
  26283. }
  26284. if (is_dir($dir)) {
  26285. $finder = Finder::create()
  26286. ->ignoreVCS(false)
  26287. ->ignoreDotFiles(false)
  26288. ->depth(0)
  26289. ->in($dir);
  26290. foreach ($finder as $path) {
  26291. $this->remove((string) $path);
  26292. }
  26293. }
  26294. }
  26295. public function removeDirectory($directory)
  26296. {
  26297. if ($this->isSymlinkedDirectory($directory)) {
  26298. return $this->unlinkSymlinkedDirectory($directory);
  26299. }
  26300. if ($this->isJunction($directory)) {
  26301. return $this->removeJunction($directory);
  26302. }
  26303. if (is_link($directory)) {
  26304. return unlink($directory);
  26305. }
  26306. if (!file_exists($directory) || !is_dir($directory)) {
  26307. return true;
  26308. }
  26309. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  26310. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  26311. }
  26312. if (!function_exists('proc_open')) {
  26313. return $this->removeDirectoryPhp($directory);
  26314. }
  26315. if (Platform::isWindows()) {
  26316. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  26317. } else {
  26318. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  26319. }
  26320. $result = $this->getProcess()->execute($cmd, $output) === 0;
  26321. clearstatcache();
  26322. if ($result && !file_exists($directory)) {
  26323. return true;
  26324. }
  26325. return $this->removeDirectoryPhp($directory);
  26326. }
  26327. public function removeDirectoryPhp($directory)
  26328. {
  26329. try {
  26330. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26331. } catch (\UnexpectedValueException $e) {
  26332. clearstatcache();
  26333. usleep(100000);
  26334. if (!is_dir($directory)) {
  26335. return true;
  26336. }
  26337. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26338. }
  26339. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26340. foreach ($ri as $file) {
  26341. if ($file->isDir()) {
  26342. $this->rmdir($file->getPathname());
  26343. } else {
  26344. $this->unlink($file->getPathname());
  26345. }
  26346. }
  26347. return $this->rmdir($directory);
  26348. }
  26349. public function ensureDirectoryExists($directory)
  26350. {
  26351. if (!is_dir($directory)) {
  26352. if (file_exists($directory)) {
  26353. throw new \RuntimeException(
  26354. $directory.' exists and is not a directory.'
  26355. );
  26356. }
  26357. if (!@mkdir($directory, 0777, true)) {
  26358. throw new \RuntimeException(
  26359. $directory.' does not exist and could not be created.'
  26360. );
  26361. }
  26362. }
  26363. }
  26364. public function unlink($path)
  26365. {
  26366. $unlinked = @$this->unlinkImplementation($path);
  26367. if (!$unlinked) {
  26368. if (Platform::isWindows()) {
  26369. usleep(350000);
  26370. $unlinked = @$this->unlinkImplementation($path);
  26371. }
  26372. if (!$unlinked) {
  26373. $error = error_get_last();
  26374. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26375. if (Platform::isWindows()) {
  26376. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26377. }
  26378. throw new \RuntimeException($message);
  26379. }
  26380. }
  26381. return true;
  26382. }
  26383. public function rmdir($path)
  26384. {
  26385. $deleted = @rmdir($path);
  26386. if (!$deleted) {
  26387. if (Platform::isWindows()) {
  26388. usleep(350000);
  26389. $deleted = @rmdir($path);
  26390. }
  26391. if (!$deleted) {
  26392. $error = error_get_last();
  26393. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26394. if (Platform::isWindows()) {
  26395. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26396. }
  26397. throw new \RuntimeException($message);
  26398. }
  26399. }
  26400. return true;
  26401. }
  26402. public function copyThenRemove($source, $target)
  26403. {
  26404. $this->copy($source, $target);
  26405. if (!is_dir($source)) {
  26406. $this->unlink($source);
  26407. return;
  26408. }
  26409. $this->removeDirectoryPhp($source);
  26410. }
  26411. public function copy($source, $target)
  26412. {
  26413. if (!is_dir($source)) {
  26414. return copy($source, $target);
  26415. }
  26416. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  26417. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  26418. $this->ensureDirectoryExists($target);
  26419. $result = true;
  26420. foreach ($ri as $file) {
  26421. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  26422. if ($file->isDir()) {
  26423. $this->ensureDirectoryExists($targetPath);
  26424. } else {
  26425. $result = $result && copy($file->getPathname(), $targetPath);
  26426. }
  26427. }
  26428. return $result;
  26429. }
  26430. public function rename($source, $target)
  26431. {
  26432. if (true === @rename($source, $target)) {
  26433. return;
  26434. }
  26435. if (!function_exists('proc_open')) {
  26436. $this->copyThenRemove($source, $target);
  26437. return;
  26438. }
  26439. if (Platform::isWindows()) {
  26440. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26441. $result = $this->processExecutor->execute($command, $output);
  26442. clearstatcache();
  26443. if (0 === $result) {
  26444. $this->remove($source);
  26445. return;
  26446. }
  26447. } else {
  26448. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26449. $result = $this->processExecutor->execute($command, $output);
  26450. clearstatcache();
  26451. if (0 === $result) {
  26452. return;
  26453. }
  26454. }
  26455. $this->copyThenRemove($source, $target);
  26456. }
  26457. public function findShortestPath($from, $to, $directories = false)
  26458. {
  26459. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26460. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26461. }
  26462. $from = lcfirst($this->normalizePath($from));
  26463. $to = lcfirst($this->normalizePath($to));
  26464. if ($directories) {
  26465. $from = rtrim($from, '/') . '/dummy_file';
  26466. }
  26467. if (dirname($from) === dirname($to)) {
  26468. return './'.basename($to);
  26469. }
  26470. $commonPath = $to;
  26471. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  26472. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26473. }
  26474. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  26475. return $to;
  26476. }
  26477. $commonPath = rtrim($commonPath, '/') . '/';
  26478. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  26479. $commonPathCode = str_repeat('../', $sourcePathDepth);
  26480. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  26481. }
  26482. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  26483. {
  26484. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26485. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26486. }
  26487. $from = lcfirst($this->normalizePath($from));
  26488. $to = lcfirst($this->normalizePath($to));
  26489. if ($from === $to) {
  26490. return $directories ? '__DIR__' : '__FILE__';
  26491. }
  26492. $commonPath = $to;
  26493. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  26494. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26495. }
  26496. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  26497. return var_export($to, true);
  26498. }
  26499. $commonPath = rtrim($commonPath, '/') . '/';
  26500. if (strpos($to, $from.'/') === 0) {
  26501. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  26502. }
  26503. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  26504. if ($staticCode) {
  26505. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  26506. } else {
  26507. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  26508. }
  26509. $relTarget = substr($to, strlen($commonPath));
  26510. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  26511. }
  26512. public function isAbsolutePath($path)
  26513. {
  26514. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  26515. }
  26516. public function size($path)
  26517. {
  26518. if (!file_exists($path)) {
  26519. throw new \RuntimeException("$path does not exist.");
  26520. }
  26521. if (is_dir($path)) {
  26522. return $this->directorySize($path);
  26523. }
  26524. return filesize($path);
  26525. }
  26526. public function normalizePath($path)
  26527. {
  26528. $parts = array();
  26529. $path = strtr($path, '\\', '/');
  26530. $prefix = '';
  26531. $absolute = false;
  26532. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  26533. $prefix = $match[1];
  26534. $path = substr($path, strlen($prefix));
  26535. }
  26536. if (substr($path, 0, 1) === '/') {
  26537. $absolute = true;
  26538. $path = substr($path, 1);
  26539. }
  26540. $up = false;
  26541. foreach (explode('/', $path) as $chunk) {
  26542. if ('..' === $chunk && ($absolute || $up)) {
  26543. array_pop($parts);
  26544. $up = !(empty($parts) || '..' === end($parts));
  26545. } elseif ('.' !== $chunk && '' !== $chunk) {
  26546. $parts[] = $chunk;
  26547. $up = '..' !== $chunk;
  26548. }
  26549. }
  26550. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  26551. }
  26552. public static function isLocalPath($path)
  26553. {
  26554. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  26555. }
  26556. public static function getPlatformPath($path)
  26557. {
  26558. if (Platform::isWindows()) {
  26559. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  26560. }
  26561. return preg_replace('{^file://}i', '', $path);
  26562. }
  26563. protected function directorySize($directory)
  26564. {
  26565. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26566. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26567. $size = 0;
  26568. foreach ($ri as $file) {
  26569. if ($file->isFile()) {
  26570. $size += $file->getSize();
  26571. }
  26572. }
  26573. return $size;
  26574. }
  26575. protected function getProcess()
  26576. {
  26577. return $this->processExecutor;
  26578. }
  26579. private function unlinkImplementation($path)
  26580. {
  26581. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  26582. return rmdir($path);
  26583. }
  26584. return unlink($path);
  26585. }
  26586. public function relativeSymlink($target, $link)
  26587. {
  26588. $cwd = getcwd();
  26589. $relativePath = $this->findShortestPath($link, $target);
  26590. chdir(dirname($link));
  26591. $result = @symlink($relativePath, $link);
  26592. chdir($cwd);
  26593. return $result;
  26594. }
  26595. public function isSymlinkedDirectory($directory)
  26596. {
  26597. if (!is_dir($directory)) {
  26598. return false;
  26599. }
  26600. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26601. return is_link($resolved);
  26602. }
  26603. private function unlinkSymlinkedDirectory($directory)
  26604. {
  26605. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26606. return $this->unlink($resolved);
  26607. }
  26608. private function resolveSymlinkedDirectorySymlink($pathname)
  26609. {
  26610. if (!is_dir($pathname)) {
  26611. return $pathname;
  26612. }
  26613. $resolved = rtrim($pathname, '/');
  26614. if (!strlen($resolved)) {
  26615. return $pathname;
  26616. }
  26617. return $resolved;
  26618. }
  26619. public function junction($target, $junction)
  26620. {
  26621. if (!Platform::isWindows()) {
  26622. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  26623. }
  26624. if (!is_dir($target)) {
  26625. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  26626. }
  26627. $cmd = sprintf(
  26628. 'mklink /J %s %s',
  26629. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  26630. ProcessExecutor::escape(realpath($target))
  26631. );
  26632. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  26633. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  26634. }
  26635. clearstatcache(true, $junction);
  26636. }
  26637. public function isJunction($junction)
  26638. {
  26639. if (!Platform::isWindows()) {
  26640. return false;
  26641. }
  26642. clearstatcache(true, $junction);
  26643. if (!is_dir($junction) || is_link($junction)) {
  26644. return false;
  26645. }
  26646. $stat = lstat($junction);
  26647. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  26648. }
  26649. public function removeJunction($junction)
  26650. {
  26651. if (!Platform::isWindows()) {
  26652. return false;
  26653. }
  26654. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  26655. if (!$this->isJunction($junction)) {
  26656. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  26657. }
  26658. return $this->rmdir($junction);
  26659. }
  26660. }
  26661. <?php
  26662. namespace Composer\Util;
  26663. use Composer\Config;
  26664. use Composer\IO\IOInterface;
  26665. class Git
  26666. {
  26667. private static $version = false;
  26668. protected $io;
  26669. protected $config;
  26670. protected $process;
  26671. protected $filesystem;
  26672. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  26673. {
  26674. $this->io = $io;
  26675. $this->config = $config;
  26676. $this->process = $process;
  26677. $this->filesystem = $fs;
  26678. }
  26679. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  26680. {
  26681. $this->config->prohibitUrlByConfig($url, $this->io);
  26682. if ($initialClone) {
  26683. $origCwd = $cwd;
  26684. $cwd = null;
  26685. }
  26686. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  26687. 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.');
  26688. }
  26689. if (!$initialClone) {
  26690. $this->process->execute('git remote -v', $output, $cwd);
  26691. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  26692. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  26693. }
  26694. }
  26695. $protocols = $this->config->get('github-protocols');
  26696. if (!is_array($protocols)) {
  26697. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  26698. }
  26699. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  26700. $messages = array();
  26701. foreach ($protocols as $protocol) {
  26702. if ('ssh' === $protocol) {
  26703. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  26704. } else {
  26705. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  26706. }
  26707. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  26708. return;
  26709. }
  26710. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  26711. if ($initialClone) {
  26712. $this->filesystem->removeDirectory($origCwd);
  26713. }
  26714. }
  26715. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  26716. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  26717. }
  26718. }
  26719. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  26720. $command = call_user_func($commandCallable, $url);
  26721. $auth = null;
  26722. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  26723. $errorMsg = $this->process->getErrorOutput();
  26724. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  26725. || preg_match('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26726. ) {
  26727. if (!$this->io->hasAuthentication($match[1])) {
  26728. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  26729. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  26730. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26731. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  26732. }
  26733. }
  26734. if ($this->io->hasAuthentication($match[1])) {
  26735. $auth = $this->io->getAuthentication($match[1]);
  26736. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26737. $command = call_user_func($commandCallable, $authUrl);
  26738. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26739. return;
  26740. }
  26741. $errorMsg = $this->process->getErrorOutput();
  26742. }
  26743. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  26744. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  26745. if (!$this->io->hasAuthentication($match[1])) {
  26746. $message = 'Enter your Bitbucket credentials to access private repos';
  26747. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26748. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  26749. $accessToken = $bitbucketUtil->getToken();
  26750. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26751. }
  26752. } else {
  26753. $auth = $this->io->getAuthentication($match[1]);
  26754. if ($auth['username'] !== 'x-token-auth') {
  26755. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  26756. if (! empty($accessToken)) {
  26757. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26758. }
  26759. }
  26760. }
  26761. if ($this->io->hasAuthentication($match[1])) {
  26762. $auth = $this->io->getAuthentication($match[1]);
  26763. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26764. $command = call_user_func($commandCallable, $authUrl);
  26765. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26766. return;
  26767. }
  26768. $errorMsg = $this->process->getErrorOutput();
  26769. } else {
  26770. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  26771. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  26772. $command = call_user_func($commandCallable, $sshUrl);
  26773. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26774. return;
  26775. }
  26776. $errorMsg = $this->process->getErrorOutput();
  26777. }
  26778. } elseif (
  26779. preg_match('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  26780. || preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26781. ) {
  26782. if ($match[1] === 'git') {
  26783. $match[1] = 'https';
  26784. }
  26785. if (!$this->io->hasAuthentication($match[2])) {
  26786. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  26787. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  26788. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  26789. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  26790. }
  26791. }
  26792. if ($this->io->hasAuthentication($match[2])) {
  26793. $auth = $this->io->getAuthentication($match[2]);
  26794. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  26795. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  26796. } else {
  26797. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  26798. }
  26799. $command = call_user_func($commandCallable, $authUrl);
  26800. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26801. return;
  26802. }
  26803. $errorMsg = $this->process->getErrorOutput();
  26804. }
  26805. } elseif ($this->isAuthenticationFailure($url, $match)) {
  26806. if (strpos($match[2], '@')) {
  26807. list($authParts, $match[2]) = explode('@', $match[2], 2);
  26808. }
  26809. $storeAuth = false;
  26810. if ($this->io->hasAuthentication($match[2])) {
  26811. $auth = $this->io->getAuthentication($match[2]);
  26812. } elseif ($this->io->isInteractive()) {
  26813. $defaultUsername = null;
  26814. if (isset($authParts) && $authParts) {
  26815. if (false !== strpos($authParts, ':')) {
  26816. list($defaultUsername, ) = explode(':', $authParts, 2);
  26817. } else {
  26818. $defaultUsername = $authParts;
  26819. }
  26820. }
  26821. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  26822. $auth = array(
  26823. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  26824. 'password' => $this->io->askAndHideAnswer(' Password: '),
  26825. );
  26826. $storeAuth = $this->config->get('store-auths');
  26827. }
  26828. if ($auth) {
  26829. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  26830. $command = call_user_func($commandCallable, $authUrl);
  26831. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26832. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  26833. $authHelper = new AuthHelper($this->io, $this->config);
  26834. $authHelper->storeAuth($match[2], $storeAuth);
  26835. return;
  26836. }
  26837. $errorMsg = $this->process->getErrorOutput();
  26838. }
  26839. }
  26840. if ($initialClone) {
  26841. $this->filesystem->removeDirectory($origCwd);
  26842. }
  26843. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  26844. }
  26845. }
  26846. public function syncMirror($url, $dir)
  26847. {
  26848. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26849. try {
  26850. $commandCallable = function ($url) {
  26851. $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url);
  26852. return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  26853. };
  26854. $this->runCommand($commandCallable, $url, $dir);
  26855. } catch (\Exception $e) {
  26856. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  26857. return false;
  26858. }
  26859. return true;
  26860. }
  26861. $this->filesystem->removeDirectory($dir);
  26862. $commandCallable = function ($url) use ($dir) {
  26863. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  26864. };
  26865. $this->runCommand($commandCallable, $url, $dir, true);
  26866. return true;
  26867. }
  26868. public function fetchRefOrSyncMirror($url, $dir, $ref)
  26869. {
  26870. if ($this->checkRefIsInMirror($url, $dir, $ref)) {
  26871. return true;
  26872. }
  26873. if ($this->syncMirror($url, $dir)) {
  26874. return $this->checkRefIsInMirror($url, $dir, $ref);
  26875. }
  26876. return false;
  26877. }
  26878. public static function getNoShowSignatureFlag(ProcessExecutor $process)
  26879. {
  26880. $gitVersion = self::getVersion($process);
  26881. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  26882. return ' --no-show-signature';
  26883. }
  26884. return '';
  26885. }
  26886. private function checkRefIsInMirror($url, $dir, $ref)
  26887. {
  26888. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26889. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  26890. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  26891. if ($exitCode === 0) {
  26892. return true;
  26893. }
  26894. }
  26895. return false;
  26896. }
  26897. private function isAuthenticationFailure($url, &$match)
  26898. {
  26899. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  26900. return false;
  26901. }
  26902. $authFailures = array(
  26903. 'fatal: Authentication failed',
  26904. 'remote error: Invalid username or password.',
  26905. 'error: 401 Unauthorized',
  26906. 'fatal: unable to access',
  26907. 'fatal: could not read Username',
  26908. );
  26909. $errorOutput = $this->process->getErrorOutput();
  26910. foreach ($authFailures as $authFailure) {
  26911. if (strpos($errorOutput, $authFailure) !== false) {
  26912. return true;
  26913. }
  26914. }
  26915. return false;
  26916. }
  26917. public static function cleanEnv()
  26918. {
  26919. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  26920. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  26921. }
  26922. if (getenv('GIT_ASKPASS') !== 'echo') {
  26923. putenv('GIT_ASKPASS=echo');
  26924. unset($_SERVER['GIT_ASKPASS']);
  26925. }
  26926. if (getenv('GIT_DIR')) {
  26927. putenv('GIT_DIR');
  26928. unset($_SERVER['GIT_DIR']);
  26929. }
  26930. if (getenv('GIT_WORK_TREE')) {
  26931. putenv('GIT_WORK_TREE');
  26932. unset($_SERVER['GIT_WORK_TREE']);
  26933. }
  26934. if (getenv('LANGUAGE') !== 'C') {
  26935. putenv('LANGUAGE=C');
  26936. }
  26937. putenv("DYLD_LIBRARY_PATH");
  26938. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26939. }
  26940. public static function getGitHubDomainsRegex(Config $config)
  26941. {
  26942. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  26943. }
  26944. public static function getGitLabDomainsRegex(Config $config)
  26945. {
  26946. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  26947. }
  26948. public static function sanitizeUrl($message)
  26949. {
  26950. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26951. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26952. return '://***:***@';
  26953. }
  26954. return '://' . $m[1] . ':***@';
  26955. }, $message);
  26956. }
  26957. private function throwException($message, $url)
  26958. {
  26959. clearstatcache();
  26960. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  26961. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  26962. }
  26963. throw new \RuntimeException(self::sanitizeUrl($message));
  26964. }
  26965. public static function getVersion(ProcessExecutor $process = null)
  26966. {
  26967. if (false === self::$version) {
  26968. self::$version = null;
  26969. if (!$process) {
  26970. $process = new ProcessExecutor;
  26971. }
  26972. if (0 === $process->execute('git --version', $output) && preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  26973. self::$version = $matches[1];
  26974. }
  26975. }
  26976. return self::$version;
  26977. }
  26978. }
  26979. <?php
  26980. namespace Composer\Util;
  26981. use Composer\Factory;
  26982. use Composer\IO\IOInterface;
  26983. use Composer\Config;
  26984. use Composer\Downloader\TransportException;
  26985. class GitHub
  26986. {
  26987. protected $io;
  26988. protected $config;
  26989. protected $process;
  26990. protected $remoteFilesystem;
  26991. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26992. {
  26993. $this->io = $io;
  26994. $this->config = $config;
  26995. $this->process = $process ?: new ProcessExecutor($io);
  26996. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26997. }
  26998. public function authorizeOAuth($originUrl)
  26999. {
  27000. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  27001. return false;
  27002. }
  27003. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  27004. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  27005. return true;
  27006. }
  27007. return false;
  27008. }
  27009. public function authorizeOAuthInteractively($originUrl, $message = null)
  27010. {
  27011. if ($message) {
  27012. $this->io->writeError($message);
  27013. }
  27014. $note = 'Composer';
  27015. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  27016. $note .= ' on ' . trim($output);
  27017. }
  27018. $note .= ' ' . date('Y-m-d Hi');
  27019. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  27020. $this->io->writeError(sprintf('Head to %s', $url));
  27021. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  27022. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  27023. if (!$token) {
  27024. $this->io->writeError('<warning>No token given, aborting.</warning>');
  27025. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27026. return false;
  27027. }
  27028. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  27029. try {
  27030. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  27031. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  27032. 'retry-auth-failure' => false,
  27033. ));
  27034. } catch (TransportException $e) {
  27035. if (in_array($e->getCode(), array(403, 401))) {
  27036. $this->io->writeError('<error>Invalid token provided.</error>');
  27037. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27038. return false;
  27039. }
  27040. throw $e;
  27041. }
  27042. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  27043. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  27044. $this->io->writeError('<info>Token stored successfully.</info>');
  27045. return true;
  27046. }
  27047. public function getRateLimit(array $headers)
  27048. {
  27049. $rateLimit = array(
  27050. 'limit' => '?',
  27051. 'reset' => '?',
  27052. );
  27053. foreach ($headers as $header) {
  27054. $header = trim($header);
  27055. if (false === strpos($header, 'X-RateLimit-')) {
  27056. continue;
  27057. }
  27058. list($type, $value) = explode(':', $header, 2);
  27059. switch ($type) {
  27060. case 'X-RateLimit-Limit':
  27061. $rateLimit['limit'] = (int) trim($value);
  27062. break;
  27063. case 'X-RateLimit-Reset':
  27064. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  27065. break;
  27066. }
  27067. }
  27068. return $rateLimit;
  27069. }
  27070. public function isRateLimited(array $headers)
  27071. {
  27072. foreach ($headers as $header) {
  27073. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  27074. return true;
  27075. }
  27076. }
  27077. return false;
  27078. }
  27079. }
  27080. <?php
  27081. namespace Composer\Util;
  27082. use Composer\IO\IOInterface;
  27083. use Composer\Config;
  27084. use Composer\Factory;
  27085. use Composer\Downloader\TransportException;
  27086. use Composer\Json\JsonFile;
  27087. class GitLab
  27088. {
  27089. protected $io;
  27090. protected $config;
  27091. protected $process;
  27092. protected $remoteFilesystem;
  27093. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  27094. {
  27095. $this->io = $io;
  27096. $this->config = $config;
  27097. $this->process = $process ?: new ProcessExecutor($io);
  27098. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  27099. }
  27100. public function authorizeOAuth($originUrl)
  27101. {
  27102. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  27103. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  27104. return false;
  27105. }
  27106. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  27107. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  27108. return true;
  27109. }
  27110. $authTokens = $this->config->get('gitlab-token');
  27111. if (isset($authTokens[$originUrl])) {
  27112. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  27113. return true;
  27114. }
  27115. if (isset($authTokens[$bcOriginUrl])) {
  27116. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  27117. return true;
  27118. }
  27119. return false;
  27120. }
  27121. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  27122. {
  27123. if ($message) {
  27124. $this->io->writeError($message);
  27125. }
  27126. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  27127. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/profile/applications');
  27128. $attemptCounter = 0;
  27129. while ($attemptCounter++ < 5) {
  27130. try {
  27131. $response = $this->createToken($scheme, $originUrl);
  27132. } catch (TransportException $e) {
  27133. if (in_array($e->getCode(), array(403, 401))) {
  27134. if (401 === $e->getCode()) {
  27135. $response = json_decode($e->getResponse(), true);
  27136. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  27137. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  27138. } else {
  27139. $this->io->writeError('Bad credentials.');
  27140. }
  27141. } else {
  27142. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  27143. }
  27144. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  27145. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  27146. continue;
  27147. }
  27148. throw $e;
  27149. }
  27150. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  27151. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  27152. return true;
  27153. }
  27154. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  27155. }
  27156. private function createToken($scheme, $originUrl)
  27157. {
  27158. $username = $this->io->ask('Username: ');
  27159. $password = $this->io->askAndHideAnswer('Password: ');
  27160. $headers = array('Content-Type: application/x-www-form-urlencoded');
  27161. $apiUrl = $originUrl;
  27162. $data = http_build_query(array(
  27163. 'username' => $username,
  27164. 'password' => $password,
  27165. 'grant_type' => 'password',
  27166. ), null, '&');
  27167. $options = array(
  27168. 'retry-auth-failure' => false,
  27169. 'http' => array(
  27170. 'method' => 'POST',
  27171. 'header' => $headers,
  27172. 'content' => $data,
  27173. ),
  27174. );
  27175. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  27176. $this->io->writeError('Token successfully created');
  27177. return JsonFile::parseJson($json);
  27178. }
  27179. }
  27180. <?php
  27181. namespace Composer\Util;
  27182. use Composer\Config;
  27183. use Composer\IO\IOInterface;
  27184. class Hg
  27185. {
  27186. private $io;
  27187. private $config;
  27188. private $process;
  27189. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  27190. {
  27191. $this->io = $io;
  27192. $this->config = $config;
  27193. $this->process = $process;
  27194. }
  27195. public function runCommand($commandCallable, $url, $cwd)
  27196. {
  27197. $this->config->prohibitUrlByConfig($url, $this->io);
  27198. $command = call_user_func($commandCallable, $url);
  27199. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27200. return;
  27201. }
  27202. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  27203. $auth = $this->io->getAuthentication($match[5]);
  27204. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  27205. $command = call_user_func($commandCallable, $authenticatedUrl);
  27206. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27207. return;
  27208. }
  27209. $error = $this->process->getErrorOutput();
  27210. } else {
  27211. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  27212. }
  27213. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  27214. }
  27215. public static function sanitizeUrl($message)
  27216. {
  27217. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  27218. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  27219. return '://***:***@';
  27220. }
  27221. return '://' . $m[1] . ':***@';
  27222. }, $message);
  27223. }
  27224. private function throwException($message, $url)
  27225. {
  27226. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  27227. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  27228. }
  27229. throw new \RuntimeException(self::sanitizeUrl($message));
  27230. }
  27231. }
  27232. <?php
  27233. namespace Composer\Util;
  27234. use Composer\XdebugHandler\XdebugHandler;
  27235. class IniHelper
  27236. {
  27237. public static function getAll()
  27238. {
  27239. return XdebugHandler::getAllIniFiles();
  27240. }
  27241. public static function getMessage()
  27242. {
  27243. $paths = self::getAll();
  27244. if (empty($paths[0])) {
  27245. array_shift($paths);
  27246. }
  27247. $ini = array_shift($paths);
  27248. if (empty($ini)) {
  27249. return 'A php.ini file does not exist. You will have to create one.';
  27250. }
  27251. if (!empty($paths)) {
  27252. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  27253. }
  27254. return 'The php.ini used by your command-line PHP is: '.$ini;
  27255. }
  27256. }
  27257. <?php
  27258. namespace Composer\Util;
  27259. use stdClass;
  27260. class NoProxyPattern
  27261. {
  27262. protected $hostNames = array();
  27263. protected $rules = array();
  27264. protected $noproxy;
  27265. public function __construct($pattern)
  27266. {
  27267. $this->hostNames = preg_split('{[\s,]+}', $pattern, null, PREG_SPLIT_NO_EMPTY);
  27268. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  27269. }
  27270. public function test($url)
  27271. {
  27272. if ($this->noproxy) {
  27273. return true;
  27274. }
  27275. if (!$urlData = $this->getUrlData($url)) {
  27276. return false;
  27277. }
  27278. foreach ($this->hostNames as $index => $hostName) {
  27279. if ($this->match($index, $hostName, $urlData)) {
  27280. return true;
  27281. }
  27282. }
  27283. return false;
  27284. }
  27285. protected function getUrlData($url)
  27286. {
  27287. if (!$host = parse_url($url, PHP_URL_HOST)) {
  27288. return false;
  27289. }
  27290. $port = parse_url($url, PHP_URL_PORT);
  27291. if (empty($port)) {
  27292. switch (parse_url($url, PHP_URL_SCHEME)) {
  27293. case 'http':
  27294. $port = 80;
  27295. break;
  27296. case 'https':
  27297. $port = 443;
  27298. break;
  27299. }
  27300. }
  27301. $hostName = $host . ($port ? ':' . $port : '');
  27302. list($host, $port, $err) = $this->splitHostPort($hostName);
  27303. if ($err || !$this->ipCheckData($host, $ipdata)) {
  27304. return false;
  27305. }
  27306. return $this->makeData($host, $port, $ipdata);
  27307. }
  27308. protected function match($index, $hostName, $url)
  27309. {
  27310. if (!$rule = $this->getRule($index, $hostName)) {
  27311. return false;
  27312. }
  27313. if ($rule->ipdata) {
  27314. if (!$url->ipdata) {
  27315. return false;
  27316. }
  27317. if ($rule->ipdata->netmask) {
  27318. return $this->matchRange($rule->ipdata, $url->ipdata);
  27319. }
  27320. $match = $rule->ipdata->ip === $url->ipdata->ip;
  27321. } else {
  27322. $haystack = substr($url->name, - strlen($rule->name));
  27323. $match = stripos($haystack, $rule->name) === 0;
  27324. }
  27325. if ($match && $rule->port) {
  27326. $match = $rule->port === $url->port;
  27327. }
  27328. return $match;
  27329. }
  27330. protected function matchRange(stdClass $network, stdClass $target)
  27331. {
  27332. $net = unpack('C*', $network->ip);
  27333. $mask = unpack('C*', $network->netmask);
  27334. $ip = unpack('C*', $target->ip);
  27335. for ($i = 1; $i < 17; ++$i) {
  27336. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  27337. return false;
  27338. }
  27339. }
  27340. return true;
  27341. }
  27342. private function getRule($index, $hostName)
  27343. {
  27344. if (array_key_exists($index, $this->rules)) {
  27345. return $this->rules[$index];
  27346. }
  27347. $this->rules[$index] = null;
  27348. list($host, $port, $err) = $this->splitHostPort($hostName);
  27349. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  27350. return null;
  27351. }
  27352. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  27353. return $this->rules[$index];
  27354. }
  27355. private function ipCheckData($host, &$ipdata, $allowPrefix = false)
  27356. {
  27357. $ipdata = null;
  27358. $netmask = null;
  27359. $prefix = null;
  27360. $modified = false;
  27361. if (strpos($host, '/') !== false) {
  27362. list($host, $prefix) = explode('/', $host);
  27363. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  27364. return false;
  27365. }
  27366. $prefix = (int) $prefix;
  27367. $modified = true;
  27368. }
  27369. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  27370. return !$modified;
  27371. }
  27372. list($ip, $size) = $this->ipGetAddr($host);
  27373. if ($prefix !== null) {
  27374. if ($prefix > $size * 8) {
  27375. return false;
  27376. }
  27377. list($ip, $netmask) = $this->ipGetNetwork($ip, $size, $prefix);
  27378. }
  27379. $ipdata = $this->makeIpData($ip, $size, $netmask);
  27380. return true;
  27381. }
  27382. private function ipGetAddr($host)
  27383. {
  27384. $ip = inet_pton($host);
  27385. $size = strlen($ip);
  27386. $mapped = $this->ipMapTo6($ip, $size);
  27387. return array($mapped, $size);
  27388. }
  27389. private function ipGetMask($prefix, $size)
  27390. {
  27391. $mask = '';
  27392. if ($ones = floor($prefix / 8)) {
  27393. $mask = str_repeat(chr(255), $ones);
  27394. }
  27395. if ($remainder = $prefix % 8) {
  27396. $mask .= chr(0xff ^ (0xff >> $remainder));
  27397. }
  27398. $mask = str_pad($mask, $size, chr(0));
  27399. return $this->ipMapTo6($mask, $size);
  27400. }
  27401. private function ipGetNetwork($rangeIp, $size, $prefix)
  27402. {
  27403. $netmask = $this->ipGetMask($prefix, $size);
  27404. $mask = unpack('C*', $netmask);
  27405. $ip = unpack('C*', $rangeIp);
  27406. $net = '';
  27407. for ($i = 1; $i < 17; ++$i) {
  27408. $net .= chr($ip[$i] & $mask[$i]);
  27409. }
  27410. return array($net, $netmask);
  27411. }
  27412. private function ipMapTo6($binary, $size)
  27413. {
  27414. if ($size === 4) {
  27415. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  27416. $binary = $prefix . $binary;
  27417. }
  27418. return $binary;
  27419. }
  27420. private function makeData($host, $port, $ipdata)
  27421. {
  27422. return (object) array(
  27423. 'host' => $host,
  27424. 'name' => '.' . ltrim($host, '.'),
  27425. 'port' => $port,
  27426. 'ipdata' => $ipdata,
  27427. );
  27428. }
  27429. private function makeIpData($ip, $size, $netmask)
  27430. {
  27431. return (object) array(
  27432. 'ip' => $ip,
  27433. 'size' => $size,
  27434. 'netmask' => $netmask,
  27435. );
  27436. }
  27437. private function splitHostPort($hostName)
  27438. {
  27439. $error = array('', '', true);
  27440. $port = 0;
  27441. $ip6 = '';
  27442. if ($hostName[0] === '[') {
  27443. $index = strpos($hostName, ']');
  27444. if (false === $index || $index < 3) {
  27445. return $error;
  27446. }
  27447. $ip6 = substr($hostName, 1, $index - 1);
  27448. $hostName = substr($hostName, $index + 1);
  27449. if (strpbrk($hostName, '[]') !== false
  27450. || substr_count($hostName, ':') > 1) {
  27451. return $error;
  27452. }
  27453. }
  27454. if (substr_count($hostName, ':') === 1) {
  27455. $index = strpos($hostName, ':');
  27456. $port = substr($hostName, $index + 1);
  27457. $hostName = substr($hostName, 0, $index);
  27458. if (!$this->validateInt($port, 1, 65535)) {
  27459. return $error;
  27460. }
  27461. $port = (int) $port;
  27462. }
  27463. $host = $ip6 . $hostName;
  27464. return array($host, $port, false);
  27465. }
  27466. private function validateInt($int, $min, $max)
  27467. {
  27468. $options = array(
  27469. 'options' => array(
  27470. 'min_range' => $min,
  27471. 'max_range' => $max)
  27472. );
  27473. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  27474. }
  27475. }
  27476. <?php
  27477. namespace Composer\Util;
  27478. use Composer\Package\Link;
  27479. use Composer\Package\PackageInterface;
  27480. class PackageSorter
  27481. {
  27482. public static function sortPackages(array $packages) {
  27483. $usageList = array();
  27484. foreach ($packages as $package) {
  27485. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  27486. $target = $link->getTarget();
  27487. $usageList[$target][] = $package->getName();
  27488. }
  27489. }
  27490. $computing = array();
  27491. $computed = array();
  27492. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  27493. if (isset($computed[$name])) {
  27494. return $computed[$name];
  27495. }
  27496. if (isset($computing[$name])) {
  27497. return 0;
  27498. }
  27499. $computing[$name] = true;
  27500. $weight = 0;
  27501. if (isset($usageList[$name])) {
  27502. foreach ($usageList[$name] as $user) {
  27503. $weight -= 1 - $computeImportance($user);
  27504. }
  27505. }
  27506. unset($computing[$name]);
  27507. $computed[$name] = $weight;
  27508. return $weight;
  27509. };
  27510. $weightList = array();
  27511. foreach ($packages as $name => $package) {
  27512. $weight = $computeImportance($name);
  27513. $weightList[$name] = $weight;
  27514. }
  27515. $stable_sort = function (&$array) {
  27516. static $transform, $restore;
  27517. $i = 0;
  27518. if (!$transform) {
  27519. $transform = function (&$v, $k) use (&$i) {
  27520. $v = array($v, ++$i, $k, $v);
  27521. };
  27522. $restore = function (&$v) {
  27523. $v = $v[3];
  27524. };
  27525. }
  27526. array_walk($array, $transform);
  27527. asort($array);
  27528. array_walk($array, $restore);
  27529. };
  27530. $stable_sort($weightList);
  27531. $sortedPackages = array();
  27532. foreach (array_keys($weightList) as $name) {
  27533. $sortedPackages[] = $packages[$name];
  27534. }
  27535. return $sortedPackages;
  27536. }
  27537. }
  27538. <?php
  27539. namespace Composer\Util;
  27540. use Composer\IO\IOInterface;
  27541. use Symfony\Component\Process\Process;
  27542. class Perforce
  27543. {
  27544. protected $path;
  27545. protected $p4Depot;
  27546. protected $p4Client;
  27547. protected $p4User;
  27548. protected $p4Password;
  27549. protected $p4Port;
  27550. protected $p4Stream;
  27551. protected $p4ClientSpec;
  27552. protected $p4DepotType;
  27553. protected $p4Branch;
  27554. protected $process;
  27555. protected $uniquePerforceClientName;
  27556. protected $windowsFlag;
  27557. protected $commandResult;
  27558. protected $io;
  27559. protected $filesystem;
  27560. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  27561. {
  27562. $this->windowsFlag = $isWindows;
  27563. $this->p4Port = $port;
  27564. $this->initializePath($path);
  27565. $this->process = $process;
  27566. $this->initialize($repoConfig);
  27567. $this->io = $io;
  27568. }
  27569. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  27570. {
  27571. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  27572. }
  27573. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  27574. {
  27575. $output = null;
  27576. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  27577. }
  27578. public function initialize($repoConfig)
  27579. {
  27580. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  27581. if (!$repoConfig) {
  27582. return;
  27583. }
  27584. if (isset($repoConfig['unique_perforce_client_name'])) {
  27585. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  27586. }
  27587. if (isset($repoConfig['depot'])) {
  27588. $this->p4Depot = $repoConfig['depot'];
  27589. }
  27590. if (isset($repoConfig['branch'])) {
  27591. $this->p4Branch = $repoConfig['branch'];
  27592. }
  27593. if (isset($repoConfig['p4user'])) {
  27594. $this->p4User = $repoConfig['p4user'];
  27595. } else {
  27596. $this->p4User = $this->getP4variable('P4USER');
  27597. }
  27598. if (isset($repoConfig['p4password'])) {
  27599. $this->p4Password = $repoConfig['p4password'];
  27600. }
  27601. }
  27602. public function initializeDepotAndBranch($depot, $branch)
  27603. {
  27604. if (isset($depot)) {
  27605. $this->p4Depot = $depot;
  27606. }
  27607. if (isset($branch)) {
  27608. $this->p4Branch = $branch;
  27609. }
  27610. }
  27611. public function generateUniquePerforceClientName()
  27612. {
  27613. return gethostname() . "_" . time();
  27614. }
  27615. public function cleanupClientSpec()
  27616. {
  27617. $client = $this->getClient();
  27618. $task = 'client -d ' . ProcessExecutor::escape($client);
  27619. $useP4Client = false;
  27620. $command = $this->generateP4Command($task, $useP4Client);
  27621. $this->executeCommand($command);
  27622. $clientSpec = $this->getP4ClientSpec();
  27623. $fileSystem = $this->getFilesystem();
  27624. $fileSystem->remove($clientSpec);
  27625. }
  27626. protected function executeCommand($command)
  27627. {
  27628. $this->commandResult = '';
  27629. return $this->process->execute($command, $this->commandResult);
  27630. }
  27631. public function getClient()
  27632. {
  27633. if (!isset($this->p4Client)) {
  27634. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  27635. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  27636. }
  27637. return $this->p4Client;
  27638. }
  27639. protected function getPath()
  27640. {
  27641. return $this->path;
  27642. }
  27643. public function initializePath($path)
  27644. {
  27645. $this->path = $path;
  27646. $fs = $this->getFilesystem();
  27647. $fs->ensureDirectoryExists($path);
  27648. }
  27649. protected function getPort()
  27650. {
  27651. return $this->p4Port;
  27652. }
  27653. public function setStream($stream)
  27654. {
  27655. $this->p4Stream = $stream;
  27656. $index = strrpos($stream, '/');
  27657. if ($index > 2) {
  27658. $this->p4DepotType = 'stream';
  27659. }
  27660. }
  27661. public function isStream()
  27662. {
  27663. return (strcmp($this->p4DepotType, 'stream') === 0);
  27664. }
  27665. public function getStream()
  27666. {
  27667. if (!isset($this->p4Stream)) {
  27668. if ($this->isStream()) {
  27669. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  27670. } else {
  27671. $this->p4Stream = '//' . $this->p4Depot;
  27672. }
  27673. }
  27674. return $this->p4Stream;
  27675. }
  27676. public function getStreamWithoutLabel($stream)
  27677. {
  27678. $index = strpos($stream, '@');
  27679. if ($index === false) {
  27680. return $stream;
  27681. }
  27682. return substr($stream, 0, $index);
  27683. }
  27684. public function getP4ClientSpec()
  27685. {
  27686. return $this->path . '/' . $this->getClient() . '.p4.spec';
  27687. }
  27688. public function getUser()
  27689. {
  27690. return $this->p4User;
  27691. }
  27692. public function setUser($user)
  27693. {
  27694. $this->p4User = $user;
  27695. }
  27696. public function queryP4User()
  27697. {
  27698. $this->getUser();
  27699. if (strlen($this->p4User) > 0) {
  27700. return;
  27701. }
  27702. $this->p4User = $this->getP4variable('P4USER');
  27703. if (strlen($this->p4User) > 0) {
  27704. return;
  27705. }
  27706. $this->p4User = $this->io->ask('Enter P4 User:');
  27707. if ($this->windowsFlag) {
  27708. $command = 'p4 set P4USER=' . $this->p4User;
  27709. } else {
  27710. $command = 'export P4USER=' . $this->p4User;
  27711. }
  27712. $this->executeCommand($command);
  27713. }
  27714. protected function getP4variable($name)
  27715. {
  27716. if ($this->windowsFlag) {
  27717. $command = 'p4 set';
  27718. $this->executeCommand($command);
  27719. $result = trim($this->commandResult);
  27720. $resArray = explode(PHP_EOL, $result);
  27721. foreach ($resArray as $line) {
  27722. $fields = explode('=', $line);
  27723. if (strcmp($name, $fields[0]) == 0) {
  27724. $index = strpos($fields[1], ' ');
  27725. if ($index === false) {
  27726. $value = $fields[1];
  27727. } else {
  27728. $value = substr($fields[1], 0, $index);
  27729. }
  27730. $value = trim($value);
  27731. return $value;
  27732. }
  27733. }
  27734. return null;
  27735. }
  27736. $command = 'echo $' . $name;
  27737. $this->executeCommand($command);
  27738. $result = trim($this->commandResult);
  27739. return $result;
  27740. }
  27741. public function queryP4Password()
  27742. {
  27743. if (isset($this->p4Password)) {
  27744. return $this->p4Password;
  27745. }
  27746. $password = $this->getP4variable('P4PASSWD');
  27747. if (strlen($password) <= 0) {
  27748. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  27749. }
  27750. $this->p4Password = $password;
  27751. return $password;
  27752. }
  27753. public function generateP4Command($command, $useClient = true)
  27754. {
  27755. $p4Command = 'p4 ';
  27756. $p4Command .= '-u ' . $this->getUser() . ' ';
  27757. if ($useClient) {
  27758. $p4Command .= '-c ' . $this->getClient() . ' ';
  27759. }
  27760. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  27761. return $p4Command;
  27762. }
  27763. public function isLoggedIn()
  27764. {
  27765. $command = $this->generateP4Command('login -s', false);
  27766. $exitCode = $this->executeCommand($command);
  27767. if ($exitCode) {
  27768. $errorOutput = $this->process->getErrorOutput();
  27769. $index = strpos($errorOutput, $this->getUser());
  27770. if ($index === false) {
  27771. $index = strpos($errorOutput, 'p4');
  27772. if ($index === false) {
  27773. return false;
  27774. }
  27775. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  27776. }
  27777. throw new \Exception('Invalid user name: ' . $this->getUser());
  27778. }
  27779. return true;
  27780. }
  27781. public function connectClient()
  27782. {
  27783. $p4CreateClientCommand = $this->generateP4Command(
  27784. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  27785. );
  27786. $this->executeCommand($p4CreateClientCommand);
  27787. }
  27788. public function syncCodeBase($sourceReference)
  27789. {
  27790. $prevDir = getcwd();
  27791. chdir($this->path);
  27792. $p4SyncCommand = $this->generateP4Command('sync -f ');
  27793. if (null !== $sourceReference) {
  27794. $p4SyncCommand .= '@' . $sourceReference;
  27795. }
  27796. $this->executeCommand($p4SyncCommand);
  27797. chdir($prevDir);
  27798. }
  27799. public function writeClientSpecToFile($spec)
  27800. {
  27801. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  27802. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  27803. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  27804. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  27805. fwrite($spec, 'Description:' . PHP_EOL);
  27806. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  27807. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  27808. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  27809. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  27810. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  27811. if ($this->isStream()) {
  27812. fwrite($spec, 'Stream:' . PHP_EOL);
  27813. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  27814. } else {
  27815. fwrite(
  27816. $spec,
  27817. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  27818. );
  27819. }
  27820. }
  27821. public function writeP4ClientSpec()
  27822. {
  27823. $clientSpec = $this->getP4ClientSpec();
  27824. $spec = fopen($clientSpec, 'w');
  27825. try {
  27826. $this->writeClientSpecToFile($spec);
  27827. } catch (\Exception $e) {
  27828. fclose($spec);
  27829. throw $e;
  27830. }
  27831. fclose($spec);
  27832. }
  27833. protected function read($pipe, $name)
  27834. {
  27835. if (feof($pipe)) {
  27836. return;
  27837. }
  27838. $line = fgets($pipe);
  27839. while ($line !== false) {
  27840. $line = fgets($pipe);
  27841. }
  27842. }
  27843. public function windowsLogin($password)
  27844. {
  27845. $command = $this->generateP4Command(' login -a');
  27846. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  27847. $process = Process::fromShellCommandline($command, null, null, $password);
  27848. } else {
  27849. $process = new Process($command, null, null, $password);
  27850. }
  27851. return $process->run();
  27852. }
  27853. public function p4Login()
  27854. {
  27855. $this->queryP4User();
  27856. if (!$this->isLoggedIn()) {
  27857. $password = $this->queryP4Password();
  27858. if ($this->windowsFlag) {
  27859. $this->windowsLogin($password);
  27860. } else {
  27861. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  27862. $exitCode = $this->executeCommand($command);
  27863. $result = trim($this->commandResult);
  27864. if ($exitCode) {
  27865. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  27866. }
  27867. }
  27868. }
  27869. }
  27870. public function getComposerInformation($identifier)
  27871. {
  27872. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  27873. if (!$composerFileContent) {
  27874. return;
  27875. }
  27876. return json_decode($composerFileContent, true);
  27877. }
  27878. public function getFileContent($file, $identifier)
  27879. {
  27880. $path = $this->getFilePath($file, $identifier);
  27881. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  27882. $this->executeCommand($command);
  27883. $result = $this->commandResult;
  27884. if (!trim($result)) {
  27885. return null;
  27886. }
  27887. return $result;
  27888. }
  27889. public function getFilePath($file, $identifier)
  27890. {
  27891. $index = strpos($identifier, '@');
  27892. if ($index === false) {
  27893. $path = $identifier. '/' . $file;
  27894. return $path;
  27895. }
  27896. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  27897. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  27898. $this->executeCommand($command);
  27899. $result = $this->commandResult;
  27900. $index2 = strpos($result, 'no such file(s).');
  27901. if ($index2 === false) {
  27902. $index3 = strpos($result, 'change');
  27903. if ($index3 !== false) {
  27904. $phrase = trim(substr($result, $index3));
  27905. $fields = explode(' ', $phrase);
  27906. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  27907. }
  27908. }
  27909. return null;
  27910. }
  27911. public function getBranches()
  27912. {
  27913. $possibleBranches = array();
  27914. if (!$this->isStream()) {
  27915. $possibleBranches[$this->p4Branch] = $this->getStream();
  27916. } else {
  27917. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  27918. $this->executeCommand($command);
  27919. $result = $this->commandResult;
  27920. $resArray = explode(PHP_EOL, $result);
  27921. foreach ($resArray as $line) {
  27922. $resBits = explode(' ', $line);
  27923. if (count($resBits) > 4) {
  27924. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  27925. $possibleBranches[$branch] = $resBits[1];
  27926. }
  27927. }
  27928. }
  27929. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  27930. $this->executeCommand($command);
  27931. $result = $this->commandResult;
  27932. $resArray = explode(PHP_EOL, $result);
  27933. $lastCommit = $resArray[0];
  27934. $lastCommitArr = explode(' ', $lastCommit);
  27935. $lastCommitNum = $lastCommitArr[1];
  27936. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  27937. return $branches;
  27938. }
  27939. public function getTags()
  27940. {
  27941. $command = $this->generateP4Command('labels');
  27942. $this->executeCommand($command);
  27943. $result = $this->commandResult;
  27944. $resArray = explode(PHP_EOL, $result);
  27945. $tags = array();
  27946. foreach ($resArray as $line) {
  27947. if (strpos($line, 'Label') !== false) {
  27948. $fields = explode(' ', $line);
  27949. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  27950. }
  27951. }
  27952. return $tags;
  27953. }
  27954. public function checkStream()
  27955. {
  27956. $command = $this->generateP4Command('depots', false);
  27957. $this->executeCommand($command);
  27958. $result = $this->commandResult;
  27959. $resArray = explode(PHP_EOL, $result);
  27960. foreach ($resArray as $line) {
  27961. if (strpos($line, 'Depot') !== false) {
  27962. $fields = explode(' ', $line);
  27963. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  27964. $this->p4DepotType = $fields[3];
  27965. return $this->isStream();
  27966. }
  27967. }
  27968. }
  27969. return false;
  27970. }
  27971. protected function getChangeList($reference)
  27972. {
  27973. $index = strpos($reference, '@');
  27974. if ($index === false) {
  27975. return null;
  27976. }
  27977. $label = substr($reference, $index);
  27978. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  27979. $this->executeCommand($command);
  27980. $changes = $this->commandResult;
  27981. if (strpos($changes, 'Change') !== 0) {
  27982. return null;
  27983. }
  27984. $fields = explode(' ', $changes);
  27985. return $fields[1];
  27986. }
  27987. public function getCommitLogs($fromReference, $toReference)
  27988. {
  27989. $fromChangeList = $this->getChangeList($fromReference);
  27990. if ($fromChangeList === null) {
  27991. return null;
  27992. }
  27993. $toChangeList = $this->getChangeList($toReference);
  27994. if ($toChangeList === null) {
  27995. return null;
  27996. }
  27997. $index = strpos($fromReference, '@');
  27998. $main = substr($fromReference, 0, $index) . '/...';
  27999. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  28000. $this->executeCommand($command);
  28001. return $this->commandResult;
  28002. }
  28003. public function getFilesystem()
  28004. {
  28005. if (empty($this->filesystem)) {
  28006. $this->filesystem = new Filesystem($this->process);
  28007. }
  28008. return $this->filesystem;
  28009. }
  28010. public function setFilesystem(Filesystem $fs)
  28011. {
  28012. $this->filesystem = $fs;
  28013. }
  28014. }
  28015. <?php
  28016. namespace Composer\Util;
  28017. class Platform
  28018. {
  28019. public static function expandPath($path)
  28020. {
  28021. if (preg_match('#^~[\\/]#', $path)) {
  28022. return self::getUserDirectory() . substr($path, 1);
  28023. }
  28024. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  28025. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  28026. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  28027. }
  28028. return getenv($matches['var']) . $matches['path'];
  28029. }, $path);
  28030. }
  28031. public static function getUserDirectory()
  28032. {
  28033. if (false !== ($home = getenv('HOME'))) {
  28034. return $home;
  28035. }
  28036. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  28037. return $home;
  28038. }
  28039. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  28040. $info = posix_getpwuid(posix_getuid());
  28041. return $info['dir'];
  28042. }
  28043. throw new \RuntimeException('Could not determine user directory');
  28044. }
  28045. public static function isWindows()
  28046. {
  28047. return defined('PHP_WINDOWS_VERSION_BUILD');
  28048. }
  28049. public static function strlen($str)
  28050. {
  28051. static $useMbString = null;
  28052. if (null === $useMbString) {
  28053. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  28054. }
  28055. if ($useMbString) {
  28056. return mb_strlen($str, '8bit');
  28057. }
  28058. return strlen($str);
  28059. }
  28060. }
  28061. <?php
  28062. namespace Composer\Util;
  28063. use Composer\IO\IOInterface;
  28064. use Symfony\Component\Process\Process;
  28065. use Symfony\Component\Process\ProcessUtils;
  28066. class ProcessExecutor
  28067. {
  28068. protected static $timeout = 300;
  28069. protected $captureOutput;
  28070. protected $errorOutput;
  28071. protected $io;
  28072. public function __construct(IOInterface $io = null)
  28073. {
  28074. $this->io = $io;
  28075. }
  28076. public function execute($command, &$output = null, $cwd = null)
  28077. {
  28078. if ($this->io && $this->io->isDebug()) {
  28079. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  28080. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  28081. return '://***:***@';
  28082. }
  28083. return '://'.$m['user'].':***@';
  28084. }, $command);
  28085. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  28086. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  28087. }
  28088. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  28089. $cwd = realpath(getcwd());
  28090. }
  28091. $this->captureOutput = func_num_args() > 1;
  28092. $this->errorOutput = null;
  28093. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  28094. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  28095. } else {
  28096. $process = new Process($command, $cwd, null, null, static::getTimeout());
  28097. }
  28098. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  28099. $process->run($callback);
  28100. if ($this->captureOutput && !is_callable($output)) {
  28101. $output = $process->getOutput();
  28102. }
  28103. $this->errorOutput = $process->getErrorOutput();
  28104. return $process->getExitCode();
  28105. }
  28106. public function splitLines($output)
  28107. {
  28108. $output = trim($output);
  28109. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  28110. }
  28111. public function getErrorOutput()
  28112. {
  28113. return $this->errorOutput;
  28114. }
  28115. public function outputHandler($type, $buffer)
  28116. {
  28117. if ($this->captureOutput) {
  28118. return;
  28119. }
  28120. if (null === $this->io) {
  28121. echo $buffer;
  28122. return;
  28123. }
  28124. if (method_exists($this->io, 'writeRaw')) {
  28125. if (Process::ERR === $type) {
  28126. $this->io->writeErrorRaw($buffer, false);
  28127. } else {
  28128. $this->io->writeRaw($buffer, false);
  28129. }
  28130. } else {
  28131. if (Process::ERR === $type) {
  28132. $this->io->writeError($buffer, false);
  28133. } else {
  28134. $this->io->write($buffer, false);
  28135. }
  28136. }
  28137. }
  28138. public static function getTimeout()
  28139. {
  28140. return static::$timeout;
  28141. }
  28142. public static function setTimeout($timeout)
  28143. {
  28144. static::$timeout = $timeout;
  28145. }
  28146. public static function escape($argument)
  28147. {
  28148. return self::escapeArgument($argument);
  28149. }
  28150. private static function escapeArgument($argument)
  28151. {
  28152. if ('\\' === DIRECTORY_SEPARATOR) {
  28153. if ((string) $argument === '') {
  28154. return escapeshellarg($argument);
  28155. }
  28156. $escapedArgument = '';
  28157. $quote = false;
  28158. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  28159. if ('"' === $part) {
  28160. $escapedArgument .= '\\"';
  28161. } elseif (self::isSurroundedBy($part, '%')) {
  28162. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  28163. } else {
  28164. if ('\\' === substr($part, -1)) {
  28165. $part .= '\\';
  28166. }
  28167. $quote = true;
  28168. $escapedArgument .= $part;
  28169. }
  28170. }
  28171. if ($quote) {
  28172. $escapedArgument = '"'.$escapedArgument.'"';
  28173. }
  28174. return $escapedArgument;
  28175. }
  28176. return "'".str_replace("'", "'\\''", $argument)."'";
  28177. }
  28178. private static function isSurroundedBy($arg, $char)
  28179. {
  28180. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  28181. }
  28182. }
  28183. <?php
  28184. namespace Composer\Util;
  28185. use Composer\Config;
  28186. use Composer\Composer;
  28187. use Composer\Semver\Constraint\Constraint;
  28188. use Composer\Package\Version\VersionParser;
  28189. use Composer\IO\IOInterface;
  28190. use Composer\Downloader\TransportException;
  28191. use Composer\CaBundle\CaBundle;
  28192. use Psr\Log\LoggerInterface;
  28193. class RemoteFilesystem
  28194. {
  28195. private $io;
  28196. private $config;
  28197. private $scheme;
  28198. private $bytesMax;
  28199. private $originUrl;
  28200. private $fileUrl;
  28201. private $fileName;
  28202. private $retry;
  28203. private $progress;
  28204. private $lastProgress;
  28205. private $options = array();
  28206. private $peerCertificateMap = array();
  28207. private $disableTls = false;
  28208. private $retryAuthFailure;
  28209. private $lastHeaders;
  28210. private $storeAuth;
  28211. private $degradedMode = false;
  28212. private $redirects;
  28213. private $maxRedirects = 20;
  28214. private $displayedOriginAuthentications = array();
  28215. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  28216. {
  28217. $this->io = $io;
  28218. if ($disableTls === false) {
  28219. $this->options = $this->getTlsDefaults($options);
  28220. } else {
  28221. $this->disableTls = true;
  28222. }
  28223. $this->options = array_replace_recursive($this->options, $options);
  28224. $this->config = $config;
  28225. }
  28226. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  28227. {
  28228. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  28229. }
  28230. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  28231. {
  28232. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  28233. }
  28234. public function getOptions()
  28235. {
  28236. return $this->options;
  28237. }
  28238. public function setOptions(array $options)
  28239. {
  28240. $this->options = array_replace_recursive($this->options, $options);
  28241. }
  28242. public function isTlsDisabled()
  28243. {
  28244. return $this->disableTls === true;
  28245. }
  28246. public function getLastHeaders()
  28247. {
  28248. return $this->lastHeaders;
  28249. }
  28250. public function findHeaderValue(array $headers, $name)
  28251. {
  28252. $value = null;
  28253. foreach ($headers as $header) {
  28254. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  28255. $value = $match[1];
  28256. } elseif (preg_match('{^HTTP/}i', $header)) {
  28257. $value = null;
  28258. }
  28259. }
  28260. return $value;
  28261. }
  28262. public function findStatusCode(array $headers)
  28263. {
  28264. $value = null;
  28265. foreach ($headers as $header) {
  28266. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  28267. $value = (int) $match[1];
  28268. }
  28269. }
  28270. return $value;
  28271. }
  28272. public function findStatusMessage(array $headers)
  28273. {
  28274. $value = null;
  28275. foreach ($headers as $header) {
  28276. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  28277. $value = $header;
  28278. }
  28279. }
  28280. return $value;
  28281. }
  28282. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  28283. {
  28284. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  28285. $originUrl = 'github.com';
  28286. }
  28287. if (
  28288. $this->config
  28289. && is_array($this->config->get('gitlab-domains'))
  28290. && false === strpos($originUrl, '/')
  28291. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  28292. ) {
  28293. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  28294. if (0 === strpos($gitlabDomain, $originUrl)) {
  28295. $originUrl = $gitlabDomain;
  28296. break;
  28297. }
  28298. }
  28299. unset($gitlabDomain);
  28300. }
  28301. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  28302. $this->bytesMax = 0;
  28303. $this->originUrl = $originUrl;
  28304. $this->fileUrl = $fileUrl;
  28305. $this->fileName = $fileName;
  28306. $this->progress = $progress;
  28307. $this->lastProgress = null;
  28308. $this->retryAuthFailure = true;
  28309. $this->lastHeaders = array();
  28310. $this->redirects = 1;
  28311. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  28312. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  28313. }
  28314. $tempAdditionalOptions = $additionalOptions;
  28315. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  28316. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  28317. unset($tempAdditionalOptions['retry-auth-failure']);
  28318. }
  28319. $isRedirect = false;
  28320. if (isset($tempAdditionalOptions['redirects'])) {
  28321. $this->redirects = $tempAdditionalOptions['redirects'];
  28322. $isRedirect = true;
  28323. unset($tempAdditionalOptions['redirects']);
  28324. }
  28325. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  28326. unset($tempAdditionalOptions);
  28327. $origFileUrl = $fileUrl;
  28328. if (isset($options['github-token'])) {
  28329. if (preg_match('{^https?://api\.github\.com/}', $fileUrl)) {
  28330. $options['http']['header'][] = 'Authorization: token '.$options['github-token'];
  28331. }
  28332. unset($options['github-token']);
  28333. }
  28334. if (isset($options['gitlab-token'])) {
  28335. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  28336. unset($options['gitlab-token']);
  28337. }
  28338. if (isset($options['http'])) {
  28339. $options['http']['ignore_errors'] = true;
  28340. }
  28341. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  28342. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  28343. $degradedPackagist = true;
  28344. }
  28345. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  28346. $actualContextOptions = stream_context_get_options($ctx);
  28347. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  28348. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $this->stripCredentialsFromUrl($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  28349. unset($origFileUrl, $actualContextOptions);
  28350. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  28351. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  28352. }
  28353. if ($this->progress && !$isRedirect) {
  28354. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  28355. }
  28356. $errorMessage = '';
  28357. $errorCode = 0;
  28358. $result = false;
  28359. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28360. if ($errorMessage) {
  28361. $errorMessage .= "\n";
  28362. }
  28363. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  28364. return true;
  28365. });
  28366. try {
  28367. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  28368. if (!empty($http_response_header[0])) {
  28369. $statusCode = $this->findStatusCode($http_response_header);
  28370. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  28371. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  28372. }
  28373. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  28374. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  28375. }
  28376. }
  28377. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  28378. if ($contentLength && Platform::strlen($result) < $contentLength) {
  28379. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  28380. $e->setHeaders($http_response_header);
  28381. $e->setStatusCode($this->findStatusCode($http_response_header));
  28382. $e->setResponse($result);
  28383. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  28384. throw $e;
  28385. }
  28386. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  28387. $params = stream_context_get_params($ctx);
  28388. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  28389. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  28390. if ($expectedPeerFingerprint !== $peerFingerprint) {
  28391. throw new TransportException('Peer fingerprint did not match');
  28392. }
  28393. }
  28394. } catch (\Exception $e) {
  28395. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  28396. $e->setHeaders($http_response_header);
  28397. $e->setStatusCode($this->findStatusCode($http_response_header));
  28398. }
  28399. if ($e instanceof TransportException && $result !== false) {
  28400. $e->setResponse($result);
  28401. }
  28402. $result = false;
  28403. }
  28404. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  28405. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  28406. }
  28407. restore_error_handler();
  28408. if (isset($e) && !$this->retry) {
  28409. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28410. $this->degradedMode = true;
  28411. $this->io->writeError('');
  28412. $this->io->writeError(array(
  28413. '<error>'.$e->getMessage().'</error>',
  28414. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28415. ));
  28416. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28417. }
  28418. throw $e;
  28419. }
  28420. $statusCode = null;
  28421. $contentType = null;
  28422. $locationHeader = null;
  28423. if (!empty($http_response_header[0])) {
  28424. $statusCode = $this->findStatusCode($http_response_header);
  28425. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  28426. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  28427. }
  28428. if ($originUrl === 'bitbucket.org'
  28429. && !$this->isPublicBitBucketDownload($fileUrl)
  28430. && substr($fileUrl, -4) === '.zip'
  28431. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  28432. && $contentType && preg_match('{^text/html\b}i', $contentType)
  28433. ) {
  28434. $result = false;
  28435. if ($this->retryAuthFailure) {
  28436. $this->promptAuthAndRetry(401);
  28437. }
  28438. }
  28439. if ($statusCode === 404
  28440. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  28441. && false !== strpos($fileUrl, 'archive.zip')
  28442. ) {
  28443. $result = false;
  28444. if ($this->retryAuthFailure) {
  28445. $this->promptAuthAndRetry(401);
  28446. }
  28447. }
  28448. $hasFollowedRedirect = false;
  28449. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  28450. $hasFollowedRedirect = true;
  28451. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  28452. }
  28453. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  28454. if (!$this->retry) {
  28455. if ($this->progress && !$this->retry && !$isRedirect) {
  28456. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  28457. }
  28458. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  28459. $e->setHeaders($http_response_header);
  28460. $e->setResponse($result);
  28461. $e->setStatusCode($statusCode);
  28462. throw $e;
  28463. }
  28464. $result = false;
  28465. }
  28466. if ($this->progress && !$this->retry && !$isRedirect) {
  28467. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  28468. }
  28469. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  28470. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  28471. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  28472. if ($decode) {
  28473. try {
  28474. if (PHP_VERSION_ID >= 50400) {
  28475. $result = zlib_decode($result);
  28476. } else {
  28477. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  28478. }
  28479. if (!$result) {
  28480. throw new TransportException('Failed to decode zlib stream');
  28481. }
  28482. } catch (\Exception $e) {
  28483. if ($this->degradedMode) {
  28484. throw $e;
  28485. }
  28486. $this->degradedMode = true;
  28487. $this->io->writeError(array(
  28488. '',
  28489. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  28490. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28491. ));
  28492. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28493. }
  28494. }
  28495. }
  28496. if (false !== $result && null !== $fileName && !$isRedirect) {
  28497. if ('' === $result) {
  28498. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  28499. }
  28500. $errorMessage = '';
  28501. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28502. if ($errorMessage) {
  28503. $errorMessage .= "\n";
  28504. }
  28505. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  28506. return true;
  28507. });
  28508. $result = (bool) file_put_contents($fileName, $result);
  28509. restore_error_handler();
  28510. if (false === $result) {
  28511. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  28512. }
  28513. }
  28514. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  28515. if (CaBundle::isOpensslParseSafe()) {
  28516. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  28517. if ($certDetails) {
  28518. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  28519. $this->retry = true;
  28520. }
  28521. } else {
  28522. $this->io->writeError('');
  28523. $this->io->writeError(sprintf(
  28524. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  28525. PHP_VERSION
  28526. ));
  28527. }
  28528. }
  28529. if ($this->retry) {
  28530. $this->retry = false;
  28531. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28532. if ($this->storeAuth && $this->config) {
  28533. $authHelper = new AuthHelper($this->io, $this->config);
  28534. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  28535. $this->storeAuth = false;
  28536. }
  28537. return $result;
  28538. }
  28539. if (false === $result) {
  28540. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  28541. if (!empty($http_response_header[0])) {
  28542. $e->setHeaders($http_response_header);
  28543. }
  28544. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28545. $this->degradedMode = true;
  28546. $this->io->writeError('');
  28547. $this->io->writeError(array(
  28548. '<error>'.$e->getMessage().'</error>',
  28549. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28550. ));
  28551. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28552. }
  28553. throw $e;
  28554. }
  28555. if (!empty($http_response_header[0])) {
  28556. $this->lastHeaders = $http_response_header;
  28557. }
  28558. return $result;
  28559. }
  28560. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  28561. {
  28562. try {
  28563. $e = null;
  28564. $result = file_get_contents($fileUrl, false, $context);
  28565. } catch (\Throwable $e) {
  28566. } catch (\Exception $e) {
  28567. }
  28568. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  28569. if (null !== $e) {
  28570. throw $e;
  28571. }
  28572. return $result;
  28573. }
  28574. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  28575. {
  28576. switch ($notificationCode) {
  28577. case STREAM_NOTIFY_FAILURE:
  28578. if (400 === $messageCode) {
  28579. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  28580. }
  28581. break;
  28582. case STREAM_NOTIFY_FILE_SIZE_IS:
  28583. $this->bytesMax = $bytesMax;
  28584. break;
  28585. case STREAM_NOTIFY_PROGRESS:
  28586. if ($this->bytesMax > 0 && $this->progress) {
  28587. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  28588. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  28589. $this->lastProgress = $progression;
  28590. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  28591. }
  28592. }
  28593. break;
  28594. default:
  28595. break;
  28596. }
  28597. }
  28598. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  28599. {
  28600. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  28601. $gitHubUtil = new GitHub($this->io, $this->config, null);
  28602. $message = "\n";
  28603. $rateLimited = $gitHubUtil->isRateLimited($headers);
  28604. if ($rateLimited) {
  28605. $rateLimit = $gitHubUtil->getRateLimit($headers);
  28606. if ($this->io->hasAuthentication($this->originUrl)) {
  28607. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  28608. } else {
  28609. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  28610. }
  28611. $message = sprintf(
  28612. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  28613. $rateLimit['limit'],
  28614. $rateLimit['reset']
  28615. )."\n";
  28616. } else {
  28617. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  28618. if ($this->io->hasAuthentication($this->originUrl)) {
  28619. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  28620. } else {
  28621. $message .= 'create a GitHub OAuth token to access private repos';
  28622. }
  28623. }
  28624. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  28625. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28626. ) {
  28627. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28628. }
  28629. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  28630. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  28631. $gitLabUtil = new GitLab($this->io, $this->config, null);
  28632. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) {
  28633. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28634. }
  28635. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  28636. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  28637. ) {
  28638. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28639. }
  28640. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  28641. $askForOAuthToken = true;
  28642. if ($this->io->hasAuthentication($this->originUrl)) {
  28643. $auth = $this->io->getAuthentication($this->originUrl);
  28644. if ($auth['username'] !== 'x-token-auth') {
  28645. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  28646. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  28647. if (!empty($accessToken)) {
  28648. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  28649. $askForOAuthToken = false;
  28650. }
  28651. } else {
  28652. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28653. }
  28654. }
  28655. if ($askForOAuthToken) {
  28656. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  28657. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  28658. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  28659. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28660. ) {
  28661. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28662. }
  28663. }
  28664. } else {
  28665. if ($httpStatus === 404) {
  28666. return;
  28667. }
  28668. if (!$this->io->isInteractive()) {
  28669. if ($httpStatus === 401) {
  28670. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  28671. }
  28672. if ($httpStatus === 403) {
  28673. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  28674. }
  28675. throw new TransportException($message, $httpStatus);
  28676. }
  28677. if ($this->io->hasAuthentication($this->originUrl)) {
  28678. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28679. }
  28680. $this->io->writeError(' Authentication required (<info>'.$this->originUrl.'</info>):');
  28681. $username = $this->io->ask(' Username: ');
  28682. $password = $this->io->askAndHideAnswer(' Password: ');
  28683. $this->io->setAuthentication($this->originUrl, $username, $password);
  28684. $this->storeAuth = $this->config->get('store-auths');
  28685. }
  28686. $this->retry = true;
  28687. throw new TransportException('RETRY');
  28688. }
  28689. protected function getOptionsForUrl($originUrl, $additionalOptions)
  28690. {
  28691. $tlsOptions = array();
  28692. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  28693. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  28694. if (PHP_VERSION_ID < 50304) {
  28695. if ($host === 'github.com' || $host === 'api.github.com') {
  28696. $host = '*.github.com';
  28697. }
  28698. }
  28699. $tlsOptions['ssl']['CN_match'] = $host;
  28700. $tlsOptions['ssl']['SNI_server_name'] = $host;
  28701. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  28702. if (isset($this->peerCertificateMap[$urlAuthority])) {
  28703. $certMap = $this->peerCertificateMap[$urlAuthority];
  28704. $this->io->writeError('', true, IOInterface::DEBUG);
  28705. $this->io->writeError(sprintf(
  28706. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  28707. $certMap['cn'],
  28708. $urlAuthority
  28709. ), true, IOInterface::DEBUG);
  28710. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  28711. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  28712. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  28713. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  28714. }
  28715. }
  28716. $headers = array();
  28717. if (extension_loaded('zlib')) {
  28718. $headers[] = 'Accept-Encoding: gzip';
  28719. }
  28720. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  28721. if (!$this->degradedMode) {
  28722. $options['http']['protocol_version'] = 1.1;
  28723. $headers[] = 'Connection: close';
  28724. }
  28725. if ($this->io->hasAuthentication($originUrl)) {
  28726. $authenticationDisplayMessage = null;
  28727. $auth = $this->io->getAuthentication($originUrl);
  28728. if ($auth['password'] === 'bearer') {
  28729. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28730. } elseif ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  28731. $options['github-token'] = $auth['username'];
  28732. $authenticationDisplayMessage = 'Using GitHub token authentication';
  28733. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  28734. if ($auth['password'] === 'oauth2') {
  28735. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28736. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  28737. } elseif ($auth['password'] === 'private-token' || $auth['password'] === 'gitlab-ci-token') {
  28738. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  28739. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  28740. }
  28741. } elseif ('bitbucket.org' === $originUrl
  28742. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  28743. ) {
  28744. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  28745. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  28746. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  28747. }
  28748. } else {
  28749. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  28750. $headers[] = 'Authorization: Basic '.$authStr;
  28751. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  28752. }
  28753. if ($authenticationDisplayMessage && !in_array($originUrl, $this->displayedOriginAuthentications, true)) {
  28754. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  28755. $this->displayedOriginAuthentications[] = $originUrl;
  28756. }
  28757. }
  28758. $options['http']['follow_location'] = 0;
  28759. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  28760. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  28761. }
  28762. foreach ($headers as $header) {
  28763. $options['http']['header'][] = $header;
  28764. }
  28765. return $options;
  28766. }
  28767. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  28768. {
  28769. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  28770. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  28771. $targetUrl = $locationHeader;
  28772. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  28773. $targetUrl = $this->scheme.':'.$locationHeader;
  28774. } elseif ('/' === $locationHeader[0]) {
  28775. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  28776. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28777. } else {
  28778. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28779. }
  28780. }
  28781. if (!empty($targetUrl)) {
  28782. $this->redirects++;
  28783. $this->io->writeError('', true, IOInterface::DEBUG);
  28784. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $this->stripCredentialsFromUrl($targetUrl)), true, IOInterface::DEBUG);
  28785. $additionalOptions['redirects'] = $this->redirects;
  28786. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  28787. }
  28788. if (!$this->retry) {
  28789. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  28790. $e->setHeaders($http_response_header);
  28791. $e->setResponse($result);
  28792. throw $e;
  28793. }
  28794. return false;
  28795. }
  28796. private function getTlsDefaults(array $options)
  28797. {
  28798. $ciphers = implode(':', array(
  28799. 'ECDHE-RSA-AES128-GCM-SHA256',
  28800. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  28801. 'ECDHE-RSA-AES256-GCM-SHA384',
  28802. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  28803. 'DHE-RSA-AES128-GCM-SHA256',
  28804. 'DHE-DSS-AES128-GCM-SHA256',
  28805. 'kEDH+AESGCM',
  28806. 'ECDHE-RSA-AES128-SHA256',
  28807. 'ECDHE-ECDSA-AES128-SHA256',
  28808. 'ECDHE-RSA-AES128-SHA',
  28809. 'ECDHE-ECDSA-AES128-SHA',
  28810. 'ECDHE-RSA-AES256-SHA384',
  28811. 'ECDHE-ECDSA-AES256-SHA384',
  28812. 'ECDHE-RSA-AES256-SHA',
  28813. 'ECDHE-ECDSA-AES256-SHA',
  28814. 'DHE-RSA-AES128-SHA256',
  28815. 'DHE-RSA-AES128-SHA',
  28816. 'DHE-DSS-AES128-SHA256',
  28817. 'DHE-RSA-AES256-SHA256',
  28818. 'DHE-DSS-AES256-SHA',
  28819. 'DHE-RSA-AES256-SHA',
  28820. 'AES128-GCM-SHA256',
  28821. 'AES256-GCM-SHA384',
  28822. 'AES128-SHA256',
  28823. 'AES256-SHA256',
  28824. 'AES128-SHA',
  28825. 'AES256-SHA',
  28826. 'AES',
  28827. 'CAMELLIA',
  28828. 'DES-CBC3-SHA',
  28829. '!aNULL',
  28830. '!eNULL',
  28831. '!EXPORT',
  28832. '!DES',
  28833. '!RC4',
  28834. '!MD5',
  28835. '!PSK',
  28836. '!aECDH',
  28837. '!EDH-DSS-DES-CBC3-SHA',
  28838. '!EDH-RSA-DES-CBC3-SHA',
  28839. '!KRB5-DES-CBC3-SHA',
  28840. ));
  28841. $defaults = array(
  28842. 'ssl' => array(
  28843. 'ciphers' => $ciphers,
  28844. 'verify_peer' => true,
  28845. 'verify_depth' => 7,
  28846. 'SNI_enabled' => true,
  28847. 'capture_peer_cert' => true,
  28848. ),
  28849. );
  28850. if (isset($options['ssl'])) {
  28851. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  28852. }
  28853. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  28854. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  28855. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  28856. if (is_dir($result)) {
  28857. $defaults['ssl']['capath'] = $result;
  28858. } else {
  28859. $defaults['ssl']['cafile'] = $result;
  28860. }
  28861. }
  28862. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  28863. throw new TransportException('The configured cafile was not valid or could not be read.');
  28864. }
  28865. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  28866. throw new TransportException('The configured capath was not valid or could not be read.');
  28867. }
  28868. if (PHP_VERSION_ID >= 50413) {
  28869. $defaults['ssl']['disable_compression'] = true;
  28870. }
  28871. return $defaults;
  28872. }
  28873. private function getCertificateCnAndFp($url, $options)
  28874. {
  28875. if (PHP_VERSION_ID >= 50600) {
  28876. throw new \BadMethodCallException(sprintf(
  28877. '%s must not be used on PHP >= 5.6',
  28878. __METHOD__
  28879. ));
  28880. }
  28881. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  28882. 'ssl' => array(
  28883. 'capture_peer_cert' => true,
  28884. 'verify_peer' => false,
  28885. ), ),
  28886. ));
  28887. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  28888. return;
  28889. }
  28890. fclose($handle);
  28891. $handle = null;
  28892. $params = stream_context_get_params($context);
  28893. if (!empty($params['options']['ssl']['peer_certificate'])) {
  28894. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  28895. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  28896. return array(
  28897. 'cn' => $commonName,
  28898. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  28899. );
  28900. }
  28901. }
  28902. }
  28903. private function getUrlAuthority($url)
  28904. {
  28905. $defaultPorts = array(
  28906. 'ftp' => 21,
  28907. 'http' => 80,
  28908. 'https' => 443,
  28909. 'ssh2.sftp' => 22,
  28910. 'ssh2.scp' => 22,
  28911. );
  28912. $scheme = parse_url($url, PHP_URL_SCHEME);
  28913. if (!isset($defaultPorts[$scheme])) {
  28914. throw new \InvalidArgumentException(sprintf(
  28915. 'Could not get default port for unknown scheme: %s',
  28916. $scheme
  28917. ));
  28918. }
  28919. $defaultPort = $defaultPorts[$scheme];
  28920. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  28921. return parse_url($url, PHP_URL_HOST).':'.$port;
  28922. }
  28923. private function isPublicBitBucketDownload($urlToBitBucketFile)
  28924. {
  28925. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  28926. if (strpos($domain, 'bitbucket.org') === false) {
  28927. return true;
  28928. }
  28929. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  28930. $pathParts = explode('/', $path);
  28931. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  28932. }
  28933. public static function outputWarnings(IOInterface $io, $url, $data)
  28934. {
  28935. foreach (array('warning', 'info') as $type) {
  28936. if (empty($data[$type])) {
  28937. continue;
  28938. }
  28939. if (!empty($data[$type . '-versions'])) {
  28940. $versionParser = new VersionParser();
  28941. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  28942. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  28943. if (!$constraint->matches($composer)) {
  28944. continue;
  28945. }
  28946. }
  28947. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  28948. }
  28949. }
  28950. public static function getOrigin($urlOrPath)
  28951. {
  28952. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  28953. if (!$hostPort) {
  28954. return $urlOrPath;
  28955. }
  28956. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  28957. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  28958. }
  28959. return $hostPort;
  28960. }
  28961. private function stripCredentialsFromUrl($url)
  28962. {
  28963. return preg_replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  28964. }
  28965. }
  28966. <?php
  28967. namespace Composer\Util;
  28968. class Silencer
  28969. {
  28970. private static $stack = array();
  28971. public static function suppress($mask = null)
  28972. {
  28973. if (!isset($mask)) {
  28974. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  28975. }
  28976. $old = error_reporting();
  28977. self::$stack[] = $old;
  28978. error_reporting($old & ~$mask);
  28979. return $old;
  28980. }
  28981. public static function restore()
  28982. {
  28983. if (!empty(self::$stack)) {
  28984. error_reporting(array_pop(self::$stack));
  28985. }
  28986. }
  28987. public static function call($callable )
  28988. {
  28989. try {
  28990. self::suppress();
  28991. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  28992. self::restore();
  28993. return $result;
  28994. } catch (\Exception $e) {
  28995. self::restore();
  28996. throw $e;
  28997. }
  28998. }
  28999. }
  29000. <?php
  29001. namespace Composer\Util;
  29002. use Composer\Spdx\SpdxLicenses;
  29003. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  29004. class SpdxLicense extends SpdxLicenses
  29005. {
  29006. }
  29007. <?php
  29008. namespace Composer\Util;
  29009. use Composer\Composer;
  29010. final class StreamContextFactory
  29011. {
  29012. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  29013. {
  29014. $options = array('http' => array(
  29015. 'follow_location' => 1,
  29016. 'max_redirects' => 20,
  29017. ));
  29018. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  29019. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  29020. }
  29021. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  29022. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  29023. }
  29024. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  29025. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  29026. }
  29027. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  29028. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  29029. if ($pattern->test($url)) {
  29030. unset($proxy);
  29031. }
  29032. }
  29033. if (!empty($proxy)) {
  29034. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  29035. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  29036. if (isset($proxy['port'])) {
  29037. $proxyURL .= ":" . $proxy['port'];
  29038. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  29039. $proxyURL .= ":80";
  29040. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  29041. $proxyURL .= ":443";
  29042. }
  29043. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  29044. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  29045. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  29046. }
  29047. $options['http']['proxy'] = $proxyURL;
  29048. switch (parse_url($url, PHP_URL_SCHEME)) {
  29049. case 'http':
  29050. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  29051. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29052. $options['http']['request_fulluri'] = true;
  29053. }
  29054. break;
  29055. case 'https':
  29056. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  29057. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29058. $options['http']['request_fulluri'] = true;
  29059. }
  29060. break;
  29061. }
  29062. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  29063. $options['ssl']['SNI_enabled'] = true;
  29064. if (PHP_VERSION_ID < 50600) {
  29065. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  29066. }
  29067. }
  29068. if (isset($proxy['user'])) {
  29069. $auth = rawurldecode($proxy['user']);
  29070. if (isset($proxy['pass'])) {
  29071. $auth .= ':' . rawurldecode($proxy['pass']);
  29072. }
  29073. $auth = base64_encode($auth);
  29074. if (isset($defaultOptions['http']['header'])) {
  29075. if (is_string($defaultOptions['http']['header'])) {
  29076. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  29077. }
  29078. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  29079. } else {
  29080. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  29081. }
  29082. }
  29083. }
  29084. $options = array_replace_recursive($options, $defaultOptions);
  29085. if (isset($options['http']['header'])) {
  29086. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  29087. }
  29088. if (defined('HHVM_VERSION')) {
  29089. $phpVersion = 'HHVM ' . HHVM_VERSION;
  29090. } else {
  29091. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  29092. }
  29093. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  29094. $options['http']['header'][] = sprintf(
  29095. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  29096. Composer::getVersion(),
  29097. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  29098. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  29099. $phpVersion,
  29100. getenv('CI') ? '; CI' : ''
  29101. );
  29102. }
  29103. return stream_context_create($options, $defaultParams);
  29104. }
  29105. private static function fixHttpHeaderField($header)
  29106. {
  29107. if (!is_array($header)) {
  29108. $header = explode("\r\n", $header);
  29109. }
  29110. uasort($header, function ($el) {
  29111. return stripos($el, 'content-type') === 0 ? 1 : -1;
  29112. });
  29113. return $header;
  29114. }
  29115. }
  29116. <?php
  29117. namespace Composer\Util;
  29118. use Composer\Config;
  29119. use Composer\IO\IOInterface;
  29120. class Svn
  29121. {
  29122. const MAX_QTY_AUTH_TRIES = 5;
  29123. protected $credentials;
  29124. protected $hasAuth;
  29125. protected $io;
  29126. protected $url;
  29127. protected $cacheCredentials = true;
  29128. protected $process;
  29129. protected $qtyAuthTries = 0;
  29130. protected $config;
  29131. private static $version;
  29132. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  29133. {
  29134. $this->url = $url;
  29135. $this->io = $io;
  29136. $this->config = $config;
  29137. $this->process = $process ?: new ProcessExecutor($io);
  29138. }
  29139. public static function cleanEnv()
  29140. {
  29141. putenv("DYLD_LIBRARY_PATH");
  29142. unset($_SERVER['DYLD_LIBRARY_PATH']);
  29143. }
  29144. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  29145. {
  29146. $this->config->prohibitUrlByConfig($url, $this->io);
  29147. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  29148. }
  29149. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  29150. {
  29151. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  29152. }
  29153. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  29154. {
  29155. $command = $this->getCommand($svnCommand, $url, $path);
  29156. $output = null;
  29157. $io = $this->io;
  29158. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  29159. if ($type !== 'out') {
  29160. return;
  29161. }
  29162. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  29163. return;
  29164. }
  29165. $output .= $buffer;
  29166. if ($verbose) {
  29167. $io->writeError($buffer, false);
  29168. }
  29169. };
  29170. $status = $this->process->execute($command, $handler, $cwd);
  29171. if (0 === $status) {
  29172. return $output;
  29173. }
  29174. $errorOutput = $this->process->getErrorOutput();
  29175. $fullOutput = implode("\n", array($output, $errorOutput));
  29176. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  29177. && false === stripos($fullOutput, 'authorization failed')
  29178. && false === stripos($fullOutput, 'svn: E170001:')
  29179. && false === stripos($fullOutput, 'svn: E215004:')) {
  29180. throw new \RuntimeException($fullOutput);
  29181. }
  29182. if (!$this->hasAuth()) {
  29183. $this->doAuthDance();
  29184. }
  29185. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  29186. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  29187. }
  29188. throw new \RuntimeException(
  29189. 'wrong credentials provided ('.$fullOutput.')'
  29190. );
  29191. }
  29192. public function setCacheCredentials($cacheCredentials)
  29193. {
  29194. $this->cacheCredentials = $cacheCredentials;
  29195. }
  29196. protected function doAuthDance()
  29197. {
  29198. if (!$this->io->isInteractive()) {
  29199. throw new \RuntimeException(
  29200. 'can not ask for authentication in non interactive mode'
  29201. );
  29202. }
  29203. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  29204. $this->hasAuth = true;
  29205. $this->credentials['username'] = $this->io->ask("Username: ");
  29206. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  29207. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  29208. return $this;
  29209. }
  29210. protected function getCommand($cmd, $url, $path = null)
  29211. {
  29212. $cmd = sprintf(
  29213. '%s %s%s %s',
  29214. $cmd,
  29215. '--non-interactive ',
  29216. $this->getCredentialString(),
  29217. ProcessExecutor::escape($url)
  29218. );
  29219. if ($path) {
  29220. $cmd .= ' ' . ProcessExecutor::escape($path);
  29221. }
  29222. return $cmd;
  29223. }
  29224. protected function getCredentialString()
  29225. {
  29226. if (!$this->hasAuth()) {
  29227. return '';
  29228. }
  29229. return sprintf(
  29230. ' %s--username %s --password %s ',
  29231. $this->getAuthCache(),
  29232. ProcessExecutor::escape($this->getUsername()),
  29233. ProcessExecutor::escape($this->getPassword())
  29234. );
  29235. }
  29236. protected function getPassword()
  29237. {
  29238. if ($this->credentials === null) {
  29239. throw new \LogicException("No svn auth detected.");
  29240. }
  29241. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  29242. }
  29243. protected function getUsername()
  29244. {
  29245. if ($this->credentials === null) {
  29246. throw new \LogicException("No svn auth detected.");
  29247. }
  29248. return $this->credentials['username'];
  29249. }
  29250. protected function hasAuth()
  29251. {
  29252. if (null !== $this->hasAuth) {
  29253. return $this->hasAuth;
  29254. }
  29255. if (false === $this->createAuthFromConfig()) {
  29256. $this->createAuthFromUrl();
  29257. }
  29258. return $this->hasAuth;
  29259. }
  29260. protected function getAuthCache()
  29261. {
  29262. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  29263. }
  29264. private function createAuthFromConfig()
  29265. {
  29266. if (!$this->config->has('http-basic')) {
  29267. return $this->hasAuth = false;
  29268. }
  29269. $authConfig = $this->config->get('http-basic');
  29270. $host = parse_url($this->url, PHP_URL_HOST);
  29271. if (isset($authConfig[$host])) {
  29272. $this->credentials['username'] = $authConfig[$host]['username'];
  29273. $this->credentials['password'] = $authConfig[$host]['password'];
  29274. return $this->hasAuth = true;
  29275. }
  29276. return $this->hasAuth = false;
  29277. }
  29278. private function createAuthFromUrl()
  29279. {
  29280. $uri = parse_url($this->url);
  29281. if (empty($uri['user'])) {
  29282. return $this->hasAuth = false;
  29283. }
  29284. $this->credentials['username'] = $uri['user'];
  29285. if (!empty($uri['pass'])) {
  29286. $this->credentials['password'] = $uri['pass'];
  29287. }
  29288. return $this->hasAuth = true;
  29289. }
  29290. public function binaryVersion()
  29291. {
  29292. if (!self::$version) {
  29293. if (0 === $this->process->execute('svn --version', $output)) {
  29294. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  29295. self::$version = $match[1];
  29296. }
  29297. }
  29298. }
  29299. return self::$version;
  29300. }
  29301. }
  29302. <?php
  29303. namespace Composer\Util;
  29304. use Composer\CaBundle\CaBundle;
  29305. final class TlsHelper
  29306. {
  29307. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  29308. {
  29309. $names = self::getCertificateNames($certificate);
  29310. if (empty($names)) {
  29311. return false;
  29312. }
  29313. $combinedNames = array_merge($names['san'], array($names['cn']));
  29314. $hostname = strtolower($hostname);
  29315. foreach ($combinedNames as $certName) {
  29316. $matcher = self::certNameMatcher($certName);
  29317. if ($matcher && $matcher($hostname)) {
  29318. $cn = $names['cn'];
  29319. return true;
  29320. }
  29321. }
  29322. return false;
  29323. }
  29324. public static function getCertificateNames($certificate)
  29325. {
  29326. if (is_array($certificate)) {
  29327. $info = $certificate;
  29328. } elseif (CaBundle::isOpensslParseSafe()) {
  29329. $info = openssl_x509_parse($certificate, false);
  29330. }
  29331. if (!isset($info['subject']['commonName'])) {
  29332. return null;
  29333. }
  29334. $commonName = strtolower($info['subject']['commonName']);
  29335. $subjectAltNames = array();
  29336. if (isset($info['extensions']['subjectAltName'])) {
  29337. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  29338. $subjectAltNames = array_filter(array_map(function ($name) {
  29339. if (0 === strpos($name, 'DNS:')) {
  29340. return strtolower(ltrim(substr($name, 4)));
  29341. }
  29342. return null;
  29343. }, $subjectAltNames));
  29344. $subjectAltNames = array_values($subjectAltNames);
  29345. }
  29346. return array(
  29347. 'cn' => $commonName,
  29348. 'san' => $subjectAltNames,
  29349. );
  29350. }
  29351. public static function getCertificateFingerprint($certificate)
  29352. {
  29353. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  29354. $pubkeypem = $pubkeydetails['key'];
  29355. $start = '-----BEGIN PUBLIC KEY-----';
  29356. $end = '-----END PUBLIC KEY-----';
  29357. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  29358. $der = base64_decode($pemtrim);
  29359. return sha1($der);
  29360. }
  29361. public static function isOpensslParseSafe()
  29362. {
  29363. return CaBundle::isOpensslParseSafe();
  29364. }
  29365. private static function certNameMatcher($certName)
  29366. {
  29367. $wildcards = substr_count($certName, '*');
  29368. if (0 === $wildcards) {
  29369. return function ($hostname) use ($certName) {
  29370. return $hostname === $certName;
  29371. };
  29372. }
  29373. if (1 === $wildcards) {
  29374. $components = explode('.', $certName);
  29375. if (3 > count($components)) {
  29376. return;
  29377. }
  29378. $firstComponent = $components[0];
  29379. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  29380. return;
  29381. }
  29382. $wildcardRegex = preg_quote($certName);
  29383. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  29384. $wildcardRegex = "{^{$wildcardRegex}$}";
  29385. return function ($hostname) use ($wildcardRegex) {
  29386. return 1 === preg_match($wildcardRegex, $hostname);
  29387. };
  29388. }
  29389. }
  29390. }
  29391. <?php
  29392. namespace Composer\Util;
  29393. use Composer\Config;
  29394. class Url
  29395. {
  29396. public static function updateDistReference(Config $config, $url, $ref)
  29397. {
  29398. $host = parse_url($url, PHP_URL_HOST);
  29399. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  29400. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  29401. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29402. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  29403. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29404. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  29405. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29406. }
  29407. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  29408. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  29409. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  29410. }
  29411. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  29412. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  29413. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  29414. }
  29415. } elseif (in_array($host, $config->get('github-domains'), true)) {
  29416. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  29417. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  29418. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  29419. }
  29420. return $url;
  29421. }
  29422. }
  29423. <?php
  29424. namespace Composer\Util;
  29425. class Zip
  29426. {
  29427. public static function getComposerJson($pathToZip)
  29428. {
  29429. if (!extension_loaded('zip')) {
  29430. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  29431. }
  29432. $zip = new \ZipArchive();
  29433. if ($zip->open($pathToZip) !== true) {
  29434. return null;
  29435. }
  29436. if (0 == $zip->numFiles) {
  29437. $zip->close();
  29438. return null;
  29439. }
  29440. $foundFileIndex = self::locateFile($zip, 'composer.json');
  29441. if (false === $foundFileIndex) {
  29442. $zip->close();
  29443. return null;
  29444. }
  29445. $content = null;
  29446. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  29447. $stream = $zip->getStream($configurationFileName);
  29448. if (false !== $stream) {
  29449. $content = stream_get_contents($stream);
  29450. }
  29451. $zip->close();
  29452. return $content;
  29453. }
  29454. private static function locateFile(\ZipArchive $zip, $filename)
  29455. {
  29456. $indexOfShortestMatch = false;
  29457. $lengthOfShortestMatch = -1;
  29458. for ($i = 0; $i < $zip->numFiles; $i++) {
  29459. $stat = $zip->statIndex($i);
  29460. if (strcmp(basename($stat['name']), $filename) === 0) {
  29461. $directoryName = dirname($stat['name']);
  29462. if ($directoryName === '.') {
  29463. return $i;
  29464. }
  29465. if (strpos($directoryName, '\\') !== false ||
  29466. strpos($directoryName, '/') !== false) {
  29467. continue;
  29468. }
  29469. $length = strlen($stat['name']);
  29470. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  29471. $contents = $zip->getFromIndex($i);
  29472. if ($contents !== false) {
  29473. $indexOfShortestMatch = $i;
  29474. $lengthOfShortestMatch = $length;
  29475. }
  29476. }
  29477. }
  29478. }
  29479. return $indexOfShortestMatch;
  29480. }
  29481. }
  29482. <?php
  29483. namespace Composer;
  29484. use Symfony\Component\Console\Output\OutputInterface;
  29485. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  29486. class XdebugHandler extends XdebugHandler\XdebugHandler
  29487. {
  29488. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  29489. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  29490. public function __construct(OutputInterface $output)
  29491. {
  29492. parent::__construct('composer', '--ansi');
  29493. }
  29494. }
  29495. <?php
  29496. function includeIfExists($file)
  29497. {
  29498. return file_exists($file) ? include $file : false;
  29499. }
  29500. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  29501. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  29502. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  29503. exit(1);
  29504. }
  29505. return $loader;
  29506. <?php
  29507. /*
  29508. * This file is part of Composer.
  29509. *
  29510. * (c) Nils Adermann <naderman@naderman.de>
  29511. * Jordi Boggiano <j.boggiano@seld.be>
  29512. *
  29513. * For the full copyright and license information, please view the LICENSE
  29514. * file that was distributed with this source code.
  29515. */
  29516. namespace Composer\Autoload;
  29517. /**
  29518. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  29519. *
  29520. * $loader = new \Composer\Autoload\ClassLoader();
  29521. *
  29522. * // register classes with namespaces
  29523. * $loader->add('Symfony\Component', __DIR__.'/component');
  29524. * $loader->add('Symfony', __DIR__.'/framework');
  29525. *
  29526. * // activate the autoloader
  29527. * $loader->register();
  29528. *
  29529. * // to enable searching the include path (eg. for PEAR packages)
  29530. * $loader->setUseIncludePath(true);
  29531. *
  29532. * In this example, if you try to use a class in the Symfony\Component
  29533. * namespace or one of its children (Symfony\Component\Console for instance),
  29534. * the autoloader will first look for the class under the component/
  29535. * directory, and it will then fallback to the framework/ directory if not
  29536. * found before giving up.
  29537. *
  29538. * This class is loosely based on the Symfony UniversalClassLoader.
  29539. *
  29540. * @author Fabien Potencier <fabien@symfony.com>
  29541. * @author Jordi Boggiano <j.boggiano@seld.be>
  29542. * @see http://www.php-fig.org/psr/psr-0/
  29543. * @see http://www.php-fig.org/psr/psr-4/
  29544. */
  29545. class ClassLoader
  29546. {
  29547. // PSR-4
  29548. private $prefixLengthsPsr4 = array();
  29549. private $prefixDirsPsr4 = array();
  29550. private $fallbackDirsPsr4 = array();
  29551. // PSR-0
  29552. private $prefixesPsr0 = array();
  29553. private $fallbackDirsPsr0 = array();
  29554. private $useIncludePath = false;
  29555. private $classMap = array();
  29556. private $classMapAuthoritative = false;
  29557. private $missingClasses = array();
  29558. private $apcuPrefix;
  29559. public function getPrefixes()
  29560. {
  29561. if (!empty($this->prefixesPsr0)) {
  29562. return call_user_func_array('array_merge', $this->prefixesPsr0);
  29563. }
  29564. return array();
  29565. }
  29566. public function getPrefixesPsr4()
  29567. {
  29568. return $this->prefixDirsPsr4;
  29569. }
  29570. public function getFallbackDirs()
  29571. {
  29572. return $this->fallbackDirsPsr0;
  29573. }
  29574. public function getFallbackDirsPsr4()
  29575. {
  29576. return $this->fallbackDirsPsr4;
  29577. }
  29578. public function getClassMap()
  29579. {
  29580. return $this->classMap;
  29581. }
  29582. /**
  29583. * @param array $classMap Class to filename map
  29584. */
  29585. public function addClassMap(array $classMap)
  29586. {
  29587. if ($this->classMap) {
  29588. $this->classMap = array_merge($this->classMap, $classMap);
  29589. } else {
  29590. $this->classMap = $classMap;
  29591. }
  29592. }
  29593. /**
  29594. * Registers a set of PSR-0 directories for a given prefix, either
  29595. * appending or prepending to the ones previously set for this prefix.
  29596. *
  29597. * @param string $prefix The prefix
  29598. * @param array|string $paths The PSR-0 root directories
  29599. * @param bool $prepend Whether to prepend the directories
  29600. */
  29601. public function add($prefix, $paths, $prepend = false)
  29602. {
  29603. if (!$prefix) {
  29604. if ($prepend) {
  29605. $this->fallbackDirsPsr0 = array_merge(
  29606. (array) $paths,
  29607. $this->fallbackDirsPsr0
  29608. );
  29609. } else {
  29610. $this->fallbackDirsPsr0 = array_merge(
  29611. $this->fallbackDirsPsr0,
  29612. (array) $paths
  29613. );
  29614. }
  29615. return;
  29616. }
  29617. $first = $prefix[0];
  29618. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  29619. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  29620. return;
  29621. }
  29622. if ($prepend) {
  29623. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29624. (array) $paths,
  29625. $this->prefixesPsr0[$first][$prefix]
  29626. );
  29627. } else {
  29628. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29629. $this->prefixesPsr0[$first][$prefix],
  29630. (array) $paths
  29631. );
  29632. }
  29633. }
  29634. /**
  29635. * Registers a set of PSR-4 directories for a given namespace, either
  29636. * appending or prepending to the ones previously set for this namespace.
  29637. *
  29638. * @param string $prefix The prefix/namespace, with trailing '\\'
  29639. * @param array|string $paths The PSR-4 base directories
  29640. * @param bool $prepend Whether to prepend the directories
  29641. *
  29642. * @throws \InvalidArgumentException
  29643. */
  29644. public function addPsr4($prefix, $paths, $prepend = false)
  29645. {
  29646. if (!$prefix) {
  29647. // Register directories for the root namespace.
  29648. if ($prepend) {
  29649. $this->fallbackDirsPsr4 = array_merge(
  29650. (array) $paths,
  29651. $this->fallbackDirsPsr4
  29652. );
  29653. } else {
  29654. $this->fallbackDirsPsr4 = array_merge(
  29655. $this->fallbackDirsPsr4,
  29656. (array) $paths
  29657. );
  29658. }
  29659. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  29660. // Register directories for a new namespace.
  29661. $length = strlen($prefix);
  29662. if ('\\' !== $prefix[$length - 1]) {
  29663. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29664. }
  29665. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29666. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29667. } elseif ($prepend) {
  29668. // Prepend directories for an already registered namespace.
  29669. $this->prefixDirsPsr4[$prefix] = array_merge(
  29670. (array) $paths,
  29671. $this->prefixDirsPsr4[$prefix]
  29672. );
  29673. } else {
  29674. // Append directories for an already registered namespace.
  29675. $this->prefixDirsPsr4[$prefix] = array_merge(
  29676. $this->prefixDirsPsr4[$prefix],
  29677. (array) $paths
  29678. );
  29679. }
  29680. }
  29681. /**
  29682. * Registers a set of PSR-0 directories for a given prefix,
  29683. * replacing any others previously set for this prefix.
  29684. *
  29685. * @param string $prefix The prefix
  29686. * @param array|string $paths The PSR-0 base directories
  29687. */
  29688. public function set($prefix, $paths)
  29689. {
  29690. if (!$prefix) {
  29691. $this->fallbackDirsPsr0 = (array) $paths;
  29692. } else {
  29693. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  29694. }
  29695. }
  29696. /**
  29697. * Registers a set of PSR-4 directories for a given namespace,
  29698. * replacing any others previously set for this namespace.
  29699. *
  29700. * @param string $prefix The prefix/namespace, with trailing '\\'
  29701. * @param array|string $paths The PSR-4 base directories
  29702. *
  29703. * @throws \InvalidArgumentException
  29704. */
  29705. public function setPsr4($prefix, $paths)
  29706. {
  29707. if (!$prefix) {
  29708. $this->fallbackDirsPsr4 = (array) $paths;
  29709. } else {
  29710. $length = strlen($prefix);
  29711. if ('\\' !== $prefix[$length - 1]) {
  29712. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29713. }
  29714. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29715. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29716. }
  29717. }
  29718. /**
  29719. * Turns on searching the include path for class files.
  29720. *
  29721. * @param bool $useIncludePath
  29722. */
  29723. public function setUseIncludePath($useIncludePath)
  29724. {
  29725. $this->useIncludePath = $useIncludePath;
  29726. }
  29727. /**
  29728. * Can be used to check if the autoloader uses the include path to check
  29729. * for classes.
  29730. *
  29731. * @return bool
  29732. */
  29733. public function getUseIncludePath()
  29734. {
  29735. return $this->useIncludePath;
  29736. }
  29737. /**
  29738. * Turns off searching the prefix and fallback directories for classes
  29739. * that have not been registered with the class map.
  29740. *
  29741. * @param bool $classMapAuthoritative
  29742. */
  29743. public function setClassMapAuthoritative($classMapAuthoritative)
  29744. {
  29745. $this->classMapAuthoritative = $classMapAuthoritative;
  29746. }
  29747. /**
  29748. * Should class lookup fail if not found in the current class map?
  29749. *
  29750. * @return bool
  29751. */
  29752. public function isClassMapAuthoritative()
  29753. {
  29754. return $this->classMapAuthoritative;
  29755. }
  29756. /**
  29757. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  29758. *
  29759. * @param string|null $apcuPrefix
  29760. */
  29761. public function setApcuPrefix($apcuPrefix)
  29762. {
  29763. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  29764. }
  29765. /**
  29766. * The APCu prefix in use, or null if APCu caching is not enabled.
  29767. *
  29768. * @return string|null
  29769. */
  29770. public function getApcuPrefix()
  29771. {
  29772. return $this->apcuPrefix;
  29773. }
  29774. /**
  29775. * Registers this instance as an autoloader.
  29776. *
  29777. * @param bool $prepend Whether to prepend the autoloader or not
  29778. */
  29779. public function register($prepend = false)
  29780. {
  29781. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  29782. }
  29783. /**
  29784. * Unregisters this instance as an autoloader.
  29785. */
  29786. public function unregister()
  29787. {
  29788. spl_autoload_unregister(array($this, 'loadClass'));
  29789. }
  29790. /**
  29791. * Loads the given class or interface.
  29792. *
  29793. * @param string $class The name of the class
  29794. * @return bool|null True if loaded, null otherwise
  29795. */
  29796. public function loadClass($class)
  29797. {
  29798. if ($file = $this->findFile($class)) {
  29799. includeFile($file);
  29800. return true;
  29801. }
  29802. }
  29803. /**
  29804. * Finds the path to the file where the class is defined.
  29805. *
  29806. * @param string $class The name of the class
  29807. *
  29808. * @return string|false The path if found, false otherwise
  29809. */
  29810. public function findFile($class)
  29811. {
  29812. // class map lookup
  29813. if (isset($this->classMap[$class])) {
  29814. return $this->classMap[$class];
  29815. }
  29816. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  29817. return false;
  29818. }
  29819. if (null !== $this->apcuPrefix) {
  29820. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  29821. if ($hit) {
  29822. return $file;
  29823. }
  29824. }
  29825. $file = $this->findFileWithExtension($class, '.php');
  29826. // Search for Hack files if we are running on HHVM
  29827. if (false === $file && defined('HHVM_VERSION')) {
  29828. $file = $this->findFileWithExtension($class, '.hh');
  29829. }
  29830. if (null !== $this->apcuPrefix) {
  29831. apcu_add($this->apcuPrefix.$class, $file);
  29832. }
  29833. if (false === $file) {
  29834. // Remember that this class does not exist.
  29835. $this->missingClasses[$class] = true;
  29836. }
  29837. return $file;
  29838. }
  29839. private function findFileWithExtension($class, $ext)
  29840. {
  29841. // PSR-4 lookup
  29842. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  29843. $first = $class[0];
  29844. if (isset($this->prefixLengthsPsr4[$first])) {
  29845. $subPath = $class;
  29846. while (false !== $lastPos = strrpos($subPath, '\\')) {
  29847. $subPath = substr($subPath, 0, $lastPos);
  29848. $search = $subPath . '\\';
  29849. if (isset($this->prefixDirsPsr4[$search])) {
  29850. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  29851. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  29852. if (file_exists($file = $dir . $pathEnd)) {
  29853. return $file;
  29854. }
  29855. }
  29856. }
  29857. }
  29858. }
  29859. // PSR-4 fallback dirs
  29860. foreach ($this->fallbackDirsPsr4 as $dir) {
  29861. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  29862. return $file;
  29863. }
  29864. }
  29865. // PSR-0 lookup
  29866. if (false !== $pos = strrpos($class, '\\')) {
  29867. // namespaced class name
  29868. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  29869. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  29870. } else {
  29871. // PEAR-like class name
  29872. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  29873. }
  29874. if (isset($this->prefixesPsr0[$first])) {
  29875. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  29876. if (0 === strpos($class, $prefix)) {
  29877. foreach ($dirs as $dir) {
  29878. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29879. return $file;
  29880. }
  29881. }
  29882. }
  29883. }
  29884. }
  29885. // PSR-0 fallback dirs
  29886. foreach ($this->fallbackDirsPsr0 as $dir) {
  29887. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29888. return $file;
  29889. }
  29890. }
  29891. // PSR-0 include paths.
  29892. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  29893. return $file;
  29894. }
  29895. return false;
  29896. }
  29897. }
  29898. /**
  29899. * Scope isolated include.
  29900. *
  29901. * Prevents access to $this/self from included files.
  29902. */
  29903. function includeFile($file)
  29904. {
  29905. include $file;
  29906. }
  29907. {
  29908. "$schema": "http://json-schema.org/draft-04/schema#",
  29909. "description": "A representation of packages metadata.",
  29910. "type": "object",
  29911. "oneOf": [
  29912. { "required": [ "packages" ] },
  29913. { "required": [ "providers" ] },
  29914. { "required": [ "provider-includes", "providers-url" ] }
  29915. ],
  29916. "properties": {
  29917. "packages": {
  29918. "type": ["object", "array"],
  29919. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29920. "additionalProperties": { "$ref": "#/definitions/versions" }
  29921. },
  29922. "providers-url": {
  29923. "type": "string",
  29924. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  29925. },
  29926. "provider-includes": {
  29927. "type": "object",
  29928. "description": "A hashmap of provider listings.",
  29929. "additionalProperties": { "$ref": "#/definitions/provider" }
  29930. },
  29931. "providers": {
  29932. "type": "object",
  29933. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29934. "additionalProperties": { "$ref": "#/definitions/provider" }
  29935. },
  29936. "notify-batch": {
  29937. "type": "string",
  29938. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  29939. },
  29940. "search": {
  29941. "type": "string",
  29942. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  29943. },
  29944. "warning": {
  29945. "type": "string",
  29946. "description": "A message that will be output by Composer as a warning when this source is consulted."
  29947. }
  29948. },
  29949. "definitions": {
  29950. "versions": {
  29951. "type": "object",
  29952. "description": "A hashmap of versions and their metadata.",
  29953. "additionalProperties": { "$ref": "#/definitions/version" }
  29954. },
  29955. "version": {
  29956. "type": "object",
  29957. "oneOf": [
  29958. { "$ref": "#/definitions/package" },
  29959. { "$ref": "#/definitions/metapackage" }
  29960. ]
  29961. },
  29962. "package-base": {
  29963. "properties": {
  29964. "name": { "type": "string" },
  29965. "type": { "type": "string" },
  29966. "version": { "type": "string" },
  29967. "version_normalized": {
  29968. "type": "string",
  29969. "description": "Normalized version, optional but can save computational time on client side."
  29970. },
  29971. "autoload": { "type": "object" },
  29972. "require": { "type": "object" },
  29973. "replace": { "type": "object" },
  29974. "conflict": { "type": "object" },
  29975. "provide": { "type": "object" },
  29976. "time": { "type": "string" }
  29977. },
  29978. "additionalProperties": true
  29979. },
  29980. "package": {
  29981. "allOf": [
  29982. { "$ref": "#/definitions/package-base" },
  29983. {
  29984. "properties": {
  29985. "dist": { "type": "object" },
  29986. "source": { "type": "object" }
  29987. }
  29988. },
  29989. { "oneOf": [
  29990. { "required": [ "name", "version", "source" ] },
  29991. { "required": [ "name", "version", "dist" ] }
  29992. ] }
  29993. ]
  29994. },
  29995. "metapackage": {
  29996. "allOf": [
  29997. { "$ref": "#/definitions/package-base" },
  29998. {
  29999. "properties": {
  30000. "type": { "type": "string", "enum": [ "metapackage" ] }
  30001. },
  30002. "required": [ "name", "version", "type" ]
  30003. }
  30004. ]
  30005. },
  30006. "provider": {
  30007. "type": "object",
  30008. "properties": {
  30009. "sha256": {
  30010. "type": "string",
  30011. "description": "Hash value that can be used to validate the resource."
  30012. }
  30013. }
  30014. }
  30015. }
  30016. }
  30017. {
  30018. "$schema": "http://json-schema.org/draft-04/schema#",
  30019. "name": "Package",
  30020. "type": "object",
  30021. "additionalProperties": false,
  30022. "required": [ "name", "description" ],
  30023. "properties": {
  30024. "name": {
  30025. "type": "string",
  30026. "description": "Package name, including 'vendor-name/' prefix."
  30027. },
  30028. "type": {
  30029. "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.",
  30030. "type": "string",
  30031. "pattern": "^[a-z0-9-]+$"
  30032. },
  30033. "target-dir": {
  30034. "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.",
  30035. "type": "string"
  30036. },
  30037. "description": {
  30038. "type": "string",
  30039. "description": "Short package description."
  30040. },
  30041. "keywords": {
  30042. "type": "array",
  30043. "items": {
  30044. "type": "string",
  30045. "description": "A tag/keyword that this package relates to."
  30046. }
  30047. },
  30048. "homepage": {
  30049. "type": "string",
  30050. "description": "Homepage URL for the project.",
  30051. "format": "uri"
  30052. },
  30053. "readme": {
  30054. "type": "string",
  30055. "description": "Relative path to the readme document."
  30056. },
  30057. "version": {
  30058. "type": "string",
  30059. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  30060. "pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?|^dev-"
  30061. },
  30062. "time": {
  30063. "type": "string",
  30064. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  30065. },
  30066. "license": {
  30067. "type": ["string", "array"],
  30068. "description": "License name. Or an array of license names."
  30069. },
  30070. "authors": {
  30071. "$ref": "#/definitions/authors"
  30072. },
  30073. "require": {
  30074. "type": "object",
  30075. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  30076. "additionalProperties": {
  30077. "type": "string"
  30078. }
  30079. },
  30080. "replace": {
  30081. "type": "object",
  30082. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  30083. "additionalProperties": {
  30084. "type": "string"
  30085. }
  30086. },
  30087. "conflict": {
  30088. "type": "object",
  30089. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  30090. "additionalProperties": {
  30091. "type": "string"
  30092. }
  30093. },
  30094. "provide": {
  30095. "type": "object",
  30096. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  30097. "additionalProperties": {
  30098. "type": "string"
  30099. }
  30100. },
  30101. "require-dev": {
  30102. "type": "object",
  30103. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  30104. "additionalProperties": {
  30105. "type": "string"
  30106. }
  30107. },
  30108. "suggest": {
  30109. "type": "object",
  30110. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  30111. "additionalProperties": {
  30112. "type": "string"
  30113. }
  30114. },
  30115. "config": {
  30116. "type": "object",
  30117. "description": "Composer options.",
  30118. "properties": {
  30119. "process-timeout": {
  30120. "type": "integer",
  30121. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  30122. },
  30123. "use-include-path": {
  30124. "type": "boolean",
  30125. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  30126. },
  30127. "preferred-install": {
  30128. "type": ["string", "object"],
  30129. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  30130. },
  30131. "notify-on-install": {
  30132. "type": "boolean",
  30133. "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."
  30134. },
  30135. "github-protocols": {
  30136. "type": "array",
  30137. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  30138. "items": {
  30139. "type": "string"
  30140. }
  30141. },
  30142. "github-oauth": {
  30143. "type": "object",
  30144. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  30145. "additionalProperties": {
  30146. "type": "string"
  30147. }
  30148. },
  30149. "gitlab-oauth": {
  30150. "type": "object",
  30151. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30152. "additionalProperties": {
  30153. "type": "string"
  30154. }
  30155. },
  30156. "gitlab-token": {
  30157. "type": "object",
  30158. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30159. "additionalProperties": {
  30160. "type": "string"
  30161. }
  30162. },
  30163. "bearer": {
  30164. "type": "object",
  30165. "description": "A hash of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  30166. "additionalProperties": {
  30167. "type": "string"
  30168. }
  30169. },
  30170. "disable-tls": {
  30171. "type": "boolean",
  30172. "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."
  30173. },
  30174. "secure-http": {
  30175. "type": "boolean",
  30176. "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."
  30177. },
  30178. "cafile": {
  30179. "type": "string",
  30180. "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."
  30181. },
  30182. "capath": {
  30183. "type": "string",
  30184. "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."
  30185. },
  30186. "http-basic": {
  30187. "type": "object",
  30188. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  30189. "additionalProperties": {
  30190. "type": "object",
  30191. "required": ["username", "password"],
  30192. "properties": {
  30193. "username": {
  30194. "type": "string",
  30195. "description": "The username used for HTTP Basic authentication"
  30196. },
  30197. "password": {
  30198. "type": "string",
  30199. "description": "The password used for HTTP Basic authentication"
  30200. }
  30201. }
  30202. }
  30203. },
  30204. "store-auths": {
  30205. "type": ["string", "boolean"],
  30206. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  30207. },
  30208. "platform": {
  30209. "type": "object",
  30210. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  30211. "additionalProperties": {
  30212. "type": "string"
  30213. }
  30214. },
  30215. "vendor-dir": {
  30216. "type": "string",
  30217. "description": "The location where all packages are installed, defaults to \"vendor\"."
  30218. },
  30219. "bin-dir": {
  30220. "type": "string",
  30221. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  30222. },
  30223. "data-dir": {
  30224. "type": "string",
  30225. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  30226. },
  30227. "cache-dir": {
  30228. "type": "string",
  30229. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  30230. },
  30231. "cache-files-dir": {
  30232. "type": "string",
  30233. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  30234. },
  30235. "cache-repo-dir": {
  30236. "type": "string",
  30237. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  30238. },
  30239. "cache-vcs-dir": {
  30240. "type": "string",
  30241. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  30242. },
  30243. "cache-ttl": {
  30244. "type": "integer",
  30245. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  30246. },
  30247. "cache-files-ttl": {
  30248. "type": "integer",
  30249. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  30250. },
  30251. "cache-files-maxsize": {
  30252. "type": ["string", "integer"],
  30253. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  30254. },
  30255. "bin-compat": {
  30256. "enum": ["auto", "full"],
  30257. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  30258. },
  30259. "discard-changes": {
  30260. "type": ["string", "boolean"],
  30261. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  30262. },
  30263. "autoloader-suffix": {
  30264. "type": "string",
  30265. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  30266. },
  30267. "optimize-autoloader": {
  30268. "type": "boolean",
  30269. "description": "Always optimize when dumping the autoloader."
  30270. },
  30271. "prepend-autoloader": {
  30272. "type": "boolean",
  30273. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  30274. },
  30275. "classmap-authoritative": {
  30276. "type": "boolean",
  30277. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  30278. },
  30279. "apcu-autoloader": {
  30280. "type": "boolean",
  30281. "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."
  30282. },
  30283. "github-domains": {
  30284. "type": "array",
  30285. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  30286. "items": {
  30287. "type": "string"
  30288. }
  30289. },
  30290. "github-expose-hostname": {
  30291. "type": "boolean",
  30292. "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."
  30293. },
  30294. "gitlab-domains": {
  30295. "type": "array",
  30296. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  30297. "items": {
  30298. "type": "string"
  30299. }
  30300. },
  30301. "use-github-api": {
  30302. "type": "boolean",
  30303. "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."
  30304. },
  30305. "archive-format": {
  30306. "type": "string",
  30307. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  30308. },
  30309. "archive-dir": {
  30310. "type": "string",
  30311. "description": "The default archive path when not provided on cli, defaults to \".\"."
  30312. },
  30313. "htaccess-protect": {
  30314. "type": "boolean",
  30315. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  30316. },
  30317. "sort-packages": {
  30318. "type": "boolean",
  30319. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  30320. },
  30321. "lock": {
  30322. "type": "boolean",
  30323. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  30324. }
  30325. }
  30326. },
  30327. "extra": {
  30328. "type": ["object", "array"],
  30329. "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.",
  30330. "additionalProperties": true
  30331. },
  30332. "autoload": {
  30333. "$ref": "#/definitions/autoload"
  30334. },
  30335. "autoload-dev": {
  30336. "type": "object",
  30337. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  30338. "properties": {
  30339. "psr-0": {
  30340. "type": "object",
  30341. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  30342. "additionalProperties": {
  30343. "type": ["string", "array"],
  30344. "items": {
  30345. "type": "string"
  30346. }
  30347. }
  30348. },
  30349. "psr-4": {
  30350. "type": "object",
  30351. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  30352. "additionalProperties": {
  30353. "type": ["string", "array"],
  30354. "items": {
  30355. "type": "string"
  30356. }
  30357. }
  30358. },
  30359. "classmap": {
  30360. "type": "array",
  30361. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30362. },
  30363. "files": {
  30364. "type": "array",
  30365. "description": "This is an array of files that are always required on every request."
  30366. }
  30367. }
  30368. },
  30369. "archive": {
  30370. "type": ["object"],
  30371. "description": "Options for creating package archives for distribution.",
  30372. "properties": {
  30373. "exclude": {
  30374. "type": "array",
  30375. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  30376. }
  30377. }
  30378. },
  30379. "repositories": {
  30380. "type": ["object", "array"],
  30381. "description": "A set of additional repositories where packages can be found.",
  30382. "additionalProperties": {
  30383. "oneOf": [
  30384. { "$ref": "#/definitions/repository" },
  30385. { "type": "boolean", "enum": [false] }
  30386. ]
  30387. },
  30388. "items": {
  30389. "oneOf": [
  30390. { "$ref": "#/definitions/repository" },
  30391. {
  30392. "type": "object",
  30393. "additionalProperties": { "type": "boolean", "enum": [false] },
  30394. "minProperties": 1,
  30395. "maxProperties": 1
  30396. }
  30397. ]
  30398. }
  30399. },
  30400. "minimum-stability": {
  30401. "type": ["string"],
  30402. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  30403. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  30404. },
  30405. "prefer-stable": {
  30406. "type": ["boolean"],
  30407. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  30408. },
  30409. "bin": {
  30410. "type": ["string", "array"],
  30411. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30412. "items": {
  30413. "type": "string"
  30414. }
  30415. },
  30416. "include-path": {
  30417. "type": ["array"],
  30418. "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.",
  30419. "items": {
  30420. "type": "string"
  30421. }
  30422. },
  30423. "scripts": {
  30424. "type": ["object"],
  30425. "description": "Script listeners that will be executed before/after some events.",
  30426. "properties": {
  30427. "pre-install-cmd": {
  30428. "type": ["array", "string"],
  30429. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  30430. },
  30431. "post-install-cmd": {
  30432. "type": ["array", "string"],
  30433. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  30434. },
  30435. "pre-update-cmd": {
  30436. "type": ["array", "string"],
  30437. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  30438. },
  30439. "post-update-cmd": {
  30440. "type": ["array", "string"],
  30441. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  30442. },
  30443. "pre-status-cmd": {
  30444. "type": ["array", "string"],
  30445. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  30446. },
  30447. "post-status-cmd": {
  30448. "type": ["array", "string"],
  30449. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  30450. },
  30451. "pre-package-install": {
  30452. "type": ["array", "string"],
  30453. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  30454. },
  30455. "post-package-install": {
  30456. "type": ["array", "string"],
  30457. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  30458. },
  30459. "pre-package-update": {
  30460. "type": ["array", "string"],
  30461. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  30462. },
  30463. "post-package-update": {
  30464. "type": ["array", "string"],
  30465. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  30466. },
  30467. "pre-package-uninstall": {
  30468. "type": ["array", "string"],
  30469. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30470. },
  30471. "post-package-uninstall": {
  30472. "type": ["array", "string"],
  30473. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30474. },
  30475. "pre-autoload-dump": {
  30476. "type": ["array", "string"],
  30477. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30478. },
  30479. "post-autoload-dump": {
  30480. "type": ["array", "string"],
  30481. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30482. },
  30483. "post-root-package-install": {
  30484. "type": ["array", "string"],
  30485. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  30486. },
  30487. "post-create-project-cmd": {
  30488. "type": ["array", "string"],
  30489. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  30490. }
  30491. }
  30492. },
  30493. "scripts-descriptions": {
  30494. "type": ["object"],
  30495. "description": "Descriptions for custom commands, shown in console help.",
  30496. "additionalProperties": {
  30497. "type": "string"
  30498. }
  30499. },
  30500. "support": {
  30501. "type": "object",
  30502. "properties": {
  30503. "email": {
  30504. "type": "string",
  30505. "description": "Email address for support.",
  30506. "format": "email"
  30507. },
  30508. "issues": {
  30509. "type": "string",
  30510. "description": "URL to the issue tracker.",
  30511. "format": "uri"
  30512. },
  30513. "forum": {
  30514. "type": "string",
  30515. "description": "URL to the forum.",
  30516. "format": "uri"
  30517. },
  30518. "wiki": {
  30519. "type": "string",
  30520. "description": "URL to the wiki.",
  30521. "format": "uri"
  30522. },
  30523. "irc": {
  30524. "type": "string",
  30525. "description": "IRC channel for support, as irc://server/channel.",
  30526. "format": "uri"
  30527. },
  30528. "chat": {
  30529. "type": "string",
  30530. "description": "URL to the support chat.",
  30531. "format": "uri"
  30532. },
  30533. "source": {
  30534. "type": "string",
  30535. "description": "URL to browse or download the sources.",
  30536. "format": "uri"
  30537. },
  30538. "docs": {
  30539. "type": "string",
  30540. "description": "URL to the documentation.",
  30541. "format": "uri"
  30542. },
  30543. "rss": {
  30544. "type": "string",
  30545. "description": "URL to the RSS feed.",
  30546. "format": "uri"
  30547. }
  30548. }
  30549. },
  30550. "funding": {
  30551. "type": "array",
  30552. "description": "A list of options to fund the development and maintenance of the package.",
  30553. "items": {
  30554. "type": "object",
  30555. "properties": {
  30556. "type": {
  30557. "type": "string",
  30558. "description": "Type of funding or platform through which funding is possible."
  30559. },
  30560. "url": {
  30561. "type": "string",
  30562. "description": "URL to a website with details on funding and a way to fund the package.",
  30563. "format": "uri"
  30564. }
  30565. }
  30566. }
  30567. },
  30568. "non-feature-branches": {
  30569. "type": ["array"],
  30570. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  30571. "items": {
  30572. "type": "string"
  30573. }
  30574. },
  30575. "abandoned": {
  30576. "type": ["boolean", "string"],
  30577. "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."
  30578. },
  30579. "_comment": {
  30580. "type": ["array", "string"],
  30581. "description": "A key to store comments in"
  30582. }
  30583. },
  30584. "definitions": {
  30585. "authors": {
  30586. "type": "array",
  30587. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  30588. "items": {
  30589. "type": "object",
  30590. "additionalProperties": false,
  30591. "required": [ "name"],
  30592. "properties": {
  30593. "name": {
  30594. "type": "string",
  30595. "description": "Full name of the author."
  30596. },
  30597. "email": {
  30598. "type": "string",
  30599. "description": "Email address of the author.",
  30600. "format": "email"
  30601. },
  30602. "homepage": {
  30603. "type": "string",
  30604. "description": "Homepage URL for the author.",
  30605. "format": "uri"
  30606. },
  30607. "role": {
  30608. "type": "string",
  30609. "description": "Author's role in the project."
  30610. }
  30611. }
  30612. }
  30613. },
  30614. "autoload": {
  30615. "type": "object",
  30616. "description": "Description of how the package can be autoloaded.",
  30617. "properties": {
  30618. "psr-0": {
  30619. "type": "object",
  30620. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  30621. "additionalProperties": {
  30622. "type": ["string", "array"],
  30623. "items": {
  30624. "type": "string"
  30625. }
  30626. }
  30627. },
  30628. "psr-4": {
  30629. "type": "object",
  30630. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  30631. "additionalProperties": {
  30632. "type": ["string", "array"],
  30633. "items": {
  30634. "type": "string"
  30635. }
  30636. }
  30637. },
  30638. "classmap": {
  30639. "type": "array",
  30640. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30641. },
  30642. "files": {
  30643. "type": "array",
  30644. "description": "This is an array of files that are always required on every request."
  30645. },
  30646. "exclude-from-classmap": {
  30647. "type": "array",
  30648. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  30649. }
  30650. }
  30651. },
  30652. "repository": {
  30653. "type": "object",
  30654. "oneOf": [
  30655. { "$ref": "#/definitions/composer-repository" },
  30656. { "$ref": "#/definitions/vcs-repository" },
  30657. { "$ref": "#/definitions/path-repository" },
  30658. { "$ref": "#/definitions/artifact-repository" },
  30659. { "$ref": "#/definitions/pear-repository" },
  30660. { "$ref": "#/definitions/package-repository" }
  30661. ]
  30662. },
  30663. "composer-repository": {
  30664. "type": "object",
  30665. "required": ["type", "url"],
  30666. "properties": {
  30667. "type": { "type": "string", "enum": ["composer"] },
  30668. "url": { "type": "string" },
  30669. "options": {
  30670. "type": "object",
  30671. "additionalProperties": true
  30672. },
  30673. "allow_ssl_downgrade": { "type": "boolean" },
  30674. "force-lazy-providers": { "type": "boolean" }
  30675. }
  30676. },
  30677. "vcs-repository": {
  30678. "type": "object",
  30679. "required": ["type", "url"],
  30680. "properties": {
  30681. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  30682. "url": { "type": "string" },
  30683. "no-api": { "type": "boolean" },
  30684. "secure-http": { "type": "boolean" },
  30685. "svn-cache-credentials": { "type": "boolean" },
  30686. "trunk-path": { "type": ["string", "boolean"] },
  30687. "branches-path": { "type": ["string", "boolean"] },
  30688. "tags-path": { "type": ["string", "boolean"] },
  30689. "package-path": { "type": "string" },
  30690. "depot": { "type": "string" },
  30691. "branch": { "type": "string" },
  30692. "unique_perforce_client_name": { "type": "string" },
  30693. "p4user": { "type": "string" },
  30694. "p4password": { "type": "string" }
  30695. }
  30696. },
  30697. "path-repository": {
  30698. "type": "object",
  30699. "required": ["type", "url"],
  30700. "properties": {
  30701. "type": { "type": "string", "enum": ["path"] },
  30702. "url": { "type": "string" },
  30703. "options": {
  30704. "type": "object",
  30705. "properties": {
  30706. "symlink": { "type": ["boolean", "null"] }
  30707. },
  30708. "additionalProperties": true
  30709. }
  30710. }
  30711. },
  30712. "artifact-repository": {
  30713. "type": "object",
  30714. "required": ["type", "url"],
  30715. "properties": {
  30716. "type": { "type": "string", "enum": ["artifact"] },
  30717. "url": { "type": "string" }
  30718. }
  30719. },
  30720. "pear-repository": {
  30721. "type": "object",
  30722. "required": ["type", "url"],
  30723. "properties": {
  30724. "type": { "type": "string", "enum": ["pear"] },
  30725. "url": { "type": "string" },
  30726. "vendor-alias": { "type": "string" }
  30727. }
  30728. },
  30729. "package-repository": {
  30730. "type": "object",
  30731. "required": ["type", "package"],
  30732. "properties": {
  30733. "type": { "type": "string", "enum": ["package"] },
  30734. "package": {
  30735. "oneOf": [
  30736. { "$ref": "#/definitions/inline-package" },
  30737. {
  30738. "type": "array",
  30739. "items": { "$ref": "#/definitions/inline-package" }
  30740. }
  30741. ]
  30742. }
  30743. }
  30744. },
  30745. "inline-package": {
  30746. "type": "object",
  30747. "required": ["name", "version"],
  30748. "properties": {
  30749. "name": {
  30750. "type": "string",
  30751. "description": "Package name, including 'vendor-name/' prefix."
  30752. },
  30753. "type": {
  30754. "type": "string"
  30755. },
  30756. "target-dir": {
  30757. "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.",
  30758. "type": "string"
  30759. },
  30760. "description": {
  30761. "type": "string"
  30762. },
  30763. "keywords": {
  30764. "type": "array",
  30765. "items": {
  30766. "type": "string"
  30767. }
  30768. },
  30769. "homepage": {
  30770. "type": "string",
  30771. "format": "uri"
  30772. },
  30773. "version": {
  30774. "type": "string"
  30775. },
  30776. "time": {
  30777. "type": "string"
  30778. },
  30779. "license": {
  30780. "type": [
  30781. "string",
  30782. "array"
  30783. ]
  30784. },
  30785. "authors": {
  30786. "$ref": "#/definitions/authors"
  30787. },
  30788. "require": {
  30789. "type": "object",
  30790. "additionalProperties": {
  30791. "type": "string"
  30792. }
  30793. },
  30794. "replace": {
  30795. "type": "object",
  30796. "additionalProperties": {
  30797. "type": "string"
  30798. }
  30799. },
  30800. "conflict": {
  30801. "type": "object",
  30802. "additionalProperties": {
  30803. "type": "string"
  30804. }
  30805. },
  30806. "provide": {
  30807. "type": "object",
  30808. "additionalProperties": {
  30809. "type": "string"
  30810. }
  30811. },
  30812. "require-dev": {
  30813. "type": "object",
  30814. "additionalProperties": {
  30815. "type": "string"
  30816. }
  30817. },
  30818. "suggest": {
  30819. "type": "object",
  30820. "additionalProperties": {
  30821. "type": "string"
  30822. }
  30823. },
  30824. "extra": {
  30825. "type": ["object", "array"],
  30826. "additionalProperties": true
  30827. },
  30828. "autoload": {
  30829. "$ref": "#/definitions/autoload"
  30830. },
  30831. "archive": {
  30832. "type": ["object"],
  30833. "properties": {
  30834. "exclude": {
  30835. "type": "array"
  30836. }
  30837. }
  30838. },
  30839. "bin": {
  30840. "type": ["string", "array"],
  30841. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30842. "items": {
  30843. "type": "string"
  30844. }
  30845. },
  30846. "include-path": {
  30847. "type": ["array"],
  30848. "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.",
  30849. "items": {
  30850. "type": "string"
  30851. }
  30852. },
  30853. "source": {
  30854. "type": "object",
  30855. "required": ["type", "url", "reference"],
  30856. "properties": {
  30857. "type": {
  30858. "type": "string"
  30859. },
  30860. "url": {
  30861. "type": "string"
  30862. },
  30863. "reference": {
  30864. "type": "string"
  30865. },
  30866. "mirrors": {
  30867. "type": "array"
  30868. }
  30869. }
  30870. },
  30871. "dist": {
  30872. "type": "object",
  30873. "required": ["type", "url"],
  30874. "properties": {
  30875. "type": {
  30876. "type": "string"
  30877. },
  30878. "url": {
  30879. "type": "string"
  30880. },
  30881. "reference": {
  30882. "type": "string"
  30883. },
  30884. "shasum": {
  30885. "type": "string"
  30886. },
  30887. "mirrors": {
  30888. "type": "array"
  30889. }
  30890. }
  30891. }
  30892. },
  30893. "additionalProperties": true
  30894. }
  30895. }
  30896. }
  30897. {
  30898. "389-exception": [
  30899. "389 Directory Server Exception"
  30900. ],
  30901. "Autoconf-exception-2.0": [
  30902. "Autoconf exception 2.0"
  30903. ],
  30904. "Autoconf-exception-3.0": [
  30905. "Autoconf exception 3.0"
  30906. ],
  30907. "Bison-exception-2.2": [
  30908. "Bison exception 2.2"
  30909. ],
  30910. "Bootloader-exception": [
  30911. "Bootloader Distribution Exception"
  30912. ],
  30913. "Classpath-exception-2.0": [
  30914. "Classpath exception 2.0"
  30915. ],
  30916. "CLISP-exception-2.0": [
  30917. "CLISP exception 2.0"
  30918. ],
  30919. "DigiRule-FOSS-exception": [
  30920. "DigiRule FOSS License Exception"
  30921. ],
  30922. "eCos-exception-2.0": [
  30923. "eCos exception 2.0"
  30924. ],
  30925. "Fawkes-Runtime-exception": [
  30926. "Fawkes Runtime Exception"
  30927. ],
  30928. "FLTK-exception": [
  30929. "FLTK exception"
  30930. ],
  30931. "Font-exception-2.0": [
  30932. "Font exception 2.0"
  30933. ],
  30934. "freertos-exception-2.0": [
  30935. "FreeRTOS Exception 2.0"
  30936. ],
  30937. "GCC-exception-2.0": [
  30938. "GCC Runtime Library exception 2.0"
  30939. ],
  30940. "GCC-exception-3.1": [
  30941. "GCC Runtime Library exception 3.1"
  30942. ],
  30943. "gnu-javamail-exception": [
  30944. "GNU JavaMail exception"
  30945. ],
  30946. "GPL-3.0-linking-exception": [
  30947. "GPL-3.0 Linking Exception"
  30948. ],
  30949. "GPL-3.0-linking-source-exception": [
  30950. "GPL-3.0 Linking Exception (with Corresponding Source)"
  30951. ],
  30952. "GPL-CC-1.0": [
  30953. "GPL Cooperation Commitment 1.0"
  30954. ],
  30955. "i2p-gpl-java-exception": [
  30956. "i2p GPL+Java Exception"
  30957. ],
  30958. "LGPL-3.0-linking-exception": [
  30959. "LGPL-3.0 Linking Exception"
  30960. ],
  30961. "Libtool-exception": [
  30962. "Libtool Exception"
  30963. ],
  30964. "Linux-syscall-note": [
  30965. "Linux Syscall Note"
  30966. ],
  30967. "LLVM-exception": [
  30968. "LLVM Exception"
  30969. ],
  30970. "LZMA-exception": [
  30971. "LZMA exception"
  30972. ],
  30973. "mif-exception": [
  30974. "Macros and Inline Functions Exception"
  30975. ],
  30976. "Nokia-Qt-exception-1.1": [
  30977. "Nokia Qt LGPL exception 1.1"
  30978. ],
  30979. "OCaml-LGPL-linking-exception": [
  30980. "OCaml LGPL Linking Exception"
  30981. ],
  30982. "OCCT-exception-1.0": [
  30983. "Open CASCADE Exception 1.0"
  30984. ],
  30985. "OpenJDK-assembly-exception-1.0": [
  30986. "OpenJDK Assembly exception 1.0"
  30987. ],
  30988. "openvpn-openssl-exception": [
  30989. "OpenVPN OpenSSL Exception"
  30990. ],
  30991. "PS-or-PDF-font-exception-20170817": [
  30992. "PS/PDF font exception (2017-08-17)"
  30993. ],
  30994. "Qt-GPL-exception-1.0": [
  30995. "Qt GPL exception 1.0"
  30996. ],
  30997. "Qt-LGPL-exception-1.1": [
  30998. "Qt LGPL exception 1.1"
  30999. ],
  31000. "Qwt-exception-1.0": [
  31001. "Qwt exception 1.0"
  31002. ],
  31003. "SHL-2.0": [
  31004. "Solderpad Hardware License v2.0"
  31005. ],
  31006. "SHL-2.1": [
  31007. "Solderpad Hardware License v2.1"
  31008. ],
  31009. "Swift-exception": [
  31010. "Swift Exception"
  31011. ],
  31012. "u-boot-exception-2.0": [
  31013. "U-Boot exception 2.0"
  31014. ],
  31015. "Universal-FOSS-exception-1.0": [
  31016. "Universal FOSS Exception, Version 1.0"
  31017. ],
  31018. "WxWindows-exception-3.1": [
  31019. "WxWindows Library Exception 3.1"
  31020. ]
  31021. }{
  31022. "0BSD": [
  31023. "BSD Zero Clause License",
  31024. true,
  31025. false
  31026. ],
  31027. "AAL": [
  31028. "Attribution Assurance License",
  31029. true,
  31030. false
  31031. ],
  31032. "Abstyles": [
  31033. "Abstyles License",
  31034. false,
  31035. false
  31036. ],
  31037. "Adobe-2006": [
  31038. "Adobe Systems Incorporated Source Code License Agreement",
  31039. false,
  31040. false
  31041. ],
  31042. "Adobe-Glyph": [
  31043. "Adobe Glyph List License",
  31044. false,
  31045. false
  31046. ],
  31047. "ADSL": [
  31048. "Amazon Digital Services License",
  31049. false,
  31050. false
  31051. ],
  31052. "AFL-1.1": [
  31053. "Academic Free License v1.1",
  31054. true,
  31055. false
  31056. ],
  31057. "AFL-1.2": [
  31058. "Academic Free License v1.2",
  31059. true,
  31060. false
  31061. ],
  31062. "AFL-2.0": [
  31063. "Academic Free License v2.0",
  31064. true,
  31065. false
  31066. ],
  31067. "AFL-2.1": [
  31068. "Academic Free License v2.1",
  31069. true,
  31070. false
  31071. ],
  31072. "AFL-3.0": [
  31073. "Academic Free License v3.0",
  31074. true,
  31075. false
  31076. ],
  31077. "Afmparse": [
  31078. "Afmparse License",
  31079. false,
  31080. false
  31081. ],
  31082. "AGPL-1.0": [
  31083. "Affero General Public License v1.0",
  31084. false,
  31085. true
  31086. ],
  31087. "AGPL-1.0-only": [
  31088. "Affero General Public License v1.0 only",
  31089. false,
  31090. false
  31091. ],
  31092. "AGPL-1.0-or-later": [
  31093. "Affero General Public License v1.0 or later",
  31094. false,
  31095. false
  31096. ],
  31097. "AGPL-3.0": [
  31098. "GNU Affero General Public License v3.0",
  31099. true,
  31100. true
  31101. ],
  31102. "AGPL-3.0-only": [
  31103. "GNU Affero General Public License v3.0 only",
  31104. true,
  31105. false
  31106. ],
  31107. "AGPL-3.0-or-later": [
  31108. "GNU Affero General Public License v3.0 or later",
  31109. true,
  31110. false
  31111. ],
  31112. "Aladdin": [
  31113. "Aladdin Free Public License",
  31114. false,
  31115. false
  31116. ],
  31117. "AMDPLPA": [
  31118. "AMD's plpa_map.c License",
  31119. false,
  31120. false
  31121. ],
  31122. "AML": [
  31123. "Apple MIT License",
  31124. false,
  31125. false
  31126. ],
  31127. "AMPAS": [
  31128. "Academy of Motion Picture Arts and Sciences BSD",
  31129. false,
  31130. false
  31131. ],
  31132. "ANTLR-PD": [
  31133. "ANTLR Software Rights Notice",
  31134. false,
  31135. false
  31136. ],
  31137. "Apache-1.0": [
  31138. "Apache License 1.0",
  31139. false,
  31140. false
  31141. ],
  31142. "Apache-1.1": [
  31143. "Apache License 1.1",
  31144. true,
  31145. false
  31146. ],
  31147. "Apache-2.0": [
  31148. "Apache License 2.0",
  31149. true,
  31150. false
  31151. ],
  31152. "APAFML": [
  31153. "Adobe Postscript AFM License",
  31154. false,
  31155. false
  31156. ],
  31157. "APL-1.0": [
  31158. "Adaptive Public License 1.0",
  31159. true,
  31160. false
  31161. ],
  31162. "APSL-1.0": [
  31163. "Apple Public Source License 1.0",
  31164. true,
  31165. false
  31166. ],
  31167. "APSL-1.1": [
  31168. "Apple Public Source License 1.1",
  31169. true,
  31170. false
  31171. ],
  31172. "APSL-1.2": [
  31173. "Apple Public Source License 1.2",
  31174. true,
  31175. false
  31176. ],
  31177. "APSL-2.0": [
  31178. "Apple Public Source License 2.0",
  31179. true,
  31180. false
  31181. ],
  31182. "Artistic-1.0": [
  31183. "Artistic License 1.0",
  31184. true,
  31185. false
  31186. ],
  31187. "Artistic-1.0-cl8": [
  31188. "Artistic License 1.0 w/clause 8",
  31189. true,
  31190. false
  31191. ],
  31192. "Artistic-1.0-Perl": [
  31193. "Artistic License 1.0 (Perl)",
  31194. true,
  31195. false
  31196. ],
  31197. "Artistic-2.0": [
  31198. "Artistic License 2.0",
  31199. true,
  31200. false
  31201. ],
  31202. "Bahyph": [
  31203. "Bahyph License",
  31204. false,
  31205. false
  31206. ],
  31207. "Barr": [
  31208. "Barr License",
  31209. false,
  31210. false
  31211. ],
  31212. "Beerware": [
  31213. "Beerware License",
  31214. false,
  31215. false
  31216. ],
  31217. "BitTorrent-1.0": [
  31218. "BitTorrent Open Source License v1.0",
  31219. false,
  31220. false
  31221. ],
  31222. "BitTorrent-1.1": [
  31223. "BitTorrent Open Source License v1.1",
  31224. false,
  31225. false
  31226. ],
  31227. "blessing": [
  31228. "SQLite Blessing",
  31229. false,
  31230. false
  31231. ],
  31232. "BlueOak-1.0.0": [
  31233. "Blue Oak Model License 1.0.0",
  31234. false,
  31235. false
  31236. ],
  31237. "Borceux": [
  31238. "Borceux license",
  31239. false,
  31240. false
  31241. ],
  31242. "BSD-1-Clause": [
  31243. "BSD 1-Clause License",
  31244. true,
  31245. false
  31246. ],
  31247. "BSD-2-Clause": [
  31248. "BSD 2-Clause \"Simplified\" License",
  31249. true,
  31250. false
  31251. ],
  31252. "BSD-2-Clause-FreeBSD": [
  31253. "BSD 2-Clause FreeBSD License",
  31254. false,
  31255. false
  31256. ],
  31257. "BSD-2-Clause-NetBSD": [
  31258. "BSD 2-Clause NetBSD License",
  31259. false,
  31260. true
  31261. ],
  31262. "BSD-2-Clause-Patent": [
  31263. "BSD-2-Clause Plus Patent License",
  31264. true,
  31265. false
  31266. ],
  31267. "BSD-3-Clause": [
  31268. "BSD 3-Clause \"New\" or \"Revised\" License",
  31269. true,
  31270. false
  31271. ],
  31272. "BSD-3-Clause-Attribution": [
  31273. "BSD with attribution",
  31274. false,
  31275. false
  31276. ],
  31277. "BSD-3-Clause-Clear": [
  31278. "BSD 3-Clause Clear License",
  31279. false,
  31280. false
  31281. ],
  31282. "BSD-3-Clause-LBNL": [
  31283. "Lawrence Berkeley National Labs BSD variant license",
  31284. true,
  31285. false
  31286. ],
  31287. "BSD-3-Clause-No-Nuclear-License": [
  31288. "BSD 3-Clause No Nuclear License",
  31289. false,
  31290. false
  31291. ],
  31292. "BSD-3-Clause-No-Nuclear-License-2014": [
  31293. "BSD 3-Clause No Nuclear License 2014",
  31294. false,
  31295. false
  31296. ],
  31297. "BSD-3-Clause-No-Nuclear-Warranty": [
  31298. "BSD 3-Clause No Nuclear Warranty",
  31299. false,
  31300. false
  31301. ],
  31302. "BSD-3-Clause-Open-MPI": [
  31303. "BSD 3-Clause Open MPI variant",
  31304. false,
  31305. false
  31306. ],
  31307. "BSD-4-Clause": [
  31308. "BSD 4-Clause \"Original\" or \"Old\" License",
  31309. false,
  31310. false
  31311. ],
  31312. "BSD-4-Clause-UC": [
  31313. "BSD-4-Clause (University of California-Specific)",
  31314. false,
  31315. false
  31316. ],
  31317. "BSD-Protection": [
  31318. "BSD Protection License",
  31319. false,
  31320. false
  31321. ],
  31322. "BSD-Source-Code": [
  31323. "BSD Source Code Attribution",
  31324. false,
  31325. false
  31326. ],
  31327. "BSL-1.0": [
  31328. "Boost Software License 1.0",
  31329. true,
  31330. false
  31331. ],
  31332. "bzip2-1.0.5": [
  31333. "bzip2 and libbzip2 License v1.0.5",
  31334. false,
  31335. false
  31336. ],
  31337. "bzip2-1.0.6": [
  31338. "bzip2 and libbzip2 License v1.0.6",
  31339. false,
  31340. false
  31341. ],
  31342. "CAL-1.0": [
  31343. "Cryptographic Autonomy License 1.0",
  31344. true,
  31345. false
  31346. ],
  31347. "CAL-1.0-Combined-Work-Exception": [
  31348. "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
  31349. true,
  31350. false
  31351. ],
  31352. "Caldera": [
  31353. "Caldera License",
  31354. false,
  31355. false
  31356. ],
  31357. "CATOSL-1.1": [
  31358. "Computer Associates Trusted Open Source License 1.1",
  31359. true,
  31360. false
  31361. ],
  31362. "CC-BY-1.0": [
  31363. "Creative Commons Attribution 1.0 Generic",
  31364. false,
  31365. false
  31366. ],
  31367. "CC-BY-2.0": [
  31368. "Creative Commons Attribution 2.0 Generic",
  31369. false,
  31370. false
  31371. ],
  31372. "CC-BY-2.5": [
  31373. "Creative Commons Attribution 2.5 Generic",
  31374. false,
  31375. false
  31376. ],
  31377. "CC-BY-3.0": [
  31378. "Creative Commons Attribution 3.0 Unported",
  31379. false,
  31380. false
  31381. ],
  31382. "CC-BY-4.0": [
  31383. "Creative Commons Attribution 4.0 International",
  31384. false,
  31385. false
  31386. ],
  31387. "CC-BY-NC-1.0": [
  31388. "Creative Commons Attribution Non Commercial 1.0 Generic",
  31389. false,
  31390. false
  31391. ],
  31392. "CC-BY-NC-2.0": [
  31393. "Creative Commons Attribution Non Commercial 2.0 Generic",
  31394. false,
  31395. false
  31396. ],
  31397. "CC-BY-NC-2.5": [
  31398. "Creative Commons Attribution Non Commercial 2.5 Generic",
  31399. false,
  31400. false
  31401. ],
  31402. "CC-BY-NC-3.0": [
  31403. "Creative Commons Attribution Non Commercial 3.0 Unported",
  31404. false,
  31405. false
  31406. ],
  31407. "CC-BY-NC-4.0": [
  31408. "Creative Commons Attribution Non Commercial 4.0 International",
  31409. false,
  31410. false
  31411. ],
  31412. "CC-BY-NC-ND-1.0": [
  31413. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  31414. false,
  31415. false
  31416. ],
  31417. "CC-BY-NC-ND-2.0": [
  31418. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  31419. false,
  31420. false
  31421. ],
  31422. "CC-BY-NC-ND-2.5": [
  31423. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  31424. false,
  31425. false
  31426. ],
  31427. "CC-BY-NC-ND-3.0": [
  31428. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  31429. false,
  31430. false
  31431. ],
  31432. "CC-BY-NC-ND-4.0": [
  31433. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  31434. false,
  31435. false
  31436. ],
  31437. "CC-BY-NC-SA-1.0": [
  31438. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  31439. false,
  31440. false
  31441. ],
  31442. "CC-BY-NC-SA-2.0": [
  31443. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  31444. false,
  31445. false
  31446. ],
  31447. "CC-BY-NC-SA-2.5": [
  31448. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  31449. false,
  31450. false
  31451. ],
  31452. "CC-BY-NC-SA-3.0": [
  31453. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  31454. false,
  31455. false
  31456. ],
  31457. "CC-BY-NC-SA-4.0": [
  31458. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  31459. false,
  31460. false
  31461. ],
  31462. "CC-BY-ND-1.0": [
  31463. "Creative Commons Attribution No Derivatives 1.0 Generic",
  31464. false,
  31465. false
  31466. ],
  31467. "CC-BY-ND-2.0": [
  31468. "Creative Commons Attribution No Derivatives 2.0 Generic",
  31469. false,
  31470. false
  31471. ],
  31472. "CC-BY-ND-2.5": [
  31473. "Creative Commons Attribution No Derivatives 2.5 Generic",
  31474. false,
  31475. false
  31476. ],
  31477. "CC-BY-ND-3.0": [
  31478. "Creative Commons Attribution No Derivatives 3.0 Unported",
  31479. false,
  31480. false
  31481. ],
  31482. "CC-BY-ND-4.0": [
  31483. "Creative Commons Attribution No Derivatives 4.0 International",
  31484. false,
  31485. false
  31486. ],
  31487. "CC-BY-SA-1.0": [
  31488. "Creative Commons Attribution Share Alike 1.0 Generic",
  31489. false,
  31490. false
  31491. ],
  31492. "CC-BY-SA-2.0": [
  31493. "Creative Commons Attribution Share Alike 2.0 Generic",
  31494. false,
  31495. false
  31496. ],
  31497. "CC-BY-SA-2.5": [
  31498. "Creative Commons Attribution Share Alike 2.5 Generic",
  31499. false,
  31500. false
  31501. ],
  31502. "CC-BY-SA-3.0": [
  31503. "Creative Commons Attribution Share Alike 3.0 Unported",
  31504. false,
  31505. false
  31506. ],
  31507. "CC-BY-SA-4.0": [
  31508. "Creative Commons Attribution Share Alike 4.0 International",
  31509. false,
  31510. false
  31511. ],
  31512. "CC-PDDC": [
  31513. "Creative Commons Public Domain Dedication and Certification",
  31514. false,
  31515. false
  31516. ],
  31517. "CC0-1.0": [
  31518. "Creative Commons Zero v1.0 Universal",
  31519. false,
  31520. false
  31521. ],
  31522. "CDDL-1.0": [
  31523. "Common Development and Distribution License 1.0",
  31524. true,
  31525. false
  31526. ],
  31527. "CDDL-1.1": [
  31528. "Common Development and Distribution License 1.1",
  31529. false,
  31530. false
  31531. ],
  31532. "CDLA-Permissive-1.0": [
  31533. "Community Data License Agreement Permissive 1.0",
  31534. false,
  31535. false
  31536. ],
  31537. "CDLA-Sharing-1.0": [
  31538. "Community Data License Agreement Sharing 1.0",
  31539. false,
  31540. false
  31541. ],
  31542. "CECILL-1.0": [
  31543. "CeCILL Free Software License Agreement v1.0",
  31544. false,
  31545. false
  31546. ],
  31547. "CECILL-1.1": [
  31548. "CeCILL Free Software License Agreement v1.1",
  31549. false,
  31550. false
  31551. ],
  31552. "CECILL-2.0": [
  31553. "CeCILL Free Software License Agreement v2.0",
  31554. false,
  31555. false
  31556. ],
  31557. "CECILL-2.1": [
  31558. "CeCILL Free Software License Agreement v2.1",
  31559. true,
  31560. false
  31561. ],
  31562. "CECILL-B": [
  31563. "CeCILL-B Free Software License Agreement",
  31564. false,
  31565. false
  31566. ],
  31567. "CECILL-C": [
  31568. "CeCILL-C Free Software License Agreement",
  31569. false,
  31570. false
  31571. ],
  31572. "CERN-OHL-1.1": [
  31573. "CERN Open Hardware Licence v1.1",
  31574. false,
  31575. false
  31576. ],
  31577. "CERN-OHL-1.2": [
  31578. "CERN Open Hardware Licence v1.2",
  31579. false,
  31580. false
  31581. ],
  31582. "CERN-OHL-P-2.0": [
  31583. "CERN Open Hardware Licence Version 2 - Permissive",
  31584. false,
  31585. false
  31586. ],
  31587. "CERN-OHL-S-2.0": [
  31588. "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
  31589. false,
  31590. false
  31591. ],
  31592. "CERN-OHL-W-2.0": [
  31593. "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
  31594. false,
  31595. false
  31596. ],
  31597. "ClArtistic": [
  31598. "Clarified Artistic License",
  31599. false,
  31600. false
  31601. ],
  31602. "CNRI-Jython": [
  31603. "CNRI Jython License",
  31604. false,
  31605. false
  31606. ],
  31607. "CNRI-Python": [
  31608. "CNRI Python License",
  31609. true,
  31610. false
  31611. ],
  31612. "CNRI-Python-GPL-Compatible": [
  31613. "CNRI Python Open Source GPL Compatible License Agreement",
  31614. false,
  31615. false
  31616. ],
  31617. "Condor-1.1": [
  31618. "Condor Public License v1.1",
  31619. false,
  31620. false
  31621. ],
  31622. "copyleft-next-0.3.0": [
  31623. "copyleft-next 0.3.0",
  31624. false,
  31625. false
  31626. ],
  31627. "copyleft-next-0.3.1": [
  31628. "copyleft-next 0.3.1",
  31629. false,
  31630. false
  31631. ],
  31632. "CPAL-1.0": [
  31633. "Common Public Attribution License 1.0",
  31634. true,
  31635. false
  31636. ],
  31637. "CPL-1.0": [
  31638. "Common Public License 1.0",
  31639. true,
  31640. false
  31641. ],
  31642. "CPOL-1.02": [
  31643. "Code Project Open License 1.02",
  31644. false,
  31645. false
  31646. ],
  31647. "Crossword": [
  31648. "Crossword License",
  31649. false,
  31650. false
  31651. ],
  31652. "CrystalStacker": [
  31653. "CrystalStacker License",
  31654. false,
  31655. false
  31656. ],
  31657. "CUA-OPL-1.0": [
  31658. "CUA Office Public License v1.0",
  31659. true,
  31660. false
  31661. ],
  31662. "Cube": [
  31663. "Cube License",
  31664. false,
  31665. false
  31666. ],
  31667. "curl": [
  31668. "curl License",
  31669. false,
  31670. false
  31671. ],
  31672. "D-FSL-1.0": [
  31673. "Deutsche Freie Software Lizenz",
  31674. false,
  31675. false
  31676. ],
  31677. "diffmark": [
  31678. "diffmark license",
  31679. false,
  31680. false
  31681. ],
  31682. "DOC": [
  31683. "DOC License",
  31684. false,
  31685. false
  31686. ],
  31687. "Dotseqn": [
  31688. "Dotseqn License",
  31689. false,
  31690. false
  31691. ],
  31692. "DSDP": [
  31693. "DSDP License",
  31694. false,
  31695. false
  31696. ],
  31697. "dvipdfm": [
  31698. "dvipdfm License",
  31699. false,
  31700. false
  31701. ],
  31702. "ECL-1.0": [
  31703. "Educational Community License v1.0",
  31704. true,
  31705. false
  31706. ],
  31707. "ECL-2.0": [
  31708. "Educational Community License v2.0",
  31709. true,
  31710. false
  31711. ],
  31712. "eCos-2.0": [
  31713. "eCos license version 2.0",
  31714. false,
  31715. true
  31716. ],
  31717. "EFL-1.0": [
  31718. "Eiffel Forum License v1.0",
  31719. true,
  31720. false
  31721. ],
  31722. "EFL-2.0": [
  31723. "Eiffel Forum License v2.0",
  31724. true,
  31725. false
  31726. ],
  31727. "eGenix": [
  31728. "eGenix.com Public License 1.1.0",
  31729. false,
  31730. false
  31731. ],
  31732. "Entessa": [
  31733. "Entessa Public License v1.0",
  31734. true,
  31735. false
  31736. ],
  31737. "EPL-1.0": [
  31738. "Eclipse Public License 1.0",
  31739. true,
  31740. false
  31741. ],
  31742. "EPL-2.0": [
  31743. "Eclipse Public License 2.0",
  31744. true,
  31745. false
  31746. ],
  31747. "ErlPL-1.1": [
  31748. "Erlang Public License v1.1",
  31749. false,
  31750. false
  31751. ],
  31752. "etalab-2.0": [
  31753. "Etalab Open License 2.0",
  31754. false,
  31755. false
  31756. ],
  31757. "EUDatagrid": [
  31758. "EU DataGrid Software License",
  31759. true,
  31760. false
  31761. ],
  31762. "EUPL-1.0": [
  31763. "European Union Public License 1.0",
  31764. false,
  31765. false
  31766. ],
  31767. "EUPL-1.1": [
  31768. "European Union Public License 1.1",
  31769. true,
  31770. false
  31771. ],
  31772. "EUPL-1.2": [
  31773. "European Union Public License 1.2",
  31774. true,
  31775. false
  31776. ],
  31777. "Eurosym": [
  31778. "Eurosym License",
  31779. false,
  31780. false
  31781. ],
  31782. "Fair": [
  31783. "Fair License",
  31784. true,
  31785. false
  31786. ],
  31787. "Frameworx-1.0": [
  31788. "Frameworx Open License 1.0",
  31789. true,
  31790. false
  31791. ],
  31792. "FreeImage": [
  31793. "FreeImage Public License v1.0",
  31794. false,
  31795. false
  31796. ],
  31797. "FSFAP": [
  31798. "FSF All Permissive License",
  31799. false,
  31800. false
  31801. ],
  31802. "FSFUL": [
  31803. "FSF Unlimited License",
  31804. false,
  31805. false
  31806. ],
  31807. "FSFULLR": [
  31808. "FSF Unlimited License (with License Retention)",
  31809. false,
  31810. false
  31811. ],
  31812. "FTL": [
  31813. "Freetype Project License",
  31814. false,
  31815. false
  31816. ],
  31817. "GFDL-1.1": [
  31818. "GNU Free Documentation License v1.1",
  31819. false,
  31820. true
  31821. ],
  31822. "GFDL-1.1-only": [
  31823. "GNU Free Documentation License v1.1 only",
  31824. false,
  31825. false
  31826. ],
  31827. "GFDL-1.1-or-later": [
  31828. "GNU Free Documentation License v1.1 or later",
  31829. false,
  31830. false
  31831. ],
  31832. "GFDL-1.2": [
  31833. "GNU Free Documentation License v1.2",
  31834. false,
  31835. true
  31836. ],
  31837. "GFDL-1.2-only": [
  31838. "GNU Free Documentation License v1.2 only",
  31839. false,
  31840. false
  31841. ],
  31842. "GFDL-1.2-or-later": [
  31843. "GNU Free Documentation License v1.2 or later",
  31844. false,
  31845. false
  31846. ],
  31847. "GFDL-1.3": [
  31848. "GNU Free Documentation License v1.3",
  31849. false,
  31850. true
  31851. ],
  31852. "GFDL-1.3-only": [
  31853. "GNU Free Documentation License v1.3 only",
  31854. false,
  31855. false
  31856. ],
  31857. "GFDL-1.3-or-later": [
  31858. "GNU Free Documentation License v1.3 or later",
  31859. false,
  31860. false
  31861. ],
  31862. "Giftware": [
  31863. "Giftware License",
  31864. false,
  31865. false
  31866. ],
  31867. "GL2PS": [
  31868. "GL2PS License",
  31869. false,
  31870. false
  31871. ],
  31872. "Glide": [
  31873. "3dfx Glide License",
  31874. false,
  31875. false
  31876. ],
  31877. "Glulxe": [
  31878. "Glulxe License",
  31879. false,
  31880. false
  31881. ],
  31882. "gnuplot": [
  31883. "gnuplot License",
  31884. false,
  31885. false
  31886. ],
  31887. "GPL-1.0": [
  31888. "GNU General Public License v1.0 only",
  31889. false,
  31890. true
  31891. ],
  31892. "GPL-1.0+": [
  31893. "GNU General Public License v1.0 or later",
  31894. false,
  31895. true
  31896. ],
  31897. "GPL-1.0-only": [
  31898. "GNU General Public License v1.0 only",
  31899. false,
  31900. false
  31901. ],
  31902. "GPL-1.0-or-later": [
  31903. "GNU General Public License v1.0 or later",
  31904. false,
  31905. false
  31906. ],
  31907. "GPL-2.0": [
  31908. "GNU General Public License v2.0 only",
  31909. true,
  31910. true
  31911. ],
  31912. "GPL-2.0+": [
  31913. "GNU General Public License v2.0 or later",
  31914. true,
  31915. true
  31916. ],
  31917. "GPL-2.0-only": [
  31918. "GNU General Public License v2.0 only",
  31919. true,
  31920. false
  31921. ],
  31922. "GPL-2.0-or-later": [
  31923. "GNU General Public License v2.0 or later",
  31924. true,
  31925. false
  31926. ],
  31927. "GPL-2.0-with-autoconf-exception": [
  31928. "GNU General Public License v2.0 w/Autoconf exception",
  31929. false,
  31930. true
  31931. ],
  31932. "GPL-2.0-with-bison-exception": [
  31933. "GNU General Public License v2.0 w/Bison exception",
  31934. false,
  31935. true
  31936. ],
  31937. "GPL-2.0-with-classpath-exception": [
  31938. "GNU General Public License v2.0 w/Classpath exception",
  31939. false,
  31940. true
  31941. ],
  31942. "GPL-2.0-with-font-exception": [
  31943. "GNU General Public License v2.0 w/Font exception",
  31944. false,
  31945. true
  31946. ],
  31947. "GPL-2.0-with-GCC-exception": [
  31948. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  31949. false,
  31950. true
  31951. ],
  31952. "GPL-3.0": [
  31953. "GNU General Public License v3.0 only",
  31954. true,
  31955. true
  31956. ],
  31957. "GPL-3.0+": [
  31958. "GNU General Public License v3.0 or later",
  31959. true,
  31960. true
  31961. ],
  31962. "GPL-3.0-only": [
  31963. "GNU General Public License v3.0 only",
  31964. true,
  31965. false
  31966. ],
  31967. "GPL-3.0-or-later": [
  31968. "GNU General Public License v3.0 or later",
  31969. true,
  31970. false
  31971. ],
  31972. "GPL-3.0-with-autoconf-exception": [
  31973. "GNU General Public License v3.0 w/Autoconf exception",
  31974. false,
  31975. true
  31976. ],
  31977. "GPL-3.0-with-GCC-exception": [
  31978. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  31979. true,
  31980. true
  31981. ],
  31982. "gSOAP-1.3b": [
  31983. "gSOAP Public License v1.3b",
  31984. false,
  31985. false
  31986. ],
  31987. "HaskellReport": [
  31988. "Haskell Language Report License",
  31989. false,
  31990. false
  31991. ],
  31992. "Hippocratic-2.1": [
  31993. "Hippocratic License 2.1",
  31994. false,
  31995. false
  31996. ],
  31997. "HPND": [
  31998. "Historical Permission Notice and Disclaimer",
  31999. true,
  32000. false
  32001. ],
  32002. "HPND-sell-variant": [
  32003. "Historical Permission Notice and Disclaimer - sell variant",
  32004. false,
  32005. false
  32006. ],
  32007. "IBM-pibs": [
  32008. "IBM PowerPC Initialization and Boot Software",
  32009. false,
  32010. false
  32011. ],
  32012. "ICU": [
  32013. "ICU License",
  32014. false,
  32015. false
  32016. ],
  32017. "IJG": [
  32018. "Independent JPEG Group License",
  32019. false,
  32020. false
  32021. ],
  32022. "ImageMagick": [
  32023. "ImageMagick License",
  32024. false,
  32025. false
  32026. ],
  32027. "iMatix": [
  32028. "iMatix Standard Function Library Agreement",
  32029. false,
  32030. false
  32031. ],
  32032. "Imlib2": [
  32033. "Imlib2 License",
  32034. false,
  32035. false
  32036. ],
  32037. "Info-ZIP": [
  32038. "Info-ZIP License",
  32039. false,
  32040. false
  32041. ],
  32042. "Intel": [
  32043. "Intel Open Source License",
  32044. true,
  32045. false
  32046. ],
  32047. "Intel-ACPI": [
  32048. "Intel ACPI Software License Agreement",
  32049. false,
  32050. false
  32051. ],
  32052. "Interbase-1.0": [
  32053. "Interbase Public License v1.0",
  32054. false,
  32055. false
  32056. ],
  32057. "IPA": [
  32058. "IPA Font License",
  32059. true,
  32060. false
  32061. ],
  32062. "IPL-1.0": [
  32063. "IBM Public License v1.0",
  32064. true,
  32065. false
  32066. ],
  32067. "ISC": [
  32068. "ISC License",
  32069. true,
  32070. false
  32071. ],
  32072. "JasPer-2.0": [
  32073. "JasPer License",
  32074. false,
  32075. false
  32076. ],
  32077. "JPNIC": [
  32078. "Japan Network Information Center License",
  32079. false,
  32080. false
  32081. ],
  32082. "JSON": [
  32083. "JSON License",
  32084. false,
  32085. false
  32086. ],
  32087. "LAL-1.2": [
  32088. "Licence Art Libre 1.2",
  32089. false,
  32090. false
  32091. ],
  32092. "LAL-1.3": [
  32093. "Licence Art Libre 1.3",
  32094. false,
  32095. false
  32096. ],
  32097. "Latex2e": [
  32098. "Latex2e License",
  32099. false,
  32100. false
  32101. ],
  32102. "Leptonica": [
  32103. "Leptonica License",
  32104. false,
  32105. false
  32106. ],
  32107. "LGPL-2.0": [
  32108. "GNU Library General Public License v2 only",
  32109. true,
  32110. true
  32111. ],
  32112. "LGPL-2.0+": [
  32113. "GNU Library General Public License v2 or later",
  32114. true,
  32115. true
  32116. ],
  32117. "LGPL-2.0-only": [
  32118. "GNU Library General Public License v2 only",
  32119. true,
  32120. false
  32121. ],
  32122. "LGPL-2.0-or-later": [
  32123. "GNU Library General Public License v2 or later",
  32124. true,
  32125. false
  32126. ],
  32127. "LGPL-2.1": [
  32128. "GNU Lesser General Public License v2.1 only",
  32129. true,
  32130. true
  32131. ],
  32132. "LGPL-2.1+": [
  32133. "GNU Library General Public License v2.1 or later",
  32134. true,
  32135. true
  32136. ],
  32137. "LGPL-2.1-only": [
  32138. "GNU Lesser General Public License v2.1 only",
  32139. true,
  32140. false
  32141. ],
  32142. "LGPL-2.1-or-later": [
  32143. "GNU Lesser General Public License v2.1 or later",
  32144. true,
  32145. false
  32146. ],
  32147. "LGPL-3.0": [
  32148. "GNU Lesser General Public License v3.0 only",
  32149. true,
  32150. true
  32151. ],
  32152. "LGPL-3.0+": [
  32153. "GNU Lesser General Public License v3.0 or later",
  32154. true,
  32155. true
  32156. ],
  32157. "LGPL-3.0-only": [
  32158. "GNU Lesser General Public License v3.0 only",
  32159. true,
  32160. false
  32161. ],
  32162. "LGPL-3.0-or-later": [
  32163. "GNU Lesser General Public License v3.0 or later",
  32164. true,
  32165. false
  32166. ],
  32167. "LGPLLR": [
  32168. "Lesser General Public License For Linguistic Resources",
  32169. false,
  32170. false
  32171. ],
  32172. "Libpng": [
  32173. "libpng License",
  32174. false,
  32175. false
  32176. ],
  32177. "libpng-2.0": [
  32178. "PNG Reference Library version 2",
  32179. false,
  32180. false
  32181. ],
  32182. "libselinux-1.0": [
  32183. "libselinux public domain notice",
  32184. false,
  32185. false
  32186. ],
  32187. "libtiff": [
  32188. "libtiff License",
  32189. false,
  32190. false
  32191. ],
  32192. "LiLiQ-P-1.1": [
  32193. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  32194. true,
  32195. false
  32196. ],
  32197. "LiLiQ-R-1.1": [
  32198. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  32199. true,
  32200. false
  32201. ],
  32202. "LiLiQ-Rplus-1.1": [
  32203. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  32204. true,
  32205. false
  32206. ],
  32207. "Linux-OpenIB": [
  32208. "Linux Kernel Variant of OpenIB.org license",
  32209. false,
  32210. false
  32211. ],
  32212. "LPL-1.0": [
  32213. "Lucent Public License Version 1.0",
  32214. true,
  32215. false
  32216. ],
  32217. "LPL-1.02": [
  32218. "Lucent Public License v1.02",
  32219. true,
  32220. false
  32221. ],
  32222. "LPPL-1.0": [
  32223. "LaTeX Project Public License v1.0",
  32224. false,
  32225. false
  32226. ],
  32227. "LPPL-1.1": [
  32228. "LaTeX Project Public License v1.1",
  32229. false,
  32230. false
  32231. ],
  32232. "LPPL-1.2": [
  32233. "LaTeX Project Public License v1.2",
  32234. false,
  32235. false
  32236. ],
  32237. "LPPL-1.3a": [
  32238. "LaTeX Project Public License v1.3a",
  32239. false,
  32240. false
  32241. ],
  32242. "LPPL-1.3c": [
  32243. "LaTeX Project Public License v1.3c",
  32244. true,
  32245. false
  32246. ],
  32247. "MakeIndex": [
  32248. "MakeIndex License",
  32249. false,
  32250. false
  32251. ],
  32252. "MirOS": [
  32253. "The MirOS Licence",
  32254. true,
  32255. false
  32256. ],
  32257. "MIT": [
  32258. "MIT License",
  32259. true,
  32260. false
  32261. ],
  32262. "MIT-0": [
  32263. "MIT No Attribution",
  32264. false,
  32265. false
  32266. ],
  32267. "MIT-advertising": [
  32268. "Enlightenment License (e16)",
  32269. false,
  32270. false
  32271. ],
  32272. "MIT-CMU": [
  32273. "CMU License",
  32274. false,
  32275. false
  32276. ],
  32277. "MIT-enna": [
  32278. "enna License",
  32279. false,
  32280. false
  32281. ],
  32282. "MIT-feh": [
  32283. "feh License",
  32284. false,
  32285. false
  32286. ],
  32287. "MITNFA": [
  32288. "MIT +no-false-attribs license",
  32289. false,
  32290. false
  32291. ],
  32292. "Motosoto": [
  32293. "Motosoto License",
  32294. true,
  32295. false
  32296. ],
  32297. "mpich2": [
  32298. "mpich2 License",
  32299. false,
  32300. false
  32301. ],
  32302. "MPL-1.0": [
  32303. "Mozilla Public License 1.0",
  32304. true,
  32305. false
  32306. ],
  32307. "MPL-1.1": [
  32308. "Mozilla Public License 1.1",
  32309. true,
  32310. false
  32311. ],
  32312. "MPL-2.0": [
  32313. "Mozilla Public License 2.0",
  32314. true,
  32315. false
  32316. ],
  32317. "MPL-2.0-no-copyleft-exception": [
  32318. "Mozilla Public License 2.0 (no copyleft exception)",
  32319. true,
  32320. false
  32321. ],
  32322. "MS-PL": [
  32323. "Microsoft Public License",
  32324. true,
  32325. false
  32326. ],
  32327. "MS-RL": [
  32328. "Microsoft Reciprocal License",
  32329. true,
  32330. false
  32331. ],
  32332. "MTLL": [
  32333. "Matrix Template Library License",
  32334. false,
  32335. false
  32336. ],
  32337. "MulanPSL-1.0": [
  32338. "Mulan Permissive Software License, Version 1",
  32339. false,
  32340. false
  32341. ],
  32342. "MulanPSL-2.0": [
  32343. "Mulan Permissive Software License, Version 2",
  32344. true,
  32345. false
  32346. ],
  32347. "Multics": [
  32348. "Multics License",
  32349. true,
  32350. false
  32351. ],
  32352. "Mup": [
  32353. "Mup License",
  32354. false,
  32355. false
  32356. ],
  32357. "NASA-1.3": [
  32358. "NASA Open Source Agreement 1.3",
  32359. true,
  32360. false
  32361. ],
  32362. "Naumen": [
  32363. "Naumen Public License",
  32364. true,
  32365. false
  32366. ],
  32367. "NBPL-1.0": [
  32368. "Net Boolean Public License v1",
  32369. false,
  32370. false
  32371. ],
  32372. "NCGL-UK-2.0": [
  32373. "Non-Commercial Government Licence",
  32374. false,
  32375. false
  32376. ],
  32377. "NCSA": [
  32378. "University of Illinois/NCSA Open Source License",
  32379. true,
  32380. false
  32381. ],
  32382. "Net-SNMP": [
  32383. "Net-SNMP License",
  32384. false,
  32385. false
  32386. ],
  32387. "NetCDF": [
  32388. "NetCDF license",
  32389. false,
  32390. false
  32391. ],
  32392. "Newsletr": [
  32393. "Newsletr License",
  32394. false,
  32395. false
  32396. ],
  32397. "NGPL": [
  32398. "Nethack General Public License",
  32399. true,
  32400. false
  32401. ],
  32402. "NLOD-1.0": [
  32403. "Norwegian Licence for Open Government Data",
  32404. false,
  32405. false
  32406. ],
  32407. "NLPL": [
  32408. "No Limit Public License",
  32409. false,
  32410. false
  32411. ],
  32412. "Nokia": [
  32413. "Nokia Open Source License",
  32414. true,
  32415. false
  32416. ],
  32417. "NOSL": [
  32418. "Netizen Open Source License",
  32419. false,
  32420. false
  32421. ],
  32422. "Noweb": [
  32423. "Noweb License",
  32424. false,
  32425. false
  32426. ],
  32427. "NPL-1.0": [
  32428. "Netscape Public License v1.0",
  32429. false,
  32430. false
  32431. ],
  32432. "NPL-1.1": [
  32433. "Netscape Public License v1.1",
  32434. false,
  32435. false
  32436. ],
  32437. "NPOSL-3.0": [
  32438. "Non-Profit Open Software License 3.0",
  32439. true,
  32440. false
  32441. ],
  32442. "NRL": [
  32443. "NRL License",
  32444. false,
  32445. false
  32446. ],
  32447. "NTP": [
  32448. "NTP License",
  32449. true,
  32450. false
  32451. ],
  32452. "NTP-0": [
  32453. "NTP No Attribution",
  32454. false,
  32455. false
  32456. ],
  32457. "Nunit": [
  32458. "Nunit License",
  32459. false,
  32460. true
  32461. ],
  32462. "O-UDA-1.0": [
  32463. "Open Use of Data Agreement v1.0",
  32464. false,
  32465. false
  32466. ],
  32467. "OCCT-PL": [
  32468. "Open CASCADE Technology Public License",
  32469. false,
  32470. false
  32471. ],
  32472. "OCLC-2.0": [
  32473. "OCLC Research Public License 2.0",
  32474. true,
  32475. false
  32476. ],
  32477. "ODbL-1.0": [
  32478. "ODC Open Database License v1.0",
  32479. false,
  32480. false
  32481. ],
  32482. "ODC-By-1.0": [
  32483. "Open Data Commons Attribution License v1.0",
  32484. false,
  32485. false
  32486. ],
  32487. "OFL-1.0": [
  32488. "SIL Open Font License 1.0",
  32489. false,
  32490. false
  32491. ],
  32492. "OFL-1.0-no-RFN": [
  32493. "SIL Open Font License 1.0 with no Reserved Font Name",
  32494. false,
  32495. false
  32496. ],
  32497. "OFL-1.0-RFN": [
  32498. "SIL Open Font License 1.0 with Reserved Font Name",
  32499. false,
  32500. false
  32501. ],
  32502. "OFL-1.1": [
  32503. "SIL Open Font License 1.1",
  32504. true,
  32505. false
  32506. ],
  32507. "OFL-1.1-no-RFN": [
  32508. "SIL Open Font License 1.1 with no Reserved Font Name",
  32509. true,
  32510. false
  32511. ],
  32512. "OFL-1.1-RFN": [
  32513. "SIL Open Font License 1.1 with Reserved Font Name",
  32514. true,
  32515. false
  32516. ],
  32517. "OGC-1.0": [
  32518. "OGC Software License, Version 1.0",
  32519. false,
  32520. false
  32521. ],
  32522. "OGL-Canada-2.0": [
  32523. "Open Government Licence - Canada",
  32524. false,
  32525. false
  32526. ],
  32527. "OGL-UK-1.0": [
  32528. "Open Government Licence v1.0",
  32529. false,
  32530. false
  32531. ],
  32532. "OGL-UK-2.0": [
  32533. "Open Government Licence v2.0",
  32534. false,
  32535. false
  32536. ],
  32537. "OGL-UK-3.0": [
  32538. "Open Government Licence v3.0",
  32539. false,
  32540. false
  32541. ],
  32542. "OGTSL": [
  32543. "Open Group Test Suite License",
  32544. true,
  32545. false
  32546. ],
  32547. "OLDAP-1.1": [
  32548. "Open LDAP Public License v1.1",
  32549. false,
  32550. false
  32551. ],
  32552. "OLDAP-1.2": [
  32553. "Open LDAP Public License v1.2",
  32554. false,
  32555. false
  32556. ],
  32557. "OLDAP-1.3": [
  32558. "Open LDAP Public License v1.3",
  32559. false,
  32560. false
  32561. ],
  32562. "OLDAP-1.4": [
  32563. "Open LDAP Public License v1.4",
  32564. false,
  32565. false
  32566. ],
  32567. "OLDAP-2.0": [
  32568. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  32569. false,
  32570. false
  32571. ],
  32572. "OLDAP-2.0.1": [
  32573. "Open LDAP Public License v2.0.1",
  32574. false,
  32575. false
  32576. ],
  32577. "OLDAP-2.1": [
  32578. "Open LDAP Public License v2.1",
  32579. false,
  32580. false
  32581. ],
  32582. "OLDAP-2.2": [
  32583. "Open LDAP Public License v2.2",
  32584. false,
  32585. false
  32586. ],
  32587. "OLDAP-2.2.1": [
  32588. "Open LDAP Public License v2.2.1",
  32589. false,
  32590. false
  32591. ],
  32592. "OLDAP-2.2.2": [
  32593. "Open LDAP Public License 2.2.2",
  32594. false,
  32595. false
  32596. ],
  32597. "OLDAP-2.3": [
  32598. "Open LDAP Public License v2.3",
  32599. false,
  32600. false
  32601. ],
  32602. "OLDAP-2.4": [
  32603. "Open LDAP Public License v2.4",
  32604. false,
  32605. false
  32606. ],
  32607. "OLDAP-2.5": [
  32608. "Open LDAP Public License v2.5",
  32609. false,
  32610. false
  32611. ],
  32612. "OLDAP-2.6": [
  32613. "Open LDAP Public License v2.6",
  32614. false,
  32615. false
  32616. ],
  32617. "OLDAP-2.7": [
  32618. "Open LDAP Public License v2.7",
  32619. false,
  32620. false
  32621. ],
  32622. "OLDAP-2.8": [
  32623. "Open LDAP Public License v2.8",
  32624. false,
  32625. false
  32626. ],
  32627. "OML": [
  32628. "Open Market License",
  32629. false,
  32630. false
  32631. ],
  32632. "OpenSSL": [
  32633. "OpenSSL License",
  32634. false,
  32635. false
  32636. ],
  32637. "OPL-1.0": [
  32638. "Open Public License v1.0",
  32639. false,
  32640. false
  32641. ],
  32642. "OSET-PL-2.1": [
  32643. "OSET Public License version 2.1",
  32644. true,
  32645. false
  32646. ],
  32647. "OSL-1.0": [
  32648. "Open Software License 1.0",
  32649. true,
  32650. false
  32651. ],
  32652. "OSL-1.1": [
  32653. "Open Software License 1.1",
  32654. false,
  32655. false
  32656. ],
  32657. "OSL-2.0": [
  32658. "Open Software License 2.0",
  32659. true,
  32660. false
  32661. ],
  32662. "OSL-2.1": [
  32663. "Open Software License 2.1",
  32664. true,
  32665. false
  32666. ],
  32667. "OSL-3.0": [
  32668. "Open Software License 3.0",
  32669. true,
  32670. false
  32671. ],
  32672. "Parity-6.0.0": [
  32673. "The Parity Public License 6.0.0",
  32674. false,
  32675. false
  32676. ],
  32677. "Parity-7.0.0": [
  32678. "The Parity Public License 7.0.0",
  32679. false,
  32680. false
  32681. ],
  32682. "PDDL-1.0": [
  32683. "ODC Public Domain Dedication & License 1.0",
  32684. false,
  32685. false
  32686. ],
  32687. "PHP-3.0": [
  32688. "PHP License v3.0",
  32689. true,
  32690. false
  32691. ],
  32692. "PHP-3.01": [
  32693. "PHP License v3.01",
  32694. false,
  32695. false
  32696. ],
  32697. "Plexus": [
  32698. "Plexus Classworlds License",
  32699. false,
  32700. false
  32701. ],
  32702. "PolyForm-Noncommercial-1.0.0": [
  32703. "PolyForm Noncommercial License 1.0.0",
  32704. false,
  32705. false
  32706. ],
  32707. "PolyForm-Small-Business-1.0.0": [
  32708. "PolyForm Small Business License 1.0.0",
  32709. false,
  32710. false
  32711. ],
  32712. "PostgreSQL": [
  32713. "PostgreSQL License",
  32714. true,
  32715. false
  32716. ],
  32717. "PSF-2.0": [
  32718. "Python Software Foundation License 2.0",
  32719. false,
  32720. false
  32721. ],
  32722. "psfrag": [
  32723. "psfrag License",
  32724. false,
  32725. false
  32726. ],
  32727. "psutils": [
  32728. "psutils License",
  32729. false,
  32730. false
  32731. ],
  32732. "Python-2.0": [
  32733. "Python License 2.0",
  32734. true,
  32735. false
  32736. ],
  32737. "Qhull": [
  32738. "Qhull License",
  32739. false,
  32740. false
  32741. ],
  32742. "QPL-1.0": [
  32743. "Q Public License 1.0",
  32744. true,
  32745. false
  32746. ],
  32747. "Rdisc": [
  32748. "Rdisc License",
  32749. false,
  32750. false
  32751. ],
  32752. "RHeCos-1.1": [
  32753. "Red Hat eCos Public License v1.1",
  32754. false,
  32755. false
  32756. ],
  32757. "RPL-1.1": [
  32758. "Reciprocal Public License 1.1",
  32759. true,
  32760. false
  32761. ],
  32762. "RPL-1.5": [
  32763. "Reciprocal Public License 1.5",
  32764. true,
  32765. false
  32766. ],
  32767. "RPSL-1.0": [
  32768. "RealNetworks Public Source License v1.0",
  32769. true,
  32770. false
  32771. ],
  32772. "RSA-MD": [
  32773. "RSA Message-Digest License",
  32774. false,
  32775. false
  32776. ],
  32777. "RSCPL": [
  32778. "Ricoh Source Code Public License",
  32779. true,
  32780. false
  32781. ],
  32782. "Ruby": [
  32783. "Ruby License",
  32784. false,
  32785. false
  32786. ],
  32787. "SAX-PD": [
  32788. "Sax Public Domain Notice",
  32789. false,
  32790. false
  32791. ],
  32792. "Saxpath": [
  32793. "Saxpath License",
  32794. false,
  32795. false
  32796. ],
  32797. "SCEA": [
  32798. "SCEA Shared Source License",
  32799. false,
  32800. false
  32801. ],
  32802. "Sendmail": [
  32803. "Sendmail License",
  32804. false,
  32805. false
  32806. ],
  32807. "Sendmail-8.23": [
  32808. "Sendmail License 8.23",
  32809. false,
  32810. false
  32811. ],
  32812. "SGI-B-1.0": [
  32813. "SGI Free Software License B v1.0",
  32814. false,
  32815. false
  32816. ],
  32817. "SGI-B-1.1": [
  32818. "SGI Free Software License B v1.1",
  32819. false,
  32820. false
  32821. ],
  32822. "SGI-B-2.0": [
  32823. "SGI Free Software License B v2.0",
  32824. false,
  32825. false
  32826. ],
  32827. "SHL-0.5": [
  32828. "Solderpad Hardware License v0.5",
  32829. false,
  32830. false
  32831. ],
  32832. "SHL-0.51": [
  32833. "Solderpad Hardware License, Version 0.51",
  32834. false,
  32835. false
  32836. ],
  32837. "SimPL-2.0": [
  32838. "Simple Public License 2.0",
  32839. true,
  32840. false
  32841. ],
  32842. "SISSL": [
  32843. "Sun Industry Standards Source License v1.1",
  32844. true,
  32845. false
  32846. ],
  32847. "SISSL-1.2": [
  32848. "Sun Industry Standards Source License v1.2",
  32849. false,
  32850. false
  32851. ],
  32852. "Sleepycat": [
  32853. "Sleepycat License",
  32854. true,
  32855. false
  32856. ],
  32857. "SMLNJ": [
  32858. "Standard ML of New Jersey License",
  32859. false,
  32860. false
  32861. ],
  32862. "SMPPL": [
  32863. "Secure Messaging Protocol Public License",
  32864. false,
  32865. false
  32866. ],
  32867. "SNIA": [
  32868. "SNIA Public License 1.1",
  32869. false,
  32870. false
  32871. ],
  32872. "Spencer-86": [
  32873. "Spencer License 86",
  32874. false,
  32875. false
  32876. ],
  32877. "Spencer-94": [
  32878. "Spencer License 94",
  32879. false,
  32880. false
  32881. ],
  32882. "Spencer-99": [
  32883. "Spencer License 99",
  32884. false,
  32885. false
  32886. ],
  32887. "SPL-1.0": [
  32888. "Sun Public License v1.0",
  32889. true,
  32890. false
  32891. ],
  32892. "SSH-OpenSSH": [
  32893. "SSH OpenSSH license",
  32894. false,
  32895. false
  32896. ],
  32897. "SSH-short": [
  32898. "SSH short notice",
  32899. false,
  32900. false
  32901. ],
  32902. "SSPL-1.0": [
  32903. "Server Side Public License, v 1",
  32904. false,
  32905. false
  32906. ],
  32907. "StandardML-NJ": [
  32908. "Standard ML of New Jersey License",
  32909. false,
  32910. true
  32911. ],
  32912. "SugarCRM-1.1.3": [
  32913. "SugarCRM Public License v1.1.3",
  32914. false,
  32915. false
  32916. ],
  32917. "SWL": [
  32918. "Scheme Widget Library (SWL) Software License Agreement",
  32919. false,
  32920. false
  32921. ],
  32922. "TAPR-OHL-1.0": [
  32923. "TAPR Open Hardware License v1.0",
  32924. false,
  32925. false
  32926. ],
  32927. "TCL": [
  32928. "TCL/TK License",
  32929. false,
  32930. false
  32931. ],
  32932. "TCP-wrappers": [
  32933. "TCP Wrappers License",
  32934. false,
  32935. false
  32936. ],
  32937. "TMate": [
  32938. "TMate Open Source License",
  32939. false,
  32940. false
  32941. ],
  32942. "TORQUE-1.1": [
  32943. "TORQUE v2.5+ Software License v1.1",
  32944. false,
  32945. false
  32946. ],
  32947. "TOSL": [
  32948. "Trusster Open Source License",
  32949. false,
  32950. false
  32951. ],
  32952. "TU-Berlin-1.0": [
  32953. "Technische Universitaet Berlin License 1.0",
  32954. false,
  32955. false
  32956. ],
  32957. "TU-Berlin-2.0": [
  32958. "Technische Universitaet Berlin License 2.0",
  32959. false,
  32960. false
  32961. ],
  32962. "UCL-1.0": [
  32963. "Upstream Compatibility License v1.0",
  32964. true,
  32965. false
  32966. ],
  32967. "Unicode-DFS-2015": [
  32968. "Unicode License Agreement - Data Files and Software (2015)",
  32969. false,
  32970. false
  32971. ],
  32972. "Unicode-DFS-2016": [
  32973. "Unicode License Agreement - Data Files and Software (2016)",
  32974. false,
  32975. false
  32976. ],
  32977. "Unicode-TOU": [
  32978. "Unicode Terms of Use",
  32979. false,
  32980. false
  32981. ],
  32982. "Unlicense": [
  32983. "The Unlicense",
  32984. false,
  32985. false
  32986. ],
  32987. "UPL-1.0": [
  32988. "Universal Permissive License v1.0",
  32989. true,
  32990. false
  32991. ],
  32992. "Vim": [
  32993. "Vim License",
  32994. false,
  32995. false
  32996. ],
  32997. "VOSTROM": [
  32998. "VOSTROM Public License for Open Source",
  32999. false,
  33000. false
  33001. ],
  33002. "VSL-1.0": [
  33003. "Vovida Software License v1.0",
  33004. true,
  33005. false
  33006. ],
  33007. "W3C": [
  33008. "W3C Software Notice and License (2002-12-31)",
  33009. true,
  33010. false
  33011. ],
  33012. "W3C-19980720": [
  33013. "W3C Software Notice and License (1998-07-20)",
  33014. false,
  33015. false
  33016. ],
  33017. "W3C-20150513": [
  33018. "W3C Software Notice and Document License (2015-05-13)",
  33019. false,
  33020. false
  33021. ],
  33022. "Watcom-1.0": [
  33023. "Sybase Open Watcom Public License 1.0",
  33024. true,
  33025. false
  33026. ],
  33027. "Wsuipa": [
  33028. "Wsuipa License",
  33029. false,
  33030. false
  33031. ],
  33032. "WTFPL": [
  33033. "Do What The F*ck You Want To Public License",
  33034. false,
  33035. false
  33036. ],
  33037. "wxWindows": [
  33038. "wxWindows Library License",
  33039. false,
  33040. true
  33041. ],
  33042. "X11": [
  33043. "X11 License",
  33044. false,
  33045. false
  33046. ],
  33047. "Xerox": [
  33048. "Xerox License",
  33049. false,
  33050. false
  33051. ],
  33052. "XFree86-1.1": [
  33053. "XFree86 License 1.1",
  33054. false,
  33055. false
  33056. ],
  33057. "xinetd": [
  33058. "xinetd License",
  33059. false,
  33060. false
  33061. ],
  33062. "Xnet": [
  33063. "X.Net License",
  33064. true,
  33065. false
  33066. ],
  33067. "xpp": [
  33068. "XPP License",
  33069. false,
  33070. false
  33071. ],
  33072. "XSkat": [
  33073. "XSkat License",
  33074. false,
  33075. false
  33076. ],
  33077. "YPL-1.0": [
  33078. "Yahoo! Public License v1.0",
  33079. false,
  33080. false
  33081. ],
  33082. "YPL-1.1": [
  33083. "Yahoo! Public License v1.1",
  33084. false,
  33085. false
  33086. ],
  33087. "Zed": [
  33088. "Zed License",
  33089. false,
  33090. false
  33091. ],
  33092. "Zend-2.0": [
  33093. "Zend License v2.0",
  33094. false,
  33095. false
  33096. ],
  33097. "Zimbra-1.3": [
  33098. "Zimbra Public License v1.3",
  33099. false,
  33100. false
  33101. ],
  33102. "Zimbra-1.4": [
  33103. "Zimbra Public License v1.4",
  33104. false,
  33105. false
  33106. ],
  33107. "Zlib": [
  33108. "zlib License",
  33109. true,
  33110. false
  33111. ],
  33112. "zlib-acknowledgement": [
  33113. "zlib/libpng License with Acknowledgement",
  33114. false,
  33115. false
  33116. ],
  33117. "ZPL-1.1": [
  33118. "Zope Public License 1.1",
  33119. false,
  33120. false
  33121. ],
  33122. "ZPL-2.0": [
  33123. "Zope Public License 2.0",
  33124. true,
  33125. false
  33126. ],
  33127. "ZPL-2.1": [
  33128. "Zope Public License 2.1",
  33129. false,
  33130. false
  33131. ]
  33132. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  33133. $�������Æ,Í;§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��������à�  ��
  33134. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  33135. ����������������� ��`.rdata����� ���
  33136. �����������������@��@.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
  33137. 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
  33138. 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
  33139. 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">
  33140. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  33141. <security>
  33142. <requestedPrivileges>
  33143. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  33144. </requestedPrivileges>
  33145. </security>
  33146. </trustInfo>
  33147. <dependency>
  33148. <dependentAssembly>
  33149. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  33150. </dependentAssembly>
  33151. </dependency>
  33152. </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
  33153. namespace Symfony\Component\Console;
  33154. use Symfony\Component\Console\Command\Command;
  33155. use Symfony\Component\Console\Command\HelpCommand;
  33156. use Symfony\Component\Console\Command\ListCommand;
  33157. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33158. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33159. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  33160. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  33161. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  33162. use Symfony\Component\Console\Exception\CommandNotFoundException;
  33163. use Symfony\Component\Console\Exception\ExceptionInterface;
  33164. use Symfony\Component\Console\Exception\LogicException;
  33165. use Symfony\Component\Console\Formatter\OutputFormatter;
  33166. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  33167. use Symfony\Component\Console\Helper\DialogHelper;
  33168. use Symfony\Component\Console\Helper\FormatterHelper;
  33169. use Symfony\Component\Console\Helper\Helper;
  33170. use Symfony\Component\Console\Helper\HelperSet;
  33171. use Symfony\Component\Console\Helper\ProcessHelper;
  33172. use Symfony\Component\Console\Helper\ProgressHelper;
  33173. use Symfony\Component\Console\Helper\QuestionHelper;
  33174. use Symfony\Component\Console\Helper\TableHelper;
  33175. use Symfony\Component\Console\Input\ArgvInput;
  33176. use Symfony\Component\Console\Input\ArrayInput;
  33177. use Symfony\Component\Console\Input\InputArgument;
  33178. use Symfony\Component\Console\Input\InputAwareInterface;
  33179. use Symfony\Component\Console\Input\InputDefinition;
  33180. use Symfony\Component\Console\Input\InputInterface;
  33181. use Symfony\Component\Console\Input\InputOption;
  33182. use Symfony\Component\Console\Output\BufferedOutput;
  33183. use Symfony\Component\Console\Output\ConsoleOutput;
  33184. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33185. use Symfony\Component\Console\Output\OutputInterface;
  33186. use Symfony\Component\Debug\Exception\FatalThrowableError;
  33187. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  33188. class Application
  33189. {
  33190. private $commands = array();
  33191. private $wantHelps = false;
  33192. private $runningCommand;
  33193. private $name;
  33194. private $version;
  33195. private $catchExceptions = true;
  33196. private $autoExit = true;
  33197. private $definition;
  33198. private $helperSet;
  33199. private $dispatcher;
  33200. private $terminalDimensions;
  33201. private $defaultCommand;
  33202. private $initialized;
  33203. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  33204. {
  33205. $this->name = $name;
  33206. $this->version = $version;
  33207. $this->defaultCommand = 'list';
  33208. }
  33209. public function setDispatcher(EventDispatcherInterface $dispatcher)
  33210. {
  33211. $this->dispatcher = $dispatcher;
  33212. }
  33213. public function run(InputInterface $input = null, OutputInterface $output = null)
  33214. {
  33215. if (null === $input) {
  33216. $input = new ArgvInput();
  33217. }
  33218. if (null === $output) {
  33219. $output = new ConsoleOutput();
  33220. }
  33221. $this->configureIO($input, $output);
  33222. try {
  33223. $e = null;
  33224. $exitCode = $this->doRun($input, $output);
  33225. } catch (\Exception $e) {
  33226. }
  33227. if (null !== $e) {
  33228. if (!$this->catchExceptions) {
  33229. throw $e;
  33230. }
  33231. if ($output instanceof ConsoleOutputInterface) {
  33232. $this->renderException($e, $output->getErrorOutput());
  33233. } else {
  33234. $this->renderException($e, $output);
  33235. }
  33236. $exitCode = $this->getExitCodeForThrowable($e);
  33237. }
  33238. if ($this->autoExit) {
  33239. if ($exitCode > 255) {
  33240. $exitCode = 255;
  33241. }
  33242. exit($exitCode);
  33243. }
  33244. return $exitCode;
  33245. }
  33246. public function doRun(InputInterface $input, OutputInterface $output)
  33247. {
  33248. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  33249. $output->writeln($this->getLongVersion());
  33250. return 0;
  33251. }
  33252. $name = $this->getCommandName($input);
  33253. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  33254. if (!$name) {
  33255. $name = 'help';
  33256. $input = new ArrayInput(array('command' => 'help'));
  33257. } else {
  33258. $this->wantHelps = true;
  33259. }
  33260. }
  33261. if (!$name) {
  33262. $name = $this->defaultCommand;
  33263. $definition = $this->getDefinition();
  33264. $definition->setArguments(array_merge(
  33265. $definition->getArguments(),
  33266. array(
  33267. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  33268. )
  33269. ));
  33270. }
  33271. $this->runningCommand = null;
  33272. $command = $this->find($name);
  33273. $this->runningCommand = $command;
  33274. $exitCode = $this->doRunCommand($command, $input, $output);
  33275. $this->runningCommand = null;
  33276. return $exitCode;
  33277. }
  33278. public function setHelperSet(HelperSet $helperSet)
  33279. {
  33280. $this->helperSet = $helperSet;
  33281. }
  33282. public function getHelperSet()
  33283. {
  33284. if (!$this->helperSet) {
  33285. $this->helperSet = $this->getDefaultHelperSet();
  33286. }
  33287. return $this->helperSet;
  33288. }
  33289. public function setDefinition(InputDefinition $definition)
  33290. {
  33291. $this->definition = $definition;
  33292. }
  33293. public function getDefinition()
  33294. {
  33295. if (!$this->definition) {
  33296. $this->definition = $this->getDefaultInputDefinition();
  33297. }
  33298. return $this->definition;
  33299. }
  33300. public function getHelp()
  33301. {
  33302. return $this->getLongVersion();
  33303. }
  33304. public function setCatchExceptions($boolean)
  33305. {
  33306. $this->catchExceptions = (bool) $boolean;
  33307. }
  33308. public function setAutoExit($boolean)
  33309. {
  33310. $this->autoExit = (bool) $boolean;
  33311. }
  33312. public function getName()
  33313. {
  33314. return $this->name;
  33315. }
  33316. public function setName($name)
  33317. {
  33318. $this->name = $name;
  33319. }
  33320. public function getVersion()
  33321. {
  33322. return $this->version;
  33323. }
  33324. public function setVersion($version)
  33325. {
  33326. $this->version = $version;
  33327. }
  33328. public function getLongVersion()
  33329. {
  33330. if ('UNKNOWN' !== $this->getName()) {
  33331. if ('UNKNOWN' !== $this->getVersion()) {
  33332. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  33333. }
  33334. return sprintf('<info>%s</info>', $this->getName());
  33335. }
  33336. return '<info>Console Tool</info>';
  33337. }
  33338. public function register($name)
  33339. {
  33340. return $this->add(new Command($name));
  33341. }
  33342. public function addCommands(array $commands)
  33343. {
  33344. foreach ($commands as $command) {
  33345. $this->add($command);
  33346. }
  33347. }
  33348. public function add(Command $command)
  33349. {
  33350. $this->init();
  33351. $command->setApplication($this);
  33352. if (!$command->isEnabled()) {
  33353. $command->setApplication(null);
  33354. return;
  33355. }
  33356. if (null === $command->getDefinition()) {
  33357. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  33358. }
  33359. $this->commands[$command->getName()] = $command;
  33360. foreach ($command->getAliases() as $alias) {
  33361. $this->commands[$alias] = $command;
  33362. }
  33363. return $command;
  33364. }
  33365. public function get($name)
  33366. {
  33367. $this->init();
  33368. if (!isset($this->commands[$name])) {
  33369. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  33370. }
  33371. $command = $this->commands[$name];
  33372. if ($this->wantHelps) {
  33373. $this->wantHelps = false;
  33374. $helpCommand = $this->get('help');
  33375. $helpCommand->setCommand($command);
  33376. return $helpCommand;
  33377. }
  33378. return $command;
  33379. }
  33380. public function has($name)
  33381. {
  33382. $this->init();
  33383. return isset($this->commands[$name]);
  33384. }
  33385. public function getNamespaces()
  33386. {
  33387. $namespaces = array();
  33388. foreach ($this->all() as $command) {
  33389. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  33390. foreach ($command->getAliases() as $alias) {
  33391. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  33392. }
  33393. }
  33394. return array_values(array_unique(array_filter($namespaces)));
  33395. }
  33396. public function findNamespace($namespace)
  33397. {
  33398. $allNamespaces = $this->getNamespaces();
  33399. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  33400. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  33401. if (empty($namespaces)) {
  33402. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  33403. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  33404. if (1 == \count($alternatives)) {
  33405. $message .= "\n\nDid you mean this?\n ";
  33406. } else {
  33407. $message .= "\n\nDid you mean one of these?\n ";
  33408. }
  33409. $message .= implode("\n ", $alternatives);
  33410. }
  33411. throw new CommandNotFoundException($message, $alternatives);
  33412. }
  33413. $exact = \in_array($namespace, $namespaces, true);
  33414. if (\count($namespaces) > 1 && !$exact) {
  33415. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  33416. }
  33417. return $exact ? $namespace : reset($namespaces);
  33418. }
  33419. public function find($name)
  33420. {
  33421. $this->init();
  33422. $aliases = array();
  33423. $allCommands = array_keys($this->commands);
  33424. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  33425. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  33426. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  33427. if (false !== $pos = strrpos($name, ':')) {
  33428. $this->findNamespace(substr($name, 0, $pos));
  33429. }
  33430. $message = sprintf('Command "%s" is not defined.', $name);
  33431. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  33432. if (1 == \count($alternatives)) {
  33433. $message .= "\n\nDid you mean this?\n ";
  33434. } else {
  33435. $message .= "\n\nDid you mean one of these?\n ";
  33436. }
  33437. $message .= implode("\n ", $alternatives);
  33438. }
  33439. throw new CommandNotFoundException($message, $alternatives);
  33440. }
  33441. if (\count($commands) > 1) {
  33442. $commandList = $this->commands;
  33443. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  33444. $commandName = $commandList[$nameOrAlias]->getName();
  33445. $aliases[$nameOrAlias] = $commandName;
  33446. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  33447. });
  33448. }
  33449. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  33450. if (!$exact && \count($commands) > 1) {
  33451. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  33452. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  33453. }
  33454. return $this->get($exact ? $name : reset($commands));
  33455. }
  33456. public function all($namespace = null)
  33457. {
  33458. $this->init();
  33459. if (null === $namespace) {
  33460. return $this->commands;
  33461. }
  33462. $commands = array();
  33463. foreach ($this->commands as $name => $command) {
  33464. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  33465. $commands[$name] = $command;
  33466. }
  33467. }
  33468. return $commands;
  33469. }
  33470. public static function getAbbreviations($names)
  33471. {
  33472. $abbrevs = array();
  33473. foreach ($names as $name) {
  33474. for ($len = \strlen($name); $len > 0; --$len) {
  33475. $abbrev = substr($name, 0, $len);
  33476. $abbrevs[$abbrev][] = $name;
  33477. }
  33478. }
  33479. return $abbrevs;
  33480. }
  33481. public function asText($namespace = null, $raw = false)
  33482. {
  33483. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33484. $descriptor = new TextDescriptor();
  33485. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  33486. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  33487. return $output->fetch();
  33488. }
  33489. public function asXml($namespace = null, $asDom = false)
  33490. {
  33491. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33492. $descriptor = new XmlDescriptor();
  33493. if ($asDom) {
  33494. return $descriptor->getApplicationDocument($this, $namespace);
  33495. }
  33496. $output = new BufferedOutput();
  33497. $descriptor->describe($output, $this, array('namespace' => $namespace));
  33498. return $output->fetch();
  33499. }
  33500. public function renderException($e, $output)
  33501. {
  33502. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33503. do {
  33504. $title = sprintf(' [%s] ', \get_class($e));
  33505. $len = Helper::strlen($title);
  33506. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  33507. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  33508. $width = 1 << 31;
  33509. }
  33510. $lines = array();
  33511. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  33512. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  33513. $lineLength = Helper::strlen($line) + 4;
  33514. $lines[] = array($line, $lineLength);
  33515. $len = max($lineLength, $len);
  33516. }
  33517. }
  33518. $messages = array();
  33519. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  33520. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  33521. foreach ($lines as $line) {
  33522. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  33523. }
  33524. $messages[] = $emptyLine;
  33525. $messages[] = '';
  33526. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  33527. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  33528. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  33529. $trace = $e->getTrace();
  33530. array_unshift($trace, array(
  33531. 'function' => '',
  33532. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  33533. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  33534. 'args' => array(),
  33535. ));
  33536. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  33537. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  33538. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  33539. $function = $trace[$i]['function'];
  33540. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  33541. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  33542. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  33543. }
  33544. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33545. }
  33546. } while ($e = $e->getPrevious());
  33547. if (null !== $this->runningCommand) {
  33548. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  33549. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33550. }
  33551. }
  33552. protected function getTerminalWidth()
  33553. {
  33554. $dimensions = $this->getTerminalDimensions();
  33555. return $dimensions[0];
  33556. }
  33557. protected function getTerminalHeight()
  33558. {
  33559. $dimensions = $this->getTerminalDimensions();
  33560. return $dimensions[1];
  33561. }
  33562. public function getTerminalDimensions()
  33563. {
  33564. if ($this->terminalDimensions) {
  33565. return $this->terminalDimensions;
  33566. }
  33567. if ('\\' === \DIRECTORY_SEPARATOR) {
  33568. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  33569. return array((int) $matches[1], (int) $matches[2]);
  33570. }
  33571. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  33572. return array((int) $matches[1], (int) $matches[2]);
  33573. }
  33574. }
  33575. if ($sttyString = $this->getSttyColumns()) {
  33576. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  33577. return array((int) $matches[2], (int) $matches[1]);
  33578. }
  33579. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  33580. return array((int) $matches[2], (int) $matches[1]);
  33581. }
  33582. }
  33583. return array(null, null);
  33584. }
  33585. public function setTerminalDimensions($width, $height)
  33586. {
  33587. $this->terminalDimensions = array($width, $height);
  33588. return $this;
  33589. }
  33590. protected function configureIO(InputInterface $input, OutputInterface $output)
  33591. {
  33592. if (true === $input->hasParameterOption(array('--ansi'))) {
  33593. $output->setDecorated(true);
  33594. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  33595. $output->setDecorated(false);
  33596. }
  33597. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  33598. $input->setInteractive(false);
  33599. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  33600. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  33601. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  33602. $input->setInteractive(false);
  33603. }
  33604. }
  33605. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  33606. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  33607. $input->setInteractive(false);
  33608. } else {
  33609. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  33610. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  33611. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  33612. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  33613. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  33614. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  33615. }
  33616. }
  33617. }
  33618. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  33619. {
  33620. foreach ($command->getHelperSet() as $helper) {
  33621. if ($helper instanceof InputAwareInterface) {
  33622. $helper->setInput($input);
  33623. }
  33624. }
  33625. if (null === $this->dispatcher) {
  33626. return $command->run($input, $output);
  33627. }
  33628. try {
  33629. $command->mergeApplicationDefinition();
  33630. $input->bind($command->getDefinition());
  33631. } catch (ExceptionInterface $e) {
  33632. }
  33633. $event = new ConsoleCommandEvent($command, $input, $output);
  33634. $e = null;
  33635. try {
  33636. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  33637. if ($event->commandShouldRun()) {
  33638. $exitCode = $command->run($input, $output);
  33639. } else {
  33640. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  33641. }
  33642. } catch (\Exception $e) {
  33643. } catch (\Throwable $e) {
  33644. }
  33645. if (null !== $e) {
  33646. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  33647. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  33648. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  33649. if ($x !== $event->getException()) {
  33650. $e = $event->getException();
  33651. }
  33652. $exitCode = $this->getExitCodeForThrowable($e);
  33653. }
  33654. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  33655. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  33656. if (null !== $e) {
  33657. throw $e;
  33658. }
  33659. return $event->getExitCode();
  33660. }
  33661. protected function getCommandName(InputInterface $input)
  33662. {
  33663. return $input->getFirstArgument();
  33664. }
  33665. protected function getDefaultInputDefinition()
  33666. {
  33667. return new InputDefinition(array(
  33668. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  33669. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  33670. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  33671. 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'),
  33672. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  33673. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  33674. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  33675. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  33676. ));
  33677. }
  33678. protected function getDefaultCommands()
  33679. {
  33680. return array(new HelpCommand(), new ListCommand());
  33681. }
  33682. protected function getDefaultHelperSet()
  33683. {
  33684. return new HelperSet(array(
  33685. new FormatterHelper(),
  33686. new DialogHelper(false),
  33687. new ProgressHelper(false),
  33688. new TableHelper(false),
  33689. new DebugFormatterHelper(),
  33690. new ProcessHelper(),
  33691. new QuestionHelper(),
  33692. ));
  33693. }
  33694. private function getSttyColumns()
  33695. {
  33696. if (!\function_exists('proc_open')) {
  33697. return;
  33698. }
  33699. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33700. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33701. if (\is_resource($process)) {
  33702. $info = stream_get_contents($pipes[1]);
  33703. fclose($pipes[1]);
  33704. fclose($pipes[2]);
  33705. proc_close($process);
  33706. return $info;
  33707. }
  33708. }
  33709. private function getConsoleMode()
  33710. {
  33711. if (!\function_exists('proc_open')) {
  33712. return;
  33713. }
  33714. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33715. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33716. if (\is_resource($process)) {
  33717. $info = stream_get_contents($pipes[1]);
  33718. fclose($pipes[1]);
  33719. fclose($pipes[2]);
  33720. proc_close($process);
  33721. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  33722. return $matches[2].'x'.$matches[1];
  33723. }
  33724. }
  33725. }
  33726. private function getAbbreviationSuggestions($abbrevs)
  33727. {
  33728. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  33729. }
  33730. public function extractNamespace($name, $limit = null)
  33731. {
  33732. $parts = explode(':', $name);
  33733. array_pop($parts);
  33734. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  33735. }
  33736. private function findAlternatives($name, $collection)
  33737. {
  33738. $threshold = 1e3;
  33739. $alternatives = array();
  33740. $collectionParts = array();
  33741. foreach ($collection as $item) {
  33742. $collectionParts[$item] = explode(':', $item);
  33743. }
  33744. foreach (explode(':', $name) as $i => $subname) {
  33745. foreach ($collectionParts as $collectionName => $parts) {
  33746. $exists = isset($alternatives[$collectionName]);
  33747. if (!isset($parts[$i]) && $exists) {
  33748. $alternatives[$collectionName] += $threshold;
  33749. continue;
  33750. } elseif (!isset($parts[$i])) {
  33751. continue;
  33752. }
  33753. $lev = levenshtein($subname, $parts[$i]);
  33754. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  33755. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  33756. } elseif ($exists) {
  33757. $alternatives[$collectionName] += $threshold;
  33758. }
  33759. }
  33760. }
  33761. foreach ($collection as $item) {
  33762. $lev = levenshtein($name, $item);
  33763. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  33764. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  33765. }
  33766. }
  33767. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  33768. asort($alternatives);
  33769. return array_keys($alternatives);
  33770. }
  33771. public function setDefaultCommand($commandName)
  33772. {
  33773. $this->defaultCommand = $commandName;
  33774. }
  33775. private function splitStringByWidth($string, $width)
  33776. {
  33777. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33778. return str_split($string, $width);
  33779. }
  33780. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  33781. $lines = array();
  33782. $line = '';
  33783. foreach (preg_split('//u', $utf8String) as $char) {
  33784. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  33785. $line .= $char;
  33786. continue;
  33787. }
  33788. $lines[] = str_pad($line, $width);
  33789. $line = $char;
  33790. }
  33791. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  33792. mb_convert_variables($encoding, 'utf8', $lines);
  33793. return $lines;
  33794. }
  33795. private function extractAllNamespaces($name)
  33796. {
  33797. $parts = explode(':', $name, -1);
  33798. $namespaces = array();
  33799. foreach ($parts as $part) {
  33800. if (\count($namespaces)) {
  33801. $namespaces[] = end($namespaces).':'.$part;
  33802. } else {
  33803. $namespaces[] = $part;
  33804. }
  33805. }
  33806. return $namespaces;
  33807. }
  33808. private function init()
  33809. {
  33810. if ($this->initialized) {
  33811. return;
  33812. }
  33813. $this->initialized = true;
  33814. foreach ($this->getDefaultCommands() as $command) {
  33815. $this->add($command);
  33816. }
  33817. }
  33818. private function getExitCodeForThrowable($throwable)
  33819. {
  33820. $exitCode = $throwable->getCode();
  33821. if (is_numeric($exitCode)) {
  33822. $exitCode = (int) $exitCode;
  33823. if (0 === $exitCode) {
  33824. $exitCode = 1;
  33825. }
  33826. } else {
  33827. $exitCode = 1;
  33828. }
  33829. return $exitCode;
  33830. }
  33831. }
  33832. <?php
  33833. namespace Symfony\Component\Console\Command;
  33834. use Symfony\Component\Console\Application;
  33835. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33836. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33837. use Symfony\Component\Console\Exception\ExceptionInterface;
  33838. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33839. use Symfony\Component\Console\Exception\LogicException;
  33840. use Symfony\Component\Console\Helper\HelperSet;
  33841. use Symfony\Component\Console\Input\InputArgument;
  33842. use Symfony\Component\Console\Input\InputDefinition;
  33843. use Symfony\Component\Console\Input\InputInterface;
  33844. use Symfony\Component\Console\Input\InputOption;
  33845. use Symfony\Component\Console\Output\BufferedOutput;
  33846. use Symfony\Component\Console\Output\OutputInterface;
  33847. class Command
  33848. {
  33849. private $application;
  33850. private $name;
  33851. private $processTitle;
  33852. private $aliases = array();
  33853. private $definition;
  33854. private $help;
  33855. private $description;
  33856. private $ignoreValidationErrors = false;
  33857. private $applicationDefinitionMerged = false;
  33858. private $applicationDefinitionMergedWithArgs = false;
  33859. private $code;
  33860. private $synopsis = array();
  33861. private $usages = array();
  33862. private $helperSet;
  33863. public function __construct($name = null)
  33864. {
  33865. $this->definition = new InputDefinition();
  33866. if (null !== $name) {
  33867. $this->setName($name);
  33868. }
  33869. $this->configure();
  33870. if (!$this->name) {
  33871. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  33872. }
  33873. }
  33874. public function ignoreValidationErrors()
  33875. {
  33876. $this->ignoreValidationErrors = true;
  33877. }
  33878. public function setApplication(Application $application = null)
  33879. {
  33880. $this->application = $application;
  33881. if ($application) {
  33882. $this->setHelperSet($application->getHelperSet());
  33883. } else {
  33884. $this->helperSet = null;
  33885. }
  33886. }
  33887. public function setHelperSet(HelperSet $helperSet)
  33888. {
  33889. $this->helperSet = $helperSet;
  33890. }
  33891. public function getHelperSet()
  33892. {
  33893. return $this->helperSet;
  33894. }
  33895. public function getApplication()
  33896. {
  33897. return $this->application;
  33898. }
  33899. public function isEnabled()
  33900. {
  33901. return true;
  33902. }
  33903. protected function configure()
  33904. {
  33905. }
  33906. protected function execute(InputInterface $input, OutputInterface $output)
  33907. {
  33908. throw new LogicException('You must override the execute() method in the concrete command class.');
  33909. }
  33910. protected function interact(InputInterface $input, OutputInterface $output)
  33911. {
  33912. }
  33913. protected function initialize(InputInterface $input, OutputInterface $output)
  33914. {
  33915. }
  33916. public function run(InputInterface $input, OutputInterface $output)
  33917. {
  33918. $this->getSynopsis(true);
  33919. $this->getSynopsis(false);
  33920. $this->mergeApplicationDefinition();
  33921. try {
  33922. $input->bind($this->definition);
  33923. } catch (ExceptionInterface $e) {
  33924. if (!$this->ignoreValidationErrors) {
  33925. throw $e;
  33926. }
  33927. }
  33928. $this->initialize($input, $output);
  33929. if (null !== $this->processTitle) {
  33930. if (\function_exists('cli_set_process_title')) {
  33931. if (!@cli_set_process_title($this->processTitle)) {
  33932. if ('Darwin' === PHP_OS) {
  33933. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  33934. } else {
  33935. cli_set_process_title($this->processTitle);
  33936. }
  33937. }
  33938. } elseif (\function_exists('setproctitle')) {
  33939. setproctitle($this->processTitle);
  33940. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  33941. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  33942. }
  33943. }
  33944. if ($input->isInteractive()) {
  33945. $this->interact($input, $output);
  33946. }
  33947. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  33948. $input->setArgument('command', $this->getName());
  33949. }
  33950. $input->validate();
  33951. if ($this->code) {
  33952. $statusCode = \call_user_func($this->code, $input, $output);
  33953. } else {
  33954. $statusCode = $this->execute($input, $output);
  33955. }
  33956. return is_numeric($statusCode) ? (int) $statusCode : 0;
  33957. }
  33958. public function setCode($code)
  33959. {
  33960. if (!\is_callable($code)) {
  33961. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  33962. }
  33963. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  33964. $r = new \ReflectionFunction($code);
  33965. if (null === $r->getClosureThis()) {
  33966. if (\PHP_VERSION_ID < 70000) {
  33967. $code = @\Closure::bind($code, $this);
  33968. } else {
  33969. $code = \Closure::bind($code, $this);
  33970. }
  33971. }
  33972. }
  33973. $this->code = $code;
  33974. return $this;
  33975. }
  33976. public function mergeApplicationDefinition($mergeArgs = true)
  33977. {
  33978. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  33979. return;
  33980. }
  33981. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  33982. $this->applicationDefinitionMerged = true;
  33983. if ($mergeArgs) {
  33984. $currentArguments = $this->definition->getArguments();
  33985. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  33986. $this->definition->addArguments($currentArguments);
  33987. $this->applicationDefinitionMergedWithArgs = true;
  33988. }
  33989. }
  33990. public function setDefinition($definition)
  33991. {
  33992. if ($definition instanceof InputDefinition) {
  33993. $this->definition = $definition;
  33994. } else {
  33995. $this->definition->setDefinition($definition);
  33996. }
  33997. $this->applicationDefinitionMerged = false;
  33998. return $this;
  33999. }
  34000. public function getDefinition()
  34001. {
  34002. return $this->definition;
  34003. }
  34004. public function getNativeDefinition()
  34005. {
  34006. return $this->getDefinition();
  34007. }
  34008. public function addArgument($name, $mode = null, $description = '', $default = null)
  34009. {
  34010. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  34011. return $this;
  34012. }
  34013. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  34014. {
  34015. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  34016. return $this;
  34017. }
  34018. public function setName($name)
  34019. {
  34020. $this->validateName($name);
  34021. $this->name = $name;
  34022. return $this;
  34023. }
  34024. public function setProcessTitle($title)
  34025. {
  34026. $this->processTitle = $title;
  34027. return $this;
  34028. }
  34029. public function getName()
  34030. {
  34031. return $this->name;
  34032. }
  34033. public function setDescription($description)
  34034. {
  34035. $this->description = $description;
  34036. return $this;
  34037. }
  34038. public function getDescription()
  34039. {
  34040. return $this->description;
  34041. }
  34042. public function setHelp($help)
  34043. {
  34044. $this->help = $help;
  34045. return $this;
  34046. }
  34047. public function getHelp()
  34048. {
  34049. return $this->help;
  34050. }
  34051. public function getProcessedHelp()
  34052. {
  34053. $name = $this->name;
  34054. $placeholders = array(
  34055. '%command.name%',
  34056. '%command.full_name%',
  34057. );
  34058. $replacements = array(
  34059. $name,
  34060. $_SERVER['PHP_SELF'].' '.$name,
  34061. );
  34062. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  34063. }
  34064. public function setAliases($aliases)
  34065. {
  34066. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  34067. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  34068. }
  34069. foreach ($aliases as $alias) {
  34070. $this->validateName($alias);
  34071. }
  34072. $this->aliases = $aliases;
  34073. return $this;
  34074. }
  34075. public function getAliases()
  34076. {
  34077. return $this->aliases;
  34078. }
  34079. public function getSynopsis($short = false)
  34080. {
  34081. $key = $short ? 'short' : 'long';
  34082. if (!isset($this->synopsis[$key])) {
  34083. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  34084. }
  34085. return $this->synopsis[$key];
  34086. }
  34087. public function addUsage($usage)
  34088. {
  34089. if (0 !== strpos($usage, $this->name)) {
  34090. $usage = sprintf('%s %s', $this->name, $usage);
  34091. }
  34092. $this->usages[] = $usage;
  34093. return $this;
  34094. }
  34095. public function getUsages()
  34096. {
  34097. return $this->usages;
  34098. }
  34099. public function getHelper($name)
  34100. {
  34101. if (null === $this->helperSet) {
  34102. 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));
  34103. }
  34104. return $this->helperSet->get($name);
  34105. }
  34106. public function asText()
  34107. {
  34108. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34109. $descriptor = new TextDescriptor();
  34110. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  34111. $descriptor->describe($output, $this, array('raw_output' => true));
  34112. return $output->fetch();
  34113. }
  34114. public function asXml($asDom = false)
  34115. {
  34116. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34117. $descriptor = new XmlDescriptor();
  34118. if ($asDom) {
  34119. return $descriptor->getCommandDocument($this);
  34120. }
  34121. $output = new BufferedOutput();
  34122. $descriptor->describe($output, $this);
  34123. return $output->fetch();
  34124. }
  34125. private function validateName($name)
  34126. {
  34127. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  34128. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  34129. }
  34130. }
  34131. }
  34132. <?php
  34133. namespace Symfony\Component\Console\Command;
  34134. use Symfony\Component\Console\Helper\DescriptorHelper;
  34135. use Symfony\Component\Console\Input\InputArgument;
  34136. use Symfony\Component\Console\Input\InputInterface;
  34137. use Symfony\Component\Console\Input\InputOption;
  34138. use Symfony\Component\Console\Output\OutputInterface;
  34139. class HelpCommand extends Command
  34140. {
  34141. private $command;
  34142. protected function configure()
  34143. {
  34144. $this->ignoreValidationErrors();
  34145. $this
  34146. ->setName('help')
  34147. ->setDefinition(array(
  34148. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  34149. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  34150. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34151. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  34152. ))
  34153. ->setDescription('Displays help for a command')
  34154. ->setHelp(<<<'EOF'
  34155. The <info>%command.name%</info> command displays help for a given command:
  34156. <info>php %command.full_name% list</info>
  34157. You can also output the help in other formats by using the <comment>--format</comment> option:
  34158. <info>php %command.full_name% --format=xml list</info>
  34159. To display the list of available commands, please use the <info>list</info> command.
  34160. EOF
  34161. )
  34162. ;
  34163. }
  34164. public function setCommand(Command $command)
  34165. {
  34166. $this->command = $command;
  34167. }
  34168. protected function execute(InputInterface $input, OutputInterface $output)
  34169. {
  34170. if (null === $this->command) {
  34171. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  34172. }
  34173. if ($input->getOption('xml')) {
  34174. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  34175. $input->setOption('format', 'xml');
  34176. }
  34177. $helper = new DescriptorHelper();
  34178. $helper->describe($output, $this->command, array(
  34179. 'format' => $input->getOption('format'),
  34180. 'raw_text' => $input->getOption('raw'),
  34181. ));
  34182. $this->command = null;
  34183. }
  34184. }
  34185. <?php
  34186. namespace Symfony\Component\Console\Command;
  34187. use Symfony\Component\Console\Helper\DescriptorHelper;
  34188. use Symfony\Component\Console\Input\InputArgument;
  34189. use Symfony\Component\Console\Input\InputDefinition;
  34190. use Symfony\Component\Console\Input\InputInterface;
  34191. use Symfony\Component\Console\Input\InputOption;
  34192. use Symfony\Component\Console\Output\OutputInterface;
  34193. class ListCommand extends Command
  34194. {
  34195. protected function configure()
  34196. {
  34197. $this
  34198. ->setName('list')
  34199. ->setDefinition($this->createDefinition())
  34200. ->setDescription('Lists commands')
  34201. ->setHelp(<<<'EOF'
  34202. The <info>%command.name%</info> command lists all commands:
  34203. <info>php %command.full_name%</info>
  34204. You can also display the commands for a specific namespace:
  34205. <info>php %command.full_name% test</info>
  34206. You can also output the information in other formats by using the <comment>--format</comment> option:
  34207. <info>php %command.full_name% --format=xml</info>
  34208. It's also possible to get raw list of commands (useful for embedding command runner):
  34209. <info>php %command.full_name% --raw</info>
  34210. EOF
  34211. )
  34212. ;
  34213. }
  34214. public function getNativeDefinition()
  34215. {
  34216. return $this->createDefinition();
  34217. }
  34218. protected function execute(InputInterface $input, OutputInterface $output)
  34219. {
  34220. if ($input->getOption('xml')) {
  34221. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  34222. $input->setOption('format', 'xml');
  34223. }
  34224. $helper = new DescriptorHelper();
  34225. $helper->describe($output, $this->getApplication(), array(
  34226. 'format' => $input->getOption('format'),
  34227. 'raw_text' => $input->getOption('raw'),
  34228. 'namespace' => $input->getArgument('namespace'),
  34229. ));
  34230. }
  34231. private function createDefinition()
  34232. {
  34233. return new InputDefinition(array(
  34234. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  34235. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  34236. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  34237. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34238. ));
  34239. }
  34240. }
  34241. <?php
  34242. namespace Symfony\Component\Console;
  34243. final class ConsoleEvents
  34244. {
  34245. const COMMAND = 'console.command';
  34246. const TERMINATE = 'console.terminate';
  34247. const EXCEPTION = 'console.exception';
  34248. }
  34249. <?php
  34250. namespace Symfony\Component\Console\Descriptor;
  34251. use Symfony\Component\Console\Application;
  34252. use Symfony\Component\Console\Command\Command;
  34253. use Symfony\Component\Console\Exception\CommandNotFoundException;
  34254. class ApplicationDescription
  34255. {
  34256. const GLOBAL_NAMESPACE = '_global';
  34257. private $application;
  34258. private $namespace;
  34259. private $namespaces;
  34260. private $commands;
  34261. private $aliases;
  34262. public function __construct(Application $application, $namespace = null)
  34263. {
  34264. $this->application = $application;
  34265. $this->namespace = $namespace;
  34266. }
  34267. public function getNamespaces()
  34268. {
  34269. if (null === $this->namespaces) {
  34270. $this->inspectApplication();
  34271. }
  34272. return $this->namespaces;
  34273. }
  34274. public function getCommands()
  34275. {
  34276. if (null === $this->commands) {
  34277. $this->inspectApplication();
  34278. }
  34279. return $this->commands;
  34280. }
  34281. public function getCommand($name)
  34282. {
  34283. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  34284. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  34285. }
  34286. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  34287. }
  34288. private function inspectApplication()
  34289. {
  34290. $this->commands = array();
  34291. $this->namespaces = array();
  34292. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  34293. foreach ($this->sortCommands($all) as $namespace => $commands) {
  34294. $names = array();
  34295. foreach ($commands as $name => $command) {
  34296. if (!$command->getName()) {
  34297. continue;
  34298. }
  34299. if ($command->getName() === $name) {
  34300. $this->commands[$name] = $command;
  34301. } else {
  34302. $this->aliases[$name] = $command;
  34303. }
  34304. $names[] = $name;
  34305. }
  34306. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  34307. }
  34308. }
  34309. private function sortCommands(array $commands)
  34310. {
  34311. $namespacedCommands = array();
  34312. $globalCommands = array();
  34313. foreach ($commands as $name => $command) {
  34314. $key = $this->application->extractNamespace($name, 1);
  34315. if (!$key) {
  34316. $globalCommands['_global'][$name] = $command;
  34317. } else {
  34318. $namespacedCommands[$key][$name] = $command;
  34319. }
  34320. }
  34321. ksort($namespacedCommands);
  34322. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  34323. foreach ($namespacedCommands as &$commandsSet) {
  34324. ksort($commandsSet);
  34325. }
  34326. unset($commandsSet);
  34327. return $namespacedCommands;
  34328. }
  34329. }
  34330. <?php
  34331. namespace Symfony\Component\Console\Descriptor;
  34332. use Symfony\Component\Console\Application;
  34333. use Symfony\Component\Console\Command\Command;
  34334. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34335. use Symfony\Component\Console\Input\InputArgument;
  34336. use Symfony\Component\Console\Input\InputDefinition;
  34337. use Symfony\Component\Console\Input\InputOption;
  34338. use Symfony\Component\Console\Output\OutputInterface;
  34339. abstract class Descriptor implements DescriptorInterface
  34340. {
  34341. private $output;
  34342. public function describe(OutputInterface $output, $object, array $options = array())
  34343. {
  34344. $this->output = $output;
  34345. switch (true) {
  34346. case $object instanceof InputArgument:
  34347. $this->describeInputArgument($object, $options);
  34348. break;
  34349. case $object instanceof InputOption:
  34350. $this->describeInputOption($object, $options);
  34351. break;
  34352. case $object instanceof InputDefinition:
  34353. $this->describeInputDefinition($object, $options);
  34354. break;
  34355. case $object instanceof Command:
  34356. $this->describeCommand($object, $options);
  34357. break;
  34358. case $object instanceof Application:
  34359. $this->describeApplication($object, $options);
  34360. break;
  34361. default:
  34362. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  34363. }
  34364. }
  34365. protected function write($content, $decorated = false)
  34366. {
  34367. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  34368. }
  34369. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  34370. abstract protected function describeInputOption(InputOption $option, array $options = array());
  34371. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  34372. abstract protected function describeCommand(Command $command, array $options = array());
  34373. abstract protected function describeApplication(Application $application, array $options = array());
  34374. }
  34375. <?php
  34376. namespace Symfony\Component\Console\Descriptor;
  34377. use Symfony\Component\Console\Output\OutputInterface;
  34378. interface DescriptorInterface
  34379. {
  34380. public function describe(OutputInterface $output, $object, array $options = array());
  34381. }
  34382. <?php
  34383. namespace Symfony\Component\Console\Descriptor;
  34384. use Symfony\Component\Console\Application;
  34385. use Symfony\Component\Console\Command\Command;
  34386. use Symfony\Component\Console\Input\InputArgument;
  34387. use Symfony\Component\Console\Input\InputDefinition;
  34388. use Symfony\Component\Console\Input\InputOption;
  34389. class JsonDescriptor extends Descriptor
  34390. {
  34391. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34392. {
  34393. $this->writeData($this->getInputArgumentData($argument), $options);
  34394. }
  34395. protected function describeInputOption(InputOption $option, array $options = array())
  34396. {
  34397. $this->writeData($this->getInputOptionData($option), $options);
  34398. }
  34399. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34400. {
  34401. $this->writeData($this->getInputDefinitionData($definition), $options);
  34402. }
  34403. protected function describeCommand(Command $command, array $options = array())
  34404. {
  34405. $this->writeData($this->getCommandData($command), $options);
  34406. }
  34407. protected function describeApplication(Application $application, array $options = array())
  34408. {
  34409. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34410. $description = new ApplicationDescription($application, $describedNamespace);
  34411. $commands = array();
  34412. foreach ($description->getCommands() as $command) {
  34413. $commands[] = $this->getCommandData($command);
  34414. }
  34415. $data = $describedNamespace
  34416. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  34417. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  34418. $this->writeData($data, $options);
  34419. }
  34420. private function writeData(array $data, array $options)
  34421. {
  34422. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  34423. }
  34424. private function getInputArgumentData(InputArgument $argument)
  34425. {
  34426. return array(
  34427. 'name' => $argument->getName(),
  34428. 'is_required' => $argument->isRequired(),
  34429. 'is_array' => $argument->isArray(),
  34430. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  34431. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  34432. );
  34433. }
  34434. private function getInputOptionData(InputOption $option)
  34435. {
  34436. return array(
  34437. 'name' => '--'.$option->getName(),
  34438. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  34439. 'accept_value' => $option->acceptValue(),
  34440. 'is_value_required' => $option->isValueRequired(),
  34441. 'is_multiple' => $option->isArray(),
  34442. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  34443. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  34444. );
  34445. }
  34446. private function getInputDefinitionData(InputDefinition $definition)
  34447. {
  34448. $inputArguments = array();
  34449. foreach ($definition->getArguments() as $name => $argument) {
  34450. $inputArguments[$name] = $this->getInputArgumentData($argument);
  34451. }
  34452. $inputOptions = array();
  34453. foreach ($definition->getOptions() as $name => $option) {
  34454. $inputOptions[$name] = $this->getInputOptionData($option);
  34455. }
  34456. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  34457. }
  34458. private function getCommandData(Command $command)
  34459. {
  34460. $command->getSynopsis();
  34461. $command->mergeApplicationDefinition(false);
  34462. return array(
  34463. 'name' => $command->getName(),
  34464. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  34465. 'description' => $command->getDescription(),
  34466. 'help' => $command->getProcessedHelp(),
  34467. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  34468. );
  34469. }
  34470. }
  34471. <?php
  34472. namespace Symfony\Component\Console\Descriptor;
  34473. use Symfony\Component\Console\Application;
  34474. use Symfony\Component\Console\Command\Command;
  34475. use Symfony\Component\Console\Helper\Helper;
  34476. use Symfony\Component\Console\Input\InputArgument;
  34477. use Symfony\Component\Console\Input\InputDefinition;
  34478. use Symfony\Component\Console\Input\InputOption;
  34479. class MarkdownDescriptor extends Descriptor
  34480. {
  34481. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34482. {
  34483. $this->write(
  34484. '**'.$argument->getName().':**'."\n\n"
  34485. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  34486. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  34487. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  34488. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  34489. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  34490. );
  34491. }
  34492. protected function describeInputOption(InputOption $option, array $options = array())
  34493. {
  34494. $this->write(
  34495. '**'.$option->getName().':**'."\n\n"
  34496. .'* Name: `--'.$option->getName().'`'."\n"
  34497. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  34498. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  34499. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  34500. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  34501. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  34502. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  34503. );
  34504. }
  34505. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34506. {
  34507. if ($showArguments = \count($definition->getArguments()) > 0) {
  34508. $this->write('### Arguments:');
  34509. foreach ($definition->getArguments() as $argument) {
  34510. $this->write("\n\n");
  34511. $this->write($this->describeInputArgument($argument));
  34512. }
  34513. }
  34514. if (\count($definition->getOptions()) > 0) {
  34515. if ($showArguments) {
  34516. $this->write("\n\n");
  34517. }
  34518. $this->write('### Options:');
  34519. foreach ($definition->getOptions() as $option) {
  34520. $this->write("\n\n");
  34521. $this->write($this->describeInputOption($option));
  34522. }
  34523. }
  34524. }
  34525. protected function describeCommand(Command $command, array $options = array())
  34526. {
  34527. $command->getSynopsis();
  34528. $command->mergeApplicationDefinition(false);
  34529. $this->write(
  34530. $command->getName()."\n"
  34531. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  34532. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  34533. .'* Usage:'."\n\n"
  34534. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  34535. return $carry.' * `'.$usage.'`'."\n";
  34536. })
  34537. );
  34538. if ($help = $command->getProcessedHelp()) {
  34539. $this->write("\n");
  34540. $this->write($help);
  34541. }
  34542. if ($command->getNativeDefinition()) {
  34543. $this->write("\n\n");
  34544. $this->describeInputDefinition($command->getNativeDefinition());
  34545. }
  34546. }
  34547. protected function describeApplication(Application $application, array $options = array())
  34548. {
  34549. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34550. $description = new ApplicationDescription($application, $describedNamespace);
  34551. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  34552. foreach ($description->getNamespaces() as $namespace) {
  34553. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34554. $this->write("\n\n");
  34555. $this->write('**'.$namespace['id'].':**');
  34556. }
  34557. $this->write("\n\n");
  34558. $this->write(implode("\n", array_map(function ($commandName) {
  34559. return '* '.$commandName;
  34560. }, $namespace['commands'])));
  34561. }
  34562. foreach ($description->getCommands() as $command) {
  34563. $this->write("\n\n");
  34564. $this->write($this->describeCommand($command));
  34565. }
  34566. }
  34567. }
  34568. <?php
  34569. namespace Symfony\Component\Console\Descriptor;
  34570. use Symfony\Component\Console\Application;
  34571. use Symfony\Component\Console\Command\Command;
  34572. use Symfony\Component\Console\Formatter\OutputFormatter;
  34573. use Symfony\Component\Console\Helper\Helper;
  34574. use Symfony\Component\Console\Input\InputArgument;
  34575. use Symfony\Component\Console\Input\InputDefinition;
  34576. use Symfony\Component\Console\Input\InputOption;
  34577. class TextDescriptor extends Descriptor
  34578. {
  34579. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34580. {
  34581. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  34582. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  34583. } else {
  34584. $default = '';
  34585. }
  34586. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  34587. $spacingWidth = $totalWidth - \strlen($argument->getName());
  34588. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  34589. $argument->getName(),
  34590. str_repeat(' ', $spacingWidth),
  34591. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  34592. $default
  34593. ), $options);
  34594. }
  34595. protected function describeInputOption(InputOption $option, array $options = array())
  34596. {
  34597. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  34598. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  34599. } else {
  34600. $default = '';
  34601. }
  34602. $value = '';
  34603. if ($option->acceptValue()) {
  34604. $value = '='.strtoupper($option->getName());
  34605. if ($option->isValueOptional()) {
  34606. $value = '['.$value.']';
  34607. }
  34608. }
  34609. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  34610. $synopsis = sprintf('%s%s',
  34611. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  34612. sprintf('--%s%s', $option->getName(), $value)
  34613. );
  34614. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  34615. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  34616. $synopsis,
  34617. str_repeat(' ', $spacingWidth),
  34618. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  34619. $default,
  34620. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  34621. ), $options);
  34622. }
  34623. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34624. {
  34625. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  34626. foreach ($definition->getArguments() as $argument) {
  34627. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  34628. }
  34629. if ($definition->getArguments()) {
  34630. $this->writeText('<comment>Arguments:</comment>', $options);
  34631. $this->writeText("\n");
  34632. foreach ($definition->getArguments() as $argument) {
  34633. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  34634. $this->writeText("\n");
  34635. }
  34636. }
  34637. if ($definition->getArguments() && $definition->getOptions()) {
  34638. $this->writeText("\n");
  34639. }
  34640. if ($definition->getOptions()) {
  34641. $laterOptions = array();
  34642. $this->writeText('<comment>Options:</comment>', $options);
  34643. foreach ($definition->getOptions() as $option) {
  34644. if (\strlen($option->getShortcut()) > 1) {
  34645. $laterOptions[] = $option;
  34646. continue;
  34647. }
  34648. $this->writeText("\n");
  34649. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34650. }
  34651. foreach ($laterOptions as $option) {
  34652. $this->writeText("\n");
  34653. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34654. }
  34655. }
  34656. }
  34657. protected function describeCommand(Command $command, array $options = array())
  34658. {
  34659. $command->getSynopsis(true);
  34660. $command->getSynopsis(false);
  34661. $command->mergeApplicationDefinition(false);
  34662. $this->writeText('<comment>Usage:</comment>', $options);
  34663. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  34664. $this->writeText("\n");
  34665. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  34666. }
  34667. $this->writeText("\n");
  34668. $definition = $command->getNativeDefinition();
  34669. if ($definition->getOptions() || $definition->getArguments()) {
  34670. $this->writeText("\n");
  34671. $this->describeInputDefinition($definition, $options);
  34672. $this->writeText("\n");
  34673. }
  34674. if ($help = $command->getProcessedHelp()) {
  34675. $this->writeText("\n");
  34676. $this->writeText('<comment>Help:</comment>', $options);
  34677. $this->writeText("\n");
  34678. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  34679. $this->writeText("\n");
  34680. }
  34681. }
  34682. protected function describeApplication(Application $application, array $options = array())
  34683. {
  34684. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34685. $description = new ApplicationDescription($application, $describedNamespace);
  34686. if (isset($options['raw_text']) && $options['raw_text']) {
  34687. $width = $this->getColumnWidth($description->getCommands());
  34688. foreach ($description->getCommands() as $command) {
  34689. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  34690. $this->writeText("\n");
  34691. }
  34692. } else {
  34693. if ('' != $help = $application->getHelp()) {
  34694. $this->writeText("$help\n\n", $options);
  34695. }
  34696. $this->writeText("<comment>Usage:</comment>\n", $options);
  34697. $this->writeText(" command [options] [arguments]\n\n", $options);
  34698. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  34699. $this->writeText("\n");
  34700. $this->writeText("\n");
  34701. $width = $this->getColumnWidth($description->getCommands());
  34702. if ($describedNamespace) {
  34703. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  34704. } else {
  34705. $this->writeText('<comment>Available commands:</comment>', $options);
  34706. }
  34707. foreach ($description->getNamespaces() as $namespace) {
  34708. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34709. $this->writeText("\n");
  34710. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  34711. }
  34712. foreach ($namespace['commands'] as $name) {
  34713. $this->writeText("\n");
  34714. $spacingWidth = $width - Helper::strlen($name);
  34715. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  34716. }
  34717. }
  34718. $this->writeText("\n");
  34719. }
  34720. }
  34721. private function writeText($content, array $options = array())
  34722. {
  34723. $this->write(
  34724. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  34725. isset($options['raw_output']) ? !$options['raw_output'] : true
  34726. );
  34727. }
  34728. private function formatDefaultValue($default)
  34729. {
  34730. if (INF === $default) {
  34731. return 'INF';
  34732. }
  34733. if (\is_string($default)) {
  34734. $default = OutputFormatter::escape($default);
  34735. } elseif (\is_array($default)) {
  34736. foreach ($default as $key => $value) {
  34737. if (\is_string($value)) {
  34738. $default[$key] = OutputFormatter::escape($value);
  34739. }
  34740. }
  34741. }
  34742. if (\PHP_VERSION_ID < 50400) {
  34743. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  34744. }
  34745. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  34746. }
  34747. private function getColumnWidth(array $commands)
  34748. {
  34749. $widths = array();
  34750. foreach ($commands as $command) {
  34751. $widths[] = Helper::strlen($command->getName());
  34752. foreach ($command->getAliases() as $alias) {
  34753. $widths[] = Helper::strlen($alias);
  34754. }
  34755. }
  34756. return max($widths) + 2;
  34757. }
  34758. private function calculateTotalWidthForOptions(array $options)
  34759. {
  34760. $totalWidth = 0;
  34761. foreach ($options as $option) {
  34762. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  34763. if ($option->acceptValue()) {
  34764. $valueLength = 1 + Helper::strlen($option->getName());
  34765. $valueLength += $option->isValueOptional() ? 2 : 0;
  34766. $nameLength += $valueLength;
  34767. }
  34768. $totalWidth = max($totalWidth, $nameLength);
  34769. }
  34770. return $totalWidth;
  34771. }
  34772. }
  34773. <?php
  34774. namespace Symfony\Component\Console\Descriptor;
  34775. use Symfony\Component\Console\Application;
  34776. use Symfony\Component\Console\Command\Command;
  34777. use Symfony\Component\Console\Input\InputArgument;
  34778. use Symfony\Component\Console\Input\InputDefinition;
  34779. use Symfony\Component\Console\Input\InputOption;
  34780. class XmlDescriptor extends Descriptor
  34781. {
  34782. public function getInputDefinitionDocument(InputDefinition $definition)
  34783. {
  34784. $dom = new \DOMDocument('1.0', 'UTF-8');
  34785. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  34786. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  34787. foreach ($definition->getArguments() as $argument) {
  34788. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  34789. }
  34790. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  34791. foreach ($definition->getOptions() as $option) {
  34792. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  34793. }
  34794. return $dom;
  34795. }
  34796. public function getCommandDocument(Command $command)
  34797. {
  34798. $dom = new \DOMDocument('1.0', 'UTF-8');
  34799. $dom->appendChild($commandXML = $dom->createElement('command'));
  34800. $command->getSynopsis();
  34801. $command->mergeApplicationDefinition(false);
  34802. $commandXML->setAttribute('id', $command->getName());
  34803. $commandXML->setAttribute('name', $command->getName());
  34804. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  34805. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  34806. $usagesXML->appendChild($dom->createElement('usage', $usage));
  34807. }
  34808. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  34809. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  34810. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  34811. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  34812. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  34813. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  34814. return $dom;
  34815. }
  34816. public function getApplicationDocument(Application $application, $namespace = null)
  34817. {
  34818. $dom = new \DOMDocument('1.0', 'UTF-8');
  34819. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  34820. if ('UNKNOWN' !== $application->getName()) {
  34821. $rootXml->setAttribute('name', $application->getName());
  34822. if ('UNKNOWN' !== $application->getVersion()) {
  34823. $rootXml->setAttribute('version', $application->getVersion());
  34824. }
  34825. }
  34826. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  34827. $description = new ApplicationDescription($application, $namespace);
  34828. if ($namespace) {
  34829. $commandsXML->setAttribute('namespace', $namespace);
  34830. }
  34831. foreach ($description->getCommands() as $command) {
  34832. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  34833. }
  34834. if (!$namespace) {
  34835. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  34836. foreach ($description->getNamespaces() as $namespaceDescription) {
  34837. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  34838. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  34839. foreach ($namespaceDescription['commands'] as $name) {
  34840. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  34841. $commandXML->appendChild($dom->createTextNode($name));
  34842. }
  34843. }
  34844. }
  34845. return $dom;
  34846. }
  34847. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34848. {
  34849. $this->writeDocument($this->getInputArgumentDocument($argument));
  34850. }
  34851. protected function describeInputOption(InputOption $option, array $options = array())
  34852. {
  34853. $this->writeDocument($this->getInputOptionDocument($option));
  34854. }
  34855. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34856. {
  34857. $this->writeDocument($this->getInputDefinitionDocument($definition));
  34858. }
  34859. protected function describeCommand(Command $command, array $options = array())
  34860. {
  34861. $this->writeDocument($this->getCommandDocument($command));
  34862. }
  34863. protected function describeApplication(Application $application, array $options = array())
  34864. {
  34865. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  34866. }
  34867. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  34868. {
  34869. foreach ($importedParent->childNodes as $childNode) {
  34870. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  34871. }
  34872. }
  34873. private function writeDocument(\DOMDocument $dom)
  34874. {
  34875. $dom->formatOutput = true;
  34876. $this->write($dom->saveXML());
  34877. }
  34878. private function getInputArgumentDocument(InputArgument $argument)
  34879. {
  34880. $dom = new \DOMDocument('1.0', 'UTF-8');
  34881. $dom->appendChild($objectXML = $dom->createElement('argument'));
  34882. $objectXML->setAttribute('name', $argument->getName());
  34883. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  34884. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  34885. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34886. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  34887. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34888. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  34889. foreach ($defaults as $default) {
  34890. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34891. $defaultXML->appendChild($dom->createTextNode($default));
  34892. }
  34893. return $dom;
  34894. }
  34895. private function getInputOptionDocument(InputOption $option)
  34896. {
  34897. $dom = new \DOMDocument('1.0', 'UTF-8');
  34898. $dom->appendChild($objectXML = $dom->createElement('option'));
  34899. $objectXML->setAttribute('name', '--'.$option->getName());
  34900. $pos = strpos($option->getShortcut(), '|');
  34901. if (false !== $pos) {
  34902. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  34903. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  34904. } else {
  34905. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  34906. }
  34907. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  34908. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  34909. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  34910. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34911. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  34912. if ($option->acceptValue()) {
  34913. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  34914. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34915. if (!empty($defaults)) {
  34916. foreach ($defaults as $default) {
  34917. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34918. $defaultXML->appendChild($dom->createTextNode($default));
  34919. }
  34920. }
  34921. }
  34922. return $dom;
  34923. }
  34924. }
  34925. <?php
  34926. namespace Symfony\Component\Console\Event;
  34927. class ConsoleCommandEvent extends ConsoleEvent
  34928. {
  34929. const RETURN_CODE_DISABLED = 113;
  34930. private $commandShouldRun = true;
  34931. public function disableCommand()
  34932. {
  34933. return $this->commandShouldRun = false;
  34934. }
  34935. public function enableCommand()
  34936. {
  34937. return $this->commandShouldRun = true;
  34938. }
  34939. public function commandShouldRun()
  34940. {
  34941. return $this->commandShouldRun;
  34942. }
  34943. }
  34944. <?php
  34945. namespace Symfony\Component\Console\Event;
  34946. use Symfony\Component\Console\Command\Command;
  34947. use Symfony\Component\Console\Input\InputInterface;
  34948. use Symfony\Component\Console\Output\OutputInterface;
  34949. use Symfony\Component\EventDispatcher\Event;
  34950. class ConsoleEvent extends Event
  34951. {
  34952. protected $command;
  34953. private $input;
  34954. private $output;
  34955. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  34956. {
  34957. $this->command = $command;
  34958. $this->input = $input;
  34959. $this->output = $output;
  34960. }
  34961. public function getCommand()
  34962. {
  34963. return $this->command;
  34964. }
  34965. public function getInput()
  34966. {
  34967. return $this->input;
  34968. }
  34969. public function getOutput()
  34970. {
  34971. return $this->output;
  34972. }
  34973. }
  34974. <?php
  34975. namespace Symfony\Component\Console\Event;
  34976. use Symfony\Component\Console\Command\Command;
  34977. use Symfony\Component\Console\Input\InputInterface;
  34978. use Symfony\Component\Console\Output\OutputInterface;
  34979. class ConsoleExceptionEvent extends ConsoleEvent
  34980. {
  34981. private $exception;
  34982. private $exitCode;
  34983. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  34984. {
  34985. parent::__construct($command, $input, $output);
  34986. $this->setException($exception);
  34987. $this->exitCode = (int) $exitCode;
  34988. }
  34989. public function getException()
  34990. {
  34991. return $this->exception;
  34992. }
  34993. public function setException(\Exception $exception)
  34994. {
  34995. $this->exception = $exception;
  34996. }
  34997. public function getExitCode()
  34998. {
  34999. return $this->exitCode;
  35000. }
  35001. }
  35002. <?php
  35003. namespace Symfony\Component\Console\Event;
  35004. use Symfony\Component\Console\Command\Command;
  35005. use Symfony\Component\Console\Input\InputInterface;
  35006. use Symfony\Component\Console\Output\OutputInterface;
  35007. class ConsoleTerminateEvent extends ConsoleEvent
  35008. {
  35009. private $exitCode;
  35010. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  35011. {
  35012. parent::__construct($command, $input, $output);
  35013. $this->setExitCode($exitCode);
  35014. }
  35015. public function setExitCode($exitCode)
  35016. {
  35017. $this->exitCode = (int) $exitCode;
  35018. }
  35019. public function getExitCode()
  35020. {
  35021. return $this->exitCode;
  35022. }
  35023. }
  35024. <?php
  35025. namespace Symfony\Component\Console\Exception;
  35026. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  35027. {
  35028. private $alternatives;
  35029. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  35030. {
  35031. parent::__construct($message, $code, $previous);
  35032. $this->alternatives = $alternatives;
  35033. }
  35034. public function getAlternatives()
  35035. {
  35036. return $this->alternatives;
  35037. }
  35038. }
  35039. <?php
  35040. namespace Symfony\Component\Console\Exception;
  35041. interface ExceptionInterface
  35042. {
  35043. }
  35044. <?php
  35045. namespace Symfony\Component\Console\Exception;
  35046. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  35047. {
  35048. }
  35049. <?php
  35050. namespace Symfony\Component\Console\Exception;
  35051. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  35052. {
  35053. }
  35054. <?php
  35055. namespace Symfony\Component\Console\Exception;
  35056. class LogicException extends \LogicException implements ExceptionInterface
  35057. {
  35058. }
  35059. <?php
  35060. namespace Symfony\Component\Console\Exception;
  35061. class RuntimeException extends \RuntimeException implements ExceptionInterface
  35062. {
  35063. }
  35064. <?php
  35065. namespace Symfony\Component\Console\Formatter;
  35066. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35067. class OutputFormatter implements OutputFormatterInterface
  35068. {
  35069. private $decorated;
  35070. private $styles = array();
  35071. private $styleStack;
  35072. public static function escape($text)
  35073. {
  35074. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  35075. return self::escapeTrailingBackslash($text);
  35076. }
  35077. public static function escapeTrailingBackslash($text)
  35078. {
  35079. if ('\\' === substr($text, -1)) {
  35080. $len = \strlen($text);
  35081. $text = rtrim($text, '\\');
  35082. $text = str_replace("\0", '', $text);
  35083. $text .= str_repeat("\0", $len - \strlen($text));
  35084. }
  35085. return $text;
  35086. }
  35087. public function __construct($decorated = false, array $styles = array())
  35088. {
  35089. $this->decorated = (bool) $decorated;
  35090. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  35091. $this->setStyle('info', new OutputFormatterStyle('green'));
  35092. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  35093. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  35094. foreach ($styles as $name => $style) {
  35095. $this->setStyle($name, $style);
  35096. }
  35097. $this->styleStack = new OutputFormatterStyleStack();
  35098. }
  35099. public function setDecorated($decorated)
  35100. {
  35101. $this->decorated = (bool) $decorated;
  35102. }
  35103. public function isDecorated()
  35104. {
  35105. return $this->decorated;
  35106. }
  35107. public function setStyle($name, OutputFormatterStyleInterface $style)
  35108. {
  35109. $this->styles[strtolower($name)] = $style;
  35110. }
  35111. public function hasStyle($name)
  35112. {
  35113. return isset($this->styles[strtolower($name)]);
  35114. }
  35115. public function getStyle($name)
  35116. {
  35117. if (!$this->hasStyle($name)) {
  35118. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  35119. }
  35120. return $this->styles[strtolower($name)];
  35121. }
  35122. public function format($message)
  35123. {
  35124. $message = (string) $message;
  35125. $offset = 0;
  35126. $output = '';
  35127. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  35128. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  35129. foreach ($matches[0] as $i => $match) {
  35130. $pos = $match[1];
  35131. $text = $match[0];
  35132. if (0 != $pos && '\\' == $message[$pos - 1]) {
  35133. continue;
  35134. }
  35135. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  35136. $offset = $pos + \strlen($text);
  35137. if ($open = '/' != $text[1]) {
  35138. $tag = $matches[1][$i][0];
  35139. } else {
  35140. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  35141. }
  35142. if (!$open && !$tag) {
  35143. $this->styleStack->pop();
  35144. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  35145. $output .= $this->applyCurrentStyle($text);
  35146. } elseif ($open) {
  35147. $this->styleStack->push($style);
  35148. } else {
  35149. $this->styleStack->pop($style);
  35150. }
  35151. }
  35152. $output .= $this->applyCurrentStyle(substr($message, $offset));
  35153. if (false !== strpos($output, "\0")) {
  35154. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  35155. }
  35156. return str_replace('\\<', '<', $output);
  35157. }
  35158. public function getStyleStack()
  35159. {
  35160. return $this->styleStack;
  35161. }
  35162. private function createStyleFromString($string)
  35163. {
  35164. if (isset($this->styles[$string])) {
  35165. return $this->styles[$string];
  35166. }
  35167. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  35168. return false;
  35169. }
  35170. $style = new OutputFormatterStyle();
  35171. foreach ($matches as $match) {
  35172. array_shift($match);
  35173. if ('fg' == $match[0]) {
  35174. $style->setForeground($match[1]);
  35175. } elseif ('bg' == $match[0]) {
  35176. $style->setBackground($match[1]);
  35177. } else {
  35178. try {
  35179. $style->setOption($match[1]);
  35180. } catch (\InvalidArgumentException $e) {
  35181. return false;
  35182. }
  35183. }
  35184. }
  35185. return $style;
  35186. }
  35187. private function applyCurrentStyle($text)
  35188. {
  35189. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  35190. }
  35191. }
  35192. <?php
  35193. namespace Symfony\Component\Console\Formatter;
  35194. interface OutputFormatterInterface
  35195. {
  35196. public function setDecorated($decorated);
  35197. public function isDecorated();
  35198. public function setStyle($name, OutputFormatterStyleInterface $style);
  35199. public function hasStyle($name);
  35200. public function getStyle($name);
  35201. public function format($message);
  35202. }
  35203. <?php
  35204. namespace Symfony\Component\Console\Formatter;
  35205. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35206. class OutputFormatterStyle implements OutputFormatterStyleInterface
  35207. {
  35208. private static $availableForegroundColors = array(
  35209. 'black' => array('set' => 30, 'unset' => 39),
  35210. 'red' => array('set' => 31, 'unset' => 39),
  35211. 'green' => array('set' => 32, 'unset' => 39),
  35212. 'yellow' => array('set' => 33, 'unset' => 39),
  35213. 'blue' => array('set' => 34, 'unset' => 39),
  35214. 'magenta' => array('set' => 35, 'unset' => 39),
  35215. 'cyan' => array('set' => 36, 'unset' => 39),
  35216. 'white' => array('set' => 37, 'unset' => 39),
  35217. 'default' => array('set' => 39, 'unset' => 39),
  35218. );
  35219. private static $availableBackgroundColors = array(
  35220. 'black' => array('set' => 40, 'unset' => 49),
  35221. 'red' => array('set' => 41, 'unset' => 49),
  35222. 'green' => array('set' => 42, 'unset' => 49),
  35223. 'yellow' => array('set' => 43, 'unset' => 49),
  35224. 'blue' => array('set' => 44, 'unset' => 49),
  35225. 'magenta' => array('set' => 45, 'unset' => 49),
  35226. 'cyan' => array('set' => 46, 'unset' => 49),
  35227. 'white' => array('set' => 47, 'unset' => 49),
  35228. 'default' => array('set' => 49, 'unset' => 49),
  35229. );
  35230. private static $availableOptions = array(
  35231. 'bold' => array('set' => 1, 'unset' => 22),
  35232. 'underscore' => array('set' => 4, 'unset' => 24),
  35233. 'blink' => array('set' => 5, 'unset' => 25),
  35234. 'reverse' => array('set' => 7, 'unset' => 27),
  35235. 'conceal' => array('set' => 8, 'unset' => 28),
  35236. );
  35237. private $foreground;
  35238. private $background;
  35239. private $options = array();
  35240. public function __construct($foreground = null, $background = null, array $options = array())
  35241. {
  35242. if (null !== $foreground) {
  35243. $this->setForeground($foreground);
  35244. }
  35245. if (null !== $background) {
  35246. $this->setBackground($background);
  35247. }
  35248. if (\count($options)) {
  35249. $this->setOptions($options);
  35250. }
  35251. }
  35252. public function setForeground($color = null)
  35253. {
  35254. if (null === $color) {
  35255. $this->foreground = null;
  35256. return;
  35257. }
  35258. if (!isset(static::$availableForegroundColors[$color])) {
  35259. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  35260. }
  35261. $this->foreground = static::$availableForegroundColors[$color];
  35262. }
  35263. public function setBackground($color = null)
  35264. {
  35265. if (null === $color) {
  35266. $this->background = null;
  35267. return;
  35268. }
  35269. if (!isset(static::$availableBackgroundColors[$color])) {
  35270. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  35271. }
  35272. $this->background = static::$availableBackgroundColors[$color];
  35273. }
  35274. public function setOption($option)
  35275. {
  35276. if (!isset(static::$availableOptions[$option])) {
  35277. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35278. }
  35279. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  35280. $this->options[] = static::$availableOptions[$option];
  35281. }
  35282. }
  35283. public function unsetOption($option)
  35284. {
  35285. if (!isset(static::$availableOptions[$option])) {
  35286. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35287. }
  35288. $pos = array_search(static::$availableOptions[$option], $this->options);
  35289. if (false !== $pos) {
  35290. unset($this->options[$pos]);
  35291. }
  35292. }
  35293. public function setOptions(array $options)
  35294. {
  35295. $this->options = array();
  35296. foreach ($options as $option) {
  35297. $this->setOption($option);
  35298. }
  35299. }
  35300. public function apply($text)
  35301. {
  35302. $setCodes = array();
  35303. $unsetCodes = array();
  35304. if (null !== $this->foreground) {
  35305. $setCodes[] = $this->foreground['set'];
  35306. $unsetCodes[] = $this->foreground['unset'];
  35307. }
  35308. if (null !== $this->background) {
  35309. $setCodes[] = $this->background['set'];
  35310. $unsetCodes[] = $this->background['unset'];
  35311. }
  35312. if (\count($this->options)) {
  35313. foreach ($this->options as $option) {
  35314. $setCodes[] = $option['set'];
  35315. $unsetCodes[] = $option['unset'];
  35316. }
  35317. }
  35318. if (0 === \count($setCodes)) {
  35319. return $text;
  35320. }
  35321. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  35322. }
  35323. }
  35324. <?php
  35325. namespace Symfony\Component\Console\Formatter;
  35326. interface OutputFormatterStyleInterface
  35327. {
  35328. public function setForeground($color = null);
  35329. public function setBackground($color = null);
  35330. public function setOption($option);
  35331. public function unsetOption($option);
  35332. public function setOptions(array $options);
  35333. public function apply($text);
  35334. }
  35335. <?php
  35336. namespace Symfony\Component\Console\Formatter;
  35337. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35338. class OutputFormatterStyleStack
  35339. {
  35340. private $styles;
  35341. private $emptyStyle;
  35342. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  35343. {
  35344. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  35345. $this->reset();
  35346. }
  35347. public function reset()
  35348. {
  35349. $this->styles = array();
  35350. }
  35351. public function push(OutputFormatterStyleInterface $style)
  35352. {
  35353. $this->styles[] = $style;
  35354. }
  35355. public function pop(OutputFormatterStyleInterface $style = null)
  35356. {
  35357. if (empty($this->styles)) {
  35358. return $this->emptyStyle;
  35359. }
  35360. if (null === $style) {
  35361. return array_pop($this->styles);
  35362. }
  35363. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  35364. if ($style->apply('') === $stackedStyle->apply('')) {
  35365. $this->styles = \array_slice($this->styles, 0, $index);
  35366. return $stackedStyle;
  35367. }
  35368. }
  35369. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  35370. }
  35371. public function getCurrent()
  35372. {
  35373. if (empty($this->styles)) {
  35374. return $this->emptyStyle;
  35375. }
  35376. return $this->styles[\count($this->styles) - 1];
  35377. }
  35378. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  35379. {
  35380. $this->emptyStyle = $emptyStyle;
  35381. return $this;
  35382. }
  35383. public function getEmptyStyle()
  35384. {
  35385. return $this->emptyStyle;
  35386. }
  35387. }
  35388. <?php
  35389. namespace Symfony\Component\Console\Helper;
  35390. class DebugFormatterHelper extends Helper
  35391. {
  35392. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  35393. private $started = array();
  35394. private $count = -1;
  35395. public function start($id, $message, $prefix = 'RUN')
  35396. {
  35397. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  35398. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  35399. }
  35400. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  35401. {
  35402. $message = '';
  35403. if ($error) {
  35404. if (isset($this->started[$id]['out'])) {
  35405. $message .= "\n";
  35406. unset($this->started[$id]['out']);
  35407. }
  35408. if (!isset($this->started[$id]['err'])) {
  35409. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  35410. $this->started[$id]['err'] = true;
  35411. }
  35412. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  35413. } else {
  35414. if (isset($this->started[$id]['err'])) {
  35415. $message .= "\n";
  35416. unset($this->started[$id]['err']);
  35417. }
  35418. if (!isset($this->started[$id]['out'])) {
  35419. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  35420. $this->started[$id]['out'] = true;
  35421. }
  35422. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  35423. }
  35424. return $message;
  35425. }
  35426. public function stop($id, $message, $successful, $prefix = 'RES')
  35427. {
  35428. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  35429. if ($successful) {
  35430. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35431. }
  35432. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35433. unset($this->started[$id]['out'], $this->started[$id]['err']);
  35434. return $message;
  35435. }
  35436. private function getBorder($id)
  35437. {
  35438. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  35439. }
  35440. public function getName()
  35441. {
  35442. return 'debug_formatter';
  35443. }
  35444. }
  35445. <?php
  35446. namespace Symfony\Component\Console\Helper;
  35447. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  35448. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  35449. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  35450. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35451. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35452. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35453. use Symfony\Component\Console\Output\OutputInterface;
  35454. class DescriptorHelper extends Helper
  35455. {
  35456. private $descriptors = array();
  35457. public function __construct()
  35458. {
  35459. $this
  35460. ->register('txt', new TextDescriptor())
  35461. ->register('xml', new XmlDescriptor())
  35462. ->register('json', new JsonDescriptor())
  35463. ->register('md', new MarkdownDescriptor())
  35464. ;
  35465. }
  35466. public function describe(OutputInterface $output, $object, array $options = array())
  35467. {
  35468. $options = array_merge(array(
  35469. 'raw_text' => false,
  35470. 'format' => 'txt',
  35471. ), $options);
  35472. if (!isset($this->descriptors[$options['format']])) {
  35473. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  35474. }
  35475. $descriptor = $this->descriptors[$options['format']];
  35476. $descriptor->describe($output, $object, $options);
  35477. }
  35478. public function register($format, DescriptorInterface $descriptor)
  35479. {
  35480. $this->descriptors[$format] = $descriptor;
  35481. return $this;
  35482. }
  35483. public function getName()
  35484. {
  35485. return 'descriptor';
  35486. }
  35487. }
  35488. <?php
  35489. namespace Symfony\Component\Console\Helper;
  35490. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35491. use Symfony\Component\Console\Exception\RuntimeException;
  35492. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35493. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35494. use Symfony\Component\Console\Output\OutputInterface;
  35495. class DialogHelper extends InputAwareHelper
  35496. {
  35497. private $inputStream;
  35498. private static $shell;
  35499. private static $stty;
  35500. public function __construct($triggerDeprecationError = true)
  35501. {
  35502. if ($triggerDeprecationError) {
  35503. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  35504. }
  35505. }
  35506. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  35507. {
  35508. if ($output instanceof ConsoleOutputInterface) {
  35509. $output = $output->getErrorOutput();
  35510. }
  35511. $width = max(array_map('strlen', array_keys($choices)));
  35512. $messages = (array) $question;
  35513. foreach ($choices as $key => $value) {
  35514. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  35515. }
  35516. $output->writeln($messages);
  35517. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  35518. $selectedChoices = str_replace(' ', '', $picked);
  35519. if ($multiselect) {
  35520. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  35521. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  35522. }
  35523. $selectedChoices = explode(',', $selectedChoices);
  35524. } else {
  35525. $selectedChoices = array($picked);
  35526. }
  35527. $multiselectChoices = array();
  35528. foreach ($selectedChoices as $value) {
  35529. if (empty($choices[$value])) {
  35530. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  35531. }
  35532. $multiselectChoices[] = $value;
  35533. }
  35534. if ($multiselect) {
  35535. return $multiselectChoices;
  35536. }
  35537. return $picked;
  35538. }, $attempts, $default);
  35539. return $result;
  35540. }
  35541. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  35542. {
  35543. if ($this->input && !$this->input->isInteractive()) {
  35544. return $default;
  35545. }
  35546. if ($output instanceof ConsoleOutputInterface) {
  35547. $output = $output->getErrorOutput();
  35548. }
  35549. $output->write($question);
  35550. $inputStream = $this->inputStream ?: STDIN;
  35551. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35552. $ret = fgets($inputStream, 4096);
  35553. if (false === $ret) {
  35554. throw new RuntimeException('Aborted');
  35555. }
  35556. $ret = trim($ret);
  35557. } else {
  35558. $ret = '';
  35559. $i = 0;
  35560. $ofs = -1;
  35561. $matches = $autocomplete;
  35562. $numMatches = \count($matches);
  35563. $sttyMode = shell_exec('stty -g');
  35564. shell_exec('stty -icanon -echo');
  35565. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35566. while (!feof($inputStream)) {
  35567. $c = fread($inputStream, 1);
  35568. if ("\177" === $c) {
  35569. if (0 === $numMatches && 0 !== $i) {
  35570. --$i;
  35571. $output->write("\033[1D");
  35572. }
  35573. if (0 === $i) {
  35574. $ofs = -1;
  35575. $matches = $autocomplete;
  35576. $numMatches = \count($matches);
  35577. } else {
  35578. $numMatches = 0;
  35579. }
  35580. $ret = substr($ret, 0, $i);
  35581. } elseif ("\033" === $c) {
  35582. $c .= fread($inputStream, 2);
  35583. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35584. if ('A' === $c[2] && -1 === $ofs) {
  35585. $ofs = 0;
  35586. }
  35587. if (0 === $numMatches) {
  35588. continue;
  35589. }
  35590. $ofs += ('A' === $c[2]) ? -1 : 1;
  35591. $ofs = ($numMatches + $ofs) % $numMatches;
  35592. }
  35593. } elseif (\ord($c) < 32) {
  35594. if ("\t" === $c || "\n" === $c) {
  35595. if ($numMatches > 0 && -1 !== $ofs) {
  35596. $ret = $matches[$ofs];
  35597. $output->write(substr($ret, $i));
  35598. $i = \strlen($ret);
  35599. }
  35600. if ("\n" === $c) {
  35601. $output->write($c);
  35602. break;
  35603. }
  35604. $numMatches = 0;
  35605. }
  35606. continue;
  35607. } else {
  35608. $output->write($c);
  35609. $ret .= $c;
  35610. ++$i;
  35611. $numMatches = 0;
  35612. $ofs = 0;
  35613. foreach ($autocomplete as $value) {
  35614. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  35615. $matches[$numMatches++] = $value;
  35616. }
  35617. }
  35618. }
  35619. $output->write("\033[K");
  35620. if ($numMatches > 0 && -1 !== $ofs) {
  35621. $output->write("\0337");
  35622. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  35623. $output->write("\0338");
  35624. }
  35625. }
  35626. shell_exec(sprintf('stty %s', $sttyMode));
  35627. }
  35628. return \strlen($ret) > 0 ? $ret : $default;
  35629. }
  35630. public function askConfirmation(OutputInterface $output, $question, $default = true)
  35631. {
  35632. $answer = 'z';
  35633. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  35634. $answer = $this->ask($output, $question);
  35635. }
  35636. if (false === $default) {
  35637. return $answer && 'y' == strtolower($answer[0]);
  35638. }
  35639. return !$answer || 'y' == strtolower($answer[0]);
  35640. }
  35641. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  35642. {
  35643. if ($output instanceof ConsoleOutputInterface) {
  35644. $output = $output->getErrorOutput();
  35645. }
  35646. if ('\\' === \DIRECTORY_SEPARATOR) {
  35647. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35648. if ('phar:' === substr(__FILE__, 0, 5)) {
  35649. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35650. copy($exe, $tmpExe);
  35651. $exe = $tmpExe;
  35652. }
  35653. $output->write($question);
  35654. $value = rtrim(shell_exec($exe));
  35655. $output->writeln('');
  35656. if (isset($tmpExe)) {
  35657. unlink($tmpExe);
  35658. }
  35659. return $value;
  35660. }
  35661. if ($this->hasSttyAvailable()) {
  35662. $output->write($question);
  35663. $sttyMode = shell_exec('stty -g');
  35664. shell_exec('stty -echo');
  35665. $value = fgets($this->inputStream ?: STDIN, 4096);
  35666. shell_exec(sprintf('stty %s', $sttyMode));
  35667. if (false === $value) {
  35668. throw new RuntimeException('Aborted');
  35669. }
  35670. $value = trim($value);
  35671. $output->writeln('');
  35672. return $value;
  35673. }
  35674. if (false !== $shell = $this->getShell()) {
  35675. $output->write($question);
  35676. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35677. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35678. $value = rtrim(shell_exec($command));
  35679. $output->writeln('');
  35680. return $value;
  35681. }
  35682. if ($fallback) {
  35683. return $this->ask($output, $question);
  35684. }
  35685. throw new RuntimeException('Unable to hide the response');
  35686. }
  35687. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  35688. {
  35689. $that = $this;
  35690. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  35691. return $that->ask($output, $question, $default, $autocomplete);
  35692. };
  35693. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35694. }
  35695. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  35696. {
  35697. $that = $this;
  35698. $interviewer = function () use ($output, $question, $fallback, $that) {
  35699. return $that->askHiddenResponse($output, $question, $fallback);
  35700. };
  35701. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35702. }
  35703. public function setInputStream($stream)
  35704. {
  35705. $this->inputStream = $stream;
  35706. }
  35707. public function getInputStream()
  35708. {
  35709. return $this->inputStream;
  35710. }
  35711. public function getName()
  35712. {
  35713. return 'dialog';
  35714. }
  35715. private function getShell()
  35716. {
  35717. if (null !== self::$shell) {
  35718. return self::$shell;
  35719. }
  35720. self::$shell = false;
  35721. if (file_exists('/usr/bin/env')) {
  35722. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35723. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35724. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35725. self::$shell = $sh;
  35726. break;
  35727. }
  35728. }
  35729. }
  35730. return self::$shell;
  35731. }
  35732. private function hasSttyAvailable()
  35733. {
  35734. if (null !== self::$stty) {
  35735. return self::$stty;
  35736. }
  35737. exec('stty 2>&1', $output, $exitcode);
  35738. return self::$stty = 0 === $exitcode;
  35739. }
  35740. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  35741. {
  35742. if ($output instanceof ConsoleOutputInterface) {
  35743. $output = $output->getErrorOutput();
  35744. }
  35745. $e = null;
  35746. while (false === $attempts || $attempts--) {
  35747. if (null !== $e) {
  35748. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  35749. }
  35750. try {
  35751. return \call_user_func($validator, $interviewer());
  35752. } catch (\Exception $e) {
  35753. }
  35754. }
  35755. throw $e;
  35756. }
  35757. }
  35758. <?php
  35759. namespace Symfony\Component\Console\Helper;
  35760. use Symfony\Component\Console\Formatter\OutputFormatter;
  35761. class FormatterHelper extends Helper
  35762. {
  35763. public function formatSection($section, $message, $style = 'info')
  35764. {
  35765. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  35766. }
  35767. public function formatBlock($messages, $style, $large = false)
  35768. {
  35769. if (!\is_array($messages)) {
  35770. $messages = array($messages);
  35771. }
  35772. $len = 0;
  35773. $lines = array();
  35774. foreach ($messages as $message) {
  35775. $message = OutputFormatter::escape($message);
  35776. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  35777. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  35778. }
  35779. $messages = $large ? array(str_repeat(' ', $len)) : array();
  35780. for ($i = 0; isset($lines[$i]); ++$i) {
  35781. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  35782. }
  35783. if ($large) {
  35784. $messages[] = str_repeat(' ', $len);
  35785. }
  35786. for ($i = 0; isset($messages[$i]); ++$i) {
  35787. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  35788. }
  35789. return implode("\n", $messages);
  35790. }
  35791. public function getName()
  35792. {
  35793. return 'formatter';
  35794. }
  35795. }
  35796. <?php
  35797. namespace Symfony\Component\Console\Helper;
  35798. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35799. abstract class Helper implements HelperInterface
  35800. {
  35801. protected $helperSet = null;
  35802. public function setHelperSet(HelperSet $helperSet = null)
  35803. {
  35804. $this->helperSet = $helperSet;
  35805. }
  35806. public function getHelperSet()
  35807. {
  35808. return $this->helperSet;
  35809. }
  35810. public static function strlen($string)
  35811. {
  35812. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  35813. return \strlen($string);
  35814. }
  35815. return mb_strwidth($string, $encoding);
  35816. }
  35817. public static function formatTime($secs)
  35818. {
  35819. static $timeFormats = array(
  35820. array(0, '< 1 sec'),
  35821. array(1, '1 sec'),
  35822. array(2, 'secs', 1),
  35823. array(60, '1 min'),
  35824. array(120, 'mins', 60),
  35825. array(3600, '1 hr'),
  35826. array(7200, 'hrs', 3600),
  35827. array(86400, '1 day'),
  35828. array(172800, 'days', 86400),
  35829. );
  35830. foreach ($timeFormats as $index => $format) {
  35831. if ($secs >= $format[0]) {
  35832. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  35833. || $index == \count($timeFormats) - 1
  35834. ) {
  35835. if (2 == \count($format)) {
  35836. return $format[1];
  35837. }
  35838. return floor($secs / $format[2]).' '.$format[1];
  35839. }
  35840. }
  35841. }
  35842. }
  35843. public static function formatMemory($memory)
  35844. {
  35845. if ($memory >= 1024 * 1024 * 1024) {
  35846. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  35847. }
  35848. if ($memory >= 1024 * 1024) {
  35849. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  35850. }
  35851. if ($memory >= 1024) {
  35852. return sprintf('%d KiB', $memory / 1024);
  35853. }
  35854. return sprintf('%d B', $memory);
  35855. }
  35856. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  35857. {
  35858. return self::strlen(self::removeDecoration($formatter, $string));
  35859. }
  35860. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  35861. {
  35862. $isDecorated = $formatter->isDecorated();
  35863. $formatter->setDecorated(false);
  35864. $string = $formatter->format($string);
  35865. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  35866. $formatter->setDecorated($isDecorated);
  35867. return $string;
  35868. }
  35869. }
  35870. <?php
  35871. namespace Symfony\Component\Console\Helper;
  35872. interface HelperInterface
  35873. {
  35874. public function setHelperSet(HelperSet $helperSet = null);
  35875. public function getHelperSet();
  35876. public function getName();
  35877. }
  35878. <?php
  35879. namespace Symfony\Component\Console\Helper;
  35880. use Symfony\Component\Console\Command\Command;
  35881. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35882. class HelperSet implements \IteratorAggregate
  35883. {
  35884. private $helpers = array();
  35885. private $command;
  35886. public function __construct(array $helpers = array())
  35887. {
  35888. foreach ($helpers as $alias => $helper) {
  35889. $this->set($helper, \is_int($alias) ? null : $alias);
  35890. }
  35891. }
  35892. public function set(HelperInterface $helper, $alias = null)
  35893. {
  35894. $this->helpers[$helper->getName()] = $helper;
  35895. if (null !== $alias) {
  35896. $this->helpers[$alias] = $helper;
  35897. }
  35898. $helper->setHelperSet($this);
  35899. }
  35900. public function has($name)
  35901. {
  35902. return isset($this->helpers[$name]);
  35903. }
  35904. public function get($name)
  35905. {
  35906. if (!$this->has($name)) {
  35907. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  35908. }
  35909. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  35910. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  35911. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  35912. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  35913. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  35914. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  35915. }
  35916. return $this->helpers[$name];
  35917. }
  35918. public function setCommand(Command $command = null)
  35919. {
  35920. $this->command = $command;
  35921. }
  35922. public function getCommand()
  35923. {
  35924. return $this->command;
  35925. }
  35926. public function getIterator()
  35927. {
  35928. return new \ArrayIterator($this->helpers);
  35929. }
  35930. }
  35931. <?php
  35932. namespace Symfony\Component\Console\Helper;
  35933. use Symfony\Component\Console\Input\InputAwareInterface;
  35934. use Symfony\Component\Console\Input\InputInterface;
  35935. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  35936. {
  35937. protected $input;
  35938. public function setInput(InputInterface $input)
  35939. {
  35940. $this->input = $input;
  35941. }
  35942. }
  35943. <?php
  35944. namespace Symfony\Component\Console\Helper;
  35945. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35946. use Symfony\Component\Console\Output\OutputInterface;
  35947. use Symfony\Component\Process\Exception\ProcessFailedException;
  35948. use Symfony\Component\Process\Process;
  35949. use Symfony\Component\Process\ProcessBuilder;
  35950. class ProcessHelper extends Helper
  35951. {
  35952. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  35953. {
  35954. if ($output instanceof ConsoleOutputInterface) {
  35955. $output = $output->getErrorOutput();
  35956. }
  35957. $formatter = $this->getHelperSet()->get('debug_formatter');
  35958. if (\is_array($cmd)) {
  35959. $process = ProcessBuilder::create($cmd)->getProcess();
  35960. } elseif ($cmd instanceof Process) {
  35961. $process = $cmd;
  35962. } else {
  35963. $process = new Process($cmd);
  35964. }
  35965. if ($verbosity <= $output->getVerbosity()) {
  35966. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  35967. }
  35968. if ($output->isDebug()) {
  35969. $callback = $this->wrapCallback($output, $process, $callback);
  35970. }
  35971. $process->run($callback);
  35972. if ($verbosity <= $output->getVerbosity()) {
  35973. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  35974. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  35975. }
  35976. if (!$process->isSuccessful() && null !== $error) {
  35977. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  35978. }
  35979. return $process;
  35980. }
  35981. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  35982. {
  35983. $process = $this->run($output, $cmd, $error, $callback);
  35984. if (!$process->isSuccessful()) {
  35985. throw new ProcessFailedException($process);
  35986. }
  35987. return $process;
  35988. }
  35989. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  35990. {
  35991. if ($output instanceof ConsoleOutputInterface) {
  35992. $output = $output->getErrorOutput();
  35993. }
  35994. $formatter = $this->getHelperSet()->get('debug_formatter');
  35995. $that = $this;
  35996. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  35997. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  35998. if (null !== $callback) {
  35999. \call_user_func($callback, $type, $buffer);
  36000. }
  36001. };
  36002. }
  36003. public function escapeString($str)
  36004. {
  36005. return str_replace('<', '\\<', $str);
  36006. }
  36007. public function getName()
  36008. {
  36009. return 'process';
  36010. }
  36011. }
  36012. <?php
  36013. namespace Symfony\Component\Console\Helper;
  36014. use Symfony\Component\Console\Exception\LogicException;
  36015. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36016. use Symfony\Component\Console\Output\OutputInterface;
  36017. class ProgressBar
  36018. {
  36019. private $barWidth = 28;
  36020. private $barChar;
  36021. private $emptyBarChar = '-';
  36022. private $progressChar = '>';
  36023. private $format;
  36024. private $internalFormat;
  36025. private $redrawFreq = 1;
  36026. private $output;
  36027. private $step = 0;
  36028. private $max;
  36029. private $startTime;
  36030. private $stepWidth;
  36031. private $percent = 0.0;
  36032. private $formatLineCount;
  36033. private $messages = array();
  36034. private $overwrite = true;
  36035. private $firstRun = true;
  36036. private static $formatters;
  36037. private static $formats;
  36038. public function __construct(OutputInterface $output, $max = 0)
  36039. {
  36040. if ($output instanceof ConsoleOutputInterface) {
  36041. $output = $output->getErrorOutput();
  36042. }
  36043. $this->output = $output;
  36044. $this->setMaxSteps($max);
  36045. if (!$this->output->isDecorated()) {
  36046. $this->overwrite = false;
  36047. $this->setRedrawFrequency($max / 10);
  36048. }
  36049. $this->startTime = time();
  36050. }
  36051. public static function setPlaceholderFormatterDefinition($name, $callable)
  36052. {
  36053. if (!self::$formatters) {
  36054. self::$formatters = self::initPlaceholderFormatters();
  36055. }
  36056. self::$formatters[$name] = $callable;
  36057. }
  36058. public static function getPlaceholderFormatterDefinition($name)
  36059. {
  36060. if (!self::$formatters) {
  36061. self::$formatters = self::initPlaceholderFormatters();
  36062. }
  36063. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36064. }
  36065. public static function setFormatDefinition($name, $format)
  36066. {
  36067. if (!self::$formats) {
  36068. self::$formats = self::initFormats();
  36069. }
  36070. self::$formats[$name] = $format;
  36071. }
  36072. public static function getFormatDefinition($name)
  36073. {
  36074. if (!self::$formats) {
  36075. self::$formats = self::initFormats();
  36076. }
  36077. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36078. }
  36079. public function setMessage($message, $name = 'message')
  36080. {
  36081. $this->messages[$name] = $message;
  36082. }
  36083. public function getMessage($name = 'message')
  36084. {
  36085. return $this->messages[$name];
  36086. }
  36087. public function getStartTime()
  36088. {
  36089. return $this->startTime;
  36090. }
  36091. public function getMaxSteps()
  36092. {
  36093. return $this->max;
  36094. }
  36095. public function getStep()
  36096. {
  36097. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  36098. return $this->getProgress();
  36099. }
  36100. public function getProgress()
  36101. {
  36102. return $this->step;
  36103. }
  36104. public function getStepWidth()
  36105. {
  36106. return $this->stepWidth;
  36107. }
  36108. public function getProgressPercent()
  36109. {
  36110. return $this->percent;
  36111. }
  36112. public function setBarWidth($size)
  36113. {
  36114. $this->barWidth = (int) $size;
  36115. }
  36116. public function getBarWidth()
  36117. {
  36118. return $this->barWidth;
  36119. }
  36120. public function setBarCharacter($char)
  36121. {
  36122. $this->barChar = $char;
  36123. }
  36124. public function getBarCharacter()
  36125. {
  36126. if (null === $this->barChar) {
  36127. return $this->max ? '=' : $this->emptyBarChar;
  36128. }
  36129. return $this->barChar;
  36130. }
  36131. public function setEmptyBarCharacter($char)
  36132. {
  36133. $this->emptyBarChar = $char;
  36134. }
  36135. public function getEmptyBarCharacter()
  36136. {
  36137. return $this->emptyBarChar;
  36138. }
  36139. public function setProgressCharacter($char)
  36140. {
  36141. $this->progressChar = $char;
  36142. }
  36143. public function getProgressCharacter()
  36144. {
  36145. return $this->progressChar;
  36146. }
  36147. public function setFormat($format)
  36148. {
  36149. $this->format = null;
  36150. $this->internalFormat = $format;
  36151. }
  36152. public function setRedrawFrequency($freq)
  36153. {
  36154. $this->redrawFreq = max((int) $freq, 1);
  36155. }
  36156. public function start($max = null)
  36157. {
  36158. $this->startTime = time();
  36159. $this->step = 0;
  36160. $this->percent = 0.0;
  36161. if (null !== $max) {
  36162. $this->setMaxSteps($max);
  36163. }
  36164. $this->display();
  36165. }
  36166. public function advance($step = 1)
  36167. {
  36168. $this->setProgress($this->step + $step);
  36169. }
  36170. public function setCurrent($step)
  36171. {
  36172. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  36173. $this->setProgress($step);
  36174. }
  36175. public function setOverwrite($overwrite)
  36176. {
  36177. $this->overwrite = (bool) $overwrite;
  36178. }
  36179. public function setProgress($step)
  36180. {
  36181. $step = (int) $step;
  36182. if ($step < $this->step) {
  36183. throw new LogicException('You can\'t regress the progress bar.');
  36184. }
  36185. if ($this->max && $step > $this->max) {
  36186. $this->max = $step;
  36187. }
  36188. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  36189. $currPeriod = (int) ($step / $this->redrawFreq);
  36190. $this->step = $step;
  36191. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  36192. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  36193. $this->display();
  36194. }
  36195. }
  36196. public function finish()
  36197. {
  36198. if (!$this->max) {
  36199. $this->max = $this->step;
  36200. }
  36201. if ($this->step === $this->max && !$this->overwrite) {
  36202. return;
  36203. }
  36204. $this->setProgress($this->max);
  36205. }
  36206. public function display()
  36207. {
  36208. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36209. return;
  36210. }
  36211. if (null === $this->format) {
  36212. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36213. }
  36214. $self = $this;
  36215. $output = $this->output;
  36216. $messages = $this->messages;
  36217. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  36218. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36219. $text = \call_user_func($formatter, $self, $output);
  36220. } elseif (isset($messages[$matches[1]])) {
  36221. $text = $messages[$matches[1]];
  36222. } else {
  36223. return $matches[0];
  36224. }
  36225. if (isset($matches[2])) {
  36226. $text = sprintf('%'.$matches[2], $text);
  36227. }
  36228. return $text;
  36229. }, $this->format));
  36230. }
  36231. public function clear()
  36232. {
  36233. if (!$this->overwrite) {
  36234. return;
  36235. }
  36236. if (null === $this->format) {
  36237. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36238. }
  36239. $this->overwrite('');
  36240. }
  36241. private function setRealFormat($format)
  36242. {
  36243. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  36244. $this->format = self::getFormatDefinition($format.'_nomax');
  36245. } elseif (null !== self::getFormatDefinition($format)) {
  36246. $this->format = self::getFormatDefinition($format);
  36247. } else {
  36248. $this->format = $format;
  36249. }
  36250. $this->formatLineCount = substr_count($this->format, "\n");
  36251. }
  36252. private function setMaxSteps($max)
  36253. {
  36254. $this->max = max(0, (int) $max);
  36255. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  36256. }
  36257. private function overwrite($message)
  36258. {
  36259. if ($this->overwrite) {
  36260. if (!$this->firstRun) {
  36261. $this->output->write("\x0D");
  36262. $this->output->write("\x1B[2K");
  36263. if ($this->formatLineCount > 0) {
  36264. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  36265. }
  36266. }
  36267. } elseif ($this->step > 0) {
  36268. $this->output->writeln('');
  36269. }
  36270. $this->firstRun = false;
  36271. $this->output->write($message);
  36272. }
  36273. private function determineBestFormat()
  36274. {
  36275. switch ($this->output->getVerbosity()) {
  36276. case OutputInterface::VERBOSITY_VERBOSE:
  36277. return $this->max ? 'verbose' : 'verbose_nomax';
  36278. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36279. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  36280. case OutputInterface::VERBOSITY_DEBUG:
  36281. return $this->max ? 'debug' : 'debug_nomax';
  36282. default:
  36283. return $this->max ? 'normal' : 'normal_nomax';
  36284. }
  36285. }
  36286. private static function initPlaceholderFormatters()
  36287. {
  36288. return array(
  36289. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  36290. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  36291. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  36292. if ($completeBars < $bar->getBarWidth()) {
  36293. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  36294. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  36295. }
  36296. return $display;
  36297. },
  36298. 'elapsed' => function (ProgressBar $bar) {
  36299. return Helper::formatTime(time() - $bar->getStartTime());
  36300. },
  36301. 'remaining' => function (ProgressBar $bar) {
  36302. if (!$bar->getMaxSteps()) {
  36303. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  36304. }
  36305. if (!$bar->getProgress()) {
  36306. $remaining = 0;
  36307. } else {
  36308. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  36309. }
  36310. return Helper::formatTime($remaining);
  36311. },
  36312. 'estimated' => function (ProgressBar $bar) {
  36313. if (!$bar->getMaxSteps()) {
  36314. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  36315. }
  36316. if (!$bar->getProgress()) {
  36317. $estimated = 0;
  36318. } else {
  36319. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  36320. }
  36321. return Helper::formatTime($estimated);
  36322. },
  36323. 'memory' => function (ProgressBar $bar) {
  36324. return Helper::formatMemory(memory_get_usage(true));
  36325. },
  36326. 'current' => function (ProgressBar $bar) {
  36327. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  36328. },
  36329. 'max' => function (ProgressBar $bar) {
  36330. return $bar->getMaxSteps();
  36331. },
  36332. 'percent' => function (ProgressBar $bar) {
  36333. return floor($bar->getProgressPercent() * 100);
  36334. },
  36335. );
  36336. }
  36337. private static function initFormats()
  36338. {
  36339. return array(
  36340. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  36341. 'normal_nomax' => ' %current% [%bar%]',
  36342. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  36343. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36344. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  36345. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36346. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  36347. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  36348. );
  36349. }
  36350. }
  36351. <?php
  36352. namespace Symfony\Component\Console\Helper;
  36353. use Symfony\Component\Console\Exception\LogicException;
  36354. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36355. use Symfony\Component\Console\Output\NullOutput;
  36356. use Symfony\Component\Console\Output\OutputInterface;
  36357. class ProgressHelper extends Helper
  36358. {
  36359. const FORMAT_QUIET = ' %percent%%';
  36360. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  36361. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  36362. const FORMAT_QUIET_NOMAX = ' %current%';
  36363. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  36364. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  36365. private $barWidth = 28;
  36366. private $barChar = '=';
  36367. private $emptyBarChar = '-';
  36368. private $progressChar = '>';
  36369. private $format = null;
  36370. private $redrawFreq = 1;
  36371. private $lastMessagesLength;
  36372. private $barCharOriginal;
  36373. private $output;
  36374. private $current;
  36375. private $max;
  36376. private $startTime;
  36377. private $defaultFormatVars = array(
  36378. 'current',
  36379. 'max',
  36380. 'bar',
  36381. 'percent',
  36382. 'elapsed',
  36383. );
  36384. private $formatVars;
  36385. private $widths = array(
  36386. 'current' => 4,
  36387. 'max' => 4,
  36388. 'percent' => 3,
  36389. 'elapsed' => 6,
  36390. );
  36391. private $timeFormats = array(
  36392. array(0, '???'),
  36393. array(2, '1 sec'),
  36394. array(59, 'secs', 1),
  36395. array(60, '1 min'),
  36396. array(3600, 'mins', 60),
  36397. array(5400, '1 hr'),
  36398. array(86400, 'hrs', 3600),
  36399. array(129600, '1 day'),
  36400. array(604800, 'days', 86400),
  36401. );
  36402. public function __construct($triggerDeprecationError = true)
  36403. {
  36404. if ($triggerDeprecationError) {
  36405. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  36406. }
  36407. }
  36408. public function setBarWidth($size)
  36409. {
  36410. $this->barWidth = (int) $size;
  36411. }
  36412. public function setBarCharacter($char)
  36413. {
  36414. $this->barChar = $char;
  36415. }
  36416. public function setEmptyBarCharacter($char)
  36417. {
  36418. $this->emptyBarChar = $char;
  36419. }
  36420. public function setProgressCharacter($char)
  36421. {
  36422. $this->progressChar = $char;
  36423. }
  36424. public function setFormat($format)
  36425. {
  36426. $this->format = $format;
  36427. }
  36428. public function setRedrawFrequency($freq)
  36429. {
  36430. $this->redrawFreq = (int) $freq;
  36431. }
  36432. public function start(OutputInterface $output, $max = null)
  36433. {
  36434. if ($output instanceof ConsoleOutputInterface) {
  36435. $output = $output->getErrorOutput();
  36436. }
  36437. $this->startTime = time();
  36438. $this->current = 0;
  36439. $this->max = (int) $max;
  36440. $this->output = $output->isDecorated() ? $output : new NullOutput();
  36441. $this->lastMessagesLength = 0;
  36442. $this->barCharOriginal = '';
  36443. if (null === $this->format) {
  36444. switch ($output->getVerbosity()) {
  36445. case OutputInterface::VERBOSITY_QUIET:
  36446. $this->format = self::FORMAT_QUIET_NOMAX;
  36447. if ($this->max > 0) {
  36448. $this->format = self::FORMAT_QUIET;
  36449. }
  36450. break;
  36451. case OutputInterface::VERBOSITY_VERBOSE:
  36452. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36453. case OutputInterface::VERBOSITY_DEBUG:
  36454. $this->format = self::FORMAT_VERBOSE_NOMAX;
  36455. if ($this->max > 0) {
  36456. $this->format = self::FORMAT_VERBOSE;
  36457. }
  36458. break;
  36459. default:
  36460. $this->format = self::FORMAT_NORMAL_NOMAX;
  36461. if ($this->max > 0) {
  36462. $this->format = self::FORMAT_NORMAL;
  36463. }
  36464. break;
  36465. }
  36466. }
  36467. $this->initialize();
  36468. }
  36469. public function advance($step = 1, $redraw = false)
  36470. {
  36471. $this->setCurrent($this->current + $step, $redraw);
  36472. }
  36473. public function setCurrent($current, $redraw = false)
  36474. {
  36475. if (null === $this->startTime) {
  36476. throw new LogicException('You must start the progress bar before calling setCurrent().');
  36477. }
  36478. $current = (int) $current;
  36479. if ($current < $this->current) {
  36480. throw new LogicException('You can\'t regress the progress bar');
  36481. }
  36482. if (0 === $this->current) {
  36483. $redraw = true;
  36484. }
  36485. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  36486. $this->current = $current;
  36487. $currPeriod = (int) ($this->current / $this->redrawFreq);
  36488. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  36489. $this->display();
  36490. }
  36491. }
  36492. public function display($finish = false)
  36493. {
  36494. if (null === $this->startTime) {
  36495. throw new LogicException('You must start the progress bar before calling display().');
  36496. }
  36497. $message = $this->format;
  36498. foreach ($this->generate($finish) as $name => $value) {
  36499. $message = str_replace("%{$name}%", $value, $message);
  36500. }
  36501. $this->overwrite($this->output, $message);
  36502. }
  36503. public function clear()
  36504. {
  36505. $this->overwrite($this->output, '');
  36506. }
  36507. public function finish()
  36508. {
  36509. if (null === $this->startTime) {
  36510. throw new LogicException('You must start the progress bar before calling finish().');
  36511. }
  36512. if (null !== $this->startTime) {
  36513. if (!$this->max) {
  36514. $this->barChar = $this->barCharOriginal;
  36515. $this->display(true);
  36516. }
  36517. $this->startTime = null;
  36518. $this->output->writeln('');
  36519. $this->output = null;
  36520. }
  36521. }
  36522. private function initialize()
  36523. {
  36524. $this->formatVars = array();
  36525. foreach ($this->defaultFormatVars as $var) {
  36526. if (false !== strpos($this->format, "%{$var}%")) {
  36527. $this->formatVars[$var] = true;
  36528. }
  36529. }
  36530. if ($this->max > 0) {
  36531. $this->widths['max'] = $this->strlen($this->max);
  36532. $this->widths['current'] = $this->widths['max'];
  36533. } else {
  36534. $this->barCharOriginal = $this->barChar;
  36535. $this->barChar = $this->emptyBarChar;
  36536. }
  36537. }
  36538. private function generate($finish = false)
  36539. {
  36540. $vars = array();
  36541. $percent = 0;
  36542. if ($this->max > 0) {
  36543. $percent = (float) $this->current / $this->max;
  36544. }
  36545. if (isset($this->formatVars['bar'])) {
  36546. if ($this->max > 0) {
  36547. $completeBars = floor($percent * $this->barWidth);
  36548. } else {
  36549. if (!$finish) {
  36550. $completeBars = floor($this->current % $this->barWidth);
  36551. } else {
  36552. $completeBars = $this->barWidth;
  36553. }
  36554. }
  36555. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  36556. $bar = str_repeat($this->barChar, $completeBars);
  36557. if ($completeBars < $this->barWidth) {
  36558. $bar .= $this->progressChar;
  36559. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  36560. }
  36561. $vars['bar'] = $bar;
  36562. }
  36563. if (isset($this->formatVars['elapsed'])) {
  36564. $elapsed = time() - $this->startTime;
  36565. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  36566. }
  36567. if (isset($this->formatVars['current'])) {
  36568. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  36569. }
  36570. if (isset($this->formatVars['max'])) {
  36571. $vars['max'] = $this->max;
  36572. }
  36573. if (isset($this->formatVars['percent'])) {
  36574. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  36575. }
  36576. return $vars;
  36577. }
  36578. private function humaneTime($secs)
  36579. {
  36580. $text = '';
  36581. foreach ($this->timeFormats as $format) {
  36582. if ($secs < $format[0]) {
  36583. if (2 == \count($format)) {
  36584. $text = $format[1];
  36585. break;
  36586. } else {
  36587. $text = ceil($secs / $format[2]).' '.$format[1];
  36588. break;
  36589. }
  36590. }
  36591. }
  36592. return $text;
  36593. }
  36594. private function overwrite(OutputInterface $output, $message)
  36595. {
  36596. $length = $this->strlen($message);
  36597. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  36598. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  36599. }
  36600. $output->write("\x0D");
  36601. $output->write($message);
  36602. $this->lastMessagesLength = $this->strlen($message);
  36603. }
  36604. public function getName()
  36605. {
  36606. return 'progress';
  36607. }
  36608. }
  36609. <?php
  36610. namespace Symfony\Component\Console\Helper;
  36611. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36612. use Symfony\Component\Console\Exception\LogicException;
  36613. use Symfony\Component\Console\Output\OutputInterface;
  36614. class ProgressIndicator
  36615. {
  36616. private $output;
  36617. private $startTime;
  36618. private $format;
  36619. private $message;
  36620. private $indicatorValues;
  36621. private $indicatorCurrent;
  36622. private $indicatorChangeInterval;
  36623. private $indicatorUpdateTime;
  36624. private $started = false;
  36625. private static $formatters;
  36626. private static $formats;
  36627. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  36628. {
  36629. $this->output = $output;
  36630. if (null === $format) {
  36631. $format = $this->determineBestFormat();
  36632. }
  36633. if (null === $indicatorValues) {
  36634. $indicatorValues = array('-', '\\', '|', '/');
  36635. }
  36636. $indicatorValues = array_values($indicatorValues);
  36637. if (2 > \count($indicatorValues)) {
  36638. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  36639. }
  36640. $this->format = self::getFormatDefinition($format);
  36641. $this->indicatorChangeInterval = $indicatorChangeInterval;
  36642. $this->indicatorValues = $indicatorValues;
  36643. $this->startTime = time();
  36644. }
  36645. public function setMessage($message)
  36646. {
  36647. $this->message = $message;
  36648. $this->display();
  36649. }
  36650. public function getMessage()
  36651. {
  36652. return $this->message;
  36653. }
  36654. public function getStartTime()
  36655. {
  36656. return $this->startTime;
  36657. }
  36658. public function getCurrentValue()
  36659. {
  36660. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  36661. }
  36662. public function start($message)
  36663. {
  36664. if ($this->started) {
  36665. throw new LogicException('Progress indicator already started.');
  36666. }
  36667. $this->message = $message;
  36668. $this->started = true;
  36669. $this->startTime = time();
  36670. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  36671. $this->indicatorCurrent = 0;
  36672. $this->display();
  36673. }
  36674. public function advance()
  36675. {
  36676. if (!$this->started) {
  36677. throw new LogicException('Progress indicator has not yet been started.');
  36678. }
  36679. if (!$this->output->isDecorated()) {
  36680. return;
  36681. }
  36682. $currentTime = $this->getCurrentTimeInMilliseconds();
  36683. if ($currentTime < $this->indicatorUpdateTime) {
  36684. return;
  36685. }
  36686. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  36687. ++$this->indicatorCurrent;
  36688. $this->display();
  36689. }
  36690. public function finish($message)
  36691. {
  36692. if (!$this->started) {
  36693. throw new LogicException('Progress indicator has not yet been started.');
  36694. }
  36695. $this->message = $message;
  36696. $this->display();
  36697. $this->output->writeln('');
  36698. $this->started = false;
  36699. }
  36700. public static function getFormatDefinition($name)
  36701. {
  36702. if (!self::$formats) {
  36703. self::$formats = self::initFormats();
  36704. }
  36705. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36706. }
  36707. public static function setPlaceholderFormatterDefinition($name, $callable)
  36708. {
  36709. if (!self::$formatters) {
  36710. self::$formatters = self::initPlaceholderFormatters();
  36711. }
  36712. self::$formatters[$name] = $callable;
  36713. }
  36714. public static function getPlaceholderFormatterDefinition($name)
  36715. {
  36716. if (!self::$formatters) {
  36717. self::$formatters = self::initPlaceholderFormatters();
  36718. }
  36719. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36720. }
  36721. private function display()
  36722. {
  36723. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36724. return;
  36725. }
  36726. $self = $this;
  36727. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  36728. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36729. return \call_user_func($formatter, $self);
  36730. }
  36731. return $matches[0];
  36732. }, $this->format));
  36733. }
  36734. private function determineBestFormat()
  36735. {
  36736. switch ($this->output->getVerbosity()) {
  36737. case OutputInterface::VERBOSITY_VERBOSE:
  36738. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  36739. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36740. case OutputInterface::VERBOSITY_DEBUG:
  36741. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  36742. default:
  36743. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  36744. }
  36745. }
  36746. private function overwrite($message)
  36747. {
  36748. if ($this->output->isDecorated()) {
  36749. $this->output->write("\x0D\x1B[2K");
  36750. $this->output->write($message);
  36751. } else {
  36752. $this->output->writeln($message);
  36753. }
  36754. }
  36755. private function getCurrentTimeInMilliseconds()
  36756. {
  36757. return round(microtime(true) * 1000);
  36758. }
  36759. private static function initPlaceholderFormatters()
  36760. {
  36761. return array(
  36762. 'indicator' => function (ProgressIndicator $indicator) {
  36763. return $indicator->getCurrentValue();
  36764. },
  36765. 'message' => function (ProgressIndicator $indicator) {
  36766. return $indicator->getMessage();
  36767. },
  36768. 'elapsed' => function (ProgressIndicator $indicator) {
  36769. return Helper::formatTime(time() - $indicator->getStartTime());
  36770. },
  36771. 'memory' => function () {
  36772. return Helper::formatMemory(memory_get_usage(true));
  36773. },
  36774. );
  36775. }
  36776. private static function initFormats()
  36777. {
  36778. return array(
  36779. 'normal' => ' %indicator% %message%',
  36780. 'normal_no_ansi' => ' %message%',
  36781. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  36782. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  36783. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  36784. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  36785. );
  36786. }
  36787. }
  36788. <?php
  36789. namespace Symfony\Component\Console\Helper;
  36790. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36791. use Symfony\Component\Console\Exception\RuntimeException;
  36792. use Symfony\Component\Console\Formatter\OutputFormatter;
  36793. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  36794. use Symfony\Component\Console\Input\InputInterface;
  36795. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36796. use Symfony\Component\Console\Output\OutputInterface;
  36797. use Symfony\Component\Console\Question\ChoiceQuestion;
  36798. use Symfony\Component\Console\Question\Question;
  36799. class QuestionHelper extends Helper
  36800. {
  36801. private $inputStream;
  36802. private static $shell;
  36803. private static $stty;
  36804. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  36805. {
  36806. if ($output instanceof ConsoleOutputInterface) {
  36807. $output = $output->getErrorOutput();
  36808. }
  36809. if (!$input->isInteractive()) {
  36810. $default = $question->getDefault();
  36811. if (null !== $default && $question instanceof ChoiceQuestion) {
  36812. $choices = $question->getChoices();
  36813. if (!$question->isMultiselect()) {
  36814. return isset($choices[$default]) ? $choices[$default] : $default;
  36815. }
  36816. $default = explode(',', $default);
  36817. foreach ($default as $k => $v) {
  36818. $v = trim($v);
  36819. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  36820. }
  36821. }
  36822. return $default;
  36823. }
  36824. if (!$question->getValidator()) {
  36825. return $this->doAsk($output, $question);
  36826. }
  36827. $that = $this;
  36828. $interviewer = function () use ($output, $question, $that) {
  36829. return $that->doAsk($output, $question);
  36830. };
  36831. return $this->validateAttempts($interviewer, $output, $question);
  36832. }
  36833. public function setInputStream($stream)
  36834. {
  36835. if (!\is_resource($stream)) {
  36836. throw new InvalidArgumentException('Input stream must be a valid resource.');
  36837. }
  36838. $this->inputStream = $stream;
  36839. }
  36840. public function getInputStream()
  36841. {
  36842. return $this->inputStream;
  36843. }
  36844. public function getName()
  36845. {
  36846. return 'question';
  36847. }
  36848. public function doAsk(OutputInterface $output, Question $question)
  36849. {
  36850. $this->writePrompt($output, $question);
  36851. $inputStream = $this->inputStream ?: STDIN;
  36852. $autocomplete = $question->getAutocompleterValues();
  36853. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  36854. $ret = false;
  36855. if ($question->isHidden()) {
  36856. try {
  36857. $ret = trim($this->getHiddenResponse($output, $inputStream));
  36858. } catch (RuntimeException $e) {
  36859. if (!$question->isHiddenFallback()) {
  36860. throw $e;
  36861. }
  36862. }
  36863. }
  36864. if (false === $ret) {
  36865. $ret = fgets($inputStream, 4096);
  36866. if (false === $ret) {
  36867. throw new RuntimeException('Aborted');
  36868. }
  36869. $ret = trim($ret);
  36870. }
  36871. } else {
  36872. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  36873. }
  36874. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  36875. if ($normalizer = $question->getNormalizer()) {
  36876. return $normalizer($ret);
  36877. }
  36878. return $ret;
  36879. }
  36880. protected function writePrompt(OutputInterface $output, Question $question)
  36881. {
  36882. $message = $question->getQuestion();
  36883. if ($question instanceof ChoiceQuestion) {
  36884. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  36885. $messages = (array) $question->getQuestion();
  36886. foreach ($question->getChoices() as $key => $value) {
  36887. $width = $maxWidth - $this->strlen($key);
  36888. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  36889. }
  36890. $output->writeln($messages);
  36891. $message = $question->getPrompt();
  36892. }
  36893. $output->write($message);
  36894. }
  36895. protected function writeError(OutputInterface $output, \Exception $error)
  36896. {
  36897. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  36898. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  36899. } else {
  36900. $message = '<error>'.$error->getMessage().'</error>';
  36901. }
  36902. $output->writeln($message);
  36903. }
  36904. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  36905. {
  36906. $ret = '';
  36907. $i = 0;
  36908. $ofs = -1;
  36909. $matches = $autocomplete;
  36910. $numMatches = \count($matches);
  36911. $sttyMode = shell_exec('stty -g');
  36912. shell_exec('stty -icanon -echo');
  36913. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  36914. while (!feof($inputStream)) {
  36915. $c = fread($inputStream, 1);
  36916. if ("\177" === $c) {
  36917. if (0 === $numMatches && 0 !== $i) {
  36918. --$i;
  36919. $output->write("\033[1D");
  36920. }
  36921. if (0 === $i) {
  36922. $ofs = -1;
  36923. $matches = $autocomplete;
  36924. $numMatches = \count($matches);
  36925. } else {
  36926. $numMatches = 0;
  36927. }
  36928. $ret = substr($ret, 0, $i);
  36929. } elseif ("\033" === $c) {
  36930. $c .= fread($inputStream, 2);
  36931. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  36932. if ('A' === $c[2] && -1 === $ofs) {
  36933. $ofs = 0;
  36934. }
  36935. if (0 === $numMatches) {
  36936. continue;
  36937. }
  36938. $ofs += ('A' === $c[2]) ? -1 : 1;
  36939. $ofs = ($numMatches + $ofs) % $numMatches;
  36940. }
  36941. } elseif (\ord($c) < 32) {
  36942. if ("\t" === $c || "\n" === $c) {
  36943. if ($numMatches > 0 && -1 !== $ofs) {
  36944. $ret = $matches[$ofs];
  36945. $output->write(substr($ret, $i));
  36946. $i = \strlen($ret);
  36947. }
  36948. if ("\n" === $c) {
  36949. $output->write($c);
  36950. break;
  36951. }
  36952. $numMatches = 0;
  36953. }
  36954. continue;
  36955. } else {
  36956. $output->write($c);
  36957. $ret .= $c;
  36958. ++$i;
  36959. $numMatches = 0;
  36960. $ofs = 0;
  36961. foreach ($autocomplete as $value) {
  36962. if (0 === strpos($value, $ret)) {
  36963. $matches[$numMatches++] = $value;
  36964. }
  36965. }
  36966. }
  36967. $output->write("\033[K");
  36968. if ($numMatches > 0 && -1 !== $ofs) {
  36969. $output->write("\0337");
  36970. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  36971. $output->write("\0338");
  36972. }
  36973. }
  36974. shell_exec(sprintf('stty %s', $sttyMode));
  36975. return $ret;
  36976. }
  36977. private function getHiddenResponse(OutputInterface $output, $inputStream)
  36978. {
  36979. if ('\\' === \DIRECTORY_SEPARATOR) {
  36980. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  36981. if ('phar:' === substr(__FILE__, 0, 5)) {
  36982. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  36983. copy($exe, $tmpExe);
  36984. $exe = $tmpExe;
  36985. }
  36986. $value = rtrim(shell_exec($exe));
  36987. $output->writeln('');
  36988. if (isset($tmpExe)) {
  36989. unlink($tmpExe);
  36990. }
  36991. return $value;
  36992. }
  36993. if ($this->hasSttyAvailable()) {
  36994. $sttyMode = shell_exec('stty -g');
  36995. shell_exec('stty -echo');
  36996. $value = fgets($inputStream, 4096);
  36997. shell_exec(sprintf('stty %s', $sttyMode));
  36998. if (false === $value) {
  36999. throw new RuntimeException('Aborted');
  37000. }
  37001. $value = trim($value);
  37002. $output->writeln('');
  37003. return $value;
  37004. }
  37005. if (false !== $shell = $this->getShell()) {
  37006. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  37007. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  37008. $value = rtrim(shell_exec($command));
  37009. $output->writeln('');
  37010. return $value;
  37011. }
  37012. throw new RuntimeException('Unable to hide the response.');
  37013. }
  37014. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  37015. {
  37016. $error = null;
  37017. $attempts = $question->getMaxAttempts();
  37018. while (null === $attempts || $attempts--) {
  37019. if (null !== $error) {
  37020. $this->writeError($output, $error);
  37021. }
  37022. try {
  37023. return \call_user_func($question->getValidator(), $interviewer());
  37024. } catch (RuntimeException $e) {
  37025. throw $e;
  37026. } catch (\Exception $error) {
  37027. }
  37028. }
  37029. throw $error;
  37030. }
  37031. private function getShell()
  37032. {
  37033. if (null !== self::$shell) {
  37034. return self::$shell;
  37035. }
  37036. self::$shell = false;
  37037. if (file_exists('/usr/bin/env')) {
  37038. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  37039. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  37040. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  37041. self::$shell = $sh;
  37042. break;
  37043. }
  37044. }
  37045. }
  37046. return self::$shell;
  37047. }
  37048. private function hasSttyAvailable()
  37049. {
  37050. if (null !== self::$stty) {
  37051. return self::$stty;
  37052. }
  37053. exec('stty 2>&1', $output, $exitcode);
  37054. return self::$stty = 0 === $exitcode;
  37055. }
  37056. }
  37057. <?php
  37058. namespace Symfony\Component\Console\Helper;
  37059. use Symfony\Component\Console\Exception\LogicException;
  37060. use Symfony\Component\Console\Formatter\OutputFormatter;
  37061. use Symfony\Component\Console\Input\InputInterface;
  37062. use Symfony\Component\Console\Output\OutputInterface;
  37063. use Symfony\Component\Console\Question\ChoiceQuestion;
  37064. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37065. use Symfony\Component\Console\Question\Question;
  37066. use Symfony\Component\Console\Style\SymfonyStyle;
  37067. class SymfonyQuestionHelper extends QuestionHelper
  37068. {
  37069. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  37070. {
  37071. $validator = $question->getValidator();
  37072. $question->setValidator(function ($value) use ($validator) {
  37073. if (null !== $validator) {
  37074. $value = $validator($value);
  37075. } else {
  37076. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  37077. throw new LogicException('A value is required.');
  37078. }
  37079. }
  37080. return $value;
  37081. });
  37082. return parent::ask($input, $output, $question);
  37083. }
  37084. protected function writePrompt(OutputInterface $output, Question $question)
  37085. {
  37086. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  37087. $default = $question->getDefault();
  37088. switch (true) {
  37089. case null === $default:
  37090. $text = sprintf(' <info>%s</info>:', $text);
  37091. break;
  37092. case $question instanceof ConfirmationQuestion:
  37093. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  37094. break;
  37095. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  37096. $choices = $question->getChoices();
  37097. $default = explode(',', $default);
  37098. foreach ($default as $key => $value) {
  37099. $default[$key] = $choices[trim($value)];
  37100. }
  37101. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  37102. break;
  37103. case $question instanceof ChoiceQuestion:
  37104. $choices = $question->getChoices();
  37105. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  37106. break;
  37107. default:
  37108. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  37109. }
  37110. $output->writeln($text);
  37111. if ($question instanceof ChoiceQuestion) {
  37112. $width = max(array_map('strlen', array_keys($question->getChoices())));
  37113. foreach ($question->getChoices() as $key => $value) {
  37114. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  37115. }
  37116. }
  37117. $output->write(' > ');
  37118. }
  37119. protected function writeError(OutputInterface $output, \Exception $error)
  37120. {
  37121. if ($output instanceof SymfonyStyle) {
  37122. $output->newLine();
  37123. $output->error($error->getMessage());
  37124. return;
  37125. }
  37126. parent::writeError($output, $error);
  37127. }
  37128. }
  37129. <?php
  37130. namespace Symfony\Component\Console\Helper;
  37131. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37132. use Symfony\Component\Console\Output\OutputInterface;
  37133. class Table
  37134. {
  37135. private $headers = array();
  37136. private $rows = array();
  37137. private $columnWidths = array();
  37138. private $numberOfColumns;
  37139. private $output;
  37140. private $style;
  37141. private $columnStyles = array();
  37142. private static $styles;
  37143. public function __construct(OutputInterface $output)
  37144. {
  37145. $this->output = $output;
  37146. if (!self::$styles) {
  37147. self::$styles = self::initStyles();
  37148. }
  37149. $this->setStyle('default');
  37150. }
  37151. public static function setStyleDefinition($name, TableStyle $style)
  37152. {
  37153. if (!self::$styles) {
  37154. self::$styles = self::initStyles();
  37155. }
  37156. self::$styles[$name] = $style;
  37157. }
  37158. public static function getStyleDefinition($name)
  37159. {
  37160. if (!self::$styles) {
  37161. self::$styles = self::initStyles();
  37162. }
  37163. if (isset(self::$styles[$name])) {
  37164. return self::$styles[$name];
  37165. }
  37166. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37167. }
  37168. public function setStyle($name)
  37169. {
  37170. $this->style = $this->resolveStyle($name);
  37171. return $this;
  37172. }
  37173. public function getStyle()
  37174. {
  37175. return $this->style;
  37176. }
  37177. public function setColumnStyle($columnIndex, $name)
  37178. {
  37179. $columnIndex = (int) $columnIndex;
  37180. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  37181. return $this;
  37182. }
  37183. public function getColumnStyle($columnIndex)
  37184. {
  37185. if (isset($this->columnStyles[$columnIndex])) {
  37186. return $this->columnStyles[$columnIndex];
  37187. }
  37188. return $this->getStyle();
  37189. }
  37190. public function setHeaders(array $headers)
  37191. {
  37192. $headers = array_values($headers);
  37193. if (!empty($headers) && !\is_array($headers[0])) {
  37194. $headers = array($headers);
  37195. }
  37196. $this->headers = $headers;
  37197. return $this;
  37198. }
  37199. public function setRows(array $rows)
  37200. {
  37201. $this->rows = array();
  37202. return $this->addRows($rows);
  37203. }
  37204. public function addRows(array $rows)
  37205. {
  37206. foreach ($rows as $row) {
  37207. $this->addRow($row);
  37208. }
  37209. return $this;
  37210. }
  37211. public function addRow($row)
  37212. {
  37213. if ($row instanceof TableSeparator) {
  37214. $this->rows[] = $row;
  37215. return $this;
  37216. }
  37217. if (!\is_array($row)) {
  37218. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  37219. }
  37220. $this->rows[] = array_values($row);
  37221. return $this;
  37222. }
  37223. public function setRow($column, array $row)
  37224. {
  37225. $this->rows[$column] = $row;
  37226. return $this;
  37227. }
  37228. public function render()
  37229. {
  37230. $this->calculateNumberOfColumns();
  37231. $rows = $this->buildTableRows($this->rows);
  37232. $headers = $this->buildTableRows($this->headers);
  37233. $this->calculateColumnsWidth(array_merge($headers, $rows));
  37234. $this->renderRowSeparator();
  37235. if (!empty($headers)) {
  37236. foreach ($headers as $header) {
  37237. $this->renderRow($header, $this->style->getCellHeaderFormat());
  37238. $this->renderRowSeparator();
  37239. }
  37240. }
  37241. foreach ($rows as $row) {
  37242. if ($row instanceof TableSeparator) {
  37243. $this->renderRowSeparator();
  37244. } else {
  37245. $this->renderRow($row, $this->style->getCellRowFormat());
  37246. }
  37247. }
  37248. if (!empty($rows)) {
  37249. $this->renderRowSeparator();
  37250. }
  37251. $this->cleanup();
  37252. }
  37253. private function renderRowSeparator()
  37254. {
  37255. if (0 === $count = $this->numberOfColumns) {
  37256. return;
  37257. }
  37258. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  37259. return;
  37260. }
  37261. $markup = $this->style->getCrossingChar();
  37262. for ($column = 0; $column < $count; ++$column) {
  37263. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  37264. }
  37265. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  37266. }
  37267. private function renderColumnSeparator()
  37268. {
  37269. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  37270. }
  37271. private function renderRow(array $row, $cellFormat)
  37272. {
  37273. if (empty($row)) {
  37274. return;
  37275. }
  37276. $rowContent = $this->renderColumnSeparator();
  37277. foreach ($this->getRowColumns($row) as $column) {
  37278. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  37279. $rowContent .= $this->renderColumnSeparator();
  37280. }
  37281. $this->output->writeln($rowContent);
  37282. }
  37283. private function renderCell(array $row, $column, $cellFormat)
  37284. {
  37285. $cell = isset($row[$column]) ? $row[$column] : '';
  37286. $width = $this->columnWidths[$column];
  37287. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37288. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  37289. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  37290. }
  37291. }
  37292. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  37293. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  37294. }
  37295. $style = $this->getColumnStyle($column);
  37296. if ($cell instanceof TableSeparator) {
  37297. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  37298. }
  37299. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37300. $content = sprintf($style->getCellRowContentFormat(), $cell);
  37301. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  37302. }
  37303. private function calculateNumberOfColumns()
  37304. {
  37305. if (null !== $this->numberOfColumns) {
  37306. return;
  37307. }
  37308. $columns = array(0);
  37309. foreach (array_merge($this->headers, $this->rows) as $row) {
  37310. if ($row instanceof TableSeparator) {
  37311. continue;
  37312. }
  37313. $columns[] = $this->getNumberOfColumns($row);
  37314. }
  37315. $this->numberOfColumns = max($columns);
  37316. }
  37317. private function buildTableRows($rows)
  37318. {
  37319. $unmergedRows = array();
  37320. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  37321. $rows = $this->fillNextRows($rows, $rowKey);
  37322. foreach ($rows[$rowKey] as $column => $cell) {
  37323. if (!strstr($cell, "\n")) {
  37324. continue;
  37325. }
  37326. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37327. foreach ($lines as $lineKey => $line) {
  37328. if ($cell instanceof TableCell) {
  37329. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  37330. }
  37331. if (0 === $lineKey) {
  37332. $rows[$rowKey][$column] = $line;
  37333. } else {
  37334. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  37335. }
  37336. }
  37337. }
  37338. }
  37339. $tableRows = array();
  37340. foreach ($rows as $rowKey => $row) {
  37341. $tableRows[] = $this->fillCells($row);
  37342. if (isset($unmergedRows[$rowKey])) {
  37343. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  37344. }
  37345. }
  37346. return $tableRows;
  37347. }
  37348. private function fillNextRows(array $rows, $line)
  37349. {
  37350. $unmergedRows = array();
  37351. foreach ($rows[$line] as $column => $cell) {
  37352. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  37353. $nbLines = $cell->getRowspan() - 1;
  37354. $lines = array($cell);
  37355. if (strstr($cell, "\n")) {
  37356. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37357. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  37358. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  37359. unset($lines[0]);
  37360. }
  37361. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  37362. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37363. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  37364. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  37365. if ($nbLines === $unmergedRowKey - $line) {
  37366. break;
  37367. }
  37368. }
  37369. }
  37370. }
  37371. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37372. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  37373. foreach ($unmergedRow as $cellKey => $cell) {
  37374. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  37375. }
  37376. } else {
  37377. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  37378. foreach ($unmergedRow as $column => $cell) {
  37379. if (!empty($cell)) {
  37380. $row[$column] = $unmergedRow[$column];
  37381. }
  37382. }
  37383. array_splice($rows, $unmergedRowKey, 0, array($row));
  37384. }
  37385. }
  37386. return $rows;
  37387. }
  37388. private function fillCells($row)
  37389. {
  37390. $newRow = array();
  37391. foreach ($row as $column => $cell) {
  37392. $newRow[] = $cell;
  37393. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37394. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  37395. $newRow[] = '';
  37396. }
  37397. }
  37398. }
  37399. return $newRow ?: $row;
  37400. }
  37401. private function copyRow(array $rows, $line)
  37402. {
  37403. $row = $rows[$line];
  37404. foreach ($row as $cellKey => $cellValue) {
  37405. $row[$cellKey] = '';
  37406. if ($cellValue instanceof TableCell) {
  37407. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  37408. }
  37409. }
  37410. return $row;
  37411. }
  37412. private function getNumberOfColumns(array $row)
  37413. {
  37414. $columns = \count($row);
  37415. foreach ($row as $column) {
  37416. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  37417. }
  37418. return $columns;
  37419. }
  37420. private function getRowColumns(array $row)
  37421. {
  37422. $columns = range(0, $this->numberOfColumns - 1);
  37423. foreach ($row as $cellKey => $cell) {
  37424. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37425. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  37426. }
  37427. }
  37428. return $columns;
  37429. }
  37430. private function calculateColumnsWidth($rows)
  37431. {
  37432. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  37433. $lengths = array();
  37434. foreach ($rows as $row) {
  37435. if ($row instanceof TableSeparator) {
  37436. continue;
  37437. }
  37438. foreach ($row as $i => $cell) {
  37439. if ($cell instanceof TableCell) {
  37440. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  37441. $textLength = Helper::strlen($textContent);
  37442. if ($textLength > 0) {
  37443. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  37444. foreach ($contentColumns as $position => $content) {
  37445. $row[$i + $position] = $content;
  37446. }
  37447. }
  37448. }
  37449. }
  37450. $lengths[] = $this->getCellWidth($row, $column);
  37451. }
  37452. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  37453. }
  37454. }
  37455. private function getColumnSeparatorWidth()
  37456. {
  37457. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  37458. }
  37459. private function getCellWidth(array $row, $column)
  37460. {
  37461. if (isset($row[$column])) {
  37462. $cell = $row[$column];
  37463. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37464. return $cellWidth;
  37465. }
  37466. return 0;
  37467. }
  37468. private function cleanup()
  37469. {
  37470. $this->columnWidths = array();
  37471. $this->numberOfColumns = null;
  37472. }
  37473. private static function initStyles()
  37474. {
  37475. $borderless = new TableStyle();
  37476. $borderless
  37477. ->setHorizontalBorderChar('=')
  37478. ->setVerticalBorderChar(' ')
  37479. ->setCrossingChar(' ')
  37480. ;
  37481. $compact = new TableStyle();
  37482. $compact
  37483. ->setHorizontalBorderChar('')
  37484. ->setVerticalBorderChar(' ')
  37485. ->setCrossingChar('')
  37486. ->setCellRowContentFormat('%s')
  37487. ;
  37488. $styleGuide = new TableStyle();
  37489. $styleGuide
  37490. ->setHorizontalBorderChar('-')
  37491. ->setVerticalBorderChar(' ')
  37492. ->setCrossingChar(' ')
  37493. ->setCellHeaderFormat('%s')
  37494. ;
  37495. return array(
  37496. 'default' => new TableStyle(),
  37497. 'borderless' => $borderless,
  37498. 'compact' => $compact,
  37499. 'symfony-style-guide' => $styleGuide,
  37500. );
  37501. }
  37502. private function resolveStyle($name)
  37503. {
  37504. if ($name instanceof TableStyle) {
  37505. return $name;
  37506. }
  37507. if (isset(self::$styles[$name])) {
  37508. return self::$styles[$name];
  37509. }
  37510. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37511. }
  37512. }
  37513. <?php
  37514. namespace Symfony\Component\Console\Helper;
  37515. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37516. class TableCell
  37517. {
  37518. private $value;
  37519. private $options = array(
  37520. 'rowspan' => 1,
  37521. 'colspan' => 1,
  37522. );
  37523. public function __construct($value = '', array $options = array())
  37524. {
  37525. if (is_numeric($value) && !\is_string($value)) {
  37526. $value = (string) $value;
  37527. }
  37528. $this->value = $value;
  37529. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  37530. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  37531. }
  37532. $this->options = array_merge($this->options, $options);
  37533. }
  37534. public function __toString()
  37535. {
  37536. return $this->value;
  37537. }
  37538. public function getColspan()
  37539. {
  37540. return (int) $this->options['colspan'];
  37541. }
  37542. public function getRowspan()
  37543. {
  37544. return (int) $this->options['rowspan'];
  37545. }
  37546. }
  37547. <?php
  37548. namespace Symfony\Component\Console\Helper;
  37549. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37550. use Symfony\Component\Console\Output\NullOutput;
  37551. use Symfony\Component\Console\Output\OutputInterface;
  37552. class TableHelper extends Helper
  37553. {
  37554. const LAYOUT_DEFAULT = 0;
  37555. const LAYOUT_BORDERLESS = 1;
  37556. const LAYOUT_COMPACT = 2;
  37557. private $table;
  37558. public function __construct($triggerDeprecationError = true)
  37559. {
  37560. if ($triggerDeprecationError) {
  37561. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  37562. }
  37563. $this->table = new Table(new NullOutput());
  37564. }
  37565. public function setLayout($layout)
  37566. {
  37567. switch ($layout) {
  37568. case self::LAYOUT_BORDERLESS:
  37569. $this->table->setStyle('borderless');
  37570. break;
  37571. case self::LAYOUT_COMPACT:
  37572. $this->table->setStyle('compact');
  37573. break;
  37574. case self::LAYOUT_DEFAULT:
  37575. $this->table->setStyle('default');
  37576. break;
  37577. default:
  37578. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  37579. }
  37580. return $this;
  37581. }
  37582. public function setHeaders(array $headers)
  37583. {
  37584. $this->table->setHeaders($headers);
  37585. return $this;
  37586. }
  37587. public function setRows(array $rows)
  37588. {
  37589. $this->table->setRows($rows);
  37590. return $this;
  37591. }
  37592. public function addRows(array $rows)
  37593. {
  37594. $this->table->addRows($rows);
  37595. return $this;
  37596. }
  37597. public function addRow(array $row)
  37598. {
  37599. $this->table->addRow($row);
  37600. return $this;
  37601. }
  37602. public function setRow($column, array $row)
  37603. {
  37604. $this->table->setRow($column, $row);
  37605. return $this;
  37606. }
  37607. public function setPaddingChar($paddingChar)
  37608. {
  37609. $this->table->getStyle()->setPaddingChar($paddingChar);
  37610. return $this;
  37611. }
  37612. public function setHorizontalBorderChar($horizontalBorderChar)
  37613. {
  37614. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  37615. return $this;
  37616. }
  37617. public function setVerticalBorderChar($verticalBorderChar)
  37618. {
  37619. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  37620. return $this;
  37621. }
  37622. public function setCrossingChar($crossingChar)
  37623. {
  37624. $this->table->getStyle()->setCrossingChar($crossingChar);
  37625. return $this;
  37626. }
  37627. public function setCellHeaderFormat($cellHeaderFormat)
  37628. {
  37629. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  37630. return $this;
  37631. }
  37632. public function setCellRowFormat($cellRowFormat)
  37633. {
  37634. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  37635. return $this;
  37636. }
  37637. public function setCellRowContentFormat($cellRowContentFormat)
  37638. {
  37639. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  37640. return $this;
  37641. }
  37642. public function setBorderFormat($borderFormat)
  37643. {
  37644. $this->table->getStyle()->setBorderFormat($borderFormat);
  37645. return $this;
  37646. }
  37647. public function setPadType($padType)
  37648. {
  37649. $this->table->getStyle()->setPadType($padType);
  37650. return $this;
  37651. }
  37652. public function render(OutputInterface $output)
  37653. {
  37654. $p = new \ReflectionProperty($this->table, 'output');
  37655. $p->setAccessible(true);
  37656. $p->setValue($this->table, $output);
  37657. $this->table->render();
  37658. }
  37659. public function getName()
  37660. {
  37661. return 'table';
  37662. }
  37663. }
  37664. <?php
  37665. namespace Symfony\Component\Console\Helper;
  37666. class TableSeparator extends TableCell
  37667. {
  37668. public function __construct(array $options = array())
  37669. {
  37670. parent::__construct('', $options);
  37671. }
  37672. }
  37673. <?php
  37674. namespace Symfony\Component\Console\Helper;
  37675. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37676. use Symfony\Component\Console\Exception\LogicException;
  37677. class TableStyle
  37678. {
  37679. private $paddingChar = ' ';
  37680. private $horizontalBorderChar = '-';
  37681. private $verticalBorderChar = '|';
  37682. private $crossingChar = '+';
  37683. private $cellHeaderFormat = '<info>%s</info>';
  37684. private $cellRowFormat = '%s';
  37685. private $cellRowContentFormat = ' %s ';
  37686. private $borderFormat = '%s';
  37687. private $padType = STR_PAD_RIGHT;
  37688. public function setPaddingChar($paddingChar)
  37689. {
  37690. if (!$paddingChar) {
  37691. throw new LogicException('The padding char must not be empty');
  37692. }
  37693. $this->paddingChar = $paddingChar;
  37694. return $this;
  37695. }
  37696. public function getPaddingChar()
  37697. {
  37698. return $this->paddingChar;
  37699. }
  37700. public function setHorizontalBorderChar($horizontalBorderChar)
  37701. {
  37702. $this->horizontalBorderChar = $horizontalBorderChar;
  37703. return $this;
  37704. }
  37705. public function getHorizontalBorderChar()
  37706. {
  37707. return $this->horizontalBorderChar;
  37708. }
  37709. public function setVerticalBorderChar($verticalBorderChar)
  37710. {
  37711. $this->verticalBorderChar = $verticalBorderChar;
  37712. return $this;
  37713. }
  37714. public function getVerticalBorderChar()
  37715. {
  37716. return $this->verticalBorderChar;
  37717. }
  37718. public function setCrossingChar($crossingChar)
  37719. {
  37720. $this->crossingChar = $crossingChar;
  37721. return $this;
  37722. }
  37723. public function getCrossingChar()
  37724. {
  37725. return $this->crossingChar;
  37726. }
  37727. public function setCellHeaderFormat($cellHeaderFormat)
  37728. {
  37729. $this->cellHeaderFormat = $cellHeaderFormat;
  37730. return $this;
  37731. }
  37732. public function getCellHeaderFormat()
  37733. {
  37734. return $this->cellHeaderFormat;
  37735. }
  37736. public function setCellRowFormat($cellRowFormat)
  37737. {
  37738. $this->cellRowFormat = $cellRowFormat;
  37739. return $this;
  37740. }
  37741. public function getCellRowFormat()
  37742. {
  37743. return $this->cellRowFormat;
  37744. }
  37745. public function setCellRowContentFormat($cellRowContentFormat)
  37746. {
  37747. $this->cellRowContentFormat = $cellRowContentFormat;
  37748. return $this;
  37749. }
  37750. public function getCellRowContentFormat()
  37751. {
  37752. return $this->cellRowContentFormat;
  37753. }
  37754. public function setBorderFormat($borderFormat)
  37755. {
  37756. $this->borderFormat = $borderFormat;
  37757. return $this;
  37758. }
  37759. public function getBorderFormat()
  37760. {
  37761. return $this->borderFormat;
  37762. }
  37763. public function setPadType($padType)
  37764. {
  37765. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  37766. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  37767. }
  37768. $this->padType = $padType;
  37769. return $this;
  37770. }
  37771. public function getPadType()
  37772. {
  37773. return $this->padType;
  37774. }
  37775. }
  37776. <?php
  37777. namespace Symfony\Component\Console\Input;
  37778. use Symfony\Component\Console\Exception\RuntimeException;
  37779. class ArgvInput extends Input
  37780. {
  37781. private $tokens;
  37782. private $parsed;
  37783. public function __construct(array $argv = null, InputDefinition $definition = null)
  37784. {
  37785. if (null === $argv) {
  37786. $argv = $_SERVER['argv'];
  37787. }
  37788. array_shift($argv);
  37789. $this->tokens = $argv;
  37790. parent::__construct($definition);
  37791. }
  37792. protected function setTokens(array $tokens)
  37793. {
  37794. $this->tokens = $tokens;
  37795. }
  37796. protected function parse()
  37797. {
  37798. $parseOptions = true;
  37799. $this->parsed = $this->tokens;
  37800. while (null !== $token = array_shift($this->parsed)) {
  37801. if ($parseOptions && '' == $token) {
  37802. $this->parseArgument($token);
  37803. } elseif ($parseOptions && '--' == $token) {
  37804. $parseOptions = false;
  37805. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  37806. $this->parseLongOption($token);
  37807. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  37808. $this->parseShortOption($token);
  37809. } else {
  37810. $this->parseArgument($token);
  37811. }
  37812. }
  37813. }
  37814. private function parseShortOption($token)
  37815. {
  37816. $name = substr($token, 1);
  37817. if (\strlen($name) > 1) {
  37818. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  37819. $this->addShortOption($name[0], substr($name, 1));
  37820. } else {
  37821. $this->parseShortOptionSet($name);
  37822. }
  37823. } else {
  37824. $this->addShortOption($name, null);
  37825. }
  37826. }
  37827. private function parseShortOptionSet($name)
  37828. {
  37829. $len = \strlen($name);
  37830. for ($i = 0; $i < $len; ++$i) {
  37831. if (!$this->definition->hasShortcut($name[$i])) {
  37832. $encoding = mb_detect_encoding($name, null, true);
  37833. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  37834. }
  37835. $option = $this->definition->getOptionForShortcut($name[$i]);
  37836. if ($option->acceptValue()) {
  37837. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  37838. break;
  37839. } else {
  37840. $this->addLongOption($option->getName(), null);
  37841. }
  37842. }
  37843. }
  37844. private function parseLongOption($token)
  37845. {
  37846. $name = substr($token, 2);
  37847. if (false !== $pos = strpos($name, '=')) {
  37848. if (0 === \strlen($value = substr($name, $pos + 1))) {
  37849. array_unshift($this->parsed, null);
  37850. }
  37851. $this->addLongOption(substr($name, 0, $pos), $value);
  37852. } else {
  37853. $this->addLongOption($name, null);
  37854. }
  37855. }
  37856. private function parseArgument($token)
  37857. {
  37858. $c = \count($this->arguments);
  37859. if ($this->definition->hasArgument($c)) {
  37860. $arg = $this->definition->getArgument($c);
  37861. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  37862. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  37863. $arg = $this->definition->getArgument($c - 1);
  37864. $this->arguments[$arg->getName()][] = $token;
  37865. } else {
  37866. $all = $this->definition->getArguments();
  37867. if (\count($all)) {
  37868. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  37869. }
  37870. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  37871. }
  37872. }
  37873. private function addShortOption($shortcut, $value)
  37874. {
  37875. if (!$this->definition->hasShortcut($shortcut)) {
  37876. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  37877. }
  37878. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  37879. }
  37880. private function addLongOption($name, $value)
  37881. {
  37882. if (!$this->definition->hasOption($name)) {
  37883. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  37884. }
  37885. $option = $this->definition->getOption($name);
  37886. if (!isset($value[0])) {
  37887. $value = null;
  37888. }
  37889. if (null !== $value && !$option->acceptValue()) {
  37890. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  37891. }
  37892. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  37893. $next = array_shift($this->parsed);
  37894. if (isset($next[0]) && '-' !== $next[0]) {
  37895. $value = $next;
  37896. } elseif (empty($next)) {
  37897. $value = null;
  37898. } else {
  37899. array_unshift($this->parsed, $next);
  37900. }
  37901. }
  37902. if (null === $value) {
  37903. if ($option->isValueRequired()) {
  37904. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  37905. }
  37906. if (!$option->isArray()) {
  37907. $value = $option->isValueOptional() ? $option->getDefault() : true;
  37908. }
  37909. }
  37910. if ($option->isArray()) {
  37911. $this->options[$name][] = $value;
  37912. } else {
  37913. $this->options[$name] = $value;
  37914. }
  37915. }
  37916. public function getFirstArgument()
  37917. {
  37918. foreach ($this->tokens as $token) {
  37919. if ($token && '-' === $token[0]) {
  37920. continue;
  37921. }
  37922. return $token;
  37923. }
  37924. }
  37925. public function hasParameterOption($values)
  37926. {
  37927. $values = (array) $values;
  37928. foreach ($this->tokens as $token) {
  37929. foreach ($values as $value) {
  37930. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37931. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  37932. return true;
  37933. }
  37934. }
  37935. }
  37936. return false;
  37937. }
  37938. public function getParameterOption($values, $default = false)
  37939. {
  37940. $values = (array) $values;
  37941. $tokens = $this->tokens;
  37942. while (0 < \count($tokens)) {
  37943. $token = array_shift($tokens);
  37944. foreach ($values as $value) {
  37945. if ($token === $value) {
  37946. return array_shift($tokens);
  37947. }
  37948. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37949. if ('' !== $leading && 0 === strpos($token, $leading)) {
  37950. return substr($token, \strlen($leading));
  37951. }
  37952. }
  37953. }
  37954. return $default;
  37955. }
  37956. public function __toString()
  37957. {
  37958. $self = $this;
  37959. $tokens = array_map(function ($token) use ($self) {
  37960. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  37961. return $match[1].$self->escapeToken($match[2]);
  37962. }
  37963. if ($token && '-' !== $token[0]) {
  37964. return $self->escapeToken($token);
  37965. }
  37966. return $token;
  37967. }, $this->tokens);
  37968. return implode(' ', $tokens);
  37969. }
  37970. }
  37971. <?php
  37972. namespace Symfony\Component\Console\Input;
  37973. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37974. use Symfony\Component\Console\Exception\InvalidOptionException;
  37975. class ArrayInput extends Input
  37976. {
  37977. private $parameters;
  37978. public function __construct(array $parameters, InputDefinition $definition = null)
  37979. {
  37980. $this->parameters = $parameters;
  37981. parent::__construct($definition);
  37982. }
  37983. public function getFirstArgument()
  37984. {
  37985. foreach ($this->parameters as $key => $value) {
  37986. if ($key && '-' === $key[0]) {
  37987. continue;
  37988. }
  37989. return $value;
  37990. }
  37991. }
  37992. public function hasParameterOption($values)
  37993. {
  37994. $values = (array) $values;
  37995. foreach ($this->parameters as $k => $v) {
  37996. if (!\is_int($k)) {
  37997. $v = $k;
  37998. }
  37999. if (\in_array($v, $values)) {
  38000. return true;
  38001. }
  38002. }
  38003. return false;
  38004. }
  38005. public function getParameterOption($values, $default = false)
  38006. {
  38007. $values = (array) $values;
  38008. foreach ($this->parameters as $k => $v) {
  38009. if (\is_int($k)) {
  38010. if (\in_array($v, $values)) {
  38011. return true;
  38012. }
  38013. } elseif (\in_array($k, $values)) {
  38014. return $v;
  38015. }
  38016. }
  38017. return $default;
  38018. }
  38019. public function __toString()
  38020. {
  38021. $params = array();
  38022. foreach ($this->parameters as $param => $val) {
  38023. if ($param && '-' === $param[0]) {
  38024. if (\is_array($val)) {
  38025. foreach ($val as $v) {
  38026. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  38027. }
  38028. } else {
  38029. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  38030. }
  38031. } else {
  38032. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  38033. }
  38034. }
  38035. return implode(' ', $params);
  38036. }
  38037. protected function parse()
  38038. {
  38039. foreach ($this->parameters as $key => $value) {
  38040. if (0 === strpos($key, '--')) {
  38041. $this->addLongOption(substr($key, 2), $value);
  38042. } elseif ('-' === $key[0]) {
  38043. $this->addShortOption(substr($key, 1), $value);
  38044. } else {
  38045. $this->addArgument($key, $value);
  38046. }
  38047. }
  38048. }
  38049. private function addShortOption($shortcut, $value)
  38050. {
  38051. if (!$this->definition->hasShortcut($shortcut)) {
  38052. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  38053. }
  38054. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  38055. }
  38056. private function addLongOption($name, $value)
  38057. {
  38058. if (!$this->definition->hasOption($name)) {
  38059. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  38060. }
  38061. $option = $this->definition->getOption($name);
  38062. if (null === $value) {
  38063. if ($option->isValueRequired()) {
  38064. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  38065. }
  38066. $value = $option->isValueOptional() ? $option->getDefault() : true;
  38067. }
  38068. $this->options[$name] = $value;
  38069. }
  38070. private function addArgument($name, $value)
  38071. {
  38072. if (!$this->definition->hasArgument($name)) {
  38073. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38074. }
  38075. $this->arguments[$name] = $value;
  38076. }
  38077. }
  38078. <?php
  38079. namespace Symfony\Component\Console\Input;
  38080. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38081. use Symfony\Component\Console\Exception\RuntimeException;
  38082. abstract class Input implements InputInterface
  38083. {
  38084. protected $definition;
  38085. protected $options = array();
  38086. protected $arguments = array();
  38087. protected $interactive = true;
  38088. public function __construct(InputDefinition $definition = null)
  38089. {
  38090. if (null === $definition) {
  38091. $this->definition = new InputDefinition();
  38092. } else {
  38093. $this->bind($definition);
  38094. $this->validate();
  38095. }
  38096. }
  38097. public function bind(InputDefinition $definition)
  38098. {
  38099. $this->arguments = array();
  38100. $this->options = array();
  38101. $this->definition = $definition;
  38102. $this->parse();
  38103. }
  38104. abstract protected function parse();
  38105. public function validate()
  38106. {
  38107. $definition = $this->definition;
  38108. $givenArguments = $this->arguments;
  38109. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  38110. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  38111. });
  38112. if (\count($missingArguments) > 0) {
  38113. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  38114. }
  38115. }
  38116. public function isInteractive()
  38117. {
  38118. return $this->interactive;
  38119. }
  38120. public function setInteractive($interactive)
  38121. {
  38122. $this->interactive = (bool) $interactive;
  38123. }
  38124. public function getArguments()
  38125. {
  38126. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  38127. }
  38128. public function getArgument($name)
  38129. {
  38130. if (!$this->definition->hasArgument($name)) {
  38131. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38132. }
  38133. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  38134. }
  38135. public function setArgument($name, $value)
  38136. {
  38137. if (!$this->definition->hasArgument($name)) {
  38138. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38139. }
  38140. $this->arguments[$name] = $value;
  38141. }
  38142. public function hasArgument($name)
  38143. {
  38144. return $this->definition->hasArgument($name);
  38145. }
  38146. public function getOptions()
  38147. {
  38148. return array_merge($this->definition->getOptionDefaults(), $this->options);
  38149. }
  38150. public function getOption($name)
  38151. {
  38152. if (!$this->definition->hasOption($name)) {
  38153. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38154. }
  38155. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  38156. }
  38157. public function setOption($name, $value)
  38158. {
  38159. if (!$this->definition->hasOption($name)) {
  38160. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38161. }
  38162. $this->options[$name] = $value;
  38163. }
  38164. public function hasOption($name)
  38165. {
  38166. return $this->definition->hasOption($name);
  38167. }
  38168. public function escapeToken($token)
  38169. {
  38170. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  38171. }
  38172. }
  38173. <?php
  38174. namespace Symfony\Component\Console\Input;
  38175. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38176. use Symfony\Component\Console\Exception\LogicException;
  38177. class InputArgument
  38178. {
  38179. const REQUIRED = 1;
  38180. const OPTIONAL = 2;
  38181. const IS_ARRAY = 4;
  38182. private $name;
  38183. private $mode;
  38184. private $default;
  38185. private $description;
  38186. public function __construct($name, $mode = null, $description = '', $default = null)
  38187. {
  38188. if (null === $mode) {
  38189. $mode = self::OPTIONAL;
  38190. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  38191. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  38192. }
  38193. $this->name = $name;
  38194. $this->mode = $mode;
  38195. $this->description = $description;
  38196. $this->setDefault($default);
  38197. }
  38198. public function getName()
  38199. {
  38200. return $this->name;
  38201. }
  38202. public function isRequired()
  38203. {
  38204. return self::REQUIRED === (self::REQUIRED & $this->mode);
  38205. }
  38206. public function isArray()
  38207. {
  38208. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  38209. }
  38210. public function setDefault($default = null)
  38211. {
  38212. if (self::REQUIRED === $this->mode && null !== $default) {
  38213. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  38214. }
  38215. if ($this->isArray()) {
  38216. if (null === $default) {
  38217. $default = array();
  38218. } elseif (!\is_array($default)) {
  38219. throw new LogicException('A default value for an array argument must be an array.');
  38220. }
  38221. }
  38222. $this->default = $default;
  38223. }
  38224. public function getDefault()
  38225. {
  38226. return $this->default;
  38227. }
  38228. public function getDescription()
  38229. {
  38230. return $this->description;
  38231. }
  38232. }
  38233. <?php
  38234. namespace Symfony\Component\Console\Input;
  38235. interface InputAwareInterface
  38236. {
  38237. public function setInput(InputInterface $input);
  38238. }
  38239. <?php
  38240. namespace Symfony\Component\Console\Input;
  38241. use Symfony\Component\Console\Descriptor\TextDescriptor;
  38242. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  38243. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38244. use Symfony\Component\Console\Exception\LogicException;
  38245. use Symfony\Component\Console\Output\BufferedOutput;
  38246. class InputDefinition
  38247. {
  38248. private $arguments;
  38249. private $requiredCount;
  38250. private $hasAnArrayArgument = false;
  38251. private $hasOptional;
  38252. private $options;
  38253. private $shortcuts;
  38254. public function __construct(array $definition = array())
  38255. {
  38256. $this->setDefinition($definition);
  38257. }
  38258. public function setDefinition(array $definition)
  38259. {
  38260. $arguments = array();
  38261. $options = array();
  38262. foreach ($definition as $item) {
  38263. if ($item instanceof InputOption) {
  38264. $options[] = $item;
  38265. } else {
  38266. $arguments[] = $item;
  38267. }
  38268. }
  38269. $this->setArguments($arguments);
  38270. $this->setOptions($options);
  38271. }
  38272. public function setArguments($arguments = array())
  38273. {
  38274. $this->arguments = array();
  38275. $this->requiredCount = 0;
  38276. $this->hasOptional = false;
  38277. $this->hasAnArrayArgument = false;
  38278. $this->addArguments($arguments);
  38279. }
  38280. public function addArguments($arguments = array())
  38281. {
  38282. if (null !== $arguments) {
  38283. foreach ($arguments as $argument) {
  38284. $this->addArgument($argument);
  38285. }
  38286. }
  38287. }
  38288. public function addArgument(InputArgument $argument)
  38289. {
  38290. if (isset($this->arguments[$argument->getName()])) {
  38291. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  38292. }
  38293. if ($this->hasAnArrayArgument) {
  38294. throw new LogicException('Cannot add an argument after an array argument.');
  38295. }
  38296. if ($argument->isRequired() && $this->hasOptional) {
  38297. throw new LogicException('Cannot add a required argument after an optional one.');
  38298. }
  38299. if ($argument->isArray()) {
  38300. $this->hasAnArrayArgument = true;
  38301. }
  38302. if ($argument->isRequired()) {
  38303. ++$this->requiredCount;
  38304. } else {
  38305. $this->hasOptional = true;
  38306. }
  38307. $this->arguments[$argument->getName()] = $argument;
  38308. }
  38309. public function getArgument($name)
  38310. {
  38311. if (!$this->hasArgument($name)) {
  38312. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38313. }
  38314. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38315. return $arguments[$name];
  38316. }
  38317. public function hasArgument($name)
  38318. {
  38319. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38320. return isset($arguments[$name]);
  38321. }
  38322. public function getArguments()
  38323. {
  38324. return $this->arguments;
  38325. }
  38326. public function getArgumentCount()
  38327. {
  38328. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  38329. }
  38330. public function getArgumentRequiredCount()
  38331. {
  38332. return $this->requiredCount;
  38333. }
  38334. public function getArgumentDefaults()
  38335. {
  38336. $values = array();
  38337. foreach ($this->arguments as $argument) {
  38338. $values[$argument->getName()] = $argument->getDefault();
  38339. }
  38340. return $values;
  38341. }
  38342. public function setOptions($options = array())
  38343. {
  38344. $this->options = array();
  38345. $this->shortcuts = array();
  38346. $this->addOptions($options);
  38347. }
  38348. public function addOptions($options = array())
  38349. {
  38350. foreach ($options as $option) {
  38351. $this->addOption($option);
  38352. }
  38353. }
  38354. public function addOption(InputOption $option)
  38355. {
  38356. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  38357. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  38358. }
  38359. if ($option->getShortcut()) {
  38360. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38361. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  38362. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  38363. }
  38364. }
  38365. }
  38366. $this->options[$option->getName()] = $option;
  38367. if ($option->getShortcut()) {
  38368. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38369. $this->shortcuts[$shortcut] = $option->getName();
  38370. }
  38371. }
  38372. }
  38373. public function getOption($name)
  38374. {
  38375. if (!$this->hasOption($name)) {
  38376. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  38377. }
  38378. return $this->options[$name];
  38379. }
  38380. public function hasOption($name)
  38381. {
  38382. return isset($this->options[$name]);
  38383. }
  38384. public function getOptions()
  38385. {
  38386. return $this->options;
  38387. }
  38388. public function hasShortcut($name)
  38389. {
  38390. return isset($this->shortcuts[$name]);
  38391. }
  38392. public function getOptionForShortcut($shortcut)
  38393. {
  38394. return $this->getOption($this->shortcutToName($shortcut));
  38395. }
  38396. public function getOptionDefaults()
  38397. {
  38398. $values = array();
  38399. foreach ($this->options as $option) {
  38400. $values[$option->getName()] = $option->getDefault();
  38401. }
  38402. return $values;
  38403. }
  38404. private function shortcutToName($shortcut)
  38405. {
  38406. if (!isset($this->shortcuts[$shortcut])) {
  38407. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  38408. }
  38409. return $this->shortcuts[$shortcut];
  38410. }
  38411. public function getSynopsis($short = false)
  38412. {
  38413. $elements = array();
  38414. if ($short && $this->getOptions()) {
  38415. $elements[] = '[options]';
  38416. } elseif (!$short) {
  38417. foreach ($this->getOptions() as $option) {
  38418. $value = '';
  38419. if ($option->acceptValue()) {
  38420. $value = sprintf(
  38421. ' %s%s%s',
  38422. $option->isValueOptional() ? '[' : '',
  38423. strtoupper($option->getName()),
  38424. $option->isValueOptional() ? ']' : ''
  38425. );
  38426. }
  38427. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  38428. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  38429. }
  38430. }
  38431. if (\count($elements) && $this->getArguments()) {
  38432. $elements[] = '[--]';
  38433. }
  38434. foreach ($this->getArguments() as $argument) {
  38435. $element = '<'.$argument->getName().'>';
  38436. if (!$argument->isRequired()) {
  38437. $element = '['.$element.']';
  38438. } elseif ($argument->isArray()) {
  38439. $element .= ' ('.$element.')';
  38440. }
  38441. if ($argument->isArray()) {
  38442. $element .= '...';
  38443. }
  38444. $elements[] = $element;
  38445. }
  38446. return implode(' ', $elements);
  38447. }
  38448. public function asText()
  38449. {
  38450. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38451. $descriptor = new TextDescriptor();
  38452. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  38453. $descriptor->describe($output, $this, array('raw_output' => true));
  38454. return $output->fetch();
  38455. }
  38456. public function asXml($asDom = false)
  38457. {
  38458. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38459. $descriptor = new XmlDescriptor();
  38460. if ($asDom) {
  38461. return $descriptor->getInputDefinitionDocument($this);
  38462. }
  38463. $output = new BufferedOutput();
  38464. $descriptor->describe($output, $this);
  38465. return $output->fetch();
  38466. }
  38467. }
  38468. <?php
  38469. namespace Symfony\Component\Console\Input;
  38470. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38471. use Symfony\Component\Console\Exception\RuntimeException;
  38472. interface InputInterface
  38473. {
  38474. public function getFirstArgument();
  38475. public function hasParameterOption($values);
  38476. public function getParameterOption($values, $default = false);
  38477. public function bind(InputDefinition $definition);
  38478. public function validate();
  38479. public function getArguments();
  38480. public function getArgument($name);
  38481. public function setArgument($name, $value);
  38482. public function hasArgument($name);
  38483. public function getOptions();
  38484. public function getOption($name);
  38485. public function setOption($name, $value);
  38486. public function hasOption($name);
  38487. public function isInteractive();
  38488. public function setInteractive($interactive);
  38489. }
  38490. <?php
  38491. namespace Symfony\Component\Console\Input;
  38492. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38493. use Symfony\Component\Console\Exception\LogicException;
  38494. class InputOption
  38495. {
  38496. const VALUE_NONE = 1;
  38497. const VALUE_REQUIRED = 2;
  38498. const VALUE_OPTIONAL = 4;
  38499. const VALUE_IS_ARRAY = 8;
  38500. private $name;
  38501. private $shortcut;
  38502. private $mode;
  38503. private $default;
  38504. private $description;
  38505. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  38506. {
  38507. if (0 === strpos($name, '--')) {
  38508. $name = substr($name, 2);
  38509. }
  38510. if (empty($name)) {
  38511. throw new InvalidArgumentException('An option name cannot be empty.');
  38512. }
  38513. if (empty($shortcut)) {
  38514. $shortcut = null;
  38515. }
  38516. if (null !== $shortcut) {
  38517. if (\is_array($shortcut)) {
  38518. $shortcut = implode('|', $shortcut);
  38519. }
  38520. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  38521. $shortcuts = array_filter($shortcuts);
  38522. $shortcut = implode('|', $shortcuts);
  38523. if (empty($shortcut)) {
  38524. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  38525. }
  38526. }
  38527. if (null === $mode) {
  38528. $mode = self::VALUE_NONE;
  38529. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  38530. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  38531. }
  38532. $this->name = $name;
  38533. $this->shortcut = $shortcut;
  38534. $this->mode = $mode;
  38535. $this->description = $description;
  38536. if ($this->isArray() && !$this->acceptValue()) {
  38537. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  38538. }
  38539. $this->setDefault($default);
  38540. }
  38541. public function getShortcut()
  38542. {
  38543. return $this->shortcut;
  38544. }
  38545. public function getName()
  38546. {
  38547. return $this->name;
  38548. }
  38549. public function acceptValue()
  38550. {
  38551. return $this->isValueRequired() || $this->isValueOptional();
  38552. }
  38553. public function isValueRequired()
  38554. {
  38555. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  38556. }
  38557. public function isValueOptional()
  38558. {
  38559. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  38560. }
  38561. public function isArray()
  38562. {
  38563. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  38564. }
  38565. public function setDefault($default = null)
  38566. {
  38567. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  38568. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  38569. }
  38570. if ($this->isArray()) {
  38571. if (null === $default) {
  38572. $default = array();
  38573. } elseif (!\is_array($default)) {
  38574. throw new LogicException('A default value for an array option must be an array.');
  38575. }
  38576. }
  38577. $this->default = $this->acceptValue() ? $default : false;
  38578. }
  38579. public function getDefault()
  38580. {
  38581. return $this->default;
  38582. }
  38583. public function getDescription()
  38584. {
  38585. return $this->description;
  38586. }
  38587. public function equals(self $option)
  38588. {
  38589. return $option->getName() === $this->getName()
  38590. && $option->getShortcut() === $this->getShortcut()
  38591. && $option->getDefault() === $this->getDefault()
  38592. && $option->isArray() === $this->isArray()
  38593. && $option->isValueRequired() === $this->isValueRequired()
  38594. && $option->isValueOptional() === $this->isValueOptional()
  38595. ;
  38596. }
  38597. }
  38598. <?php
  38599. namespace Symfony\Component\Console\Input;
  38600. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38601. class StringInput extends ArgvInput
  38602. {
  38603. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  38604. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  38605. public function __construct($input, InputDefinition $definition = null)
  38606. {
  38607. if ($definition) {
  38608. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  38609. }
  38610. parent::__construct(array(), null);
  38611. $this->setTokens($this->tokenize($input));
  38612. if (null !== $definition) {
  38613. $this->bind($definition);
  38614. }
  38615. }
  38616. private function tokenize($input)
  38617. {
  38618. $tokens = array();
  38619. $length = \strlen($input);
  38620. $cursor = 0;
  38621. while ($cursor < $length) {
  38622. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  38623. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  38624. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  38625. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  38626. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  38627. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  38628. $tokens[] = stripcslashes($match[1]);
  38629. } else {
  38630. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  38631. }
  38632. $cursor += \strlen($match[0]);
  38633. }
  38634. return $tokens;
  38635. }
  38636. }
  38637. Copyright (c) 2004-2018 Fabien Potencier
  38638. Permission is hereby granted, free of charge, to any person obtaining a copy
  38639. of this software and associated documentation files (the "Software"), to deal
  38640. in the Software without restriction, including without limitation the rights
  38641. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38642. copies of the Software, and to permit persons to whom the Software is furnished
  38643. to do so, subject to the following conditions:
  38644. The above copyright notice and this permission notice shall be included in all
  38645. copies or substantial portions of the Software.
  38646. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38647. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38648. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38649. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38650. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38651. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38652. THE SOFTWARE.
  38653. <?php
  38654. namespace Symfony\Component\Console\Logger;
  38655. use Psr\Log\AbstractLogger;
  38656. use Psr\Log\InvalidArgumentException;
  38657. use Psr\Log\LogLevel;
  38658. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  38659. use Symfony\Component\Console\Output\OutputInterface;
  38660. class ConsoleLogger extends AbstractLogger
  38661. {
  38662. const INFO = 'info';
  38663. const ERROR = 'error';
  38664. private $output;
  38665. private $verbosityLevelMap = array(
  38666. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  38667. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  38668. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  38669. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  38670. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  38671. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  38672. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  38673. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  38674. );
  38675. private $formatLevelMap = array(
  38676. LogLevel::EMERGENCY => self::ERROR,
  38677. LogLevel::ALERT => self::ERROR,
  38678. LogLevel::CRITICAL => self::ERROR,
  38679. LogLevel::ERROR => self::ERROR,
  38680. LogLevel::WARNING => self::INFO,
  38681. LogLevel::NOTICE => self::INFO,
  38682. LogLevel::INFO => self::INFO,
  38683. LogLevel::DEBUG => self::INFO,
  38684. );
  38685. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  38686. {
  38687. $this->output = $output;
  38688. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  38689. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  38690. }
  38691. public function log($level, $message, array $context = array())
  38692. {
  38693. if (!isset($this->verbosityLevelMap[$level])) {
  38694. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  38695. }
  38696. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  38697. $output = $this->output->getErrorOutput();
  38698. } else {
  38699. $output = $this->output;
  38700. }
  38701. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  38702. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  38703. }
  38704. }
  38705. private function interpolate($message, array $context)
  38706. {
  38707. $replace = array();
  38708. foreach ($context as $key => $val) {
  38709. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  38710. $replace[sprintf('{%s}', $key)] = $val;
  38711. }
  38712. }
  38713. return strtr($message, $replace);
  38714. }
  38715. }
  38716. <?php
  38717. namespace Symfony\Component\Console\Output;
  38718. class BufferedOutput extends Output
  38719. {
  38720. private $buffer = '';
  38721. public function fetch()
  38722. {
  38723. $content = $this->buffer;
  38724. $this->buffer = '';
  38725. return $content;
  38726. }
  38727. protected function doWrite($message, $newline)
  38728. {
  38729. $this->buffer .= $message;
  38730. if ($newline) {
  38731. $this->buffer .= PHP_EOL;
  38732. }
  38733. }
  38734. }
  38735. <?php
  38736. namespace Symfony\Component\Console\Output;
  38737. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38738. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  38739. {
  38740. private $stderr;
  38741. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38742. {
  38743. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  38744. $actualDecorated = $this->isDecorated();
  38745. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  38746. if (null === $decorated) {
  38747. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  38748. }
  38749. }
  38750. public function setDecorated($decorated)
  38751. {
  38752. parent::setDecorated($decorated);
  38753. $this->stderr->setDecorated($decorated);
  38754. }
  38755. public function setFormatter(OutputFormatterInterface $formatter)
  38756. {
  38757. parent::setFormatter($formatter);
  38758. $this->stderr->setFormatter($formatter);
  38759. }
  38760. public function setVerbosity($level)
  38761. {
  38762. parent::setVerbosity($level);
  38763. $this->stderr->setVerbosity($level);
  38764. }
  38765. public function getErrorOutput()
  38766. {
  38767. return $this->stderr;
  38768. }
  38769. public function setErrorOutput(OutputInterface $error)
  38770. {
  38771. $this->stderr = $error;
  38772. }
  38773. protected function hasStdoutSupport()
  38774. {
  38775. return false === $this->isRunningOS400();
  38776. }
  38777. protected function hasStderrSupport()
  38778. {
  38779. return false === $this->isRunningOS400();
  38780. }
  38781. private function isRunningOS400()
  38782. {
  38783. $checks = array(
  38784. \function_exists('php_uname') ? php_uname('s') : '',
  38785. getenv('OSTYPE'),
  38786. PHP_OS,
  38787. );
  38788. return false !== stripos(implode(';', $checks), 'OS400');
  38789. }
  38790. private function openOutputStream()
  38791. {
  38792. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  38793. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  38794. }
  38795. private function openErrorStream()
  38796. {
  38797. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  38798. return fopen($errorStream, 'w');
  38799. }
  38800. }
  38801. <?php
  38802. namespace Symfony\Component\Console\Output;
  38803. interface ConsoleOutputInterface extends OutputInterface
  38804. {
  38805. public function getErrorOutput();
  38806. public function setErrorOutput(OutputInterface $error);
  38807. }
  38808. <?php
  38809. namespace Symfony\Component\Console\Output;
  38810. use Symfony\Component\Console\Formatter\OutputFormatter;
  38811. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38812. class NullOutput implements OutputInterface
  38813. {
  38814. public function setFormatter(OutputFormatterInterface $formatter)
  38815. {
  38816. }
  38817. public function getFormatter()
  38818. {
  38819. return new OutputFormatter();
  38820. }
  38821. public function setDecorated($decorated)
  38822. {
  38823. }
  38824. public function isDecorated()
  38825. {
  38826. return false;
  38827. }
  38828. public function setVerbosity($level)
  38829. {
  38830. }
  38831. public function getVerbosity()
  38832. {
  38833. return self::VERBOSITY_QUIET;
  38834. }
  38835. public function isQuiet()
  38836. {
  38837. return true;
  38838. }
  38839. public function isVerbose()
  38840. {
  38841. return false;
  38842. }
  38843. public function isVeryVerbose()
  38844. {
  38845. return false;
  38846. }
  38847. public function isDebug()
  38848. {
  38849. return false;
  38850. }
  38851. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38852. {
  38853. }
  38854. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38855. {
  38856. }
  38857. }
  38858. <?php
  38859. namespace Symfony\Component\Console\Output;
  38860. use Symfony\Component\Console\Formatter\OutputFormatter;
  38861. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38862. abstract class Output implements OutputInterface
  38863. {
  38864. private $verbosity;
  38865. private $formatter;
  38866. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  38867. {
  38868. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  38869. $this->formatter = $formatter ?: new OutputFormatter();
  38870. $this->formatter->setDecorated($decorated);
  38871. }
  38872. public function setFormatter(OutputFormatterInterface $formatter)
  38873. {
  38874. $this->formatter = $formatter;
  38875. }
  38876. public function getFormatter()
  38877. {
  38878. return $this->formatter;
  38879. }
  38880. public function setDecorated($decorated)
  38881. {
  38882. $this->formatter->setDecorated($decorated);
  38883. }
  38884. public function isDecorated()
  38885. {
  38886. return $this->formatter->isDecorated();
  38887. }
  38888. public function setVerbosity($level)
  38889. {
  38890. $this->verbosity = (int) $level;
  38891. }
  38892. public function getVerbosity()
  38893. {
  38894. return $this->verbosity;
  38895. }
  38896. public function isQuiet()
  38897. {
  38898. return self::VERBOSITY_QUIET === $this->verbosity;
  38899. }
  38900. public function isVerbose()
  38901. {
  38902. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  38903. }
  38904. public function isVeryVerbose()
  38905. {
  38906. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  38907. }
  38908. public function isDebug()
  38909. {
  38910. return self::VERBOSITY_DEBUG <= $this->verbosity;
  38911. }
  38912. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38913. {
  38914. $this->write($messages, true, $options);
  38915. }
  38916. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38917. {
  38918. $messages = (array) $messages;
  38919. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  38920. $type = $types & $options ?: self::OUTPUT_NORMAL;
  38921. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  38922. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  38923. if ($verbosity > $this->getVerbosity()) {
  38924. return;
  38925. }
  38926. foreach ($messages as $message) {
  38927. switch ($type) {
  38928. case OutputInterface::OUTPUT_NORMAL:
  38929. $message = $this->formatter->format($message);
  38930. break;
  38931. case OutputInterface::OUTPUT_RAW:
  38932. break;
  38933. case OutputInterface::OUTPUT_PLAIN:
  38934. $message = strip_tags($this->formatter->format($message));
  38935. break;
  38936. }
  38937. $this->doWrite($message, $newline);
  38938. }
  38939. }
  38940. abstract protected function doWrite($message, $newline);
  38941. }
  38942. <?php
  38943. namespace Symfony\Component\Console\Output;
  38944. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38945. interface OutputInterface
  38946. {
  38947. const VERBOSITY_QUIET = 16;
  38948. const VERBOSITY_NORMAL = 32;
  38949. const VERBOSITY_VERBOSE = 64;
  38950. const VERBOSITY_VERY_VERBOSE = 128;
  38951. const VERBOSITY_DEBUG = 256;
  38952. const OUTPUT_NORMAL = 1;
  38953. const OUTPUT_RAW = 2;
  38954. const OUTPUT_PLAIN = 4;
  38955. public function write($messages, $newline = false, $options = 0);
  38956. public function writeln($messages, $options = 0);
  38957. public function setVerbosity($level);
  38958. public function getVerbosity();
  38959. public function setDecorated($decorated);
  38960. public function isDecorated();
  38961. public function setFormatter(OutputFormatterInterface $formatter);
  38962. public function getFormatter();
  38963. }
  38964. <?php
  38965. namespace Symfony\Component\Console\Output;
  38966. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38967. use Symfony\Component\Console\Exception\RuntimeException;
  38968. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38969. class StreamOutput extends Output
  38970. {
  38971. private $stream;
  38972. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38973. {
  38974. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  38975. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  38976. }
  38977. $this->stream = $stream;
  38978. if (null === $decorated) {
  38979. $decorated = $this->hasColorSupport();
  38980. }
  38981. parent::__construct($verbosity, $decorated, $formatter);
  38982. }
  38983. public function getStream()
  38984. {
  38985. return $this->stream;
  38986. }
  38987. protected function doWrite($message, $newline)
  38988. {
  38989. if ($newline) {
  38990. $message .= PHP_EOL;
  38991. }
  38992. if (false === @fwrite($this->stream, $message)) {
  38993. throw new RuntimeException('Unable to write output.');
  38994. }
  38995. fflush($this->stream);
  38996. }
  38997. protected function hasColorSupport()
  38998. {
  38999. if ('Hyper' === getenv('TERM_PROGRAM')) {
  39000. return true;
  39001. }
  39002. if (\DIRECTORY_SEPARATOR === '\\') {
  39003. return (\function_exists('sapi_windows_vt100_support')
  39004. && @sapi_windows_vt100_support($this->stream))
  39005. || false !== getenv('ANSICON')
  39006. || 'ON' === getenv('ConEmuANSI')
  39007. || 'xterm' === getenv('TERM');
  39008. }
  39009. if (\function_exists('stream_isatty')) {
  39010. return @stream_isatty($this->stream);
  39011. }
  39012. if (\function_exists('posix_isatty')) {
  39013. return @posix_isatty($this->stream);
  39014. }
  39015. $stat = @fstat($this->stream);
  39016. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  39017. }
  39018. }
  39019. <?php
  39020. namespace Symfony\Component\Console\Question;
  39021. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39022. class ChoiceQuestion extends Question
  39023. {
  39024. private $choices;
  39025. private $multiselect = false;
  39026. private $prompt = ' > ';
  39027. private $errorMessage = 'Value "%s" is invalid';
  39028. public function __construct($question, array $choices, $default = null)
  39029. {
  39030. if (!$choices) {
  39031. throw new \LogicException('Choice question must have at least 1 choice available.');
  39032. }
  39033. parent::__construct($question, $default);
  39034. $this->choices = $choices;
  39035. $this->setValidator($this->getDefaultValidator());
  39036. $this->setAutocompleterValues($choices);
  39037. }
  39038. public function getChoices()
  39039. {
  39040. return $this->choices;
  39041. }
  39042. public function setMultiselect($multiselect)
  39043. {
  39044. $this->multiselect = $multiselect;
  39045. $this->setValidator($this->getDefaultValidator());
  39046. return $this;
  39047. }
  39048. public function isMultiselect()
  39049. {
  39050. return $this->multiselect;
  39051. }
  39052. public function getPrompt()
  39053. {
  39054. return $this->prompt;
  39055. }
  39056. public function setPrompt($prompt)
  39057. {
  39058. $this->prompt = $prompt;
  39059. return $this;
  39060. }
  39061. public function setErrorMessage($errorMessage)
  39062. {
  39063. $this->errorMessage = $errorMessage;
  39064. $this->setValidator($this->getDefaultValidator());
  39065. return $this;
  39066. }
  39067. private function getDefaultValidator()
  39068. {
  39069. $choices = $this->choices;
  39070. $errorMessage = $this->errorMessage;
  39071. $multiselect = $this->multiselect;
  39072. $isAssoc = $this->isAssoc($choices);
  39073. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  39074. $selectedChoices = str_replace(' ', '', $selected);
  39075. if ($multiselect) {
  39076. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  39077. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  39078. }
  39079. $selectedChoices = explode(',', $selectedChoices);
  39080. } else {
  39081. $selectedChoices = array($selected);
  39082. }
  39083. $multiselectChoices = array();
  39084. foreach ($selectedChoices as $value) {
  39085. $results = array();
  39086. foreach ($choices as $key => $choice) {
  39087. if ($choice === $value) {
  39088. $results[] = $key;
  39089. }
  39090. }
  39091. if (\count($results) > 1) {
  39092. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  39093. }
  39094. $result = array_search($value, $choices);
  39095. if (!$isAssoc) {
  39096. if (false !== $result) {
  39097. $result = $choices[$result];
  39098. } elseif (isset($choices[$value])) {
  39099. $result = $choices[$value];
  39100. }
  39101. } elseif (false === $result && isset($choices[$value])) {
  39102. $result = $value;
  39103. }
  39104. if (false === $result) {
  39105. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  39106. }
  39107. $multiselectChoices[] = (string) $result;
  39108. }
  39109. if ($multiselect) {
  39110. return $multiselectChoices;
  39111. }
  39112. return current($multiselectChoices);
  39113. };
  39114. }
  39115. }
  39116. <?php
  39117. namespace Symfony\Component\Console\Question;
  39118. class ConfirmationQuestion extends Question
  39119. {
  39120. private $trueAnswerRegex;
  39121. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  39122. {
  39123. parent::__construct($question, (bool) $default);
  39124. $this->trueAnswerRegex = $trueAnswerRegex;
  39125. $this->setNormalizer($this->getDefaultNormalizer());
  39126. }
  39127. private function getDefaultNormalizer()
  39128. {
  39129. $default = $this->getDefault();
  39130. $regex = $this->trueAnswerRegex;
  39131. return function ($answer) use ($default, $regex) {
  39132. if (\is_bool($answer)) {
  39133. return $answer;
  39134. }
  39135. $answerIsTrue = (bool) preg_match($regex, $answer);
  39136. if (false === $default) {
  39137. return $answer && $answerIsTrue;
  39138. }
  39139. return !$answer || $answerIsTrue;
  39140. };
  39141. }
  39142. }
  39143. <?php
  39144. namespace Symfony\Component\Console\Question;
  39145. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39146. use Symfony\Component\Console\Exception\LogicException;
  39147. class Question
  39148. {
  39149. private $question;
  39150. private $attempts;
  39151. private $hidden = false;
  39152. private $hiddenFallback = true;
  39153. private $autocompleterValues;
  39154. private $validator;
  39155. private $default;
  39156. private $normalizer;
  39157. public function __construct($question, $default = null)
  39158. {
  39159. $this->question = $question;
  39160. $this->default = $default;
  39161. }
  39162. public function getQuestion()
  39163. {
  39164. return $this->question;
  39165. }
  39166. public function getDefault()
  39167. {
  39168. return $this->default;
  39169. }
  39170. public function isHidden()
  39171. {
  39172. return $this->hidden;
  39173. }
  39174. public function setHidden($hidden)
  39175. {
  39176. if ($this->autocompleterValues) {
  39177. throw new LogicException('A hidden question cannot use the autocompleter.');
  39178. }
  39179. $this->hidden = (bool) $hidden;
  39180. return $this;
  39181. }
  39182. public function isHiddenFallback()
  39183. {
  39184. return $this->hiddenFallback;
  39185. }
  39186. public function setHiddenFallback($fallback)
  39187. {
  39188. $this->hiddenFallback = (bool) $fallback;
  39189. return $this;
  39190. }
  39191. public function getAutocompleterValues()
  39192. {
  39193. return $this->autocompleterValues;
  39194. }
  39195. public function setAutocompleterValues($values)
  39196. {
  39197. if (\is_array($values)) {
  39198. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  39199. }
  39200. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  39201. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  39202. }
  39203. if ($this->hidden) {
  39204. throw new LogicException('A hidden question cannot use the autocompleter.');
  39205. }
  39206. $this->autocompleterValues = $values;
  39207. return $this;
  39208. }
  39209. public function setValidator($validator)
  39210. {
  39211. $this->validator = $validator;
  39212. return $this;
  39213. }
  39214. public function getValidator()
  39215. {
  39216. return $this->validator;
  39217. }
  39218. public function setMaxAttempts($attempts)
  39219. {
  39220. if (null !== $attempts && $attempts < 1) {
  39221. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  39222. }
  39223. $this->attempts = $attempts;
  39224. return $this;
  39225. }
  39226. public function getMaxAttempts()
  39227. {
  39228. return $this->attempts;
  39229. }
  39230. public function setNormalizer($normalizer)
  39231. {
  39232. $this->normalizer = $normalizer;
  39233. return $this;
  39234. }
  39235. public function getNormalizer()
  39236. {
  39237. return $this->normalizer;
  39238. }
  39239. protected function isAssoc($array)
  39240. {
  39241. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  39242. }
  39243. }
  39244. <?php
  39245. namespace Symfony\Component\Console;
  39246. use Symfony\Component\Console\Exception\RuntimeException;
  39247. use Symfony\Component\Console\Input\StringInput;
  39248. use Symfony\Component\Console\Output\ConsoleOutput;
  39249. use Symfony\Component\Process\PhpExecutableFinder;
  39250. use Symfony\Component\Process\ProcessBuilder;
  39251. class Shell
  39252. {
  39253. private $application;
  39254. private $history;
  39255. private $output;
  39256. private $hasReadline;
  39257. private $processIsolation = false;
  39258. public function __construct(Application $application)
  39259. {
  39260. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39261. $this->hasReadline = \function_exists('readline');
  39262. $this->application = $application;
  39263. $this->history = getenv('HOME').'/.history_'.$application->getName();
  39264. $this->output = new ConsoleOutput();
  39265. }
  39266. public function run()
  39267. {
  39268. $this->application->setAutoExit(false);
  39269. $this->application->setCatchExceptions(true);
  39270. if ($this->hasReadline) {
  39271. readline_read_history($this->history);
  39272. readline_completion_function(array($this, 'autocompleter'));
  39273. }
  39274. $this->output->writeln($this->getHeader());
  39275. $php = null;
  39276. if ($this->processIsolation) {
  39277. $finder = new PhpExecutableFinder();
  39278. $php = $finder->find();
  39279. $this->output->writeln(<<<'EOF'
  39280. <info>Running with process isolation, you should consider this:</info>
  39281. * each command is executed as separate process,
  39282. * commands don't support interactivity, all params must be passed explicitly,
  39283. * commands output is not colorized.
  39284. EOF
  39285. );
  39286. }
  39287. while (true) {
  39288. $command = $this->readline();
  39289. if (false === $command) {
  39290. $this->output->writeln("\n");
  39291. break;
  39292. }
  39293. if ($this->hasReadline) {
  39294. readline_add_history($command);
  39295. readline_write_history($this->history);
  39296. }
  39297. if ($this->processIsolation) {
  39298. $pb = new ProcessBuilder();
  39299. $process = $pb
  39300. ->add($php)
  39301. ->add($_SERVER['argv'][0])
  39302. ->add($command)
  39303. ->inheritEnvironmentVariables(true)
  39304. ->getProcess()
  39305. ;
  39306. $output = $this->output;
  39307. $process->run(function ($type, $data) use ($output) {
  39308. $output->writeln($data);
  39309. });
  39310. $ret = $process->getExitCode();
  39311. } else {
  39312. $ret = $this->application->run(new StringInput($command), $this->output);
  39313. }
  39314. if (0 !== $ret) {
  39315. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  39316. }
  39317. }
  39318. }
  39319. protected function getHeader()
  39320. {
  39321. return <<<EOF
  39322. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  39323. At the prompt, type <comment>help</comment> for some help,
  39324. or <comment>list</comment> to get a list of available commands.
  39325. To exit the shell, type <comment>^D</comment>.
  39326. EOF;
  39327. }
  39328. protected function getPrompt()
  39329. {
  39330. return $this->output->getFormatter()->format($this->application->getName().' > ');
  39331. }
  39332. protected function getOutput()
  39333. {
  39334. return $this->output;
  39335. }
  39336. protected function getApplication()
  39337. {
  39338. return $this->application;
  39339. }
  39340. private function autocompleter($text)
  39341. {
  39342. $info = readline_info();
  39343. $text = substr($info['line_buffer'], 0, $info['end']);
  39344. if ($info['point'] !== $info['end']) {
  39345. return true;
  39346. }
  39347. if (false === strpos($text, ' ') || !$text) {
  39348. return array_keys($this->application->all());
  39349. }
  39350. try {
  39351. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  39352. } catch (\Exception $e) {
  39353. return true;
  39354. }
  39355. $list = array('--help');
  39356. foreach ($command->getDefinition()->getOptions() as $option) {
  39357. $list[] = '--'.$option->getName();
  39358. }
  39359. return $list;
  39360. }
  39361. private function readline()
  39362. {
  39363. if ($this->hasReadline) {
  39364. $line = readline($this->getPrompt());
  39365. } else {
  39366. $this->output->write($this->getPrompt());
  39367. $line = fgets(STDIN, 1024);
  39368. $line = (false === $line || '' === $line) ? false : rtrim($line);
  39369. }
  39370. return $line;
  39371. }
  39372. public function getProcessIsolation()
  39373. {
  39374. return $this->processIsolation;
  39375. }
  39376. public function setProcessIsolation($processIsolation)
  39377. {
  39378. $this->processIsolation = (bool) $processIsolation;
  39379. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  39380. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  39381. }
  39382. }
  39383. }
  39384. <?php
  39385. namespace Symfony\Component\Console\Style;
  39386. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  39387. use Symfony\Component\Console\Helper\ProgressBar;
  39388. use Symfony\Component\Console\Output\OutputInterface;
  39389. abstract class OutputStyle implements OutputInterface, StyleInterface
  39390. {
  39391. private $output;
  39392. public function __construct(OutputInterface $output)
  39393. {
  39394. $this->output = $output;
  39395. }
  39396. public function newLine($count = 1)
  39397. {
  39398. $this->output->write(str_repeat(PHP_EOL, $count));
  39399. }
  39400. public function createProgressBar($max = 0)
  39401. {
  39402. return new ProgressBar($this->output, $max);
  39403. }
  39404. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39405. {
  39406. $this->output->write($messages, $newline, $type);
  39407. }
  39408. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39409. {
  39410. $this->output->writeln($messages, $type);
  39411. }
  39412. public function setVerbosity($level)
  39413. {
  39414. $this->output->setVerbosity($level);
  39415. }
  39416. public function getVerbosity()
  39417. {
  39418. return $this->output->getVerbosity();
  39419. }
  39420. public function setDecorated($decorated)
  39421. {
  39422. $this->output->setDecorated($decorated);
  39423. }
  39424. public function isDecorated()
  39425. {
  39426. return $this->output->isDecorated();
  39427. }
  39428. public function setFormatter(OutputFormatterInterface $formatter)
  39429. {
  39430. $this->output->setFormatter($formatter);
  39431. }
  39432. public function getFormatter()
  39433. {
  39434. return $this->output->getFormatter();
  39435. }
  39436. }
  39437. <?php
  39438. namespace Symfony\Component\Console\Style;
  39439. interface StyleInterface
  39440. {
  39441. public function title($message);
  39442. public function section($message);
  39443. public function listing(array $elements);
  39444. public function text($message);
  39445. public function success($message);
  39446. public function error($message);
  39447. public function warning($message);
  39448. public function note($message);
  39449. public function caution($message);
  39450. public function table(array $headers, array $rows);
  39451. public function ask($question, $default = null, $validator = null);
  39452. public function askHidden($question, $validator = null);
  39453. public function confirm($question, $default = true);
  39454. public function choice($question, array $choices, $default = null);
  39455. public function newLine($count = 1);
  39456. public function progressStart($max = 0);
  39457. public function progressAdvance($step = 1);
  39458. public function progressFinish();
  39459. }
  39460. <?php
  39461. namespace Symfony\Component\Console\Style;
  39462. use Symfony\Component\Console\Application;
  39463. use Symfony\Component\Console\Exception\RuntimeException;
  39464. use Symfony\Component\Console\Formatter\OutputFormatter;
  39465. use Symfony\Component\Console\Helper\Helper;
  39466. use Symfony\Component\Console\Helper\ProgressBar;
  39467. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  39468. use Symfony\Component\Console\Helper\Table;
  39469. use Symfony\Component\Console\Input\InputInterface;
  39470. use Symfony\Component\Console\Output\BufferedOutput;
  39471. use Symfony\Component\Console\Output\OutputInterface;
  39472. use Symfony\Component\Console\Question\ChoiceQuestion;
  39473. use Symfony\Component\Console\Question\ConfirmationQuestion;
  39474. use Symfony\Component\Console\Question\Question;
  39475. class SymfonyStyle extends OutputStyle
  39476. {
  39477. const MAX_LINE_LENGTH = 120;
  39478. private $input;
  39479. private $questionHelper;
  39480. private $progressBar;
  39481. private $lineLength;
  39482. private $bufferedOutput;
  39483. public function __construct(InputInterface $input, OutputInterface $output)
  39484. {
  39485. $this->input = $input;
  39486. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  39487. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  39488. parent::__construct($output);
  39489. }
  39490. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  39491. {
  39492. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  39493. $this->autoPrependBlock();
  39494. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  39495. $this->newLine();
  39496. }
  39497. public function title($message)
  39498. {
  39499. $this->autoPrependBlock();
  39500. $this->writeln(array(
  39501. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39502. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39503. ));
  39504. $this->newLine();
  39505. }
  39506. public function section($message)
  39507. {
  39508. $this->autoPrependBlock();
  39509. $this->writeln(array(
  39510. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39511. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39512. ));
  39513. $this->newLine();
  39514. }
  39515. public function listing(array $elements)
  39516. {
  39517. $this->autoPrependText();
  39518. $elements = array_map(function ($element) {
  39519. return sprintf(' * %s', $element);
  39520. }, $elements);
  39521. $this->writeln($elements);
  39522. $this->newLine();
  39523. }
  39524. public function text($message)
  39525. {
  39526. $this->autoPrependText();
  39527. $messages = \is_array($message) ? array_values($message) : array($message);
  39528. foreach ($messages as $message) {
  39529. $this->writeln(sprintf(' %s', $message));
  39530. }
  39531. }
  39532. public function comment($message)
  39533. {
  39534. $messages = \is_array($message) ? array_values($message) : array($message);
  39535. $this->autoPrependBlock();
  39536. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  39537. $this->newLine();
  39538. }
  39539. public function success($message)
  39540. {
  39541. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  39542. }
  39543. public function error($message)
  39544. {
  39545. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  39546. }
  39547. public function warning($message)
  39548. {
  39549. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  39550. }
  39551. public function note($message)
  39552. {
  39553. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  39554. }
  39555. public function caution($message)
  39556. {
  39557. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  39558. }
  39559. public function table(array $headers, array $rows)
  39560. {
  39561. $style = clone Table::getStyleDefinition('symfony-style-guide');
  39562. $style->setCellHeaderFormat('<info>%s</info>');
  39563. $table = new Table($this);
  39564. $table->setHeaders($headers);
  39565. $table->setRows($rows);
  39566. $table->setStyle($style);
  39567. $table->render();
  39568. $this->newLine();
  39569. }
  39570. public function ask($question, $default = null, $validator = null)
  39571. {
  39572. $question = new Question($question, $default);
  39573. $question->setValidator($validator);
  39574. return $this->askQuestion($question);
  39575. }
  39576. public function askHidden($question, $validator = null)
  39577. {
  39578. $question = new Question($question);
  39579. $question->setHidden(true);
  39580. $question->setValidator($validator);
  39581. return $this->askQuestion($question);
  39582. }
  39583. public function confirm($question, $default = true)
  39584. {
  39585. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  39586. }
  39587. public function choice($question, array $choices, $default = null)
  39588. {
  39589. if (null !== $default) {
  39590. $values = array_flip($choices);
  39591. $default = $values[$default];
  39592. }
  39593. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  39594. }
  39595. public function progressStart($max = 0)
  39596. {
  39597. $this->progressBar = $this->createProgressBar($max);
  39598. $this->progressBar->start();
  39599. }
  39600. public function progressAdvance($step = 1)
  39601. {
  39602. $this->getProgressBar()->advance($step);
  39603. }
  39604. public function progressFinish()
  39605. {
  39606. $this->getProgressBar()->finish();
  39607. $this->newLine(2);
  39608. $this->progressBar = null;
  39609. }
  39610. public function createProgressBar($max = 0)
  39611. {
  39612. $progressBar = parent::createProgressBar($max);
  39613. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  39614. $progressBar->setEmptyBarCharacter('â–‘');
  39615. $progressBar->setProgressCharacter('');
  39616. $progressBar->setBarCharacter('â–“');
  39617. }
  39618. return $progressBar;
  39619. }
  39620. public function askQuestion(Question $question)
  39621. {
  39622. if ($this->input->isInteractive()) {
  39623. $this->autoPrependBlock();
  39624. }
  39625. if (!$this->questionHelper) {
  39626. $this->questionHelper = new SymfonyQuestionHelper();
  39627. }
  39628. $answer = $this->questionHelper->ask($this->input, $this, $question);
  39629. if ($this->input->isInteractive()) {
  39630. $this->newLine();
  39631. $this->bufferedOutput->write("\n");
  39632. }
  39633. return $answer;
  39634. }
  39635. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39636. {
  39637. parent::writeln($messages, $type);
  39638. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  39639. }
  39640. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39641. {
  39642. parent::write($messages, $newline, $type);
  39643. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  39644. }
  39645. public function newLine($count = 1)
  39646. {
  39647. parent::newLine($count);
  39648. $this->bufferedOutput->write(str_repeat("\n", $count));
  39649. }
  39650. private function getProgressBar()
  39651. {
  39652. if (!$this->progressBar) {
  39653. throw new RuntimeException('The ProgressBar is not started.');
  39654. }
  39655. return $this->progressBar;
  39656. }
  39657. private function getTerminalWidth()
  39658. {
  39659. $application = new Application();
  39660. $dimensions = $application->getTerminalDimensions();
  39661. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  39662. }
  39663. private function autoPrependBlock()
  39664. {
  39665. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  39666. if (!isset($chars[0])) {
  39667. return $this->newLine();
  39668. }
  39669. $this->newLine(2 - substr_count($chars, "\n"));
  39670. }
  39671. private function autoPrependText()
  39672. {
  39673. $fetched = $this->bufferedOutput->fetch();
  39674. if ("\n" !== substr($fetched, -1)) {
  39675. $this->newLine();
  39676. }
  39677. }
  39678. private function reduceBuffer($messages)
  39679. {
  39680. return array_map(function ($value) {
  39681. return substr($value, -4);
  39682. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  39683. }
  39684. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  39685. {
  39686. $indentLength = 0;
  39687. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  39688. $lines = array();
  39689. if (null !== $type) {
  39690. $type = sprintf('[%s] ', $type);
  39691. $indentLength = \strlen($type);
  39692. $lineIndentation = str_repeat(' ', $indentLength);
  39693. }
  39694. foreach ($messages as $key => $message) {
  39695. if ($escape) {
  39696. $message = OutputFormatter::escape($message);
  39697. }
  39698. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  39699. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  39700. $lines[] = '';
  39701. }
  39702. }
  39703. $firstLineIndex = 0;
  39704. if ($padding && $this->isDecorated()) {
  39705. $firstLineIndex = 1;
  39706. array_unshift($lines, '');
  39707. $lines[] = '';
  39708. }
  39709. foreach ($lines as $i => &$line) {
  39710. if (null !== $type) {
  39711. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  39712. }
  39713. $line = $prefix.$line;
  39714. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  39715. if ($style) {
  39716. $line = sprintf('<%s>%s</>', $style, $line);
  39717. }
  39718. }
  39719. return $lines;
  39720. }
  39721. }
  39722. <?php
  39723. namespace Symfony\Component\Console\Tester;
  39724. use Symfony\Component\Console\Application;
  39725. use Symfony\Component\Console\Input\ArrayInput;
  39726. use Symfony\Component\Console\Input\InputInterface;
  39727. use Symfony\Component\Console\Output\OutputInterface;
  39728. use Symfony\Component\Console\Output\StreamOutput;
  39729. class ApplicationTester
  39730. {
  39731. private $application;
  39732. private $input;
  39733. private $output;
  39734. private $statusCode;
  39735. public function __construct(Application $application)
  39736. {
  39737. $this->application = $application;
  39738. }
  39739. public function run(array $input, $options = array())
  39740. {
  39741. $this->input = new ArrayInput($input);
  39742. if (isset($options['interactive'])) {
  39743. $this->input->setInteractive($options['interactive']);
  39744. }
  39745. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39746. if (isset($options['decorated'])) {
  39747. $this->output->setDecorated($options['decorated']);
  39748. }
  39749. if (isset($options['verbosity'])) {
  39750. $this->output->setVerbosity($options['verbosity']);
  39751. }
  39752. return $this->statusCode = $this->application->run($this->input, $this->output);
  39753. }
  39754. public function getDisplay($normalize = false)
  39755. {
  39756. rewind($this->output->getStream());
  39757. $display = stream_get_contents($this->output->getStream());
  39758. if ($normalize) {
  39759. $display = str_replace(PHP_EOL, "\n", $display);
  39760. }
  39761. return $display;
  39762. }
  39763. public function getInput()
  39764. {
  39765. return $this->input;
  39766. }
  39767. public function getOutput()
  39768. {
  39769. return $this->output;
  39770. }
  39771. public function getStatusCode()
  39772. {
  39773. return $this->statusCode;
  39774. }
  39775. }
  39776. <?php
  39777. namespace Symfony\Component\Console\Tester;
  39778. use Symfony\Component\Console\Command\Command;
  39779. use Symfony\Component\Console\Input\ArrayInput;
  39780. use Symfony\Component\Console\Input\InputInterface;
  39781. use Symfony\Component\Console\Output\OutputInterface;
  39782. use Symfony\Component\Console\Output\StreamOutput;
  39783. class CommandTester
  39784. {
  39785. private $command;
  39786. private $input;
  39787. private $output;
  39788. private $statusCode;
  39789. public function __construct(Command $command)
  39790. {
  39791. $this->command = $command;
  39792. }
  39793. public function execute(array $input, array $options = array())
  39794. {
  39795. if (!isset($input['command'])
  39796. && (null !== $application = $this->command->getApplication())
  39797. && $application->getDefinition()->hasArgument('command')
  39798. ) {
  39799. $input = array_merge(array('command' => $this->command->getName()), $input);
  39800. }
  39801. $this->input = new ArrayInput($input);
  39802. if (isset($options['interactive'])) {
  39803. $this->input->setInteractive($options['interactive']);
  39804. }
  39805. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39806. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  39807. if (isset($options['verbosity'])) {
  39808. $this->output->setVerbosity($options['verbosity']);
  39809. }
  39810. return $this->statusCode = $this->command->run($this->input, $this->output);
  39811. }
  39812. public function getDisplay($normalize = false)
  39813. {
  39814. rewind($this->output->getStream());
  39815. $display = stream_get_contents($this->output->getStream());
  39816. if ($normalize) {
  39817. $display = str_replace(PHP_EOL, "\n", $display);
  39818. }
  39819. return $display;
  39820. }
  39821. public function getInput()
  39822. {
  39823. return $this->input;
  39824. }
  39825. public function getOutput()
  39826. {
  39827. return $this->output;
  39828. }
  39829. public function getStatusCode()
  39830. {
  39831. return $this->statusCode;
  39832. }
  39833. }
  39834. <?php
  39835. namespace Symfony\Component\Debug;
  39836. use Psr\Log\AbstractLogger;
  39837. class BufferingLogger extends AbstractLogger
  39838. {
  39839. private $logs = array();
  39840. public function log($level, $message, array $context = array())
  39841. {
  39842. $this->logs[] = array($level, $message, $context);
  39843. }
  39844. public function cleanLogs()
  39845. {
  39846. $logs = $this->logs;
  39847. $this->logs = array();
  39848. return $logs;
  39849. }
  39850. }
  39851. <?php
  39852. namespace Symfony\Component\Debug;
  39853. class Debug
  39854. {
  39855. private static $enabled = false;
  39856. public static function enable($errorReportingLevel = null, $displayErrors = true)
  39857. {
  39858. if (static::$enabled) {
  39859. return;
  39860. }
  39861. static::$enabled = true;
  39862. if (null !== $errorReportingLevel) {
  39863. error_reporting($errorReportingLevel);
  39864. } else {
  39865. error_reporting(-1);
  39866. }
  39867. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  39868. ini_set('display_errors', 0);
  39869. ExceptionHandler::register();
  39870. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  39871. ini_set('display_errors', 1);
  39872. }
  39873. if ($displayErrors) {
  39874. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  39875. } else {
  39876. ErrorHandler::register()->throwAt(0, true);
  39877. }
  39878. DebugClassLoader::enable();
  39879. }
  39880. }
  39881. <?php
  39882. namespace Symfony\Component\Debug;
  39883. class DebugClassLoader
  39884. {
  39885. private $classLoader;
  39886. private $isFinder;
  39887. private $loaded = array();
  39888. private $wasFinder;
  39889. private static $caseCheck;
  39890. private static $deprecated = array();
  39891. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  39892. private static $darwinCache = array('/' => array('/', array()));
  39893. public function __construct($classLoader)
  39894. {
  39895. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  39896. if ($this->wasFinder) {
  39897. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  39898. $this->classLoader = array($classLoader, 'loadClass');
  39899. $this->isFinder = true;
  39900. } else {
  39901. $this->classLoader = $classLoader;
  39902. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  39903. }
  39904. if (!isset(self::$caseCheck)) {
  39905. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  39906. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  39907. $dir = substr($file, 0, 1 + $i);
  39908. $file = substr($file, 1 + $i);
  39909. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  39910. $test = realpath($dir.$test);
  39911. if (false === $test || false === $i) {
  39912. self::$caseCheck = 0;
  39913. } elseif (substr($test, -\strlen($file)) === $file) {
  39914. self::$caseCheck = 1;
  39915. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  39916. self::$caseCheck = 2;
  39917. } else {
  39918. self::$caseCheck = 0;
  39919. }
  39920. }
  39921. }
  39922. public function getClassLoader()
  39923. {
  39924. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  39925. }
  39926. public static function enable()
  39927. {
  39928. class_exists('Symfony\Component\Debug\ErrorHandler');
  39929. class_exists('Psr\Log\LogLevel');
  39930. if (!\is_array($functions = spl_autoload_functions())) {
  39931. return;
  39932. }
  39933. foreach ($functions as $function) {
  39934. spl_autoload_unregister($function);
  39935. }
  39936. foreach ($functions as $function) {
  39937. if (!\is_array($function) || !$function[0] instanceof self) {
  39938. $function = array(new static($function), 'loadClass');
  39939. }
  39940. spl_autoload_register($function);
  39941. }
  39942. }
  39943. public static function disable()
  39944. {
  39945. if (!\is_array($functions = spl_autoload_functions())) {
  39946. return;
  39947. }
  39948. foreach ($functions as $function) {
  39949. spl_autoload_unregister($function);
  39950. }
  39951. foreach ($functions as $function) {
  39952. if (\is_array($function) && $function[0] instanceof self) {
  39953. $function = $function[0]->getClassLoader();
  39954. }
  39955. spl_autoload_register($function);
  39956. }
  39957. }
  39958. public function findFile($class)
  39959. {
  39960. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39961. if ($this->wasFinder) {
  39962. return $this->classLoader[0]->findFile($class);
  39963. }
  39964. }
  39965. public function loadClass($class)
  39966. {
  39967. ErrorHandler::stackErrors();
  39968. try {
  39969. if ($this->isFinder && !isset($this->loaded[$class])) {
  39970. $this->loaded[$class] = true;
  39971. if ($file = $this->classLoader[0]->findFile($class)) {
  39972. require $file;
  39973. }
  39974. } else {
  39975. \call_user_func($this->classLoader, $class);
  39976. $file = false;
  39977. }
  39978. } catch (\Exception $e) {
  39979. ErrorHandler::unstackErrors();
  39980. throw $e;
  39981. } catch (\Throwable $e) {
  39982. ErrorHandler::unstackErrors();
  39983. throw $e;
  39984. }
  39985. ErrorHandler::unstackErrors();
  39986. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  39987. if ($class && '\\' === $class[0]) {
  39988. $class = substr($class, 1);
  39989. }
  39990. if ($exists) {
  39991. $refl = new \ReflectionClass($class);
  39992. $name = $refl->getName();
  39993. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  39994. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  39995. }
  39996. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  39997. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  39998. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  39999. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  40000. } else {
  40001. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  40002. $len = 0;
  40003. $ns = '';
  40004. } else {
  40005. $ns = substr($name, 0, $len);
  40006. }
  40007. $parent = get_parent_class($class);
  40008. if (!$parent || strncmp($ns, $parent, $len)) {
  40009. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  40010. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  40011. }
  40012. $parentInterfaces = array();
  40013. $deprecatedInterfaces = array();
  40014. if ($parent) {
  40015. foreach (class_implements($parent) as $interface) {
  40016. $parentInterfaces[$interface] = 1;
  40017. }
  40018. }
  40019. foreach ($refl->getInterfaceNames() as $interface) {
  40020. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  40021. $deprecatedInterfaces[] = $interface;
  40022. }
  40023. foreach (class_implements($interface) as $interface) {
  40024. $parentInterfaces[$interface] = 1;
  40025. }
  40026. }
  40027. foreach ($deprecatedInterfaces as $interface) {
  40028. if (!isset($parentInterfaces[$interface])) {
  40029. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  40030. }
  40031. }
  40032. }
  40033. }
  40034. }
  40035. if ($file) {
  40036. if (!$exists) {
  40037. if (false !== strpos($class, '/')) {
  40038. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  40039. }
  40040. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  40041. }
  40042. if (self::$caseCheck) {
  40043. $real = explode('\\', $class.strrchr($file, '.'));
  40044. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  40045. $i = \count($tail) - 1;
  40046. $j = \count($real) - 1;
  40047. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  40048. --$i;
  40049. --$j;
  40050. }
  40051. array_splice($tail, 0, $i + 1);
  40052. }
  40053. if (self::$caseCheck && $tail) {
  40054. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  40055. $tailLen = \strlen($tail);
  40056. $real = $refl->getFileName();
  40057. if (2 === self::$caseCheck) {
  40058. $i = 1 + strrpos($real, '/');
  40059. $file = substr($real, $i);
  40060. $real = substr($real, 0, $i);
  40061. if (isset(self::$darwinCache[$real])) {
  40062. $kDir = $real;
  40063. } else {
  40064. $kDir = strtolower($real);
  40065. if (isset(self::$darwinCache[$kDir])) {
  40066. $real = self::$darwinCache[$kDir][0];
  40067. } else {
  40068. $dir = getcwd();
  40069. chdir($real);
  40070. $real = getcwd().'/';
  40071. chdir($dir);
  40072. $dir = $real;
  40073. $k = $kDir;
  40074. $i = \strlen($dir) - 1;
  40075. while (!isset(self::$darwinCache[$k])) {
  40076. self::$darwinCache[$k] = array($dir, array());
  40077. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  40078. while ('/' !== $dir[--$i]) {
  40079. }
  40080. $k = substr($k, 0, ++$i);
  40081. $dir = substr($dir, 0, $i--);
  40082. }
  40083. }
  40084. }
  40085. $dirFiles = self::$darwinCache[$kDir][1];
  40086. if (isset($dirFiles[$file])) {
  40087. $kFile = $file;
  40088. } else {
  40089. $kFile = strtolower($file);
  40090. if (!isset($dirFiles[$kFile])) {
  40091. foreach (scandir($real, 2) as $f) {
  40092. if ('.' !== $f[0]) {
  40093. $dirFiles[$f] = $f;
  40094. if ($f === $file) {
  40095. $kFile = $k = $file;
  40096. } elseif ($f !== $k = strtolower($f)) {
  40097. $dirFiles[$k] = $f;
  40098. }
  40099. }
  40100. }
  40101. self::$darwinCache[$kDir][1] = $dirFiles;
  40102. }
  40103. }
  40104. $real .= $dirFiles[$kFile];
  40105. }
  40106. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  40107. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  40108. ) {
  40109. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  40110. }
  40111. }
  40112. return true;
  40113. }
  40114. }
  40115. }
  40116. <?php
  40117. namespace Symfony\Component\Debug;
  40118. use Psr\Log\LoggerInterface;
  40119. use Psr\Log\LogLevel;
  40120. use Symfony\Component\Debug\Exception\ContextErrorException;
  40121. use Symfony\Component\Debug\Exception\FatalErrorException;
  40122. use Symfony\Component\Debug\Exception\FatalThrowableError;
  40123. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  40124. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  40125. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  40126. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  40127. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  40128. class ErrorHandler
  40129. {
  40130. const TYPE_DEPRECATION = -100;
  40131. private $levels = array(
  40132. E_DEPRECATED => 'Deprecated',
  40133. E_USER_DEPRECATED => 'User Deprecated',
  40134. E_NOTICE => 'Notice',
  40135. E_USER_NOTICE => 'User Notice',
  40136. E_STRICT => 'Runtime Notice',
  40137. E_WARNING => 'Warning',
  40138. E_USER_WARNING => 'User Warning',
  40139. E_COMPILE_WARNING => 'Compile Warning',
  40140. E_CORE_WARNING => 'Core Warning',
  40141. E_USER_ERROR => 'User Error',
  40142. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  40143. E_COMPILE_ERROR => 'Compile Error',
  40144. E_PARSE => 'Parse Error',
  40145. E_ERROR => 'Error',
  40146. E_CORE_ERROR => 'Core Error',
  40147. );
  40148. private $loggers = array(
  40149. E_DEPRECATED => array(null, LogLevel::INFO),
  40150. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  40151. E_NOTICE => array(null, LogLevel::WARNING),
  40152. E_USER_NOTICE => array(null, LogLevel::WARNING),
  40153. E_STRICT => array(null, LogLevel::WARNING),
  40154. E_WARNING => array(null, LogLevel::WARNING),
  40155. E_USER_WARNING => array(null, LogLevel::WARNING),
  40156. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  40157. E_CORE_WARNING => array(null, LogLevel::WARNING),
  40158. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  40159. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  40160. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  40161. E_PARSE => array(null, LogLevel::CRITICAL),
  40162. E_ERROR => array(null, LogLevel::CRITICAL),
  40163. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  40164. );
  40165. private $thrownErrors = 0x1FFF;
  40166. private $scopedErrors = 0x1FFF;
  40167. private $tracedErrors = 0x77FB;
  40168. private $screamedErrors = 0x55;
  40169. private $loggedErrors = 0;
  40170. private $loggedTraces = array();
  40171. private $isRecursive = 0;
  40172. private $isRoot = false;
  40173. private $exceptionHandler;
  40174. private $bootstrappingLogger;
  40175. private static $reservedMemory;
  40176. private static $stackedErrors = array();
  40177. private static $stackedErrorLevels = array();
  40178. private static $toStringException = null;
  40179. private static $exitCode = 0;
  40180. private $displayErrors = 0x1FFF;
  40181. public static function register($handler = null, $replace = true)
  40182. {
  40183. if (null === self::$reservedMemory) {
  40184. self::$reservedMemory = str_repeat('x', 10240);
  40185. register_shutdown_function(__CLASS__.'::handleFatalError');
  40186. }
  40187. $levels = -1;
  40188. if ($handlerIsNew = !$handler instanceof self) {
  40189. if (null !== $handler) {
  40190. $levels = $replace ? $handler : 0;
  40191. $replace = true;
  40192. }
  40193. $handler = new static();
  40194. }
  40195. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  40196. restore_error_handler();
  40197. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  40198. $handler->isRoot = true;
  40199. }
  40200. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  40201. $handler = $prev[0];
  40202. $replace = false;
  40203. }
  40204. if (!$replace && $prev) {
  40205. restore_error_handler();
  40206. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  40207. } else {
  40208. $handlerIsRegistered = true;
  40209. }
  40210. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  40211. restore_exception_handler();
  40212. if (!$handlerIsRegistered) {
  40213. $handler = $prev[0];
  40214. } elseif ($handler !== $prev[0] && $replace) {
  40215. set_exception_handler(array($handler, 'handleException'));
  40216. $p = $prev[0]->setExceptionHandler(null);
  40217. $handler->setExceptionHandler($p);
  40218. $prev[0]->setExceptionHandler($p);
  40219. }
  40220. } else {
  40221. $handler->setExceptionHandler($prev);
  40222. }
  40223. $handler->throwAt($levels & $handler->thrownErrors, true);
  40224. return $handler;
  40225. }
  40226. public function __construct(BufferingLogger $bootstrappingLogger = null)
  40227. {
  40228. if ($bootstrappingLogger) {
  40229. $this->bootstrappingLogger = $bootstrappingLogger;
  40230. $this->setDefaultLogger($bootstrappingLogger);
  40231. }
  40232. }
  40233. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  40234. {
  40235. $loggers = array();
  40236. if (\is_array($levels)) {
  40237. foreach ($levels as $type => $logLevel) {
  40238. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  40239. $loggers[$type] = array($logger, $logLevel);
  40240. }
  40241. }
  40242. } else {
  40243. if (null === $levels) {
  40244. $levels = E_ALL | E_STRICT;
  40245. }
  40246. foreach ($this->loggers as $type => $log) {
  40247. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  40248. $log[0] = $logger;
  40249. $loggers[$type] = $log;
  40250. }
  40251. }
  40252. }
  40253. $this->setLoggers($loggers);
  40254. }
  40255. public function setLoggers(array $loggers)
  40256. {
  40257. $prevLogged = $this->loggedErrors;
  40258. $prev = $this->loggers;
  40259. $flush = array();
  40260. foreach ($loggers as $type => $log) {
  40261. if (!isset($prev[$type])) {
  40262. throw new \InvalidArgumentException('Unknown error type: '.$type);
  40263. }
  40264. if (!\is_array($log)) {
  40265. $log = array($log);
  40266. } elseif (!array_key_exists(0, $log)) {
  40267. throw new \InvalidArgumentException('No logger provided');
  40268. }
  40269. if (null === $log[0]) {
  40270. $this->loggedErrors &= ~$type;
  40271. } elseif ($log[0] instanceof LoggerInterface) {
  40272. $this->loggedErrors |= $type;
  40273. } else {
  40274. throw new \InvalidArgumentException('Invalid logger provided');
  40275. }
  40276. $this->loggers[$type] = $log + $prev[$type];
  40277. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  40278. $flush[$type] = $type;
  40279. }
  40280. }
  40281. $this->reRegister($prevLogged | $this->thrownErrors);
  40282. if ($flush) {
  40283. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  40284. $type = $log[2]['type'];
  40285. if (!isset($flush[$type])) {
  40286. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  40287. } elseif ($this->loggers[$type][0]) {
  40288. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  40289. }
  40290. }
  40291. }
  40292. return $prev;
  40293. }
  40294. public function setExceptionHandler($handler)
  40295. {
  40296. if (null !== $handler && !\is_callable($handler)) {
  40297. throw new \LogicException('The exception handler must be a valid PHP callable.');
  40298. }
  40299. $prev = $this->exceptionHandler;
  40300. $this->exceptionHandler = $handler;
  40301. return $prev;
  40302. }
  40303. public function throwAt($levels, $replace = false)
  40304. {
  40305. $prev = $this->thrownErrors;
  40306. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  40307. if (!$replace) {
  40308. $this->thrownErrors |= $prev;
  40309. }
  40310. $this->reRegister($prev | $this->loggedErrors);
  40311. $this->displayErrors = $this->thrownErrors;
  40312. return $prev;
  40313. }
  40314. public function scopeAt($levels, $replace = false)
  40315. {
  40316. $prev = $this->scopedErrors;
  40317. $this->scopedErrors = (int) $levels;
  40318. if (!$replace) {
  40319. $this->scopedErrors |= $prev;
  40320. }
  40321. return $prev;
  40322. }
  40323. public function traceAt($levels, $replace = false)
  40324. {
  40325. $prev = $this->tracedErrors;
  40326. $this->tracedErrors = (int) $levels;
  40327. if (!$replace) {
  40328. $this->tracedErrors |= $prev;
  40329. }
  40330. return $prev;
  40331. }
  40332. public function screamAt($levels, $replace = false)
  40333. {
  40334. $prev = $this->screamedErrors;
  40335. $this->screamedErrors = (int) $levels;
  40336. if (!$replace) {
  40337. $this->screamedErrors |= $prev;
  40338. }
  40339. return $prev;
  40340. }
  40341. private function reRegister($prev)
  40342. {
  40343. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  40344. $handler = set_error_handler('var_dump');
  40345. $handler = \is_array($handler) ? $handler[0] : null;
  40346. restore_error_handler();
  40347. if ($handler === $this) {
  40348. restore_error_handler();
  40349. if ($this->isRoot) {
  40350. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  40351. } else {
  40352. set_error_handler(array($this, 'handleError'));
  40353. }
  40354. }
  40355. }
  40356. }
  40357. public function handleError($type, $message, $file, $line)
  40358. {
  40359. $level = error_reporting();
  40360. $silenced = 0 === ($level & $type);
  40361. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  40362. $log = $this->loggedErrors & $type;
  40363. $throw = $this->thrownErrors & $type & $level;
  40364. $type &= $level | $this->screamedErrors;
  40365. if (!$type || (!$log && !$throw)) {
  40366. return !$silenced && $type && $log;
  40367. }
  40368. $scope = $this->scopedErrors & $type;
  40369. if (4 < $numArgs = \func_num_args()) {
  40370. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  40371. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  40372. } else {
  40373. $context = array();
  40374. $backtrace = null;
  40375. }
  40376. if (isset($context['GLOBALS']) && $scope) {
  40377. $e = $context;
  40378. unset($e['GLOBALS'], $context);
  40379. $context = $e;
  40380. }
  40381. if (null !== $backtrace && $type & E_ERROR) {
  40382. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  40383. return true;
  40384. }
  40385. if ($throw) {
  40386. if (null !== self::$toStringException) {
  40387. $throw = self::$toStringException;
  40388. self::$toStringException = null;
  40389. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  40390. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  40391. } else {
  40392. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  40393. }
  40394. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  40395. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  40396. }
  40397. if (E_USER_ERROR & $type) {
  40398. $backtrace = $backtrace ?: $throw->getTrace();
  40399. for ($i = 1; isset($backtrace[$i]); ++$i) {
  40400. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  40401. && '__toString' === $backtrace[$i]['function']
  40402. && '->' === $backtrace[$i]['type']
  40403. && !isset($backtrace[$i - 1]['class'])
  40404. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  40405. ) {
  40406. foreach ($context as $e) {
  40407. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  40408. if (1 === $i) {
  40409. $throw = $e;
  40410. break;
  40411. }
  40412. self::$toStringException = $e;
  40413. return true;
  40414. }
  40415. }
  40416. if (1 < $i) {
  40417. $this->handleException($throw);
  40418. return false;
  40419. }
  40420. }
  40421. }
  40422. }
  40423. throw $throw;
  40424. }
  40425. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  40426. $trace = true;
  40427. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  40428. $trace = false;
  40429. } else {
  40430. $this->loggedTraces[$e] = 1;
  40431. }
  40432. $e = compact('type', 'file', 'line', 'level');
  40433. if ($type & $level) {
  40434. if ($scope) {
  40435. $e['scope_vars'] = $context;
  40436. if ($trace) {
  40437. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  40438. }
  40439. } elseif ($trace) {
  40440. if (null === $backtrace) {
  40441. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  40442. } else {
  40443. foreach ($backtrace as &$frame) {
  40444. unset($frame['args'], $frame);
  40445. }
  40446. $e['stack'] = $backtrace;
  40447. }
  40448. }
  40449. }
  40450. if ($this->isRecursive) {
  40451. $log = 0;
  40452. } elseif (self::$stackedErrorLevels) {
  40453. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40454. } else {
  40455. try {
  40456. $this->isRecursive = true;
  40457. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40458. $this->isRecursive = false;
  40459. } catch (\Exception $e) {
  40460. $this->isRecursive = false;
  40461. throw $e;
  40462. } catch (\Throwable $e) {
  40463. $this->isRecursive = false;
  40464. throw $e;
  40465. }
  40466. }
  40467. return !$silenced && $type && $log;
  40468. }
  40469. public function handleException($exception, array $error = null)
  40470. {
  40471. if (null === $error) {
  40472. self::$exitCode = 255;
  40473. }
  40474. if (!$exception instanceof \Exception) {
  40475. $exception = new FatalThrowableError($exception);
  40476. }
  40477. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  40478. $handlerException = null;
  40479. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  40480. $e = array(
  40481. 'type' => $type,
  40482. 'file' => $exception->getFile(),
  40483. 'line' => $exception->getLine(),
  40484. 'level' => error_reporting(),
  40485. 'stack' => $exception->getTrace(),
  40486. );
  40487. if ($exception instanceof FatalErrorException) {
  40488. if ($exception instanceof FatalThrowableError) {
  40489. $error = array(
  40490. 'type' => $type,
  40491. 'message' => $message = $exception->getMessage(),
  40492. 'file' => $e['file'],
  40493. 'line' => $e['line'],
  40494. );
  40495. } else {
  40496. $message = 'Fatal '.$exception->getMessage();
  40497. }
  40498. } elseif ($exception instanceof \ErrorException) {
  40499. $message = 'Uncaught '.$exception->getMessage();
  40500. if ($exception instanceof ContextErrorException) {
  40501. $e['context'] = $exception->getContext();
  40502. }
  40503. } else {
  40504. $message = 'Uncaught Exception: '.$exception->getMessage();
  40505. }
  40506. }
  40507. if ($this->loggedErrors & $type) {
  40508. try {
  40509. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  40510. } catch (\Exception $handlerException) {
  40511. } catch (\Throwable $handlerException) {
  40512. }
  40513. }
  40514. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  40515. foreach ($this->getFatalErrorHandlers() as $handler) {
  40516. if ($e = $handler->handleError($error, $exception)) {
  40517. $exception = $e;
  40518. break;
  40519. }
  40520. }
  40521. }
  40522. $exceptionHandler = $this->exceptionHandler;
  40523. $this->exceptionHandler = null;
  40524. try {
  40525. if (null !== $exceptionHandler) {
  40526. return \call_user_func($exceptionHandler, $exception);
  40527. }
  40528. $handlerException = $handlerException ?: $exception;
  40529. } catch (\Exception $handlerException) {
  40530. } catch (\Throwable $handlerException) {
  40531. }
  40532. if ($exception === $handlerException) {
  40533. self::$reservedMemory = null;
  40534. throw $exception;
  40535. }
  40536. $this->handleException($handlerException);
  40537. }
  40538. public static function handleFatalError(array $error = null)
  40539. {
  40540. if (null === self::$reservedMemory) {
  40541. return;
  40542. }
  40543. $handler = self::$reservedMemory = null;
  40544. $handlers = array();
  40545. $previousHandler = null;
  40546. $sameHandlerLimit = 10;
  40547. while (!\is_array($handler) || !$handler[0] instanceof self) {
  40548. $handler = set_exception_handler('var_dump');
  40549. restore_exception_handler();
  40550. if (!$handler) {
  40551. break;
  40552. }
  40553. restore_exception_handler();
  40554. if ($handler !== $previousHandler) {
  40555. array_unshift($handlers, $handler);
  40556. $previousHandler = $handler;
  40557. } elseif (0 === --$sameHandlerLimit) {
  40558. $handler = null;
  40559. break;
  40560. }
  40561. }
  40562. foreach ($handlers as $h) {
  40563. set_exception_handler($h);
  40564. }
  40565. if (!$handler) {
  40566. return;
  40567. }
  40568. if ($handler !== $h) {
  40569. $handler[0]->setExceptionHandler($h);
  40570. }
  40571. $handler = $handler[0];
  40572. $handlers = array();
  40573. if ($exit = null === $error) {
  40574. $error = error_get_last();
  40575. }
  40576. try {
  40577. while (self::$stackedErrorLevels) {
  40578. static::unstackErrors();
  40579. }
  40580. } catch (\Exception $exception) {
  40581. } catch (\Throwable $exception) {
  40582. }
  40583. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  40584. $handler->throwAt(0, true);
  40585. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  40586. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  40587. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  40588. } else {
  40589. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  40590. }
  40591. }
  40592. try {
  40593. if (isset($exception)) {
  40594. self::$exitCode = 255;
  40595. $handler->handleException($exception, $error);
  40596. }
  40597. } catch (FatalErrorException $e) {
  40598. }
  40599. if ($exit && self::$exitCode) {
  40600. $exitCode = self::$exitCode;
  40601. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  40602. }
  40603. }
  40604. public static function stackErrors()
  40605. {
  40606. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40607. }
  40608. public static function unstackErrors()
  40609. {
  40610. $level = array_pop(self::$stackedErrorLevels);
  40611. if (null !== $level) {
  40612. $e = error_reporting($level);
  40613. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  40614. error_reporting($e);
  40615. }
  40616. }
  40617. if (empty(self::$stackedErrorLevels)) {
  40618. $errors = self::$stackedErrors;
  40619. self::$stackedErrors = array();
  40620. foreach ($errors as $e) {
  40621. $e[0]->log($e[1], $e[2], $e[3]);
  40622. }
  40623. }
  40624. }
  40625. protected function getFatalErrorHandlers()
  40626. {
  40627. return array(
  40628. new UndefinedFunctionFatalErrorHandler(),
  40629. new UndefinedMethodFatalErrorHandler(),
  40630. new ClassNotFoundFatalErrorHandler(),
  40631. );
  40632. }
  40633. public function setLevel($level)
  40634. {
  40635. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  40636. $level = null === $level ? error_reporting() : $level;
  40637. $this->throwAt($level, true);
  40638. }
  40639. public function setDisplayErrors($displayErrors)
  40640. {
  40641. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  40642. if ($displayErrors) {
  40643. $this->throwAt($this->displayErrors, true);
  40644. } else {
  40645. $displayErrors = $this->displayErrors;
  40646. $this->throwAt(0, true);
  40647. $this->displayErrors = $displayErrors;
  40648. }
  40649. }
  40650. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  40651. {
  40652. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  40653. $handler = set_error_handler('var_dump');
  40654. $handler = \is_array($handler) ? $handler[0] : null;
  40655. restore_error_handler();
  40656. if (!$handler instanceof self) {
  40657. return;
  40658. }
  40659. if ('deprecation' === $channel) {
  40660. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  40661. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  40662. } elseif ('scream' === $channel) {
  40663. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  40664. $handler->screamAt(E_ALL | E_STRICT);
  40665. } elseif ('emergency' === $channel) {
  40666. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  40667. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40668. }
  40669. }
  40670. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  40671. {
  40672. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  40673. return $this->handleError($level, $message, $file, $line, (array) $context);
  40674. }
  40675. public function handleFatal()
  40676. {
  40677. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  40678. static::handleFatalError();
  40679. }
  40680. }
  40681. class ErrorHandlerCanary
  40682. {
  40683. private static $displayErrors = null;
  40684. public function __construct()
  40685. {
  40686. if (null === self::$displayErrors) {
  40687. self::$displayErrors = ini_set('display_errors', 1);
  40688. }
  40689. }
  40690. public function __destruct()
  40691. {
  40692. if (null !== self::$displayErrors) {
  40693. ini_set('display_errors', self::$displayErrors);
  40694. self::$displayErrors = null;
  40695. }
  40696. }
  40697. }
  40698. <?php
  40699. namespace Symfony\Component\Debug\Exception;
  40700. class ClassNotFoundException extends FatalErrorException
  40701. {
  40702. public function __construct($message, \ErrorException $previous)
  40703. {
  40704. parent::__construct(
  40705. $message,
  40706. $previous->getCode(),
  40707. $previous->getSeverity(),
  40708. $previous->getFile(),
  40709. $previous->getLine(),
  40710. null,
  40711. true,
  40712. null,
  40713. $previous->getPrevious()
  40714. );
  40715. $this->setTrace($previous->getTrace());
  40716. }
  40717. }
  40718. <?php
  40719. namespace Symfony\Component\Debug\Exception;
  40720. class ContextErrorException extends \ErrorException
  40721. {
  40722. private $context = array();
  40723. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  40724. {
  40725. parent::__construct($message, $code, $severity, $filename, $lineno);
  40726. $this->context = $context;
  40727. }
  40728. public function getContext()
  40729. {
  40730. return $this->context;
  40731. }
  40732. }
  40733. <?php
  40734. namespace Symfony\Component\Debug\Exception;
  40735. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  40736. class DummyException extends \ErrorException
  40737. {
  40738. }
  40739. <?php
  40740. namespace Symfony\Component\HttpKernel\Exception;
  40741. class FatalErrorException extends \ErrorException
  40742. {
  40743. }
  40744. namespace Symfony\Component\Debug\Exception;
  40745. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  40746. class FatalErrorException extends LegacyFatalErrorException
  40747. {
  40748. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  40749. {
  40750. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  40751. if (null !== $trace) {
  40752. if (!$traceArgs) {
  40753. foreach ($trace as &$frame) {
  40754. unset($frame['args'], $frame['this'], $frame);
  40755. }
  40756. }
  40757. $this->setTrace($trace);
  40758. } elseif (null !== $traceOffset) {
  40759. if (\function_exists('xdebug_get_function_stack')) {
  40760. $trace = xdebug_get_function_stack();
  40761. if (0 < $traceOffset) {
  40762. array_splice($trace, -$traceOffset);
  40763. }
  40764. foreach ($trace as &$frame) {
  40765. if (!isset($frame['type'])) {
  40766. if (isset($frame['class'])) {
  40767. $frame['type'] = '::';
  40768. }
  40769. } elseif ('dynamic' === $frame['type']) {
  40770. $frame['type'] = '->';
  40771. } elseif ('static' === $frame['type']) {
  40772. $frame['type'] = '::';
  40773. }
  40774. if (!$traceArgs) {
  40775. unset($frame['params'], $frame['args']);
  40776. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  40777. $frame['args'] = $frame['params'];
  40778. unset($frame['params']);
  40779. }
  40780. }
  40781. unset($frame);
  40782. $trace = array_reverse($trace);
  40783. } elseif (\function_exists('symfony_debug_backtrace')) {
  40784. $trace = symfony_debug_backtrace();
  40785. if (0 < $traceOffset) {
  40786. array_splice($trace, 0, $traceOffset);
  40787. }
  40788. } else {
  40789. $trace = array();
  40790. }
  40791. $this->setTrace($trace);
  40792. }
  40793. }
  40794. protected function setTrace($trace)
  40795. {
  40796. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  40797. $traceReflector->setAccessible(true);
  40798. $traceReflector->setValue($this, $trace);
  40799. }
  40800. }
  40801. <?php
  40802. namespace Symfony\Component\Debug\Exception;
  40803. class FatalThrowableError extends FatalErrorException
  40804. {
  40805. public function __construct(\Throwable $e)
  40806. {
  40807. if ($e instanceof \ParseError) {
  40808. $message = 'Parse error: '.$e->getMessage();
  40809. $severity = E_PARSE;
  40810. } elseif ($e instanceof \TypeError) {
  40811. $message = 'Type error: '.$e->getMessage();
  40812. $severity = E_RECOVERABLE_ERROR;
  40813. } else {
  40814. $message = $e->getMessage();
  40815. $severity = E_ERROR;
  40816. }
  40817. \ErrorException::__construct(
  40818. $message,
  40819. $e->getCode(),
  40820. $severity,
  40821. $e->getFile(),
  40822. $e->getLine(),
  40823. $e->getPrevious()
  40824. );
  40825. $this->setTrace($e->getTrace());
  40826. }
  40827. }
  40828. <?php
  40829. namespace Symfony\Component\HttpKernel\Exception;
  40830. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  40831. class FlattenException
  40832. {
  40833. private $handler;
  40834. public static function __callStatic($method, $args)
  40835. {
  40836. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  40837. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  40838. }
  40839. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  40840. }
  40841. public function __call($method, $args)
  40842. {
  40843. if (!isset($this->handler)) {
  40844. $this->handler = new DebugFlattenException();
  40845. }
  40846. if (!method_exists($this->handler, $method)) {
  40847. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  40848. }
  40849. return \call_user_func_array(array($this->handler, $method), $args);
  40850. }
  40851. }
  40852. namespace Symfony\Component\Debug\Exception;
  40853. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  40854. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  40855. class FlattenException extends LegacyFlattenException
  40856. {
  40857. private $message;
  40858. private $code;
  40859. private $previous;
  40860. private $trace;
  40861. private $class;
  40862. private $statusCode;
  40863. private $headers;
  40864. private $file;
  40865. private $line;
  40866. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  40867. {
  40868. $e = new static();
  40869. $e->setMessage($exception->getMessage());
  40870. $e->setCode($exception->getCode());
  40871. if ($exception instanceof HttpExceptionInterface) {
  40872. $statusCode = $exception->getStatusCode();
  40873. $headers = array_merge($headers, $exception->getHeaders());
  40874. }
  40875. if (null === $statusCode) {
  40876. $statusCode = 500;
  40877. }
  40878. $e->setStatusCode($statusCode);
  40879. $e->setHeaders($headers);
  40880. $e->setTraceFromException($exception);
  40881. $e->setClass(\get_class($exception));
  40882. $e->setFile($exception->getFile());
  40883. $e->setLine($exception->getLine());
  40884. $previous = $exception->getPrevious();
  40885. if ($previous instanceof \Exception) {
  40886. $e->setPrevious(static::create($previous));
  40887. } elseif ($previous instanceof \Throwable) {
  40888. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  40889. }
  40890. return $e;
  40891. }
  40892. public function toArray()
  40893. {
  40894. $exceptions = array();
  40895. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  40896. $exceptions[] = array(
  40897. 'message' => $exception->getMessage(),
  40898. 'class' => $exception->getClass(),
  40899. 'trace' => $exception->getTrace(),
  40900. );
  40901. }
  40902. return $exceptions;
  40903. }
  40904. public function getStatusCode()
  40905. {
  40906. return $this->statusCode;
  40907. }
  40908. public function setStatusCode($code)
  40909. {
  40910. $this->statusCode = $code;
  40911. }
  40912. public function getHeaders()
  40913. {
  40914. return $this->headers;
  40915. }
  40916. public function setHeaders(array $headers)
  40917. {
  40918. $this->headers = $headers;
  40919. }
  40920. public function getClass()
  40921. {
  40922. return $this->class;
  40923. }
  40924. public function setClass($class)
  40925. {
  40926. $this->class = $class;
  40927. }
  40928. public function getFile()
  40929. {
  40930. return $this->file;
  40931. }
  40932. public function setFile($file)
  40933. {
  40934. $this->file = $file;
  40935. }
  40936. public function getLine()
  40937. {
  40938. return $this->line;
  40939. }
  40940. public function setLine($line)
  40941. {
  40942. $this->line = $line;
  40943. }
  40944. public function getMessage()
  40945. {
  40946. return $this->message;
  40947. }
  40948. public function setMessage($message)
  40949. {
  40950. $this->message = $message;
  40951. }
  40952. public function getCode()
  40953. {
  40954. return $this->code;
  40955. }
  40956. public function setCode($code)
  40957. {
  40958. $this->code = $code;
  40959. }
  40960. public function getPrevious()
  40961. {
  40962. return $this->previous;
  40963. }
  40964. public function setPrevious(FlattenException $previous)
  40965. {
  40966. $this->previous = $previous;
  40967. }
  40968. public function getAllPrevious()
  40969. {
  40970. $exceptions = array();
  40971. $e = $this;
  40972. while ($e = $e->getPrevious()) {
  40973. $exceptions[] = $e;
  40974. }
  40975. return $exceptions;
  40976. }
  40977. public function getTrace()
  40978. {
  40979. return $this->trace;
  40980. }
  40981. public function setTraceFromException(\Exception $exception)
  40982. {
  40983. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  40984. }
  40985. public function setTrace($trace, $file, $line)
  40986. {
  40987. $this->trace = array();
  40988. $this->trace[] = array(
  40989. 'namespace' => '',
  40990. 'short_class' => '',
  40991. 'class' => '',
  40992. 'type' => '',
  40993. 'function' => '',
  40994. 'file' => $file,
  40995. 'line' => $line,
  40996. 'args' => array(),
  40997. );
  40998. foreach ($trace as $entry) {
  40999. $class = '';
  41000. $namespace = '';
  41001. if (isset($entry['class'])) {
  41002. $parts = explode('\\', $entry['class']);
  41003. $class = array_pop($parts);
  41004. $namespace = implode('\\', $parts);
  41005. }
  41006. $this->trace[] = array(
  41007. 'namespace' => $namespace,
  41008. 'short_class' => $class,
  41009. 'class' => isset($entry['class']) ? $entry['class'] : '',
  41010. 'type' => isset($entry['type']) ? $entry['type'] : '',
  41011. 'function' => isset($entry['function']) ? $entry['function'] : null,
  41012. 'file' => isset($entry['file']) ? $entry['file'] : null,
  41013. 'line' => isset($entry['line']) ? $entry['line'] : null,
  41014. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  41015. );
  41016. }
  41017. }
  41018. private function flattenArgs($args, $level = 0, &$count = 0)
  41019. {
  41020. $result = array();
  41021. foreach ($args as $key => $value) {
  41022. if (++$count > 1e4) {
  41023. return array('array', '*SKIPPED over 10000 entries*');
  41024. }
  41025. if ($value instanceof \__PHP_Incomplete_Class) {
  41026. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  41027. } elseif (\is_object($value)) {
  41028. $result[$key] = array('object', \get_class($value));
  41029. } elseif (\is_array($value)) {
  41030. if ($level > 10) {
  41031. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  41032. } else {
  41033. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  41034. }
  41035. } elseif (null === $value) {
  41036. $result[$key] = array('null', null);
  41037. } elseif (\is_bool($value)) {
  41038. $result[$key] = array('boolean', $value);
  41039. } elseif (\is_resource($value)) {
  41040. $result[$key] = array('resource', get_resource_type($value));
  41041. } else {
  41042. $result[$key] = array('string', (string) $value);
  41043. }
  41044. }
  41045. return $result;
  41046. }
  41047. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  41048. {
  41049. $array = new \ArrayObject($value);
  41050. return $array['__PHP_Incomplete_Class_Name'];
  41051. }
  41052. }
  41053. <?php
  41054. namespace Symfony\Component\Debug\Exception;
  41055. class OutOfMemoryException extends FatalErrorException
  41056. {
  41057. }
  41058. <?php
  41059. namespace Symfony\Component\Debug\Exception;
  41060. class UndefinedFunctionException extends FatalErrorException
  41061. {
  41062. public function __construct($message, \ErrorException $previous)
  41063. {
  41064. parent::__construct(
  41065. $message,
  41066. $previous->getCode(),
  41067. $previous->getSeverity(),
  41068. $previous->getFile(),
  41069. $previous->getLine(),
  41070. null,
  41071. true,
  41072. null,
  41073. $previous->getPrevious()
  41074. );
  41075. $this->setTrace($previous->getTrace());
  41076. }
  41077. }
  41078. <?php
  41079. namespace Symfony\Component\Debug\Exception;
  41080. class UndefinedMethodException extends FatalErrorException
  41081. {
  41082. public function __construct($message, \ErrorException $previous)
  41083. {
  41084. parent::__construct(
  41085. $message,
  41086. $previous->getCode(),
  41087. $previous->getSeverity(),
  41088. $previous->getFile(),
  41089. $previous->getLine(),
  41090. null,
  41091. true,
  41092. null,
  41093. $previous->getPrevious()
  41094. );
  41095. $this->setTrace($previous->getTrace());
  41096. }
  41097. }
  41098. <?php
  41099. namespace Symfony\Component\Debug;
  41100. use Symfony\Component\Debug\Exception\FlattenException;
  41101. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  41102. use Symfony\Component\HttpFoundation\Response;
  41103. class ExceptionHandler
  41104. {
  41105. private $debug;
  41106. private $charset;
  41107. private $handler;
  41108. private $caughtBuffer;
  41109. private $caughtLength;
  41110. private $fileLinkFormat;
  41111. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  41112. {
  41113. if (false !== strpos($charset, '%')) {
  41114. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  41115. $pivot = $fileLinkFormat;
  41116. $fileLinkFormat = $charset;
  41117. $charset = $pivot;
  41118. }
  41119. $this->debug = $debug;
  41120. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  41121. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  41122. }
  41123. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  41124. {
  41125. $handler = new static($debug, $charset, $fileLinkFormat);
  41126. $prev = set_exception_handler(array($handler, 'handle'));
  41127. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  41128. restore_exception_handler();
  41129. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  41130. }
  41131. return $handler;
  41132. }
  41133. public function setHandler($handler)
  41134. {
  41135. if (null !== $handler && !\is_callable($handler)) {
  41136. throw new \LogicException('The exception handler must be a valid PHP callable.');
  41137. }
  41138. $old = $this->handler;
  41139. $this->handler = $handler;
  41140. return $old;
  41141. }
  41142. public function setFileLinkFormat($format)
  41143. {
  41144. $old = $this->fileLinkFormat;
  41145. $this->fileLinkFormat = $format;
  41146. return $old;
  41147. }
  41148. public function handle(\Exception $exception)
  41149. {
  41150. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  41151. $this->failSafeHandle($exception);
  41152. return;
  41153. }
  41154. $caughtLength = $this->caughtLength = 0;
  41155. ob_start(array($this, 'catchOutput'));
  41156. $this->failSafeHandle($exception);
  41157. while (null === $this->caughtBuffer && ob_end_flush()) {
  41158. }
  41159. if (isset($this->caughtBuffer[0])) {
  41160. ob_start(array($this, 'cleanOutput'));
  41161. echo $this->caughtBuffer;
  41162. $caughtLength = ob_get_length();
  41163. }
  41164. $this->caughtBuffer = null;
  41165. try {
  41166. \call_user_func($this->handler, $exception);
  41167. $this->caughtLength = $caughtLength;
  41168. } catch (\Exception $e) {
  41169. if (!$caughtLength) {
  41170. throw $exception;
  41171. }
  41172. }
  41173. }
  41174. private function failSafeHandle(\Exception $exception)
  41175. {
  41176. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  41177. && __CLASS__ !== \get_class($this)
  41178. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  41179. && __CLASS__ !== $reflector->class
  41180. ) {
  41181. $response = $this->createResponse($exception);
  41182. $response->sendHeaders();
  41183. $response->sendContent();
  41184. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  41185. return;
  41186. }
  41187. $this->sendPhpResponse($exception);
  41188. }
  41189. public function sendPhpResponse($exception)
  41190. {
  41191. if (!$exception instanceof FlattenException) {
  41192. $exception = FlattenException::create($exception);
  41193. }
  41194. if (!headers_sent()) {
  41195. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  41196. foreach ($exception->getHeaders() as $name => $value) {
  41197. header($name.': '.$value, false);
  41198. }
  41199. header('Content-Type: text/html; charset='.$this->charset);
  41200. }
  41201. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41202. }
  41203. public function createResponse($exception)
  41204. {
  41205. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41206. if (!$exception instanceof FlattenException) {
  41207. $exception = FlattenException::create($exception);
  41208. }
  41209. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  41210. }
  41211. public function getHtml($exception)
  41212. {
  41213. if (!$exception instanceof FlattenException) {
  41214. $exception = FlattenException::create($exception);
  41215. }
  41216. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41217. }
  41218. public function getContent(FlattenException $exception)
  41219. {
  41220. switch ($exception->getStatusCode()) {
  41221. case 404:
  41222. $title = 'Sorry, the page you are looking for could not be found.';
  41223. break;
  41224. default:
  41225. $title = 'Whoops, looks like something went wrong.';
  41226. }
  41227. $content = '';
  41228. if ($this->debug) {
  41229. try {
  41230. $count = \count($exception->getAllPrevious());
  41231. $total = $count + 1;
  41232. foreach ($exception->toArray() as $position => $e) {
  41233. $ind = $count - $position + 1;
  41234. $class = $this->formatClass($e['class']);
  41235. $message = nl2br($this->escapeHtml($e['message']));
  41236. $content .= sprintf(<<<'EOF'
  41237. <h2 class="block_exception clear_fix">
  41238. <span class="exception_counter">%d/%d</span>
  41239. <span class="exception_title">%s%s:</span>
  41240. <span class="exception_message">%s</span>
  41241. </h2>
  41242. <div class="block">
  41243. <ol class="traces list_exception">
  41244. EOF
  41245. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  41246. foreach ($e['trace'] as $trace) {
  41247. $content .= ' <li>';
  41248. if ($trace['function']) {
  41249. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  41250. }
  41251. if (isset($trace['file']) && isset($trace['line'])) {
  41252. $content .= $this->formatPath($trace['file'], $trace['line']);
  41253. }
  41254. $content .= "</li>\n";
  41255. }
  41256. $content .= " </ol>\n</div>\n";
  41257. }
  41258. } catch (\Exception $e) {
  41259. if ($this->debug) {
  41260. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  41261. } else {
  41262. $title = 'Whoops, looks like something went wrong.';
  41263. }
  41264. }
  41265. }
  41266. return <<<EOF
  41267. <div id="sf-resetcontent" class="sf-reset">
  41268. <h1>$title</h1>
  41269. $content
  41270. </div>
  41271. EOF;
  41272. }
  41273. public function getStylesheet(FlattenException $exception)
  41274. {
  41275. return <<<'EOF'
  41276. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  41277. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  41278. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  41279. .sf-reset .clear_fix { display:inline-block; }
  41280. .sf-reset * html .clear_fix { height:1%; }
  41281. .sf-reset .clear_fix { display:block; }
  41282. .sf-reset, .sf-reset .block { margin: auto }
  41283. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  41284. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  41285. .sf-reset strong { font-weight:bold; }
  41286. .sf-reset a { color:#6c6159; cursor: default; }
  41287. .sf-reset a img { border:none; }
  41288. .sf-reset a:hover { text-decoration:underline; }
  41289. .sf-reset em { font-style:italic; }
  41290. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  41291. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  41292. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  41293. .sf-reset .exception_message { margin-left: 3em; display: block; }
  41294. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  41295. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  41296. -webkit-border-bottom-right-radius: 16px;
  41297. -webkit-border-bottom-left-radius: 16px;
  41298. -moz-border-radius-bottomright: 16px;
  41299. -moz-border-radius-bottomleft: 16px;
  41300. border-bottom-right-radius: 16px;
  41301. border-bottom-left-radius: 16px;
  41302. border-bottom:1px solid #ccc;
  41303. border-right:1px solid #ccc;
  41304. border-left:1px solid #ccc;
  41305. word-wrap: break-word;
  41306. }
  41307. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  41308. -webkit-border-top-left-radius: 16px;
  41309. -webkit-border-top-right-radius: 16px;
  41310. -moz-border-radius-topleft: 16px;
  41311. -moz-border-radius-topright: 16px;
  41312. border-top-left-radius: 16px;
  41313. border-top-right-radius: 16px;
  41314. border-top:1px solid #ccc;
  41315. border-right:1px solid #ccc;
  41316. border-left:1px solid #ccc;
  41317. overflow: hidden;
  41318. word-wrap: break-word;
  41319. }
  41320. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  41321. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  41322. .sf-reset ol { padding: 10px 0; }
  41323. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  41324. -webkit-border-radius: 10px;
  41325. -moz-border-radius: 10px;
  41326. border-radius: 10px;
  41327. border: 1px solid #ccc;
  41328. }
  41329. EOF;
  41330. }
  41331. private function decorate($content, $css)
  41332. {
  41333. return <<<EOF
  41334. <!DOCTYPE html>
  41335. <html>
  41336. <head>
  41337. <meta charset="{$this->charset}" />
  41338. <meta name="robots" content="noindex,nofollow" />
  41339. <style>
  41340. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  41341. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  41342. html { background: #eee; padding: 10px }
  41343. img { border: 0; }
  41344. #sf-resetcontent { width:970px; margin:0 auto; }
  41345. $css
  41346. </style>
  41347. </head>
  41348. <body>
  41349. $content
  41350. </body>
  41351. </html>
  41352. EOF;
  41353. }
  41354. private function formatClass($class)
  41355. {
  41356. $parts = explode('\\', $class);
  41357. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  41358. }
  41359. private function formatPath($path, $line)
  41360. {
  41361. $path = $this->escapeHtml($path);
  41362. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  41363. if ($linkFormat = $this->fileLinkFormat) {
  41364. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  41365. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  41366. }
  41367. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  41368. }
  41369. private function formatArgs(array $args)
  41370. {
  41371. $result = array();
  41372. foreach ($args as $key => $item) {
  41373. if ('object' === $item[0]) {
  41374. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  41375. } elseif ('array' === $item[0]) {
  41376. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  41377. } elseif ('string' === $item[0]) {
  41378. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  41379. } elseif ('null' === $item[0]) {
  41380. $formattedValue = '<em>null</em>';
  41381. } elseif ('boolean' === $item[0]) {
  41382. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  41383. } elseif ('resource' === $item[0]) {
  41384. $formattedValue = '<em>resource</em>';
  41385. } else {
  41386. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  41387. }
  41388. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  41389. }
  41390. return implode(', ', $result);
  41391. }
  41392. protected static function utf8Htmlize($str)
  41393. {
  41394. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  41395. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  41396. }
  41397. private function escapeHtml($str)
  41398. {
  41399. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  41400. }
  41401. public function catchOutput($buffer)
  41402. {
  41403. $this->caughtBuffer = $buffer;
  41404. return '';
  41405. }
  41406. public function cleanOutput($buffer)
  41407. {
  41408. if ($this->caughtLength) {
  41409. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  41410. if (isset($cleanBuffer[0])) {
  41411. $buffer = $cleanBuffer;
  41412. }
  41413. }
  41414. return $buffer;
  41415. }
  41416. }
  41417. <?php
  41418. namespace Symfony\Component\Debug\FatalErrorHandler;
  41419. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  41420. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  41421. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  41422. use Symfony\Component\Debug\DebugClassLoader;
  41423. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  41424. use Symfony\Component\Debug\Exception\FatalErrorException;
  41425. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  41426. {
  41427. public function handleError(array $error, FatalErrorException $exception)
  41428. {
  41429. $messageLen = \strlen($error['message']);
  41430. $notFoundSuffix = '\' not found';
  41431. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41432. if ($notFoundSuffixLen > $messageLen) {
  41433. return;
  41434. }
  41435. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41436. return;
  41437. }
  41438. foreach (array('class', 'interface', 'trait') as $typeName) {
  41439. $prefix = ucfirst($typeName).' \'';
  41440. $prefixLen = \strlen($prefix);
  41441. if (0 !== strpos($error['message'], $prefix)) {
  41442. continue;
  41443. }
  41444. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41445. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  41446. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  41447. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  41448. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  41449. $tail = ' for another namespace?';
  41450. } else {
  41451. $className = $fullyQualifiedClassName;
  41452. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  41453. $tail = '?';
  41454. }
  41455. if ($candidates = $this->getClassCandidates($className)) {
  41456. $tail = array_pop($candidates).'"?';
  41457. if ($candidates) {
  41458. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  41459. } else {
  41460. $tail = ' for "'.$tail;
  41461. }
  41462. }
  41463. $message .= "\nDid you forget a \"use\" statement".$tail;
  41464. return new ClassNotFoundException($message, $exception);
  41465. }
  41466. }
  41467. private function getClassCandidates($class)
  41468. {
  41469. if (!\is_array($functions = spl_autoload_functions())) {
  41470. return array();
  41471. }
  41472. $classes = array();
  41473. foreach ($functions as $function) {
  41474. if (!\is_array($function)) {
  41475. continue;
  41476. }
  41477. if ($function[0] instanceof DebugClassLoader) {
  41478. $function = $function[0]->getClassLoader();
  41479. if (\is_object($function)) {
  41480. $function = array($function);
  41481. }
  41482. if (!\is_array($function)) {
  41483. continue;
  41484. }
  41485. }
  41486. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  41487. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  41488. foreach ($paths as $path) {
  41489. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41490. }
  41491. }
  41492. }
  41493. if ($function[0] instanceof ComposerClassLoader) {
  41494. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  41495. foreach ($paths as $path) {
  41496. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41497. }
  41498. }
  41499. }
  41500. }
  41501. return array_unique($classes);
  41502. }
  41503. private function findClassInPath($path, $class, $prefix)
  41504. {
  41505. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  41506. return array();
  41507. }
  41508. $classes = array();
  41509. $filename = $class.'.php';
  41510. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  41511. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  41512. $classes[] = $class;
  41513. }
  41514. }
  41515. return $classes;
  41516. }
  41517. private function convertFileToClass($path, $file, $prefix)
  41518. {
  41519. $candidates = array(
  41520. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  41521. $prefix.$namespacedClass,
  41522. $prefix.'\\'.$namespacedClass,
  41523. str_replace('\\', '_', $namespacedClass),
  41524. str_replace('\\', '_', $prefix.$namespacedClass),
  41525. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  41526. );
  41527. if ($prefix) {
  41528. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  41529. }
  41530. foreach ($candidates as $candidate) {
  41531. if ($this->classExists($candidate)) {
  41532. return $candidate;
  41533. }
  41534. }
  41535. require_once $file;
  41536. foreach ($candidates as $candidate) {
  41537. if ($this->classExists($candidate)) {
  41538. return $candidate;
  41539. }
  41540. }
  41541. }
  41542. private function classExists($class)
  41543. {
  41544. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  41545. }
  41546. }
  41547. <?php
  41548. namespace Symfony\Component\Debug\FatalErrorHandler;
  41549. use Symfony\Component\Debug\Exception\FatalErrorException;
  41550. interface FatalErrorHandlerInterface
  41551. {
  41552. public function handleError(array $error, FatalErrorException $exception);
  41553. }
  41554. <?php
  41555. namespace Symfony\Component\Debug\FatalErrorHandler;
  41556. use Symfony\Component\Debug\Exception\FatalErrorException;
  41557. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  41558. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  41559. {
  41560. public function handleError(array $error, FatalErrorException $exception)
  41561. {
  41562. $messageLen = \strlen($error['message']);
  41563. $notFoundSuffix = '()';
  41564. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41565. if ($notFoundSuffixLen > $messageLen) {
  41566. return;
  41567. }
  41568. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41569. return;
  41570. }
  41571. $prefix = 'Call to undefined function ';
  41572. $prefixLen = \strlen($prefix);
  41573. if (0 !== strpos($error['message'], $prefix)) {
  41574. return;
  41575. }
  41576. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41577. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  41578. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  41579. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  41580. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  41581. } else {
  41582. $functionName = $fullyQualifiedFunctionName;
  41583. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  41584. }
  41585. $candidates = array();
  41586. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  41587. foreach ($definedFunctionNames as $definedFunctionName) {
  41588. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  41589. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  41590. } else {
  41591. $definedFunctionNameBasename = $definedFunctionName;
  41592. }
  41593. if ($definedFunctionNameBasename === $functionName) {
  41594. $candidates[] = '\\'.$definedFunctionName;
  41595. }
  41596. }
  41597. }
  41598. if ($candidates) {
  41599. sort($candidates);
  41600. $last = array_pop($candidates).'"?';
  41601. if ($candidates) {
  41602. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41603. } else {
  41604. $candidates = '"'.$last;
  41605. }
  41606. $message .= "\nDid you mean to call ".$candidates;
  41607. }
  41608. return new UndefinedFunctionException($message, $exception);
  41609. }
  41610. }
  41611. <?php
  41612. namespace Symfony\Component\Debug\FatalErrorHandler;
  41613. use Symfony\Component\Debug\Exception\FatalErrorException;
  41614. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  41615. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  41616. {
  41617. public function handleError(array $error, FatalErrorException $exception)
  41618. {
  41619. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  41620. if (!$matches) {
  41621. return;
  41622. }
  41623. $className = $matches[1];
  41624. $methodName = $matches[2];
  41625. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  41626. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  41627. return new UndefinedMethodException($message, $exception);
  41628. }
  41629. $candidates = array();
  41630. foreach ($methods as $definedMethodName) {
  41631. $lev = levenshtein($methodName, $definedMethodName);
  41632. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  41633. $candidates[] = $definedMethodName;
  41634. }
  41635. }
  41636. if ($candidates) {
  41637. sort($candidates);
  41638. $last = array_pop($candidates).'"?';
  41639. if ($candidates) {
  41640. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41641. } else {
  41642. $candidates = '"'.$last;
  41643. }
  41644. $message .= "\nDid you mean to call ".$candidates;
  41645. }
  41646. return new UndefinedMethodException($message, $exception);
  41647. }
  41648. }
  41649. Copyright (c) 2004-2018 Fabien Potencier
  41650. Permission is hereby granted, free of charge, to any person obtaining a copy
  41651. of this software and associated documentation files (the "Software"), to deal
  41652. in the Software without restriction, including without limitation the rights
  41653. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41654. copies of the Software, and to permit persons to whom the Software is furnished
  41655. to do so, subject to the following conditions:
  41656. The above copyright notice and this permission notice shall be included in all
  41657. copies or substantial portions of the Software.
  41658. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41659. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41660. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41661. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41662. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41663. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41664. THE SOFTWARE.
  41665. <?php
  41666. namespace Symfony\Component\Filesystem\Exception;
  41667. interface ExceptionInterface
  41668. {
  41669. }
  41670. <?php
  41671. namespace Symfony\Component\Filesystem\Exception;
  41672. class FileNotFoundException extends IOException
  41673. {
  41674. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  41675. {
  41676. if (null === $message) {
  41677. if (null === $path) {
  41678. $message = 'File could not be found.';
  41679. } else {
  41680. $message = sprintf('File "%s" could not be found.', $path);
  41681. }
  41682. }
  41683. parent::__construct($message, $code, $previous, $path);
  41684. }
  41685. }
  41686. <?php
  41687. namespace Symfony\Component\Filesystem\Exception;
  41688. class IOException extends \RuntimeException implements IOExceptionInterface
  41689. {
  41690. private $path;
  41691. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  41692. {
  41693. $this->path = $path;
  41694. parent::__construct($message, $code, $previous);
  41695. }
  41696. public function getPath()
  41697. {
  41698. return $this->path;
  41699. }
  41700. }
  41701. <?php
  41702. namespace Symfony\Component\Filesystem\Exception;
  41703. interface IOExceptionInterface extends ExceptionInterface
  41704. {
  41705. public function getPath();
  41706. }
  41707. <?php
  41708. namespace Symfony\Component\Filesystem;
  41709. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  41710. use Symfony\Component\Filesystem\Exception\IOException;
  41711. class Filesystem
  41712. {
  41713. private static $lastError;
  41714. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  41715. {
  41716. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  41717. if ($originIsLocal && !is_file($originFile)) {
  41718. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  41719. }
  41720. $this->mkdir(\dirname($targetFile));
  41721. $doCopy = true;
  41722. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  41723. $doCopy = filemtime($originFile) > filemtime($targetFile);
  41724. }
  41725. if ($doCopy) {
  41726. if (false === $source = @fopen($originFile, 'r')) {
  41727. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  41728. }
  41729. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  41730. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  41731. }
  41732. $bytesCopied = stream_copy_to_stream($source, $target);
  41733. fclose($source);
  41734. fclose($target);
  41735. unset($source, $target);
  41736. if (!is_file($targetFile)) {
  41737. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  41738. }
  41739. if ($originIsLocal) {
  41740. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  41741. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  41742. 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);
  41743. }
  41744. }
  41745. }
  41746. }
  41747. public function mkdir($dirs, $mode = 0777)
  41748. {
  41749. foreach ($this->toIterator($dirs) as $dir) {
  41750. if (is_dir($dir)) {
  41751. continue;
  41752. }
  41753. if (!self::box('mkdir', $dir, $mode, true)) {
  41754. if (!is_dir($dir)) {
  41755. if (self::$lastError) {
  41756. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  41757. }
  41758. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  41759. }
  41760. }
  41761. }
  41762. }
  41763. public function exists($files)
  41764. {
  41765. $maxPathLength = PHP_MAXPATHLEN - 2;
  41766. foreach ($this->toIterator($files) as $file) {
  41767. if (\strlen($file) > $maxPathLength) {
  41768. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  41769. }
  41770. if (!file_exists($file)) {
  41771. return false;
  41772. }
  41773. }
  41774. return true;
  41775. }
  41776. public function touch($files, $time = null, $atime = null)
  41777. {
  41778. foreach ($this->toIterator($files) as $file) {
  41779. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  41780. if (true !== $touch) {
  41781. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  41782. }
  41783. }
  41784. }
  41785. public function remove($files)
  41786. {
  41787. if ($files instanceof \Traversable) {
  41788. $files = iterator_to_array($files, false);
  41789. } elseif (!\is_array($files)) {
  41790. $files = array($files);
  41791. }
  41792. $files = array_reverse($files);
  41793. foreach ($files as $file) {
  41794. if (is_link($file)) {
  41795. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  41796. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  41797. }
  41798. } elseif (is_dir($file)) {
  41799. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  41800. if (!self::box('rmdir', $file) && file_exists($file)) {
  41801. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  41802. }
  41803. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  41804. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  41805. }
  41806. }
  41807. }
  41808. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  41809. {
  41810. foreach ($this->toIterator($files) as $file) {
  41811. if (true !== @chmod($file, $mode & ~$umask)) {
  41812. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  41813. }
  41814. if ($recursive && is_dir($file) && !is_link($file)) {
  41815. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  41816. }
  41817. }
  41818. }
  41819. public function chown($files, $user, $recursive = false)
  41820. {
  41821. foreach ($this->toIterator($files) as $file) {
  41822. if ($recursive && is_dir($file) && !is_link($file)) {
  41823. $this->chown(new \FilesystemIterator($file), $user, true);
  41824. }
  41825. if (is_link($file) && \function_exists('lchown')) {
  41826. if (true !== @lchown($file, $user)) {
  41827. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41828. }
  41829. } else {
  41830. if (true !== @chown($file, $user)) {
  41831. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41832. }
  41833. }
  41834. }
  41835. }
  41836. public function chgrp($files, $group, $recursive = false)
  41837. {
  41838. foreach ($this->toIterator($files) as $file) {
  41839. if ($recursive && is_dir($file) && !is_link($file)) {
  41840. $this->chgrp(new \FilesystemIterator($file), $group, true);
  41841. }
  41842. if (is_link($file) && \function_exists('lchgrp')) {
  41843. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  41844. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41845. }
  41846. } else {
  41847. if (true !== @chgrp($file, $group)) {
  41848. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41849. }
  41850. }
  41851. }
  41852. }
  41853. public function rename($origin, $target, $overwrite = false)
  41854. {
  41855. if (!$overwrite && $this->isReadable($target)) {
  41856. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  41857. }
  41858. if (true !== @rename($origin, $target)) {
  41859. if (is_dir($origin)) {
  41860. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  41861. $this->remove($origin);
  41862. return;
  41863. }
  41864. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  41865. }
  41866. }
  41867. private function isReadable($filename)
  41868. {
  41869. $maxPathLength = PHP_MAXPATHLEN - 2;
  41870. if (\strlen($filename) > $maxPathLength) {
  41871. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  41872. }
  41873. return is_readable($filename);
  41874. }
  41875. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  41876. {
  41877. if ('\\' === \DIRECTORY_SEPARATOR) {
  41878. $originDir = strtr($originDir, '/', '\\');
  41879. $targetDir = strtr($targetDir, '/', '\\');
  41880. if ($copyOnWindows) {
  41881. $this->mirror($originDir, $targetDir);
  41882. return;
  41883. }
  41884. }
  41885. $this->mkdir(\dirname($targetDir));
  41886. if (is_link($targetDir)) {
  41887. if (readlink($targetDir) === $originDir) {
  41888. return;
  41889. }
  41890. $this->remove($targetDir);
  41891. }
  41892. if (!self::box('symlink', $originDir, $targetDir)) {
  41893. if (null !== self::$lastError) {
  41894. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  41895. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  41896. }
  41897. }
  41898. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  41899. }
  41900. }
  41901. public function makePathRelative($endPath, $startPath)
  41902. {
  41903. if ('\\' === \DIRECTORY_SEPARATOR) {
  41904. $endPath = str_replace('\\', '/', $endPath);
  41905. $startPath = str_replace('\\', '/', $startPath);
  41906. }
  41907. $stripDriveLetter = function ($path) {
  41908. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  41909. return substr($path, 2);
  41910. }
  41911. return $path;
  41912. };
  41913. $endPath = $stripDriveLetter($endPath);
  41914. $startPath = $stripDriveLetter($startPath);
  41915. $startPathArr = explode('/', trim($startPath, '/'));
  41916. $endPathArr = explode('/', trim($endPath, '/'));
  41917. $normalizePathArray = function ($pathSegments, $absolute) {
  41918. $result = array();
  41919. foreach ($pathSegments as $segment) {
  41920. if ('..' === $segment && ($absolute || \count($result))) {
  41921. array_pop($result);
  41922. } elseif ('.' !== $segment) {
  41923. $result[] = $segment;
  41924. }
  41925. }
  41926. return $result;
  41927. };
  41928. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  41929. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  41930. $index = 0;
  41931. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  41932. ++$index;
  41933. }
  41934. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  41935. $depth = 0;
  41936. } else {
  41937. $depth = \count($startPathArr) - $index;
  41938. }
  41939. $traverser = str_repeat('../', $depth);
  41940. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  41941. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  41942. return '' === $relativePath ? './' : $relativePath;
  41943. }
  41944. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  41945. {
  41946. $targetDir = rtrim($targetDir, '/\\');
  41947. $originDir = rtrim($originDir, '/\\');
  41948. $originDirLen = \strlen($originDir);
  41949. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  41950. $deleteIterator = $iterator;
  41951. if (null === $deleteIterator) {
  41952. $flags = \FilesystemIterator::SKIP_DOTS;
  41953. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  41954. }
  41955. $targetDirLen = \strlen($targetDir);
  41956. foreach ($deleteIterator as $file) {
  41957. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  41958. if (!$this->exists($origin)) {
  41959. $this->remove($file);
  41960. }
  41961. }
  41962. }
  41963. $copyOnWindows = false;
  41964. if (isset($options['copy_on_windows'])) {
  41965. $copyOnWindows = $options['copy_on_windows'];
  41966. }
  41967. if (null === $iterator) {
  41968. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  41969. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  41970. }
  41971. if ($this->exists($originDir)) {
  41972. $this->mkdir($targetDir);
  41973. }
  41974. foreach ($iterator as $file) {
  41975. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  41976. if ($copyOnWindows) {
  41977. if (is_file($file)) {
  41978. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  41979. } elseif (is_dir($file)) {
  41980. $this->mkdir($target);
  41981. } else {
  41982. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  41983. }
  41984. } else {
  41985. if (is_link($file)) {
  41986. $this->symlink($file->getLinkTarget(), $target);
  41987. } elseif (is_dir($file)) {
  41988. $this->mkdir($target);
  41989. } elseif (is_file($file)) {
  41990. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  41991. } else {
  41992. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  41993. }
  41994. }
  41995. }
  41996. }
  41997. public function isAbsolutePath($file)
  41998. {
  41999. return strspn($file, '/\\', 0, 1)
  42000. || (\strlen($file) > 3 && ctype_alpha($file[0])
  42001. && ':' === substr($file, 1, 1)
  42002. && strspn($file, '/\\', 2, 1)
  42003. )
  42004. || null !== parse_url($file, PHP_URL_SCHEME)
  42005. ;
  42006. }
  42007. public function tempnam($dir, $prefix)
  42008. {
  42009. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  42010. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  42011. $tmpFile = @tempnam($hierarchy, $prefix);
  42012. if (false !== $tmpFile) {
  42013. if (null !== $scheme && 'gs' !== $scheme) {
  42014. return $scheme.'://'.$tmpFile;
  42015. }
  42016. return $tmpFile;
  42017. }
  42018. throw new IOException('A temporary file could not be created.');
  42019. }
  42020. for ($i = 0; $i < 10; ++$i) {
  42021. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  42022. $handle = @fopen($tmpFile, 'x+');
  42023. if (false === $handle) {
  42024. continue;
  42025. }
  42026. @fclose($handle);
  42027. return $tmpFile;
  42028. }
  42029. throw new IOException('A temporary file could not be created.');
  42030. }
  42031. public function dumpFile($filename, $content, $mode = 0666)
  42032. {
  42033. $dir = \dirname($filename);
  42034. if (!is_dir($dir)) {
  42035. $this->mkdir($dir);
  42036. }
  42037. if (!is_writable($dir)) {
  42038. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  42039. }
  42040. $tmpFile = $this->tempnam($dir, basename($filename));
  42041. if (false === @file_put_contents($tmpFile, $content)) {
  42042. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  42043. }
  42044. if (null !== $mode) {
  42045. if (\func_num_args() > 2) {
  42046. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  42047. }
  42048. $this->chmod($tmpFile, $mode);
  42049. } elseif (file_exists($filename)) {
  42050. @chmod($tmpFile, fileperms($filename));
  42051. }
  42052. $this->rename($tmpFile, $filename, true);
  42053. }
  42054. private function toIterator($files)
  42055. {
  42056. if (!$files instanceof \Traversable) {
  42057. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  42058. }
  42059. return $files;
  42060. }
  42061. private function getSchemeAndHierarchy($filename)
  42062. {
  42063. $components = explode('://', $filename, 2);
  42064. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  42065. }
  42066. private static function box($func)
  42067. {
  42068. self::$lastError = null;
  42069. \set_error_handler(__CLASS__.'::handleError');
  42070. try {
  42071. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  42072. \restore_error_handler();
  42073. return $result;
  42074. } catch (\Throwable $e) {
  42075. } catch (\Exception $e) {
  42076. }
  42077. \restore_error_handler();
  42078. throw $e;
  42079. }
  42080. public static function handleError($type, $msg)
  42081. {
  42082. self::$lastError = $msg;
  42083. }
  42084. }
  42085. Copyright (c) 2004-2018 Fabien Potencier
  42086. Permission is hereby granted, free of charge, to any person obtaining a copy
  42087. of this software and associated documentation files (the "Software"), to deal
  42088. in the Software without restriction, including without limitation the rights
  42089. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42090. copies of the Software, and to permit persons to whom the Software is furnished
  42091. to do so, subject to the following conditions:
  42092. The above copyright notice and this permission notice shall be included in all
  42093. copies or substantial portions of the Software.
  42094. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42095. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42096. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42097. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42098. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42099. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42100. THE SOFTWARE.
  42101. <?php
  42102. namespace Symfony\Component\Filesystem;
  42103. use Symfony\Component\Filesystem\Exception\IOException;
  42104. class LockHandler
  42105. {
  42106. private $file;
  42107. private $handle;
  42108. public function __construct($name, $lockPath = null)
  42109. {
  42110. $lockPath = $lockPath ?: sys_get_temp_dir();
  42111. if (!is_dir($lockPath)) {
  42112. $fs = new Filesystem();
  42113. $fs->mkdir($lockPath);
  42114. }
  42115. if (!is_writable($lockPath)) {
  42116. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  42117. }
  42118. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  42119. }
  42120. public function lock($blocking = false)
  42121. {
  42122. if ($this->handle) {
  42123. return true;
  42124. }
  42125. $error = null;
  42126. set_error_handler(function ($errno, $msg) use (&$error) {
  42127. $error = $msg;
  42128. });
  42129. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42130. if ($this->handle = fopen($this->file, 'x')) {
  42131. chmod($this->file, 0666);
  42132. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42133. usleep(100);
  42134. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  42135. }
  42136. }
  42137. restore_error_handler();
  42138. if (!$this->handle) {
  42139. throw new IOException($error, 0, null, $this->file);
  42140. }
  42141. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  42142. fclose($this->handle);
  42143. $this->handle = null;
  42144. return false;
  42145. }
  42146. return true;
  42147. }
  42148. public function release()
  42149. {
  42150. if ($this->handle) {
  42151. flock($this->handle, LOCK_UN | LOCK_NB);
  42152. fclose($this->handle);
  42153. $this->handle = null;
  42154. }
  42155. }
  42156. }
  42157. <?php
  42158. namespace Symfony\Component\Finder\Adapter;
  42159. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42160. abstract class AbstractAdapter implements AdapterInterface
  42161. {
  42162. protected $followLinks = false;
  42163. protected $mode = 0;
  42164. protected $minDepth = 0;
  42165. protected $maxDepth = PHP_INT_MAX;
  42166. protected $exclude = array();
  42167. protected $names = array();
  42168. protected $notNames = array();
  42169. protected $contains = array();
  42170. protected $notContains = array();
  42171. protected $sizes = array();
  42172. protected $dates = array();
  42173. protected $filters = array();
  42174. protected $sort = false;
  42175. protected $paths = array();
  42176. protected $notPaths = array();
  42177. protected $ignoreUnreadableDirs = false;
  42178. private static $areSupported = array();
  42179. public function isSupported()
  42180. {
  42181. $name = $this->getName();
  42182. if (!array_key_exists($name, self::$areSupported)) {
  42183. self::$areSupported[$name] = $this->canBeUsed();
  42184. }
  42185. return self::$areSupported[$name];
  42186. }
  42187. public function setFollowLinks($followLinks)
  42188. {
  42189. $this->followLinks = $followLinks;
  42190. return $this;
  42191. }
  42192. public function setMode($mode)
  42193. {
  42194. $this->mode = $mode;
  42195. return $this;
  42196. }
  42197. public function setDepths(array $depths)
  42198. {
  42199. $this->minDepth = 0;
  42200. $this->maxDepth = PHP_INT_MAX;
  42201. foreach ($depths as $comparator) {
  42202. switch ($comparator->getOperator()) {
  42203. case '>':
  42204. $this->minDepth = $comparator->getTarget() + 1;
  42205. break;
  42206. case '>=':
  42207. $this->minDepth = $comparator->getTarget();
  42208. break;
  42209. case '<':
  42210. $this->maxDepth = $comparator->getTarget() - 1;
  42211. break;
  42212. case '<=':
  42213. $this->maxDepth = $comparator->getTarget();
  42214. break;
  42215. default:
  42216. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  42217. }
  42218. }
  42219. return $this;
  42220. }
  42221. public function setExclude(array $exclude)
  42222. {
  42223. $this->exclude = $exclude;
  42224. return $this;
  42225. }
  42226. public function setNames(array $names)
  42227. {
  42228. $this->names = $names;
  42229. return $this;
  42230. }
  42231. public function setNotNames(array $notNames)
  42232. {
  42233. $this->notNames = $notNames;
  42234. return $this;
  42235. }
  42236. public function setContains(array $contains)
  42237. {
  42238. $this->contains = $contains;
  42239. return $this;
  42240. }
  42241. public function setNotContains(array $notContains)
  42242. {
  42243. $this->notContains = $notContains;
  42244. return $this;
  42245. }
  42246. public function setSizes(array $sizes)
  42247. {
  42248. $this->sizes = $sizes;
  42249. return $this;
  42250. }
  42251. public function setDates(array $dates)
  42252. {
  42253. $this->dates = $dates;
  42254. return $this;
  42255. }
  42256. public function setFilters(array $filters)
  42257. {
  42258. $this->filters = $filters;
  42259. return $this;
  42260. }
  42261. public function setSort($sort)
  42262. {
  42263. $this->sort = $sort;
  42264. return $this;
  42265. }
  42266. public function setPath(array $paths)
  42267. {
  42268. $this->paths = $paths;
  42269. return $this;
  42270. }
  42271. public function setNotPath(array $notPaths)
  42272. {
  42273. $this->notPaths = $notPaths;
  42274. return $this;
  42275. }
  42276. public function ignoreUnreadableDirs($ignore = true)
  42277. {
  42278. $this->ignoreUnreadableDirs = (bool) $ignore;
  42279. return $this;
  42280. }
  42281. abstract protected function canBeUsed();
  42282. }
  42283. <?php
  42284. namespace Symfony\Component\Finder\Adapter;
  42285. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42286. use Symfony\Component\Finder\Comparator\DateComparator;
  42287. use Symfony\Component\Finder\Comparator\NumberComparator;
  42288. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42289. use Symfony\Component\Finder\Expression\Expression;
  42290. use Symfony\Component\Finder\Iterator;
  42291. use Symfony\Component\Finder\Shell\Command;
  42292. use Symfony\Component\Finder\Shell\Shell;
  42293. abstract class AbstractFindAdapter extends AbstractAdapter
  42294. {
  42295. protected $shell;
  42296. public function __construct()
  42297. {
  42298. $this->shell = new Shell();
  42299. }
  42300. public function searchInDirectory($dir)
  42301. {
  42302. $dir = realpath($dir);
  42303. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  42304. return new Iterator\FilePathsIterator(array(), $dir);
  42305. }
  42306. $command = Command::create();
  42307. $find = $this->buildFindCommand($command, $dir);
  42308. if ($this->followLinks) {
  42309. $find->add('-follow');
  42310. }
  42311. $find->add('-mindepth')->add($this->minDepth + 1);
  42312. if (PHP_INT_MAX !== $this->maxDepth) {
  42313. $find->add('-maxdepth')->add($this->maxDepth + 1);
  42314. }
  42315. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  42316. $find->add('-type d');
  42317. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  42318. $find->add('-type f');
  42319. }
  42320. $this->buildNamesFiltering($find, $this->names);
  42321. $this->buildNamesFiltering($find, $this->notNames, true);
  42322. $this->buildPathsFiltering($find, $dir, $this->paths);
  42323. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  42324. $this->buildSizesFiltering($find, $this->sizes);
  42325. $this->buildDatesFiltering($find, $this->dates);
  42326. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  42327. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  42328. if ($useGrep && ($this->contains || $this->notContains)) {
  42329. $grep = $command->ins('grep');
  42330. $this->buildContentFiltering($grep, $this->contains);
  42331. $this->buildContentFiltering($grep, $this->notContains, true);
  42332. }
  42333. if ($useSort) {
  42334. $this->buildSorting($command, $this->sort);
  42335. }
  42336. $command->setErrorHandler(
  42337. $this->ignoreUnreadableDirs
  42338. ? function ($stderr) { }
  42339. : function ($stderr) { throw new AccessDeniedException($stderr); }
  42340. );
  42341. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  42342. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  42343. if ($this->exclude) {
  42344. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42345. }
  42346. if (!$useGrep && ($this->contains || $this->notContains)) {
  42347. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42348. }
  42349. if ($this->filters) {
  42350. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42351. }
  42352. if (!$useSort && $this->sort) {
  42353. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42354. $iterator = $iteratorAggregate->getIterator();
  42355. }
  42356. return $iterator;
  42357. }
  42358. protected function canBeUsed()
  42359. {
  42360. return $this->shell->testCommand('find');
  42361. }
  42362. protected function buildFindCommand(Command $command, $dir)
  42363. {
  42364. return $command
  42365. ->ins('find')
  42366. ->add('find ')
  42367. ->arg($dir)
  42368. ->add('-noleaf');
  42369. }
  42370. private function buildNamesFiltering(Command $command, array $names, $not = false)
  42371. {
  42372. if (0 === \count($names)) {
  42373. return;
  42374. }
  42375. $command->add($not ? '-not' : null)->cmd('(');
  42376. foreach ($names as $i => $name) {
  42377. $expr = Expression::create($name);
  42378. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42379. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42380. }
  42381. if ($expr->isRegex()) {
  42382. $regex = $expr->getRegex();
  42383. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  42384. ->setStartFlag(false)
  42385. ->setStartJoker(true)
  42386. ->replaceJokers('[^/]');
  42387. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  42388. $regex->setEndJoker(false)->append('[^/]*');
  42389. }
  42390. }
  42391. $command
  42392. ->add($i > 0 ? '-or' : null)
  42393. ->add($expr->isRegex()
  42394. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42395. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  42396. )
  42397. ->arg($expr->renderPattern());
  42398. }
  42399. $command->cmd(')');
  42400. }
  42401. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  42402. {
  42403. if (0 === \count($paths)) {
  42404. return;
  42405. }
  42406. $command->add($not ? '-not' : null)->cmd('(');
  42407. foreach ($paths as $i => $path) {
  42408. $expr = Expression::create($path);
  42409. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42410. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42411. }
  42412. if ($expr->isRegex()) {
  42413. $regex = $expr->getRegex();
  42414. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  42415. } else {
  42416. $expr->prepend('*')->append('*');
  42417. }
  42418. $command
  42419. ->add($i > 0 ? '-or' : null)
  42420. ->add($expr->isRegex()
  42421. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42422. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  42423. )
  42424. ->arg($expr->renderPattern());
  42425. }
  42426. $command->cmd(')');
  42427. }
  42428. private function buildSizesFiltering(Command $command, array $sizes)
  42429. {
  42430. foreach ($sizes as $i => $size) {
  42431. $command->add($i > 0 ? '-and' : null);
  42432. switch ($size->getOperator()) {
  42433. case '<=':
  42434. $command->add('-size -'.($size->getTarget() + 1).'c');
  42435. break;
  42436. case '>=':
  42437. $command->add('-size +'.($size->getTarget() - 1).'c');
  42438. break;
  42439. case '>':
  42440. $command->add('-size +'.$size->getTarget().'c');
  42441. break;
  42442. case '!=':
  42443. $command->add('-size -'.$size->getTarget().'c');
  42444. $command->add('-size +'.$size->getTarget().'c');
  42445. break;
  42446. case '<':
  42447. default:
  42448. $command->add('-size -'.$size->getTarget().'c');
  42449. }
  42450. }
  42451. }
  42452. private function buildDatesFiltering(Command $command, array $dates)
  42453. {
  42454. foreach ($dates as $i => $date) {
  42455. $command->add($i > 0 ? '-and' : null);
  42456. $mins = (int) round((time() - $date->getTarget()) / 60);
  42457. if (0 > $mins) {
  42458. $command->add(' -mmin -0');
  42459. return;
  42460. }
  42461. switch ($date->getOperator()) {
  42462. case '<=':
  42463. $command->add('-mmin +'.($mins - 1));
  42464. break;
  42465. case '>=':
  42466. $command->add('-mmin -'.($mins + 1));
  42467. break;
  42468. case '>':
  42469. $command->add('-mmin -'.$mins);
  42470. break;
  42471. case '!=':
  42472. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  42473. break;
  42474. case '<':
  42475. default:
  42476. $command->add('-mmin +'.$mins);
  42477. }
  42478. }
  42479. }
  42480. private function buildSorting(Command $command, $sort)
  42481. {
  42482. $this->buildFormatSorting($command, $sort);
  42483. }
  42484. abstract protected function buildFormatSorting(Command $command, $sort);
  42485. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  42486. }
  42487. <?php
  42488. namespace Symfony\Component\Finder\Adapter;
  42489. interface AdapterInterface
  42490. {
  42491. public function setFollowLinks($followLinks);
  42492. public function setMode($mode);
  42493. public function setExclude(array $exclude);
  42494. public function setDepths(array $depths);
  42495. public function setNames(array $names);
  42496. public function setNotNames(array $notNames);
  42497. public function setContains(array $contains);
  42498. public function setNotContains(array $notContains);
  42499. public function setSizes(array $sizes);
  42500. public function setDates(array $dates);
  42501. public function setFilters(array $filters);
  42502. public function setSort($sort);
  42503. public function setPath(array $paths);
  42504. public function setNotPath(array $notPaths);
  42505. public function ignoreUnreadableDirs($ignore = true);
  42506. public function searchInDirectory($dir);
  42507. public function isSupported();
  42508. public function getName();
  42509. }
  42510. <?php
  42511. namespace Symfony\Component\Finder\Adapter;
  42512. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42513. use Symfony\Component\Finder\Expression\Expression;
  42514. use Symfony\Component\Finder\Iterator\SortableIterator;
  42515. use Symfony\Component\Finder\Shell\Command;
  42516. use Symfony\Component\Finder\Shell\Shell;
  42517. class BsdFindAdapter extends AbstractFindAdapter
  42518. {
  42519. public function getName()
  42520. {
  42521. return 'bsd_find';
  42522. }
  42523. protected function canBeUsed()
  42524. {
  42525. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  42526. }
  42527. protected function buildFormatSorting(Command $command, $sort)
  42528. {
  42529. switch ($sort) {
  42530. case SortableIterator::SORT_BY_NAME:
  42531. $command->ins('sort')->add('| sort');
  42532. return;
  42533. case SortableIterator::SORT_BY_TYPE:
  42534. $format = '%HT';
  42535. break;
  42536. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42537. $format = '%a';
  42538. break;
  42539. case SortableIterator::SORT_BY_CHANGED_TIME:
  42540. $format = '%c';
  42541. break;
  42542. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42543. $format = '%m';
  42544. break;
  42545. default:
  42546. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42547. }
  42548. $command
  42549. ->add('-print0 | xargs -0 stat -f')
  42550. ->arg($format.'%t%N')
  42551. ->add('| sort | cut -f 2');
  42552. }
  42553. protected function buildFindCommand(Command $command, $dir)
  42554. {
  42555. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  42556. return $command;
  42557. }
  42558. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42559. {
  42560. foreach ($contains as $contain) {
  42561. $expr = Expression::create($contain);
  42562. $command
  42563. ->add('| grep -v \'^$\'')
  42564. ->add('| xargs -I{} grep -I')
  42565. ->add($expr->isCaseSensitive() ? null : '-i')
  42566. ->add($not ? '-L' : '-l')
  42567. ->add('-Ee')->arg($expr->renderPattern())
  42568. ->add('{}')
  42569. ;
  42570. }
  42571. }
  42572. }
  42573. <?php
  42574. namespace Symfony\Component\Finder\Adapter;
  42575. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42576. use Symfony\Component\Finder\Expression\Expression;
  42577. use Symfony\Component\Finder\Iterator\SortableIterator;
  42578. use Symfony\Component\Finder\Shell\Command;
  42579. use Symfony\Component\Finder\Shell\Shell;
  42580. class GnuFindAdapter extends AbstractFindAdapter
  42581. {
  42582. public function getName()
  42583. {
  42584. return 'gnu_find';
  42585. }
  42586. protected function buildFormatSorting(Command $command, $sort)
  42587. {
  42588. switch ($sort) {
  42589. case SortableIterator::SORT_BY_NAME:
  42590. $command->ins('sort')->add('| sort');
  42591. return;
  42592. case SortableIterator::SORT_BY_TYPE:
  42593. $format = '%y';
  42594. break;
  42595. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42596. $format = '%A@';
  42597. break;
  42598. case SortableIterator::SORT_BY_CHANGED_TIME:
  42599. $format = '%C@';
  42600. break;
  42601. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42602. $format = '%T@';
  42603. break;
  42604. default:
  42605. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42606. }
  42607. $command
  42608. ->get('find')
  42609. ->add('-printf')
  42610. ->arg($format.' %h/%f\\n')
  42611. ->add('| sort | cut')
  42612. ->arg('-d ')
  42613. ->arg('-f2-')
  42614. ;
  42615. }
  42616. protected function canBeUsed()
  42617. {
  42618. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  42619. }
  42620. protected function buildFindCommand(Command $command, $dir)
  42621. {
  42622. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  42623. }
  42624. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42625. {
  42626. foreach ($contains as $contain) {
  42627. $expr = Expression::create($contain);
  42628. $command
  42629. ->add('| xargs -I{} -r grep -I')
  42630. ->add($expr->isCaseSensitive() ? null : '-i')
  42631. ->add($not ? '-L' : '-l')
  42632. ->add('-Ee')->arg($expr->renderPattern())
  42633. ->add('{}')
  42634. ;
  42635. }
  42636. }
  42637. }
  42638. <?php
  42639. namespace Symfony\Component\Finder\Adapter;
  42640. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42641. use Symfony\Component\Finder\Iterator;
  42642. class PhpAdapter extends AbstractAdapter
  42643. {
  42644. public function searchInDirectory($dir)
  42645. {
  42646. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42647. if ($this->followLinks) {
  42648. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42649. }
  42650. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42651. if ($this->exclude) {
  42652. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42653. }
  42654. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42655. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  42656. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  42657. }
  42658. if ($this->mode) {
  42659. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42660. }
  42661. if ($this->names || $this->notNames) {
  42662. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42663. }
  42664. if ($this->contains || $this->notContains) {
  42665. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42666. }
  42667. if ($this->sizes) {
  42668. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42669. }
  42670. if ($this->dates) {
  42671. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42672. }
  42673. if ($this->filters) {
  42674. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42675. }
  42676. if ($this->paths || $this->notPaths) {
  42677. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42678. }
  42679. if ($this->sort) {
  42680. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42681. $iterator = $iteratorAggregate->getIterator();
  42682. }
  42683. return $iterator;
  42684. }
  42685. public function getName()
  42686. {
  42687. return 'php';
  42688. }
  42689. protected function canBeUsed()
  42690. {
  42691. return true;
  42692. }
  42693. }
  42694. <?php
  42695. namespace Symfony\Component\Finder\Comparator;
  42696. class Comparator
  42697. {
  42698. private $target;
  42699. private $operator = '==';
  42700. public function getTarget()
  42701. {
  42702. return $this->target;
  42703. }
  42704. public function setTarget($target)
  42705. {
  42706. $this->target = $target;
  42707. }
  42708. public function getOperator()
  42709. {
  42710. return $this->operator;
  42711. }
  42712. public function setOperator($operator)
  42713. {
  42714. if (!$operator) {
  42715. $operator = '==';
  42716. }
  42717. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  42718. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  42719. }
  42720. $this->operator = $operator;
  42721. }
  42722. public function test($test)
  42723. {
  42724. switch ($this->operator) {
  42725. case '>':
  42726. return $test > $this->target;
  42727. case '>=':
  42728. return $test >= $this->target;
  42729. case '<':
  42730. return $test < $this->target;
  42731. case '<=':
  42732. return $test <= $this->target;
  42733. case '!=':
  42734. return $test != $this->target;
  42735. }
  42736. return $test == $this->target;
  42737. }
  42738. }
  42739. <?php
  42740. namespace Symfony\Component\Finder\Comparator;
  42741. class DateComparator extends Comparator
  42742. {
  42743. public function __construct($test)
  42744. {
  42745. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  42746. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  42747. }
  42748. try {
  42749. $date = new \DateTime($matches[2]);
  42750. $target = $date->format('U');
  42751. } catch (\Exception $e) {
  42752. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  42753. }
  42754. $operator = isset($matches[1]) ? $matches[1] : '==';
  42755. if ('since' === $operator || 'after' === $operator) {
  42756. $operator = '>';
  42757. }
  42758. if ('until' === $operator || 'before' === $operator) {
  42759. $operator = '<';
  42760. }
  42761. $this->setOperator($operator);
  42762. $this->setTarget($target);
  42763. }
  42764. }
  42765. <?php
  42766. namespace Symfony\Component\Finder\Comparator;
  42767. class NumberComparator extends Comparator
  42768. {
  42769. public function __construct($test)
  42770. {
  42771. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  42772. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  42773. }
  42774. $target = $matches[2];
  42775. if (!is_numeric($target)) {
  42776. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  42777. }
  42778. if (isset($matches[3])) {
  42779. switch (strtolower($matches[3])) {
  42780. case 'k':
  42781. $target *= 1000;
  42782. break;
  42783. case 'ki':
  42784. $target *= 1024;
  42785. break;
  42786. case 'm':
  42787. $target *= 1000000;
  42788. break;
  42789. case 'mi':
  42790. $target *= 1024 * 1024;
  42791. break;
  42792. case 'g':
  42793. $target *= 1000000000;
  42794. break;
  42795. case 'gi':
  42796. $target *= 1024 * 1024 * 1024;
  42797. break;
  42798. }
  42799. }
  42800. $this->setTarget($target);
  42801. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  42802. }
  42803. }
  42804. <?php
  42805. namespace Symfony\Component\Finder\Exception;
  42806. class AccessDeniedException extends \UnexpectedValueException
  42807. {
  42808. }
  42809. <?php
  42810. namespace Symfony\Component\Finder\Exception;
  42811. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42812. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42813. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  42814. {
  42815. private $adapter;
  42816. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  42817. {
  42818. $this->adapter = $adapter;
  42819. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  42820. }
  42821. public function getAdapter()
  42822. {
  42823. return $this->adapter;
  42824. }
  42825. }
  42826. <?php
  42827. namespace Symfony\Component\Finder\Exception;
  42828. interface ExceptionInterface
  42829. {
  42830. public function getAdapter();
  42831. }
  42832. <?php
  42833. namespace Symfony\Component\Finder\Exception;
  42834. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42835. class OperationNotPermitedException extends AdapterFailureException
  42836. {
  42837. }
  42838. <?php
  42839. namespace Symfony\Component\Finder\Exception;
  42840. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42841. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42842. use Symfony\Component\Finder\Shell\Command;
  42843. class ShellCommandFailureException extends AdapterFailureException
  42844. {
  42845. private $command;
  42846. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  42847. {
  42848. $this->command = $command;
  42849. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  42850. }
  42851. public function getCommand()
  42852. {
  42853. return $this->command;
  42854. }
  42855. }
  42856. <?php
  42857. namespace Symfony\Component\Finder\Expression;
  42858. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42859. class Expression implements ValueInterface
  42860. {
  42861. const TYPE_REGEX = 1;
  42862. const TYPE_GLOB = 2;
  42863. private $value;
  42864. public static function create($expr)
  42865. {
  42866. return new self($expr);
  42867. }
  42868. public function __construct($expr)
  42869. {
  42870. try {
  42871. $this->value = Regex::create($expr);
  42872. } catch (\InvalidArgumentException $e) {
  42873. $this->value = new Glob($expr);
  42874. }
  42875. }
  42876. public function __toString()
  42877. {
  42878. return $this->render();
  42879. }
  42880. public function render()
  42881. {
  42882. return $this->value->render();
  42883. }
  42884. public function renderPattern()
  42885. {
  42886. return $this->value->renderPattern();
  42887. }
  42888. public function isCaseSensitive()
  42889. {
  42890. return $this->value->isCaseSensitive();
  42891. }
  42892. public function getType()
  42893. {
  42894. return $this->value->getType();
  42895. }
  42896. public function prepend($expr)
  42897. {
  42898. $this->value->prepend($expr);
  42899. return $this;
  42900. }
  42901. public function append($expr)
  42902. {
  42903. $this->value->append($expr);
  42904. return $this;
  42905. }
  42906. public function isRegex()
  42907. {
  42908. return self::TYPE_REGEX === $this->value->getType();
  42909. }
  42910. public function isGlob()
  42911. {
  42912. return self::TYPE_GLOB === $this->value->getType();
  42913. }
  42914. public function getGlob()
  42915. {
  42916. if (self::TYPE_GLOB !== $this->value->getType()) {
  42917. throw new \LogicException('Regex can\'t be transformed to glob.');
  42918. }
  42919. return $this->value;
  42920. }
  42921. public function getRegex()
  42922. {
  42923. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  42924. }
  42925. }
  42926. <?php
  42927. namespace Symfony\Component\Finder\Expression;
  42928. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42929. use Symfony\Component\Finder\Glob as FinderGlob;
  42930. class Glob implements ValueInterface
  42931. {
  42932. private $pattern;
  42933. public function __construct($pattern)
  42934. {
  42935. $this->pattern = $pattern;
  42936. }
  42937. public function render()
  42938. {
  42939. return $this->pattern;
  42940. }
  42941. public function renderPattern()
  42942. {
  42943. return $this->pattern;
  42944. }
  42945. public function getType()
  42946. {
  42947. return Expression::TYPE_GLOB;
  42948. }
  42949. public function isCaseSensitive()
  42950. {
  42951. return true;
  42952. }
  42953. public function prepend($expr)
  42954. {
  42955. $this->pattern = $expr.$this->pattern;
  42956. return $this;
  42957. }
  42958. public function append($expr)
  42959. {
  42960. $this->pattern .= $expr;
  42961. return $this;
  42962. }
  42963. public function isExpandable()
  42964. {
  42965. return false !== strpos($this->pattern, '{')
  42966. && false !== strpos($this->pattern, '}');
  42967. }
  42968. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  42969. {
  42970. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  42971. return new Regex($regex);
  42972. }
  42973. }
  42974. <?php
  42975. namespace Symfony\Component\Finder\Expression;
  42976. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42977. class Regex implements ValueInterface
  42978. {
  42979. const START_FLAG = '^';
  42980. const END_FLAG = '$';
  42981. const BOUNDARY = '~';
  42982. const JOKER = '.*';
  42983. const ESCAPING = '\\';
  42984. private $pattern;
  42985. private $options;
  42986. private $startFlag;
  42987. private $endFlag;
  42988. private $startJoker;
  42989. private $endJoker;
  42990. public static function create($expr)
  42991. {
  42992. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  42993. $start = substr($m[1], 0, 1);
  42994. $end = substr($m[1], -1);
  42995. if (
  42996. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  42997. || ('{' === $start && '}' === $end)
  42998. || ('(' === $start && ')' === $end)
  42999. ) {
  43000. return new self(substr($m[1], 1, -1), $m[2], $end);
  43001. }
  43002. }
  43003. throw new \InvalidArgumentException('Given expression is not a regex.');
  43004. }
  43005. public function __construct($pattern, $options = '', $delimiter = null)
  43006. {
  43007. if (null !== $delimiter) {
  43008. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  43009. }
  43010. $this->parsePattern($pattern);
  43011. $this->options = $options;
  43012. }
  43013. public function __toString()
  43014. {
  43015. return $this->render();
  43016. }
  43017. public function render()
  43018. {
  43019. return self::BOUNDARY
  43020. .$this->renderPattern()
  43021. .self::BOUNDARY
  43022. .$this->options;
  43023. }
  43024. public function renderPattern()
  43025. {
  43026. return ($this->startFlag ? self::START_FLAG : '')
  43027. .($this->startJoker ? self::JOKER : '')
  43028. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  43029. .($this->endJoker ? self::JOKER : '')
  43030. .($this->endFlag ? self::END_FLAG : '');
  43031. }
  43032. public function isCaseSensitive()
  43033. {
  43034. return !$this->hasOption('i');
  43035. }
  43036. public function getType()
  43037. {
  43038. return Expression::TYPE_REGEX;
  43039. }
  43040. public function prepend($expr)
  43041. {
  43042. $this->pattern = $expr.$this->pattern;
  43043. return $this;
  43044. }
  43045. public function append($expr)
  43046. {
  43047. $this->pattern .= $expr;
  43048. return $this;
  43049. }
  43050. public function hasOption($option)
  43051. {
  43052. return false !== strpos($this->options, $option);
  43053. }
  43054. public function addOption($option)
  43055. {
  43056. if (!$this->hasOption($option)) {
  43057. $this->options .= $option;
  43058. }
  43059. return $this;
  43060. }
  43061. public function removeOption($option)
  43062. {
  43063. $this->options = str_replace($option, '', $this->options);
  43064. return $this;
  43065. }
  43066. public function setStartFlag($startFlag)
  43067. {
  43068. $this->startFlag = $startFlag;
  43069. return $this;
  43070. }
  43071. public function hasStartFlag()
  43072. {
  43073. return $this->startFlag;
  43074. }
  43075. public function setEndFlag($endFlag)
  43076. {
  43077. $this->endFlag = (bool) $endFlag;
  43078. return $this;
  43079. }
  43080. public function hasEndFlag()
  43081. {
  43082. return $this->endFlag;
  43083. }
  43084. public function setStartJoker($startJoker)
  43085. {
  43086. $this->startJoker = $startJoker;
  43087. return $this;
  43088. }
  43089. public function hasStartJoker()
  43090. {
  43091. return $this->startJoker;
  43092. }
  43093. public function setEndJoker($endJoker)
  43094. {
  43095. $this->endJoker = (bool) $endJoker;
  43096. return $this;
  43097. }
  43098. public function hasEndJoker()
  43099. {
  43100. return $this->endJoker;
  43101. }
  43102. public function replaceJokers($replacement)
  43103. {
  43104. $replace = function ($subject) use ($replacement) {
  43105. $subject = $subject[0];
  43106. $replace = 0 === substr_count($subject, '\\') % 2;
  43107. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  43108. };
  43109. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  43110. return $this;
  43111. }
  43112. private function parsePattern($pattern)
  43113. {
  43114. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  43115. $pattern = substr($pattern, 1);
  43116. }
  43117. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  43118. $pattern = substr($pattern, 2);
  43119. }
  43120. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  43121. $pattern = substr($pattern, 0, -1);
  43122. }
  43123. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  43124. $pattern = substr($pattern, 0, -2);
  43125. }
  43126. $this->pattern = $pattern;
  43127. }
  43128. }
  43129. <?php
  43130. namespace Symfony\Component\Finder\Expression;
  43131. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43132. interface ValueInterface
  43133. {
  43134. public function render();
  43135. public function renderPattern();
  43136. public function isCaseSensitive();
  43137. public function getType();
  43138. public function prepend($expr);
  43139. public function append($expr);
  43140. }
  43141. <?php
  43142. namespace Symfony\Component\Finder;
  43143. use Symfony\Component\Finder\Adapter\AdapterInterface;
  43144. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  43145. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  43146. use Symfony\Component\Finder\Adapter\PhpAdapter;
  43147. use Symfony\Component\Finder\Comparator\DateComparator;
  43148. use Symfony\Component\Finder\Comparator\NumberComparator;
  43149. use Symfony\Component\Finder\Exception\ExceptionInterface;
  43150. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  43151. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  43152. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  43153. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  43154. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  43155. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  43156. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  43157. use Symfony\Component\Finder\Iterator\SortableIterator;
  43158. class Finder implements \IteratorAggregate, \Countable
  43159. {
  43160. const IGNORE_VCS_FILES = 1;
  43161. const IGNORE_DOT_FILES = 2;
  43162. private $mode = 0;
  43163. private $names = array();
  43164. private $notNames = array();
  43165. private $exclude = array();
  43166. private $filters = array();
  43167. private $depths = array();
  43168. private $sizes = array();
  43169. private $followLinks = false;
  43170. private $sort = false;
  43171. private $ignore = 0;
  43172. private $dirs = array();
  43173. private $dates = array();
  43174. private $iterators = array();
  43175. private $contains = array();
  43176. private $notContains = array();
  43177. private $adapters = null;
  43178. private $paths = array();
  43179. private $notPaths = array();
  43180. private $ignoreUnreadableDirs = false;
  43181. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  43182. public function __construct()
  43183. {
  43184. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  43185. }
  43186. public static function create()
  43187. {
  43188. return new static();
  43189. }
  43190. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  43191. {
  43192. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43193. $this->initDefaultAdapters();
  43194. $this->adapters[$adapter->getName()] = array(
  43195. 'adapter' => $adapter,
  43196. 'priority' => $priority,
  43197. 'selected' => false,
  43198. );
  43199. return $this->sortAdapters();
  43200. }
  43201. public function useBestAdapter()
  43202. {
  43203. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43204. $this->initDefaultAdapters();
  43205. $this->resetAdapterSelection();
  43206. return $this->sortAdapters();
  43207. }
  43208. public function setAdapter($name)
  43209. {
  43210. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43211. $this->initDefaultAdapters();
  43212. if (!isset($this->adapters[$name])) {
  43213. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  43214. }
  43215. $this->resetAdapterSelection();
  43216. $this->adapters[$name]['selected'] = true;
  43217. return $this->sortAdapters();
  43218. }
  43219. public function removeAdapters()
  43220. {
  43221. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43222. $this->adapters = array();
  43223. return $this;
  43224. }
  43225. public function getAdapters()
  43226. {
  43227. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43228. $this->initDefaultAdapters();
  43229. return array_values(array_map(function (array $adapter) {
  43230. return $adapter['adapter'];
  43231. }, $this->adapters));
  43232. }
  43233. public function directories()
  43234. {
  43235. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  43236. return $this;
  43237. }
  43238. public function files()
  43239. {
  43240. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  43241. return $this;
  43242. }
  43243. public function depth($level)
  43244. {
  43245. $this->depths[] = new Comparator\NumberComparator($level);
  43246. return $this;
  43247. }
  43248. public function date($date)
  43249. {
  43250. $this->dates[] = new Comparator\DateComparator($date);
  43251. return $this;
  43252. }
  43253. public function name($pattern)
  43254. {
  43255. $this->names[] = $pattern;
  43256. return $this;
  43257. }
  43258. public function notName($pattern)
  43259. {
  43260. $this->notNames[] = $pattern;
  43261. return $this;
  43262. }
  43263. public function contains($pattern)
  43264. {
  43265. $this->contains[] = $pattern;
  43266. return $this;
  43267. }
  43268. public function notContains($pattern)
  43269. {
  43270. $this->notContains[] = $pattern;
  43271. return $this;
  43272. }
  43273. public function path($pattern)
  43274. {
  43275. $this->paths[] = $pattern;
  43276. return $this;
  43277. }
  43278. public function notPath($pattern)
  43279. {
  43280. $this->notPaths[] = $pattern;
  43281. return $this;
  43282. }
  43283. public function size($size)
  43284. {
  43285. $this->sizes[] = new Comparator\NumberComparator($size);
  43286. return $this;
  43287. }
  43288. public function exclude($dirs)
  43289. {
  43290. $this->exclude = array_merge($this->exclude, (array) $dirs);
  43291. return $this;
  43292. }
  43293. public function ignoreDotFiles($ignoreDotFiles)
  43294. {
  43295. if ($ignoreDotFiles) {
  43296. $this->ignore |= static::IGNORE_DOT_FILES;
  43297. } else {
  43298. $this->ignore &= ~static::IGNORE_DOT_FILES;
  43299. }
  43300. return $this;
  43301. }
  43302. public function ignoreVCS($ignoreVCS)
  43303. {
  43304. if ($ignoreVCS) {
  43305. $this->ignore |= static::IGNORE_VCS_FILES;
  43306. } else {
  43307. $this->ignore &= ~static::IGNORE_VCS_FILES;
  43308. }
  43309. return $this;
  43310. }
  43311. public static function addVCSPattern($pattern)
  43312. {
  43313. foreach ((array) $pattern as $p) {
  43314. self::$vcsPatterns[] = $p;
  43315. }
  43316. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  43317. }
  43318. public function sort(\Closure $closure)
  43319. {
  43320. $this->sort = $closure;
  43321. return $this;
  43322. }
  43323. public function sortByName()
  43324. {
  43325. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  43326. return $this;
  43327. }
  43328. public function sortByType()
  43329. {
  43330. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  43331. return $this;
  43332. }
  43333. public function sortByAccessedTime()
  43334. {
  43335. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  43336. return $this;
  43337. }
  43338. public function sortByChangedTime()
  43339. {
  43340. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  43341. return $this;
  43342. }
  43343. public function sortByModifiedTime()
  43344. {
  43345. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  43346. return $this;
  43347. }
  43348. public function filter(\Closure $closure)
  43349. {
  43350. $this->filters[] = $closure;
  43351. return $this;
  43352. }
  43353. public function followLinks()
  43354. {
  43355. $this->followLinks = true;
  43356. return $this;
  43357. }
  43358. public function ignoreUnreadableDirs($ignore = true)
  43359. {
  43360. $this->ignoreUnreadableDirs = (bool) $ignore;
  43361. return $this;
  43362. }
  43363. public function in($dirs)
  43364. {
  43365. $resolvedDirs = array();
  43366. foreach ((array) $dirs as $dir) {
  43367. if (is_dir($dir)) {
  43368. $resolvedDirs[] = $this->normalizeDir($dir);
  43369. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  43370. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  43371. } else {
  43372. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  43373. }
  43374. }
  43375. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  43376. return $this;
  43377. }
  43378. public function getIterator()
  43379. {
  43380. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43381. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  43382. }
  43383. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43384. return $this->searchInDirectory($this->dirs[0]);
  43385. }
  43386. $iterator = new \AppendIterator();
  43387. foreach ($this->dirs as $dir) {
  43388. $iterator->append($this->searchInDirectory($dir));
  43389. }
  43390. foreach ($this->iterators as $it) {
  43391. $iterator->append($it);
  43392. }
  43393. return $iterator;
  43394. }
  43395. public function append($iterator)
  43396. {
  43397. if ($iterator instanceof \IteratorAggregate) {
  43398. $this->iterators[] = $iterator->getIterator();
  43399. } elseif ($iterator instanceof \Iterator) {
  43400. $this->iterators[] = $iterator;
  43401. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  43402. $it = new \ArrayIterator();
  43403. foreach ($iterator as $file) {
  43404. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  43405. }
  43406. $this->iterators[] = $it;
  43407. } else {
  43408. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  43409. }
  43410. return $this;
  43411. }
  43412. public function count()
  43413. {
  43414. return iterator_count($this->getIterator());
  43415. }
  43416. private function sortAdapters()
  43417. {
  43418. uasort($this->adapters, function (array $a, array $b) {
  43419. if ($a['selected'] || $b['selected']) {
  43420. return $a['selected'] ? -1 : 1;
  43421. }
  43422. return $a['priority'] > $b['priority'] ? -1 : 1;
  43423. });
  43424. return $this;
  43425. }
  43426. private function searchInDirectory($dir)
  43427. {
  43428. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  43429. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  43430. }
  43431. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  43432. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  43433. }
  43434. if ($this->adapters) {
  43435. foreach ($this->adapters as $adapter) {
  43436. if ($adapter['adapter']->isSupported()) {
  43437. try {
  43438. return $this
  43439. ->buildAdapter($adapter['adapter'])
  43440. ->searchInDirectory($dir);
  43441. } catch (ExceptionInterface $e) {
  43442. }
  43443. }
  43444. }
  43445. }
  43446. $minDepth = 0;
  43447. $maxDepth = PHP_INT_MAX;
  43448. foreach ($this->depths as $comparator) {
  43449. switch ($comparator->getOperator()) {
  43450. case '>':
  43451. $minDepth = $comparator->getTarget() + 1;
  43452. break;
  43453. case '>=':
  43454. $minDepth = $comparator->getTarget();
  43455. break;
  43456. case '<':
  43457. $maxDepth = $comparator->getTarget() - 1;
  43458. break;
  43459. case '<=':
  43460. $maxDepth = $comparator->getTarget();
  43461. break;
  43462. default:
  43463. $minDepth = $maxDepth = $comparator->getTarget();
  43464. }
  43465. }
  43466. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  43467. if ($this->followLinks) {
  43468. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  43469. }
  43470. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  43471. if ($this->exclude) {
  43472. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  43473. }
  43474. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  43475. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  43476. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  43477. }
  43478. if ($this->mode) {
  43479. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  43480. }
  43481. if ($this->names || $this->notNames) {
  43482. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  43483. }
  43484. if ($this->contains || $this->notContains) {
  43485. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  43486. }
  43487. if ($this->sizes) {
  43488. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  43489. }
  43490. if ($this->dates) {
  43491. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  43492. }
  43493. if ($this->filters) {
  43494. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  43495. }
  43496. if ($this->paths || $this->notPaths) {
  43497. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  43498. }
  43499. if ($this->sort) {
  43500. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  43501. $iterator = $iteratorAggregate->getIterator();
  43502. }
  43503. return $iterator;
  43504. }
  43505. private function buildAdapter(AdapterInterface $adapter)
  43506. {
  43507. return $adapter
  43508. ->setFollowLinks($this->followLinks)
  43509. ->setDepths($this->depths)
  43510. ->setMode($this->mode)
  43511. ->setExclude($this->exclude)
  43512. ->setNames($this->names)
  43513. ->setNotNames($this->notNames)
  43514. ->setContains($this->contains)
  43515. ->setNotContains($this->notContains)
  43516. ->setSizes($this->sizes)
  43517. ->setDates($this->dates)
  43518. ->setFilters($this->filters)
  43519. ->setSort($this->sort)
  43520. ->setPath($this->paths)
  43521. ->setNotPath($this->notPaths)
  43522. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  43523. }
  43524. private function resetAdapterSelection()
  43525. {
  43526. $this->adapters = array_map(function (array $properties) {
  43527. $properties['selected'] = false;
  43528. return $properties;
  43529. }, $this->adapters);
  43530. }
  43531. private function initDefaultAdapters()
  43532. {
  43533. if (null === $this->adapters) {
  43534. $this->adapters = array();
  43535. $this
  43536. ->addAdapter(new GnuFindAdapter())
  43537. ->addAdapter(new BsdFindAdapter())
  43538. ->addAdapter(new PhpAdapter(), -50)
  43539. ->setAdapter('php')
  43540. ;
  43541. }
  43542. }
  43543. private function normalizeDir($dir)
  43544. {
  43545. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  43546. }
  43547. }
  43548. <?php
  43549. namespace Symfony\Component\Finder;
  43550. class Glob
  43551. {
  43552. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  43553. {
  43554. $firstByte = true;
  43555. $escaping = false;
  43556. $inCurlies = 0;
  43557. $regex = '';
  43558. $sizeGlob = \strlen($glob);
  43559. for ($i = 0; $i < $sizeGlob; ++$i) {
  43560. $car = $glob[$i];
  43561. if ($firstByte) {
  43562. if ($strictLeadingDot && '.' !== $car) {
  43563. $regex .= '(?=[^\.])';
  43564. }
  43565. $firstByte = false;
  43566. }
  43567. if ('/' === $car) {
  43568. $firstByte = true;
  43569. }
  43570. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  43571. $regex .= "\\$car";
  43572. } elseif ('*' === $car) {
  43573. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  43574. } elseif ('?' === $car) {
  43575. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  43576. } elseif ('{' === $car) {
  43577. $regex .= $escaping ? '\\{' : '(';
  43578. if (!$escaping) {
  43579. ++$inCurlies;
  43580. }
  43581. } elseif ('}' === $car && $inCurlies) {
  43582. $regex .= $escaping ? '}' : ')';
  43583. if (!$escaping) {
  43584. --$inCurlies;
  43585. }
  43586. } elseif (',' === $car && $inCurlies) {
  43587. $regex .= $escaping ? ',' : '|';
  43588. } elseif ('\\' === $car) {
  43589. if ($escaping) {
  43590. $regex .= '\\\\';
  43591. $escaping = false;
  43592. } else {
  43593. $escaping = true;
  43594. }
  43595. continue;
  43596. } else {
  43597. $regex .= $car;
  43598. }
  43599. $escaping = false;
  43600. }
  43601. return $delimiter.'^'.$regex.'$'.$delimiter;
  43602. }
  43603. }
  43604. <?php
  43605. namespace Symfony\Component\Finder\Iterator;
  43606. class CustomFilterIterator extends FilterIterator
  43607. {
  43608. private $filters = array();
  43609. public function __construct(\Iterator $iterator, array $filters)
  43610. {
  43611. foreach ($filters as $filter) {
  43612. if (!\is_callable($filter)) {
  43613. throw new \InvalidArgumentException('Invalid PHP callback.');
  43614. }
  43615. }
  43616. $this->filters = $filters;
  43617. parent::__construct($iterator);
  43618. }
  43619. public function accept()
  43620. {
  43621. $fileinfo = $this->current();
  43622. foreach ($this->filters as $filter) {
  43623. if (false === \call_user_func($filter, $fileinfo)) {
  43624. return false;
  43625. }
  43626. }
  43627. return true;
  43628. }
  43629. }
  43630. <?php
  43631. namespace Symfony\Component\Finder\Iterator;
  43632. use Symfony\Component\Finder\Comparator\DateComparator;
  43633. class DateRangeFilterIterator extends FilterIterator
  43634. {
  43635. private $comparators = array();
  43636. public function __construct(\Iterator $iterator, array $comparators)
  43637. {
  43638. $this->comparators = $comparators;
  43639. parent::__construct($iterator);
  43640. }
  43641. public function accept()
  43642. {
  43643. $fileinfo = $this->current();
  43644. if (!file_exists($fileinfo->getPathname())) {
  43645. return false;
  43646. }
  43647. $filedate = $fileinfo->getMTime();
  43648. foreach ($this->comparators as $compare) {
  43649. if (!$compare->test($filedate)) {
  43650. return false;
  43651. }
  43652. }
  43653. return true;
  43654. }
  43655. }
  43656. <?php
  43657. namespace Symfony\Component\Finder\Iterator;
  43658. class DepthRangeFilterIterator extends FilterIterator
  43659. {
  43660. private $minDepth = 0;
  43661. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  43662. {
  43663. $this->minDepth = $minDepth;
  43664. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  43665. parent::__construct($iterator);
  43666. }
  43667. public function accept()
  43668. {
  43669. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  43670. }
  43671. }
  43672. <?php
  43673. namespace Symfony\Component\Finder\Iterator;
  43674. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  43675. {
  43676. private $iterator;
  43677. private $isRecursive;
  43678. private $excludedDirs = array();
  43679. private $excludedPattern;
  43680. public function __construct(\Iterator $iterator, array $directories)
  43681. {
  43682. $this->iterator = $iterator;
  43683. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  43684. $patterns = array();
  43685. foreach ($directories as $directory) {
  43686. $directory = rtrim($directory, '/');
  43687. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  43688. $patterns[] = preg_quote($directory, '#');
  43689. } else {
  43690. $this->excludedDirs[$directory] = true;
  43691. }
  43692. }
  43693. if ($patterns) {
  43694. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  43695. }
  43696. parent::__construct($iterator);
  43697. }
  43698. public function accept()
  43699. {
  43700. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  43701. return false;
  43702. }
  43703. if ($this->excludedPattern) {
  43704. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  43705. $path = str_replace('\\', '/', $path);
  43706. return !preg_match($this->excludedPattern, $path);
  43707. }
  43708. return true;
  43709. }
  43710. public function hasChildren()
  43711. {
  43712. return $this->isRecursive && $this->iterator->hasChildren();
  43713. }
  43714. public function getChildren()
  43715. {
  43716. $children = new self($this->iterator->getChildren(), array());
  43717. $children->excludedDirs = $this->excludedDirs;
  43718. $children->excludedPattern = $this->excludedPattern;
  43719. return $children;
  43720. }
  43721. }
  43722. <?php
  43723. namespace Symfony\Component\Finder\Iterator;
  43724. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43725. use Symfony\Component\Finder\SplFileInfo;
  43726. class FilePathsIterator extends \ArrayIterator
  43727. {
  43728. private $baseDir;
  43729. private $baseDirLength;
  43730. private $subPath;
  43731. private $subPathname;
  43732. private $current;
  43733. public function __construct(array $paths, $baseDir)
  43734. {
  43735. $this->baseDir = $baseDir;
  43736. $this->baseDirLength = \strlen($baseDir);
  43737. parent::__construct($paths);
  43738. }
  43739. public function __call($name, array $arguments)
  43740. {
  43741. return \call_user_func_array(array($this->current(), $name), $arguments);
  43742. }
  43743. public function current()
  43744. {
  43745. return $this->current;
  43746. }
  43747. public function key()
  43748. {
  43749. return $this->current->getPathname();
  43750. }
  43751. public function next()
  43752. {
  43753. parent::next();
  43754. $this->buildProperties();
  43755. }
  43756. public function rewind()
  43757. {
  43758. parent::rewind();
  43759. $this->buildProperties();
  43760. }
  43761. public function getSubPath()
  43762. {
  43763. return $this->subPath;
  43764. }
  43765. public function getSubPathname()
  43766. {
  43767. return $this->subPathname;
  43768. }
  43769. private function buildProperties()
  43770. {
  43771. $absolutePath = parent::current();
  43772. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  43773. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  43774. $dir = \dirname($this->subPathname);
  43775. $this->subPath = '.' === $dir ? '' : $dir;
  43776. } else {
  43777. $this->subPath = $this->subPathname = '';
  43778. }
  43779. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  43780. }
  43781. }
  43782. <?php
  43783. namespace Symfony\Component\Finder\Iterator;
  43784. class FileTypeFilterIterator extends FilterIterator
  43785. {
  43786. const ONLY_FILES = 1;
  43787. const ONLY_DIRECTORIES = 2;
  43788. private $mode;
  43789. public function __construct(\Iterator $iterator, $mode)
  43790. {
  43791. $this->mode = $mode;
  43792. parent::__construct($iterator);
  43793. }
  43794. public function accept()
  43795. {
  43796. $fileinfo = $this->current();
  43797. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  43798. return false;
  43799. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  43800. return false;
  43801. }
  43802. return true;
  43803. }
  43804. }
  43805. <?php
  43806. namespace Symfony\Component\Finder\Iterator;
  43807. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  43808. {
  43809. public function accept()
  43810. {
  43811. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  43812. return true;
  43813. }
  43814. $fileinfo = $this->current();
  43815. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  43816. return false;
  43817. }
  43818. $content = $fileinfo->getContents();
  43819. if (!$content) {
  43820. return false;
  43821. }
  43822. return $this->isAccepted($content);
  43823. }
  43824. protected function toRegex($str)
  43825. {
  43826. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43827. }
  43828. }
  43829. <?php
  43830. namespace Symfony\Component\Finder\Iterator;
  43831. use Symfony\Component\Finder\Glob;
  43832. class FilenameFilterIterator extends MultiplePcreFilterIterator
  43833. {
  43834. public function accept()
  43835. {
  43836. return $this->isAccepted($this->current()->getFilename());
  43837. }
  43838. protected function toRegex($str)
  43839. {
  43840. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  43841. }
  43842. }
  43843. <?php
  43844. namespace Symfony\Component\Finder\Iterator;
  43845. abstract class FilterIterator extends \FilterIterator
  43846. {
  43847. public function rewind()
  43848. {
  43849. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  43850. parent::rewind();
  43851. return;
  43852. }
  43853. $iterator = $this;
  43854. while ($iterator instanceof \OuterIterator) {
  43855. $innerIterator = $iterator->getInnerIterator();
  43856. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  43857. if ($innerIterator->isRewindable()) {
  43858. $innerIterator->next();
  43859. $innerIterator->rewind();
  43860. }
  43861. } elseif ($innerIterator instanceof \FilesystemIterator) {
  43862. $innerIterator->next();
  43863. $innerIterator->rewind();
  43864. }
  43865. $iterator = $innerIterator;
  43866. }
  43867. parent::rewind();
  43868. }
  43869. }
  43870. <?php
  43871. namespace Symfony\Component\Finder\Iterator;
  43872. abstract class MultiplePcreFilterIterator extends FilterIterator
  43873. {
  43874. protected $matchRegexps = array();
  43875. protected $noMatchRegexps = array();
  43876. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  43877. {
  43878. foreach ($matchPatterns as $pattern) {
  43879. $this->matchRegexps[] = $this->toRegex($pattern);
  43880. }
  43881. foreach ($noMatchPatterns as $pattern) {
  43882. $this->noMatchRegexps[] = $this->toRegex($pattern);
  43883. }
  43884. parent::__construct($iterator);
  43885. }
  43886. protected function isAccepted($string)
  43887. {
  43888. foreach ($this->noMatchRegexps as $regex) {
  43889. if (preg_match($regex, $string)) {
  43890. return false;
  43891. }
  43892. }
  43893. if ($this->matchRegexps) {
  43894. foreach ($this->matchRegexps as $regex) {
  43895. if (preg_match($regex, $string)) {
  43896. return true;
  43897. }
  43898. }
  43899. return false;
  43900. }
  43901. return true;
  43902. }
  43903. protected function isRegex($str)
  43904. {
  43905. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  43906. $start = substr($m[1], 0, 1);
  43907. $end = substr($m[1], -1);
  43908. if ($start === $end) {
  43909. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  43910. }
  43911. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  43912. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  43913. return true;
  43914. }
  43915. }
  43916. }
  43917. return false;
  43918. }
  43919. abstract protected function toRegex($str);
  43920. }
  43921. <?php
  43922. namespace Symfony\Component\Finder\Iterator;
  43923. class PathFilterIterator extends MultiplePcreFilterIterator
  43924. {
  43925. public function accept()
  43926. {
  43927. $filename = $this->current()->getRelativePathname();
  43928. if ('\\' === \DIRECTORY_SEPARATOR) {
  43929. $filename = str_replace('\\', '/', $filename);
  43930. }
  43931. return $this->isAccepted($filename);
  43932. }
  43933. protected function toRegex($str)
  43934. {
  43935. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43936. }
  43937. }
  43938. <?php
  43939. namespace Symfony\Component\Finder\Iterator;
  43940. use Symfony\Component\Finder\Exception\AccessDeniedException;
  43941. use Symfony\Component\Finder\SplFileInfo;
  43942. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  43943. {
  43944. private $ignoreUnreadableDirs;
  43945. private $rewindable;
  43946. private $rootPath;
  43947. private $subPath;
  43948. private $directorySeparator = '/';
  43949. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  43950. {
  43951. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  43952. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  43953. }
  43954. parent::__construct($path, $flags);
  43955. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  43956. $this->rootPath = (string) $path;
  43957. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  43958. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  43959. }
  43960. }
  43961. public function current()
  43962. {
  43963. if (null === $subPathname = $this->subPath) {
  43964. $subPathname = $this->subPath = (string) $this->getSubPath();
  43965. }
  43966. if ('' !== $subPathname) {
  43967. $subPathname .= $this->directorySeparator;
  43968. }
  43969. $subPathname .= $this->getFilename();
  43970. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  43971. }
  43972. public function getChildren()
  43973. {
  43974. try {
  43975. $children = parent::getChildren();
  43976. if ($children instanceof self) {
  43977. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  43978. $children->rewindable = &$this->rewindable;
  43979. $children->rootPath = $this->rootPath;
  43980. }
  43981. return $children;
  43982. } catch (\UnexpectedValueException $e) {
  43983. if ($this->ignoreUnreadableDirs) {
  43984. return new \RecursiveArrayIterator(array());
  43985. } else {
  43986. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  43987. }
  43988. }
  43989. }
  43990. public function rewind()
  43991. {
  43992. if (false === $this->isRewindable()) {
  43993. return;
  43994. }
  43995. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  43996. parent::next();
  43997. }
  43998. parent::rewind();
  43999. }
  44000. public function isRewindable()
  44001. {
  44002. if (null !== $this->rewindable) {
  44003. return $this->rewindable;
  44004. }
  44005. if ('' === $this->getPath()) {
  44006. return $this->rewindable = false;
  44007. }
  44008. if (false !== $stream = @opendir($this->getPath())) {
  44009. $infos = stream_get_meta_data($stream);
  44010. closedir($stream);
  44011. if ($infos['seekable']) {
  44012. return $this->rewindable = true;
  44013. }
  44014. }
  44015. return $this->rewindable = false;
  44016. }
  44017. }
  44018. <?php
  44019. namespace Symfony\Component\Finder\Iterator;
  44020. use Symfony\Component\Finder\Comparator\NumberComparator;
  44021. class SizeRangeFilterIterator extends FilterIterator
  44022. {
  44023. private $comparators = array();
  44024. public function __construct(\Iterator $iterator, array $comparators)
  44025. {
  44026. $this->comparators = $comparators;
  44027. parent::__construct($iterator);
  44028. }
  44029. public function accept()
  44030. {
  44031. $fileinfo = $this->current();
  44032. if (!$fileinfo->isFile()) {
  44033. return true;
  44034. }
  44035. $filesize = $fileinfo->getSize();
  44036. foreach ($this->comparators as $compare) {
  44037. if (!$compare->test($filesize)) {
  44038. return false;
  44039. }
  44040. }
  44041. return true;
  44042. }
  44043. }
  44044. <?php
  44045. namespace Symfony\Component\Finder\Iterator;
  44046. class SortableIterator implements \IteratorAggregate
  44047. {
  44048. const SORT_BY_NAME = 1;
  44049. const SORT_BY_TYPE = 2;
  44050. const SORT_BY_ACCESSED_TIME = 3;
  44051. const SORT_BY_CHANGED_TIME = 4;
  44052. const SORT_BY_MODIFIED_TIME = 5;
  44053. private $iterator;
  44054. private $sort;
  44055. public function __construct(\Traversable $iterator, $sort)
  44056. {
  44057. $this->iterator = $iterator;
  44058. if (self::SORT_BY_NAME === $sort) {
  44059. $this->sort = function ($a, $b) {
  44060. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  44061. };
  44062. } elseif (self::SORT_BY_TYPE === $sort) {
  44063. $this->sort = function ($a, $b) {
  44064. if ($a->isDir() && $b->isFile()) {
  44065. return -1;
  44066. } elseif ($a->isFile() && $b->isDir()) {
  44067. return 1;
  44068. }
  44069. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  44070. };
  44071. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  44072. $this->sort = function ($a, $b) {
  44073. return $a->getATime() - $b->getATime();
  44074. };
  44075. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  44076. $this->sort = function ($a, $b) {
  44077. return $a->getCTime() - $b->getCTime();
  44078. };
  44079. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  44080. $this->sort = function ($a, $b) {
  44081. return $a->getMTime() - $b->getMTime();
  44082. };
  44083. } elseif (\is_callable($sort)) {
  44084. $this->sort = $sort;
  44085. } else {
  44086. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  44087. }
  44088. }
  44089. public function getIterator()
  44090. {
  44091. $array = iterator_to_array($this->iterator, true);
  44092. uasort($array, $this->sort);
  44093. return new \ArrayIterator($array);
  44094. }
  44095. }
  44096. Copyright (c) 2004-2018 Fabien Potencier
  44097. Permission is hereby granted, free of charge, to any person obtaining a copy
  44098. of this software and associated documentation files (the "Software"), to deal
  44099. in the Software without restriction, including without limitation the rights
  44100. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44101. copies of the Software, and to permit persons to whom the Software is furnished
  44102. to do so, subject to the following conditions:
  44103. The above copyright notice and this permission notice shall be included in all
  44104. copies or substantial portions of the Software.
  44105. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44106. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44107. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44108. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44109. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44110. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44111. THE SOFTWARE.
  44112. <?php
  44113. namespace Symfony\Component\Finder\Shell;
  44114. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44115. class Command
  44116. {
  44117. private $parent;
  44118. private $bits = array();
  44119. private $labels = array();
  44120. private $errorHandler;
  44121. public function __construct(Command $parent = null)
  44122. {
  44123. $this->parent = $parent;
  44124. }
  44125. public function __toString()
  44126. {
  44127. return $this->join();
  44128. }
  44129. public static function create(Command $parent = null)
  44130. {
  44131. return new self($parent);
  44132. }
  44133. public static function escape($input)
  44134. {
  44135. return escapeshellcmd($input);
  44136. }
  44137. public static function quote($input)
  44138. {
  44139. return escapeshellarg($input);
  44140. }
  44141. public function add($bit)
  44142. {
  44143. $this->bits[] = $bit;
  44144. return $this;
  44145. }
  44146. public function top($bit)
  44147. {
  44148. array_unshift($this->bits, $bit);
  44149. foreach ($this->labels as $label => $index) {
  44150. ++$this->labels[$label];
  44151. }
  44152. return $this;
  44153. }
  44154. public function arg($arg)
  44155. {
  44156. $this->bits[] = self::quote($arg);
  44157. return $this;
  44158. }
  44159. public function cmd($esc)
  44160. {
  44161. $this->bits[] = self::escape($esc);
  44162. return $this;
  44163. }
  44164. public function ins($label)
  44165. {
  44166. if (isset($this->labels[$label])) {
  44167. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  44168. }
  44169. $this->bits[] = self::create($this);
  44170. $this->labels[$label] = \count($this->bits) - 1;
  44171. return $this->bits[$this->labels[$label]];
  44172. }
  44173. public function get($label)
  44174. {
  44175. if (!isset($this->labels[$label])) {
  44176. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  44177. }
  44178. return $this->bits[$this->labels[$label]];
  44179. }
  44180. public function end()
  44181. {
  44182. if (null === $this->parent) {
  44183. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  44184. }
  44185. return $this->parent;
  44186. }
  44187. public function length()
  44188. {
  44189. return \count($this->bits);
  44190. }
  44191. public function setErrorHandler(\Closure $errorHandler)
  44192. {
  44193. $this->errorHandler = $errorHandler;
  44194. return $this;
  44195. }
  44196. public function getErrorHandler()
  44197. {
  44198. return $this->errorHandler;
  44199. }
  44200. public function execute()
  44201. {
  44202. if (null === $errorHandler = $this->errorHandler) {
  44203. exec($this->join(), $output);
  44204. } else {
  44205. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  44206. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  44207. if ($error = stream_get_contents($pipes[2])) {
  44208. $errorHandler($error);
  44209. }
  44210. proc_close($process);
  44211. }
  44212. return $output ?: array();
  44213. }
  44214. public function join()
  44215. {
  44216. return implode(' ', array_filter(
  44217. array_map(function ($bit) {
  44218. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  44219. }, $this->bits),
  44220. function ($bit) { return null !== $bit; }
  44221. ));
  44222. }
  44223. public function addAtIndex($bit, $index)
  44224. {
  44225. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  44226. return $this;
  44227. }
  44228. }
  44229. <?php
  44230. namespace Symfony\Component\Finder\Shell;
  44231. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44232. class Shell
  44233. {
  44234. const TYPE_UNIX = 1;
  44235. const TYPE_DARWIN = 2;
  44236. const TYPE_CYGWIN = 3;
  44237. const TYPE_WINDOWS = 4;
  44238. const TYPE_BSD = 5;
  44239. private $type;
  44240. public function getType()
  44241. {
  44242. if (null === $this->type) {
  44243. $this->type = $this->guessType();
  44244. }
  44245. return $this->type;
  44246. }
  44247. public function testCommand($command)
  44248. {
  44249. if (!\function_exists('exec')) {
  44250. return false;
  44251. }
  44252. $testCommand = 'which ';
  44253. if (self::TYPE_WINDOWS === $this->type) {
  44254. $testCommand = 'where ';
  44255. }
  44256. $command = escapeshellcmd($command);
  44257. exec($testCommand.$command, $output, $code);
  44258. return 0 === $code && \count($output) > 0;
  44259. }
  44260. private function guessType()
  44261. {
  44262. $os = strtolower(PHP_OS);
  44263. if (false !== strpos($os, 'cygwin')) {
  44264. return self::TYPE_CYGWIN;
  44265. }
  44266. if (false !== strpos($os, 'darwin')) {
  44267. return self::TYPE_DARWIN;
  44268. }
  44269. if (false !== strpos($os, 'bsd')) {
  44270. return self::TYPE_BSD;
  44271. }
  44272. if (0 === strpos($os, 'win')) {
  44273. return self::TYPE_WINDOWS;
  44274. }
  44275. return self::TYPE_UNIX;
  44276. }
  44277. }
  44278. <?php
  44279. namespace Symfony\Component\Finder;
  44280. class SplFileInfo extends \SplFileInfo
  44281. {
  44282. private $relativePath;
  44283. private $relativePathname;
  44284. public function __construct($file, $relativePath, $relativePathname)
  44285. {
  44286. parent::__construct($file);
  44287. $this->relativePath = $relativePath;
  44288. $this->relativePathname = $relativePathname;
  44289. }
  44290. public function getRelativePath()
  44291. {
  44292. return $this->relativePath;
  44293. }
  44294. public function getRelativePathname()
  44295. {
  44296. return $this->relativePathname;
  44297. }
  44298. public function getContents()
  44299. {
  44300. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  44301. $content = file_get_contents($this->getPathname());
  44302. restore_error_handler();
  44303. if (false === $content) {
  44304. throw new \RuntimeException($error);
  44305. }
  44306. return $content;
  44307. }
  44308. }
  44309. <?php
  44310. namespace Symfony\Polyfill\Ctype;
  44311. final class Ctype
  44312. {
  44313. public static function ctype_alnum($text)
  44314. {
  44315. $text = self::convert_int_to_char_for_ctype($text);
  44316. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  44317. }
  44318. public static function ctype_alpha($text)
  44319. {
  44320. $text = self::convert_int_to_char_for_ctype($text);
  44321. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  44322. }
  44323. public static function ctype_cntrl($text)
  44324. {
  44325. $text = self::convert_int_to_char_for_ctype($text);
  44326. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  44327. }
  44328. public static function ctype_digit($text)
  44329. {
  44330. $text = self::convert_int_to_char_for_ctype($text);
  44331. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  44332. }
  44333. public static function ctype_graph($text)
  44334. {
  44335. $text = self::convert_int_to_char_for_ctype($text);
  44336. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  44337. }
  44338. public static function ctype_lower($text)
  44339. {
  44340. $text = self::convert_int_to_char_for_ctype($text);
  44341. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  44342. }
  44343. public static function ctype_print($text)
  44344. {
  44345. $text = self::convert_int_to_char_for_ctype($text);
  44346. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  44347. }
  44348. public static function ctype_punct($text)
  44349. {
  44350. $text = self::convert_int_to_char_for_ctype($text);
  44351. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  44352. }
  44353. public static function ctype_space($text)
  44354. {
  44355. $text = self::convert_int_to_char_for_ctype($text);
  44356. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  44357. }
  44358. public static function ctype_upper($text)
  44359. {
  44360. $text = self::convert_int_to_char_for_ctype($text);
  44361. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  44362. }
  44363. public static function ctype_xdigit($text)
  44364. {
  44365. $text = self::convert_int_to_char_for_ctype($text);
  44366. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  44367. }
  44368. private static function convert_int_to_char_for_ctype($int)
  44369. {
  44370. if (!\is_int($int)) {
  44371. return $int;
  44372. }
  44373. if ($int < -128 || $int > 255) {
  44374. return (string) $int;
  44375. }
  44376. if ($int < 0) {
  44377. $int += 256;
  44378. }
  44379. return \chr($int);
  44380. }
  44381. }
  44382. Copyright (c) 2018-2019 Fabien Potencier
  44383. Permission is hereby granted, free of charge, to any person obtaining a copy
  44384. of this software and associated documentation files (the "Software"), to deal
  44385. in the Software without restriction, including without limitation the rights
  44386. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44387. copies of the Software, and to permit persons to whom the Software is furnished
  44388. to do so, subject to the following conditions:
  44389. The above copyright notice and this permission notice shall be included in all
  44390. copies or substantial portions of the Software.
  44391. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44392. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44393. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44394. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44395. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44396. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44397. THE SOFTWARE.
  44398. <?php
  44399. use Symfony\Polyfill\Ctype as p;
  44400. if (!function_exists('ctype_alnum')) {
  44401. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  44402. }
  44403. if (!function_exists('ctype_alpha')) {
  44404. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  44405. }
  44406. if (!function_exists('ctype_cntrl')) {
  44407. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  44408. }
  44409. if (!function_exists('ctype_digit')) {
  44410. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  44411. }
  44412. if (!function_exists('ctype_graph')) {
  44413. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  44414. }
  44415. if (!function_exists('ctype_lower')) {
  44416. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  44417. }
  44418. if (!function_exists('ctype_print')) {
  44419. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  44420. }
  44421. if (!function_exists('ctype_punct')) {
  44422. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  44423. }
  44424. if (!function_exists('ctype_space')) {
  44425. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  44426. }
  44427. if (!function_exists('ctype_upper')) {
  44428. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  44429. }
  44430. if (!function_exists('ctype_xdigit')) {
  44431. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  44432. }
  44433. Copyright (c) 2015-2019 Fabien Potencier
  44434. Permission is hereby granted, free of charge, to any person obtaining a copy
  44435. of this software and associated documentation files (the "Software"), to deal
  44436. in the Software without restriction, including without limitation the rights
  44437. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44438. copies of the Software, and to permit persons to whom the Software is furnished
  44439. to do so, subject to the following conditions:
  44440. The above copyright notice and this permission notice shall be included in all
  44441. copies or substantial portions of the Software.
  44442. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44443. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44444. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44445. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44446. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44447. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44448. THE SOFTWARE.
  44449. <?php
  44450. namespace Symfony\Polyfill\Mbstring;
  44451. final class Mbstring
  44452. {
  44453. const MB_CASE_FOLD = PHP_INT_MAX;
  44454. private static $encodingList = array('ASCII', 'UTF-8');
  44455. private static $language = 'neutral';
  44456. private static $internalEncoding = 'UTF-8';
  44457. private static $caseFold = array(
  44458. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  44459. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  44460. );
  44461. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  44462. {
  44463. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  44464. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  44465. } else {
  44466. $fromEncoding = self::getEncoding($fromEncoding);
  44467. }
  44468. $toEncoding = self::getEncoding($toEncoding);
  44469. if ('BASE64' === $fromEncoding) {
  44470. $s = base64_decode($s);
  44471. $fromEncoding = $toEncoding;
  44472. }
  44473. if ('BASE64' === $toEncoding) {
  44474. return base64_encode($s);
  44475. }
  44476. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  44477. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  44478. $fromEncoding = 'Windows-1252';
  44479. }
  44480. if ('UTF-8' !== $fromEncoding) {
  44481. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  44482. }
  44483. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  44484. }
  44485. if ('HTML-ENTITIES' === $fromEncoding) {
  44486. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  44487. $fromEncoding = 'UTF-8';
  44488. }
  44489. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  44490. }
  44491. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  44492. {
  44493. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  44494. $ok = true;
  44495. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  44496. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  44497. $ok = false;
  44498. }
  44499. });
  44500. return $ok ? $fromEncoding : false;
  44501. }
  44502. public static function mb_decode_mimeheader($s)
  44503. {
  44504. return iconv_mime_decode($s, 2, self::$internalEncoding);
  44505. }
  44506. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  44507. {
  44508. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  44509. }
  44510. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  44511. {
  44512. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44513. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44514. return null;
  44515. }
  44516. if (!\is_array($convmap) || !$convmap) {
  44517. return false;
  44518. }
  44519. if (null !== $encoding && !\is_scalar($encoding)) {
  44520. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44521. return '';
  44522. }
  44523. $s = (string) $s;
  44524. if ('' === $s) {
  44525. return '';
  44526. }
  44527. $encoding = self::getEncoding($encoding);
  44528. if ('UTF-8' === $encoding) {
  44529. $encoding = null;
  44530. if (!preg_match('//u', $s)) {
  44531. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44532. }
  44533. } else {
  44534. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44535. }
  44536. $cnt = floor(\count($convmap) / 4) * 4;
  44537. for ($i = 0; $i < $cnt; $i += 4) {
  44538. $convmap[$i] += $convmap[$i + 2];
  44539. $convmap[$i + 1] += $convmap[$i + 2];
  44540. }
  44541. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  44542. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  44543. for ($i = 0; $i < $cnt; $i += 4) {
  44544. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  44545. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  44546. }
  44547. }
  44548. return $m[0];
  44549. }, $s);
  44550. if (null === $encoding) {
  44551. return $s;
  44552. }
  44553. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44554. }
  44555. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  44556. {
  44557. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44558. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44559. return null;
  44560. }
  44561. if (!\is_array($convmap) || !$convmap) {
  44562. return false;
  44563. }
  44564. if (null !== $encoding && !\is_scalar($encoding)) {
  44565. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44566. return null;
  44567. }
  44568. if (null !== $is_hex && !\is_scalar($is_hex)) {
  44569. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  44570. return null;
  44571. }
  44572. $s = (string) $s;
  44573. if ('' === $s) {
  44574. return '';
  44575. }
  44576. $encoding = self::getEncoding($encoding);
  44577. if ('UTF-8' === $encoding) {
  44578. $encoding = null;
  44579. if (!preg_match('//u', $s)) {
  44580. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44581. }
  44582. } else {
  44583. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44584. }
  44585. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44586. $cnt = floor(\count($convmap) / 4) * 4;
  44587. $i = 0;
  44588. $len = \strlen($s);
  44589. $result = '';
  44590. while ($i < $len) {
  44591. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44592. $uchr = substr($s, $i, $ulen);
  44593. $i += $ulen;
  44594. $c = self::mb_ord($uchr);
  44595. for ($j = 0; $j < $cnt; $j += 4) {
  44596. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  44597. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  44598. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  44599. continue 2;
  44600. }
  44601. }
  44602. $result .= $uchr;
  44603. }
  44604. if (null === $encoding) {
  44605. return $result;
  44606. }
  44607. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  44608. }
  44609. public static function mb_convert_case($s, $mode, $encoding = null)
  44610. {
  44611. $s = (string) $s;
  44612. if ('' === $s) {
  44613. return '';
  44614. }
  44615. $encoding = self::getEncoding($encoding);
  44616. if ('UTF-8' === $encoding) {
  44617. $encoding = null;
  44618. if (!preg_match('//u', $s)) {
  44619. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44620. }
  44621. } else {
  44622. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44623. }
  44624. if (MB_CASE_TITLE == $mode) {
  44625. static $titleRegexp = null;
  44626. if (null === $titleRegexp) {
  44627. $titleRegexp = self::getData('titleCaseRegexp');
  44628. }
  44629. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  44630. } else {
  44631. if (MB_CASE_UPPER == $mode) {
  44632. static $upper = null;
  44633. if (null === $upper) {
  44634. $upper = self::getData('upperCase');
  44635. }
  44636. $map = $upper;
  44637. } else {
  44638. if (self::MB_CASE_FOLD === $mode) {
  44639. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  44640. }
  44641. static $lower = null;
  44642. if (null === $lower) {
  44643. $lower = self::getData('lowerCase');
  44644. }
  44645. $map = $lower;
  44646. }
  44647. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44648. $i = 0;
  44649. $len = \strlen($s);
  44650. while ($i < $len) {
  44651. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44652. $uchr = substr($s, $i, $ulen);
  44653. $i += $ulen;
  44654. if (isset($map[$uchr])) {
  44655. $uchr = $map[$uchr];
  44656. $nlen = \strlen($uchr);
  44657. if ($nlen == $ulen) {
  44658. $nlen = $i;
  44659. do {
  44660. $s[--$nlen] = $uchr[--$ulen];
  44661. } while ($ulen);
  44662. } else {
  44663. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  44664. $len += $nlen - $ulen;
  44665. $i += $nlen - $ulen;
  44666. }
  44667. }
  44668. }
  44669. }
  44670. if (null === $encoding) {
  44671. return $s;
  44672. }
  44673. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44674. }
  44675. public static function mb_internal_encoding($encoding = null)
  44676. {
  44677. if (null === $encoding) {
  44678. return self::$internalEncoding;
  44679. }
  44680. $encoding = self::getEncoding($encoding);
  44681. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  44682. self::$internalEncoding = $encoding;
  44683. return true;
  44684. }
  44685. return false;
  44686. }
  44687. public static function mb_language($lang = null)
  44688. {
  44689. if (null === $lang) {
  44690. return self::$language;
  44691. }
  44692. switch ($lang = strtolower($lang)) {
  44693. case 'uni':
  44694. case 'neutral':
  44695. self::$language = $lang;
  44696. return true;
  44697. }
  44698. return false;
  44699. }
  44700. public static function mb_list_encodings()
  44701. {
  44702. return array('UTF-8');
  44703. }
  44704. public static function mb_encoding_aliases($encoding)
  44705. {
  44706. switch (strtoupper($encoding)) {
  44707. case 'UTF8':
  44708. case 'UTF-8':
  44709. return array('utf8');
  44710. }
  44711. return false;
  44712. }
  44713. public static function mb_check_encoding($var = null, $encoding = null)
  44714. {
  44715. if (null === $encoding) {
  44716. if (null === $var) {
  44717. return false;
  44718. }
  44719. $encoding = self::$internalEncoding;
  44720. }
  44721. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  44722. }
  44723. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  44724. {
  44725. if (null === $encodingList) {
  44726. $encodingList = self::$encodingList;
  44727. } else {
  44728. if (!\is_array($encodingList)) {
  44729. $encodingList = array_map('trim', explode(',', $encodingList));
  44730. }
  44731. $encodingList = array_map('strtoupper', $encodingList);
  44732. }
  44733. foreach ($encodingList as $enc) {
  44734. switch ($enc) {
  44735. case 'ASCII':
  44736. if (!preg_match('/[\x80-\xFF]/', $str)) {
  44737. return $enc;
  44738. }
  44739. break;
  44740. case 'UTF8':
  44741. case 'UTF-8':
  44742. if (preg_match('//u', $str)) {
  44743. return 'UTF-8';
  44744. }
  44745. break;
  44746. default:
  44747. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  44748. return $enc;
  44749. }
  44750. }
  44751. }
  44752. return false;
  44753. }
  44754. public static function mb_detect_order($encodingList = null)
  44755. {
  44756. if (null === $encodingList) {
  44757. return self::$encodingList;
  44758. }
  44759. if (!\is_array($encodingList)) {
  44760. $encodingList = array_map('trim', explode(',', $encodingList));
  44761. }
  44762. $encodingList = array_map('strtoupper', $encodingList);
  44763. foreach ($encodingList as $enc) {
  44764. switch ($enc) {
  44765. default:
  44766. if (strncmp($enc, 'ISO-8859-', 9)) {
  44767. return false;
  44768. }
  44769. case 'ASCII':
  44770. case 'UTF8':
  44771. case 'UTF-8':
  44772. }
  44773. }
  44774. self::$encodingList = $encodingList;
  44775. return true;
  44776. }
  44777. public static function mb_strlen($s, $encoding = null)
  44778. {
  44779. $encoding = self::getEncoding($encoding);
  44780. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44781. return \strlen($s);
  44782. }
  44783. return @iconv_strlen($s, $encoding);
  44784. }
  44785. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  44786. {
  44787. $encoding = self::getEncoding($encoding);
  44788. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44789. return strpos($haystack, $needle, $offset);
  44790. }
  44791. $needle = (string) $needle;
  44792. if ('' === $needle) {
  44793. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  44794. return false;
  44795. }
  44796. return iconv_strpos($haystack, $needle, $offset, $encoding);
  44797. }
  44798. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  44799. {
  44800. $encoding = self::getEncoding($encoding);
  44801. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44802. return strrpos($haystack, $needle, $offset);
  44803. }
  44804. if ($offset != (int) $offset) {
  44805. $offset = 0;
  44806. } elseif ($offset = (int) $offset) {
  44807. if ($offset < 0) {
  44808. if (0 > $offset += self::mb_strlen($needle)) {
  44809. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  44810. }
  44811. $offset = 0;
  44812. } else {
  44813. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  44814. }
  44815. }
  44816. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44817. return false !== $pos ? $offset + $pos : false;
  44818. }
  44819. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  44820. {
  44821. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
  44822. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
  44823. return null;
  44824. }
  44825. if (1 > $split_length = (int) $split_length) {
  44826. trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
  44827. return false;
  44828. }
  44829. if (null === $encoding) {
  44830. $encoding = mb_internal_encoding();
  44831. }
  44832. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  44833. $rx = '/(';
  44834. while (65535 < $split_length) {
  44835. $rx .= '.{65535}';
  44836. $split_length -= 65535;
  44837. }
  44838. $rx .= '.{'.$split_length.'})/us';
  44839. return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
  44840. }
  44841. $result = array();
  44842. $length = mb_strlen($string, $encoding);
  44843. for ($i = 0; $i < $length; $i += $split_length) {
  44844. $result[] = mb_substr($string, $i, $split_length, $encoding);
  44845. }
  44846. return $result;
  44847. }
  44848. public static function mb_strtolower($s, $encoding = null)
  44849. {
  44850. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  44851. }
  44852. public static function mb_strtoupper($s, $encoding = null)
  44853. {
  44854. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  44855. }
  44856. public static function mb_substitute_character($c = null)
  44857. {
  44858. if (0 === strcasecmp($c, 'none')) {
  44859. return true;
  44860. }
  44861. return null !== $c ? false : 'none';
  44862. }
  44863. public static function mb_substr($s, $start, $length = null, $encoding = null)
  44864. {
  44865. $encoding = self::getEncoding($encoding);
  44866. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44867. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  44868. }
  44869. if ($start < 0) {
  44870. $start = iconv_strlen($s, $encoding) + $start;
  44871. if ($start < 0) {
  44872. $start = 0;
  44873. }
  44874. }
  44875. if (null === $length) {
  44876. $length = 2147483647;
  44877. } elseif ($length < 0) {
  44878. $length = iconv_strlen($s, $encoding) + $length - $start;
  44879. if ($length < 0) {
  44880. return '';
  44881. }
  44882. }
  44883. return (string) iconv_substr($s, $start, $length, $encoding);
  44884. }
  44885. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  44886. {
  44887. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44888. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44889. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  44890. }
  44891. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  44892. {
  44893. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  44894. return self::getSubpart($pos, $part, $haystack, $encoding);
  44895. }
  44896. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  44897. {
  44898. $encoding = self::getEncoding($encoding);
  44899. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44900. return strrchr($haystack, $needle, $part);
  44901. }
  44902. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44903. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44904. return self::getSubpart($pos, $part, $haystack, $encoding);
  44905. }
  44906. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  44907. {
  44908. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44909. $pos = self::mb_strripos($haystack, $needle, $encoding);
  44910. return self::getSubpart($pos, $part, $haystack, $encoding);
  44911. }
  44912. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  44913. {
  44914. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44915. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44916. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  44917. }
  44918. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  44919. {
  44920. $pos = strpos($haystack, $needle);
  44921. if (false === $pos) {
  44922. return false;
  44923. }
  44924. if ($part) {
  44925. return substr($haystack, 0, $pos);
  44926. }
  44927. return substr($haystack, $pos);
  44928. }
  44929. public static function mb_get_info($type = 'all')
  44930. {
  44931. $info = array(
  44932. 'internal_encoding' => self::$internalEncoding,
  44933. 'http_output' => 'pass',
  44934. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  44935. 'func_overload' => 0,
  44936. 'func_overload_list' => 'no overload',
  44937. 'mail_charset' => 'UTF-8',
  44938. 'mail_header_encoding' => 'BASE64',
  44939. 'mail_body_encoding' => 'BASE64',
  44940. 'illegal_chars' => 0,
  44941. 'encoding_translation' => 'Off',
  44942. 'language' => self::$language,
  44943. 'detect_order' => self::$encodingList,
  44944. 'substitute_character' => 'none',
  44945. 'strict_detection' => 'Off',
  44946. );
  44947. if ('all' === $type) {
  44948. return $info;
  44949. }
  44950. if (isset($info[$type])) {
  44951. return $info[$type];
  44952. }
  44953. return false;
  44954. }
  44955. public static function mb_http_input($type = '')
  44956. {
  44957. return false;
  44958. }
  44959. public static function mb_http_output($encoding = null)
  44960. {
  44961. return null !== $encoding ? 'pass' === $encoding : 'pass';
  44962. }
  44963. public static function mb_strwidth($s, $encoding = null)
  44964. {
  44965. $encoding = self::getEncoding($encoding);
  44966. if ('UTF-8' !== $encoding) {
  44967. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44968. }
  44969. $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);
  44970. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  44971. }
  44972. public static function mb_substr_count($haystack, $needle, $encoding = null)
  44973. {
  44974. return substr_count($haystack, $needle);
  44975. }
  44976. public static function mb_output_handler($contents, $status)
  44977. {
  44978. return $contents;
  44979. }
  44980. public static function mb_chr($code, $encoding = null)
  44981. {
  44982. if (0x80 > $code %= 0x200000) {
  44983. $s = \chr($code);
  44984. } elseif (0x800 > $code) {
  44985. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  44986. } elseif (0x10000 > $code) {
  44987. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  44988. } else {
  44989. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  44990. }
  44991. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  44992. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  44993. }
  44994. return $s;
  44995. }
  44996. public static function mb_ord($s, $encoding = null)
  44997. {
  44998. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  44999. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  45000. }
  45001. if (1 === \strlen($s)) {
  45002. return \ord($s);
  45003. }
  45004. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  45005. if (0xF0 <= $code) {
  45006. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  45007. }
  45008. if (0xE0 <= $code) {
  45009. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  45010. }
  45011. if (0xC0 <= $code) {
  45012. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  45013. }
  45014. return $code;
  45015. }
  45016. private static function getSubpart($pos, $part, $haystack, $encoding)
  45017. {
  45018. if (false === $pos) {
  45019. return false;
  45020. }
  45021. if ($part) {
  45022. return self::mb_substr($haystack, 0, $pos, $encoding);
  45023. }
  45024. return self::mb_substr($haystack, $pos, null, $encoding);
  45025. }
  45026. private static function html_encoding_callback(array $m)
  45027. {
  45028. $i = 1;
  45029. $entities = '';
  45030. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  45031. while (isset($m[$i])) {
  45032. if (0x80 > $m[$i]) {
  45033. $entities .= \chr($m[$i++]);
  45034. continue;
  45035. }
  45036. if (0xF0 <= $m[$i]) {
  45037. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  45038. } elseif (0xE0 <= $m[$i]) {
  45039. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  45040. } else {
  45041. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  45042. }
  45043. $entities .= '&#'.$c.';';
  45044. }
  45045. return $entities;
  45046. }
  45047. private static function title_case(array $s)
  45048. {
  45049. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  45050. }
  45051. private static function getData($file)
  45052. {
  45053. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  45054. return require $file;
  45055. }
  45056. return false;
  45057. }
  45058. private static function getEncoding($encoding)
  45059. {
  45060. if (null === $encoding) {
  45061. return self::$internalEncoding;
  45062. }
  45063. if ('UTF-8' === $encoding) {
  45064. return 'UTF-8';
  45065. }
  45066. $encoding = strtoupper($encoding);
  45067. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  45068. return 'CP850';
  45069. }
  45070. if ('UTF8' === $encoding) {
  45071. return 'UTF-8';
  45072. }
  45073. return $encoding;
  45074. }
  45075. }
  45076. <?php
  45077. return array (
  45078. 'A' => 'a',
  45079. 'B' => 'b',
  45080. 'C' => 'c',
  45081. 'D' => 'd',
  45082. 'E' => 'e',
  45083. 'F' => 'f',
  45084. 'G' => 'g',
  45085. 'H' => 'h',
  45086. 'I' => 'i',
  45087. 'J' => 'j',
  45088. 'K' => 'k',
  45089. 'L' => 'l',
  45090. 'M' => 'm',
  45091. 'N' => 'n',
  45092. 'O' => 'o',
  45093. 'P' => 'p',
  45094. 'Q' => 'q',
  45095. 'R' => 'r',
  45096. 'S' => 's',
  45097. 'T' => 't',
  45098. 'U' => 'u',
  45099. 'V' => 'v',
  45100. 'W' => 'w',
  45101. 'X' => 'x',
  45102. 'Y' => 'y',
  45103. 'Z' => 'z',
  45104. 'À' => 'à',
  45105. '�' => 'á',
  45106. 'Â' => 'â',
  45107. 'Ã' => 'ã',
  45108. 'Ä' => 'ä',
  45109. 'Ã…' => 'Ã¥',
  45110. 'Æ' => 'æ',
  45111. 'Ç' => 'ç',
  45112. 'È' => 'è',
  45113. 'É' => 'é',
  45114. 'Ê' => 'ê',
  45115. 'Ë' => 'ë',
  45116. 'Ì' => 'ì',
  45117. '�' => 'í',
  45118. 'Î' => 'î',
  45119. '�' => 'ï',
  45120. '�' => 'ð',
  45121. 'Ñ' => 'ñ',
  45122. 'Ò' => 'ò',
  45123. 'Ó' => 'ó',
  45124. 'Ô' => 'ô',
  45125. 'Õ' => 'õ',
  45126. 'Ö' => 'ö',
  45127. 'Ø' => 'ø',
  45128. 'Ù' => 'ù',
  45129. 'Ú' => 'ú',
  45130. 'Û' => 'û',
  45131. 'Ü' => 'ü',
  45132. '�' => 'ý',
  45133. 'Þ' => 'þ',
  45134. 'Ā' => '�',
  45135. 'Ă' => 'ă',
  45136. 'Ä„' => 'Ä…',
  45137. 'Ć' => 'ć',
  45138. 'Ĉ' => 'ĉ',
  45139. 'ÄŠ' => 'Ä‹',
  45140. 'Č' => '�',
  45141. 'Ď' => '�',
  45142. '�' => 'đ',
  45143. 'Ä’' => 'Ä“',
  45144. 'Ä”' => 'Ä•',
  45145. 'Ä–' => 'Ä—',
  45146. 'Ę' => 'ę',
  45147. 'Äš' => 'Ä›',
  45148. 'Ĝ' => '�',
  45149. 'Äž' => 'ÄŸ',
  45150. 'Ä ' => 'Ä¡',
  45151. 'Ä¢' => 'Ä£',
  45152. 'Ĥ' => 'ĥ',
  45153. 'Ħ' => 'ħ',
  45154. 'Ĩ' => 'ĩ',
  45155. 'Ī' => 'ī',
  45156. 'Ĭ' => 'ĭ',
  45157. 'Į' => 'į',
  45158. 'Ä°' => 'i',
  45159. 'IJ' => 'ij',
  45160. 'Ĵ' => 'ĵ',
  45161. 'Ķ' => 'ķ',
  45162. 'Ĺ' => 'ĺ',
  45163. 'Ļ' => 'ļ',
  45164. 'Ľ' => 'ľ',
  45165. 'Ä¿' => 'Å€',
  45166. '�' => 'ł',
  45167. 'Ń' => 'ń',
  45168. 'Ņ' => 'ņ',
  45169. 'Ň' => 'ň',
  45170. 'ÅŠ' => 'Å‹',
  45171. 'Ō' => '�',
  45172. 'Ŏ' => '�',
  45173. '�' => 'ő',
  45174. 'Å’' => 'Å“',
  45175. 'Å”' => 'Å•',
  45176. 'Å–' => 'Å—',
  45177. 'Ř' => 'ř',
  45178. 'Åš' => 'Å›',
  45179. 'Ŝ' => '�',
  45180. 'Åž' => 'ÅŸ',
  45181. 'Å ' => 'Å¡',
  45182. 'Å¢' => 'Å£',
  45183. 'Ť' => 'ť',
  45184. 'Ŧ' => 'ŧ',
  45185. 'Ũ' => 'ũ',
  45186. 'Ū' => 'ū',
  45187. 'Ŭ' => 'ŭ',
  45188. 'Ů' => 'ů',
  45189. 'Ű' => 'ű',
  45190. 'Ų' => 'ų',
  45191. 'Ŵ' => 'ŵ',
  45192. 'Ŷ' => 'ŷ',
  45193. 'Ÿ' => 'ÿ',
  45194. 'Ź' => 'ź',
  45195. 'Ż' => 'ż',
  45196. 'Ž' => 'ž',
  45197. '�' => 'ɓ',
  45198. 'Ƃ' => 'ƃ',
  45199. 'Æ„' => 'Æ…',
  45200. 'Ɔ' => 'ɔ',
  45201. 'Ƈ' => 'ƈ',
  45202. 'Ɖ' => 'ɖ',
  45203. 'ÆŠ' => 'É—',
  45204. 'Ƌ' => 'ƌ',
  45205. 'Ǝ' => '�',
  45206. '�' => 'ə',
  45207. '�' => 'ɛ',
  45208. 'Æ‘' => 'Æ’',
  45209. 'Æ“' => 'É ',
  45210. 'Æ”' => 'É£',
  45211. 'Æ–' => 'É©',
  45212. 'Ɨ' => 'ɨ',
  45213. 'Ƙ' => 'ƙ',
  45214. 'Ɯ' => 'ɯ',
  45215. '�' => 'ɲ',
  45216. 'Ɵ' => 'ɵ',
  45217. 'Æ ' => 'Æ¡',
  45218. 'Æ¢' => 'Æ£',
  45219. 'Ƥ' => 'ƥ',
  45220. 'Ʀ' => 'ʀ',
  45221. 'Ƨ' => 'ƨ',
  45222. 'Ʃ' => 'ʃ',
  45223. 'Ƭ' => 'ƭ',
  45224. 'Ʈ' => 'ʈ',
  45225. 'Ư' => 'ư',
  45226. 'Ʊ' => 'ʊ',
  45227. 'Ʋ' => 'ʋ',
  45228. 'Ƴ' => 'ƴ',
  45229. 'Ƶ' => 'ƶ',
  45230. 'Æ·' => 'Ê’',
  45231. 'Ƹ' => 'ƹ',
  45232. 'Ƽ' => 'ƽ',
  45233. 'DŽ' => 'dž',
  45234. 'Dž' => 'dž',
  45235. 'LJ' => 'lj',
  45236. 'Lj' => 'lj',
  45237. 'NJ' => 'nj',
  45238. 'Nj' => 'nj',
  45239. '�' => 'ǎ',
  45240. '�' => '�',
  45241. 'Ç‘' => 'Ç’',
  45242. 'Ç“' => 'Ç”',
  45243. 'Ç•' => 'Ç–',
  45244. 'Ǘ' => 'ǘ',
  45245. 'Ç™' => 'Çš',
  45246. 'Ǜ' => 'ǜ',
  45247. 'Çž' => 'ÇŸ',
  45248. 'Ç ' => 'Ç¡',
  45249. 'Ç¢' => 'Ç£',
  45250. 'Ǥ' => 'ǥ',
  45251. 'Ǧ' => 'ǧ',
  45252. 'Ǩ' => 'ǩ',
  45253. 'Ǫ' => 'ǫ',
  45254. 'Ǭ' => 'ǭ',
  45255. 'Ǯ' => 'ǯ',
  45256. 'DZ' => 'dz',
  45257. 'Dz' => 'dz',
  45258. 'Ǵ' => 'ǵ',
  45259. 'Ƕ' => 'ƕ',
  45260. 'Ç·' => 'Æ¿',
  45261. 'Ǹ' => 'ǹ',
  45262. 'Ǻ' => 'ǻ',
  45263. 'Ǽ' => 'ǽ',
  45264. 'Ǿ' => 'ǿ',
  45265. 'Ȁ' => '�',
  45266. 'Ȃ' => 'ȃ',
  45267. 'È„' => 'È…',
  45268. 'Ȇ' => 'ȇ',
  45269. 'Ȉ' => 'ȉ',
  45270. 'ÈŠ' => 'È‹',
  45271. 'Ȍ' => '�',
  45272. 'Ȏ' => '�',
  45273. '�' => 'ȑ',
  45274. 'È’' => 'È“',
  45275. 'È”' => 'È•',
  45276. 'È–' => 'È—',
  45277. 'Ș' => 'ș',
  45278. 'Èš' => 'È›',
  45279. 'Ȝ' => '�',
  45280. 'Èž' => 'ÈŸ',
  45281. 'È ' => 'Æž',
  45282. 'È¢' => 'È£',
  45283. 'Ȥ' => 'ȥ',
  45284. 'Ȧ' => 'ȧ',
  45285. 'Ȩ' => 'ȩ',
  45286. 'Ȫ' => 'ȫ',
  45287. 'Ȭ' => 'ȭ',
  45288. 'Ȯ' => 'ȯ',
  45289. 'Ȱ' => 'ȱ',
  45290. 'Ȳ' => 'ȳ',
  45291. 'Ⱥ' => 'ⱥ',
  45292. 'Ȼ' => 'ȼ',
  45293. 'Ƚ' => 'ƚ',
  45294. 'Ⱦ' => 'ⱦ',
  45295. '�' => 'ɂ',
  45296. 'Ƀ' => 'ƀ',
  45297. 'Ʉ' => 'ʉ',
  45298. 'Ʌ' => 'ʌ',
  45299. 'Ɇ' => 'ɇ',
  45300. 'Ɉ' => 'ɉ',
  45301. 'ÉŠ' => 'É‹',
  45302. 'Ɍ' => '�',
  45303. 'Ɏ' => '�',
  45304. 'Ͱ' => 'ͱ',
  45305. 'Ͳ' => 'ͳ',
  45306. 'Ͷ' => 'ͷ',
  45307. 'Ϳ' => 'ϳ',
  45308. 'Ά' => 'ά',
  45309. 'Έ' => 'έ',
  45310. 'Ή' => 'ή',
  45311. 'Ί' => 'ί',
  45312. 'Ό' => 'ό',
  45313. 'Ύ' => '�',
  45314. '�' => 'ώ',
  45315. 'Α' => 'α',
  45316. 'Β' => 'β',
  45317. 'Γ' => 'γ',
  45318. 'Δ' => 'δ',
  45319. 'Ε' => 'ε',
  45320. 'Ζ' => 'ζ',
  45321. 'Η' => 'η',
  45322. 'Θ' => 'θ',
  45323. 'Ι' => 'ι',
  45324. 'Κ' => 'κ',
  45325. 'Λ' => 'λ',
  45326. 'Μ' => 'μ',
  45327. '�' => 'ν',
  45328. 'Ξ' => 'ξ',
  45329. 'Ο' => 'ο',
  45330. 'Π' => 'π',
  45331. 'Ρ' => '�',
  45332. 'Σ' => 'σ',
  45333. 'Τ' => 'τ',
  45334. 'Î¥' => 'Ï…',
  45335. 'Φ' => 'φ',
  45336. 'Χ' => 'χ',
  45337. 'Ψ' => 'ψ',
  45338. 'Ω' => 'ω',
  45339. 'Ϊ' => 'ϊ',
  45340. 'Ϋ' => 'ϋ',
  45341. '�' => 'ϗ',
  45342. 'Ϙ' => 'ϙ',
  45343. 'Ïš' => 'Ï›',
  45344. 'Ϝ' => '�',
  45345. 'Ïž' => 'ÏŸ',
  45346. 'Ï ' => 'Ï¡',
  45347. 'Ï¢' => 'Ï£',
  45348. 'Ϥ' => 'ϥ',
  45349. 'Ϧ' => 'ϧ',
  45350. 'Ϩ' => 'ϩ',
  45351. 'Ϫ' => 'ϫ',
  45352. 'Ϭ' => 'ϭ',
  45353. 'Ϯ' => 'ϯ',
  45354. 'ϴ' => 'θ',
  45355. 'Ϸ' => 'ϸ',
  45356. 'Ϲ' => 'ϲ',
  45357. 'Ϻ' => 'ϻ',
  45358. 'Ͻ' => 'ͻ',
  45359. 'Ͼ' => 'ͼ',
  45360. 'Ͽ' => 'ͽ',
  45361. 'Ѐ' => '�',
  45362. '�' => 'ё',
  45363. 'Ђ' => 'ђ',
  45364. 'Ѓ' => 'ѓ',
  45365. 'Є' => 'є',
  45366. 'Ð…' => 'Ñ•',
  45367. 'І' => 'і',
  45368. 'Ї' => 'ї',
  45369. 'Ј' => 'ј',
  45370. 'Љ' => 'љ',
  45371. 'Њ' => 'њ',
  45372. 'Ћ' => 'ћ',
  45373. 'Ќ' => 'ќ',
  45374. '�' => '�',
  45375. 'ÐŽ' => 'Ñž',
  45376. '�' => 'џ',
  45377. '�' => 'а',
  45378. 'Б' => 'б',
  45379. 'В' => 'в',
  45380. 'Г' => 'г',
  45381. 'Д' => 'д',
  45382. 'Е' => 'е',
  45383. 'Ж' => 'ж',
  45384. 'З' => 'з',
  45385. 'И' => 'и',
  45386. 'Й' => 'й',
  45387. 'К' => 'к',
  45388. 'Л' => 'л',
  45389. 'М' => 'м',
  45390. '�' => 'н',
  45391. 'О' => 'о',
  45392. 'П' => 'п',
  45393. 'Р' => 'р',
  45394. 'С' => '�',
  45395. 'Т' => 'т',
  45396. 'У' => 'у',
  45397. 'Ф' => 'ф',
  45398. 'Ð¥' => 'Ñ…',
  45399. 'Ц' => 'ц',
  45400. 'Ч' => 'ч',
  45401. 'Ш' => 'ш',
  45402. 'Щ' => 'щ',
  45403. 'Ъ' => 'ъ',
  45404. 'Ы' => 'ы',
  45405. 'Ь' => 'ь',
  45406. 'Э' => '�',
  45407. 'Ю' => 'ю',
  45408. 'Я' => '�',
  45409. 'Ñ ' => 'Ñ¡',
  45410. 'Ñ¢' => 'Ñ£',
  45411. 'Ѥ' => 'ѥ',
  45412. 'Ѧ' => 'ѧ',
  45413. 'Ѩ' => 'ѩ',
  45414. 'Ѫ' => 'ѫ',
  45415. 'Ѭ' => 'ѭ',
  45416. 'Ѯ' => 'ѯ',
  45417. 'Ѱ' => 'ѱ',
  45418. 'Ѳ' => 'ѳ',
  45419. 'Ѵ' => 'ѵ',
  45420. 'Ѷ' => 'ѷ',
  45421. 'Ѹ' => 'ѹ',
  45422. 'Ѻ' => 'ѻ',
  45423. 'Ѽ' => 'ѽ',
  45424. 'Ѿ' => 'ѿ',
  45425. 'Ò€' => 'Ò�',
  45426. 'ÒŠ' => 'Ò‹',
  45427. 'Ҍ' => '�',
  45428. 'ÒŽ' => 'Ò�',
  45429. 'Ò�' => 'Ò‘',
  45430. 'Ò’' => 'Ò“',
  45431. 'Ò”' => 'Ò•',
  45432. 'Ò–' => 'Ò—',
  45433. 'Ò˜' => 'Ò™',
  45434. 'Òš' => 'Ò›',
  45435. 'Ҝ' => '�',
  45436. 'Òž' => 'ÒŸ',
  45437. 'Ò ' => 'Ò¡',
  45438. 'Ò¢' => 'Ò£',
  45439. 'Ò¤' => 'Ò¥',
  45440. 'Ò¦' => 'Ò§',
  45441. 'Ò¨' => 'Ò©',
  45442. 'Òª' => 'Ò«',
  45443. 'Ò¬' => 'Ò­',
  45444. 'Ò®' => 'Ò¯',
  45445. 'Ò°' => 'Ò±',
  45446. 'Ò²' => 'Ò³',
  45447. 'Ò´' => 'Òµ',
  45448. 'Ò¶' => 'Ò·',
  45449. 'Ò¸' => 'Ò¹',
  45450. 'Òº' => 'Ò»',
  45451. 'Ò¼' => 'Ò½',
  45452. 'Ò¾' => 'Ò¿',
  45453. 'Ó€' => 'Ó�',
  45454. 'Ó�' => 'Ó‚',
  45455. 'Óƒ' => 'Ó„',
  45456. 'Ó…' => 'Ó†',
  45457. 'Ó‡' => 'Óˆ',
  45458. 'Ó‰' => 'ÓŠ',
  45459. 'Ӌ' => 'ӌ',
  45460. 'Ó�' => 'ÓŽ',
  45461. 'Ó�' => 'Ó‘',
  45462. 'Ó’' => 'Ó“',
  45463. 'Ó”' => 'Ó•',
  45464. 'Ó–' => 'Ó—',
  45465. 'Ó˜' => 'Ó™',
  45466. 'Óš' => 'Ó›',
  45467. 'Ӝ' => '�',
  45468. 'Óž' => 'ÓŸ',
  45469. 'Ó ' => 'Ó¡',
  45470. 'Ó¢' => 'Ó£',
  45471. 'Ó¤' => 'Ó¥',
  45472. 'Ó¦' => 'Ó§',
  45473. 'Ó¨' => 'Ó©',
  45474. 'Óª' => 'Ó«',
  45475. 'Ó¬' => 'Ó­',
  45476. 'Ó®' => 'Ó¯',
  45477. 'Ó°' => 'Ó±',
  45478. 'Ó²' => 'Ó³',
  45479. 'Ó´' => 'Óµ',
  45480. 'Ó¶' => 'Ó·',
  45481. 'Ó¸' => 'Ó¹',
  45482. 'Óº' => 'Ó»',
  45483. 'Ó¼' => 'Ó½',
  45484. 'Ó¾' => 'Ó¿',
  45485. 'Ô€' => 'Ô�',
  45486. 'Ô‚' => 'Ôƒ',
  45487. 'Ô„' => 'Ô…',
  45488. 'Ô†' => 'Ô‡',
  45489. 'Ôˆ' => 'Ô‰',
  45490. 'ÔŠ' => 'Ô‹',
  45491. 'Ԍ' => '�',
  45492. 'ÔŽ' => 'Ô�',
  45493. 'Ô�' => 'Ô‘',
  45494. 'Ô’' => 'Ô“',
  45495. 'Ô”' => 'Ô•',
  45496. 'Ô–' => 'Ô—',
  45497. 'Ô˜' => 'Ô™',
  45498. 'Ôš' => 'Ô›',
  45499. 'Ԝ' => '�',
  45500. 'Ôž' => 'ÔŸ',
  45501. 'Ô ' => 'Ô¡',
  45502. 'Ô¢' => 'Ô£',
  45503. 'Ô¤' => 'Ô¥',
  45504. 'Ô¦' => 'Ô§',
  45505. 'Ô¨' => 'Ô©',
  45506. 'Ôª' => 'Ô«',
  45507. 'Ô¬' => 'Ô­',
  45508. 'Ô®' => 'Ô¯',
  45509. 'Ô±' => 'Õ¡',
  45510. 'Ô²' => 'Õ¢',
  45511. 'Ô³' => 'Õ£',
  45512. 'Ô´' => 'Õ¤',
  45513. 'Ôµ' => 'Õ¥',
  45514. 'Ô¶' => 'Õ¦',
  45515. 'Ô·' => 'Õ§',
  45516. 'Ô¸' => 'Õ¨',
  45517. 'Ô¹' => 'Õ©',
  45518. 'Ôº' => 'Õª',
  45519. 'Ô»' => 'Õ«',
  45520. 'Ô¼' => 'Õ¬',
  45521. 'Ô½' => 'Õ­',
  45522. 'Ô¾' => 'Õ®',
  45523. 'Ô¿' => 'Õ¯',
  45524. 'Õ€' => 'Õ°',
  45525. 'Õ�' => 'Õ±',
  45526. 'Õ‚' => 'Õ²',
  45527. 'Õƒ' => 'Õ³',
  45528. 'Õ„' => 'Õ´',
  45529. 'Õ…' => 'Õµ',
  45530. 'Õ†' => 'Õ¶',
  45531. 'Õ‡' => 'Õ·',
  45532. 'Õˆ' => 'Õ¸',
  45533. 'Õ‰' => 'Õ¹',
  45534. 'ÕŠ' => 'Õº',
  45535. 'Õ‹' => 'Õ»',
  45536. 'Ռ' => 'ռ',
  45537. 'Õ�' => 'Õ½',
  45538. 'ÕŽ' => 'Õ¾',
  45539. 'Õ�' => 'Õ¿',
  45540. 'Õ�' => 'Ö€',
  45541. 'Õ‘' => 'Ö�',
  45542. 'Õ’' => 'Ö‚',
  45543. 'Õ“' => 'Öƒ',
  45544. 'Õ”' => 'Ö„',
  45545. 'Õ•' => 'Ö…',
  45546. 'Õ–' => 'Ö†',
  45547. 'á‚ ' => 'â´€',
  45548. 'á‚¡' => 'â´�',
  45549. 'á‚¢' => 'â´‚',
  45550. 'á‚£' => 'â´ƒ',
  45551. 'Ⴄ' => 'ⴄ',
  45552. 'á‚¥' => 'â´…',
  45553. 'Ⴆ' => 'ⴆ',
  45554. 'Ⴇ' => 'ⴇ',
  45555. 'Ⴈ' => 'ⴈ',
  45556. 'á‚©' => 'â´‰',
  45557. 'Ⴊ' => 'ⴊ',
  45558. 'á‚«' => 'â´‹',
  45559. 'Ⴌ' => 'ⴌ',
  45560. 'á‚­' => 'â´�',
  45561. 'á‚®' => 'â´Ž',
  45562. 'Ⴏ' => '�',
  45563. 'á‚°' => 'â´�',
  45564. 'Ⴑ' => 'ⴑ',
  45565. 'Ⴒ' => 'ⴒ',
  45566. 'Ⴓ' => 'ⴓ',
  45567. 'á‚´' => 'â´”',
  45568. 'Ⴕ' => 'ⴕ',
  45569. 'Ⴖ' => 'ⴖ',
  45570. 'á‚·' => 'â´—',
  45571. 'Ⴘ' => 'ⴘ',
  45572. 'Ⴙ' => 'ⴙ',
  45573. 'Ⴚ' => 'ⴚ',
  45574. 'á‚»' => 'â´›',
  45575. 'Ⴜ' => 'ⴜ',
  45576. 'Ⴝ' => '�',
  45577. 'Ⴞ' => 'ⴞ',
  45578. 'á‚¿' => 'â´Ÿ',
  45579. 'Ⴠ' => 'ⴠ',
  45580. '�' => 'ⴡ',
  45581. 'Ⴢ' => 'ⴢ',
  45582. 'Ⴣ' => 'ⴣ',
  45583. 'Ⴤ' => 'ⴤ',
  45584. 'Ⴥ' => 'ⴥ',
  45585. 'Ⴧ' => 'ⴧ',
  45586. '�' => 'ⴭ',
  45587. 'Ꭰ' => 'ꭰ',
  45588. 'Ꭱ' => 'ꭱ',
  45589. 'Ꭲ' => 'ꭲ',
  45590. 'Ꭳ' => 'ꭳ',
  45591. 'Ꭴ' => 'ꭴ',
  45592. 'Ꭵ' => 'ꭵ',
  45593. 'Ꭶ' => 'ꭶ',
  45594. 'Ꭷ' => 'ꭷ',
  45595. 'Ꭸ' => 'ꭸ',
  45596. 'Ꭹ' => 'ꭹ',
  45597. 'Ꭺ' => 'ꭺ',
  45598. 'Ꭻ' => 'ꭻ',
  45599. 'Ꭼ' => 'ꭼ',
  45600. 'Ꭽ' => 'ꭽ',
  45601. 'Ꭾ' => 'ꭾ',
  45602. 'Ꭿ' => 'ꭿ',
  45603. 'Ꮀ' => 'ꮀ',
  45604. 'Ꮁ' => '�',
  45605. 'Ꮂ' => 'ꮂ',
  45606. 'Ꮃ' => 'ꮃ',
  45607. 'Ꮄ' => 'ꮄ',
  45608. 'Ꮅ' => 'ꮅ',
  45609. 'Ꮆ' => 'ꮆ',
  45610. 'Ꮇ' => 'ꮇ',
  45611. 'Ꮈ' => 'ꮈ',
  45612. 'Ꮉ' => 'ꮉ',
  45613. 'Ꮊ' => 'ꮊ',
  45614. 'Ꮋ' => 'ꮋ',
  45615. 'Ꮌ' => 'ꮌ',
  45616. 'Ꮍ' => '�',
  45617. 'Ꮎ' => 'ꮎ',
  45618. 'Ꮏ' => '�',
  45619. '�' => '�',
  45620. '�' => 'ꮑ',
  45621. '�' => 'ꮒ',
  45622. '�' => 'ꮓ',
  45623. '�' => 'ꮔ',
  45624. '�' => 'ꮕ',
  45625. '�' => 'ꮖ',
  45626. '�' => 'ꮗ',
  45627. '�' => 'ꮘ',
  45628. '�' => 'ꮙ',
  45629. '�' => 'ꮚ',
  45630. '�' => 'ꮛ',
  45631. '�' => 'ꮜ',
  45632. '�' => '�',
  45633. '�' => 'ꮞ',
  45634. '�' => 'ꮟ',
  45635. '�' => 'ꮠ',
  45636. '�' => 'ꮡ',
  45637. '�' => 'ꮢ',
  45638. '�' => 'ꮣ',
  45639. '�' => 'ꮤ',
  45640. '�' => 'ꮥ',
  45641. '�' => 'ꮦ',
  45642. '�' => 'ꮧ',
  45643. '�' => 'ꮨ',
  45644. '�' => 'ꮩ',
  45645. '�' => 'ꮪ',
  45646. '�' => 'ꮫ',
  45647. '�' => 'ꮬ',
  45648. '�' => 'ꮭ',
  45649. '�' => 'ꮮ',
  45650. '�' => 'ꮯ',
  45651. '�' => 'ꮰ',
  45652. '�' => 'ꮱ',
  45653. '�' => 'ꮲ',
  45654. '�' => 'ꮳ',
  45655. '�' => 'ꮴ',
  45656. '�' => 'ꮵ',
  45657. '�' => 'ꮶ',
  45658. '�' => 'ꮷ',
  45659. '�' => 'ꮸ',
  45660. '�' => 'ꮹ',
  45661. '�' => 'ꮺ',
  45662. '�' => 'ꮻ',
  45663. '�' => 'ꮼ',
  45664. '�' => 'ꮽ',
  45665. '�' => 'ꮾ',
  45666. '�' => 'ꮿ',
  45667. '�' => '�',
  45668. '�' => '�',
  45669. '�' => '�',
  45670. '�' => '�',
  45671. '�' => '�',
  45672. '�' => '�',
  45673. '�' => '�',
  45674. 'Ბ' => 'ბ',
  45675. 'Გ' => 'გ',
  45676. 'Დ' => 'დ',
  45677. 'Ე' => 'ე',
  45678. 'Ვ' => 'ვ',
  45679. 'Ზ' => 'ზ',
  45680. 'Თ' => 'თ',
  45681. 'Ი' => 'ი',
  45682. 'Კ' => 'კ',
  45683. 'Ლ' => 'ლ',
  45684. 'Მ' => 'მ',
  45685. 'Ნ' => 'ნ',
  45686. '�' => '�',
  45687. 'Პ' => 'პ',
  45688. 'Ჟ' => 'ჟ',
  45689. 'Რ' => 'რ',
  45690. 'Ს' => 'ს',
  45691. 'Ტ' => 'ტ',
  45692. 'Უ' => 'უ',
  45693. 'Ფ' => 'ფ',
  45694. 'Ქ' => 'ქ',
  45695. 'Ღ' => 'ღ',
  45696. 'Ყ' => 'ყ',
  45697. 'Შ' => 'შ',
  45698. 'Ჩ' => 'ჩ',
  45699. 'Ც' => 'ც',
  45700. 'Ძ' => 'ძ',
  45701. 'Წ' => 'წ',
  45702. 'Ჭ' => 'ჭ',
  45703. 'Ხ' => 'ხ',
  45704. 'Ჯ' => 'ჯ',
  45705. 'Ჰ' => 'ჰ',
  45706. 'Ჱ' => 'ჱ',
  45707. 'Ჲ' => 'ჲ',
  45708. 'Ჳ' => 'ჳ',
  45709. 'Ჴ' => 'ჴ',
  45710. 'Ჵ' => 'ჵ',
  45711. 'Ჶ' => 'ჶ',
  45712. 'Ჷ' => 'ჷ',
  45713. 'Ჸ' => 'ჸ',
  45714. 'Ჹ' => 'ჹ',
  45715. 'Ჺ' => 'ჺ',
  45716. 'Ჽ' => 'ჽ',
  45717. 'Ჾ' => 'ჾ',
  45718. 'Ჿ' => 'ჿ',
  45719. 'Ḁ' => '�',
  45720. 'Ḃ' => 'ḃ',
  45721. 'Ḅ' => 'ḅ',
  45722. 'Ḇ' => 'ḇ',
  45723. 'Ḉ' => 'ḉ',
  45724. 'Ḋ' => 'ḋ',
  45725. 'Ḍ' => '�',
  45726. 'Ḏ' => '�',
  45727. '�' => 'ḑ',
  45728. 'Ḓ' => 'ḓ',
  45729. 'Ḕ' => 'ḕ',
  45730. 'Ḗ' => 'ḗ',
  45731. 'Ḙ' => 'ḙ',
  45732. 'Ḛ' => 'ḛ',
  45733. 'Ḝ' => '�',
  45734. 'Ḟ' => 'ḟ',
  45735. 'Ḡ' => 'ḡ',
  45736. 'Ḣ' => 'ḣ',
  45737. 'Ḥ' => 'ḥ',
  45738. 'Ḧ' => 'ḧ',
  45739. 'Ḩ' => 'ḩ',
  45740. 'Ḫ' => 'ḫ',
  45741. 'Ḭ' => 'ḭ',
  45742. 'Ḯ' => 'ḯ',
  45743. 'Ḱ' => 'ḱ',
  45744. 'Ḳ' => 'ḳ',
  45745. 'Ḵ' => 'ḵ',
  45746. 'Ḷ' => 'ḷ',
  45747. 'Ḹ' => 'ḹ',
  45748. 'Ḻ' => 'ḻ',
  45749. 'Ḽ' => 'ḽ',
  45750. 'Ḿ' => 'ḿ',
  45751. 'Ṁ' => '�',
  45752. 'Ṃ' => 'ṃ',
  45753. 'Ṅ' => 'ṅ',
  45754. 'Ṇ' => 'ṇ',
  45755. 'Ṉ' => 'ṉ',
  45756. 'Ṋ' => 'ṋ',
  45757. 'Ṍ' => '�',
  45758. 'Ṏ' => '�',
  45759. '�' => 'ṑ',
  45760. 'Ṓ' => 'ṓ',
  45761. 'Ṕ' => 'ṕ',
  45762. 'á¹–' => 'á¹—',
  45763. 'Ṙ' => 'ṙ',
  45764. 'Ṛ' => 'ṛ',
  45765. 'Ṝ' => '�',
  45766. 'Ṟ' => 'ṟ',
  45767. 'Ṡ' => 'ṡ',
  45768. 'á¹¢' => 'á¹£',
  45769. 'Ṥ' => 'ṥ',
  45770. 'Ṧ' => 'ṧ',
  45771. 'Ṩ' => 'ṩ',
  45772. 'Ṫ' => 'ṫ',
  45773. 'Ṭ' => 'ṭ',
  45774. 'Ṯ' => 'ṯ',
  45775. 'á¹°' => 'á¹±',
  45776. 'á¹²' => 'á¹³',
  45777. 'á¹´' => 'á¹µ',
  45778. 'Ṷ' => 'ṷ',
  45779. 'Ṹ' => 'ṹ',
  45780. 'Ṻ' => 'ṻ',
  45781. 'á¹¼' => 'á¹½',
  45782. 'Ṿ' => 'ṿ',
  45783. 'Ẁ' => '�',
  45784. 'Ẃ' => 'ẃ',
  45785. 'Ẅ' => 'ẅ',
  45786. 'Ẇ' => 'ẇ',
  45787. 'Ẉ' => 'ẉ',
  45788. 'Ẋ' => 'ẋ',
  45789. 'Ẍ' => '�',
  45790. 'Ẏ' => '�',
  45791. '�' => 'ẑ',
  45792. 'Ẓ' => 'ẓ',
  45793. 'Ẕ' => 'ẕ',
  45794. 'ẞ' => 'ß',
  45795. 'Ạ' => 'ạ',
  45796. 'Ả' => 'ả',
  45797. 'Ấ' => 'ấ',
  45798. 'Ầ' => 'ầ',
  45799. 'Ẩ' => 'ẩ',
  45800. 'Ẫ' => 'ẫ',
  45801. 'Ậ' => 'ậ',
  45802. 'Ắ' => 'ắ',
  45803. 'Ằ' => 'ằ',
  45804. 'Ẳ' => 'ẳ',
  45805. 'Ẵ' => 'ẵ',
  45806. 'Ặ' => 'ặ',
  45807. 'Ẹ' => 'ẹ',
  45808. 'Ẻ' => 'ẻ',
  45809. 'Ẽ' => 'ẽ',
  45810. 'Ế' => 'ế',
  45811. 'Ề' => '�',
  45812. 'Ể' => 'ể',
  45813. 'Ễ' => 'ễ',
  45814. 'Ệ' => 'ệ',
  45815. 'Ỉ' => 'ỉ',
  45816. 'Ị' => 'ị',
  45817. 'Ọ' => '�',
  45818. 'Ỏ' => '�',
  45819. '�' => 'ố',
  45820. 'Ồ' => 'ồ',
  45821. 'Ổ' => 'ổ',
  45822. 'á»–' => 'á»—',
  45823. 'Ộ' => 'ộ',
  45824. 'Ớ' => 'ớ',
  45825. 'Ờ' => '�',
  45826. 'Ở' => 'ở',
  45827. 'Ỡ' => 'ỡ',
  45828. 'Ợ' => 'ợ',
  45829. 'Ụ' => 'ụ',
  45830. 'Ủ' => 'ủ',
  45831. 'Ứ' => 'ứ',
  45832. 'Ừ' => 'ừ',
  45833. 'Ử' => 'ử',
  45834. 'Ữ' => 'ữ',
  45835. 'á»°' => 'á»±',
  45836. 'Ỳ' => 'ỳ',
  45837. 'Ỵ' => 'ỵ',
  45838. 'Ỷ' => 'ỷ',
  45839. 'Ỹ' => 'ỹ',
  45840. 'Ỻ' => 'ỻ',
  45841. 'Ỽ' => 'ỽ',
  45842. 'Ỿ' => 'ỿ',
  45843. 'Ἀ' => 'ἀ',
  45844. 'Ἁ' => '�',
  45845. 'Ἂ' => 'ἂ',
  45846. 'Ἃ' => 'ἃ',
  45847. 'Ἄ' => 'ἄ',
  45848. '�' => 'ἅ',
  45849. 'Ἆ' => 'ἆ',
  45850. '�' => 'ἇ',
  45851. 'Ἐ' => '�',
  45852. 'Ἑ' => 'ἑ',
  45853. 'Ἒ' => 'ἒ',
  45854. 'Ἓ' => 'ἓ',
  45855. 'Ἔ' => 'ἔ',
  45856. '�' => 'ἕ',
  45857. 'Ἠ' => 'ἠ',
  45858. 'Ἡ' => 'ἡ',
  45859. 'Ἢ' => 'ἢ',
  45860. 'Ἣ' => 'ἣ',
  45861. 'Ἤ' => 'ἤ',
  45862. 'á¼­' => 'á¼¥',
  45863. 'Ἦ' => 'ἦ',
  45864. 'Ἧ' => 'ἧ',
  45865. 'Ἰ' => 'ἰ',
  45866. 'á¼¹' => 'á¼±',
  45867. 'Ἲ' => 'ἲ',
  45868. 'á¼»' => 'á¼³',
  45869. 'á¼¼' => 'á¼´',
  45870. 'á¼½' => 'á¼µ',
  45871. 'Ἶ' => 'ἶ',
  45872. 'Ἷ' => 'ἷ',
  45873. 'Ὀ' => 'ὀ',
  45874. 'Ὁ' => '�',
  45875. 'Ὂ' => 'ὂ',
  45876. 'Ὃ' => 'ὃ',
  45877. 'Ὄ' => 'ὄ',
  45878. '�' => 'ὅ',
  45879. 'Ὑ' => 'ὑ',
  45880. 'Ὓ' => 'ὓ',
  45881. '�' => 'ὕ',
  45882. 'Ὗ' => 'ὗ',
  45883. 'Ὠ' => 'ὠ',
  45884. 'Ὡ' => 'ὡ',
  45885. 'Ὢ' => 'ὢ',
  45886. 'Ὣ' => 'ὣ',
  45887. 'Ὤ' => 'ὤ',
  45888. 'á½­' => 'á½¥',
  45889. 'Ὦ' => 'ὦ',
  45890. 'Ὧ' => 'ὧ',
  45891. 'ᾈ' => 'ᾀ',
  45892. 'ᾉ' => '�',
  45893. 'ᾊ' => 'ᾂ',
  45894. 'ᾋ' => 'ᾃ',
  45895. 'ᾌ' => 'ᾄ',
  45896. '�' => 'ᾅ',
  45897. 'ᾎ' => 'ᾆ',
  45898. '�' => 'ᾇ',
  45899. 'ᾘ' => '�',
  45900. 'ᾙ' => 'ᾑ',
  45901. 'ᾚ' => 'ᾒ',
  45902. 'ᾛ' => 'ᾓ',
  45903. 'ᾜ' => 'ᾔ',
  45904. '�' => 'ᾕ',
  45905. 'ᾞ' => 'ᾖ',
  45906. 'ᾟ' => 'ᾗ',
  45907. 'ᾨ' => 'ᾠ',
  45908. 'ᾩ' => 'ᾡ',
  45909. 'ᾪ' => 'ᾢ',
  45910. 'ᾫ' => 'ᾣ',
  45911. 'ᾬ' => 'ᾤ',
  45912. 'á¾­' => 'á¾¥',
  45913. 'ᾮ' => 'ᾦ',
  45914. 'ᾯ' => 'ᾧ',
  45915. 'Ᾰ' => 'ᾰ',
  45916. 'á¾¹' => 'á¾±',
  45917. 'Ὰ' => 'ὰ',
  45918. 'á¾»' => 'á½±',
  45919. 'á¾¼' => 'á¾³',
  45920. 'Ὲ' => 'ὲ',
  45921. 'Έ' => 'έ',
  45922. 'á¿Š' => 'á½´',
  45923. 'á¿‹' => 'á½µ',
  45924. 'ῌ' => 'ῃ',
  45925. 'Ῐ' => '�',
  45926. 'á¿™' => 'á¿‘',
  45927. 'Ὶ' => 'ὶ',
  45928. 'á¿›' => 'á½·',
  45929. 'Ῠ' => 'ῠ',
  45930. 'á¿©' => 'á¿¡',
  45931. 'Ὺ' => 'ὺ',
  45932. 'á¿«' => 'á½»',
  45933. 'Ῥ' => 'ῥ',
  45934. 'Ὸ' => 'ὸ',
  45935. 'Ό' => 'ό',
  45936. 'Ὼ' => 'ὼ',
  45937. 'á¿»' => 'á½½',
  45938. 'ῼ' => 'ῳ',
  45939. 'Ω' => 'ω',
  45940. 'K' => 'k',
  45941. 'â„«' => 'Ã¥',
  45942. 'Ⅎ' => 'ⅎ',
  45943. 'â… ' => 'â…°',
  45944. 'â…¡' => 'â…±',
  45945. 'â…¢' => 'â…²',
  45946. 'â…£' => 'â…³',
  45947. 'â…¤' => 'â…´',
  45948. 'â…¥' => 'â…µ',
  45949. 'â…¦' => 'â…¶',
  45950. 'â…§' => 'â…·',
  45951. 'â…¨' => 'â…¸',
  45952. 'â…©' => 'â…¹',
  45953. 'â…ª' => 'â…º',
  45954. 'â…«' => 'â…»',
  45955. 'â…¬' => 'â…¼',
  45956. 'â…­' => 'â…½',
  45957. 'â…®' => 'â…¾',
  45958. 'â…¯' => 'â…¿',
  45959. 'Ↄ' => 'ↄ',
  45960. 'Ⓐ' => '�',
  45961. 'â’·' => 'â“‘',
  45962. 'â’¸' => 'â“’',
  45963. 'â’¹' => 'â““',
  45964. 'â’º' => 'â“”',
  45965. 'â’»' => 'â“•',
  45966. 'â’¼' => 'â“–',
  45967. 'â’½' => 'â“—',
  45968. 'Ⓘ' => 'ⓘ',
  45969. 'â’¿' => 'â“™',
  45970. 'â“€' => 'â“š',
  45971. '�' => 'ⓛ',
  45972. 'Ⓜ' => 'ⓜ',
  45973. 'Ⓝ' => '�',
  45974. 'â“„' => 'â“ž',
  45975. 'â“…' => 'â“Ÿ',
  45976. 'Ⓠ' => 'ⓠ',
  45977. 'Ⓡ' => 'ⓡ',
  45978. 'Ⓢ' => 'ⓢ',
  45979. 'Ⓣ' => 'ⓣ',
  45980. 'Ⓤ' => 'ⓤ',
  45981. 'â“‹' => 'â“¥',
  45982. 'Ⓦ' => 'ⓦ',
  45983. '�' => 'ⓧ',
  45984. 'Ⓨ' => 'ⓨ',
  45985. '�' => 'ⓩ',
  45986. 'â°€' => 'â°°',
  45987. 'â°�' => 'â°±',
  45988. 'â°‚' => 'â°²',
  45989. 'â°ƒ' => 'â°³',
  45990. 'â°„' => 'â°´',
  45991. 'â°…' => 'â°µ',
  45992. 'â°†' => 'â°¶',
  45993. 'â°‡' => 'â°·',
  45994. 'â°ˆ' => 'â°¸',
  45995. 'â°‰' => 'â°¹',
  45996. 'â°Š' => 'â°º',
  45997. 'â°‹' => 'â°»',
  45998. 'Ⰼ' => 'ⰼ',
  45999. 'â°�' => 'â°½',
  46000. 'â°Ž' => 'â°¾',
  46001. 'â°�' => 'â°¿',
  46002. 'â°�' => 'â±€',
  46003. 'Ⱁ' => '�',
  46004. 'Ⱂ' => 'ⱂ',
  46005. 'Ⱃ' => 'ⱃ',
  46006. 'Ⱄ' => 'ⱄ',
  46007. 'â°•' => 'â±…',
  46008. 'Ⱆ' => 'ⱆ',
  46009. 'Ⱇ' => 'ⱇ',
  46010. 'Ⱈ' => 'ⱈ',
  46011. 'Ⱉ' => 'ⱉ',
  46012. 'Ⱊ' => 'ⱊ',
  46013. 'Ⱋ' => 'ⱋ',
  46014. 'Ⱌ' => 'ⱌ',
  46015. '�' => '�',
  46016. 'Ⱎ' => 'ⱎ',
  46017. 'Ⱏ' => '�',
  46018. 'Ⱐ' => '�',
  46019. 'Ⱑ' => 'ⱑ',
  46020. 'â°¢' => 'â±’',
  46021. 'Ⱓ' => 'ⱓ',
  46022. 'â°¤' => 'â±”',
  46023. 'Ⱕ' => 'ⱕ',
  46024. 'â°¦' => 'â±–',
  46025. 'â°§' => 'â±—',
  46026. 'Ⱘ' => 'ⱘ',
  46027. 'â°©' => 'â±™',
  46028. 'Ⱚ' => 'ⱚ',
  46029. 'â°«' => 'â±›',
  46030. 'Ⱜ' => 'ⱜ',
  46031. 'Ⱝ' => '�',
  46032. 'Ⱞ' => 'ⱞ',
  46033. 'Ⱡ' => 'ⱡ',
  46034. 'â±¢' => 'É«',
  46035. 'â±£' => 'áµ½',
  46036. 'Ɽ' => 'ɽ',
  46037. 'Ⱨ' => 'ⱨ',
  46038. 'Ⱪ' => 'ⱪ',
  46039. 'Ⱬ' => 'ⱬ',
  46040. 'â±­' => 'É‘',
  46041. 'Ɱ' => 'ɱ',
  46042. 'Ɐ' => '�',
  46043. 'â±°' => 'É’',
  46044. 'â±²' => 'â±³',
  46045. 'Ⱶ' => 'ⱶ',
  46046. 'â±¾' => 'È¿',
  46047. 'Ɀ' => 'ɀ',
  46048. 'Ⲁ' => '�',
  46049. 'Ⲃ' => 'ⲃ',
  46050. 'Ⲅ' => 'ⲅ',
  46051. 'Ⲇ' => 'ⲇ',
  46052. 'Ⲉ' => 'ⲉ',
  46053. 'Ⲋ' => 'ⲋ',
  46054. 'Ⲍ' => '�',
  46055. 'Ⲏ' => '�',
  46056. '�' => 'ⲑ',
  46057. 'Ⲓ' => 'ⲓ',
  46058. 'Ⲕ' => 'ⲕ',
  46059. 'â²–' => 'â²—',
  46060. 'Ⲙ' => 'ⲙ',
  46061. 'Ⲛ' => 'ⲛ',
  46062. 'Ⲝ' => '�',
  46063. 'Ⲟ' => 'ⲟ',
  46064. 'Ⲡ' => 'ⲡ',
  46065. 'â²¢' => 'â²£',
  46066. 'Ⲥ' => 'ⲥ',
  46067. 'Ⲧ' => 'ⲧ',
  46068. 'Ⲩ' => 'ⲩ',
  46069. 'Ⲫ' => 'ⲫ',
  46070. 'Ⲭ' => 'ⲭ',
  46071. 'Ⲯ' => 'ⲯ',
  46072. 'â²°' => 'â²±',
  46073. 'â²²' => 'â²³',
  46074. 'â²´' => 'â²µ',
  46075. 'Ⲷ' => 'ⲷ',
  46076. 'Ⲹ' => 'ⲹ',
  46077. 'Ⲻ' => 'ⲻ',
  46078. 'â²¼' => 'â²½',
  46079. 'Ⲿ' => 'ⲿ',
  46080. 'Ⳁ' => '�',
  46081. 'Ⳃ' => 'ⳃ',
  46082. 'Ⳅ' => 'ⳅ',
  46083. 'Ⳇ' => 'ⳇ',
  46084. 'Ⳉ' => 'ⳉ',
  46085. 'Ⳋ' => 'ⳋ',
  46086. 'Ⳍ' => '�',
  46087. 'Ⳏ' => '�',
  46088. '�' => 'ⳑ',
  46089. 'Ⳓ' => 'ⳓ',
  46090. 'Ⳕ' => 'ⳕ',
  46091. 'â³–' => 'â³—',
  46092. 'Ⳙ' => 'ⳙ',
  46093. 'Ⳛ' => 'ⳛ',
  46094. 'Ⳝ' => '�',
  46095. 'Ⳟ' => 'ⳟ',
  46096. 'Ⳡ' => 'ⳡ',
  46097. 'â³¢' => 'â³£',
  46098. 'Ⳬ' => 'ⳬ',
  46099. 'â³­' => 'â³®',
  46100. 'â³²' => 'â³³',
  46101. 'Ꙁ' => '�',
  46102. 'Ꙃ' => 'ꙃ',
  46103. 'Ꙅ' => 'ꙅ',
  46104. 'Ꙇ' => 'ꙇ',
  46105. 'Ꙉ' => 'ꙉ',
  46106. 'Ꙋ' => 'ꙋ',
  46107. 'Ꙍ' => '�',
  46108. 'Ꙏ' => '�',
  46109. '�' => 'ꙑ',
  46110. 'Ꙓ' => 'ꙓ',
  46111. 'Ꙕ' => 'ꙕ',
  46112. 'ê™–' => 'ê™—',
  46113. 'Ꙙ' => 'ꙙ',
  46114. 'Ꙛ' => 'ꙛ',
  46115. 'Ꙝ' => '�',
  46116. 'Ꙟ' => 'ꙟ',
  46117. 'Ꙡ' => 'ꙡ',
  46118. 'Ꙣ' => 'ꙣ',
  46119. 'Ꙥ' => 'ꙥ',
  46120. 'Ꙧ' => 'ꙧ',
  46121. 'Ꙩ' => 'ꙩ',
  46122. 'Ꙫ' => 'ꙫ',
  46123. 'Ꙭ' => 'ꙭ',
  46124. 'Ꚁ' => '�',
  46125. 'Ꚃ' => 'ꚃ',
  46126. 'êš„' => 'êš…',
  46127. 'Ꚇ' => 'ꚇ',
  46128. 'Ꚉ' => 'ꚉ',
  46129. 'Ꚋ' => 'ꚋ',
  46130. 'Ꚍ' => '�',
  46131. 'Ꚏ' => '�',
  46132. '�' => 'ꚑ',
  46133. 'êš’' => 'êš“',
  46134. 'êš”' => 'êš•',
  46135. 'êš–' => 'êš—',
  46136. 'Ꚙ' => 'ꚙ',
  46137. 'êšš' => 'êš›',
  46138. 'Ꜣ' => 'ꜣ',
  46139. 'Ꜥ' => 'ꜥ',
  46140. 'Ꜧ' => 'ꜧ',
  46141. 'Ꜩ' => 'ꜩ',
  46142. 'Ꜫ' => 'ꜫ',
  46143. 'Ꜭ' => 'ꜭ',
  46144. 'Ꜯ' => 'ꜯ',
  46145. 'Ꜳ' => 'ꜳ',
  46146. 'Ꜵ' => 'ꜵ',
  46147. 'Ꜷ' => 'ꜷ',
  46148. 'Ꜹ' => 'ꜹ',
  46149. 'Ꜻ' => 'ꜻ',
  46150. 'Ꜽ' => 'ꜽ',
  46151. 'Ꜿ' => 'ꜿ',
  46152. '�' => '�',
  46153. '�' => '�',
  46154. '�' => '�',
  46155. '�' => '�',
  46156. '�' => '�',
  46157. '�' => '�',
  46158. '�' => '�',
  46159. '�' => '�',
  46160. '�' => '�',
  46161. '�' => '�',
  46162. '�' => '�',
  46163. '�' => '�',
  46164. '�' => '�',
  46165. '�' => '�',
  46166. '�' => '�',
  46167. '�' => '�',
  46168. '�' => '�',
  46169. '�' => '�',
  46170. '�' => '�',
  46171. '�' => '�',
  46172. '�' => '�',
  46173. '�' => '�',
  46174. '�' => '�',
  46175. '�' => '�',
  46176. '�' => '�',
  46177. '�' => '�',
  46178. '�' => 'ᵹ',
  46179. '�' => '�',
  46180. 'Ꞁ' => '�',
  46181. 'Ꞃ' => 'ꞃ',
  46182. 'êž„' => 'êž…',
  46183. 'Ꞇ' => 'ꞇ',
  46184. 'Ꞌ' => 'ꞌ',
  46185. '�' => 'ɥ',
  46186. '�' => 'ꞑ',
  46187. 'êž’' => 'êž“',
  46188. 'êž–' => 'êž—',
  46189. 'Ꞙ' => 'ꞙ',
  46190. 'êžš' => 'êž›',
  46191. 'Ꞝ' => '�',
  46192. 'Ꞟ' => 'ꞟ',
  46193. 'êž ' => 'êž¡',
  46194. 'Ꞣ' => 'ꞣ',
  46195. 'Ꞥ' => 'ꞥ',
  46196. 'Ꞧ' => 'ꞧ',
  46197. 'Ꞩ' => 'ꞩ',
  46198. 'Ɦ' => 'ɦ',
  46199. 'Ɜ' => 'ɜ',
  46200. 'Ɡ' => 'ɡ',
  46201. 'Ɬ' => 'ɬ',
  46202. 'Ɪ' => 'ɪ',
  46203. 'êž°' => 'Êž',
  46204. 'Ʇ' => 'ʇ',
  46205. 'Ʝ' => '�',
  46206. 'êž³' => 'ê­“',
  46207. 'êž´' => 'êžµ',
  46208. 'Ꞷ' => 'ꞷ',
  46209. 'Ꞹ' => 'ꞹ',
  46210. 'Ꞻ' => 'ꞻ',
  46211. 'êž¼' => 'êž½',
  46212. 'êž¾' => 'êž¿',
  46213. 'Ꟃ' => 'ꟃ',
  46214. 'Ꞔ' => 'ꞔ',
  46215. 'Ʂ' => 'ʂ',
  46216. 'Ᶎ' => 'ᶎ',
  46217. 'Ꟈ' => 'ꟈ',
  46218. 'Ꟊ' => 'ꟊ',
  46219. 'Ꟶ' => 'ꟶ',
  46220. 'A' => '�',
  46221. 'B' => 'b',
  46222. 'C' => 'c',
  46223. 'D' => 'd',
  46224. 'ï¼¥' => 'ï½…',
  46225. 'F' => 'f',
  46226. 'G' => 'g',
  46227. 'H' => 'h',
  46228. 'I' => 'i',
  46229. 'J' => 'j',
  46230. 'K' => 'k',
  46231. 'L' => 'l',
  46232. 'M' => '�',
  46233. 'N' => 'n',
  46234. 'O' => '�',
  46235. 'P' => '�',
  46236. 'Q' => 'q',
  46237. 'ï¼²' => 'ï½’',
  46238. 'S' => 's',
  46239. 'ï¼´' => 'ï½”',
  46240. 'U' => 'u',
  46241. 'V' => 'v',
  46242. 'ï¼·' => 'ï½—',
  46243. 'X' => 'x',
  46244. 'ï¼¹' => 'ï½™',
  46245. 'Z' => 'z',
  46246. '�' => '�',
  46247. '�' => '�',
  46248. '�' => '�',
  46249. '�' => '�',
  46250. '�' => '�',
  46251. '�' => '�',
  46252. '�' => '�',
  46253. '�' => '�',
  46254. '�' => '�',
  46255. '�' => '�',
  46256. '�' => '�',
  46257. '�' => '�',
  46258. '�' => '�',
  46259. '�' => '�',
  46260. '�' => '�',
  46261. '�' => '�',
  46262. '�' => '�',
  46263. '�' => '�',
  46264. '�' => '�',
  46265. '�' => '�',
  46266. '�' => '�',
  46267. '�' => '�',
  46268. '�' => '�',
  46269. '�' => '�',
  46270. '�' => '�',
  46271. '�' => '�',
  46272. '�' => '�',
  46273. '�' => '�',
  46274. '�' => '�',
  46275. '�' => '�',
  46276. '�' => '�',
  46277. '�' => '�',
  46278. '�' => '�',
  46279. '�' => '�',
  46280. '�' => '�',
  46281. '�' => '�',
  46282. '�' => '�',
  46283. '�' => '�',
  46284. '�' => '�',
  46285. '�' => '�',
  46286. '�' => '�',
  46287. '�' => '�',
  46288. '�' => '�',
  46289. '�' => '�',
  46290. '�' => '�',
  46291. '�' => '�',
  46292. '�' => '�',
  46293. '�' => '�',
  46294. '�' => '�',
  46295. '�' => '�',
  46296. '�' => '�',
  46297. '�' => '�',
  46298. '�' => '�',
  46299. '�' => '�',
  46300. '�' => '�',
  46301. '�' => '�',
  46302. '�' => '�',
  46303. '�' => '�',
  46304. '�' => '�',
  46305. '�' => '�',
  46306. '�' => '�',
  46307. '�' => '�',
  46308. '�' => '�',
  46309. '�' => '�',
  46310. '�' => '�',
  46311. '�' => '�',
  46312. '�' => '�',
  46313. '�' => '�',
  46314. '�' => '�',
  46315. '�' => '�',
  46316. '�' => '�',
  46317. '�' => '�',
  46318. '�' => '�',
  46319. '�' => '�',
  46320. '�' => '�',
  46321. '�' => '�',
  46322. '�' => '�',
  46323. '�' => '�',
  46324. '�' => '�',
  46325. '�' => '�',
  46326. '�' => '�',
  46327. '�' => '�',
  46328. '�' => '�',
  46329. '�' => '�',
  46330. '�' => '�',
  46331. '�' => '�',
  46332. '�' => '�',
  46333. '�' => '�',
  46334. '�' => '�',
  46335. '�' => '�',
  46336. '�' => '�',
  46337. '�' => '�',
  46338. '�' => '�',
  46339. '�' => '�',
  46340. '�' => '�',
  46341. '�' => '�',
  46342. '�' => '�',
  46343. '�' => '�',
  46344. '�' => '�',
  46345. '�' => '�',
  46346. '�' => '�',
  46347. '�' => '�',
  46348. '�' => '�',
  46349. '�' => '�',
  46350. '�' => '�',
  46351. '�' => '�',
  46352. '�' => '�',
  46353. '�' => '�',
  46354. '�' => '�',
  46355. '�' => '�',
  46356. '�' => '�',
  46357. '�' => '�',
  46358. '�' => '�',
  46359. '�' => '�',
  46360. '�' => '�',
  46361. '�' => '�',
  46362. '�' => '�',
  46363. '�' => '�',
  46364. '�' => '�',
  46365. '�' => '�',
  46366. '�' => '�',
  46367. '�' => '�',
  46368. '�' => '�',
  46369. '�' => '�',
  46370. '�' => '�',
  46371. '�' => '�',
  46372. '�' => '�',
  46373. 'ð‘¢ ' => 'ð‘£€',
  46374. '𑢡' => '�',
  46375. '𑢢' => '𑣂',
  46376. '𑢣' => '𑣃',
  46377. '𑢤' => '𑣄',
  46378. 'ð‘¢¥' => 'ð‘£…',
  46379. '𑢦' => '𑣆',
  46380. '𑢧' => '𑣇',
  46381. '𑢨' => '𑣈',
  46382. '𑢩' => '𑣉',
  46383. '𑢪' => '𑣊',
  46384. '𑢫' => '𑣋',
  46385. '𑢬' => '𑣌',
  46386. '𑢭' => '�',
  46387. '𑢮' => '𑣎',
  46388. '𑢯' => '�',
  46389. '𑢰' => '�',
  46390. '𑢱' => '𑣑',
  46391. 'ð‘¢²' => 'ð‘£’',
  46392. '𑢳' => '𑣓',
  46393. 'ð‘¢´' => 'ð‘£”',
  46394. '𑢵' => '𑣕',
  46395. '𑢶' => '𑣖',
  46396. 'ð‘¢·' => 'ð‘£—',
  46397. '𑢸' => '𑣘',
  46398. 'ð‘¢¹' => 'ð‘£™',
  46399. '𑢺' => '𑣚',
  46400. 'ð‘¢»' => 'ð‘£›',
  46401. '𑢼' => '𑣜',
  46402. '𑢽' => '�',
  46403. '𑢾' => '𑣞',
  46404. '𑢿' => '𑣟',
  46405. 'ð–¹€' => 'ð–¹ ',
  46406. '�' => '𖹡',
  46407. '𖹂' => '𖹢',
  46408. '𖹃' => '𖹣',
  46409. '𖹄' => '𖹤',
  46410. 'ð–¹…' => 'ð–¹¥',
  46411. '𖹆' => '𖹦',
  46412. '𖹇' => '𖹧',
  46413. '𖹈' => '𖹨',
  46414. '𖹉' => '𖹩',
  46415. '𖹊' => '𖹪',
  46416. '𖹋' => '𖹫',
  46417. '𖹌' => '𖹬',
  46418. '�' => '𖹭',
  46419. '𖹎' => '𖹮',
  46420. '�' => '𖹯',
  46421. '�' => '𖹰',
  46422. '𖹑' => '𖹱',
  46423. 'ð–¹’' => 'ð–¹²',
  46424. '𖹓' => '𖹳',
  46425. 'ð–¹”' => 'ð–¹´',
  46426. '𖹕' => '𖹵',
  46427. '𖹖' => '𖹶',
  46428. 'ð–¹—' => 'ð–¹·',
  46429. '𖹘' => '𖹸',
  46430. 'ð–¹™' => 'ð–¹¹',
  46431. '𖹚' => '𖹺',
  46432. 'ð–¹›' => 'ð–¹»',
  46433. '𖹜' => '𖹼',
  46434. '�' => '𖹽',
  46435. '𖹞' => '𖹾',
  46436. '𖹟' => '𖹿',
  46437. '𞤀' => '𞤢',
  46438. '�' => '𞤣',
  46439. '𞤂' => '𞤤',
  46440. '𞤃' => '𞤥',
  46441. '𞤄' => '𞤦',
  46442. '𞤅' => '𞤧',
  46443. '𞤆' => '𞤨',
  46444. '𞤇' => '𞤩',
  46445. '𞤈' => '𞤪',
  46446. '𞤉' => '𞤫',
  46447. '𞤊' => '𞤬',
  46448. '𞤋' => '𞤭',
  46449. '𞤌' => '𞤮',
  46450. '�' => '𞤯',
  46451. '𞤎' => '𞤰',
  46452. '�' => '𞤱',
  46453. '�' => '𞤲',
  46454. '𞤑' => '𞤳',
  46455. '𞤒' => '𞤴',
  46456. '𞤓' => '𞤵',
  46457. '𞤔' => '𞤶',
  46458. '𞤕' => '𞤷',
  46459. '𞤖' => '𞤸',
  46460. '𞤗' => '𞤹',
  46461. '𞤘' => '𞤺',
  46462. '𞤙' => '𞤻',
  46463. '𞤚' => '𞤼',
  46464. '𞤛' => '𞤽',
  46465. '𞤜' => '𞤾',
  46466. '�' => '𞤿',
  46467. '𞤞' => '𞥀',
  46468. '𞤟' => '�',
  46469. '𞤠' => '𞥂',
  46470. '𞤡' => '𞥃',
  46471. );
  46472. <?php
  46473. 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';
  46474. <?php
  46475. return array (
  46476. 'a' => 'A',
  46477. 'b' => 'B',
  46478. 'c' => 'C',
  46479. 'd' => 'D',
  46480. 'e' => 'E',
  46481. 'f' => 'F',
  46482. 'g' => 'G',
  46483. 'h' => 'H',
  46484. 'i' => 'I',
  46485. 'j' => 'J',
  46486. 'k' => 'K',
  46487. 'l' => 'L',
  46488. 'm' => 'M',
  46489. 'n' => 'N',
  46490. 'o' => 'O',
  46491. 'p' => 'P',
  46492. 'q' => 'Q',
  46493. 'r' => 'R',
  46494. 's' => 'S',
  46495. 't' => 'T',
  46496. 'u' => 'U',
  46497. 'v' => 'V',
  46498. 'w' => 'W',
  46499. 'x' => 'X',
  46500. 'y' => 'Y',
  46501. 'z' => 'Z',
  46502. 'µ' => 'Μ',
  46503. 'à' => 'À',
  46504. 'á' => '�',
  46505. 'â' => 'Â',
  46506. 'ã' => 'Ã',
  46507. 'ä' => 'Ä',
  46508. 'Ã¥' => 'Ã…',
  46509. 'æ' => 'Æ',
  46510. 'ç' => 'Ç',
  46511. 'è' => 'È',
  46512. 'é' => 'É',
  46513. 'ê' => 'Ê',
  46514. 'ë' => 'Ë',
  46515. 'ì' => 'Ì',
  46516. 'í' => '�',
  46517. 'î' => 'Î',
  46518. 'ï' => '�',
  46519. 'ð' => '�',
  46520. 'ñ' => 'Ñ',
  46521. 'ò' => 'Ò',
  46522. 'ó' => 'Ó',
  46523. 'ô' => 'Ô',
  46524. 'õ' => 'Õ',
  46525. 'ö' => 'Ö',
  46526. 'ø' => 'Ø',
  46527. 'ù' => 'Ù',
  46528. 'ú' => 'Ú',
  46529. 'û' => 'Û',
  46530. 'ü' => 'Ü',
  46531. 'ý' => '�',
  46532. 'þ' => 'Þ',
  46533. 'ÿ' => 'Ÿ',
  46534. '�' => 'Ā',
  46535. 'ă' => 'Ă',
  46536. 'Ä…' => 'Ä„',
  46537. 'ć' => 'Ć',
  46538. 'ĉ' => 'Ĉ',
  46539. 'Ä‹' => 'ÄŠ',
  46540. '�' => 'Č',
  46541. '�' => 'Ď',
  46542. 'đ' => '�',
  46543. 'Ä“' => 'Ä’',
  46544. 'Ä•' => 'Ä”',
  46545. 'Ä—' => 'Ä–',
  46546. 'ę' => 'Ę',
  46547. 'Ä›' => 'Äš',
  46548. '�' => 'Ĝ',
  46549. 'ÄŸ' => 'Äž',
  46550. 'Ä¡' => 'Ä ',
  46551. 'Ä£' => 'Ä¢',
  46552. 'ĥ' => 'Ĥ',
  46553. 'ħ' => 'Ħ',
  46554. 'ĩ' => 'Ĩ',
  46555. 'ī' => 'Ī',
  46556. 'ĭ' => 'Ĭ',
  46557. 'į' => 'Į',
  46558. 'ı' => 'I',
  46559. 'ij' => 'IJ',
  46560. 'ĵ' => 'Ĵ',
  46561. 'ķ' => 'Ķ',
  46562. 'ĺ' => 'Ĺ',
  46563. 'ļ' => 'Ļ',
  46564. 'ľ' => 'Ľ',
  46565. 'Å€' => 'Ä¿',
  46566. 'ł' => '�',
  46567. 'ń' => 'Ń',
  46568. 'ņ' => 'Ņ',
  46569. 'ň' => 'Ň',
  46570. 'Å‹' => 'ÅŠ',
  46571. '�' => 'Ō',
  46572. '�' => 'Ŏ',
  46573. 'ő' => '�',
  46574. 'Å“' => 'Å’',
  46575. 'Å•' => 'Å”',
  46576. 'Å—' => 'Å–',
  46577. 'ř' => 'Ř',
  46578. 'Å›' => 'Åš',
  46579. '�' => 'Ŝ',
  46580. 'ÅŸ' => 'Åž',
  46581. 'Å¡' => 'Å ',
  46582. 'Å£' => 'Å¢',
  46583. 'ť' => 'Ť',
  46584. 'ŧ' => 'Ŧ',
  46585. 'ũ' => 'Ũ',
  46586. 'ū' => 'Ū',
  46587. 'ŭ' => 'Ŭ',
  46588. 'ů' => 'Ů',
  46589. 'ű' => 'Ű',
  46590. 'ų' => 'Ų',
  46591. 'ŵ' => 'Ŵ',
  46592. 'ŷ' => 'Ŷ',
  46593. 'ź' => 'Ź',
  46594. 'ż' => 'Ż',
  46595. 'ž' => 'Ž',
  46596. 'Å¿' => 'S',
  46597. 'ƀ' => 'Ƀ',
  46598. 'ƃ' => 'Ƃ',
  46599. 'Æ…' => 'Æ„',
  46600. 'ƈ' => 'Ƈ',
  46601. 'ƌ' => 'Ƌ',
  46602. 'Æ’' => 'Æ‘',
  46603. 'ƕ' => 'Ƕ',
  46604. 'ƙ' => 'Ƙ',
  46605. 'ƚ' => 'Ƚ',
  46606. 'Æž' => 'È ',
  46607. 'Æ¡' => 'Æ ',
  46608. 'Æ£' => 'Æ¢',
  46609. 'ƥ' => 'Ƥ',
  46610. 'ƨ' => 'Ƨ',
  46611. 'ƭ' => 'Ƭ',
  46612. 'ư' => 'Ư',
  46613. 'ƴ' => 'Ƴ',
  46614. 'ƶ' => 'Ƶ',
  46615. 'ƹ' => 'Ƹ',
  46616. 'ƽ' => 'Ƽ',
  46617. 'Æ¿' => 'Ç·',
  46618. 'Ç…' => 'Ç„',
  46619. 'dž' => 'DŽ',
  46620. 'Lj' => 'LJ',
  46621. 'lj' => 'LJ',
  46622. 'Ç‹' => 'ÇŠ',
  46623. 'nj' => 'NJ',
  46624. 'ǎ' => '�',
  46625. '�' => '�',
  46626. 'Ç’' => 'Ç‘',
  46627. 'Ç”' => 'Ç“',
  46628. 'Ç–' => 'Ç•',
  46629. 'ǘ' => 'Ǘ',
  46630. 'Çš' => 'Ç™',
  46631. 'ǜ' => 'Ǜ',
  46632. '�' => 'Ǝ',
  46633. 'ÇŸ' => 'Çž',
  46634. 'Ç¡' => 'Ç ',
  46635. 'Ç£' => 'Ç¢',
  46636. 'ǥ' => 'Ǥ',
  46637. 'ǧ' => 'Ǧ',
  46638. 'ǩ' => 'Ǩ',
  46639. 'ǫ' => 'Ǫ',
  46640. 'ǭ' => 'Ǭ',
  46641. 'ǯ' => 'Ǯ',
  46642. 'Dz' => 'DZ',
  46643. 'dz' => 'DZ',
  46644. 'ǵ' => 'Ǵ',
  46645. 'ǹ' => 'Ǹ',
  46646. 'ǻ' => 'Ǻ',
  46647. 'ǽ' => 'Ǽ',
  46648. 'ǿ' => 'Ǿ',
  46649. '�' => 'Ȁ',
  46650. 'ȃ' => 'Ȃ',
  46651. 'È…' => 'È„',
  46652. 'ȇ' => 'Ȇ',
  46653. 'ȉ' => 'Ȉ',
  46654. 'È‹' => 'ÈŠ',
  46655. '�' => 'Ȍ',
  46656. '�' => 'Ȏ',
  46657. 'ȑ' => '�',
  46658. 'È“' => 'È’',
  46659. 'È•' => 'È”',
  46660. 'È—' => 'È–',
  46661. 'ș' => 'Ș',
  46662. 'È›' => 'Èš',
  46663. '�' => 'Ȝ',
  46664. 'ÈŸ' => 'Èž',
  46665. 'È£' => 'È¢',
  46666. 'ȥ' => 'Ȥ',
  46667. 'ȧ' => 'Ȧ',
  46668. 'ȩ' => 'Ȩ',
  46669. 'ȫ' => 'Ȫ',
  46670. 'ȭ' => 'Ȭ',
  46671. 'ȯ' => 'Ȯ',
  46672. 'ȱ' => 'Ȱ',
  46673. 'ȳ' => 'Ȳ',
  46674. 'ȼ' => 'Ȼ',
  46675. 'È¿' => 'â±¾',
  46676. 'ɀ' => 'Ɀ',
  46677. 'ɂ' => '�',
  46678. 'ɇ' => 'Ɇ',
  46679. 'ɉ' => 'Ɉ',
  46680. 'É‹' => 'ÉŠ',
  46681. '�' => 'Ɍ',
  46682. '�' => 'Ɏ',
  46683. '�' => 'Ɐ',
  46684. 'É‘' => 'â±­',
  46685. 'É’' => 'â±°',
  46686. 'ɓ' => '�',
  46687. 'ɔ' => 'Ɔ',
  46688. 'ɖ' => 'Ɖ',
  46689. 'É—' => 'ÆŠ',
  46690. 'ə' => '�',
  46691. 'ɛ' => '�',
  46692. 'ɜ' => 'Ɜ',
  46693. 'É ' => 'Æ“',
  46694. 'ɡ' => 'Ɡ',
  46695. 'É£' => 'Æ”',
  46696. 'ɥ' => '�',
  46697. 'ɦ' => 'Ɦ',
  46698. 'ɨ' => 'Ɨ',
  46699. 'É©' => 'Æ–',
  46700. 'ɪ' => 'Ɪ',
  46701. 'É«' => 'â±¢',
  46702. 'ɬ' => 'Ɬ',
  46703. 'ɯ' => 'Ɯ',
  46704. 'ɱ' => 'Ɱ',
  46705. 'ɲ' => '�',
  46706. 'ɵ' => 'Ɵ',
  46707. 'ɽ' => 'Ɽ',
  46708. 'ʀ' => 'Ʀ',
  46709. 'ʂ' => 'Ʂ',
  46710. 'ʃ' => 'Ʃ',
  46711. 'ʇ' => 'Ʇ',
  46712. 'ʈ' => 'Ʈ',
  46713. 'ʉ' => 'Ʉ',
  46714. 'ʊ' => 'Ʊ',
  46715. 'ʋ' => 'Ʋ',
  46716. 'ʌ' => 'Ʌ',
  46717. 'Ê’' => 'Æ·',
  46718. '�' => 'Ʝ',
  46719. 'Êž' => 'êž°',
  46720. 'ͅ' => 'Ι',
  46721. 'ͱ' => 'Ͱ',
  46722. 'ͳ' => 'Ͳ',
  46723. 'ͷ' => 'Ͷ',
  46724. 'ͻ' => 'Ͻ',
  46725. 'ͼ' => 'Ͼ',
  46726. 'ͽ' => 'Ͽ',
  46727. 'ά' => 'Ά',
  46728. 'έ' => 'Έ',
  46729. 'ή' => 'Ή',
  46730. 'ί' => 'Ί',
  46731. 'α' => 'Α',
  46732. 'β' => 'Β',
  46733. 'γ' => 'Γ',
  46734. 'δ' => 'Δ',
  46735. 'ε' => 'Ε',
  46736. 'ζ' => 'Ζ',
  46737. 'η' => 'Η',
  46738. 'θ' => 'Θ',
  46739. 'ι' => 'Ι',
  46740. 'κ' => 'Κ',
  46741. 'λ' => 'Λ',
  46742. 'μ' => 'Μ',
  46743. 'ν' => '�',
  46744. 'ξ' => 'Ξ',
  46745. 'ο' => 'Ο',
  46746. 'π' => 'Π',
  46747. '�' => 'Ρ',
  46748. 'ς' => 'Σ',
  46749. 'σ' => 'Σ',
  46750. 'τ' => 'Τ',
  46751. 'Ï…' => 'Î¥',
  46752. 'φ' => 'Φ',
  46753. 'χ' => 'Χ',
  46754. 'ψ' => 'Ψ',
  46755. 'ω' => 'Ω',
  46756. 'ϊ' => 'Ϊ',
  46757. 'ϋ' => 'Ϋ',
  46758. 'ό' => 'Ό',
  46759. '�' => 'Ύ',
  46760. 'ώ' => '�',
  46761. '�' => 'Β',
  46762. 'ϑ' => 'Θ',
  46763. 'ϕ' => 'Φ',
  46764. 'ϖ' => 'Π',
  46765. 'ϗ' => '�',
  46766. 'ϙ' => 'Ϙ',
  46767. 'Ï›' => 'Ïš',
  46768. '�' => 'Ϝ',
  46769. 'ÏŸ' => 'Ïž',
  46770. 'Ï¡' => 'Ï ',
  46771. 'Ï£' => 'Ï¢',
  46772. 'ϥ' => 'Ϥ',
  46773. 'ϧ' => 'Ϧ',
  46774. 'ϩ' => 'Ϩ',
  46775. 'ϫ' => 'Ϫ',
  46776. 'ϭ' => 'Ϭ',
  46777. 'ϯ' => 'Ϯ',
  46778. 'ϰ' => 'Κ',
  46779. 'ϱ' => 'Ρ',
  46780. 'ϲ' => 'Ϲ',
  46781. 'ϳ' => 'Ϳ',
  46782. 'ϵ' => 'Ε',
  46783. 'ϸ' => 'Ϸ',
  46784. 'ϻ' => 'Ϻ',
  46785. 'а' => '�',
  46786. 'б' => 'Б',
  46787. 'в' => 'В',
  46788. 'г' => 'Г',
  46789. 'д' => 'Д',
  46790. 'е' => 'Е',
  46791. 'ж' => 'Ж',
  46792. 'з' => 'З',
  46793. 'и' => 'И',
  46794. 'й' => 'Й',
  46795. 'к' => 'К',
  46796. 'л' => 'Л',
  46797. 'м' => 'М',
  46798. 'н' => '�',
  46799. 'о' => 'О',
  46800. 'п' => 'П',
  46801. 'р' => 'Р',
  46802. '�' => 'С',
  46803. 'т' => 'Т',
  46804. 'у' => 'У',
  46805. 'ф' => 'Ф',
  46806. 'Ñ…' => 'Ð¥',
  46807. 'ц' => 'Ц',
  46808. 'ч' => 'Ч',
  46809. 'ш' => 'Ш',
  46810. 'щ' => 'Щ',
  46811. 'ъ' => 'Ъ',
  46812. 'ы' => 'Ы',
  46813. 'ь' => 'Ь',
  46814. '�' => 'Э',
  46815. 'ю' => 'Ю',
  46816. '�' => 'Я',
  46817. '�' => 'Ѐ',
  46818. 'ё' => '�',
  46819. 'ђ' => 'Ђ',
  46820. 'ѓ' => 'Ѓ',
  46821. 'є' => 'Є',
  46822. 'Ñ•' => 'Ð…',
  46823. 'і' => 'І',
  46824. 'ї' => 'Ї',
  46825. 'ј' => 'Ј',
  46826. 'љ' => 'Љ',
  46827. 'њ' => 'Њ',
  46828. 'ћ' => 'Ћ',
  46829. 'ќ' => 'Ќ',
  46830. '�' => '�',
  46831. 'Ñž' => 'ÐŽ',
  46832. 'џ' => '�',
  46833. 'Ñ¡' => 'Ñ ',
  46834. 'Ñ£' => 'Ñ¢',
  46835. 'ѥ' => 'Ѥ',
  46836. 'ѧ' => 'Ѧ',
  46837. 'ѩ' => 'Ѩ',
  46838. 'ѫ' => 'Ѫ',
  46839. 'ѭ' => 'Ѭ',
  46840. 'ѯ' => 'Ѯ',
  46841. 'ѱ' => 'Ѱ',
  46842. 'ѳ' => 'Ѳ',
  46843. 'ѵ' => 'Ѵ',
  46844. 'ѷ' => 'Ѷ',
  46845. 'ѹ' => 'Ѹ',
  46846. 'ѻ' => 'Ѻ',
  46847. 'ѽ' => 'Ѽ',
  46848. 'ѿ' => 'Ѿ',
  46849. 'Ò�' => 'Ò€',
  46850. 'Ò‹' => 'ÒŠ',
  46851. '�' => 'Ҍ',
  46852. 'Ò�' => 'ÒŽ',
  46853. 'Ò‘' => 'Ò�',
  46854. 'Ò“' => 'Ò’',
  46855. 'Ò•' => 'Ò”',
  46856. 'Ò—' => 'Ò–',
  46857. 'Ò™' => 'Ò˜',
  46858. 'Ò›' => 'Òš',
  46859. '�' => 'Ҝ',
  46860. 'ÒŸ' => 'Òž',
  46861. 'Ò¡' => 'Ò ',
  46862. 'Ò£' => 'Ò¢',
  46863. 'Ò¥' => 'Ò¤',
  46864. 'Ò§' => 'Ò¦',
  46865. 'Ò©' => 'Ò¨',
  46866. 'Ò«' => 'Òª',
  46867. 'Ò­' => 'Ò¬',
  46868. 'Ò¯' => 'Ò®',
  46869. 'Ò±' => 'Ò°',
  46870. 'Ò³' => 'Ò²',
  46871. 'Òµ' => 'Ò´',
  46872. 'Ò·' => 'Ò¶',
  46873. 'Ò¹' => 'Ò¸',
  46874. 'Ò»' => 'Òº',
  46875. 'Ò½' => 'Ò¼',
  46876. 'Ò¿' => 'Ò¾',
  46877. 'Ó‚' => 'Ó�',
  46878. 'Ó„' => 'Óƒ',
  46879. 'Ó†' => 'Ó…',
  46880. 'Óˆ' => 'Ó‡',
  46881. 'ÓŠ' => 'Ó‰',
  46882. 'ӌ' => 'Ӌ',
  46883. 'ÓŽ' => 'Ó�',
  46884. 'Ó�' => 'Ó€',
  46885. 'Ó‘' => 'Ó�',
  46886. 'Ó“' => 'Ó’',
  46887. 'Ó•' => 'Ó”',
  46888. 'Ó—' => 'Ó–',
  46889. 'Ó™' => 'Ó˜',
  46890. 'Ó›' => 'Óš',
  46891. '�' => 'Ӝ',
  46892. 'ÓŸ' => 'Óž',
  46893. 'Ó¡' => 'Ó ',
  46894. 'Ó£' => 'Ó¢',
  46895. 'Ó¥' => 'Ó¤',
  46896. 'Ó§' => 'Ó¦',
  46897. 'Ó©' => 'Ó¨',
  46898. 'Ó«' => 'Óª',
  46899. 'Ó­' => 'Ó¬',
  46900. 'Ó¯' => 'Ó®',
  46901. 'Ó±' => 'Ó°',
  46902. 'Ó³' => 'Ó²',
  46903. 'Óµ' => 'Ó´',
  46904. 'Ó·' => 'Ó¶',
  46905. 'Ó¹' => 'Ó¸',
  46906. 'Ó»' => 'Óº',
  46907. 'Ó½' => 'Ó¼',
  46908. 'Ó¿' => 'Ó¾',
  46909. 'Ô�' => 'Ô€',
  46910. 'Ôƒ' => 'Ô‚',
  46911. 'Ô…' => 'Ô„',
  46912. 'Ô‡' => 'Ô†',
  46913. 'Ô‰' => 'Ôˆ',
  46914. 'Ô‹' => 'ÔŠ',
  46915. '�' => 'Ԍ',
  46916. 'Ô�' => 'ÔŽ',
  46917. 'Ô‘' => 'Ô�',
  46918. 'Ô“' => 'Ô’',
  46919. 'Ô•' => 'Ô”',
  46920. 'Ô—' => 'Ô–',
  46921. 'Ô™' => 'Ô˜',
  46922. 'Ô›' => 'Ôš',
  46923. '�' => 'Ԝ',
  46924. 'ÔŸ' => 'Ôž',
  46925. 'Ô¡' => 'Ô ',
  46926. 'Ô£' => 'Ô¢',
  46927. 'Ô¥' => 'Ô¤',
  46928. 'Ô§' => 'Ô¦',
  46929. 'Ô©' => 'Ô¨',
  46930. 'Ô«' => 'Ôª',
  46931. 'Ô­' => 'Ô¬',
  46932. 'Ô¯' => 'Ô®',
  46933. 'Õ¡' => 'Ô±',
  46934. 'Õ¢' => 'Ô²',
  46935. 'Õ£' => 'Ô³',
  46936. 'Õ¤' => 'Ô´',
  46937. 'Õ¥' => 'Ôµ',
  46938. 'Õ¦' => 'Ô¶',
  46939. 'Õ§' => 'Ô·',
  46940. 'Õ¨' => 'Ô¸',
  46941. 'Õ©' => 'Ô¹',
  46942. 'Õª' => 'Ôº',
  46943. 'Õ«' => 'Ô»',
  46944. 'Õ¬' => 'Ô¼',
  46945. 'Õ­' => 'Ô½',
  46946. 'Õ®' => 'Ô¾',
  46947. 'Õ¯' => 'Ô¿',
  46948. 'Õ°' => 'Õ€',
  46949. 'Õ±' => 'Õ�',
  46950. 'Õ²' => 'Õ‚',
  46951. 'Õ³' => 'Õƒ',
  46952. 'Õ´' => 'Õ„',
  46953. 'Õµ' => 'Õ…',
  46954. 'Õ¶' => 'Õ†',
  46955. 'Õ·' => 'Õ‡',
  46956. 'Õ¸' => 'Õˆ',
  46957. 'Õ¹' => 'Õ‰',
  46958. 'Õº' => 'ÕŠ',
  46959. 'Õ»' => 'Õ‹',
  46960. 'ռ' => 'Ռ',
  46961. 'Õ½' => 'Õ�',
  46962. 'Õ¾' => 'ÕŽ',
  46963. 'Õ¿' => 'Õ�',
  46964. 'Ö€' => 'Õ�',
  46965. 'Ö�' => 'Õ‘',
  46966. 'Ö‚' => 'Õ’',
  46967. 'Öƒ' => 'Õ“',
  46968. 'Ö„' => 'Õ”',
  46969. 'Ö…' => 'Õ•',
  46970. 'Ö†' => 'Õ–',
  46971. '�' => '�',
  46972. 'ბ' => 'Ბ',
  46973. 'გ' => 'Გ',
  46974. 'დ' => 'Დ',
  46975. 'ე' => 'Ე',
  46976. 'ვ' => 'Ვ',
  46977. 'ზ' => 'Ზ',
  46978. 'თ' => 'Თ',
  46979. 'ი' => 'Ი',
  46980. 'კ' => 'Კ',
  46981. 'ლ' => 'Ლ',
  46982. 'მ' => 'Მ',
  46983. 'ნ' => 'Ნ',
  46984. '�' => '�',
  46985. 'პ' => 'Პ',
  46986. 'ჟ' => 'Ჟ',
  46987. 'რ' => 'Რ',
  46988. 'ს' => 'Ს',
  46989. 'ტ' => 'Ტ',
  46990. 'უ' => 'Უ',
  46991. 'ფ' => 'Ფ',
  46992. 'ქ' => 'Ქ',
  46993. 'ღ' => 'Ღ',
  46994. 'ყ' => 'Ყ',
  46995. 'შ' => 'Შ',
  46996. 'ჩ' => 'Ჩ',
  46997. 'ც' => 'Ც',
  46998. 'ძ' => 'Ძ',
  46999. 'წ' => 'Წ',
  47000. 'ჭ' => 'Ჭ',
  47001. 'ხ' => 'Ხ',
  47002. 'ჯ' => 'Ჯ',
  47003. 'ჰ' => 'Ჰ',
  47004. 'ჱ' => 'Ჱ',
  47005. 'ჲ' => 'Ჲ',
  47006. 'ჳ' => 'Ჳ',
  47007. 'ჴ' => 'Ჴ',
  47008. 'ჵ' => 'Ჵ',
  47009. 'ჶ' => 'Ჶ',
  47010. 'ჷ' => 'Ჷ',
  47011. 'ჸ' => 'Ჸ',
  47012. 'ჹ' => 'Ჹ',
  47013. 'ჺ' => 'Ჺ',
  47014. 'ჽ' => 'Ჽ',
  47015. 'ჾ' => 'Ჾ',
  47016. 'ჿ' => 'Ჿ',
  47017. '�' => '�',
  47018. '�' => '�',
  47019. '�' => '�',
  47020. '�' => '�',
  47021. '�' => '�',
  47022. '�' => '�',
  47023. 'á²€' => 'Ð’',
  47024. '�' => 'Д',
  47025. 'ᲂ' => 'О',
  47026. 'ᲃ' => 'С',
  47027. 'ᲄ' => 'Т',
  47028. 'ᲅ' => 'Т',
  47029. 'ᲆ' => 'Ъ',
  47030. 'ᲇ' => 'Ѣ',
  47031. 'ᲈ' => 'Ꙋ',
  47032. 'ᵹ' => '�',
  47033. 'áµ½' => 'â±£',
  47034. 'ᶎ' => 'Ᶎ',
  47035. '�' => 'Ḁ',
  47036. 'ḃ' => 'Ḃ',
  47037. 'ḅ' => 'Ḅ',
  47038. 'ḇ' => 'Ḇ',
  47039. 'ḉ' => 'Ḉ',
  47040. 'ḋ' => 'Ḋ',
  47041. '�' => 'Ḍ',
  47042. '�' => 'Ḏ',
  47043. 'ḑ' => '�',
  47044. 'ḓ' => 'Ḓ',
  47045. 'ḕ' => 'Ḕ',
  47046. 'ḗ' => 'Ḗ',
  47047. 'ḙ' => 'Ḙ',
  47048. 'ḛ' => 'Ḛ',
  47049. '�' => 'Ḝ',
  47050. 'ḟ' => 'Ḟ',
  47051. 'ḡ' => 'Ḡ',
  47052. 'ḣ' => 'Ḣ',
  47053. 'ḥ' => 'Ḥ',
  47054. 'ḧ' => 'Ḧ',
  47055. 'ḩ' => 'Ḩ',
  47056. 'ḫ' => 'Ḫ',
  47057. 'ḭ' => 'Ḭ',
  47058. 'ḯ' => 'Ḯ',
  47059. 'ḱ' => 'Ḱ',
  47060. 'ḳ' => 'Ḳ',
  47061. 'ḵ' => 'Ḵ',
  47062. 'ḷ' => 'Ḷ',
  47063. 'ḹ' => 'Ḹ',
  47064. 'ḻ' => 'Ḻ',
  47065. 'ḽ' => 'Ḽ',
  47066. 'ḿ' => 'Ḿ',
  47067. '�' => 'Ṁ',
  47068. 'ṃ' => 'Ṃ',
  47069. 'ṅ' => 'Ṅ',
  47070. 'ṇ' => 'Ṇ',
  47071. 'ṉ' => 'Ṉ',
  47072. 'ṋ' => 'Ṋ',
  47073. '�' => 'Ṍ',
  47074. '�' => 'Ṏ',
  47075. 'ṑ' => '�',
  47076. 'ṓ' => 'Ṓ',
  47077. 'ṕ' => 'Ṕ',
  47078. 'á¹—' => 'á¹–',
  47079. 'ṙ' => 'Ṙ',
  47080. 'ṛ' => 'Ṛ',
  47081. '�' => 'Ṝ',
  47082. 'ṟ' => 'Ṟ',
  47083. 'ṡ' => 'Ṡ',
  47084. 'á¹£' => 'á¹¢',
  47085. 'ṥ' => 'Ṥ',
  47086. 'ṧ' => 'Ṧ',
  47087. 'ṩ' => 'Ṩ',
  47088. 'ṫ' => 'Ṫ',
  47089. 'ṭ' => 'Ṭ',
  47090. 'ṯ' => 'Ṯ',
  47091. 'á¹±' => 'á¹°',
  47092. 'á¹³' => 'á¹²',
  47093. 'á¹µ' => 'á¹´',
  47094. 'ṷ' => 'Ṷ',
  47095. 'ṹ' => 'Ṹ',
  47096. 'ṻ' => 'Ṻ',
  47097. 'á¹½' => 'á¹¼',
  47098. 'ṿ' => 'Ṿ',
  47099. '�' => 'Ẁ',
  47100. 'ẃ' => 'Ẃ',
  47101. 'ẅ' => 'Ẅ',
  47102. 'ẇ' => 'Ẇ',
  47103. 'ẉ' => 'Ẉ',
  47104. 'ẋ' => 'Ẋ',
  47105. '�' => 'Ẍ',
  47106. '�' => 'Ẏ',
  47107. 'ẑ' => '�',
  47108. 'ẓ' => 'Ẓ',
  47109. 'ẕ' => 'Ẕ',
  47110. 'ẛ' => 'Ṡ',
  47111. 'ạ' => 'Ạ',
  47112. 'ả' => 'Ả',
  47113. 'ấ' => 'Ấ',
  47114. 'ầ' => 'Ầ',
  47115. 'ẩ' => 'Ẩ',
  47116. 'ẫ' => 'Ẫ',
  47117. 'ậ' => 'Ậ',
  47118. 'ắ' => 'Ắ',
  47119. 'ằ' => 'Ằ',
  47120. 'ẳ' => 'Ẳ',
  47121. 'ẵ' => 'Ẵ',
  47122. 'ặ' => 'Ặ',
  47123. 'ẹ' => 'Ẹ',
  47124. 'ẻ' => 'Ẻ',
  47125. 'ẽ' => 'Ẽ',
  47126. 'ế' => 'Ế',
  47127. '�' => 'Ề',
  47128. 'ể' => 'Ể',
  47129. 'ễ' => 'Ễ',
  47130. 'ệ' => 'Ệ',
  47131. 'ỉ' => 'Ỉ',
  47132. 'ị' => 'Ị',
  47133. '�' => 'Ọ',
  47134. '�' => 'Ỏ',
  47135. 'ố' => '�',
  47136. 'ồ' => 'Ồ',
  47137. 'ổ' => 'Ổ',
  47138. 'á»—' => 'á»–',
  47139. 'ộ' => 'Ộ',
  47140. 'ớ' => 'Ớ',
  47141. '�' => 'Ờ',
  47142. 'ở' => 'Ở',
  47143. 'ỡ' => 'Ỡ',
  47144. 'ợ' => 'Ợ',
  47145. 'ụ' => 'Ụ',
  47146. 'ủ' => 'Ủ',
  47147. 'ứ' => 'Ứ',
  47148. 'ừ' => 'Ừ',
  47149. 'ử' => 'Ử',
  47150. 'ữ' => 'Ữ',
  47151. 'á»±' => 'á»°',
  47152. 'ỳ' => 'Ỳ',
  47153. 'ỵ' => 'Ỵ',
  47154. 'ỷ' => 'Ỷ',
  47155. 'ỹ' => 'Ỹ',
  47156. 'ỻ' => 'Ỻ',
  47157. 'ỽ' => 'Ỽ',
  47158. 'ỿ' => 'Ỿ',
  47159. 'ἀ' => 'Ἀ',
  47160. '�' => 'Ἁ',
  47161. 'ἂ' => 'Ἂ',
  47162. 'ἃ' => 'Ἃ',
  47163. 'ἄ' => 'Ἄ',
  47164. 'ἅ' => '�',
  47165. 'ἆ' => 'Ἆ',
  47166. 'ἇ' => '�',
  47167. '�' => 'Ἐ',
  47168. 'ἑ' => 'Ἑ',
  47169. 'ἒ' => 'Ἒ',
  47170. 'ἓ' => 'Ἓ',
  47171. 'ἔ' => 'Ἔ',
  47172. 'ἕ' => '�',
  47173. 'ἠ' => 'Ἠ',
  47174. 'ἡ' => 'Ἡ',
  47175. 'ἢ' => 'Ἢ',
  47176. 'ἣ' => 'Ἣ',
  47177. 'ἤ' => 'Ἤ',
  47178. 'á¼¥' => 'á¼­',
  47179. 'ἦ' => 'Ἦ',
  47180. 'ἧ' => 'Ἧ',
  47181. 'ἰ' => 'Ἰ',
  47182. 'á¼±' => 'á¼¹',
  47183. 'ἲ' => 'Ἲ',
  47184. 'á¼³' => 'á¼»',
  47185. 'á¼´' => 'á¼¼',
  47186. 'á¼µ' => 'á¼½',
  47187. 'ἶ' => 'Ἶ',
  47188. 'ἷ' => 'Ἷ',
  47189. 'ὀ' => 'Ὀ',
  47190. '�' => 'Ὁ',
  47191. 'ὂ' => 'Ὂ',
  47192. 'ὃ' => 'Ὃ',
  47193. 'ὄ' => 'Ὄ',
  47194. 'ὅ' => '�',
  47195. 'ὑ' => 'Ὑ',
  47196. 'ὓ' => 'Ὓ',
  47197. 'ὕ' => '�',
  47198. 'ὗ' => 'Ὗ',
  47199. 'ὠ' => 'Ὠ',
  47200. 'ὡ' => 'Ὡ',
  47201. 'ὢ' => 'Ὢ',
  47202. 'ὣ' => 'Ὣ',
  47203. 'ὤ' => 'Ὤ',
  47204. 'á½¥' => 'á½­',
  47205. 'ὦ' => 'Ὦ',
  47206. 'ὧ' => 'Ὧ',
  47207. 'ὰ' => 'Ὰ',
  47208. 'á½±' => 'á¾»',
  47209. 'ὲ' => 'Ὲ',
  47210. 'έ' => 'Έ',
  47211. 'á½´' => 'á¿Š',
  47212. 'á½µ' => 'á¿‹',
  47213. 'ὶ' => 'Ὶ',
  47214. 'á½·' => 'á¿›',
  47215. 'ὸ' => 'Ὸ',
  47216. 'ό' => 'Ό',
  47217. 'ὺ' => 'Ὺ',
  47218. 'á½»' => 'á¿«',
  47219. 'ὼ' => 'Ὼ',
  47220. 'á½½' => 'á¿»',
  47221. 'ᾀ' => 'ᾈ',
  47222. '�' => 'ᾉ',
  47223. 'ᾂ' => 'ᾊ',
  47224. 'ᾃ' => 'ᾋ',
  47225. 'ᾄ' => 'ᾌ',
  47226. 'ᾅ' => '�',
  47227. 'ᾆ' => 'ᾎ',
  47228. 'ᾇ' => '�',
  47229. '�' => 'ᾘ',
  47230. 'ᾑ' => 'ᾙ',
  47231. 'ᾒ' => 'ᾚ',
  47232. 'ᾓ' => 'ᾛ',
  47233. 'ᾔ' => 'ᾜ',
  47234. 'ᾕ' => '�',
  47235. 'ᾖ' => 'ᾞ',
  47236. 'ᾗ' => 'ᾟ',
  47237. 'ᾠ' => 'ᾨ',
  47238. 'ᾡ' => 'ᾩ',
  47239. 'ᾢ' => 'ᾪ',
  47240. 'ᾣ' => 'ᾫ',
  47241. 'ᾤ' => 'ᾬ',
  47242. 'á¾¥' => 'á¾­',
  47243. 'ᾦ' => 'ᾮ',
  47244. 'ᾧ' => 'ᾯ',
  47245. 'ᾰ' => 'Ᾰ',
  47246. 'á¾±' => 'á¾¹',
  47247. 'á¾³' => 'á¾¼',
  47248. 'ι' => 'Ι',
  47249. 'ῃ' => 'ῌ',
  47250. '�' => 'Ῐ',
  47251. 'á¿‘' => 'á¿™',
  47252. 'ῠ' => 'Ῠ',
  47253. 'á¿¡' => 'á¿©',
  47254. 'ῥ' => 'Ῥ',
  47255. 'ῳ' => 'ῼ',
  47256. 'ⅎ' => 'Ⅎ',
  47257. 'â…°' => 'â… ',
  47258. 'â…±' => 'â…¡',
  47259. 'â…²' => 'â…¢',
  47260. 'â…³' => 'â…£',
  47261. 'â…´' => 'â…¤',
  47262. 'â…µ' => 'â…¥',
  47263. 'â…¶' => 'â…¦',
  47264. 'â…·' => 'â…§',
  47265. 'â…¸' => 'â…¨',
  47266. 'â…¹' => 'â…©',
  47267. 'â…º' => 'â…ª',
  47268. 'â…»' => 'â…«',
  47269. 'â…¼' => 'â…¬',
  47270. 'â…½' => 'â…­',
  47271. 'â…¾' => 'â…®',
  47272. 'â…¿' => 'â…¯',
  47273. 'ↄ' => 'Ↄ',
  47274. '�' => 'Ⓐ',
  47275. 'â“‘' => 'â’·',
  47276. 'â“’' => 'â’¸',
  47277. 'â““' => 'â’¹',
  47278. 'â“”' => 'â’º',
  47279. 'â“•' => 'â’»',
  47280. 'â“–' => 'â’¼',
  47281. 'â“—' => 'â’½',
  47282. 'ⓘ' => 'Ⓘ',
  47283. 'â“™' => 'â’¿',
  47284. 'â“š' => 'â“€',
  47285. 'ⓛ' => '�',
  47286. 'ⓜ' => 'Ⓜ',
  47287. '�' => 'Ⓝ',
  47288. 'â“ž' => 'â“„',
  47289. 'â“Ÿ' => 'â“…',
  47290. 'ⓠ' => 'Ⓠ',
  47291. 'ⓡ' => 'Ⓡ',
  47292. 'ⓢ' => 'Ⓢ',
  47293. 'ⓣ' => 'Ⓣ',
  47294. 'ⓤ' => 'Ⓤ',
  47295. 'â“¥' => 'â“‹',
  47296. 'ⓦ' => 'Ⓦ',
  47297. 'ⓧ' => '�',
  47298. 'ⓨ' => 'Ⓨ',
  47299. 'ⓩ' => '�',
  47300. 'â°°' => 'â°€',
  47301. 'â°±' => 'â°�',
  47302. 'â°²' => 'â°‚',
  47303. 'â°³' => 'â°ƒ',
  47304. 'â°´' => 'â°„',
  47305. 'â°µ' => 'â°…',
  47306. 'â°¶' => 'â°†',
  47307. 'â°·' => 'â°‡',
  47308. 'â°¸' => 'â°ˆ',
  47309. 'â°¹' => 'â°‰',
  47310. 'â°º' => 'â°Š',
  47311. 'â°»' => 'â°‹',
  47312. 'ⰼ' => 'Ⰼ',
  47313. 'â°½' => 'â°�',
  47314. 'â°¾' => 'â°Ž',
  47315. 'â°¿' => 'â°�',
  47316. 'â±€' => 'â°�',
  47317. '�' => 'Ⱁ',
  47318. 'ⱂ' => 'Ⱂ',
  47319. 'ⱃ' => 'Ⱃ',
  47320. 'ⱄ' => 'Ⱄ',
  47321. 'â±…' => 'â°•',
  47322. 'ⱆ' => 'Ⱆ',
  47323. 'ⱇ' => 'Ⱇ',
  47324. 'ⱈ' => 'Ⱈ',
  47325. 'ⱉ' => 'Ⱉ',
  47326. 'ⱊ' => 'Ⱊ',
  47327. 'ⱋ' => 'Ⱋ',
  47328. 'ⱌ' => 'Ⱌ',
  47329. '�' => '�',
  47330. 'ⱎ' => 'Ⱎ',
  47331. '�' => 'Ⱏ',
  47332. '�' => 'Ⱐ',
  47333. 'ⱑ' => 'Ⱑ',
  47334. 'â±’' => 'â°¢',
  47335. 'ⱓ' => 'Ⱓ',
  47336. 'â±”' => 'â°¤',
  47337. 'ⱕ' => 'Ⱕ',
  47338. 'â±–' => 'â°¦',
  47339. 'â±—' => 'â°§',
  47340. 'ⱘ' => 'Ⱘ',
  47341. 'â±™' => 'â°©',
  47342. 'ⱚ' => 'Ⱚ',
  47343. 'â±›' => 'â°«',
  47344. 'ⱜ' => 'Ⱜ',
  47345. '�' => 'Ⱝ',
  47346. 'ⱞ' => 'Ⱞ',
  47347. 'ⱡ' => 'Ⱡ',
  47348. 'ⱥ' => 'Ⱥ',
  47349. 'ⱦ' => 'Ⱦ',
  47350. 'ⱨ' => 'Ⱨ',
  47351. 'ⱪ' => 'Ⱪ',
  47352. 'ⱬ' => 'Ⱬ',
  47353. 'â±³' => 'â±²',
  47354. 'ⱶ' => 'Ⱶ',
  47355. '�' => 'Ⲁ',
  47356. 'ⲃ' => 'Ⲃ',
  47357. 'ⲅ' => 'Ⲅ',
  47358. 'ⲇ' => 'Ⲇ',
  47359. 'ⲉ' => 'Ⲉ',
  47360. 'ⲋ' => 'Ⲋ',
  47361. '�' => 'Ⲍ',
  47362. '�' => 'Ⲏ',
  47363. 'ⲑ' => '�',
  47364. 'ⲓ' => 'Ⲓ',
  47365. 'ⲕ' => 'Ⲕ',
  47366. 'â²—' => 'â²–',
  47367. 'ⲙ' => 'Ⲙ',
  47368. 'ⲛ' => 'Ⲛ',
  47369. '�' => 'Ⲝ',
  47370. 'ⲟ' => 'Ⲟ',
  47371. 'ⲡ' => 'Ⲡ',
  47372. 'â²£' => 'â²¢',
  47373. 'ⲥ' => 'Ⲥ',
  47374. 'ⲧ' => 'Ⲧ',
  47375. 'ⲩ' => 'Ⲩ',
  47376. 'ⲫ' => 'Ⲫ',
  47377. 'ⲭ' => 'Ⲭ',
  47378. 'ⲯ' => 'Ⲯ',
  47379. 'â²±' => 'â²°',
  47380. 'â²³' => 'â²²',
  47381. 'â²µ' => 'â²´',
  47382. 'ⲷ' => 'Ⲷ',
  47383. 'ⲹ' => 'Ⲹ',
  47384. 'ⲻ' => 'Ⲻ',
  47385. 'â²½' => 'â²¼',
  47386. 'ⲿ' => 'Ⲿ',
  47387. '�' => 'Ⳁ',
  47388. 'ⳃ' => 'Ⳃ',
  47389. 'ⳅ' => 'Ⳅ',
  47390. 'ⳇ' => 'Ⳇ',
  47391. 'ⳉ' => 'Ⳉ',
  47392. 'ⳋ' => 'Ⳋ',
  47393. '�' => 'Ⳍ',
  47394. '�' => 'Ⳏ',
  47395. 'ⳑ' => '�',
  47396. 'ⳓ' => 'Ⳓ',
  47397. 'ⳕ' => 'Ⳕ',
  47398. 'â³—' => 'â³–',
  47399. 'ⳙ' => 'Ⳙ',
  47400. 'ⳛ' => 'Ⳛ',
  47401. '�' => 'Ⳝ',
  47402. 'ⳟ' => 'Ⳟ',
  47403. 'ⳡ' => 'Ⳡ',
  47404. 'â³£' => 'â³¢',
  47405. 'ⳬ' => 'Ⳬ',
  47406. 'â³®' => 'â³­',
  47407. 'â³³' => 'â³²',
  47408. 'â´€' => 'á‚ ',
  47409. 'â´�' => 'á‚¡',
  47410. 'â´‚' => 'á‚¢',
  47411. 'â´ƒ' => 'á‚£',
  47412. 'ⴄ' => 'Ⴄ',
  47413. 'â´…' => 'á‚¥',
  47414. 'ⴆ' => 'Ⴆ',
  47415. 'ⴇ' => 'Ⴇ',
  47416. 'ⴈ' => 'Ⴈ',
  47417. 'â´‰' => 'á‚©',
  47418. 'ⴊ' => 'Ⴊ',
  47419. 'â´‹' => 'á‚«',
  47420. 'ⴌ' => 'Ⴌ',
  47421. 'â´�' => 'á‚­',
  47422. 'â´Ž' => 'á‚®',
  47423. '�' => 'Ⴏ',
  47424. 'â´�' => 'á‚°',
  47425. 'ⴑ' => 'Ⴑ',
  47426. 'ⴒ' => 'Ⴒ',
  47427. 'ⴓ' => 'Ⴓ',
  47428. 'â´”' => 'á‚´',
  47429. 'ⴕ' => 'Ⴕ',
  47430. 'ⴖ' => 'Ⴖ',
  47431. 'â´—' => 'á‚·',
  47432. 'ⴘ' => 'Ⴘ',
  47433. 'ⴙ' => 'Ⴙ',
  47434. 'ⴚ' => 'Ⴚ',
  47435. 'â´›' => 'á‚»',
  47436. 'ⴜ' => 'Ⴜ',
  47437. '�' => 'Ⴝ',
  47438. 'ⴞ' => 'Ⴞ',
  47439. 'â´Ÿ' => 'á‚¿',
  47440. 'ⴠ' => 'Ⴠ',
  47441. 'ⴡ' => '�',
  47442. 'ⴢ' => 'Ⴢ',
  47443. 'ⴣ' => 'Ⴣ',
  47444. 'ⴤ' => 'Ⴤ',
  47445. 'ⴥ' => 'Ⴥ',
  47446. 'ⴧ' => 'Ⴧ',
  47447. 'ⴭ' => '�',
  47448. '�' => 'Ꙁ',
  47449. 'ꙃ' => 'Ꙃ',
  47450. 'ꙅ' => 'Ꙅ',
  47451. 'ꙇ' => 'Ꙇ',
  47452. 'ꙉ' => 'Ꙉ',
  47453. 'ꙋ' => 'Ꙋ',
  47454. '�' => 'Ꙍ',
  47455. '�' => 'Ꙏ',
  47456. 'ꙑ' => '�',
  47457. 'ꙓ' => 'Ꙓ',
  47458. 'ꙕ' => 'Ꙕ',
  47459. 'ê™—' => 'ê™–',
  47460. 'ꙙ' => 'Ꙙ',
  47461. 'ꙛ' => 'Ꙛ',
  47462. '�' => 'Ꙝ',
  47463. 'ꙟ' => 'Ꙟ',
  47464. 'ꙡ' => 'Ꙡ',
  47465. 'ꙣ' => 'Ꙣ',
  47466. 'ꙥ' => 'Ꙥ',
  47467. 'ꙧ' => 'Ꙧ',
  47468. 'ꙩ' => 'Ꙩ',
  47469. 'ꙫ' => 'Ꙫ',
  47470. 'ꙭ' => 'Ꙭ',
  47471. '�' => 'Ꚁ',
  47472. 'ꚃ' => 'Ꚃ',
  47473. 'êš…' => 'êš„',
  47474. 'ꚇ' => 'Ꚇ',
  47475. 'ꚉ' => 'Ꚉ',
  47476. 'ꚋ' => 'Ꚋ',
  47477. '�' => 'Ꚍ',
  47478. '�' => 'Ꚏ',
  47479. 'ꚑ' => '�',
  47480. 'êš“' => 'êš’',
  47481. 'êš•' => 'êš”',
  47482. 'êš—' => 'êš–',
  47483. 'ꚙ' => 'Ꚙ',
  47484. 'êš›' => 'êšš',
  47485. 'ꜣ' => 'Ꜣ',
  47486. 'ꜥ' => 'Ꜥ',
  47487. 'ꜧ' => 'Ꜧ',
  47488. 'ꜩ' => 'Ꜩ',
  47489. 'ꜫ' => 'Ꜫ',
  47490. 'ꜭ' => 'Ꜭ',
  47491. 'ꜯ' => 'Ꜯ',
  47492. 'ꜳ' => 'Ꜳ',
  47493. 'ꜵ' => 'Ꜵ',
  47494. 'ꜷ' => 'Ꜷ',
  47495. 'ꜹ' => 'Ꜹ',
  47496. 'ꜻ' => 'Ꜻ',
  47497. 'ꜽ' => 'Ꜽ',
  47498. 'ꜿ' => 'Ꜿ',
  47499. '�' => '�',
  47500. '�' => '�',
  47501. '�' => '�',
  47502. '�' => '�',
  47503. '�' => '�',
  47504. '�' => '�',
  47505. '�' => '�',
  47506. '�' => '�',
  47507. '�' => '�',
  47508. '�' => '�',
  47509. '�' => '�',
  47510. '�' => '�',
  47511. '�' => '�',
  47512. '�' => '�',
  47513. '�' => '�',
  47514. '�' => '�',
  47515. '�' => '�',
  47516. '�' => '�',
  47517. '�' => '�',
  47518. '�' => '�',
  47519. '�' => '�',
  47520. '�' => '�',
  47521. '�' => '�',
  47522. '�' => '�',
  47523. '�' => '�',
  47524. '�' => '�',
  47525. '�' => '�',
  47526. '�' => 'Ꞁ',
  47527. 'ꞃ' => 'Ꞃ',
  47528. 'êž…' => 'êž„',
  47529. 'ꞇ' => 'Ꞇ',
  47530. 'ꞌ' => 'Ꞌ',
  47531. 'ꞑ' => '�',
  47532. 'êž“' => 'êž’',
  47533. 'ꞔ' => 'Ꞔ',
  47534. 'êž—' => 'êž–',
  47535. 'ꞙ' => 'Ꞙ',
  47536. 'êž›' => 'êžš',
  47537. '�' => 'Ꞝ',
  47538. 'ꞟ' => 'Ꞟ',
  47539. 'êž¡' => 'êž ',
  47540. 'ꞣ' => 'Ꞣ',
  47541. 'ꞥ' => 'Ꞥ',
  47542. 'ꞧ' => 'Ꞧ',
  47543. 'ꞩ' => 'Ꞩ',
  47544. 'êžµ' => 'êž´',
  47545. 'ꞷ' => 'Ꞷ',
  47546. 'ꞹ' => 'Ꞹ',
  47547. 'ꞻ' => 'Ꞻ',
  47548. 'êž½' => 'êž¼',
  47549. 'êž¿' => 'êž¾',
  47550. 'ꟃ' => 'Ꟃ',
  47551. 'ꟈ' => 'Ꟈ',
  47552. 'ꟊ' => 'Ꟊ',
  47553. 'ꟶ' => 'Ꟶ',
  47554. 'ê­“' => 'êž³',
  47555. 'ꭰ' => 'Ꭰ',
  47556. 'ꭱ' => 'Ꭱ',
  47557. 'ꭲ' => 'Ꭲ',
  47558. 'ꭳ' => 'Ꭳ',
  47559. 'ꭴ' => 'Ꭴ',
  47560. 'ꭵ' => 'Ꭵ',
  47561. 'ꭶ' => 'Ꭶ',
  47562. 'ꭷ' => 'Ꭷ',
  47563. 'ꭸ' => 'Ꭸ',
  47564. 'ꭹ' => 'Ꭹ',
  47565. 'ꭺ' => 'Ꭺ',
  47566. 'ꭻ' => 'Ꭻ',
  47567. 'ꭼ' => 'Ꭼ',
  47568. 'ꭽ' => 'Ꭽ',
  47569. 'ꭾ' => 'Ꭾ',
  47570. 'ꭿ' => 'Ꭿ',
  47571. 'ꮀ' => 'Ꮀ',
  47572. '�' => 'Ꮁ',
  47573. 'ꮂ' => 'Ꮂ',
  47574. 'ꮃ' => 'Ꮃ',
  47575. 'ꮄ' => 'Ꮄ',
  47576. 'ꮅ' => 'Ꮅ',
  47577. 'ꮆ' => 'Ꮆ',
  47578. 'ꮇ' => 'Ꮇ',
  47579. 'ꮈ' => 'Ꮈ',
  47580. 'ꮉ' => 'Ꮉ',
  47581. 'ꮊ' => 'Ꮊ',
  47582. 'ꮋ' => 'Ꮋ',
  47583. 'ꮌ' => 'Ꮌ',
  47584. '�' => 'Ꮍ',
  47585. 'ꮎ' => 'Ꮎ',
  47586. '�' => 'Ꮏ',
  47587. '�' => '�',
  47588. 'ꮑ' => '�',
  47589. 'ꮒ' => '�',
  47590. 'ꮓ' => '�',
  47591. 'ꮔ' => '�',
  47592. 'ꮕ' => '�',
  47593. 'ꮖ' => '�',
  47594. 'ꮗ' => '�',
  47595. 'ꮘ' => '�',
  47596. 'ꮙ' => '�',
  47597. 'ꮚ' => '�',
  47598. 'ꮛ' => '�',
  47599. 'ꮜ' => '�',
  47600. '�' => '�',
  47601. 'ꮞ' => '�',
  47602. 'ꮟ' => '�',
  47603. 'ꮠ' => '�',
  47604. 'ꮡ' => '�',
  47605. 'ꮢ' => '�',
  47606. 'ꮣ' => '�',
  47607. 'ꮤ' => '�',
  47608. 'ꮥ' => '�',
  47609. 'ꮦ' => '�',
  47610. 'ꮧ' => '�',
  47611. 'ꮨ' => '�',
  47612. 'ꮩ' => '�',
  47613. 'ꮪ' => '�',
  47614. 'ꮫ' => '�',
  47615. 'ꮬ' => '�',
  47616. 'ꮭ' => '�',
  47617. 'ꮮ' => '�',
  47618. 'ꮯ' => '�',
  47619. 'ꮰ' => '�',
  47620. 'ꮱ' => '�',
  47621. 'ꮲ' => '�',
  47622. 'ꮳ' => '�',
  47623. 'ꮴ' => '�',
  47624. 'ꮵ' => '�',
  47625. 'ꮶ' => '�',
  47626. 'ꮷ' => '�',
  47627. 'ꮸ' => '�',
  47628. 'ꮹ' => '�',
  47629. 'ꮺ' => '�',
  47630. 'ꮻ' => '�',
  47631. 'ꮼ' => '�',
  47632. 'ꮽ' => '�',
  47633. 'ꮾ' => '�',
  47634. 'ꮿ' => '�',
  47635. '�' => 'A',
  47636. 'b' => 'B',
  47637. 'c' => 'C',
  47638. 'd' => 'D',
  47639. 'ï½…' => 'ï¼¥',
  47640. 'f' => 'F',
  47641. 'g' => 'G',
  47642. 'h' => 'H',
  47643. 'i' => 'I',
  47644. 'j' => 'J',
  47645. 'k' => 'K',
  47646. 'l' => 'L',
  47647. '�' => 'M',
  47648. 'n' => 'N',
  47649. '�' => 'O',
  47650. '�' => 'P',
  47651. 'q' => 'Q',
  47652. 'ï½’' => 'ï¼²',
  47653. 's' => 'S',
  47654. 'ï½”' => 'ï¼´',
  47655. 'u' => 'U',
  47656. 'v' => 'V',
  47657. 'ï½—' => 'ï¼·',
  47658. 'x' => 'X',
  47659. 'ï½™' => 'ï¼¹',
  47660. 'z' => 'Z',
  47661. '�' => '�',
  47662. '�' => '�',
  47663. '�' => '�',
  47664. '�' => '�',
  47665. '�' => '�',
  47666. '�' => '�',
  47667. '�' => '�',
  47668. '�' => '�',
  47669. '�' => '�',
  47670. '�' => '�',
  47671. '�' => '�',
  47672. '�' => '�',
  47673. '�' => '�',
  47674. '�' => '�',
  47675. '�' => '�',
  47676. '�' => '�',
  47677. '�' => '�',
  47678. '�' => '�',
  47679. '�' => '�',
  47680. '�' => '�',
  47681. '�' => '�',
  47682. '�' => '�',
  47683. '�' => '�',
  47684. '�' => '�',
  47685. '�' => '�',
  47686. '�' => '�',
  47687. '�' => '�',
  47688. '�' => '�',
  47689. '�' => '�',
  47690. '�' => '�',
  47691. '�' => '�',
  47692. '�' => '�',
  47693. '�' => '�',
  47694. '�' => '�',
  47695. '�' => '�',
  47696. '�' => '�',
  47697. '�' => '�',
  47698. '�' => '�',
  47699. '�' => '�',
  47700. '�' => '�',
  47701. '�' => '�',
  47702. '�' => '�',
  47703. '�' => '�',
  47704. '�' => '�',
  47705. '�' => '�',
  47706. '�' => '�',
  47707. '�' => '�',
  47708. '�' => '�',
  47709. '�' => '�',
  47710. '�' => '�',
  47711. '�' => '�',
  47712. '�' => '�',
  47713. '�' => '�',
  47714. '�' => '�',
  47715. '�' => '�',
  47716. '�' => '�',
  47717. '�' => '�',
  47718. '�' => '�',
  47719. '�' => '�',
  47720. '�' => '�',
  47721. '�' => '�',
  47722. '�' => '�',
  47723. '�' => '�',
  47724. '�' => '�',
  47725. '�' => '�',
  47726. '�' => '�',
  47727. '�' => '�',
  47728. '�' => '�',
  47729. '�' => '�',
  47730. '�' => '�',
  47731. '�' => '�',
  47732. '�' => '�',
  47733. '�' => '�',
  47734. '�' => '�',
  47735. '�' => '�',
  47736. '�' => '�',
  47737. '�' => '�',
  47738. '�' => '�',
  47739. '�' => '�',
  47740. '�' => '�',
  47741. '�' => '�',
  47742. '�' => '�',
  47743. '�' => '�',
  47744. '�' => '�',
  47745. '�' => '�',
  47746. '�' => '�',
  47747. '�' => '�',
  47748. '�' => '�',
  47749. '�' => '�',
  47750. '�' => '�',
  47751. '�' => '�',
  47752. '�' => '�',
  47753. '�' => '�',
  47754. '�' => '�',
  47755. '�' => '�',
  47756. '�' => '�',
  47757. '�' => '�',
  47758. '�' => '�',
  47759. '�' => '�',
  47760. '�' => '�',
  47761. '�' => '�',
  47762. '�' => '�',
  47763. '�' => '�',
  47764. '�' => '�',
  47765. '�' => '�',
  47766. '�' => '�',
  47767. '�' => '�',
  47768. '�' => '�',
  47769. '�' => '�',
  47770. '�' => '�',
  47771. '�' => '�',
  47772. '�' => '�',
  47773. '�' => '�',
  47774. '�' => '�',
  47775. '�' => '�',
  47776. '�' => '�',
  47777. '�' => '�',
  47778. '�' => '�',
  47779. '�' => '�',
  47780. '�' => '�',
  47781. '�' => '�',
  47782. '�' => '�',
  47783. '�' => '�',
  47784. '�' => '�',
  47785. '�' => '�',
  47786. '�' => '�',
  47787. '�' => '�',
  47788. 'ð‘£€' => 'ð‘¢ ',
  47789. '�' => '𑢡',
  47790. '𑣂' => '𑢢',
  47791. '𑣃' => '𑢣',
  47792. '𑣄' => '𑢤',
  47793. 'ð‘£…' => 'ð‘¢¥',
  47794. '𑣆' => '𑢦',
  47795. '𑣇' => '𑢧',
  47796. '𑣈' => '𑢨',
  47797. '𑣉' => '𑢩',
  47798. '𑣊' => '𑢪',
  47799. '𑣋' => '𑢫',
  47800. '𑣌' => '𑢬',
  47801. '�' => '𑢭',
  47802. '𑣎' => '𑢮',
  47803. '�' => '𑢯',
  47804. '�' => '𑢰',
  47805. '𑣑' => '𑢱',
  47806. 'ð‘£’' => 'ð‘¢²',
  47807. '𑣓' => '𑢳',
  47808. 'ð‘£”' => 'ð‘¢´',
  47809. '𑣕' => '𑢵',
  47810. '𑣖' => '𑢶',
  47811. 'ð‘£—' => 'ð‘¢·',
  47812. '𑣘' => '𑢸',
  47813. 'ð‘£™' => 'ð‘¢¹',
  47814. '𑣚' => '𑢺',
  47815. 'ð‘£›' => 'ð‘¢»',
  47816. '𑣜' => '𑢼',
  47817. '�' => '𑢽',
  47818. '𑣞' => '𑢾',
  47819. '𑣟' => '𑢿',
  47820. 'ð–¹ ' => 'ð–¹€',
  47821. '𖹡' => '�',
  47822. '𖹢' => '𖹂',
  47823. '𖹣' => '𖹃',
  47824. '𖹤' => '𖹄',
  47825. 'ð–¹¥' => 'ð–¹…',
  47826. '𖹦' => '𖹆',
  47827. '𖹧' => '𖹇',
  47828. '𖹨' => '𖹈',
  47829. '𖹩' => '𖹉',
  47830. '𖹪' => '𖹊',
  47831. '𖹫' => '𖹋',
  47832. '𖹬' => '𖹌',
  47833. '𖹭' => '�',
  47834. '𖹮' => '𖹎',
  47835. '𖹯' => '�',
  47836. '𖹰' => '�',
  47837. '𖹱' => '𖹑',
  47838. 'ð–¹²' => 'ð–¹’',
  47839. '𖹳' => '𖹓',
  47840. 'ð–¹´' => 'ð–¹”',
  47841. '𖹵' => '𖹕',
  47842. '𖹶' => '𖹖',
  47843. 'ð–¹·' => 'ð–¹—',
  47844. '𖹸' => '𖹘',
  47845. 'ð–¹¹' => 'ð–¹™',
  47846. '𖹺' => '𖹚',
  47847. 'ð–¹»' => 'ð–¹›',
  47848. '𖹼' => '𖹜',
  47849. '𖹽' => '�',
  47850. '𖹾' => '𖹞',
  47851. '𖹿' => '𖹟',
  47852. '𞤢' => '𞤀',
  47853. '𞤣' => '�',
  47854. '𞤤' => '𞤂',
  47855. '𞤥' => '𞤃',
  47856. '𞤦' => '𞤄',
  47857. '𞤧' => '𞤅',
  47858. '𞤨' => '𞤆',
  47859. '𞤩' => '𞤇',
  47860. '𞤪' => '𞤈',
  47861. '𞤫' => '𞤉',
  47862. '𞤬' => '𞤊',
  47863. '𞤭' => '𞤋',
  47864. '𞤮' => '𞤌',
  47865. '𞤯' => '�',
  47866. '𞤰' => '𞤎',
  47867. '𞤱' => '�',
  47868. '𞤲' => '�',
  47869. '𞤳' => '𞤑',
  47870. '𞤴' => '𞤒',
  47871. '𞤵' => '𞤓',
  47872. '𞤶' => '𞤔',
  47873. '𞤷' => '𞤕',
  47874. '𞤸' => '𞤖',
  47875. '𞤹' => '𞤗',
  47876. '𞤺' => '𞤘',
  47877. '𞤻' => '𞤙',
  47878. '𞤼' => '𞤚',
  47879. '𞤽' => '𞤛',
  47880. '𞤾' => '𞤜',
  47881. '𞤿' => '�',
  47882. '𞥀' => '𞤞',
  47883. '�' => '𞤟',
  47884. '𞥂' => '𞤠',
  47885. '𞥃' => '𞤡',
  47886. );
  47887. <?php
  47888. use Symfony\Polyfill\Mbstring as p;
  47889. if (!function_exists('mb_convert_encoding')) {
  47890. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  47891. }
  47892. if (!function_exists('mb_decode_mimeheader')) {
  47893. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  47894. }
  47895. if (!function_exists('mb_encode_mimeheader')) {
  47896. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  47897. }
  47898. if (!function_exists('mb_decode_numericentity')) {
  47899. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  47900. }
  47901. if (!function_exists('mb_encode_numericentity')) {
  47902. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  47903. }
  47904. if (!function_exists('mb_convert_case')) {
  47905. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  47906. }
  47907. if (!function_exists('mb_internal_encoding')) {
  47908. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  47909. }
  47910. if (!function_exists('mb_language')) {
  47911. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  47912. }
  47913. if (!function_exists('mb_list_encodings')) {
  47914. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  47915. }
  47916. if (!function_exists('mb_encoding_aliases')) {
  47917. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  47918. }
  47919. if (!function_exists('mb_check_encoding')) {
  47920. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  47921. }
  47922. if (!function_exists('mb_detect_encoding')) {
  47923. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  47924. }
  47925. if (!function_exists('mb_detect_order')) {
  47926. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  47927. }
  47928. if (!function_exists('mb_parse_str')) {
  47929. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  47930. }
  47931. if (!function_exists('mb_strlen')) {
  47932. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  47933. }
  47934. if (!function_exists('mb_strpos')) {
  47935. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  47936. }
  47937. if (!function_exists('mb_strtolower')) {
  47938. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  47939. }
  47940. if (!function_exists('mb_strtoupper')) {
  47941. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  47942. }
  47943. if (!function_exists('mb_substitute_character')) {
  47944. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  47945. }
  47946. if (!function_exists('mb_substr')) {
  47947. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  47948. }
  47949. if (!function_exists('mb_stripos')) {
  47950. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  47951. }
  47952. if (!function_exists('mb_stristr')) {
  47953. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  47954. }
  47955. if (!function_exists('mb_strrchr')) {
  47956. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  47957. }
  47958. if (!function_exists('mb_strrichr')) {
  47959. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  47960. }
  47961. if (!function_exists('mb_strripos')) {
  47962. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  47963. }
  47964. if (!function_exists('mb_strrpos')) {
  47965. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  47966. }
  47967. if (!function_exists('mb_strstr')) {
  47968. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  47969. }
  47970. if (!function_exists('mb_get_info')) {
  47971. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  47972. }
  47973. if (!function_exists('mb_http_output')) {
  47974. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  47975. }
  47976. if (!function_exists('mb_strwidth')) {
  47977. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  47978. }
  47979. if (!function_exists('mb_substr_count')) {
  47980. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  47981. }
  47982. if (!function_exists('mb_output_handler')) {
  47983. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  47984. }
  47985. if (!function_exists('mb_http_input')) {
  47986. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  47987. }
  47988. if (!function_exists('mb_convert_variables')) {
  47989. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  47990. }
  47991. if (!function_exists('mb_ord')) {
  47992. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  47993. }
  47994. if (!function_exists('mb_chr')) {
  47995. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  47996. }
  47997. if (!function_exists('mb_scrub')) {
  47998. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  47999. }
  48000. if (!function_exists('mb_str_split')) {
  48001. function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
  48002. }
  48003. if (extension_loaded('mbstring')) {
  48004. return;
  48005. }
  48006. if (!defined('MB_CASE_UPPER')) {
  48007. define('MB_CASE_UPPER', 0);
  48008. }
  48009. if (!defined('MB_CASE_LOWER')) {
  48010. define('MB_CASE_LOWER', 1);
  48011. }
  48012. if (!defined('MB_CASE_TITLE')) {
  48013. define('MB_CASE_TITLE', 2);
  48014. }
  48015. <?php
  48016. namespace Symfony\Component\Process\Exception;
  48017. interface ExceptionInterface
  48018. {
  48019. }
  48020. <?php
  48021. namespace Symfony\Component\Process\Exception;
  48022. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  48023. {
  48024. }
  48025. <?php
  48026. namespace Symfony\Component\Process\Exception;
  48027. class LogicException extends \LogicException implements ExceptionInterface
  48028. {
  48029. }
  48030. <?php
  48031. namespace Symfony\Component\Process\Exception;
  48032. use Symfony\Component\Process\Process;
  48033. class ProcessFailedException extends RuntimeException
  48034. {
  48035. private $process;
  48036. public function __construct(Process $process)
  48037. {
  48038. if ($process->isSuccessful()) {
  48039. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  48040. }
  48041. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  48042. $process->getCommandLine(),
  48043. $process->getExitCode(),
  48044. $process->getExitCodeText(),
  48045. $process->getWorkingDirectory()
  48046. );
  48047. if (!$process->isOutputDisabled()) {
  48048. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  48049. $process->getOutput(),
  48050. $process->getErrorOutput()
  48051. );
  48052. }
  48053. parent::__construct($error);
  48054. $this->process = $process;
  48055. }
  48056. public function getProcess()
  48057. {
  48058. return $this->process;
  48059. }
  48060. }
  48061. <?php
  48062. namespace Symfony\Component\Process\Exception;
  48063. use Symfony\Component\Process\Process;
  48064. class ProcessTimedOutException extends RuntimeException
  48065. {
  48066. const TYPE_GENERAL = 1;
  48067. const TYPE_IDLE = 2;
  48068. private $process;
  48069. private $timeoutType;
  48070. public function __construct(Process $process, $timeoutType)
  48071. {
  48072. $this->process = $process;
  48073. $this->timeoutType = $timeoutType;
  48074. parent::__construct(sprintf(
  48075. 'The process "%s" exceeded the timeout of %s seconds.',
  48076. $process->getCommandLine(),
  48077. $this->getExceededTimeout()
  48078. ));
  48079. }
  48080. public function getProcess()
  48081. {
  48082. return $this->process;
  48083. }
  48084. public function isGeneralTimeout()
  48085. {
  48086. return self::TYPE_GENERAL === $this->timeoutType;
  48087. }
  48088. public function isIdleTimeout()
  48089. {
  48090. return self::TYPE_IDLE === $this->timeoutType;
  48091. }
  48092. public function getExceededTimeout()
  48093. {
  48094. switch ($this->timeoutType) {
  48095. case self::TYPE_GENERAL:
  48096. return $this->process->getTimeout();
  48097. case self::TYPE_IDLE:
  48098. return $this->process->getIdleTimeout();
  48099. default:
  48100. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  48101. }
  48102. }
  48103. }
  48104. <?php
  48105. namespace Symfony\Component\Process\Exception;
  48106. class RuntimeException extends \RuntimeException implements ExceptionInterface
  48107. {
  48108. }
  48109. <?php
  48110. namespace Symfony\Component\Process;
  48111. class ExecutableFinder
  48112. {
  48113. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  48114. public function setSuffixes(array $suffixes)
  48115. {
  48116. $this->suffixes = $suffixes;
  48117. }
  48118. public function addSuffix($suffix)
  48119. {
  48120. $this->suffixes[] = $suffix;
  48121. }
  48122. public function find($name, $default = null, array $extraDirs = array())
  48123. {
  48124. if (ini_get('open_basedir')) {
  48125. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  48126. $dirs = array();
  48127. foreach ($searchPath as $path) {
  48128. if (@is_dir($path)) {
  48129. $dirs[] = $path;
  48130. } else {
  48131. if (basename($path) == $name && @is_executable($path)) {
  48132. return $path;
  48133. }
  48134. }
  48135. }
  48136. } else {
  48137. $dirs = array_merge(
  48138. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  48139. $extraDirs
  48140. );
  48141. }
  48142. $suffixes = array('');
  48143. if ('\\' === \DIRECTORY_SEPARATOR) {
  48144. $pathExt = getenv('PATHEXT');
  48145. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  48146. }
  48147. foreach ($suffixes as $suffix) {
  48148. foreach ($dirs as $dir) {
  48149. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  48150. return $file;
  48151. }
  48152. }
  48153. }
  48154. return $default;
  48155. }
  48156. }
  48157. Copyright (c) 2004-2018 Fabien Potencier
  48158. Permission is hereby granted, free of charge, to any person obtaining a copy
  48159. of this software and associated documentation files (the "Software"), to deal
  48160. in the Software without restriction, including without limitation the rights
  48161. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48162. copies of the Software, and to permit persons to whom the Software is furnished
  48163. to do so, subject to the following conditions:
  48164. The above copyright notice and this permission notice shall be included in all
  48165. copies or substantial portions of the Software.
  48166. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48167. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48168. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48169. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48170. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48171. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  48172. THE SOFTWARE.
  48173. <?php
  48174. namespace Symfony\Component\Process;
  48175. class PhpExecutableFinder
  48176. {
  48177. private $executableFinder;
  48178. public function __construct()
  48179. {
  48180. $this->executableFinder = new ExecutableFinder();
  48181. }
  48182. public function find($includeArgs = true)
  48183. {
  48184. $args = $this->findArguments();
  48185. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  48186. if (\defined('HHVM_VERSION')) {
  48187. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  48188. }
  48189. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  48190. return PHP_BINARY.$args;
  48191. }
  48192. if ($php = getenv('PHP_PATH')) {
  48193. if (!@is_executable($php)) {
  48194. return false;
  48195. }
  48196. return $php;
  48197. }
  48198. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  48199. if (@is_executable($php)) {
  48200. return $php;
  48201. }
  48202. }
  48203. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  48204. return $php;
  48205. }
  48206. $dirs = array(PHP_BINDIR);
  48207. if ('\\' === \DIRECTORY_SEPARATOR) {
  48208. $dirs[] = 'C:\xampp\php\\';
  48209. }
  48210. return $this->executableFinder->find('php', false, $dirs);
  48211. }
  48212. public function findArguments()
  48213. {
  48214. $arguments = array();
  48215. if (\defined('HHVM_VERSION')) {
  48216. $arguments[] = '--php';
  48217. } elseif ('phpdbg' === \PHP_SAPI) {
  48218. $arguments[] = '-qrr';
  48219. }
  48220. return $arguments;
  48221. }
  48222. }
  48223. <?php
  48224. namespace Symfony\Component\Process;
  48225. use Symfony\Component\Process\Exception\RuntimeException;
  48226. class PhpProcess extends Process
  48227. {
  48228. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  48229. {
  48230. $executableFinder = new PhpExecutableFinder();
  48231. if (false === $php = $executableFinder->find()) {
  48232. $php = null;
  48233. }
  48234. if ('phpdbg' === \PHP_SAPI) {
  48235. $file = tempnam(sys_get_temp_dir(), 'dbg');
  48236. file_put_contents($file, $script);
  48237. register_shutdown_function('unlink', $file);
  48238. $php .= ' '.ProcessUtils::escapeArgument($file);
  48239. $script = null;
  48240. }
  48241. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  48242. $php = 'exec '.$php;
  48243. }
  48244. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  48245. }
  48246. public function setPhpBinary($php)
  48247. {
  48248. $this->setCommandLine($php);
  48249. }
  48250. public function start($callback = null)
  48251. {
  48252. if (null === $this->getCommandLine()) {
  48253. throw new RuntimeException('Unable to find the PHP executable.');
  48254. }
  48255. parent::start($callback);
  48256. }
  48257. }
  48258. <?php
  48259. namespace Symfony\Component\Process\Pipes;
  48260. abstract class AbstractPipes implements PipesInterface
  48261. {
  48262. public $pipes = array();
  48263. private $inputBuffer = '';
  48264. private $input;
  48265. private $blocked = true;
  48266. private $lastError;
  48267. public function __construct($input)
  48268. {
  48269. if (\is_resource($input)) {
  48270. $this->input = $input;
  48271. } elseif (\is_string($input)) {
  48272. $this->inputBuffer = $input;
  48273. } else {
  48274. $this->inputBuffer = (string) $input;
  48275. }
  48276. }
  48277. public function close()
  48278. {
  48279. foreach ($this->pipes as $pipe) {
  48280. fclose($pipe);
  48281. }
  48282. $this->pipes = array();
  48283. }
  48284. protected function hasSystemCallBeenInterrupted()
  48285. {
  48286. $lastError = $this->lastError;
  48287. $this->lastError = null;
  48288. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  48289. }
  48290. protected function unblock()
  48291. {
  48292. if (!$this->blocked) {
  48293. return;
  48294. }
  48295. foreach ($this->pipes as $pipe) {
  48296. stream_set_blocking($pipe, 0);
  48297. }
  48298. if (null !== $this->input) {
  48299. stream_set_blocking($this->input, 0);
  48300. }
  48301. $this->blocked = false;
  48302. }
  48303. protected function write()
  48304. {
  48305. if (!isset($this->pipes[0])) {
  48306. return;
  48307. }
  48308. $input = $this->input;
  48309. $r = $e = array();
  48310. $w = array($this->pipes[0]);
  48311. if (false === @stream_select($r, $w, $e, 0, 0)) {
  48312. return;
  48313. }
  48314. foreach ($w as $stdin) {
  48315. if (isset($this->inputBuffer[0])) {
  48316. $written = fwrite($stdin, $this->inputBuffer);
  48317. $this->inputBuffer = substr($this->inputBuffer, $written);
  48318. if (isset($this->inputBuffer[0])) {
  48319. return array($this->pipes[0]);
  48320. }
  48321. }
  48322. if ($input) {
  48323. for (;;) {
  48324. $data = fread($input, self::CHUNK_SIZE);
  48325. if (!isset($data[0])) {
  48326. break;
  48327. }
  48328. $written = fwrite($stdin, $data);
  48329. $data = substr($data, $written);
  48330. if (isset($data[0])) {
  48331. $this->inputBuffer = $data;
  48332. return array($this->pipes[0]);
  48333. }
  48334. }
  48335. if (feof($input)) {
  48336. $this->input = null;
  48337. }
  48338. }
  48339. }
  48340. if (null === $this->input && !isset($this->inputBuffer[0])) {
  48341. fclose($this->pipes[0]);
  48342. unset($this->pipes[0]);
  48343. } elseif (!$w) {
  48344. return array($this->pipes[0]);
  48345. }
  48346. }
  48347. public function handleError($type, $msg)
  48348. {
  48349. $this->lastError = $msg;
  48350. }
  48351. }
  48352. <?php
  48353. namespace Symfony\Component\Process\Pipes;
  48354. interface PipesInterface
  48355. {
  48356. const CHUNK_SIZE = 16384;
  48357. public function getDescriptors();
  48358. public function getFiles();
  48359. public function readAndWrite($blocking, $close = false);
  48360. public function areOpen();
  48361. public function close();
  48362. }
  48363. <?php
  48364. namespace Symfony\Component\Process\Pipes;
  48365. use Symfony\Component\Process\Process;
  48366. class UnixPipes extends AbstractPipes
  48367. {
  48368. private $ttyMode;
  48369. private $ptyMode;
  48370. private $disableOutput;
  48371. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  48372. {
  48373. $this->ttyMode = (bool) $ttyMode;
  48374. $this->ptyMode = (bool) $ptyMode;
  48375. $this->disableOutput = (bool) $disableOutput;
  48376. parent::__construct($input);
  48377. }
  48378. public function __destruct()
  48379. {
  48380. $this->close();
  48381. }
  48382. public function getDescriptors()
  48383. {
  48384. if ($this->disableOutput) {
  48385. $nullstream = fopen('/dev/null', 'c');
  48386. return array(
  48387. array('pipe', 'r'),
  48388. $nullstream,
  48389. $nullstream,
  48390. );
  48391. }
  48392. if ($this->ttyMode) {
  48393. return array(
  48394. array('file', '/dev/tty', 'r'),
  48395. array('file', '/dev/tty', 'w'),
  48396. array('file', '/dev/tty', 'w'),
  48397. );
  48398. }
  48399. if ($this->ptyMode && Process::isPtySupported()) {
  48400. return array(
  48401. array('pty'),
  48402. array('pty'),
  48403. array('pty'),
  48404. );
  48405. }
  48406. return array(
  48407. array('pipe', 'r'),
  48408. array('pipe', 'w'),
  48409. array('pipe', 'w'),
  48410. );
  48411. }
  48412. public function getFiles()
  48413. {
  48414. return array();
  48415. }
  48416. public function readAndWrite($blocking, $close = false)
  48417. {
  48418. $this->unblock();
  48419. $w = $this->write();
  48420. $read = $e = array();
  48421. $r = $this->pipes;
  48422. unset($r[0]);
  48423. set_error_handler(array($this, 'handleError'));
  48424. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  48425. restore_error_handler();
  48426. if (!$this->hasSystemCallBeenInterrupted()) {
  48427. $this->pipes = array();
  48428. }
  48429. return $read;
  48430. }
  48431. restore_error_handler();
  48432. foreach ($r as $pipe) {
  48433. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  48434. do {
  48435. $data = fread($pipe, self::CHUNK_SIZE);
  48436. $read[$type] .= $data;
  48437. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  48438. if (!isset($read[$type][0])) {
  48439. unset($read[$type]);
  48440. }
  48441. if ($close && feof($pipe)) {
  48442. fclose($pipe);
  48443. unset($this->pipes[$type]);
  48444. }
  48445. }
  48446. return $read;
  48447. }
  48448. public function areOpen()
  48449. {
  48450. return (bool) $this->pipes;
  48451. }
  48452. public static function create(Process $process, $input)
  48453. {
  48454. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  48455. }
  48456. }
  48457. <?php
  48458. namespace Symfony\Component\Process\Pipes;
  48459. use Symfony\Component\Process\Exception\RuntimeException;
  48460. use Symfony\Component\Process\Process;
  48461. class WindowsPipes extends AbstractPipes
  48462. {
  48463. private $files = array();
  48464. private $fileHandles = array();
  48465. private $lockHandles = array();
  48466. private $readBytes = array(
  48467. Process::STDOUT => 0,
  48468. Process::STDERR => 0,
  48469. );
  48470. private $disableOutput;
  48471. public function __construct($disableOutput, $input)
  48472. {
  48473. $this->disableOutput = (bool) $disableOutput;
  48474. if (!$this->disableOutput) {
  48475. $pipes = array(
  48476. Process::STDOUT => Process::OUT,
  48477. Process::STDERR => Process::ERR,
  48478. );
  48479. $tmpDir = sys_get_temp_dir();
  48480. $lastError = 'unknown reason';
  48481. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  48482. for ($i = 0;; ++$i) {
  48483. foreach ($pipes as $pipe => $name) {
  48484. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  48485. if (!$h = fopen($file.'.lock', 'w')) {
  48486. restore_error_handler();
  48487. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  48488. }
  48489. if (!flock($h, LOCK_EX | LOCK_NB)) {
  48490. continue 2;
  48491. }
  48492. if (isset($this->lockHandles[$pipe])) {
  48493. flock($this->lockHandles[$pipe], LOCK_UN);
  48494. fclose($this->lockHandles[$pipe]);
  48495. }
  48496. $this->lockHandles[$pipe] = $h;
  48497. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  48498. flock($this->lockHandles[$pipe], LOCK_UN);
  48499. fclose($this->lockHandles[$pipe]);
  48500. unset($this->lockHandles[$pipe]);
  48501. continue 2;
  48502. }
  48503. $this->fileHandles[$pipe] = $h;
  48504. $this->files[$pipe] = $file;
  48505. }
  48506. break;
  48507. }
  48508. restore_error_handler();
  48509. }
  48510. parent::__construct($input);
  48511. }
  48512. public function __destruct()
  48513. {
  48514. $this->close();
  48515. }
  48516. public function getDescriptors()
  48517. {
  48518. if ($this->disableOutput) {
  48519. $nullstream = fopen('NUL', 'c');
  48520. return array(
  48521. array('pipe', 'r'),
  48522. $nullstream,
  48523. $nullstream,
  48524. );
  48525. }
  48526. return array(
  48527. array('pipe', 'r'),
  48528. array('file', 'NUL', 'w'),
  48529. array('file', 'NUL', 'w'),
  48530. );
  48531. }
  48532. public function getFiles()
  48533. {
  48534. return $this->files;
  48535. }
  48536. public function readAndWrite($blocking, $close = false)
  48537. {
  48538. $this->unblock();
  48539. $w = $this->write();
  48540. $read = $r = $e = array();
  48541. if ($blocking) {
  48542. if ($w) {
  48543. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  48544. } elseif ($this->fileHandles) {
  48545. usleep(Process::TIMEOUT_PRECISION * 1E6);
  48546. }
  48547. }
  48548. foreach ($this->fileHandles as $type => $fileHandle) {
  48549. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  48550. if (isset($data[0])) {
  48551. $this->readBytes[$type] += \strlen($data);
  48552. $read[$type] = $data;
  48553. }
  48554. if ($close) {
  48555. ftruncate($fileHandle, 0);
  48556. fclose($fileHandle);
  48557. flock($this->lockHandles[$type], LOCK_UN);
  48558. fclose($this->lockHandles[$type]);
  48559. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  48560. }
  48561. }
  48562. return $read;
  48563. }
  48564. public function areOpen()
  48565. {
  48566. return $this->pipes && $this->fileHandles;
  48567. }
  48568. public function close()
  48569. {
  48570. parent::close();
  48571. foreach ($this->fileHandles as $type => $handle) {
  48572. ftruncate($handle, 0);
  48573. fclose($handle);
  48574. flock($this->lockHandles[$type], LOCK_UN);
  48575. fclose($this->lockHandles[$type]);
  48576. }
  48577. $this->fileHandles = $this->lockHandles = array();
  48578. }
  48579. public static function create(Process $process, $input)
  48580. {
  48581. return new static($process->isOutputDisabled(), $input);
  48582. }
  48583. }
  48584. <?php
  48585. namespace Symfony\Component\Process;
  48586. use Symfony\Component\Process\Exception\InvalidArgumentException;
  48587. use Symfony\Component\Process\Exception\LogicException;
  48588. use Symfony\Component\Process\Exception\ProcessFailedException;
  48589. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  48590. use Symfony\Component\Process\Exception\RuntimeException;
  48591. use Symfony\Component\Process\Pipes\PipesInterface;
  48592. use Symfony\Component\Process\Pipes\UnixPipes;
  48593. use Symfony\Component\Process\Pipes\WindowsPipes;
  48594. class Process
  48595. {
  48596. const ERR = 'err';
  48597. const OUT = 'out';
  48598. const STATUS_READY = 'ready';
  48599. const STATUS_STARTED = 'started';
  48600. const STATUS_TERMINATED = 'terminated';
  48601. const STDIN = 0;
  48602. const STDOUT = 1;
  48603. const STDERR = 2;
  48604. const TIMEOUT_PRECISION = 0.2;
  48605. private $callback;
  48606. private $commandline;
  48607. private $cwd;
  48608. private $env;
  48609. private $input;
  48610. private $starttime;
  48611. private $lastOutputTime;
  48612. private $timeout;
  48613. private $idleTimeout;
  48614. private $options;
  48615. private $exitcode;
  48616. private $fallbackStatus = array();
  48617. private $processInformation;
  48618. private $outputDisabled = false;
  48619. private $stdout;
  48620. private $stderr;
  48621. private $enhanceWindowsCompatibility = true;
  48622. private $enhanceSigchildCompatibility;
  48623. private $process;
  48624. private $status = self::STATUS_READY;
  48625. private $incrementalOutputOffset = 0;
  48626. private $incrementalErrorOutputOffset = 0;
  48627. private $tty;
  48628. private $pty;
  48629. private $useFileHandles = false;
  48630. private $processPipes;
  48631. private $latestSignal;
  48632. private static $sigchild;
  48633. public static $exitCodes = array(
  48634. 0 => 'OK',
  48635. 1 => 'General error',
  48636. 2 => 'Misuse of shell builtins',
  48637. 126 => 'Invoked command cannot execute',
  48638. 127 => 'Command not found',
  48639. 128 => 'Invalid exit argument',
  48640. 129 => 'Hangup',
  48641. 130 => 'Interrupt',
  48642. 131 => 'Quit and dump core',
  48643. 132 => 'Illegal instruction',
  48644. 133 => 'Trace/breakpoint trap',
  48645. 134 => 'Process aborted',
  48646. 135 => 'Bus error: "access to undefined portion of memory object"',
  48647. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  48648. 137 => 'Kill (terminate immediately)',
  48649. 138 => 'User-defined 1',
  48650. 139 => 'Segmentation violation',
  48651. 140 => 'User-defined 2',
  48652. 141 => 'Write to pipe with no one reading',
  48653. 142 => 'Signal raised by alarm',
  48654. 143 => 'Termination (request to terminate)',
  48655. 145 => 'Child process terminated, stopped (or continued*)',
  48656. 146 => 'Continue if stopped',
  48657. 147 => 'Stop executing temporarily',
  48658. 148 => 'Terminal stop signal',
  48659. 149 => 'Background process attempting to read from tty ("in")',
  48660. 150 => 'Background process attempting to write to tty ("out")',
  48661. 151 => 'Urgent data available on socket',
  48662. 152 => 'CPU time limit exceeded',
  48663. 153 => 'File size limit exceeded',
  48664. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  48665. 155 => 'Profiling timer expired',
  48666. 157 => 'Pollable event',
  48667. 159 => 'Bad syscall',
  48668. );
  48669. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  48670. {
  48671. if (!\function_exists('proc_open')) {
  48672. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  48673. }
  48674. $this->commandline = $commandline;
  48675. $this->cwd = $cwd;
  48676. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  48677. $this->cwd = getcwd();
  48678. }
  48679. if (null !== $env) {
  48680. $this->setEnv($env);
  48681. }
  48682. $this->setInput($input);
  48683. $this->setTimeout($timeout);
  48684. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  48685. $this->pty = false;
  48686. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  48687. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  48688. }
  48689. public function __destruct()
  48690. {
  48691. $this->stop(0);
  48692. }
  48693. public function __clone()
  48694. {
  48695. $this->resetProcessData();
  48696. }
  48697. public function run($callback = null)
  48698. {
  48699. $this->start($callback);
  48700. return $this->wait();
  48701. }
  48702. public function mustRun($callback = null)
  48703. {
  48704. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48705. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48706. }
  48707. if (0 !== $this->run($callback)) {
  48708. throw new ProcessFailedException($this);
  48709. }
  48710. return $this;
  48711. }
  48712. public function start($callback = null)
  48713. {
  48714. if ($this->isRunning()) {
  48715. throw new RuntimeException('Process is already running');
  48716. }
  48717. if ($this->outputDisabled && null !== $callback) {
  48718. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  48719. }
  48720. $this->resetProcessData();
  48721. $this->starttime = $this->lastOutputTime = microtime(true);
  48722. $this->callback = $this->buildCallback($callback);
  48723. $descriptors = $this->getDescriptors();
  48724. $commandline = $this->commandline;
  48725. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  48726. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  48727. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  48728. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  48729. }
  48730. $commandline .= '"';
  48731. if (!isset($this->options['bypass_shell'])) {
  48732. $this->options['bypass_shell'] = true;
  48733. }
  48734. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48735. $descriptors[3] = array('pipe', 'w');
  48736. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  48737. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  48738. $ptsWorkaround = fopen(__FILE__, 'r');
  48739. }
  48740. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  48741. if (!\is_resource($this->process)) {
  48742. throw new RuntimeException('Unable to launch a new process.');
  48743. }
  48744. $this->status = self::STATUS_STARTED;
  48745. if (isset($descriptors[3])) {
  48746. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  48747. }
  48748. if ($this->tty) {
  48749. return;
  48750. }
  48751. $this->updateStatus(false);
  48752. $this->checkTimeout();
  48753. }
  48754. public function restart($callback = null)
  48755. {
  48756. if ($this->isRunning()) {
  48757. throw new RuntimeException('Process is already running');
  48758. }
  48759. $process = clone $this;
  48760. $process->start($callback);
  48761. return $process;
  48762. }
  48763. public function wait($callback = null)
  48764. {
  48765. $this->requireProcessIsStarted(__FUNCTION__);
  48766. $this->updateStatus(false);
  48767. if (null !== $callback) {
  48768. $this->callback = $this->buildCallback($callback);
  48769. }
  48770. do {
  48771. $this->checkTimeout();
  48772. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  48773. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  48774. } while ($running);
  48775. while ($this->isRunning()) {
  48776. usleep(1000);
  48777. }
  48778. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  48779. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  48780. }
  48781. return $this->exitcode;
  48782. }
  48783. public function getPid()
  48784. {
  48785. return $this->isRunning() ? $this->processInformation['pid'] : null;
  48786. }
  48787. public function signal($signal)
  48788. {
  48789. $this->doSignal($signal, true);
  48790. return $this;
  48791. }
  48792. public function disableOutput()
  48793. {
  48794. if ($this->isRunning()) {
  48795. throw new RuntimeException('Disabling output while the process is running is not possible.');
  48796. }
  48797. if (null !== $this->idleTimeout) {
  48798. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  48799. }
  48800. $this->outputDisabled = true;
  48801. return $this;
  48802. }
  48803. public function enableOutput()
  48804. {
  48805. if ($this->isRunning()) {
  48806. throw new RuntimeException('Enabling output while the process is running is not possible.');
  48807. }
  48808. $this->outputDisabled = false;
  48809. return $this;
  48810. }
  48811. public function isOutputDisabled()
  48812. {
  48813. return $this->outputDisabled;
  48814. }
  48815. public function getOutput()
  48816. {
  48817. $this->readPipesForOutput(__FUNCTION__);
  48818. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  48819. return '';
  48820. }
  48821. return $ret;
  48822. }
  48823. public function getIncrementalOutput()
  48824. {
  48825. $this->readPipesForOutput(__FUNCTION__);
  48826. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  48827. $this->incrementalOutputOffset = ftell($this->stdout);
  48828. if (false === $latest) {
  48829. return '';
  48830. }
  48831. return $latest;
  48832. }
  48833. public function clearOutput()
  48834. {
  48835. ftruncate($this->stdout, 0);
  48836. fseek($this->stdout, 0);
  48837. $this->incrementalOutputOffset = 0;
  48838. return $this;
  48839. }
  48840. public function getErrorOutput()
  48841. {
  48842. $this->readPipesForOutput(__FUNCTION__);
  48843. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  48844. return '';
  48845. }
  48846. return $ret;
  48847. }
  48848. public function getIncrementalErrorOutput()
  48849. {
  48850. $this->readPipesForOutput(__FUNCTION__);
  48851. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  48852. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  48853. if (false === $latest) {
  48854. return '';
  48855. }
  48856. return $latest;
  48857. }
  48858. public function clearErrorOutput()
  48859. {
  48860. ftruncate($this->stderr, 0);
  48861. fseek($this->stderr, 0);
  48862. $this->incrementalErrorOutputOffset = 0;
  48863. return $this;
  48864. }
  48865. public function getExitCode()
  48866. {
  48867. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48868. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48869. }
  48870. $this->updateStatus(false);
  48871. return $this->exitcode;
  48872. }
  48873. public function getExitCodeText()
  48874. {
  48875. if (null === $exitcode = $this->getExitCode()) {
  48876. return;
  48877. }
  48878. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  48879. }
  48880. public function isSuccessful()
  48881. {
  48882. return 0 === $this->getExitCode();
  48883. }
  48884. public function hasBeenSignaled()
  48885. {
  48886. $this->requireProcessIsTerminated(__FUNCTION__);
  48887. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48888. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48889. }
  48890. return $this->processInformation['signaled'];
  48891. }
  48892. public function getTermSignal()
  48893. {
  48894. $this->requireProcessIsTerminated(__FUNCTION__);
  48895. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  48896. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48897. }
  48898. return $this->processInformation['termsig'];
  48899. }
  48900. public function hasBeenStopped()
  48901. {
  48902. $this->requireProcessIsTerminated(__FUNCTION__);
  48903. return $this->processInformation['stopped'];
  48904. }
  48905. public function getStopSignal()
  48906. {
  48907. $this->requireProcessIsTerminated(__FUNCTION__);
  48908. return $this->processInformation['stopsig'];
  48909. }
  48910. public function isRunning()
  48911. {
  48912. if (self::STATUS_STARTED !== $this->status) {
  48913. return false;
  48914. }
  48915. $this->updateStatus(false);
  48916. return $this->processInformation['running'];
  48917. }
  48918. public function isStarted()
  48919. {
  48920. return self::STATUS_READY != $this->status;
  48921. }
  48922. public function isTerminated()
  48923. {
  48924. $this->updateStatus(false);
  48925. return self::STATUS_TERMINATED == $this->status;
  48926. }
  48927. public function getStatus()
  48928. {
  48929. $this->updateStatus(false);
  48930. return $this->status;
  48931. }
  48932. public function stop($timeout = 10, $signal = null)
  48933. {
  48934. $timeoutMicro = microtime(true) + $timeout;
  48935. if ($this->isRunning()) {
  48936. $this->doSignal(15, false);
  48937. do {
  48938. usleep(1000);
  48939. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  48940. if ($this->isRunning()) {
  48941. $this->doSignal($signal ?: 9, false);
  48942. }
  48943. }
  48944. if ($this->isRunning()) {
  48945. if (isset($this->fallbackStatus['pid'])) {
  48946. unset($this->fallbackStatus['pid']);
  48947. return $this->stop(0, $signal);
  48948. }
  48949. $this->close();
  48950. }
  48951. return $this->exitcode;
  48952. }
  48953. public function addOutput($line)
  48954. {
  48955. $this->lastOutputTime = microtime(true);
  48956. fseek($this->stdout, 0, SEEK_END);
  48957. fwrite($this->stdout, $line);
  48958. fseek($this->stdout, $this->incrementalOutputOffset);
  48959. }
  48960. public function addErrorOutput($line)
  48961. {
  48962. $this->lastOutputTime = microtime(true);
  48963. fseek($this->stderr, 0, SEEK_END);
  48964. fwrite($this->stderr, $line);
  48965. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  48966. }
  48967. public function getCommandLine()
  48968. {
  48969. return $this->commandline;
  48970. }
  48971. public function setCommandLine($commandline)
  48972. {
  48973. $this->commandline = $commandline;
  48974. return $this;
  48975. }
  48976. public function getTimeout()
  48977. {
  48978. return $this->timeout;
  48979. }
  48980. public function getIdleTimeout()
  48981. {
  48982. return $this->idleTimeout;
  48983. }
  48984. public function setTimeout($timeout)
  48985. {
  48986. $this->timeout = $this->validateTimeout($timeout);
  48987. return $this;
  48988. }
  48989. public function setIdleTimeout($timeout)
  48990. {
  48991. if (null !== $timeout && $this->outputDisabled) {
  48992. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  48993. }
  48994. $this->idleTimeout = $this->validateTimeout($timeout);
  48995. return $this;
  48996. }
  48997. public function setTty($tty)
  48998. {
  48999. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  49000. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  49001. }
  49002. if ($tty) {
  49003. static $isTtySupported;
  49004. if (null === $isTtySupported) {
  49005. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  49006. }
  49007. if (!$isTtySupported) {
  49008. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  49009. }
  49010. }
  49011. $this->tty = (bool) $tty;
  49012. return $this;
  49013. }
  49014. public function isTty()
  49015. {
  49016. return $this->tty;
  49017. }
  49018. public function setPty($bool)
  49019. {
  49020. $this->pty = (bool) $bool;
  49021. return $this;
  49022. }
  49023. public function isPty()
  49024. {
  49025. return $this->pty;
  49026. }
  49027. public function getWorkingDirectory()
  49028. {
  49029. if (null === $this->cwd) {
  49030. return getcwd() ?: null;
  49031. }
  49032. return $this->cwd;
  49033. }
  49034. public function setWorkingDirectory($cwd)
  49035. {
  49036. $this->cwd = $cwd;
  49037. return $this;
  49038. }
  49039. public function getEnv()
  49040. {
  49041. return $this->env;
  49042. }
  49043. public function setEnv(array $env)
  49044. {
  49045. $env = array_filter($env, function ($value) {
  49046. return !\is_array($value);
  49047. });
  49048. $this->env = array();
  49049. foreach ($env as $key => $value) {
  49050. $this->env[$key] = (string) $value;
  49051. }
  49052. return $this;
  49053. }
  49054. public function getStdin()
  49055. {
  49056. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  49057. return $this->getInput();
  49058. }
  49059. public function getInput()
  49060. {
  49061. return $this->input;
  49062. }
  49063. public function setStdin($stdin)
  49064. {
  49065. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  49066. return $this->setInput($stdin);
  49067. }
  49068. public function setInput($input)
  49069. {
  49070. if ($this->isRunning()) {
  49071. throw new LogicException('Input can not be set while the process is running.');
  49072. }
  49073. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  49074. return $this;
  49075. }
  49076. public function getOptions()
  49077. {
  49078. return $this->options;
  49079. }
  49080. public function setOptions(array $options)
  49081. {
  49082. $this->options = $options;
  49083. return $this;
  49084. }
  49085. public function getEnhanceWindowsCompatibility()
  49086. {
  49087. return $this->enhanceWindowsCompatibility;
  49088. }
  49089. public function setEnhanceWindowsCompatibility($enhance)
  49090. {
  49091. $this->enhanceWindowsCompatibility = (bool) $enhance;
  49092. return $this;
  49093. }
  49094. public function getEnhanceSigchildCompatibility()
  49095. {
  49096. return $this->enhanceSigchildCompatibility;
  49097. }
  49098. public function setEnhanceSigchildCompatibility($enhance)
  49099. {
  49100. $this->enhanceSigchildCompatibility = (bool) $enhance;
  49101. return $this;
  49102. }
  49103. public function checkTimeout()
  49104. {
  49105. if (self::STATUS_STARTED !== $this->status) {
  49106. return;
  49107. }
  49108. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  49109. $this->stop(0);
  49110. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  49111. }
  49112. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  49113. $this->stop(0);
  49114. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  49115. }
  49116. }
  49117. public static function isPtySupported()
  49118. {
  49119. static $result;
  49120. if (null !== $result) {
  49121. return $result;
  49122. }
  49123. if ('\\' === \DIRECTORY_SEPARATOR) {
  49124. return $result = false;
  49125. }
  49126. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  49127. }
  49128. private function getDescriptors()
  49129. {
  49130. if ('\\' === \DIRECTORY_SEPARATOR) {
  49131. $this->processPipes = WindowsPipes::create($this, $this->input);
  49132. } else {
  49133. $this->processPipes = UnixPipes::create($this, $this->input);
  49134. }
  49135. return $this->processPipes->getDescriptors();
  49136. }
  49137. protected function buildCallback($callback)
  49138. {
  49139. $that = $this;
  49140. $out = self::OUT;
  49141. $callback = function ($type, $data) use ($that, $callback, $out) {
  49142. if ($out == $type) {
  49143. $that->addOutput($data);
  49144. } else {
  49145. $that->addErrorOutput($data);
  49146. }
  49147. if (null !== $callback) {
  49148. \call_user_func($callback, $type, $data);
  49149. }
  49150. };
  49151. return $callback;
  49152. }
  49153. protected function updateStatus($blocking)
  49154. {
  49155. if (self::STATUS_STARTED !== $this->status) {
  49156. return;
  49157. }
  49158. $this->processInformation = proc_get_status($this->process);
  49159. $running = $this->processInformation['running'];
  49160. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  49161. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  49162. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  49163. }
  49164. if (!$running) {
  49165. $this->close();
  49166. }
  49167. }
  49168. protected function isSigchildEnabled()
  49169. {
  49170. if (null !== self::$sigchild) {
  49171. return self::$sigchild;
  49172. }
  49173. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  49174. return self::$sigchild = false;
  49175. }
  49176. ob_start();
  49177. phpinfo(INFO_GENERAL);
  49178. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  49179. }
  49180. private function readPipesForOutput($caller)
  49181. {
  49182. if ($this->outputDisabled) {
  49183. throw new LogicException('Output has been disabled.');
  49184. }
  49185. $this->requireProcessIsStarted($caller);
  49186. $this->updateStatus(false);
  49187. }
  49188. private function validateTimeout($timeout)
  49189. {
  49190. $timeout = (float) $timeout;
  49191. if (0.0 === $timeout) {
  49192. $timeout = null;
  49193. } elseif ($timeout < 0) {
  49194. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  49195. }
  49196. return $timeout;
  49197. }
  49198. private function readPipes($blocking, $close)
  49199. {
  49200. $result = $this->processPipes->readAndWrite($blocking, $close);
  49201. $callback = $this->callback;
  49202. foreach ($result as $type => $data) {
  49203. if (3 !== $type) {
  49204. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  49205. } elseif (!isset($this->fallbackStatus['signaled'])) {
  49206. $this->fallbackStatus['exitcode'] = (int) $data;
  49207. }
  49208. }
  49209. }
  49210. private function close()
  49211. {
  49212. $this->processPipes->close();
  49213. if (\is_resource($this->process)) {
  49214. proc_close($this->process);
  49215. }
  49216. $this->exitcode = $this->processInformation['exitcode'];
  49217. $this->status = self::STATUS_TERMINATED;
  49218. if (-1 === $this->exitcode) {
  49219. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  49220. $this->exitcode = 128 + $this->processInformation['termsig'];
  49221. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  49222. $this->processInformation['signaled'] = true;
  49223. $this->processInformation['termsig'] = -1;
  49224. }
  49225. }
  49226. $this->callback = null;
  49227. return $this->exitcode;
  49228. }
  49229. private function resetProcessData()
  49230. {
  49231. $this->starttime = null;
  49232. $this->callback = null;
  49233. $this->exitcode = null;
  49234. $this->fallbackStatus = array();
  49235. $this->processInformation = null;
  49236. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  49237. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  49238. $this->process = null;
  49239. $this->latestSignal = null;
  49240. $this->status = self::STATUS_READY;
  49241. $this->incrementalOutputOffset = 0;
  49242. $this->incrementalErrorOutputOffset = 0;
  49243. }
  49244. private function doSignal($signal, $throwException)
  49245. {
  49246. if (null === $pid = $this->getPid()) {
  49247. if ($throwException) {
  49248. throw new LogicException('Can not send signal on a non running process.');
  49249. }
  49250. return false;
  49251. }
  49252. if ('\\' === \DIRECTORY_SEPARATOR) {
  49253. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  49254. if ($exitCode && $this->isRunning()) {
  49255. if ($throwException) {
  49256. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  49257. }
  49258. return false;
  49259. }
  49260. } else {
  49261. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  49262. $ok = @proc_terminate($this->process, $signal);
  49263. } elseif (\function_exists('posix_kill')) {
  49264. $ok = @posix_kill($pid, $signal);
  49265. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  49266. $ok = false === fgets($pipes[2]);
  49267. }
  49268. if (!$ok) {
  49269. if ($throwException) {
  49270. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  49271. }
  49272. return false;
  49273. }
  49274. }
  49275. $this->latestSignal = (int) $signal;
  49276. $this->fallbackStatus['signaled'] = true;
  49277. $this->fallbackStatus['exitcode'] = -1;
  49278. $this->fallbackStatus['termsig'] = $this->latestSignal;
  49279. return true;
  49280. }
  49281. private function requireProcessIsStarted($functionName)
  49282. {
  49283. if (!$this->isStarted()) {
  49284. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  49285. }
  49286. }
  49287. private function requireProcessIsTerminated($functionName)
  49288. {
  49289. if (!$this->isTerminated()) {
  49290. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  49291. }
  49292. }
  49293. }
  49294. <?php
  49295. namespace Symfony\Component\Process;
  49296. use Symfony\Component\Process\Exception\InvalidArgumentException;
  49297. use Symfony\Component\Process\Exception\LogicException;
  49298. class ProcessBuilder
  49299. {
  49300. private $arguments;
  49301. private $cwd;
  49302. private $env = array();
  49303. private $input;
  49304. private $timeout = 60;
  49305. private $options = array();
  49306. private $inheritEnv = true;
  49307. private $prefix = array();
  49308. private $outputDisabled = false;
  49309. public function __construct(array $arguments = array())
  49310. {
  49311. $this->arguments = $arguments;
  49312. }
  49313. public static function create(array $arguments = array())
  49314. {
  49315. return new static($arguments);
  49316. }
  49317. public function add($argument)
  49318. {
  49319. $this->arguments[] = $argument;
  49320. return $this;
  49321. }
  49322. public function setPrefix($prefix)
  49323. {
  49324. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  49325. return $this;
  49326. }
  49327. public function setArguments(array $arguments)
  49328. {
  49329. $this->arguments = $arguments;
  49330. return $this;
  49331. }
  49332. public function setWorkingDirectory($cwd)
  49333. {
  49334. $this->cwd = $cwd;
  49335. return $this;
  49336. }
  49337. public function inheritEnvironmentVariables($inheritEnv = true)
  49338. {
  49339. $this->inheritEnv = $inheritEnv;
  49340. return $this;
  49341. }
  49342. public function setEnv($name, $value)
  49343. {
  49344. $this->env[$name] = $value;
  49345. return $this;
  49346. }
  49347. public function addEnvironmentVariables(array $variables)
  49348. {
  49349. $this->env = array_replace($this->env, $variables);
  49350. return $this;
  49351. }
  49352. public function setInput($input)
  49353. {
  49354. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  49355. return $this;
  49356. }
  49357. public function setTimeout($timeout)
  49358. {
  49359. if (null === $timeout) {
  49360. $this->timeout = null;
  49361. return $this;
  49362. }
  49363. $timeout = (float) $timeout;
  49364. if ($timeout < 0) {
  49365. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  49366. }
  49367. $this->timeout = $timeout;
  49368. return $this;
  49369. }
  49370. public function setOption($name, $value)
  49371. {
  49372. $this->options[$name] = $value;
  49373. return $this;
  49374. }
  49375. public function disableOutput()
  49376. {
  49377. $this->outputDisabled = true;
  49378. return $this;
  49379. }
  49380. public function enableOutput()
  49381. {
  49382. $this->outputDisabled = false;
  49383. return $this;
  49384. }
  49385. public function getProcess()
  49386. {
  49387. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  49388. throw new LogicException('You must add() command arguments before calling getProcess().');
  49389. }
  49390. $options = $this->options;
  49391. $arguments = array_merge($this->prefix, $this->arguments);
  49392. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  49393. if ($this->inheritEnv) {
  49394. $env = array_replace($_ENV, $_SERVER, $this->env);
  49395. } else {
  49396. $env = $this->env;
  49397. }
  49398. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  49399. if ($this->outputDisabled) {
  49400. $process->disableOutput();
  49401. }
  49402. return $process;
  49403. }
  49404. }
  49405. <?php
  49406. namespace Symfony\Component\Process;
  49407. use Symfony\Component\Process\Exception\InvalidArgumentException;
  49408. class ProcessUtils
  49409. {
  49410. private function __construct()
  49411. {
  49412. }
  49413. public static function escapeArgument($argument)
  49414. {
  49415. if ('\\' === \DIRECTORY_SEPARATOR) {
  49416. if ('' === $argument) {
  49417. return escapeshellarg($argument);
  49418. }
  49419. $escapedArgument = '';
  49420. $quote = false;
  49421. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  49422. if ('"' === $part) {
  49423. $escapedArgument .= '\\"';
  49424. } elseif (self::isSurroundedBy($part, '%')) {
  49425. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  49426. } else {
  49427. if ('\\' === substr($part, -1)) {
  49428. $part .= '\\';
  49429. }
  49430. $quote = true;
  49431. $escapedArgument .= $part;
  49432. }
  49433. }
  49434. if ($quote) {
  49435. $escapedArgument = '"'.$escapedArgument.'"';
  49436. }
  49437. return $escapedArgument;
  49438. }
  49439. return "'".str_replace("'", "'\\''", $argument)."'";
  49440. }
  49441. public static function validateInput($caller, $input)
  49442. {
  49443. if (null !== $input) {
  49444. if (\is_resource($input)) {
  49445. return $input;
  49446. }
  49447. if (\is_string($input)) {
  49448. return $input;
  49449. }
  49450. if (is_scalar($input)) {
  49451. return (string) $input;
  49452. }
  49453. if (\is_object($input) && method_exists($input, '__toString')) {
  49454. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  49455. return (string) $input;
  49456. }
  49457. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  49458. }
  49459. return $input;
  49460. }
  49461. private static function isSurroundedBy($arg, $char)
  49462. {
  49463. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  49464. }
  49465. }
  49466. Copyright (c) 2011 Jordi Boggiano
  49467. Permission is hereby granted, free of charge, to any person obtaining a copy
  49468. of this software and associated documentation files (the "Software"), to deal
  49469. in the Software without restriction, including without limitation the rights
  49470. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49471. copies of the Software, and to permit persons to whom the Software is furnished
  49472. to do so, subject to the following conditions:
  49473. The above copyright notice and this permission notice shall be included in all
  49474. copies or substantial portions of the Software.
  49475. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49476. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49477. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49478. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49479. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49480. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  49481. THE SOFTWARE.
  49482. <?php
  49483. namespace Seld\JsonLint;
  49484. class DuplicateKeyException extends ParsingException
  49485. {
  49486. public function __construct($message, $key, array $details = array())
  49487. {
  49488. $details['key'] = $key;
  49489. parent::__construct($message, $details);
  49490. }
  49491. public function getKey()
  49492. {
  49493. return $this->details['key'];
  49494. }
  49495. }
  49496. <?php
  49497. namespace Seld\JsonLint;
  49498. use stdClass;
  49499. class JsonParser
  49500. {
  49501. const DETECT_KEY_CONFLICTS = 1;
  49502. const ALLOW_DUPLICATE_KEYS = 2;
  49503. const PARSE_TO_ASSOC = 4;
  49504. private $lexer;
  49505. private $flags;
  49506. private $stack;
  49507. private $vstack;
  49508. private $lstack;
  49509. private $symbols = array(
  49510. 'error' => 2,
  49511. 'JSONString' => 3,
  49512. 'STRING' => 4,
  49513. 'JSONNumber' => 5,
  49514. 'NUMBER' => 6,
  49515. 'JSONNullLiteral' => 7,
  49516. 'NULL' => 8,
  49517. 'JSONBooleanLiteral' => 9,
  49518. 'TRUE' => 10,
  49519. 'FALSE' => 11,
  49520. 'JSONText' => 12,
  49521. 'JSONValue' => 13,
  49522. 'EOF' => 14,
  49523. 'JSONObject' => 15,
  49524. 'JSONArray' => 16,
  49525. '{' => 17,
  49526. '}' => 18,
  49527. 'JSONMemberList' => 19,
  49528. 'JSONMember' => 20,
  49529. ':' => 21,
  49530. ',' => 22,
  49531. '[' => 23,
  49532. ']' => 24,
  49533. 'JSONElementList' => 25,
  49534. '$accept' => 0,
  49535. '$end' => 1,
  49536. );
  49537. private $terminals_ = array(
  49538. 2 => "error",
  49539. 4 => "STRING",
  49540. 6 => "NUMBER",
  49541. 8 => "NULL",
  49542. 10 => "TRUE",
  49543. 11 => "FALSE",
  49544. 14 => "EOF",
  49545. 17 => "{",
  49546. 18 => "}",
  49547. 21 => ":",
  49548. 22 => ",",
  49549. 23 => "[",
  49550. 24 => "]",
  49551. );
  49552. private $productions_ = array(
  49553. 0,
  49554. array(3, 1),
  49555. array(5, 1),
  49556. array(7, 1),
  49557. array(9, 1),
  49558. array(9, 1),
  49559. array(12, 2),
  49560. array(13, 1),
  49561. array(13, 1),
  49562. array(13, 1),
  49563. array(13, 1),
  49564. array(13, 1),
  49565. array(13, 1),
  49566. array(15, 2),
  49567. array(15, 3),
  49568. array(20, 3),
  49569. array(19, 1),
  49570. array(19, 3),
  49571. array(16, 2),
  49572. array(16, 3),
  49573. array(25, 1),
  49574. array(25, 3)
  49575. );
  49576. private $table = array(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)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), 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 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), 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)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), 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)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  49577. );
  49578. private $defaultActions = array(
  49579. 16 => array(2, 6)
  49580. );
  49581. public function lint($input, $flags = 0)
  49582. {
  49583. try {
  49584. $this->parse($input, $flags);
  49585. } catch (ParsingException $e) {
  49586. return $e;
  49587. }
  49588. }
  49589. public function parse($input, $flags = 0)
  49590. {
  49591. $this->failOnBOM($input);
  49592. $this->flags = $flags;
  49593. $this->stack = array(0);
  49594. $this->vstack = array(null);
  49595. $this->lstack = array();
  49596. $yytext = '';
  49597. $yylineno = 0;
  49598. $yyleng = 0;
  49599. $recovering = 0;
  49600. $TERROR = 2;
  49601. $EOF = 1;
  49602. $this->lexer = new Lexer();
  49603. $this->lexer->setInput($input);
  49604. $yyloc = $this->lexer->yylloc;
  49605. $this->lstack[] = $yyloc;
  49606. $symbol = null;
  49607. $preErrorSymbol = null;
  49608. $state = null;
  49609. $action = null;
  49610. $a = null;
  49611. $r = null;
  49612. $yyval = new stdClass;
  49613. $p = null;
  49614. $len = null;
  49615. $newState = null;
  49616. $expected = null;
  49617. $errStr = null;
  49618. while (true) {
  49619. $state = $this->stack[\count($this->stack)-1];
  49620. if (isset($this->defaultActions[$state])) {
  49621. $action = $this->defaultActions[$state];
  49622. } else {
  49623. if ($symbol == null) {
  49624. $symbol = $this->lex();
  49625. }
  49626. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  49627. }
  49628. if (!$action || !$action[0]) {
  49629. if (!$recovering) {
  49630. $expected = array();
  49631. foreach ($this->table[$state] as $p => $ignore) {
  49632. if (isset($this->terminals_[$p]) && $p > 2) {
  49633. $expected[] = "'" . $this->terminals_[$p] . "'";
  49634. }
  49635. }
  49636. $message = null;
  49637. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  49638. $message = "Invalid string";
  49639. if ("'" === substr($this->lexer->match, 0, 1)) {
  49640. $message .= ", it appears you used single quotes instead of double quotes";
  49641. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  49642. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  49643. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  49644. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  49645. }
  49646. }
  49647. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49648. $errStr .= $this->lexer->showPosition() . "\n";
  49649. if ($message) {
  49650. $errStr .= $message;
  49651. } else {
  49652. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  49653. $errStr .= implode(', ', $expected);
  49654. }
  49655. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  49656. $errStr .= " - It appears you have an extra trailing comma";
  49657. }
  49658. $this->parseError($errStr, array(
  49659. 'text' => $this->lexer->match,
  49660. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  49661. 'line' => $this->lexer->yylineno,
  49662. 'loc' => $yyloc,
  49663. 'expected' => $expected,
  49664. ));
  49665. }
  49666. if ($recovering == 3) {
  49667. if ($symbol == $EOF) {
  49668. throw new ParsingException($errStr ?: 'Parsing halted.');
  49669. }
  49670. $yyleng = $this->lexer->yyleng;
  49671. $yytext = $this->lexer->yytext;
  49672. $yylineno = $this->lexer->yylineno;
  49673. $yyloc = $this->lexer->yylloc;
  49674. $symbol = $this->lex();
  49675. }
  49676. while (true) {
  49677. if (\array_key_exists($TERROR, $this->table[$state])) {
  49678. break;
  49679. }
  49680. if ($state == 0) {
  49681. throw new ParsingException($errStr ?: 'Parsing halted.');
  49682. }
  49683. $this->popStack(1);
  49684. $state = $this->stack[\count($this->stack)-1];
  49685. }
  49686. $preErrorSymbol = $symbol;
  49687. $symbol = $TERROR;
  49688. $state = $this->stack[\count($this->stack)-1];
  49689. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  49690. $recovering = 3;
  49691. }
  49692. if (\is_array($action[0]) && \count($action) > 1) {
  49693. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  49694. }
  49695. switch ($action[0]) {
  49696. case 1:
  49697. $this->stack[] = $symbol;
  49698. $this->vstack[] = $this->lexer->yytext;
  49699. $this->lstack[] = $this->lexer->yylloc;
  49700. $this->stack[] = $action[1];
  49701. $symbol = null;
  49702. if (!$preErrorSymbol) {
  49703. $yyleng = $this->lexer->yyleng;
  49704. $yytext = $this->lexer->yytext;
  49705. $yylineno = $this->lexer->yylineno;
  49706. $yyloc = $this->lexer->yylloc;
  49707. if ($recovering > 0) {
  49708. $recovering--;
  49709. }
  49710. } else {
  49711. $symbol = $preErrorSymbol;
  49712. $preErrorSymbol = null;
  49713. }
  49714. break;
  49715. case 2:
  49716. $len = $this->productions_[$action[1]][1];
  49717. $yyval->token = $this->vstack[\count($this->vstack) - $len];
  49718. $yyval->store = array(
  49719. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  49720. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  49721. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  49722. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  49723. );
  49724. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  49725. if (!$r instanceof Undefined) {
  49726. return $r;
  49727. }
  49728. if ($len) {
  49729. $this->popStack($len);
  49730. }
  49731. $this->stack[] = $this->productions_[$action[1]][0];
  49732. $this->vstack[] = $yyval->token;
  49733. $this->lstack[] = $yyval->store;
  49734. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  49735. $this->stack[] = $newState;
  49736. break;
  49737. case 3:
  49738. return true;
  49739. }
  49740. }
  49741. return true;
  49742. }
  49743. protected function parseError($str, $hash)
  49744. {
  49745. throw new ParsingException($str, $hash);
  49746. }
  49747. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  49748. {
  49749. $len = \count($tokens) - 1;
  49750. switch ($yystate) {
  49751. case 1:
  49752. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  49753. $yyval->token = $yytext;
  49754. break;
  49755. case 2:
  49756. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  49757. $yyval->token = \floatval($yytext);
  49758. } else {
  49759. $yyval->token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  49760. }
  49761. break;
  49762. case 3:
  49763. $yyval->token = null;
  49764. break;
  49765. case 4:
  49766. $yyval->token = true;
  49767. break;
  49768. case 5:
  49769. $yyval->token = false;
  49770. break;
  49771. case 6:
  49772. return $yyval->token = $tokens[$len-1];
  49773. case 13:
  49774. if ($this->flags & self::PARSE_TO_ASSOC) {
  49775. $yyval->token = array();
  49776. } else {
  49777. $yyval->token = new stdClass;
  49778. }
  49779. break;
  49780. case 14:
  49781. $yyval->token = $tokens[$len-1];
  49782. break;
  49783. case 15:
  49784. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  49785. break;
  49786. case 16:
  49787. if (PHP_VERSION_ID < 70100) {
  49788. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49789. } else {
  49790. $property = $tokens[$len][0];
  49791. }
  49792. if ($this->flags & self::PARSE_TO_ASSOC) {
  49793. $yyval->token = array();
  49794. $yyval->token[$property] = $tokens[$len][1];
  49795. } else {
  49796. $yyval->token = new stdClass;
  49797. $yyval->token->$property = $tokens[$len][1];
  49798. }
  49799. break;
  49800. case 17:
  49801. if ($this->flags & self::PARSE_TO_ASSOC) {
  49802. $yyval->token =& $tokens[$len-2];
  49803. $key = $tokens[$len][0];
  49804. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  49805. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49806. $errStr .= $this->lexer->showPosition() . "\n";
  49807. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49808. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49809. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  49810. $duplicateCount = 1;
  49811. do {
  49812. $duplicateKey = $key . '.' . $duplicateCount++;
  49813. } while (isset($tokens[$len-2][$duplicateKey]));
  49814. $key = $duplicateKey;
  49815. }
  49816. $tokens[$len-2][$key] = $tokens[$len][1];
  49817. } else {
  49818. $yyval->token = $tokens[$len-2];
  49819. if (PHP_VERSION_ID < 70100) {
  49820. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49821. } else {
  49822. $key = $tokens[$len][0];
  49823. }
  49824. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  49825. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49826. $errStr .= $this->lexer->showPosition() . "\n";
  49827. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49828. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49829. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  49830. $duplicateCount = 1;
  49831. do {
  49832. $duplicateKey = $key . '.' . $duplicateCount++;
  49833. } while (isset($tokens[$len-2]->$duplicateKey));
  49834. $key = $duplicateKey;
  49835. }
  49836. $tokens[$len-2]->$key = $tokens[$len][1];
  49837. }
  49838. break;
  49839. case 18:
  49840. $yyval->token = array();
  49841. break;
  49842. case 19:
  49843. $yyval->token = $tokens[$len-1];
  49844. break;
  49845. case 20:
  49846. $yyval->token = array($tokens[$len]);
  49847. break;
  49848. case 21:
  49849. $tokens[$len-2][] = $tokens[$len];
  49850. $yyval->token = $tokens[$len-2];
  49851. break;
  49852. }
  49853. return new Undefined();
  49854. }
  49855. private function stringInterpolation($match)
  49856. {
  49857. switch ($match[0]) {
  49858. case '\\\\':
  49859. return '\\';
  49860. case '\"':
  49861. return '"';
  49862. case '\b':
  49863. return \chr(8);
  49864. case '\f':
  49865. return \chr(12);
  49866. case '\n':
  49867. return "\n";
  49868. case '\r':
  49869. return "\r";
  49870. case '\t':
  49871. return "\t";
  49872. case '\/':
  49873. return "/";
  49874. default:
  49875. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  49876. }
  49877. }
  49878. private function popStack($n)
  49879. {
  49880. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  49881. $this->vstack = \array_slice($this->vstack, 0, - $n);
  49882. $this->lstack = \array_slice($this->lstack, 0, - $n);
  49883. }
  49884. private function lex()
  49885. {
  49886. $token = $this->lexer->lex() ?: 1;
  49887. if (!is_numeric($token)) {
  49888. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  49889. }
  49890. return $token;
  49891. }
  49892. private function failOnBOM($input)
  49893. {
  49894. $bom = "\xEF\xBB\xBF";
  49895. if (substr($input, 0, 3) === $bom) {
  49896. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  49897. }
  49898. }
  49899. }
  49900. <?php
  49901. namespace Seld\JsonLint;
  49902. class Lexer
  49903. {
  49904. private $EOF = 1;
  49905. private $rules = array(
  49906. 0 => '/\G\s+/',
  49907. 1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  49908. 2 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  49909. 3 => '/\G\{/',
  49910. 4 => '/\G\}/',
  49911. 5 => '/\G\[/',
  49912. 6 => '/\G\]/',
  49913. 7 => '/\G,/',
  49914. 8 => '/\G:/',
  49915. 9 => '/\Gtrue\b/',
  49916. 10 => '/\Gfalse\b/',
  49917. 11 => '/\Gnull\b/',
  49918. 12 => '/\G$/',
  49919. 13 => '/\G./',
  49920. );
  49921. private $conditions = array(
  49922. "INITIAL" => array(
  49923. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  49924. "inclusive" => true,
  49925. ),
  49926. );
  49927. private $conditionStack;
  49928. private $input;
  49929. private $more;
  49930. private $done;
  49931. private $offset;
  49932. public $match;
  49933. public $yylineno;
  49934. public $yyleng;
  49935. public $yytext;
  49936. public $yylloc;
  49937. public function lex()
  49938. {
  49939. $r = $this->next();
  49940. if (!$r instanceof Undefined) {
  49941. return $r;
  49942. }
  49943. return $this->lex();
  49944. }
  49945. public function setInput($input)
  49946. {
  49947. $this->input = $input;
  49948. $this->more = false;
  49949. $this->done = false;
  49950. $this->offset = 0;
  49951. $this->yylineno = $this->yyleng = 0;
  49952. $this->yytext = $this->match = '';
  49953. $this->conditionStack = array('INITIAL');
  49954. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  49955. return $this;
  49956. }
  49957. public function showPosition()
  49958. {
  49959. $pre = str_replace("\n", '', $this->getPastInput());
  49960. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  49961. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  49962. }
  49963. public function getPastInput()
  49964. {
  49965. $pastLength = $this->offset - \strlen($this->match);
  49966. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  49967. }
  49968. public function getUpcomingInput()
  49969. {
  49970. $next = $this->match;
  49971. if (\strlen($next) < 20) {
  49972. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  49973. }
  49974. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  49975. }
  49976. public function getFullUpcomingInput()
  49977. {
  49978. $next = $this->match;
  49979. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  49980. $len = \strlen($this->input);
  49981. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  49982. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  49983. } elseif (\strlen($next) < 20) {
  49984. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  49985. }
  49986. return $next;
  49987. }
  49988. protected function parseError($str, $hash)
  49989. {
  49990. throw new \Exception($str);
  49991. }
  49992. private function next()
  49993. {
  49994. if ($this->done) {
  49995. return $this->EOF;
  49996. }
  49997. if ($this->offset === \strlen($this->input)) {
  49998. $this->done = true;
  49999. }
  50000. $token = null;
  50001. $match = null;
  50002. $col = null;
  50003. $lines = null;
  50004. if (!$this->more) {
  50005. $this->yytext = '';
  50006. $this->match = '';
  50007. }
  50008. $rules = $this->getCurrentRules();
  50009. $rulesLen = \count($rules);
  50010. for ($i=0; $i < $rulesLen; $i++) {
  50011. if (preg_match($this->rules[$rules[$i]], $this->input, $match, 0, $this->offset)) {
  50012. preg_match_all('/\n.*/', $match[0], $lines);
  50013. $lines = $lines[0];
  50014. if ($lines) {
  50015. $this->yylineno += \count($lines);
  50016. }
  50017. $this->yylloc = array(
  50018. 'first_line' => $this->yylloc['last_line'],
  50019. 'last_line' => $this->yylineno+1,
  50020. 'first_column' => $this->yylloc['last_column'],
  50021. 'last_column' => $lines ? \strlen($lines[\count($lines) - 1]) - 1 : $this->yylloc['last_column'] + \strlen($match[0]),
  50022. );
  50023. $this->yytext .= $match[0];
  50024. $this->match .= $match[0];
  50025. $this->yyleng = \strlen($this->yytext);
  50026. $this->more = false;
  50027. $this->offset += \strlen($match[0]);
  50028. $token = $this->performAction($rules[$i], $this->conditionStack[\count($this->conditionStack)-1]);
  50029. if ($token) {
  50030. return $token;
  50031. }
  50032. return new Undefined();
  50033. }
  50034. }
  50035. if ($this->offset === \strlen($this->input)) {
  50036. return $this->EOF;
  50037. }
  50038. $this->parseError(
  50039. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  50040. array(
  50041. 'text' => "",
  50042. 'token' => null,
  50043. 'line' => $this->yylineno,
  50044. )
  50045. );
  50046. }
  50047. private function getCurrentRules()
  50048. {
  50049. return $this->conditions[$this->conditionStack[\count($this->conditionStack)-1]]['rules'];
  50050. }
  50051. private function performAction($avoiding_name_collisions, $YY_START)
  50052. {
  50053. switch ($avoiding_name_collisions) {
  50054. case 0:
  50055. break;
  50056. case 1:
  50057. return 6;
  50058. break;
  50059. case 2:
  50060. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  50061. return 4;
  50062. case 3:
  50063. return 17;
  50064. case 4:
  50065. return 18;
  50066. case 5:
  50067. return 23;
  50068. case 6:
  50069. return 24;
  50070. case 7:
  50071. return 22;
  50072. case 8:
  50073. return 21;
  50074. case 9:
  50075. return 10;
  50076. case 10:
  50077. return 11;
  50078. case 11:
  50079. return 8;
  50080. case 12:
  50081. return 14;
  50082. case 13:
  50083. return 'INVALID';
  50084. }
  50085. }
  50086. }
  50087. <?php
  50088. namespace Seld\JsonLint;
  50089. class ParsingException extends \Exception
  50090. {
  50091. protected $details;
  50092. public function __construct($message, $details = array())
  50093. {
  50094. $this->details = $details;
  50095. parent::__construct($message);
  50096. }
  50097. public function getDetails()
  50098. {
  50099. return $this->details;
  50100. }
  50101. }
  50102. <?php
  50103. namespace Seld\JsonLint;
  50104. class Undefined
  50105. {
  50106. }
  50107. MIT License
  50108. Copyright (c) 2016
  50109. Permission is hereby granted, free of charge, to any person obtaining a copy
  50110. of this software and associated documentation files (the "Software"), to deal
  50111. in the Software without restriction, including without limitation the rights
  50112. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50113. copies of the Software, and to permit persons to whom the Software is
  50114. furnished to do so, subject to the following conditions:
  50115. The above copyright notice and this permission notice shall be included in all
  50116. copies or substantial portions of the Software.
  50117. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50118. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50119. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50120. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50121. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50122. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50123. SOFTWARE.
  50124. <?php
  50125. require __DIR__ . '/../vendor/autoload.php';
  50126. $data = json_decode(file_get_contents('data.json'));
  50127. $validator = new JsonSchema\Validator();
  50128. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  50129. if ($validator->isValid()) {
  50130. echo "The supplied JSON validates against the schema.\n";
  50131. } else {
  50132. echo "JSON does not validate. Violations:\n";
  50133. foreach ($validator->getErrors() as $error) {
  50134. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  50135. }
  50136. }
  50137. <?php
  50138. namespace JsonSchema\Constraints;
  50139. use JsonSchema\Entity\JsonPointer;
  50140. use JsonSchema\Exception\InvalidArgumentException;
  50141. use JsonSchema\Exception\ValidationException;
  50142. use JsonSchema\Validator;
  50143. class BaseConstraint
  50144. {
  50145. protected $errors = array();
  50146. protected $errorMask = Validator::ERROR_NONE;
  50147. protected $factory;
  50148. public function __construct(Factory $factory = null)
  50149. {
  50150. $this->factory = $factory ?: new Factory();
  50151. }
  50152. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  50153. {
  50154. $error = array(
  50155. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  50156. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  50157. 'message' => $message,
  50158. 'constraint' => $constraint,
  50159. 'context' => $this->factory->getErrorContext(),
  50160. );
  50161. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  50162. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  50163. }
  50164. if (is_array($more) && count($more) > 0) {
  50165. $error += $more;
  50166. }
  50167. $this->errors[] = $error;
  50168. $this->errorMask |= $error['context'];
  50169. }
  50170. public function addErrors(array $errors)
  50171. {
  50172. if ($errors) {
  50173. $this->errors = array_merge($this->errors, $errors);
  50174. $errorMask = &$this->errorMask;
  50175. array_walk($errors, function ($error) use (&$errorMask) {
  50176. if (isset($error['context'])) {
  50177. $errorMask |= $error['context'];
  50178. }
  50179. });
  50180. }
  50181. }
  50182. public function getErrors($errorContext = Validator::ERROR_ALL)
  50183. {
  50184. if ($errorContext === Validator::ERROR_ALL) {
  50185. return $this->errors;
  50186. }
  50187. return array_filter($this->errors, function ($error) use ($errorContext) {
  50188. if ($errorContext & $error['context']) {
  50189. return true;
  50190. }
  50191. });
  50192. }
  50193. public function numErrors($errorContext = Validator::ERROR_ALL)
  50194. {
  50195. if ($errorContext === Validator::ERROR_ALL) {
  50196. return count($this->errors);
  50197. }
  50198. return count($this->getErrors($errorContext));
  50199. }
  50200. public function isValid()
  50201. {
  50202. return !$this->getErrors();
  50203. }
  50204. public function reset()
  50205. {
  50206. $this->errors = array();
  50207. $this->errorMask = Validator::ERROR_NONE;
  50208. }
  50209. public function getErrorMask()
  50210. {
  50211. return $this->errorMask;
  50212. }
  50213. public static function arrayToObjectRecursive($array)
  50214. {
  50215. $json = json_encode($array);
  50216. if (json_last_error() !== \JSON_ERROR_NONE) {
  50217. $message = 'Unable to encode schema array as JSON';
  50218. if (function_exists('json_last_error_msg')) {
  50219. $message .= ': ' . json_last_error_msg();
  50220. }
  50221. throw new InvalidArgumentException($message);
  50222. }
  50223. return (object) json_decode($json);
  50224. }
  50225. }
  50226. <?php
  50227. namespace JsonSchema\Constraints;
  50228. use JsonSchema\Entity\JsonPointer;
  50229. class CollectionConstraint extends Constraint
  50230. {
  50231. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50232. {
  50233. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  50234. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  50235. }
  50236. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  50237. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  50238. }
  50239. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  50240. $unique = $value;
  50241. if (is_array($value) && count($value)) {
  50242. $unique = array_map(function ($e) {
  50243. return var_export($e, true);
  50244. }, $value);
  50245. }
  50246. if (count(array_unique($unique)) != count($value)) {
  50247. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  50248. }
  50249. }
  50250. if (isset($schema->items)) {
  50251. $this->validateItems($value, $schema, $path, $i);
  50252. }
  50253. }
  50254. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50255. {
  50256. if (is_object($schema->items)) {
  50257. foreach ($value as $k => &$v) {
  50258. $initErrors = $this->getErrors();
  50259. $this->checkUndefined($v, $schema->items, $path, $k);
  50260. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  50261. $secondErrors = $this->getErrors();
  50262. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  50263. }
  50264. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  50265. $this->errors = $secondErrors;
  50266. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  50267. $this->errors = $initErrors;
  50268. }
  50269. }
  50270. unset($v);
  50271. } else {
  50272. foreach ($value as $k => &$v) {
  50273. if (array_key_exists($k, $schema->items)) {
  50274. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  50275. } else {
  50276. if (property_exists($schema, 'additionalItems')) {
  50277. if ($schema->additionalItems !== false) {
  50278. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  50279. } else {
  50280. $this->addError(
  50281. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  50282. }
  50283. } else {
  50284. $this->checkUndefined($v, new \stdClass(), $path, $k);
  50285. }
  50286. }
  50287. }
  50288. unset($v);
  50289. if (count($value) > 0) {
  50290. for ($k = count($value); $k < count($schema->items); $k++) {
  50291. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  50292. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  50293. }
  50294. }
  50295. }
  50296. }
  50297. }
  50298. <?php
  50299. namespace JsonSchema\Constraints;
  50300. use JsonSchema\Entity\JsonPointer;
  50301. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  50302. {
  50303. protected $inlineSchemaProperty = '$schema';
  50304. const CHECK_MODE_NONE = 0x00000000;
  50305. const CHECK_MODE_NORMAL = 0x00000001;
  50306. const CHECK_MODE_TYPE_CAST = 0x00000002;
  50307. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  50308. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  50309. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  50310. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  50311. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  50312. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  50313. protected function incrementPath(JsonPointer $path = null, $i)
  50314. {
  50315. $path = $path ?: new JsonPointer('');
  50316. $path = $path->withPropertyPaths(
  50317. array_merge(
  50318. $path->getPropertyPaths(),
  50319. array_filter(array($i), 'strlen')
  50320. )
  50321. );
  50322. return $path;
  50323. }
  50324. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50325. {
  50326. $validator = $this->factory->createInstanceFor('collection');
  50327. $validator->check($value, $schema, $path, $i);
  50328. $this->addErrors($validator->getErrors());
  50329. }
  50330. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  50331. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  50332. {
  50333. $validator = $this->factory->createInstanceFor('object');
  50334. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  50335. $this->addErrors($validator->getErrors());
  50336. }
  50337. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50338. {
  50339. $validator = $this->factory->createInstanceFor('type');
  50340. $validator->check($value, $schema, $path, $i);
  50341. $this->addErrors($validator->getErrors());
  50342. }
  50343. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  50344. {
  50345. $validator = $this->factory->createInstanceFor('undefined');
  50346. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  50347. $this->addErrors($validator->getErrors());
  50348. }
  50349. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  50350. {
  50351. $validator = $this->factory->createInstanceFor('string');
  50352. $validator->check($value, $schema, $path, $i);
  50353. $this->addErrors($validator->getErrors());
  50354. }
  50355. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  50356. {
  50357. $validator = $this->factory->createInstanceFor('number');
  50358. $validator->check($value, $schema, $path, $i);
  50359. $this->addErrors($validator->getErrors());
  50360. }
  50361. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  50362. {
  50363. $validator = $this->factory->createInstanceFor('enum');
  50364. $validator->check($value, $schema, $path, $i);
  50365. $this->addErrors($validator->getErrors());
  50366. }
  50367. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  50368. {
  50369. $validator = $this->factory->createInstanceFor('format');
  50370. $validator->check($value, $schema, $path, $i);
  50371. $this->addErrors($validator->getErrors());
  50372. }
  50373. protected function getTypeCheck()
  50374. {
  50375. return $this->factory->getTypeCheck();
  50376. }
  50377. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  50378. {
  50379. $result = array_map(
  50380. function ($path) {
  50381. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  50382. },
  50383. $pointer->getPropertyPaths()
  50384. );
  50385. return trim(implode('', $result), '.');
  50386. }
  50387. }
  50388. <?php
  50389. namespace JsonSchema\Constraints;
  50390. use JsonSchema\Entity\JsonPointer;
  50391. interface ConstraintInterface
  50392. {
  50393. public function getErrors();
  50394. public function addErrors(array $errors);
  50395. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  50396. public function isValid();
  50397. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  50398. }
  50399. <?php
  50400. namespace JsonSchema\Constraints;
  50401. use JsonSchema\Entity\JsonPointer;
  50402. class EnumConstraint extends Constraint
  50403. {
  50404. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50405. {
  50406. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  50407. return;
  50408. }
  50409. $type = gettype($element);
  50410. foreach ($schema->enum as $enum) {
  50411. $enumType = gettype($enum);
  50412. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  50413. if ((object) $element == $enum) {
  50414. return;
  50415. }
  50416. }
  50417. if ($type === gettype($enum)) {
  50418. if ($type == 'object') {
  50419. if ($element == $enum) {
  50420. return;
  50421. }
  50422. } elseif ($element === $enum) {
  50423. return;
  50424. }
  50425. }
  50426. }
  50427. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  50428. }
  50429. }
  50430. <?php
  50431. namespace JsonSchema\Constraints;
  50432. use JsonSchema\Exception\InvalidArgumentException;
  50433. use JsonSchema\SchemaStorage;
  50434. use JsonSchema\SchemaStorageInterface;
  50435. use JsonSchema\Uri\UriRetriever;
  50436. use JsonSchema\UriRetrieverInterface;
  50437. use JsonSchema\Validator;
  50438. class Factory
  50439. {
  50440. protected $schemaStorage;
  50441. protected $uriRetriever;
  50442. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  50443. private $typeCheck = array();
  50444. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  50445. protected $constraintMap = array(
  50446. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  50447. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  50448. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  50449. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  50450. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  50451. 'string' => 'JsonSchema\Constraints\StringConstraint',
  50452. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  50453. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  50454. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  50455. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  50456. 'validator' => 'JsonSchema\Validator'
  50457. );
  50458. private $instanceCache = array();
  50459. public function __construct(
  50460. SchemaStorageInterface $schemaStorage = null,
  50461. UriRetrieverInterface $uriRetriever = null,
  50462. $checkMode = Constraint::CHECK_MODE_NORMAL
  50463. ) {
  50464. $this->setConfig($checkMode);
  50465. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  50466. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  50467. }
  50468. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  50469. {
  50470. $this->checkMode = $checkMode;
  50471. }
  50472. public function addConfig($options)
  50473. {
  50474. $this->checkMode |= $options;
  50475. }
  50476. public function removeConfig($options)
  50477. {
  50478. $this->checkMode &= ~$options;
  50479. }
  50480. public function getConfig($options = null)
  50481. {
  50482. if ($options === null) {
  50483. return $this->checkMode;
  50484. }
  50485. return $this->checkMode & $options;
  50486. }
  50487. public function getUriRetriever()
  50488. {
  50489. return $this->uriRetriever;
  50490. }
  50491. public function getSchemaStorage()
  50492. {
  50493. return $this->schemaStorage;
  50494. }
  50495. public function getTypeCheck()
  50496. {
  50497. if (!isset($this->typeCheck[$this->checkMode])) {
  50498. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  50499. ? new TypeCheck\LooseTypeCheck()
  50500. : new TypeCheck\StrictTypeCheck();
  50501. }
  50502. return $this->typeCheck[$this->checkMode];
  50503. }
  50504. public function setConstraintClass($name, $class)
  50505. {
  50506. if (!class_exists($class)) {
  50507. throw new InvalidArgumentException('Unknown constraint ' . $name);
  50508. }
  50509. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  50510. throw new InvalidArgumentException('Invalid class ' . $name);
  50511. }
  50512. $this->constraintMap[$name] = $class;
  50513. return $this;
  50514. }
  50515. public function createInstanceFor($constraintName)
  50516. {
  50517. if (!isset($this->constraintMap[$constraintName])) {
  50518. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  50519. }
  50520. if (!isset($this->instanceCache[$constraintName])) {
  50521. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  50522. }
  50523. return clone $this->instanceCache[$constraintName];
  50524. }
  50525. public function getErrorContext()
  50526. {
  50527. return $this->errorContext;
  50528. }
  50529. public function setErrorContext($errorContext)
  50530. {
  50531. $this->errorContext = $errorContext;
  50532. }
  50533. }
  50534. <?php
  50535. namespace JsonSchema\Constraints;
  50536. use JsonSchema\Entity\JsonPointer;
  50537. use JsonSchema\Rfc3339;
  50538. class FormatConstraint extends Constraint
  50539. {
  50540. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50541. {
  50542. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  50543. return;
  50544. }
  50545. switch ($schema->format) {
  50546. case 'date':
  50547. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  50548. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  50549. }
  50550. break;
  50551. case 'time':
  50552. if (!$this->validateDateTime($element, 'H:i:s')) {
  50553. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  50554. }
  50555. break;
  50556. case 'date-time':
  50557. if (null === Rfc3339::createFromString($element)) {
  50558. $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));
  50559. }
  50560. break;
  50561. case 'utc-millisec':
  50562. if (!$this->validateDateTime($element, 'U')) {
  50563. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  50564. }
  50565. break;
  50566. case 'regex':
  50567. if (!$this->validateRegex($element)) {
  50568. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  50569. }
  50570. break;
  50571. case 'color':
  50572. if (!$this->validateColor($element)) {
  50573. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  50574. }
  50575. break;
  50576. case 'style':
  50577. if (!$this->validateStyle($element)) {
  50578. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  50579. }
  50580. break;
  50581. case 'phone':
  50582. if (!$this->validatePhone($element)) {
  50583. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  50584. }
  50585. break;
  50586. case 'uri':
  50587. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  50588. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  50589. }
  50590. break;
  50591. case 'uriref':
  50592. case 'uri-reference':
  50593. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  50594. if (substr($element, 0, 2) === '//') {
  50595. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50596. } elseif (substr($element, 0, 1) === '/') {
  50597. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50598. } elseif (strlen($element)) {
  50599. $pathParts = explode('/', $element, 2);
  50600. if (strpos($pathParts[0], ':') !== false) {
  50601. $validURL = null;
  50602. } else {
  50603. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50604. }
  50605. } else {
  50606. $validURL = null;
  50607. }
  50608. if ($validURL === null) {
  50609. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  50610. }
  50611. }
  50612. break;
  50613. case 'email':
  50614. $filterFlags = FILTER_NULL_ON_FAILURE;
  50615. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  50616. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  50617. }
  50618. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  50619. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  50620. }
  50621. break;
  50622. case 'ip-address':
  50623. case 'ipv4':
  50624. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  50625. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  50626. }
  50627. break;
  50628. case 'ipv6':
  50629. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  50630. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  50631. }
  50632. break;
  50633. case 'host-name':
  50634. case 'hostname':
  50635. if (!$this->validateHostname($element)) {
  50636. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  50637. }
  50638. break;
  50639. default:
  50640. break;
  50641. }
  50642. }
  50643. protected function validateDateTime($datetime, $format)
  50644. {
  50645. $dt = \DateTime::createFromFormat($format, $datetime);
  50646. if (!$dt) {
  50647. return false;
  50648. }
  50649. if ($datetime === $dt->format($format)) {
  50650. return true;
  50651. }
  50652. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  50653. return true;
  50654. }
  50655. return false;
  50656. }
  50657. protected function validateRegex($regex)
  50658. {
  50659. return false !== @preg_match('/' . $regex . '/u', '');
  50660. }
  50661. protected function validateColor($color)
  50662. {
  50663. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  50664. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  50665. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  50666. return true;
  50667. }
  50668. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  50669. }
  50670. protected function validateStyle($style)
  50671. {
  50672. $properties = explode(';', rtrim($style, ';'));
  50673. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  50674. return empty($invalidEntries);
  50675. }
  50676. protected function validatePhone($phone)
  50677. {
  50678. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  50679. }
  50680. protected function validateHostname($host)
  50681. {
  50682. $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';
  50683. return preg_match($hostnameRegex, $host);
  50684. }
  50685. }
  50686. <?php
  50687. namespace JsonSchema\Constraints;
  50688. use JsonSchema\Entity\JsonPointer;
  50689. class NumberConstraint extends Constraint
  50690. {
  50691. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50692. {
  50693. if (isset($schema->exclusiveMinimum)) {
  50694. if (isset($schema->minimum)) {
  50695. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  50696. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  50697. } elseif ($element < $schema->minimum) {
  50698. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50699. }
  50700. } else {
  50701. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  50702. }
  50703. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  50704. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50705. }
  50706. if (isset($schema->exclusiveMaximum)) {
  50707. if (isset($schema->maximum)) {
  50708. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  50709. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  50710. } elseif ($element > $schema->maximum) {
  50711. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50712. }
  50713. } else {
  50714. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  50715. }
  50716. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  50717. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50718. }
  50719. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  50720. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  50721. }
  50722. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  50723. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  50724. }
  50725. $this->checkFormat($element, $schema, $path, $i);
  50726. }
  50727. private function fmod($number1, $number2)
  50728. {
  50729. $modulus = ($number1 - round($number1 / $number2) * $number2);
  50730. $precision = 0.0000000001;
  50731. if (-$precision < $modulus && $modulus < $precision) {
  50732. return 0.0;
  50733. }
  50734. return $modulus;
  50735. }
  50736. }
  50737. <?php
  50738. namespace JsonSchema\Constraints;
  50739. use JsonSchema\Entity\JsonPointer;
  50740. class ObjectConstraint extends Constraint
  50741. {
  50742. protected $appliedDefaults = array();
  50743. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  50744. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  50745. {
  50746. if ($element instanceof UndefinedConstraint) {
  50747. return;
  50748. }
  50749. $this->appliedDefaults = $appliedDefaults;
  50750. $matches = array();
  50751. if ($patternProperties) {
  50752. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  50753. }
  50754. if ($properties) {
  50755. $this->validateProperties($element, $properties, $path);
  50756. }
  50757. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  50758. }
  50759. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  50760. {
  50761. $try = array('/', '#', '+', '~', '%');
  50762. $matches = array();
  50763. foreach ($patternProperties as $pregex => $schema) {
  50764. $delimiter = '/';
  50765. foreach ($try as $delimiter) {
  50766. if (strpos($pregex, $delimiter) === false) {
  50767. break;
  50768. }
  50769. }
  50770. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  50771. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  50772. continue;
  50773. }
  50774. foreach ($element as $i => $value) {
  50775. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  50776. $matches[] = $i;
  50777. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  50778. }
  50779. }
  50780. }
  50781. return $matches;
  50782. }
  50783. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  50784. $properties = null, $additionalProp = null)
  50785. {
  50786. $this->validateMinMaxConstraint($element, $schema, $path);
  50787. foreach ($element as $i => $value) {
  50788. $definition = $this->getProperty($properties, $i);
  50789. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  50790. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  50791. }
  50792. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  50793. if ($additionalProp === true) {
  50794. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  50795. } else {
  50796. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  50797. }
  50798. }
  50799. $require = $this->getProperty($definition, 'requires');
  50800. if ($require && !$this->getProperty($element, $require)) {
  50801. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  50802. }
  50803. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  50804. if (is_object($property)) {
  50805. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  50806. }
  50807. }
  50808. }
  50809. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  50810. {
  50811. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  50812. foreach ($properties as $i => $value) {
  50813. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  50814. $definition = $this->getProperty($properties, $i);
  50815. if (is_object($definition)) {
  50816. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  50817. }
  50818. }
  50819. }
  50820. protected function &getProperty(&$element, $property, $fallback = null)
  50821. {
  50822. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  50823. return $element[$property];
  50824. } elseif (is_object($element) && property_exists($element, $property)) {
  50825. return $element->$property;
  50826. }
  50827. return $fallback;
  50828. }
  50829. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  50830. {
  50831. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  50832. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  50833. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  50834. }
  50835. }
  50836. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  50837. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  50838. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  50839. }
  50840. }
  50841. }
  50842. }
  50843. <?php
  50844. namespace JsonSchema\Constraints;
  50845. use JsonSchema\Entity\JsonPointer;
  50846. use JsonSchema\Exception\InvalidArgumentException;
  50847. use JsonSchema\Exception\InvalidSchemaException;
  50848. use JsonSchema\Exception\RuntimeException;
  50849. use JsonSchema\Validator;
  50850. class SchemaConstraint extends Constraint
  50851. {
  50852. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  50853. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50854. {
  50855. if ($schema !== null) {
  50856. $validationSchema = $schema;
  50857. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  50858. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  50859. } else {
  50860. throw new InvalidArgumentException('no schema found to verify against');
  50861. }
  50862. if (is_array($validationSchema)) {
  50863. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  50864. }
  50865. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  50866. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  50867. throw new RuntimeException('Cannot validate the schema of a non-object');
  50868. }
  50869. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  50870. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  50871. } else {
  50872. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  50873. }
  50874. $schemaStorage = $this->factory->getSchemaStorage();
  50875. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  50876. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  50877. }
  50878. $initialErrorCount = $this->numErrors();
  50879. $initialConfig = $this->factory->getConfig();
  50880. $initialContext = $this->factory->getErrorContext();
  50881. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  50882. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  50883. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  50884. try {
  50885. $this->check($validationSchema, $schemaSpec);
  50886. } catch (\Exception $e) {
  50887. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  50888. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  50889. }
  50890. }
  50891. if ($this->numErrors() > $initialErrorCount) {
  50892. $this->addError($path, 'Schema is not valid', 'schema');
  50893. }
  50894. $this->factory->setConfig($initialConfig);
  50895. $this->factory->setErrorContext($initialContext);
  50896. }
  50897. $this->checkUndefined($element, $validationSchema, $path, $i);
  50898. }
  50899. }
  50900. <?php
  50901. namespace JsonSchema\Constraints;
  50902. use JsonSchema\Entity\JsonPointer;
  50903. class StringConstraint extends Constraint
  50904. {
  50905. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50906. {
  50907. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  50908. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  50909. 'maxLength' => $schema->maxLength,
  50910. ));
  50911. }
  50912. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  50913. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  50914. 'minLength' => $schema->minLength,
  50915. ));
  50916. }
  50917. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  50918. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  50919. 'pattern' => $schema->pattern,
  50920. ));
  50921. }
  50922. $this->checkFormat($element, $schema, $path, $i);
  50923. }
  50924. private function strlen($string)
  50925. {
  50926. if (extension_loaded('mbstring')) {
  50927. return mb_strlen($string, mb_detect_encoding($string));
  50928. }
  50929. return strlen($string);
  50930. }
  50931. }
  50932. <?php
  50933. namespace JsonSchema\Constraints\TypeCheck;
  50934. class LooseTypeCheck implements TypeCheckInterface
  50935. {
  50936. public static function isObject($value)
  50937. {
  50938. return
  50939. is_object($value) ||
  50940. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  50941. }
  50942. public static function isArray($value)
  50943. {
  50944. return
  50945. is_array($value) &&
  50946. (count($value) == 0 || !self::isAssociativeArray($value));
  50947. }
  50948. public static function propertyGet($value, $property)
  50949. {
  50950. if (is_object($value)) {
  50951. return $value->{$property};
  50952. }
  50953. return $value[$property];
  50954. }
  50955. public static function propertySet(&$value, $property, $data)
  50956. {
  50957. if (is_object($value)) {
  50958. $value->{$property} = $data;
  50959. } else {
  50960. $value[$property] = $data;
  50961. }
  50962. }
  50963. public static function propertyExists($value, $property)
  50964. {
  50965. if (is_object($value)) {
  50966. return property_exists($value, $property);
  50967. }
  50968. return array_key_exists($property, $value);
  50969. }
  50970. public static function propertyCount($value)
  50971. {
  50972. if (is_object($value)) {
  50973. return count(get_object_vars($value));
  50974. }
  50975. return count($value);
  50976. }
  50977. private static function isAssociativeArray($arr)
  50978. {
  50979. return array_keys($arr) !== range(0, count($arr) - 1);
  50980. }
  50981. }
  50982. <?php
  50983. namespace JsonSchema\Constraints\TypeCheck;
  50984. class StrictTypeCheck implements TypeCheckInterface
  50985. {
  50986. public static function isObject($value)
  50987. {
  50988. return is_object($value);
  50989. }
  50990. public static function isArray($value)
  50991. {
  50992. return is_array($value);
  50993. }
  50994. public static function propertyGet($value, $property)
  50995. {
  50996. return $value->{$property};
  50997. }
  50998. public static function propertySet(&$value, $property, $data)
  50999. {
  51000. $value->{$property} = $data;
  51001. }
  51002. public static function propertyExists($value, $property)
  51003. {
  51004. return property_exists($value, $property);
  51005. }
  51006. public static function propertyCount($value)
  51007. {
  51008. if (!is_object($value)) {
  51009. return 0;
  51010. }
  51011. return count(get_object_vars($value));
  51012. }
  51013. }
  51014. <?php
  51015. namespace JsonSchema\Constraints\TypeCheck;
  51016. interface TypeCheckInterface
  51017. {
  51018. public static function isObject($value);
  51019. public static function isArray($value);
  51020. public static function propertyGet($value, $property);
  51021. public static function propertySet(&$value, $property, $data);
  51022. public static function propertyExists($value, $property);
  51023. public static function propertyCount($value);
  51024. }
  51025. <?php
  51026. namespace JsonSchema\Constraints;
  51027. use JsonSchema\Entity\JsonPointer;
  51028. use JsonSchema\Exception\InvalidArgumentException;
  51029. use UnexpectedValueException as StandardUnexpectedValueException;
  51030. class TypeConstraint extends Constraint
  51031. {
  51032. public static $wording = array(
  51033. 'integer' => 'an integer',
  51034. 'number' => 'a number',
  51035. 'boolean' => 'a boolean',
  51036. 'object' => 'an object',
  51037. 'array' => 'an array',
  51038. 'string' => 'a string',
  51039. 'null' => 'a null',
  51040. 'any' => null,
  51041. 0 => null,
  51042. );
  51043. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  51044. {
  51045. $type = isset($schema->type) ? $schema->type : null;
  51046. $isValid = false;
  51047. $wording = array();
  51048. if (is_array($type)) {
  51049. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  51050. } elseif (is_object($type)) {
  51051. $this->checkUndefined($value, $type, $path);
  51052. return;
  51053. } else {
  51054. $isValid = $this->validateType($value, $type);
  51055. }
  51056. if ($isValid === false) {
  51057. if (!is_array($type)) {
  51058. $this->validateTypeNameWording($type);
  51059. $wording[] = self::$wording[$type];
  51060. }
  51061. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  51062. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  51063. }
  51064. }
  51065. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  51066. {
  51067. foreach ($type as $tp) {
  51068. if (is_object($tp)) {
  51069. if (!$isValid) {
  51070. $validator = $this->factory->createInstanceFor('type');
  51071. $subSchema = new \stdClass();
  51072. $subSchema->type = $tp;
  51073. $validator->check($value, $subSchema, $path, null);
  51074. $error = $validator->getErrors();
  51075. $isValid = !(bool) $error;
  51076. $validTypesWording[] = self::$wording['object'];
  51077. }
  51078. } else {
  51079. $this->validateTypeNameWording($tp);
  51080. $validTypesWording[] = self::$wording[$tp];
  51081. if (!$isValid) {
  51082. $isValid = $this->validateType($value, $tp);
  51083. }
  51084. }
  51085. }
  51086. }
  51087. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  51088. {
  51089. if ($listEnd === false || !isset($elements[1])) {
  51090. return implode($delimiter, $elements);
  51091. }
  51092. $lastElement = array_slice($elements, -1);
  51093. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  51094. $implodedElements = array_merge(array($firsElements), $lastElement);
  51095. return join(" $listEnd ", $implodedElements);
  51096. }
  51097. protected function validateTypeNameWording($type)
  51098. {
  51099. if (!isset(self::$wording[$type])) {
  51100. throw new StandardUnexpectedValueException(
  51101. sprintf(
  51102. 'No wording for %s available, expected wordings are: [%s]',
  51103. var_export($type, true),
  51104. implode(', ', array_filter(self::$wording)))
  51105. );
  51106. }
  51107. }
  51108. protected function validateType(&$value, $type)
  51109. {
  51110. if (!$type) {
  51111. return true;
  51112. }
  51113. if ('any' === $type) {
  51114. return true;
  51115. }
  51116. if ('object' === $type) {
  51117. return $this->getTypeCheck()->isObject($value);
  51118. }
  51119. if ('array' === $type) {
  51120. return $this->getTypeCheck()->isArray($value);
  51121. }
  51122. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  51123. if ('integer' === $type) {
  51124. if ($coerce) {
  51125. $value = $this->toInteger($value);
  51126. }
  51127. return is_int($value);
  51128. }
  51129. if ('number' === $type) {
  51130. if ($coerce) {
  51131. $value = $this->toNumber($value);
  51132. }
  51133. return is_numeric($value) && !is_string($value);
  51134. }
  51135. if ('boolean' === $type) {
  51136. if ($coerce) {
  51137. $value = $this->toBoolean($value);
  51138. }
  51139. return is_bool($value);
  51140. }
  51141. if ('string' === $type) {
  51142. return is_string($value);
  51143. }
  51144. if ('email' === $type) {
  51145. return is_string($value);
  51146. }
  51147. if ('null' === $type) {
  51148. return is_null($value);
  51149. }
  51150. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  51151. }
  51152. protected function toBoolean($value)
  51153. {
  51154. if ($value === 'true') {
  51155. return true;
  51156. }
  51157. if ($value === 'false') {
  51158. return false;
  51159. }
  51160. return $value;
  51161. }
  51162. protected function toNumber($value)
  51163. {
  51164. if (is_numeric($value)) {
  51165. return $value + 0;
  51166. }
  51167. return $value;
  51168. }
  51169. protected function toInteger($value)
  51170. {
  51171. if (is_numeric($value) && (int) $value == $value) {
  51172. return (int) $value;
  51173. }
  51174. return $value;
  51175. }
  51176. }
  51177. <?php
  51178. namespace JsonSchema\Constraints;
  51179. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  51180. use JsonSchema\Entity\JsonPointer;
  51181. use JsonSchema\Exception\ValidationException;
  51182. use JsonSchema\Uri\UriResolver;
  51183. class UndefinedConstraint extends Constraint
  51184. {
  51185. protected $appliedDefaults = array();
  51186. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  51187. {
  51188. if (is_null($schema) || !is_object($schema)) {
  51189. return;
  51190. }
  51191. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  51192. if ($fromDefault) {
  51193. $path->setFromDefault();
  51194. }
  51195. $this->validateCommonProperties($value, $schema, $path, $i);
  51196. $this->validateOfProperties($value, $schema, $path, '');
  51197. $this->validateTypes($value, $schema, $path, $i);
  51198. }
  51199. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  51200. {
  51201. if ($this->getTypeCheck()->isArray($value)) {
  51202. $this->checkArray($value, $schema, $path, $i);
  51203. }
  51204. if (LooseTypeCheck::isObject($value)) {
  51205. $this->checkObject(
  51206. $value,
  51207. $schema,
  51208. $path,
  51209. isset($schema->properties) ? $schema->properties : null,
  51210. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  51211. isset($schema->patternProperties) ? $schema->patternProperties : null,
  51212. $this->appliedDefaults
  51213. );
  51214. }
  51215. if (is_string($value)) {
  51216. $this->checkString($value, $schema, $path, $i);
  51217. }
  51218. if (is_numeric($value)) {
  51219. $this->checkNumber($value, $schema, $path, $i);
  51220. }
  51221. if (isset($schema->enum)) {
  51222. $this->checkEnum($value, $schema, $path, $i);
  51223. }
  51224. }
  51225. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  51226. {
  51227. if (isset($schema->extends)) {
  51228. if (is_string($schema->extends)) {
  51229. $schema->extends = $this->validateUri($schema, $schema->extends);
  51230. }
  51231. if (is_array($schema->extends)) {
  51232. foreach ($schema->extends as $extends) {
  51233. $this->checkUndefined($value, $extends, $path, $i);
  51234. }
  51235. } else {
  51236. $this->checkUndefined($value, $schema->extends, $path, $i);
  51237. }
  51238. }
  51239. if (!$path->fromDefault()) {
  51240. $this->applyDefaultValues($value, $schema, $path);
  51241. }
  51242. if ($this->getTypeCheck()->isObject($value)) {
  51243. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  51244. foreach ($schema->required as $required) {
  51245. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  51246. $this->addError(
  51247. $this->incrementPath($path ?: new JsonPointer(''), $required),
  51248. 'The property ' . $required . ' is required',
  51249. 'required'
  51250. );
  51251. }
  51252. }
  51253. } elseif (isset($schema->required) && !is_array($schema->required)) {
  51254. if ($schema->required && $value instanceof self) {
  51255. $propertyPaths = $path->getPropertyPaths();
  51256. $propertyName = end($propertyPaths);
  51257. $this->addError(
  51258. $path,
  51259. 'The property ' . $propertyName . ' is required',
  51260. 'required'
  51261. );
  51262. }
  51263. } else {
  51264. if ($value instanceof self) {
  51265. return;
  51266. }
  51267. }
  51268. }
  51269. if (!($value instanceof self)) {
  51270. $this->checkType($value, $schema, $path, $i);
  51271. }
  51272. if (isset($schema->disallow)) {
  51273. $initErrors = $this->getErrors();
  51274. $typeSchema = new \stdClass();
  51275. $typeSchema->type = $schema->disallow;
  51276. $this->checkType($value, $typeSchema, $path);
  51277. if (count($this->getErrors()) == count($initErrors)) {
  51278. $this->addError($path, 'Disallowed value was matched', 'disallow');
  51279. } else {
  51280. $this->errors = $initErrors;
  51281. }
  51282. }
  51283. if (isset($schema->not)) {
  51284. $initErrors = $this->getErrors();
  51285. $this->checkUndefined($value, $schema->not, $path, $i);
  51286. if (count($this->getErrors()) == count($initErrors)) {
  51287. $this->addError($path, 'Matched a schema which it should not', 'not');
  51288. } else {
  51289. $this->errors = $initErrors;
  51290. }
  51291. }
  51292. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  51293. $this->validateDependencies($value, $schema->dependencies, $path);
  51294. }
  51295. }
  51296. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  51297. {
  51298. if (!$requiredOnly) {
  51299. return true;
  51300. }
  51301. if (
  51302. $name !== null
  51303. && isset($parentSchema->required)
  51304. && is_array($parentSchema->required)
  51305. && in_array($name, $parentSchema->required)
  51306. ) {
  51307. return true;
  51308. }
  51309. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  51310. return true;
  51311. }
  51312. return false;
  51313. }
  51314. protected function applyDefaultValues(&$value, $schema, $path)
  51315. {
  51316. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  51317. return;
  51318. }
  51319. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  51320. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  51321. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  51322. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  51323. if (
  51324. !LooseTypeCheck::propertyExists($value, $currentProperty)
  51325. && property_exists($propertyDefinition, 'default')
  51326. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  51327. ) {
  51328. if (is_object($propertyDefinition->default)) {
  51329. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  51330. } else {
  51331. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  51332. }
  51333. $this->appliedDefaults[] = $currentProperty;
  51334. }
  51335. }
  51336. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  51337. $items = array();
  51338. if (LooseTypeCheck::isArray($schema->items)) {
  51339. $items = $schema->items;
  51340. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  51341. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  51342. }
  51343. foreach ($items as $currentItem => $itemDefinition) {
  51344. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  51345. if (
  51346. !array_key_exists($currentItem, $value)
  51347. && property_exists($itemDefinition, 'default')
  51348. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  51349. if (is_object($itemDefinition->default)) {
  51350. $value[$currentItem] = clone $itemDefinition->default;
  51351. } else {
  51352. $value[$currentItem] = $itemDefinition->default;
  51353. }
  51354. }
  51355. $path->setFromDefault();
  51356. }
  51357. } elseif (
  51358. $value instanceof self
  51359. && property_exists($schema, 'default')
  51360. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  51361. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  51362. $path->setFromDefault();
  51363. }
  51364. }
  51365. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  51366. {
  51367. if ($value instanceof self) {
  51368. return;
  51369. }
  51370. if (isset($schema->allOf)) {
  51371. $isValid = true;
  51372. foreach ($schema->allOf as $allOf) {
  51373. $initErrors = $this->getErrors();
  51374. $this->checkUndefined($value, $allOf, $path, $i);
  51375. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  51376. }
  51377. if (!$isValid) {
  51378. $this->addError($path, 'Failed to match all schemas', 'allOf');
  51379. }
  51380. }
  51381. if (isset($schema->anyOf)) {
  51382. $isValid = false;
  51383. $startErrors = $this->getErrors();
  51384. $caughtException = null;
  51385. foreach ($schema->anyOf as $anyOf) {
  51386. $initErrors = $this->getErrors();
  51387. try {
  51388. $this->checkUndefined($value, $anyOf, $path, $i);
  51389. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  51390. break;
  51391. }
  51392. } catch (ValidationException $e) {
  51393. $isValid = false;
  51394. }
  51395. }
  51396. if (!$isValid) {
  51397. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  51398. } else {
  51399. $this->errors = $startErrors;
  51400. }
  51401. }
  51402. if (isset($schema->oneOf)) {
  51403. $allErrors = array();
  51404. $matchedSchemas = 0;
  51405. $startErrors = $this->getErrors();
  51406. foreach ($schema->oneOf as $oneOf) {
  51407. try {
  51408. $this->errors = array();
  51409. $this->checkUndefined($value, $oneOf, $path, $i);
  51410. if (count($this->getErrors()) == 0) {
  51411. $matchedSchemas++;
  51412. }
  51413. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  51414. } catch (ValidationException $e) {
  51415. }
  51416. }
  51417. if ($matchedSchemas !== 1) {
  51418. $this->addErrors(array_merge($allErrors, $startErrors));
  51419. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  51420. } else {
  51421. $this->errors = $startErrors;
  51422. }
  51423. }
  51424. }
  51425. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  51426. {
  51427. foreach ($dependencies as $key => $dependency) {
  51428. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  51429. if (is_string($dependency)) {
  51430. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  51431. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  51432. }
  51433. } elseif (is_array($dependency)) {
  51434. foreach ($dependency as $d) {
  51435. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  51436. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  51437. }
  51438. }
  51439. } elseif (is_object($dependency)) {
  51440. $this->checkUndefined($value, $dependency, $path, $i);
  51441. }
  51442. }
  51443. }
  51444. }
  51445. protected function validateUri($schema, $schemaUri = null)
  51446. {
  51447. $resolver = new UriResolver();
  51448. $retriever = $this->factory->getUriRetriever();
  51449. $jsonSchema = null;
  51450. if ($resolver->isValid($schemaUri)) {
  51451. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  51452. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  51453. }
  51454. return $jsonSchema;
  51455. }
  51456. }
  51457. <?php
  51458. namespace JsonSchema\Entity;
  51459. use JsonSchema\Exception\InvalidArgumentException;
  51460. class JsonPointer
  51461. {
  51462. private $filename;
  51463. private $propertyPaths = array();
  51464. private $fromDefault = false;
  51465. public function __construct($value)
  51466. {
  51467. if (!is_string($value)) {
  51468. throw new InvalidArgumentException('Ref value must be a string');
  51469. }
  51470. $splitRef = explode('#', $value, 2);
  51471. $this->filename = $splitRef[0];
  51472. if (array_key_exists(1, $splitRef)) {
  51473. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  51474. }
  51475. }
  51476. private function decodePropertyPaths($propertyPathString)
  51477. {
  51478. $paths = array();
  51479. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  51480. $path = $this->decodePath($path);
  51481. if (is_string($path) && '' !== $path) {
  51482. $paths[] = $path;
  51483. }
  51484. }
  51485. return $paths;
  51486. }
  51487. private function encodePropertyPaths()
  51488. {
  51489. return array_map(
  51490. array($this, 'encodePath'),
  51491. $this->getPropertyPaths()
  51492. );
  51493. }
  51494. private function decodePath($path)
  51495. {
  51496. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  51497. }
  51498. private function encodePath($path)
  51499. {
  51500. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  51501. }
  51502. public function getFilename()
  51503. {
  51504. return $this->filename;
  51505. }
  51506. public function getPropertyPaths()
  51507. {
  51508. return $this->propertyPaths;
  51509. }
  51510. public function withPropertyPaths(array $propertyPaths)
  51511. {
  51512. $new = clone $this;
  51513. $new->propertyPaths = $propertyPaths;
  51514. return $new;
  51515. }
  51516. public function getPropertyPathAsString()
  51517. {
  51518. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  51519. }
  51520. public function __toString()
  51521. {
  51522. return $this->getFilename() . $this->getPropertyPathAsString();
  51523. }
  51524. public function setFromDefault()
  51525. {
  51526. $this->fromDefault = true;
  51527. }
  51528. public function fromDefault()
  51529. {
  51530. return $this->fromDefault;
  51531. }
  51532. }
  51533. <?php
  51534. namespace JsonSchema\Exception;
  51535. interface ExceptionInterface
  51536. {
  51537. }
  51538. <?php
  51539. namespace JsonSchema\Exception;
  51540. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  51541. {
  51542. }
  51543. <?php
  51544. namespace JsonSchema\Exception;
  51545. class InvalidConfigException extends RuntimeException
  51546. {
  51547. }
  51548. <?php
  51549. namespace JsonSchema\Exception;
  51550. class InvalidSchemaException extends RuntimeException
  51551. {
  51552. }
  51553. <?php
  51554. namespace JsonSchema\Exception;
  51555. class InvalidSchemaMediaTypeException extends RuntimeException
  51556. {
  51557. }
  51558. <?php
  51559. namespace JsonSchema\Exception;
  51560. class InvalidSourceUriException extends InvalidArgumentException
  51561. {
  51562. }
  51563. <?php
  51564. namespace JsonSchema\Exception;
  51565. class JsonDecodingException extends RuntimeException
  51566. {
  51567. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  51568. {
  51569. switch ($code) {
  51570. case JSON_ERROR_DEPTH:
  51571. $message = 'The maximum stack depth has been exceeded';
  51572. break;
  51573. case JSON_ERROR_STATE_MISMATCH:
  51574. $message = 'Invalid or malformed JSON';
  51575. break;
  51576. case JSON_ERROR_CTRL_CHAR:
  51577. $message = 'Control character error, possibly incorrectly encoded';
  51578. break;
  51579. case JSON_ERROR_UTF8:
  51580. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  51581. break;
  51582. case JSON_ERROR_SYNTAX:
  51583. $message = 'JSON syntax is malformed';
  51584. break;
  51585. default:
  51586. $message = 'Syntax error';
  51587. }
  51588. parent::__construct($message, $code, $previous);
  51589. }
  51590. }
  51591. <?php
  51592. namespace JsonSchema\Exception;
  51593. class ResourceNotFoundException extends RuntimeException
  51594. {
  51595. }
  51596. <?php
  51597. namespace JsonSchema\Exception;
  51598. class RuntimeException extends \RuntimeException implements ExceptionInterface
  51599. {
  51600. }
  51601. <?php
  51602. namespace JsonSchema\Exception;
  51603. class UnresolvableJsonPointerException extends InvalidArgumentException
  51604. {
  51605. }
  51606. <?php
  51607. namespace JsonSchema\Exception;
  51608. class UriResolverException extends RuntimeException
  51609. {
  51610. }
  51611. <?php
  51612. namespace JsonSchema\Exception;
  51613. class ValidationException extends RuntimeException
  51614. {
  51615. }
  51616. <?php
  51617. namespace JsonSchema\Iterator;
  51618. class ObjectIterator implements \Iterator, \Countable
  51619. {
  51620. private $object;
  51621. private $position = 0;
  51622. private $data = array();
  51623. private $initialized = false;
  51624. public function __construct($object)
  51625. {
  51626. $this->object = $object;
  51627. }
  51628. public function current()
  51629. {
  51630. $this->initialize();
  51631. return $this->data[$this->position];
  51632. }
  51633. public function next()
  51634. {
  51635. $this->initialize();
  51636. $this->position++;
  51637. }
  51638. public function key()
  51639. {
  51640. $this->initialize();
  51641. return $this->position;
  51642. }
  51643. public function valid()
  51644. {
  51645. $this->initialize();
  51646. return isset($this->data[$this->position]);
  51647. }
  51648. public function rewind()
  51649. {
  51650. $this->initialize();
  51651. $this->position = 0;
  51652. }
  51653. public function count()
  51654. {
  51655. $this->initialize();
  51656. return count($this->data);
  51657. }
  51658. private function initialize()
  51659. {
  51660. if (!$this->initialized) {
  51661. $this->data = $this->buildDataFromObject($this->object);
  51662. $this->initialized = true;
  51663. }
  51664. }
  51665. private function buildDataFromObject($object)
  51666. {
  51667. $result = array();
  51668. $stack = new \SplStack();
  51669. $stack->push($object);
  51670. while (!$stack->isEmpty()) {
  51671. $current = $stack->pop();
  51672. if (is_object($current)) {
  51673. array_push($result, $current);
  51674. }
  51675. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  51676. if (is_object($propertyValue) || is_array($propertyValue)) {
  51677. $stack->push($propertyValue);
  51678. }
  51679. }
  51680. }
  51681. return $result;
  51682. }
  51683. private function getDataFromItem($item)
  51684. {
  51685. if (!is_object($item) && !is_array($item)) {
  51686. return array();
  51687. }
  51688. return is_object($item) ? get_object_vars($item) : $item;
  51689. }
  51690. }
  51691. <?php
  51692. namespace JsonSchema;
  51693. class Rfc3339
  51694. {
  51695. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  51696. public static function createFromString($string)
  51697. {
  51698. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  51699. return null;
  51700. }
  51701. $dateAndTime = $matches[1];
  51702. $microseconds = $matches[2] ?: '.000000';
  51703. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  51704. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  51705. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  51706. return $dateTime ?: null;
  51707. }
  51708. }
  51709. <?php
  51710. namespace JsonSchema;
  51711. use JsonSchema\Constraints\BaseConstraint;
  51712. use JsonSchema\Entity\JsonPointer;
  51713. use JsonSchema\Exception\UnresolvableJsonPointerException;
  51714. use JsonSchema\Uri\UriResolver;
  51715. use JsonSchema\Uri\UriRetriever;
  51716. class SchemaStorage implements SchemaStorageInterface
  51717. {
  51718. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  51719. protected $uriRetriever;
  51720. protected $uriResolver;
  51721. protected $schemas = array();
  51722. public function __construct(
  51723. UriRetrieverInterface $uriRetriever = null,
  51724. UriResolverInterface $uriResolver = null
  51725. ) {
  51726. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  51727. $this->uriResolver = $uriResolver ?: new UriResolver();
  51728. }
  51729. public function getUriRetriever()
  51730. {
  51731. return $this->uriRetriever;
  51732. }
  51733. public function getUriResolver()
  51734. {
  51735. return $this->uriResolver;
  51736. }
  51737. public function addSchema($id, $schema = null)
  51738. {
  51739. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  51740. $schema = $this->uriRetriever->retrieve($id);
  51741. }
  51742. if (is_array($schema)) {
  51743. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  51744. }
  51745. if (is_object($schema) && property_exists($schema, 'id')) {
  51746. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  51747. $schema->properties->id->format = 'uri-reference';
  51748. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  51749. $schema->properties->id->format = 'uri-reference';
  51750. $schema->properties->{'$ref'}->format = 'uri-reference';
  51751. }
  51752. }
  51753. $this->expandRefs($schema, $id);
  51754. $this->schemas[$id] = $schema;
  51755. }
  51756. private function expandRefs(&$schema, $base = null)
  51757. {
  51758. if (!is_object($schema)) {
  51759. if (is_array($schema)) {
  51760. foreach ($schema as &$member) {
  51761. $this->expandRefs($member, $base);
  51762. }
  51763. }
  51764. return;
  51765. }
  51766. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  51767. $base = $this->uriResolver->resolve($schema->id, $base);
  51768. }
  51769. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  51770. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  51771. $schema->{'$ref'} = (string) $refPointer;
  51772. }
  51773. foreach ($schema as &$member) {
  51774. $this->expandRefs($member, $base);
  51775. }
  51776. }
  51777. public function getSchema($id)
  51778. {
  51779. if (!array_key_exists($id, $this->schemas)) {
  51780. $this->addSchema($id);
  51781. }
  51782. return $this->schemas[$id];
  51783. }
  51784. public function resolveRef($ref)
  51785. {
  51786. $jsonPointer = new JsonPointer($ref);
  51787. $fileName = $jsonPointer->getFilename();
  51788. if (!strlen($fileName)) {
  51789. throw new UnresolvableJsonPointerException(sprintf(
  51790. "Could not resolve fragment '%s': no file is defined",
  51791. $jsonPointer->getPropertyPathAsString()
  51792. ));
  51793. }
  51794. $refSchema = $this->getSchema($fileName);
  51795. foreach ($jsonPointer->getPropertyPaths() as $path) {
  51796. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  51797. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  51798. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  51799. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  51800. } else {
  51801. throw new UnresolvableJsonPointerException(sprintf(
  51802. 'File: %s is found, but could not resolve fragment: %s',
  51803. $jsonPointer->getFilename(),
  51804. $jsonPointer->getPropertyPathAsString()
  51805. ));
  51806. }
  51807. }
  51808. return $refSchema;
  51809. }
  51810. public function resolveRefSchema($refSchema)
  51811. {
  51812. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  51813. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  51814. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  51815. unset($refSchema->{'$ref'});
  51816. }
  51817. return $refSchema;
  51818. }
  51819. }
  51820. <?php
  51821. namespace JsonSchema;
  51822. interface SchemaStorageInterface
  51823. {
  51824. public function addSchema($id, $schema = null);
  51825. public function getSchema($id);
  51826. public function resolveRef($ref);
  51827. public function resolveRefSchema($refSchema);
  51828. }
  51829. <?php
  51830. namespace JsonSchema\Uri\Retrievers;
  51831. abstract class AbstractRetriever implements UriRetrieverInterface
  51832. {
  51833. protected $contentType;
  51834. public function getContentType()
  51835. {
  51836. return $this->contentType;
  51837. }
  51838. }
  51839. <?php
  51840. namespace JsonSchema\Uri\Retrievers;
  51841. use JsonSchema\Exception\RuntimeException;
  51842. use JsonSchema\Validator;
  51843. class Curl extends AbstractRetriever
  51844. {
  51845. protected $messageBody;
  51846. public function __construct()
  51847. {
  51848. if (!function_exists('curl_init')) {
  51849. throw new RuntimeException('cURL not installed');
  51850. }
  51851. }
  51852. public function retrieve($uri)
  51853. {
  51854. $ch = curl_init();
  51855. curl_setopt($ch, CURLOPT_URL, $uri);
  51856. curl_setopt($ch, CURLOPT_HEADER, true);
  51857. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  51858. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  51859. $response = curl_exec($ch);
  51860. if (false === $response) {
  51861. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  51862. }
  51863. $this->fetchMessageBody($response);
  51864. $this->fetchContentType($response);
  51865. curl_close($ch);
  51866. return $this->messageBody;
  51867. }
  51868. private function fetchMessageBody($response)
  51869. {
  51870. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  51871. $this->messageBody = $match[1];
  51872. }
  51873. protected function fetchContentType($response)
  51874. {
  51875. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  51876. $this->contentType = trim($match[1]);
  51877. return true;
  51878. }
  51879. return false;
  51880. }
  51881. }
  51882. <?php
  51883. namespace JsonSchema\Uri\Retrievers;
  51884. use JsonSchema\Exception\ResourceNotFoundException;
  51885. class FileGetContents extends AbstractRetriever
  51886. {
  51887. protected $messageBody;
  51888. public function retrieve($uri)
  51889. {
  51890. $errorMessage = null;
  51891. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  51892. $errorMessage = $errstr;
  51893. });
  51894. $response = file_get_contents($uri);
  51895. restore_error_handler();
  51896. if ($errorMessage) {
  51897. throw new ResourceNotFoundException($errorMessage);
  51898. }
  51899. if (false === $response) {
  51900. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51901. }
  51902. if ($response == ''
  51903. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  51904. ) {
  51905. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51906. }
  51907. $this->messageBody = $response;
  51908. if (!empty($http_response_header)) {
  51909. $this->fetchContentType($http_response_header);
  51910. } else {
  51911. $this->contentType = null;
  51912. }
  51913. return $this->messageBody;
  51914. }
  51915. private function fetchContentType(array $headers)
  51916. {
  51917. foreach ($headers as $header) {
  51918. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  51919. return true;
  51920. }
  51921. }
  51922. return false;
  51923. }
  51924. protected static function getContentTypeMatchInHeader($header)
  51925. {
  51926. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  51927. return trim($match[1]);
  51928. }
  51929. return null;
  51930. }
  51931. }
  51932. <?php
  51933. namespace JsonSchema\Uri\Retrievers;
  51934. use JsonSchema\Validator;
  51935. class PredefinedArray extends AbstractRetriever
  51936. {
  51937. private $schemas;
  51938. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  51939. {
  51940. $this->schemas = $schemas;
  51941. $this->contentType = $contentType;
  51942. }
  51943. public function retrieve($uri)
  51944. {
  51945. if (!array_key_exists($uri, $this->schemas)) {
  51946. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  51947. 'The JSON schema "%s" was not found.',
  51948. $uri
  51949. ));
  51950. }
  51951. return $this->schemas[$uri];
  51952. }
  51953. }
  51954. <?php
  51955. namespace JsonSchema\Uri\Retrievers;
  51956. interface UriRetrieverInterface
  51957. {
  51958. public function retrieve($uri);
  51959. public function getContentType();
  51960. }
  51961. <?php
  51962. namespace JsonSchema\Uri;
  51963. use JsonSchema\Exception\UriResolverException;
  51964. use JsonSchema\UriResolverInterface;
  51965. class UriResolver implements UriResolverInterface
  51966. {
  51967. public function parse($uri)
  51968. {
  51969. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  51970. $components = array();
  51971. if (5 < count($match)) {
  51972. $components = array(
  51973. 'scheme' => $match[2],
  51974. 'authority' => $match[4],
  51975. 'path' => $match[5]
  51976. );
  51977. }
  51978. if (7 < count($match)) {
  51979. $components['query'] = $match[7];
  51980. }
  51981. if (9 < count($match)) {
  51982. $components['fragment'] = $match[9];
  51983. }
  51984. return $components;
  51985. }
  51986. public function generate(array $components)
  51987. {
  51988. $uri = $components['scheme'] . '://'
  51989. . $components['authority']
  51990. . $components['path'];
  51991. if (array_key_exists('query', $components) && strlen($components['query'])) {
  51992. $uri .= '?' . $components['query'];
  51993. }
  51994. if (array_key_exists('fragment', $components)) {
  51995. $uri .= '#' . $components['fragment'];
  51996. }
  51997. return $uri;
  51998. }
  51999. public function resolve($uri, $baseUri = null)
  52000. {
  52001. if (
  52002. !is_null($baseUri) &&
  52003. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  52004. !preg_match('|^[^/]+://|u', $baseUri)
  52005. ) {
  52006. if (is_file($baseUri)) {
  52007. $baseUri = 'file://' . realpath($baseUri);
  52008. } elseif (is_dir($baseUri)) {
  52009. $baseUri = 'file://' . realpath($baseUri) . '/';
  52010. } else {
  52011. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  52012. }
  52013. }
  52014. if ($uri == '') {
  52015. return $baseUri;
  52016. }
  52017. $components = $this->parse($uri);
  52018. $path = $components['path'];
  52019. if (!empty($components['scheme'])) {
  52020. return $uri;
  52021. }
  52022. $baseComponents = $this->parse($baseUri);
  52023. $basePath = $baseComponents['path'];
  52024. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  52025. if (isset($components['fragment'])) {
  52026. $baseComponents['fragment'] = $components['fragment'];
  52027. }
  52028. return $this->generate($baseComponents);
  52029. }
  52030. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  52031. {
  52032. $relativePath = self::normalizePath($relativePath);
  52033. if ($relativePath == '') {
  52034. return $basePath;
  52035. }
  52036. if ($relativePath[0] == '/') {
  52037. return $relativePath;
  52038. }
  52039. $basePathSegments = explode('/', $basePath);
  52040. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  52041. $numLevelUp = strlen($match[0]) /3 + 1;
  52042. if ($numLevelUp >= count($basePathSegments)) {
  52043. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  52044. }
  52045. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  52046. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  52047. return implode('/', $basePathSegments) . '/' . $path;
  52048. }
  52049. private static function normalizePath($path)
  52050. {
  52051. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  52052. $path = preg_replace('|//|', '/', $path);
  52053. return $path;
  52054. }
  52055. public function isValid($uri)
  52056. {
  52057. $components = $this->parse($uri);
  52058. return !empty($components);
  52059. }
  52060. }
  52061. <?php
  52062. namespace JsonSchema\Uri;
  52063. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  52064. use JsonSchema\Exception\JsonDecodingException;
  52065. use JsonSchema\Exception\ResourceNotFoundException;
  52066. use JsonSchema\Uri\Retrievers\FileGetContents;
  52067. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  52068. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  52069. use JsonSchema\Validator;
  52070. class UriRetriever implements BaseUriRetrieverInterface
  52071. {
  52072. protected $translationMap = array(
  52073. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  52074. );
  52075. protected $allowedInvalidContentTypeEndpoints = array(
  52076. 'http://json-schema.org/',
  52077. 'https://json-schema.org/'
  52078. );
  52079. protected $uriRetriever = null;
  52080. private $schemaCache = array();
  52081. public function addInvalidContentTypeEndpoint($endpoint)
  52082. {
  52083. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  52084. }
  52085. public function confirmMediaType($uriRetriever, $uri)
  52086. {
  52087. $contentType = $uriRetriever->getContentType();
  52088. if (is_null($contentType)) {
  52089. return;
  52090. }
  52091. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  52092. return;
  52093. }
  52094. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  52095. if (strpos($uri, $endpoint) === 0) {
  52096. return true;
  52097. }
  52098. }
  52099. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  52100. }
  52101. public function getUriRetriever()
  52102. {
  52103. if (is_null($this->uriRetriever)) {
  52104. $this->setUriRetriever(new FileGetContents());
  52105. }
  52106. return $this->uriRetriever;
  52107. }
  52108. public function resolvePointer($jsonSchema, $uri)
  52109. {
  52110. $resolver = new UriResolver();
  52111. $parsed = $resolver->parse($uri);
  52112. if (empty($parsed['fragment'])) {
  52113. return $jsonSchema;
  52114. }
  52115. $path = explode('/', $parsed['fragment']);
  52116. while ($path) {
  52117. $pathElement = array_shift($path);
  52118. if (!empty($pathElement)) {
  52119. $pathElement = str_replace('~1', '/', $pathElement);
  52120. $pathElement = str_replace('~0', '~', $pathElement);
  52121. if (!empty($jsonSchema->$pathElement)) {
  52122. $jsonSchema = $jsonSchema->$pathElement;
  52123. } else {
  52124. throw new ResourceNotFoundException(
  52125. 'Fragment "' . $parsed['fragment'] . '" not found'
  52126. . ' in ' . $uri
  52127. );
  52128. }
  52129. if (!is_object($jsonSchema)) {
  52130. throw new ResourceNotFoundException(
  52131. 'Fragment part "' . $pathElement . '" is no object '
  52132. . ' in ' . $uri
  52133. );
  52134. }
  52135. }
  52136. }
  52137. return $jsonSchema;
  52138. }
  52139. public function retrieve($uri, $baseUri = null, $translate = true)
  52140. {
  52141. $resolver = new UriResolver();
  52142. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  52143. $arParts = $resolver->parse($resolvedUri);
  52144. if (isset($arParts['fragment'])) {
  52145. unset($arParts['fragment']);
  52146. $fetchUri = $resolver->generate($arParts);
  52147. }
  52148. if ($translate) {
  52149. $fetchUri = $this->translate($fetchUri);
  52150. }
  52151. $jsonSchema = $this->loadSchema($fetchUri);
  52152. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  52153. if ($jsonSchema instanceof \stdClass) {
  52154. $jsonSchema->id = $resolvedUri;
  52155. }
  52156. return $jsonSchema;
  52157. }
  52158. protected function loadSchema($fetchUri)
  52159. {
  52160. if (isset($this->schemaCache[$fetchUri])) {
  52161. return $this->schemaCache[$fetchUri];
  52162. }
  52163. $uriRetriever = $this->getUriRetriever();
  52164. $contents = $this->uriRetriever->retrieve($fetchUri);
  52165. $this->confirmMediaType($uriRetriever, $fetchUri);
  52166. $jsonSchema = json_decode($contents);
  52167. if (JSON_ERROR_NONE < $error = json_last_error()) {
  52168. throw new JsonDecodingException($error);
  52169. }
  52170. $this->schemaCache[$fetchUri] = $jsonSchema;
  52171. return $jsonSchema;
  52172. }
  52173. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  52174. {
  52175. $this->uriRetriever = $uriRetriever;
  52176. return $this;
  52177. }
  52178. public function parse($uri)
  52179. {
  52180. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  52181. $components = array();
  52182. if (5 < count($match)) {
  52183. $components = array(
  52184. 'scheme' => $match[2],
  52185. 'authority' => $match[4],
  52186. 'path' => $match[5]
  52187. );
  52188. }
  52189. if (7 < count($match)) {
  52190. $components['query'] = $match[7];
  52191. }
  52192. if (9 < count($match)) {
  52193. $components['fragment'] = $match[9];
  52194. }
  52195. return $components;
  52196. }
  52197. public function generate(array $components)
  52198. {
  52199. $uri = $components['scheme'] . '://'
  52200. . $components['authority']
  52201. . $components['path'];
  52202. if (array_key_exists('query', $components)) {
  52203. $uri .= $components['query'];
  52204. }
  52205. if (array_key_exists('fragment', $components)) {
  52206. $uri .= $components['fragment'];
  52207. }
  52208. return $uri;
  52209. }
  52210. public function resolve($uri, $baseUri = null)
  52211. {
  52212. $components = $this->parse($uri);
  52213. $path = $components['path'];
  52214. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  52215. return $uri;
  52216. }
  52217. $baseComponents = $this->parse($baseUri);
  52218. $basePath = $baseComponents['path'];
  52219. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  52220. return $this->generate($baseComponents);
  52221. }
  52222. public function isValid($uri)
  52223. {
  52224. $components = $this->parse($uri);
  52225. return !empty($components);
  52226. }
  52227. public function setTranslation($from, $to)
  52228. {
  52229. $this->translationMap[$from] = $to;
  52230. }
  52231. public function translate($uri)
  52232. {
  52233. foreach ($this->translationMap as $from => $to) {
  52234. $uri = preg_replace($from, $to, $uri);
  52235. }
  52236. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  52237. return $uri;
  52238. }
  52239. }
  52240. <?php
  52241. namespace JsonSchema;
  52242. interface UriResolverInterface
  52243. {
  52244. public function resolve($uri, $baseUri = null);
  52245. }
  52246. <?php
  52247. namespace JsonSchema;
  52248. interface UriRetrieverInterface
  52249. {
  52250. public function retrieve($uri, $baseUri = null);
  52251. }
  52252. <?php
  52253. namespace JsonSchema;
  52254. use JsonSchema\Constraints\BaseConstraint;
  52255. use JsonSchema\Constraints\Constraint;
  52256. class Validator extends BaseConstraint
  52257. {
  52258. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  52259. const ERROR_NONE = 0x00000000;
  52260. const ERROR_ALL = 0xFFFFFFFF;
  52261. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  52262. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  52263. public function validate(&$value, $schema = null, $checkMode = null)
  52264. {
  52265. if (is_array($schema)) {
  52266. $schema = self::arrayToObjectRecursive($schema);
  52267. }
  52268. $initialCheckMode = $this->factory->getConfig();
  52269. if ($checkMode !== null) {
  52270. $this->factory->setConfig($checkMode);
  52271. }
  52272. if (is_object($schema) && property_exists($schema, 'id')) {
  52273. $schemaURI = $schema->id;
  52274. } else {
  52275. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  52276. }
  52277. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  52278. $validator = $this->factory->createInstanceFor('schema');
  52279. $validator->check(
  52280. $value,
  52281. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  52282. );
  52283. $this->factory->setConfig($initialCheckMode);
  52284. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  52285. return $validator->getErrorMask();
  52286. }
  52287. public function check($value, $schema)
  52288. {
  52289. return $this->validate($value, $schema);
  52290. }
  52291. public function coerce(&$value, $schema)
  52292. {
  52293. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  52294. }
  52295. }
  52296. Copyright (C) 2015 Composer
  52297. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52298. this software and associated documentation files (the "Software"), to deal in
  52299. the Software without restriction, including without limitation the rights to
  52300. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52301. of the Software, and to permit persons to whom the Software is furnished to do
  52302. so, subject to the following conditions:
  52303. The above copyright notice and this permission notice shall be included in all
  52304. copies or substantial portions of the Software.
  52305. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52306. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52307. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52308. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52309. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52310. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52311. SOFTWARE.
  52312. <?php
  52313. namespace Composer\Spdx;
  52314. class SpdxLicenses
  52315. {
  52316. const LICENSES_FILE = 'spdx-licenses.json';
  52317. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  52318. private $licenses;
  52319. private $licensesExpression;
  52320. private $exceptions;
  52321. private $exceptionsExpression;
  52322. public function __construct()
  52323. {
  52324. $this->loadLicenses();
  52325. $this->loadExceptions();
  52326. }
  52327. public function getLicenseByIdentifier($identifier)
  52328. {
  52329. $key = strtolower($identifier);
  52330. if (!isset($this->licenses[$key])) {
  52331. return;
  52332. }
  52333. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  52334. return array(
  52335. $name,
  52336. $isOsiApproved,
  52337. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  52338. $isDeprecatedLicenseId,
  52339. );
  52340. }
  52341. public function getLicenses()
  52342. {
  52343. return $this->licenses;
  52344. }
  52345. public function getExceptionByIdentifier($identifier)
  52346. {
  52347. $key = strtolower($identifier);
  52348. if (!isset($this->exceptions[$key])) {
  52349. return;
  52350. }
  52351. list($identifier, $name) = $this->exceptions[$key];
  52352. return array(
  52353. $name,
  52354. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  52355. );
  52356. }
  52357. public function getIdentifierByName($name)
  52358. {
  52359. foreach ($this->licenses as $licenseData) {
  52360. if ($licenseData[1] === $name) {
  52361. return $licenseData[0];
  52362. }
  52363. }
  52364. foreach ($this->exceptions as $licenseData) {
  52365. if ($licenseData[1] === $name) {
  52366. return $licenseData[0];
  52367. }
  52368. }
  52369. }
  52370. public function isOsiApprovedByIdentifier($identifier)
  52371. {
  52372. return $this->licenses[strtolower($identifier)][2];
  52373. }
  52374. public function isDeprecatedByIdentifier($identifier)
  52375. {
  52376. return $this->licenses[strtolower($identifier)][3];
  52377. }
  52378. public function validate($license)
  52379. {
  52380. if (is_array($license)) {
  52381. $count = count($license);
  52382. if ($count !== count(array_filter($license, 'is_string'))) {
  52383. throw new \InvalidArgumentException('Array of strings expected.');
  52384. }
  52385. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  52386. }
  52387. if (!is_string($license)) {
  52388. throw new \InvalidArgumentException(sprintf(
  52389. 'Array or String expected, %s given.',
  52390. gettype($license)
  52391. ));
  52392. }
  52393. return $this->isValidLicenseString($license);
  52394. }
  52395. public static function getResourcesDir()
  52396. {
  52397. return dirname(__DIR__) . '/res';
  52398. }
  52399. private function loadLicenses()
  52400. {
  52401. if (null !== $this->licenses) {
  52402. return;
  52403. }
  52404. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  52405. $this->licenses = array();
  52406. foreach (json_decode($json, true) as $identifier => $license) {
  52407. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  52408. }
  52409. }
  52410. private function loadExceptions()
  52411. {
  52412. if (null !== $this->exceptions) {
  52413. return;
  52414. }
  52415. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  52416. $this->exceptions = array();
  52417. foreach (json_decode($json, true) as $identifier => $exception) {
  52418. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  52419. }
  52420. }
  52421. private function getLicensesExpression()
  52422. {
  52423. if (null === $this->licensesExpression) {
  52424. $licenses = array_map('preg_quote', array_keys($this->licenses));
  52425. rsort($licenses);
  52426. $licenses = implode('|', $licenses);
  52427. $this->licensesExpression = $licenses;
  52428. }
  52429. return $this->licensesExpression;
  52430. }
  52431. private function getExceptionsExpression()
  52432. {
  52433. if (null === $this->exceptionsExpression) {
  52434. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  52435. rsort($exceptions);
  52436. $exceptions = implode('|', $exceptions);
  52437. $this->exceptionsExpression = $exceptions;
  52438. }
  52439. return $this->exceptionsExpression;
  52440. }
  52441. private function isValidLicenseString($license)
  52442. {
  52443. if (isset($this->licenses[strtolower($license)])) {
  52444. return true;
  52445. }
  52446. $licenses = $this->getLicensesExpression();
  52447. $exceptions = $this->getExceptionsExpression();
  52448. $regex = <<<REGEX
  52449. {
  52450. (?(DEFINE)
  52451. # idstring: 1*( ALPHA / DIGIT / - / . )
  52452. (?<idstring>[\pL\pN.-]{1,})
  52453. # license-id: taken from list
  52454. (?<licenseid>${licenses})
  52455. # license-exception-id: taken from list
  52456. (?<licenseexceptionid>${exceptions})
  52457. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  52458. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  52459. # simple-expresssion: license-id / license-id+ / license-ref
  52460. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  52461. # compound-expression: 1*(
  52462. # simple-expression /
  52463. # simple-expression WITH license-exception-id /
  52464. # compound-expression AND compound-expression /
  52465. # compound-expression OR compound-expression
  52466. # ) / ( compound-expression ) )
  52467. (?<compound_head>
  52468. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  52469. | \( \s* (?&compound_expression) \s* \)
  52470. )
  52471. (?<compound_expression>
  52472. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  52473. )
  52474. # license-expression: 1*1(simple-expression / compound-expression)
  52475. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  52476. ) # end of define
  52477. ^(NONE | NOASSERTION | (?&license_expression))$
  52478. }xi
  52479. REGEX;
  52480. $match = preg_match($regex, $license);
  52481. if (0 === $match) {
  52482. return false;
  52483. }
  52484. if (false === $match) {
  52485. throw new \RuntimeException('Regex failed to compile/run.');
  52486. }
  52487. return true;
  52488. }
  52489. }
  52490. Copyright (C) 2015 Composer
  52491. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52492. this software and associated documentation files (the "Software"), to deal in
  52493. the Software without restriction, including without limitation the rights to
  52494. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52495. of the Software, and to permit persons to whom the Software is furnished to do
  52496. so, subject to the following conditions:
  52497. The above copyright notice and this permission notice shall be included in all
  52498. copies or substantial portions of the Software.
  52499. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52500. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52501. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52502. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52503. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52504. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52505. SOFTWARE.
  52506. <?php
  52507. namespace Composer\Semver;
  52508. use Composer\Semver\Constraint\Constraint;
  52509. class Comparator
  52510. {
  52511. public static function greaterThan($version1, $version2)
  52512. {
  52513. return self::compare($version1, '>', $version2);
  52514. }
  52515. public static function greaterThanOrEqualTo($version1, $version2)
  52516. {
  52517. return self::compare($version1, '>=', $version2);
  52518. }
  52519. public static function lessThan($version1, $version2)
  52520. {
  52521. return self::compare($version1, '<', $version2);
  52522. }
  52523. public static function lessThanOrEqualTo($version1, $version2)
  52524. {
  52525. return self::compare($version1, '<=', $version2);
  52526. }
  52527. public static function equalTo($version1, $version2)
  52528. {
  52529. return self::compare($version1, '==', $version2);
  52530. }
  52531. public static function notEqualTo($version1, $version2)
  52532. {
  52533. return self::compare($version1, '!=', $version2);
  52534. }
  52535. public static function compare($version1, $operator, $version2)
  52536. {
  52537. $constraint = new Constraint($operator, $version2);
  52538. return $constraint->matches(new Constraint('==', $version1));
  52539. }
  52540. }
  52541. <?php
  52542. namespace Composer\Semver\Constraint;
  52543. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  52544. abstract class AbstractConstraint implements ConstraintInterface
  52545. {
  52546. protected $prettyString;
  52547. public function matches(ConstraintInterface $provider)
  52548. {
  52549. if ($provider instanceof $this) {
  52550. return $this->matchSpecific($provider);
  52551. }
  52552. return $provider->matches($this);
  52553. }
  52554. public function setPrettyString($prettyString)
  52555. {
  52556. $this->prettyString = $prettyString;
  52557. }
  52558. public function getPrettyString()
  52559. {
  52560. if ($this->prettyString) {
  52561. return $this->prettyString;
  52562. }
  52563. return $this->__toString();
  52564. }
  52565. }
  52566. <?php
  52567. namespace Composer\Semver\Constraint;
  52568. class Constraint implements ConstraintInterface
  52569. {
  52570. const OP_EQ = 0;
  52571. const OP_LT = 1;
  52572. const OP_LE = 2;
  52573. const OP_GT = 3;
  52574. const OP_GE = 4;
  52575. const OP_NE = 5;
  52576. private static $transOpStr = array(
  52577. '=' => self::OP_EQ,
  52578. '==' => self::OP_EQ,
  52579. '<' => self::OP_LT,
  52580. '<=' => self::OP_LE,
  52581. '>' => self::OP_GT,
  52582. '>=' => self::OP_GE,
  52583. '<>' => self::OP_NE,
  52584. '!=' => self::OP_NE,
  52585. );
  52586. private static $transOpInt = array(
  52587. self::OP_EQ => '==',
  52588. self::OP_LT => '<',
  52589. self::OP_LE => '<=',
  52590. self::OP_GT => '>',
  52591. self::OP_GE => '>=',
  52592. self::OP_NE => '!=',
  52593. );
  52594. protected $operator;
  52595. protected $version;
  52596. protected $prettyString;
  52597. public function matches(ConstraintInterface $provider)
  52598. {
  52599. if ($provider instanceof $this) {
  52600. return $this->matchSpecific($provider);
  52601. }
  52602. return $provider->matches($this);
  52603. }
  52604. public function setPrettyString($prettyString)
  52605. {
  52606. $this->prettyString = $prettyString;
  52607. }
  52608. public function getPrettyString()
  52609. {
  52610. if ($this->prettyString) {
  52611. return $this->prettyString;
  52612. }
  52613. return $this->__toString();
  52614. }
  52615. public static function getSupportedOperators()
  52616. {
  52617. return array_keys(self::$transOpStr);
  52618. }
  52619. public function __construct($operator, $version)
  52620. {
  52621. if (!isset(self::$transOpStr[$operator])) {
  52622. throw new \InvalidArgumentException(sprintf(
  52623. 'Invalid operator "%s" given, expected one of: %s',
  52624. $operator,
  52625. implode(', ', self::getSupportedOperators())
  52626. ));
  52627. }
  52628. $this->operator = self::$transOpStr[$operator];
  52629. $this->version = $version;
  52630. }
  52631. public function versionCompare($a, $b, $operator, $compareBranches = false)
  52632. {
  52633. if (!isset(self::$transOpStr[$operator])) {
  52634. throw new \InvalidArgumentException(sprintf(
  52635. 'Invalid operator "%s" given, expected one of: %s',
  52636. $operator,
  52637. implode(', ', self::getSupportedOperators())
  52638. ));
  52639. }
  52640. $aIsBranch = 'dev-' === substr($a, 0, 4);
  52641. $bIsBranch = 'dev-' === substr($b, 0, 4);
  52642. if ($aIsBranch && $bIsBranch) {
  52643. return $operator === '==' && $a === $b;
  52644. }
  52645. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  52646. return false;
  52647. }
  52648. return version_compare($a, $b, $operator);
  52649. }
  52650. public function matchSpecific(Constraint $provider, $compareBranches = false)
  52651. {
  52652. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  52653. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  52654. $isEqualOp = self::OP_EQ === $this->operator;
  52655. $isNonEqualOp = self::OP_NE === $this->operator;
  52656. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  52657. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  52658. if ($isNonEqualOp || $isProviderNonEqualOp) {
  52659. return (!$isEqualOp && !$isProviderEqualOp)
  52660. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  52661. }
  52662. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  52663. return true;
  52664. }
  52665. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  52666. return !($provider->version === $this->version
  52667. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  52668. && self::$transOpInt[$this->operator] !== $noEqualOp);
  52669. }
  52670. return false;
  52671. }
  52672. public function __toString()
  52673. {
  52674. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  52675. }
  52676. }
  52677. <?php
  52678. namespace Composer\Semver\Constraint;
  52679. interface ConstraintInterface
  52680. {
  52681. public function matches(ConstraintInterface $provider);
  52682. public function getPrettyString();
  52683. public function __toString();
  52684. }
  52685. <?php
  52686. namespace Composer\Semver\Constraint;
  52687. class EmptyConstraint implements ConstraintInterface
  52688. {
  52689. protected $prettyString;
  52690. public function matches(ConstraintInterface $provider)
  52691. {
  52692. return true;
  52693. }
  52694. public function setPrettyString($prettyString)
  52695. {
  52696. $this->prettyString = $prettyString;
  52697. }
  52698. public function getPrettyString()
  52699. {
  52700. if ($this->prettyString) {
  52701. return $this->prettyString;
  52702. }
  52703. return (string) $this;
  52704. }
  52705. public function __toString()
  52706. {
  52707. return '[]';
  52708. }
  52709. }
  52710. <?php
  52711. namespace Composer\Semver\Constraint;
  52712. class MultiConstraint implements ConstraintInterface
  52713. {
  52714. protected $constraints;
  52715. protected $prettyString;
  52716. protected $conjunctive;
  52717. public function __construct(array $constraints, $conjunctive = true)
  52718. {
  52719. $this->constraints = $constraints;
  52720. $this->conjunctive = $conjunctive;
  52721. }
  52722. public function getConstraints()
  52723. {
  52724. return $this->constraints;
  52725. }
  52726. public function isConjunctive()
  52727. {
  52728. return $this->conjunctive;
  52729. }
  52730. public function isDisjunctive()
  52731. {
  52732. return !$this->conjunctive;
  52733. }
  52734. public function matches(ConstraintInterface $provider)
  52735. {
  52736. if (false === $this->conjunctive) {
  52737. foreach ($this->constraints as $constraint) {
  52738. if ($constraint->matches($provider)) {
  52739. return true;
  52740. }
  52741. }
  52742. return false;
  52743. }
  52744. foreach ($this->constraints as $constraint) {
  52745. if (!$constraint->matches($provider)) {
  52746. return false;
  52747. }
  52748. }
  52749. return true;
  52750. }
  52751. public function setPrettyString($prettyString)
  52752. {
  52753. $this->prettyString = $prettyString;
  52754. }
  52755. public function getPrettyString()
  52756. {
  52757. if ($this->prettyString) {
  52758. return $this->prettyString;
  52759. }
  52760. return (string) $this;
  52761. }
  52762. public function __toString()
  52763. {
  52764. $constraints = array();
  52765. foreach ($this->constraints as $constraint) {
  52766. $constraints[] = (string) $constraint;
  52767. }
  52768. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  52769. }
  52770. }
  52771. <?php
  52772. namespace Composer\Semver;
  52773. use Composer\Semver\Constraint\Constraint;
  52774. class Semver
  52775. {
  52776. const SORT_ASC = 1;
  52777. const SORT_DESC = -1;
  52778. private static $versionParser;
  52779. public static function satisfies($version, $constraints)
  52780. {
  52781. if (null === self::$versionParser) {
  52782. self::$versionParser = new VersionParser();
  52783. }
  52784. $versionParser = self::$versionParser;
  52785. $provider = new Constraint('==', $versionParser->normalize($version));
  52786. $parsedConstraints = $versionParser->parseConstraints($constraints);
  52787. return $parsedConstraints->matches($provider);
  52788. }
  52789. public static function satisfiedBy(array $versions, $constraints)
  52790. {
  52791. $versions = array_filter($versions, function ($version) use ($constraints) {
  52792. return Semver::satisfies($version, $constraints);
  52793. });
  52794. return array_values($versions);
  52795. }
  52796. public static function sort(array $versions)
  52797. {
  52798. return self::usort($versions, self::SORT_ASC);
  52799. }
  52800. public static function rsort(array $versions)
  52801. {
  52802. return self::usort($versions, self::SORT_DESC);
  52803. }
  52804. private static function usort(array $versions, $direction)
  52805. {
  52806. if (null === self::$versionParser) {
  52807. self::$versionParser = new VersionParser();
  52808. }
  52809. $versionParser = self::$versionParser;
  52810. $normalized = array();
  52811. foreach ($versions as $key => $version) {
  52812. $normalized[] = array($versionParser->normalize($version), $key);
  52813. }
  52814. usort($normalized, function (array $left, array $right) use ($direction) {
  52815. if ($left[0] === $right[0]) {
  52816. return 0;
  52817. }
  52818. if (Comparator::lessThan($left[0], $right[0])) {
  52819. return -$direction;
  52820. }
  52821. return $direction;
  52822. });
  52823. $sorted = array();
  52824. foreach ($normalized as $item) {
  52825. $sorted[] = $versions[$item[1]];
  52826. }
  52827. return $sorted;
  52828. }
  52829. }
  52830. <?php
  52831. namespace Composer\Semver;
  52832. use Composer\Semver\Constraint\ConstraintInterface;
  52833. use Composer\Semver\Constraint\EmptyConstraint;
  52834. use Composer\Semver\Constraint\MultiConstraint;
  52835. use Composer\Semver\Constraint\Constraint;
  52836. class VersionParser
  52837. {
  52838. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  52839. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  52840. public static function parseStability($version)
  52841. {
  52842. $version = preg_replace('{#.+$}i', '', $version);
  52843. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  52844. return 'dev';
  52845. }
  52846. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  52847. if (!empty($match[3])) {
  52848. return 'dev';
  52849. }
  52850. if (!empty($match[1])) {
  52851. if ('beta' === $match[1] || 'b' === $match[1]) {
  52852. return 'beta';
  52853. }
  52854. if ('alpha' === $match[1] || 'a' === $match[1]) {
  52855. return 'alpha';
  52856. }
  52857. if ('rc' === $match[1]) {
  52858. return 'RC';
  52859. }
  52860. }
  52861. return 'stable';
  52862. }
  52863. public static function normalizeStability($stability)
  52864. {
  52865. $stability = strtolower($stability);
  52866. return $stability === 'rc' ? 'RC' : $stability;
  52867. }
  52868. public function normalize($version, $fullVersion = null)
  52869. {
  52870. $version = trim($version);
  52871. if (null === $fullVersion) {
  52872. $fullVersion = $version;
  52873. }
  52874. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  52875. $this->normalize($match[2]);
  52876. $version = $match[1];
  52877. }
  52878. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  52879. return '9999999-dev';
  52880. }
  52881. if (stripos($version, 'dev-') === 0) {
  52882. return 'dev-' . substr($version, 4);
  52883. }
  52884. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  52885. $version = $match[1];
  52886. }
  52887. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  52888. $version = $matches[1]
  52889. . (!empty($matches[2]) ? $matches[2] : '.0')
  52890. . (!empty($matches[3]) ? $matches[3] : '.0')
  52891. . (!empty($matches[4]) ? $matches[4] : '.0');
  52892. $index = 5;
  52893. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  52894. $version = preg_replace('{\D}', '.', $matches[1]);
  52895. $index = 2;
  52896. }
  52897. if (isset($index)) {
  52898. if (!empty($matches[$index])) {
  52899. if ('stable' === $matches[$index]) {
  52900. return $version;
  52901. }
  52902. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  52903. }
  52904. if (!empty($matches[$index + 2])) {
  52905. $version .= '-dev';
  52906. }
  52907. return $version;
  52908. }
  52909. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  52910. try {
  52911. return $this->normalizeBranch($match[1]);
  52912. } catch (\Exception $e) {
  52913. }
  52914. }
  52915. $extraMessage = '';
  52916. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  52917. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  52918. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  52919. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  52920. }
  52921. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  52922. }
  52923. public function parseNumericAliasPrefix($branch)
  52924. {
  52925. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  52926. return $matches['version'] . '.';
  52927. }
  52928. return false;
  52929. }
  52930. public function normalizeBranch($name)
  52931. {
  52932. $name = trim($name);
  52933. if (in_array($name, array('master', 'trunk', 'default'))) {
  52934. return $this->normalize($name);
  52935. }
  52936. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  52937. $version = '';
  52938. for ($i = 1; $i < 5; ++$i) {
  52939. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  52940. }
  52941. return str_replace('x', '9999999', $version) . '-dev';
  52942. }
  52943. return 'dev-' . $name;
  52944. }
  52945. public function parseConstraints($constraints)
  52946. {
  52947. $prettyConstraint = $constraints;
  52948. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  52949. $constraints = empty($match[1]) ? '*' : $match[1];
  52950. }
  52951. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  52952. $constraints = $match[1];
  52953. }
  52954. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  52955. $orGroups = array();
  52956. foreach ($orConstraints as $constraints) {
  52957. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  52958. if (count($andConstraints) > 1) {
  52959. $constraintObjects = array();
  52960. foreach ($andConstraints as $constraint) {
  52961. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  52962. $constraintObjects[] = $parsedConstraint;
  52963. }
  52964. }
  52965. } else {
  52966. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  52967. }
  52968. if (1 === count($constraintObjects)) {
  52969. $constraint = $constraintObjects[0];
  52970. } else {
  52971. $constraint = new MultiConstraint($constraintObjects);
  52972. }
  52973. $orGroups[] = $constraint;
  52974. }
  52975. if (1 === count($orGroups)) {
  52976. $constraint = $orGroups[0];
  52977. } elseif (2 === count($orGroups)
  52978. && $orGroups[0] instanceof MultiConstraint
  52979. && $orGroups[1] instanceof MultiConstraint
  52980. && 2 === count($orGroups[0]->getConstraints())
  52981. && 2 === count($orGroups[1]->getConstraints())
  52982. && ($a = (string) $orGroups[0])
  52983. && strpos($a, '[>=') === 0 && (false !== ($posA = strpos($a, '<', 4)))
  52984. && ($b = (string) $orGroups[1])
  52985. && strpos($b, '[>=') === 0 && (false !== ($posB = strpos($b, '<', 4)))
  52986. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  52987. ) {
  52988. $constraint = new MultiConstraint(array(
  52989. new Constraint('>=', substr($a, 4, $posA - 5)),
  52990. new Constraint('<', substr($b, $posB + 2, -1)),
  52991. ));
  52992. } else {
  52993. $constraint = new MultiConstraint($orGroups, false);
  52994. }
  52995. $constraint->setPrettyString($prettyConstraint);
  52996. return $constraint;
  52997. }
  52998. private function parseConstraint($constraint)
  52999. {
  53000. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  53001. $constraint = $match[1];
  53002. if ($match[2] !== 'stable') {
  53003. $stabilityModifier = $match[2];
  53004. }
  53005. }
  53006. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  53007. return array(new EmptyConstraint());
  53008. }
  53009. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  53010. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  53011. if (strpos($constraint, '~>') === 0) {
  53012. throw new \UnexpectedValueException(
  53013. 'Could not parse version constraint ' . $constraint . ': ' .
  53014. 'Invalid operator "~>", you probably meant to use the "~" operator'
  53015. );
  53016. }
  53017. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  53018. $position = 4;
  53019. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  53020. $position = 3;
  53021. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  53022. $position = 2;
  53023. } else {
  53024. $position = 1;
  53025. }
  53026. $stabilitySuffix = '';
  53027. if (empty($matches[5]) && empty($matches[7])) {
  53028. $stabilitySuffix .= '-dev';
  53029. }
  53030. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  53031. $lowerBound = new Constraint('>=', $lowVersion);
  53032. $highPosition = max(1, $position - 1);
  53033. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  53034. $upperBound = new Constraint('<', $highVersion);
  53035. return array(
  53036. $lowerBound,
  53037. $upperBound,
  53038. );
  53039. }
  53040. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  53041. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  53042. $position = 1;
  53043. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  53044. $position = 2;
  53045. } else {
  53046. $position = 3;
  53047. }
  53048. $stabilitySuffix = '';
  53049. if (empty($matches[5]) && empty($matches[7])) {
  53050. $stabilitySuffix .= '-dev';
  53051. }
  53052. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  53053. $lowerBound = new Constraint('>=', $lowVersion);
  53054. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  53055. $upperBound = new Constraint('<', $highVersion);
  53056. return array(
  53057. $lowerBound,
  53058. $upperBound,
  53059. );
  53060. }
  53061. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  53062. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  53063. $position = 3;
  53064. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  53065. $position = 2;
  53066. } else {
  53067. $position = 1;
  53068. }
  53069. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  53070. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  53071. if ($lowVersion === '0.0.0.0-dev') {
  53072. return array(new Constraint('<', $highVersion));
  53073. }
  53074. return array(
  53075. new Constraint('>=', $lowVersion),
  53076. new Constraint('<', $highVersion),
  53077. );
  53078. }
  53079. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  53080. $lowStabilitySuffix = '';
  53081. if (empty($matches[6]) && empty($matches[8])) {
  53082. $lowStabilitySuffix = '-dev';
  53083. }
  53084. $lowVersion = $this->normalize($matches['from']);
  53085. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  53086. $empty = function ($x) {
  53087. return ($x === 0 || $x === '0') ? false : empty($x);
  53088. };
  53089. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  53090. $highVersion = $this->normalize($matches['to']);
  53091. $upperBound = new Constraint('<=', $highVersion);
  53092. } else {
  53093. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  53094. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  53095. $upperBound = new Constraint('<', $highVersion);
  53096. }
  53097. return array(
  53098. $lowerBound,
  53099. $upperBound,
  53100. );
  53101. }
  53102. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  53103. try {
  53104. $version = $this->normalize($matches[2]);
  53105. if (!empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  53106. $version .= '-' . $stabilityModifier;
  53107. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  53108. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  53109. if (strpos($matches[2], 'dev-') !== 0) {
  53110. $version .= '-dev';
  53111. }
  53112. }
  53113. }
  53114. return array(new Constraint($matches[1] ?: '=', $version));
  53115. } catch (\Exception $e) {
  53116. }
  53117. }
  53118. $message = 'Could not parse version constraint ' . $constraint;
  53119. if (isset($e)) {
  53120. $message .= ': ' . $e->getMessage();
  53121. }
  53122. throw new \UnexpectedValueException($message);
  53123. }
  53124. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  53125. {
  53126. for ($i = 4; $i > 0; --$i) {
  53127. if ($i > $position) {
  53128. $matches[$i] = $pad;
  53129. } elseif ($i === $position && $increment) {
  53130. $matches[$i] += $increment;
  53131. if ($matches[$i] < 0) {
  53132. $matches[$i] = $pad;
  53133. --$position;
  53134. if ($i === 1) {
  53135. return null;
  53136. }
  53137. }
  53138. }
  53139. }
  53140. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  53141. }
  53142. private function expandStability($stability)
  53143. {
  53144. $stability = strtolower($stability);
  53145. switch ($stability) {
  53146. case 'a':
  53147. return 'alpha';
  53148. case 'b':
  53149. return 'beta';
  53150. case 'p':
  53151. case 'pl':
  53152. return 'patch';
  53153. case 'rc':
  53154. return 'RC';
  53155. default:
  53156. return $stability;
  53157. }
  53158. }
  53159. }
  53160. Copyright (C) 2016 Composer
  53161. Permission is hereby granted, free of charge, to any person obtaining a copy of
  53162. this software and associated documentation files (the "Software"), to deal in
  53163. the Software without restriction, including without limitation the rights to
  53164. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  53165. of the Software, and to permit persons to whom the Software is furnished to do
  53166. so, subject to the following conditions:
  53167. The above copyright notice and this permission notice shall be included in all
  53168. copies or substantial portions of the Software.
  53169. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53170. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53171. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53172. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53173. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53174. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  53175. SOFTWARE.
  53176. <?php
  53177. namespace Composer\CaBundle;
  53178. use Psr\Log\LoggerInterface;
  53179. use Symfony\Component\Process\PhpProcess;
  53180. class CaBundle
  53181. {
  53182. private static $caPath;
  53183. private static $caFileValidity = array();
  53184. private static $useOpensslParse;
  53185. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  53186. {
  53187. if (self::$caPath !== null) {
  53188. return self::$caPath;
  53189. }
  53190. $caBundlePaths = array();
  53191. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  53192. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  53193. $caBundlePaths[] = ini_get('openssl.cafile');
  53194. $caBundlePaths[] = ini_get('openssl.capath');
  53195. $otherLocations = array(
  53196. '/etc/pki/tls/certs/ca-bundle.crt',
  53197. '/etc/ssl/certs/ca-certificates.crt',
  53198. '/etc/ssl/ca-bundle.pem',
  53199. '/usr/local/share/certs/ca-root-nss.crt',
  53200. '/usr/ssl/certs/ca-bundle.crt',
  53201. '/opt/local/share/curl/curl-ca-bundle.crt',
  53202. '/usr/local/share/curl/curl-ca-bundle.crt',
  53203. '/usr/share/ssl/certs/ca-bundle.crt',
  53204. '/etc/ssl/cert.pem',
  53205. '/usr/local/etc/ssl/cert.pem',
  53206. '/usr/local/etc/openssl/cert.pem',
  53207. '/usr/local/etc/openssl@1.1/cert.pem',
  53208. );
  53209. foreach($otherLocations as $location) {
  53210. $otherLocations[] = dirname($location);
  53211. }
  53212. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  53213. foreach ($caBundlePaths as $caBundle) {
  53214. if (self::caFileUsable($caBundle, $logger)) {
  53215. return self::$caPath = $caBundle;
  53216. }
  53217. if (self::caDirUsable($caBundle)) {
  53218. return self::$caPath = $caBundle;
  53219. }
  53220. }
  53221. return self::$caPath = static::getBundledCaBundlePath();
  53222. }
  53223. public static function getBundledCaBundlePath()
  53224. {
  53225. $caBundleFile = __DIR__.'/../res/cacert.pem';
  53226. if (0 === strpos($caBundleFile, 'phar://')) {
  53227. file_put_contents(
  53228. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  53229. file_get_contents($caBundleFile)
  53230. );
  53231. register_shutdown_function(function() use ($tempCaBundleFile) {
  53232. @unlink($tempCaBundleFile);
  53233. });
  53234. $caBundleFile = $tempCaBundleFile;
  53235. }
  53236. return $caBundleFile;
  53237. }
  53238. public static function validateCaFile($filename, LoggerInterface $logger = null)
  53239. {
  53240. static $warned = false;
  53241. if (isset(self::$caFileValidity[$filename])) {
  53242. return self::$caFileValidity[$filename];
  53243. }
  53244. $contents = file_get_contents($filename);
  53245. if (!static::isOpensslParseSafe()) {
  53246. if (!$warned && $logger) {
  53247. $logger->warning(sprintf(
  53248. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  53249. PHP_VERSION
  53250. ));
  53251. $warned = true;
  53252. }
  53253. $isValid = !empty($contents);
  53254. } else {
  53255. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  53256. $isValid = (bool) openssl_x509_parse($contents);
  53257. }
  53258. if ($logger) {
  53259. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  53260. }
  53261. return self::$caFileValidity[$filename] = $isValid;
  53262. }
  53263. public static function isOpensslParseSafe()
  53264. {
  53265. if (null !== self::$useOpensslParse) {
  53266. return self::$useOpensslParse;
  53267. }
  53268. if (PHP_VERSION_ID >= 50600) {
  53269. return self::$useOpensslParse = true;
  53270. }
  53271. if (
  53272. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  53273. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  53274. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  53275. ) {
  53276. return self::$useOpensslParse = true;
  53277. }
  53278. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  53279. return self::$useOpensslParse = false;
  53280. }
  53281. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  53282. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  53283. if (preg_match($regex, PHP_VERSION, $m)) {
  53284. return ((int) $m[1]) >= $fixedVersion;
  53285. }
  53286. return false;
  53287. };
  53288. if (
  53289. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  53290. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  53291. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  53292. ) {
  53293. return self::$useOpensslParse = true;
  53294. }
  53295. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  53296. return self::$useOpensslParse = false;
  53297. }
  53298. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  53299. $script = <<<'EOT'
  53300. error_reporting(-1);
  53301. $info = openssl_x509_parse(base64_decode('%s'));
  53302. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  53303. EOT;
  53304. $script = '<'."?php\n".sprintf($script, $cert);
  53305. try {
  53306. $process = new PhpProcess($script);
  53307. $process->mustRun();
  53308. } catch (\Exception $e) {
  53309. return self::$useOpensslParse = false;
  53310. }
  53311. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  53312. $errorOutput = trim($process->getErrorOutput());
  53313. if (
  53314. count($output) === 3
  53315. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  53316. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  53317. && $output[2] === 'int(-1)'
  53318. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  53319. ) {
  53320. return self::$useOpensslParse = true;
  53321. }
  53322. return self::$useOpensslParse = false;
  53323. }
  53324. public static function reset()
  53325. {
  53326. self::$caFileValidity = array();
  53327. self::$caPath = null;
  53328. self::$useOpensslParse = null;
  53329. }
  53330. private static function getEnvVariable($name)
  53331. {
  53332. if (isset($_SERVER[$name])) {
  53333. return (string) $_SERVER[$name];
  53334. }
  53335. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  53336. return (string) $value;
  53337. }
  53338. return false;
  53339. }
  53340. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  53341. {
  53342. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  53343. }
  53344. private static function caDirUsable($certDir)
  53345. {
  53346. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  53347. }
  53348. }
  53349. MIT License
  53350. Copyright (c) 2017 Composer
  53351. Permission is hereby granted, free of charge, to any person obtaining a copy
  53352. of this software and associated documentation files (the "Software"), to deal
  53353. in the Software without restriction, including without limitation the rights
  53354. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53355. copies of the Software, and to permit persons to whom the Software is
  53356. furnished to do so, subject to the following conditions:
  53357. The above copyright notice and this permission notice shall be included in all
  53358. copies or substantial portions of the Software.
  53359. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53360. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53361. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53362. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53363. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53364. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  53365. SOFTWARE.
  53366. <?php
  53367. namespace Composer\XdebugHandler;
  53368. class PhpConfig
  53369. {
  53370. public function useOriginal()
  53371. {
  53372. $this->getDataAndReset();
  53373. return array();
  53374. }
  53375. public function useStandard()
  53376. {
  53377. if ($data = $this->getDataAndReset()) {
  53378. return array('-n', '-c', $data['tmpIni']);
  53379. }
  53380. return array();
  53381. }
  53382. public function usePersistent()
  53383. {
  53384. if ($data = $this->getDataAndReset()) {
  53385. Process::setEnv('PHPRC', $data['tmpIni']);
  53386. Process::setEnv('PHP_INI_SCAN_DIR', '');
  53387. }
  53388. return array();
  53389. }
  53390. private function getDataAndReset()
  53391. {
  53392. if ($data = XdebugHandler::getRestartSettings()) {
  53393. Process::setEnv('PHPRC', $data['phprc']);
  53394. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  53395. }
  53396. return $data;
  53397. }
  53398. }
  53399. <?php
  53400. namespace Composer\XdebugHandler;
  53401. class Process
  53402. {
  53403. public static function addColorOption(array $args, $colorOption)
  53404. {
  53405. if (!$colorOption
  53406. || in_array($colorOption, $args)
  53407. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  53408. return $args;
  53409. }
  53410. if (isset($matches[2])) {
  53411. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  53412. $args[$index] = $colorOption;
  53413. return $args;
  53414. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  53415. return $args;
  53416. }
  53417. } elseif (in_array('--no-'.$matches[1], $args)) {
  53418. return $args;
  53419. }
  53420. if (false !== getenv('NO_COLOR')) {
  53421. return $args;
  53422. }
  53423. if (false !== ($index = array_search('--', $args))) {
  53424. array_splice($args, $index, 0, $colorOption);
  53425. } else {
  53426. $args[] = $colorOption;
  53427. }
  53428. return $args;
  53429. }
  53430. public static function escape($arg, $meta = true, $module = false)
  53431. {
  53432. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  53433. return "'".str_replace("'", "'\\''", $arg)."'";
  53434. }
  53435. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  53436. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  53437. if ($meta) {
  53438. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  53439. if (!$meta) {
  53440. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  53441. } elseif ($module && !$dquotes && $quote) {
  53442. $meta = false;
  53443. }
  53444. }
  53445. if ($quote) {
  53446. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  53447. }
  53448. if ($meta) {
  53449. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  53450. }
  53451. return $arg;
  53452. }
  53453. public static function supportsColor($output)
  53454. {
  53455. if ('Hyper' === getenv('TERM_PROGRAM')) {
  53456. return true;
  53457. }
  53458. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  53459. return (function_exists('sapi_windows_vt100_support')
  53460. && sapi_windows_vt100_support($output))
  53461. || false !== getenv('ANSICON')
  53462. || 'ON' === getenv('ConEmuANSI')
  53463. || 'xterm' === getenv('TERM');
  53464. }
  53465. if (function_exists('stream_isatty')) {
  53466. return stream_isatty($output);
  53467. }
  53468. if (function_exists('posix_isatty')) {
  53469. return posix_isatty($output);
  53470. }
  53471. $stat = fstat($output);
  53472. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  53473. }
  53474. public static function setEnv($name, $value = false)
  53475. {
  53476. $unset = false === $value;
  53477. if (!putenv($unset ? $name : $name.'='.$value)) {
  53478. return false;
  53479. }
  53480. if ($unset) {
  53481. unset($_SERVER[$name]);
  53482. } else {
  53483. $_SERVER[$name] = $value;
  53484. }
  53485. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  53486. if ($unset) {
  53487. unset($_ENV[$name]);
  53488. } else {
  53489. $_ENV[$name] = $value;
  53490. }
  53491. }
  53492. return true;
  53493. }
  53494. }
  53495. <?php
  53496. namespace Composer\XdebugHandler;
  53497. use Psr\Log\LoggerInterface;
  53498. use Psr\Log\LogLevel;
  53499. class Status
  53500. {
  53501. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  53502. const CHECK = 'Check';
  53503. const ERROR = 'Error';
  53504. const INFO = 'Info';
  53505. const NORESTART = 'NoRestart';
  53506. const RESTART = 'Restart';
  53507. const RESTARTING = 'Restarting';
  53508. const RESTARTED = 'Restarted';
  53509. private $debug;
  53510. private $envAllowXdebug;
  53511. private $loaded;
  53512. private $logger;
  53513. private $time;
  53514. public function __construct($envAllowXdebug, $debug)
  53515. {
  53516. $start = getenv(self::ENV_RESTART);
  53517. Process::setEnv(self::ENV_RESTART);
  53518. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  53519. $this->envAllowXdebug = $envAllowXdebug;
  53520. $this->debug = $debug && defined('STDERR');
  53521. }
  53522. public function setLogger(LoggerInterface $logger)
  53523. {
  53524. $this->logger = $logger;
  53525. }
  53526. public function report($op, $data)
  53527. {
  53528. if ($this->logger || $this->debug) {
  53529. call_user_func(array($this, 'report'.$op), $data);
  53530. }
  53531. }
  53532. private function output($text, $level = null)
  53533. {
  53534. if ($this->logger) {
  53535. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  53536. }
  53537. if ($this->debug) {
  53538. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  53539. }
  53540. }
  53541. private function reportCheck($loaded)
  53542. {
  53543. $this->loaded = $loaded;
  53544. $this->output('Checking '.$this->envAllowXdebug);
  53545. }
  53546. private function reportError($error)
  53547. {
  53548. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  53549. }
  53550. private function reportInfo($info)
  53551. {
  53552. $this->output($info);
  53553. }
  53554. private function reportNoRestart()
  53555. {
  53556. $this->output($this->getLoadedMessage());
  53557. if ($this->loaded) {
  53558. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  53559. if (!getenv($this->envAllowXdebug)) {
  53560. $text .= ' Allowed by application';
  53561. }
  53562. $this->output($text);
  53563. }
  53564. }
  53565. private function reportRestart()
  53566. {
  53567. $this->output($this->getLoadedMessage());
  53568. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  53569. }
  53570. private function reportRestarted()
  53571. {
  53572. $loaded = $this->getLoadedMessage();
  53573. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  53574. $level = $this->loaded ? LogLevel::WARNING : null;
  53575. $this->output($text, $level);
  53576. }
  53577. private function reportRestarting($command)
  53578. {
  53579. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  53580. $this->output($text);
  53581. $text = 'Running '.$command;
  53582. $this->output($text);
  53583. }
  53584. private function getEnvAllow()
  53585. {
  53586. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  53587. }
  53588. private function getLoadedMessage()
  53589. {
  53590. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  53591. return 'The Xdebug extension is '.$loaded;
  53592. }
  53593. }
  53594. <?php
  53595. namespace Composer\XdebugHandler;
  53596. use Psr\Log\LoggerInterface;
  53597. class XdebugHandler
  53598. {
  53599. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  53600. const SUFFIX_INIS = '_ORIGINAL_INIS';
  53601. const RESTART_ID = 'internal';
  53602. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  53603. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  53604. protected $tmpIni;
  53605. private static $inRestart;
  53606. private static $name;
  53607. private static $skipped;
  53608. private $cli;
  53609. private $colorOption;
  53610. private $debug;
  53611. private $envAllowXdebug;
  53612. private $envOriginalInis;
  53613. private $loaded;
  53614. private $persistent;
  53615. private $script;
  53616. private $statusWriter;
  53617. public function __construct($envPrefix, $colorOption = '')
  53618. {
  53619. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  53620. throw new \RuntimeException('Invalid constructor parameter');
  53621. }
  53622. self::$name = strtoupper($envPrefix);
  53623. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  53624. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  53625. $this->colorOption = $colorOption;
  53626. if (extension_loaded('xdebug')) {
  53627. $ext = new \ReflectionExtension('xdebug');
  53628. $this->loaded = $ext->getVersion() ?: 'unknown';
  53629. }
  53630. if ($this->cli = PHP_SAPI === 'cli') {
  53631. $this->debug = getenv(self::DEBUG);
  53632. }
  53633. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  53634. }
  53635. public function setLogger(LoggerInterface $logger)
  53636. {
  53637. $this->statusWriter->setLogger($logger);
  53638. return $this;
  53639. }
  53640. public function setMainScript($script)
  53641. {
  53642. $this->script = $script;
  53643. return $this;
  53644. }
  53645. public function setPersistent()
  53646. {
  53647. $this->persistent = true;
  53648. return $this;
  53649. }
  53650. public function check()
  53651. {
  53652. $this->notify(Status::CHECK, $this->loaded);
  53653. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  53654. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  53655. $this->notify(Status::RESTART);
  53656. if ($this->prepareRestart()) {
  53657. $command = $this->getCommand();
  53658. $this->notify(Status::RESTARTING, $command);
  53659. $this->restart($command);
  53660. }
  53661. return;
  53662. }
  53663. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  53664. $this->notify(Status::RESTARTED);
  53665. Process::setEnv($this->envAllowXdebug);
  53666. self::$inRestart = true;
  53667. if (!$this->loaded) {
  53668. self::$skipped = $envArgs[1];
  53669. }
  53670. $this->setEnvRestartSettings($envArgs);
  53671. return;
  53672. }
  53673. $this->notify(Status::NORESTART);
  53674. if ($settings = self::getRestartSettings()) {
  53675. $this->syncSettings($settings);
  53676. }
  53677. }
  53678. public static function getAllIniFiles()
  53679. {
  53680. if (!empty(self::$name)) {
  53681. $env = getenv(self::$name.self::SUFFIX_INIS);
  53682. if (false !== $env) {
  53683. return explode(PATH_SEPARATOR, $env);
  53684. }
  53685. }
  53686. $paths = array((string) php_ini_loaded_file());
  53687. if ($scanned = php_ini_scanned_files()) {
  53688. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  53689. }
  53690. return $paths;
  53691. }
  53692. public static function getRestartSettings()
  53693. {
  53694. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  53695. if (count($envArgs) !== 6
  53696. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  53697. return;
  53698. }
  53699. return array(
  53700. 'tmpIni' => $envArgs[0],
  53701. 'scannedInis' => (bool) $envArgs[1],
  53702. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  53703. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  53704. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  53705. 'skipped' => $envArgs[5],
  53706. );
  53707. }
  53708. public static function getSkippedVersion()
  53709. {
  53710. return (string) self::$skipped;
  53711. }
  53712. protected function requiresRestart($isLoaded)
  53713. {
  53714. return $isLoaded;
  53715. }
  53716. protected function restart($command)
  53717. {
  53718. $this->doRestart($command);
  53719. }
  53720. private function doRestart($command)
  53721. {
  53722. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  53723. pcntl_async_signals(true);
  53724. pcntl_signal(SIGINT, SIG_IGN);
  53725. }
  53726. passthru($command, $exitCode);
  53727. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  53728. if ($this->debug === '2') {
  53729. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  53730. } else {
  53731. @unlink($this->tmpIni);
  53732. }
  53733. exit($exitCode);
  53734. }
  53735. private function prepareRestart()
  53736. {
  53737. $error = '';
  53738. $iniFiles = self::getAllIniFiles();
  53739. $scannedInis = count($iniFiles) > 1;
  53740. $tmpDir = sys_get_temp_dir();
  53741. if (!$this->cli) {
  53742. $error = 'Unsupported SAPI: '.PHP_SAPI;
  53743. } elseif (!defined('PHP_BINARY')) {
  53744. $error = 'PHP version is too old: '.PHP_VERSION;
  53745. } elseif (!$this->checkConfiguration($info)) {
  53746. $error = $info;
  53747. } elseif (!$this->checkScanDirConfig()) {
  53748. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  53749. } elseif (!$this->checkMainScript()) {
  53750. $error = 'Unable to access main script: '.$this->script;
  53751. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  53752. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  53753. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  53754. $error = 'Unable to set environment variables';
  53755. }
  53756. if ($error) {
  53757. $this->notify(Status::ERROR, $error);
  53758. }
  53759. return empty($error);
  53760. }
  53761. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  53762. {
  53763. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  53764. return false;
  53765. }
  53766. if (empty($iniFiles[0])) {
  53767. array_shift($iniFiles);
  53768. }
  53769. $content = '';
  53770. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  53771. foreach ($iniFiles as $file) {
  53772. if (($data = @file_get_contents($file)) === false) {
  53773. $error = 'Unable to read ini: '.$file;
  53774. return false;
  53775. }
  53776. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  53777. }
  53778. if ($config = parse_ini_string($content)) {
  53779. $loaded = ini_get_all(null, false);
  53780. $content .= $this->mergeLoadedConfig($loaded, $config);
  53781. }
  53782. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  53783. return @file_put_contents($this->tmpIni, $content);
  53784. }
  53785. private function getCommand()
  53786. {
  53787. $php = array(PHP_BINARY);
  53788. $args = array_slice($_SERVER['argv'], 1);
  53789. if (!$this->persistent) {
  53790. array_push($php, '-n', '-c', $this->tmpIni);
  53791. }
  53792. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  53793. $args = Process::addColorOption($args, $this->colorOption);
  53794. }
  53795. $args = array_merge($php, array($this->script), $args);
  53796. $cmd = Process::escape(array_shift($args), true, true);
  53797. foreach ($args as $arg) {
  53798. $cmd .= ' '.Process::escape($arg);
  53799. }
  53800. return $cmd;
  53801. }
  53802. private function setEnvironment($scannedInis, array $iniFiles)
  53803. {
  53804. $scanDir = getenv('PHP_INI_SCAN_DIR');
  53805. $phprc = getenv('PHPRC');
  53806. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  53807. return false;
  53808. }
  53809. if ($this->persistent) {
  53810. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  53811. return false;
  53812. }
  53813. }
  53814. $envArgs = array(
  53815. self::RESTART_ID,
  53816. $this->loaded,
  53817. (int) $scannedInis,
  53818. false === $scanDir ? '*' : $scanDir,
  53819. false === $phprc ? '*' : $phprc,
  53820. );
  53821. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  53822. }
  53823. private function notify($op, $data = null)
  53824. {
  53825. $this->statusWriter->report($op, $data);
  53826. }
  53827. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  53828. {
  53829. $content = '';
  53830. foreach ($loadedConfig as $name => $value) {
  53831. if (!is_string($value)
  53832. || strpos($name, 'xdebug') === 0
  53833. || $name === 'apc.mmap_file_mask') {
  53834. continue;
  53835. }
  53836. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  53837. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  53838. }
  53839. }
  53840. return $content;
  53841. }
  53842. private function checkMainScript()
  53843. {
  53844. if (null !== $this->script) {
  53845. return file_exists($this->script) || '--' === $this->script;
  53846. }
  53847. if (file_exists($this->script = $_SERVER['argv'][0])) {
  53848. return true;
  53849. }
  53850. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  53851. $trace = debug_backtrace($options);
  53852. if (($main = end($trace)) && isset($main['file'])) {
  53853. return file_exists($this->script = $main['file']);
  53854. }
  53855. return false;
  53856. }
  53857. private function setEnvRestartSettings($envArgs)
  53858. {
  53859. $settings = array(
  53860. php_ini_loaded_file(),
  53861. $envArgs[2],
  53862. $envArgs[3],
  53863. $envArgs[4],
  53864. getenv($this->envOriginalInis),
  53865. self::$skipped,
  53866. );
  53867. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  53868. }
  53869. private function syncSettings(array $settings)
  53870. {
  53871. if (false === getenv($this->envOriginalInis)) {
  53872. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  53873. }
  53874. self::$skipped = $settings['skipped'];
  53875. $this->notify(Status::INFO, 'Process called with existing restart settings');
  53876. }
  53877. private function checkScanDirConfig()
  53878. {
  53879. return !(getenv('PHP_INI_SCAN_DIR')
  53880. && !PHP_CONFIG_FILE_SCAN_DIR
  53881. && (PHP_VERSION_ID < 70113
  53882. || PHP_VERSION_ID === 70200));
  53883. }
  53884. private function checkConfiguration(&$info)
  53885. {
  53886. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  53887. $info = 'passthru function is disabled';
  53888. return false;
  53889. }
  53890. if (extension_loaded('uopz') && !ini_get('uopz.disable')) {
  53891. if (function_exists('uopz_allow_exit')) {
  53892. @uopz_allow_exit(true);
  53893. } else {
  53894. $info = 'uopz extension is not compatible';
  53895. return false;
  53896. }
  53897. }
  53898. return true;
  53899. }
  53900. }
  53901. Copyright (c) 2012 PHP Framework Interoperability Group
  53902. Permission is hereby granted, free of charge, to any person obtaining a copy
  53903. of this software and associated documentation files (the "Software"), to deal
  53904. in the Software without restriction, including without limitation the rights
  53905. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53906. copies of the Software, and to permit persons to whom the Software is
  53907. furnished to do so, subject to the following conditions:
  53908. The above copyright notice and this permission notice shall be included in
  53909. all copies or substantial portions of the Software.
  53910. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53911. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53912. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53913. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53914. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53915. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53916. THE SOFTWARE.
  53917. <?php
  53918. namespace Psr\Log;
  53919. abstract class AbstractLogger implements LoggerInterface
  53920. {
  53921. public function emergency($message, array $context = array())
  53922. {
  53923. $this->log(LogLevel::EMERGENCY, $message, $context);
  53924. }
  53925. public function alert($message, array $context = array())
  53926. {
  53927. $this->log(LogLevel::ALERT, $message, $context);
  53928. }
  53929. public function critical($message, array $context = array())
  53930. {
  53931. $this->log(LogLevel::CRITICAL, $message, $context);
  53932. }
  53933. public function error($message, array $context = array())
  53934. {
  53935. $this->log(LogLevel::ERROR, $message, $context);
  53936. }
  53937. public function warning($message, array $context = array())
  53938. {
  53939. $this->log(LogLevel::WARNING, $message, $context);
  53940. }
  53941. public function notice($message, array $context = array())
  53942. {
  53943. $this->log(LogLevel::NOTICE, $message, $context);
  53944. }
  53945. public function info($message, array $context = array())
  53946. {
  53947. $this->log(LogLevel::INFO, $message, $context);
  53948. }
  53949. public function debug($message, array $context = array())
  53950. {
  53951. $this->log(LogLevel::DEBUG, $message, $context);
  53952. }
  53953. }
  53954. <?php
  53955. namespace Psr\Log;
  53956. class InvalidArgumentException extends \InvalidArgumentException
  53957. {
  53958. }
  53959. <?php
  53960. namespace Psr\Log;
  53961. class LogLevel
  53962. {
  53963. const EMERGENCY = 'emergency';
  53964. const ALERT = 'alert';
  53965. const CRITICAL = 'critical';
  53966. const ERROR = 'error';
  53967. const WARNING = 'warning';
  53968. const NOTICE = 'notice';
  53969. const INFO = 'info';
  53970. const DEBUG = 'debug';
  53971. }
  53972. <?php
  53973. namespace Psr\Log;
  53974. interface LoggerAwareInterface
  53975. {
  53976. public function setLogger(LoggerInterface $logger);
  53977. }
  53978. <?php
  53979. namespace Psr\Log;
  53980. trait LoggerAwareTrait
  53981. {
  53982. protected $logger;
  53983. public function setLogger(LoggerInterface $logger)
  53984. {
  53985. $this->logger = $logger;
  53986. }
  53987. }
  53988. <?php
  53989. namespace Psr\Log;
  53990. interface LoggerInterface
  53991. {
  53992. public function emergency($message, array $context = array());
  53993. public function alert($message, array $context = array());
  53994. public function critical($message, array $context = array());
  53995. public function error($message, array $context = array());
  53996. public function warning($message, array $context = array());
  53997. public function notice($message, array $context = array());
  53998. public function info($message, array $context = array());
  53999. public function debug($message, array $context = array());
  54000. public function log($level, $message, array $context = array());
  54001. }
  54002. <?php
  54003. namespace Psr\Log;
  54004. trait LoggerTrait
  54005. {
  54006. public function emergency($message, array $context = array())
  54007. {
  54008. $this->log(LogLevel::EMERGENCY, $message, $context);
  54009. }
  54010. public function alert($message, array $context = array())
  54011. {
  54012. $this->log(LogLevel::ALERT, $message, $context);
  54013. }
  54014. public function critical($message, array $context = array())
  54015. {
  54016. $this->log(LogLevel::CRITICAL, $message, $context);
  54017. }
  54018. public function error($message, array $context = array())
  54019. {
  54020. $this->log(LogLevel::ERROR, $message, $context);
  54021. }
  54022. public function warning($message, array $context = array())
  54023. {
  54024. $this->log(LogLevel::WARNING, $message, $context);
  54025. }
  54026. public function notice($message, array $context = array())
  54027. {
  54028. $this->log(LogLevel::NOTICE, $message, $context);
  54029. }
  54030. public function info($message, array $context = array())
  54031. {
  54032. $this->log(LogLevel::INFO, $message, $context);
  54033. }
  54034. public function debug($message, array $context = array())
  54035. {
  54036. $this->log(LogLevel::DEBUG, $message, $context);
  54037. }
  54038. abstract public function log($level, $message, array $context = array());
  54039. }
  54040. <?php
  54041. namespace Psr\Log;
  54042. class NullLogger extends AbstractLogger
  54043. {
  54044. public function log($level, $message, array $context = array())
  54045. {
  54046. }
  54047. }
  54048. <?php
  54049. namespace Psr\Log\Test;
  54050. class DummyTest
  54051. {
  54052. public function __toString()
  54053. {
  54054. return 'DummyTest';
  54055. }
  54056. }
  54057. <?php
  54058. namespace Psr\Log\Test;
  54059. use Psr\Log\LoggerInterface;
  54060. use Psr\Log\LogLevel;
  54061. use PHPUnit\Framework\TestCase;
  54062. abstract class LoggerInterfaceTest extends TestCase
  54063. {
  54064. abstract public function getLogger();
  54065. abstract public function getLogs();
  54066. public function testImplements()
  54067. {
  54068. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  54069. }
  54070. public function testLogsAtAllLevels($level, $message)
  54071. {
  54072. $logger = $this->getLogger();
  54073. $logger->{$level}($message, array('user' => 'Bob'));
  54074. $logger->log($level, $message, array('user' => 'Bob'));
  54075. $expected = array(
  54076. $level.' message of level '.$level.' with context: Bob',
  54077. $level.' message of level '.$level.' with context: Bob',
  54078. );
  54079. $this->assertEquals($expected, $this->getLogs());
  54080. }
  54081. public function provideLevelsAndMessages()
  54082. {
  54083. return array(
  54084. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  54085. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  54086. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  54087. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  54088. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  54089. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  54090. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  54091. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  54092. );
  54093. }
  54094. public function testThrowsOnInvalidLevel()
  54095. {
  54096. $logger = $this->getLogger();
  54097. $logger->log('invalid level', 'Foo');
  54098. }
  54099. public function testContextReplacement()
  54100. {
  54101. $logger = $this->getLogger();
  54102. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  54103. $expected = array('info {Message {nothing} Bob Bar a}');
  54104. $this->assertEquals($expected, $this->getLogs());
  54105. }
  54106. public function testObjectCastToString()
  54107. {
  54108. if (method_exists($this, 'createPartialMock')) {
  54109. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  54110. } else {
  54111. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  54112. }
  54113. $dummy->expects($this->once())
  54114. ->method('__toString')
  54115. ->will($this->returnValue('DUMMY'));
  54116. $this->getLogger()->warning($dummy);
  54117. $expected = array('warning DUMMY');
  54118. $this->assertEquals($expected, $this->getLogs());
  54119. }
  54120. public function testContextCanContainAnything()
  54121. {
  54122. $closed = fopen('php://memory', 'r');
  54123. fclose($closed);
  54124. $context = array(
  54125. 'bool' => true,
  54126. 'null' => null,
  54127. 'string' => 'Foo',
  54128. 'int' => 0,
  54129. 'float' => 0.5,
  54130. 'nested' => array('with object' => new DummyTest),
  54131. 'object' => new \DateTime,
  54132. 'resource' => fopen('php://memory', 'r'),
  54133. 'closed' => $closed,
  54134. );
  54135. $this->getLogger()->warning('Crazy context data', $context);
  54136. $expected = array('warning Crazy context data');
  54137. $this->assertEquals($expected, $this->getLogs());
  54138. }
  54139. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  54140. {
  54141. $logger = $this->getLogger();
  54142. $logger->warning('Random message', array('exception' => 'oops'));
  54143. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  54144. $expected = array(
  54145. 'warning Random message',
  54146. 'critical Uncaught Exception!'
  54147. );
  54148. $this->assertEquals($expected, $this->getLogs());
  54149. }
  54150. }
  54151. <?php
  54152. namespace Psr\Log\Test;
  54153. use Psr\Log\AbstractLogger;
  54154. class TestLogger extends AbstractLogger
  54155. {
  54156. public $records = [];
  54157. public $recordsByLevel = [];
  54158. public function log($level, $message, array $context = [])
  54159. {
  54160. $record = [
  54161. 'level' => $level,
  54162. 'message' => $message,
  54163. 'context' => $context,
  54164. ];
  54165. $this->recordsByLevel[$record['level']][] = $record;
  54166. $this->records[] = $record;
  54167. }
  54168. public function hasRecords($level)
  54169. {
  54170. return isset($this->recordsByLevel[$level]);
  54171. }
  54172. public function hasRecord($record, $level)
  54173. {
  54174. if (is_string($record)) {
  54175. $record = ['message' => $record];
  54176. }
  54177. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  54178. if ($rec['message'] !== $record['message']) {
  54179. return false;
  54180. }
  54181. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  54182. return false;
  54183. }
  54184. return true;
  54185. }, $level);
  54186. }
  54187. public function hasRecordThatContains($message, $level)
  54188. {
  54189. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  54190. return strpos($rec['message'], $message) !== false;
  54191. }, $level);
  54192. }
  54193. public function hasRecordThatMatches($regex, $level)
  54194. {
  54195. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  54196. return preg_match($regex, $rec['message']) > 0;
  54197. }, $level);
  54198. }
  54199. public function hasRecordThatPasses(callable $predicate, $level)
  54200. {
  54201. if (!isset($this->recordsByLevel[$level])) {
  54202. return false;
  54203. }
  54204. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  54205. if (call_user_func($predicate, $rec, $i)) {
  54206. return true;
  54207. }
  54208. }
  54209. return false;
  54210. }
  54211. public function __call($method, $args)
  54212. {
  54213. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  54214. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  54215. $level = strtolower($matches[2]);
  54216. if (method_exists($this, $genericMethod)) {
  54217. $args[] = $level;
  54218. return call_user_func_array([$this, $genericMethod], $args);
  54219. }
  54220. }
  54221. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  54222. }
  54223. public function reset()
  54224. {
  54225. $this->records = [];
  54226. $this->recordsByLevel = [];
  54227. }
  54228. }
  54229. <?php
  54230. require_once __DIR__ . '/composer/autoload_real.php';
  54231. return ComposerAutoloaderInitComposerPhar1596447319::getLoader();
  54232. <?php
  54233. $vendorDir = dirname(dirname(__FILE__));
  54234. $baseDir = dirname($vendorDir);
  54235. return array(
  54236. );
  54237. <?php
  54238. $vendorDir = dirname(dirname(__FILE__));
  54239. $baseDir = dirname($vendorDir);
  54240. return array(
  54241. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  54242. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  54243. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  54244. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  54245. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  54246. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  54247. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  54248. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  54249. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  54250. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  54251. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  54252. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  54253. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  54254. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  54255. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  54256. 'Composer\\' => array($baseDir . '/src/Composer'),
  54257. );
  54258. <?php
  54259. $vendorDir = dirname(dirname(__FILE__));
  54260. $baseDir = dirname($vendorDir);
  54261. return array(
  54262. );
  54263. <?php
  54264. $vendorDir = dirname(dirname(__FILE__));
  54265. $baseDir = dirname($vendorDir);
  54266. return array(
  54267. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  54268. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  54269. );
  54270. <?php
  54271. class ComposerAutoloaderInitComposerPhar1596447319
  54272. {
  54273. private static $loader;
  54274. public static function loadClassLoader($class)
  54275. {
  54276. if ('Composer\Autoload\ClassLoader' === $class) {
  54277. require __DIR__ . '/ClassLoader.php';
  54278. }
  54279. }
  54280. public static function getLoader()
  54281. {
  54282. if (null !== self::$loader) {
  54283. return self::$loader;
  54284. }
  54285. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1596447319', 'loadClassLoader'), true, true);
  54286. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  54287. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1596447319', 'loadClassLoader'));
  54288. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  54289. if ($useStaticLoader) {
  54290. require_once __DIR__ . '/autoload_static.php';
  54291. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1596447319::getInitializer($loader));
  54292. } else {
  54293. $map = require __DIR__ . '/autoload_namespaces.php';
  54294. foreach ($map as $namespace => $path) {
  54295. $loader->set($namespace, $path);
  54296. }
  54297. $map = require __DIR__ . '/autoload_psr4.php';
  54298. foreach ($map as $namespace => $path) {
  54299. $loader->setPsr4($namespace, $path);
  54300. }
  54301. $classMap = require __DIR__ . '/autoload_classmap.php';
  54302. if ($classMap) {
  54303. $loader->addClassMap($classMap);
  54304. }
  54305. }
  54306. $loader->register(true);
  54307. if ($useStaticLoader) {
  54308. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1596447319::$files;
  54309. } else {
  54310. $includeFiles = require __DIR__ . '/autoload_files.php';
  54311. }
  54312. foreach ($includeFiles as $fileIdentifier => $file) {
  54313. composerRequireComposerPhar1596447319($fileIdentifier, $file);
  54314. }
  54315. return $loader;
  54316. }
  54317. }
  54318. function composerRequireComposerPhar1596447319($fileIdentifier, $file)
  54319. {
  54320. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  54321. require $file;
  54322. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  54323. }
  54324. }
  54325. <?php
  54326. namespace Composer\Autoload;
  54327. class ComposerStaticInitComposerPhar1596447319
  54328. {
  54329. public static $files = array (
  54330. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  54331. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  54332. );
  54333. public static $prefixLengthsPsr4 = array (
  54334. 'S' =>
  54335. array (
  54336. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  54337. 'Symfony\\Polyfill\\Ctype\\' => 23,
  54338. 'Symfony\\Component\\Process\\' => 26,
  54339. 'Symfony\\Component\\Finder\\' => 25,
  54340. 'Symfony\\Component\\Filesystem\\' => 29,
  54341. 'Symfony\\Component\\Debug\\' => 24,
  54342. 'Symfony\\Component\\Console\\' => 26,
  54343. 'Seld\\PharUtils\\' => 15,
  54344. 'Seld\\JsonLint\\' => 14,
  54345. ),
  54346. 'P' =>
  54347. array (
  54348. 'Psr\\Log\\' => 8,
  54349. ),
  54350. 'J' =>
  54351. array (
  54352. 'JsonSchema\\' => 11,
  54353. ),
  54354. 'C' =>
  54355. array (
  54356. 'Composer\\XdebugHandler\\' => 23,
  54357. 'Composer\\Spdx\\' => 14,
  54358. 'Composer\\Semver\\' => 16,
  54359. 'Composer\\CaBundle\\' => 18,
  54360. 'Composer\\' => 9,
  54361. ),
  54362. );
  54363. public static $prefixDirsPsr4 = array (
  54364. 'Symfony\\Polyfill\\Mbstring\\' =>
  54365. array (
  54366. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  54367. ),
  54368. 'Symfony\\Polyfill\\Ctype\\' =>
  54369. array (
  54370. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  54371. ),
  54372. 'Symfony\\Component\\Process\\' =>
  54373. array (
  54374. 0 => __DIR__ . '/..' . '/symfony/process',
  54375. ),
  54376. 'Symfony\\Component\\Finder\\' =>
  54377. array (
  54378. 0 => __DIR__ . '/..' . '/symfony/finder',
  54379. ),
  54380. 'Symfony\\Component\\Filesystem\\' =>
  54381. array (
  54382. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  54383. ),
  54384. 'Symfony\\Component\\Debug\\' =>
  54385. array (
  54386. 0 => __DIR__ . '/..' . '/symfony/debug',
  54387. ),
  54388. 'Symfony\\Component\\Console\\' =>
  54389. array (
  54390. 0 => __DIR__ . '/..' . '/symfony/console',
  54391. ),
  54392. 'Seld\\PharUtils\\' =>
  54393. array (
  54394. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  54395. ),
  54396. 'Seld\\JsonLint\\' =>
  54397. array (
  54398. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  54399. ),
  54400. 'Psr\\Log\\' =>
  54401. array (
  54402. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  54403. ),
  54404. 'JsonSchema\\' =>
  54405. array (
  54406. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  54407. ),
  54408. 'Composer\\XdebugHandler\\' =>
  54409. array (
  54410. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  54411. ),
  54412. 'Composer\\Spdx\\' =>
  54413. array (
  54414. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  54415. ),
  54416. 'Composer\\Semver\\' =>
  54417. array (
  54418. 0 => __DIR__ . '/..' . '/composer/semver/src',
  54419. ),
  54420. 'Composer\\CaBundle\\' =>
  54421. array (
  54422. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  54423. ),
  54424. 'Composer\\' =>
  54425. array (
  54426. 0 => __DIR__ . '/../..' . '/src/Composer',
  54427. ),
  54428. );
  54429. public static function getInitializer(ClassLoader $loader)
  54430. {
  54431. return \Closure::bind(function () use ($loader) {
  54432. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1596447319::$prefixLengthsPsr4;
  54433. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1596447319::$prefixDirsPsr4;
  54434. }, null, ClassLoader::class);
  54435. }
  54436. }
  54437. <?php
  54438. namespace Composer\Autoload;
  54439. class ClassLoader
  54440. {
  54441. private $prefixLengthsPsr4 = array();
  54442. private $prefixDirsPsr4 = array();
  54443. private $fallbackDirsPsr4 = array();
  54444. private $prefixesPsr0 = array();
  54445. private $fallbackDirsPsr0 = array();
  54446. private $useIncludePath = false;
  54447. private $classMap = array();
  54448. private $classMapAuthoritative = false;
  54449. private $missingClasses = array();
  54450. private $apcuPrefix;
  54451. public function getPrefixes()
  54452. {
  54453. if (!empty($this->prefixesPsr0)) {
  54454. return call_user_func_array('array_merge', $this->prefixesPsr0);
  54455. }
  54456. return array();
  54457. }
  54458. public function getPrefixesPsr4()
  54459. {
  54460. return $this->prefixDirsPsr4;
  54461. }
  54462. public function getFallbackDirs()
  54463. {
  54464. return $this->fallbackDirsPsr0;
  54465. }
  54466. public function getFallbackDirsPsr4()
  54467. {
  54468. return $this->fallbackDirsPsr4;
  54469. }
  54470. public function getClassMap()
  54471. {
  54472. return $this->classMap;
  54473. }
  54474. public function addClassMap(array $classMap)
  54475. {
  54476. if ($this->classMap) {
  54477. $this->classMap = array_merge($this->classMap, $classMap);
  54478. } else {
  54479. $this->classMap = $classMap;
  54480. }
  54481. }
  54482. public function add($prefix, $paths, $prepend = false)
  54483. {
  54484. if (!$prefix) {
  54485. if ($prepend) {
  54486. $this->fallbackDirsPsr0 = array_merge(
  54487. (array) $paths,
  54488. $this->fallbackDirsPsr0
  54489. );
  54490. } else {
  54491. $this->fallbackDirsPsr0 = array_merge(
  54492. $this->fallbackDirsPsr0,
  54493. (array) $paths
  54494. );
  54495. }
  54496. return;
  54497. }
  54498. $first = $prefix[0];
  54499. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  54500. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  54501. return;
  54502. }
  54503. if ($prepend) {
  54504. $this->prefixesPsr0[$first][$prefix] = array_merge(
  54505. (array) $paths,
  54506. $this->prefixesPsr0[$first][$prefix]
  54507. );
  54508. } else {
  54509. $this->prefixesPsr0[$first][$prefix] = array_merge(
  54510. $this->prefixesPsr0[$first][$prefix],
  54511. (array) $paths
  54512. );
  54513. }
  54514. }
  54515. public function addPsr4($prefix, $paths, $prepend = false)
  54516. {
  54517. if (!$prefix) {
  54518. if ($prepend) {
  54519. $this->fallbackDirsPsr4 = array_merge(
  54520. (array) $paths,
  54521. $this->fallbackDirsPsr4
  54522. );
  54523. } else {
  54524. $this->fallbackDirsPsr4 = array_merge(
  54525. $this->fallbackDirsPsr4,
  54526. (array) $paths
  54527. );
  54528. }
  54529. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  54530. $length = strlen($prefix);
  54531. if ('\\' !== $prefix[$length - 1]) {
  54532. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  54533. }
  54534. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  54535. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  54536. } elseif ($prepend) {
  54537. $this->prefixDirsPsr4[$prefix] = array_merge(
  54538. (array) $paths,
  54539. $this->prefixDirsPsr4[$prefix]
  54540. );
  54541. } else {
  54542. $this->prefixDirsPsr4[$prefix] = array_merge(
  54543. $this->prefixDirsPsr4[$prefix],
  54544. (array) $paths
  54545. );
  54546. }
  54547. }
  54548. public function set($prefix, $paths)
  54549. {
  54550. if (!$prefix) {
  54551. $this->fallbackDirsPsr0 = (array) $paths;
  54552. } else {
  54553. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  54554. }
  54555. }
  54556. public function setPsr4($prefix, $paths)
  54557. {
  54558. if (!$prefix) {
  54559. $this->fallbackDirsPsr4 = (array) $paths;
  54560. } else {
  54561. $length = strlen($prefix);
  54562. if ('\\' !== $prefix[$length - 1]) {
  54563. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  54564. }
  54565. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  54566. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  54567. }
  54568. }
  54569. public function setUseIncludePath($useIncludePath)
  54570. {
  54571. $this->useIncludePath = $useIncludePath;
  54572. }
  54573. public function getUseIncludePath()
  54574. {
  54575. return $this->useIncludePath;
  54576. }
  54577. public function setClassMapAuthoritative($classMapAuthoritative)
  54578. {
  54579. $this->classMapAuthoritative = $classMapAuthoritative;
  54580. }
  54581. public function isClassMapAuthoritative()
  54582. {
  54583. return $this->classMapAuthoritative;
  54584. }
  54585. public function setApcuPrefix($apcuPrefix)
  54586. {
  54587. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  54588. }
  54589. public function getApcuPrefix()
  54590. {
  54591. return $this->apcuPrefix;
  54592. }
  54593. public function register($prepend = false)
  54594. {
  54595. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  54596. }
  54597. public function unregister()
  54598. {
  54599. spl_autoload_unregister(array($this, 'loadClass'));
  54600. }
  54601. public function loadClass($class)
  54602. {
  54603. if ($file = $this->findFile($class)) {
  54604. includeFile($file);
  54605. return true;
  54606. }
  54607. }
  54608. public function findFile($class)
  54609. {
  54610. if (isset($this->classMap[$class])) {
  54611. return $this->classMap[$class];
  54612. }
  54613. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  54614. return false;
  54615. }
  54616. if (null !== $this->apcuPrefix) {
  54617. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  54618. if ($hit) {
  54619. return $file;
  54620. }
  54621. }
  54622. $file = $this->findFileWithExtension($class, '.php');
  54623. if (false === $file && defined('HHVM_VERSION')) {
  54624. $file = $this->findFileWithExtension($class, '.hh');
  54625. }
  54626. if (null !== $this->apcuPrefix) {
  54627. apcu_add($this->apcuPrefix.$class, $file);
  54628. }
  54629. if (false === $file) {
  54630. $this->missingClasses[$class] = true;
  54631. }
  54632. return $file;
  54633. }
  54634. private function findFileWithExtension($class, $ext)
  54635. {
  54636. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  54637. $first = $class[0];
  54638. if (isset($this->prefixLengthsPsr4[$first])) {
  54639. $subPath = $class;
  54640. while (false !== $lastPos = strrpos($subPath, '\\')) {
  54641. $subPath = substr($subPath, 0, $lastPos);
  54642. $search = $subPath . '\\';
  54643. if (isset($this->prefixDirsPsr4[$search])) {
  54644. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  54645. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  54646. if (file_exists($file = $dir . $pathEnd)) {
  54647. return $file;
  54648. }
  54649. }
  54650. }
  54651. }
  54652. }
  54653. foreach ($this->fallbackDirsPsr4 as $dir) {
  54654. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  54655. return $file;
  54656. }
  54657. }
  54658. if (false !== $pos = strrpos($class, '\\')) {
  54659. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  54660. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  54661. } else {
  54662. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  54663. }
  54664. if (isset($this->prefixesPsr0[$first])) {
  54665. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  54666. if (0 === strpos($class, $prefix)) {
  54667. foreach ($dirs as $dir) {
  54668. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  54669. return $file;
  54670. }
  54671. }
  54672. }
  54673. }
  54674. }
  54675. foreach ($this->fallbackDirsPsr0 as $dir) {
  54676. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  54677. return $file;
  54678. }
  54679. }
  54680. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  54681. return $file;
  54682. }
  54683. return false;
  54684. }
  54685. }
  54686. function includeFile($file)
  54687. {
  54688. include $file;
  54689. }
  54690. ##
  54691. ## Bundle of CA Root Certificates
  54692. ##
  54693. ## Certificate data from Mozilla as of: Wed Jan 1 04:12:10 2020 GMT
  54694. ##
  54695. ## This is a bundle of X.509 certificates of public Certificate Authorities
  54696. ## (CA). These were automatically extracted from Mozilla's root certificates
  54697. ## file (certdata.txt). This file can be found in the mozilla source tree:
  54698. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  54699. ##
  54700. ## It contains the certificates in PEM format and therefore
  54701. ## can be directly used with curl / libcurl / php_curl, or with
  54702. ## an Apache+mod_ssl webserver for SSL client authentication.
  54703. ## Just configure this file as the SSLCACertificateFile.
  54704. ##
  54705. ## Conversion done with mk-ca-bundle.pl version 1.27.
  54706. ## SHA256: f3bdcd74612952da8476a9d4147f50b29ad0710b7dd95b4c8690500209986d70
  54707. ##
  54708. GlobalSign Root CA
  54709. ==================
  54710. -----BEGIN CERTIFICATE-----
  54711. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  54712. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  54713. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  54714. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  54715. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  54716. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  54717. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  54718. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  54719. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  54720. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  54721. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  54722. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  54723. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  54724. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  54725. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  54726. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  54727. -----END CERTIFICATE-----
  54728. GlobalSign Root CA - R2
  54729. =======================
  54730. -----BEGIN CERTIFICATE-----
  54731. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  54732. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  54733. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  54734. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  54735. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  54736. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  54737. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  54738. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  54739. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  54740. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  54741. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  54742. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  54743. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  54744. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  54745. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  54746. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  54747. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  54748. -----END CERTIFICATE-----
  54749. Verisign Class 3 Public Primary Certification Authority - G3
  54750. ============================================================
  54751. -----BEGIN CERTIFICATE-----
  54752. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  54753. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  54754. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  54755. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  54756. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  54757. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  54758. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  54759. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  54760. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54761. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  54762. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  54763. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  54764. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  54765. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  54766. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  54767. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  54768. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  54769. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  54770. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  54771. -----END CERTIFICATE-----
  54772. Entrust.net Premium 2048 Secure Server CA
  54773. =========================================
  54774. -----BEGIN CERTIFICATE-----
  54775. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  54776. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  54777. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  54778. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  54779. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  54780. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  54781. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  54782. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54783. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  54784. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  54785. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  54786. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  54787. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  54788. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  54789. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  54790. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  54791. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  54792. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  54793. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  54794. -----END CERTIFICATE-----
  54795. Baltimore CyberTrust Root
  54796. =========================
  54797. -----BEGIN CERTIFICATE-----
  54798. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  54799. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  54800. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  54801. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  54802. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  54803. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  54804. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  54805. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  54806. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  54807. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  54808. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  54809. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  54810. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  54811. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  54812. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  54813. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  54814. -----END CERTIFICATE-----
  54815. AddTrust External Root
  54816. ======================
  54817. -----BEGIN CERTIFICATE-----
  54818. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  54819. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  54820. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  54821. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  54822. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  54823. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  54824. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  54825. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  54826. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  54827. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  54828. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  54829. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  54830. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  54831. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  54832. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  54833. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  54834. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  54835. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  54836. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  54837. -----END CERTIFICATE-----
  54838. Entrust Root Certification Authority
  54839. ====================================
  54840. -----BEGIN CERTIFICATE-----
  54841. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  54842. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  54843. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  54844. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  54845. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  54846. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  54847. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  54848. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54849. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  54850. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  54851. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  54852. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  54853. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  54854. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  54855. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  54856. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  54857. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  54858. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  54859. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  54860. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  54861. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  54862. -----END CERTIFICATE-----
  54863. GeoTrust Global CA
  54864. ==================
  54865. -----BEGIN CERTIFICATE-----
  54866. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  54867. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  54868. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  54869. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  54870. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  54871. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  54872. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  54873. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  54874. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  54875. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  54876. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  54877. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  54878. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  54879. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  54880. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  54881. Mw==
  54882. -----END CERTIFICATE-----
  54883. GeoTrust Universal CA
  54884. =====================
  54885. -----BEGIN CERTIFICATE-----
  54886. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54887. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  54888. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  54889. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  54890. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  54891. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  54892. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  54893. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  54894. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  54895. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  54896. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  54897. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  54898. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  54899. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  54900. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  54901. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  54902. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  54903. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  54904. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  54905. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  54906. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  54907. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  54908. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  54909. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  54910. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  54911. -----END CERTIFICATE-----
  54912. GeoTrust Universal CA 2
  54913. =======================
  54914. -----BEGIN CERTIFICATE-----
  54915. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54916. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  54917. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  54918. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  54919. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  54920. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  54921. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  54922. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  54923. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  54924. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  54925. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  54926. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  54927. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  54928. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  54929. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  54930. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  54931. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  54932. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  54933. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  54934. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  54935. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  54936. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  54937. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  54938. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  54939. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  54940. -----END CERTIFICATE-----
  54941. Comodo AAA Services root
  54942. ========================
  54943. -----BEGIN CERTIFICATE-----
  54944. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  54945. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  54946. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  54947. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  54948. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  54949. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54950. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  54951. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  54952. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  54953. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  54954. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  54955. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  54956. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  54957. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  54958. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  54959. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  54960. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  54961. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  54962. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  54963. -----END CERTIFICATE-----
  54964. QuoVadis Root CA
  54965. ================
  54966. -----BEGIN CERTIFICATE-----
  54967. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  54968. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  54969. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  54970. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  54971. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  54972. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  54973. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  54974. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  54975. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  54976. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  54977. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  54978. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  54979. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  54980. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  54981. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  54982. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  54983. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  54984. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  54985. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  54986. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  54987. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  54988. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  54989. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  54990. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  54991. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  54992. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  54993. 5nrQNiOKSnQ2+Q==
  54994. -----END CERTIFICATE-----
  54995. QuoVadis Root CA 2
  54996. ==================
  54997. -----BEGIN CERTIFICATE-----
  54998. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  54999. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  55000. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  55001. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55002. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  55003. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  55004. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  55005. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  55006. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  55007. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  55008. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  55009. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  55010. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  55011. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  55012. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  55013. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  55014. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  55015. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  55016. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  55017. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  55018. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  55019. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  55020. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  55021. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  55022. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  55023. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  55024. -----END CERTIFICATE-----
  55025. QuoVadis Root CA 3
  55026. ==================
  55027. -----BEGIN CERTIFICATE-----
  55028. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  55029. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  55030. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  55031. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55032. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  55033. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  55034. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  55035. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  55036. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  55037. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  55038. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  55039. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  55040. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  55041. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  55042. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  55043. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  55044. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  55045. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  55046. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  55047. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  55048. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  55049. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  55050. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  55051. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  55052. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  55053. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  55054. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  55055. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  55056. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  55057. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  55058. -----END CERTIFICATE-----
  55059. Security Communication Root CA
  55060. ==============================
  55061. -----BEGIN CERTIFICATE-----
  55062. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  55063. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  55064. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  55065. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  55066. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  55067. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  55068. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  55069. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  55070. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  55071. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  55072. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  55073. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  55074. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  55075. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  55076. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  55077. FL39vmwLAw==
  55078. -----END CERTIFICATE-----
  55079. Sonera Class 2 Root CA
  55080. ======================
  55081. -----BEGIN CERTIFICATE-----
  55082. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  55083. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  55084. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  55085. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  55086. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  55087. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  55088. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  55089. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  55090. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  55091. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  55092. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  55093. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  55094. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  55095. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  55096. llpwrN9M
  55097. -----END CERTIFICATE-----
  55098. XRamp Global CA Root
  55099. ====================
  55100. -----BEGIN CERTIFICATE-----
  55101. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  55102. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  55103. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  55104. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  55105. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  55106. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  55107. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  55108. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  55109. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  55110. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  55111. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  55112. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  55113. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  55114. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  55115. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  55116. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  55117. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  55118. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  55119. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  55120. -----END CERTIFICATE-----
  55121. Go Daddy Class 2 CA
  55122. ===================
  55123. -----BEGIN CERTIFICATE-----
  55124. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  55125. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  55126. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  55127. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  55128. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  55129. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  55130. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  55131. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  55132. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  55133. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  55134. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  55135. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  55136. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  55137. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  55138. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  55139. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  55140. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  55141. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  55142. vZ8=
  55143. -----END CERTIFICATE-----
  55144. Starfield Class 2 CA
  55145. ====================
  55146. -----BEGIN CERTIFICATE-----
  55147. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  55148. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  55149. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  55150. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  55151. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  55152. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  55153. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  55154. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  55155. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  55156. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  55157. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  55158. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  55159. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  55160. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  55161. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  55162. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  55163. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  55164. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  55165. QBFGmh95DmK/D5fs4C8fF5Q=
  55166. -----END CERTIFICATE-----
  55167. Taiwan GRCA
  55168. ===========
  55169. -----BEGIN CERTIFICATE-----
  55170. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  55171. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  55172. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  55173. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55174. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  55175. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  55176. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  55177. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  55178. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  55179. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  55180. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  55181. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  55182. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  55183. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  55184. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  55185. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  55186. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  55187. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  55188. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  55189. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  55190. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  55191. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  55192. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  55193. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  55194. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  55195. -----END CERTIFICATE-----
  55196. DigiCert Assured ID Root CA
  55197. ===========================
  55198. -----BEGIN CERTIFICATE-----
  55199. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  55200. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  55201. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  55202. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  55203. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  55204. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  55205. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  55206. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  55207. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  55208. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  55209. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  55210. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  55211. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  55212. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  55213. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  55214. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  55215. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  55216. -----END CERTIFICATE-----
  55217. DigiCert Global Root CA
  55218. =======================
  55219. -----BEGIN CERTIFICATE-----
  55220. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  55221. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  55222. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  55223. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  55224. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  55225. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  55226. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  55227. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  55228. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  55229. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  55230. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  55231. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  55232. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  55233. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  55234. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  55235. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  55236. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  55237. -----END CERTIFICATE-----
  55238. DigiCert High Assurance EV Root CA
  55239. ==================================
  55240. -----BEGIN CERTIFICATE-----
  55241. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  55242. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  55243. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  55244. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  55245. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  55246. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  55247. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  55248. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  55249. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  55250. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  55251. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  55252. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  55253. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  55254. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  55255. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  55256. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  55257. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  55258. -----END CERTIFICATE-----
  55259. DST Root CA X3
  55260. ==============
  55261. -----BEGIN CERTIFICATE-----
  55262. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  55263. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  55264. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  55265. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  55266. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  55267. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  55268. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  55269. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  55270. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  55271. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  55272. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  55273. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  55274. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  55275. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  55276. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  55277. -----END CERTIFICATE-----
  55278. SwissSign Gold CA - G2
  55279. ======================
  55280. -----BEGIN CERTIFICATE-----
  55281. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  55282. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  55283. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  55284. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  55285. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  55286. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  55287. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  55288. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  55289. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  55290. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  55291. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  55292. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  55293. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  55294. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  55295. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  55296. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  55297. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  55298. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  55299. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  55300. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  55301. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  55302. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  55303. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  55304. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  55305. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  55306. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  55307. -----END CERTIFICATE-----
  55308. SwissSign Silver CA - G2
  55309. ========================
  55310. -----BEGIN CERTIFICATE-----
  55311. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  55312. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  55313. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  55314. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  55315. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  55316. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  55317. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  55318. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  55319. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  55320. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  55321. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  55322. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  55323. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  55324. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  55325. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  55326. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  55327. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  55328. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  55329. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  55330. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  55331. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  55332. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  55333. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  55334. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  55335. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  55336. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  55337. -----END CERTIFICATE-----
  55338. GeoTrust Primary Certification Authority
  55339. ========================================
  55340. -----BEGIN CERTIFICATE-----
  55341. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  55342. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  55343. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  55344. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  55345. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  55346. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  55347. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  55348. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  55349. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  55350. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55351. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  55352. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  55353. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  55354. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  55355. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  55356. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  55357. -----END CERTIFICATE-----
  55358. thawte Primary Root CA
  55359. ======================
  55360. -----BEGIN CERTIFICATE-----
  55361. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  55362. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  55363. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  55364. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  55365. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  55366. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  55367. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  55368. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  55369. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  55370. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  55371. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  55372. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  55373. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  55374. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  55375. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  55376. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  55377. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  55378. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  55379. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  55380. -----END CERTIFICATE-----
  55381. VeriSign Class 3 Public Primary Certification Authority - G5
  55382. ============================================================
  55383. -----BEGIN CERTIFICATE-----
  55384. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  55385. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55386. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55387. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  55388. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  55389. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  55390. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  55391. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  55392. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  55393. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  55394. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  55395. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  55396. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  55397. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  55398. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  55399. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  55400. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  55401. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  55402. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  55403. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  55404. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  55405. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  55406. -----END CERTIFICATE-----
  55407. SecureTrust CA
  55408. ==============
  55409. -----BEGIN CERTIFICATE-----
  55410. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  55411. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  55412. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  55413. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  55414. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  55415. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  55416. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  55417. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  55418. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  55419. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  55420. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  55421. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  55422. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  55423. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  55424. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  55425. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  55426. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  55427. -----END CERTIFICATE-----
  55428. Secure Global CA
  55429. ================
  55430. -----BEGIN CERTIFICATE-----
  55431. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  55432. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  55433. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  55434. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  55435. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  55436. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  55437. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  55438. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  55439. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  55440. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  55441. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  55442. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  55443. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  55444. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  55445. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  55446. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  55447. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  55448. -----END CERTIFICATE-----
  55449. COMODO Certification Authority
  55450. ==============================
  55451. -----BEGIN CERTIFICATE-----
  55452. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  55453. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  55454. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  55455. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  55456. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  55457. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  55458. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  55459. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  55460. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  55461. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  55462. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  55463. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  55464. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  55465. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  55466. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  55467. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  55468. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  55469. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  55470. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  55471. -----END CERTIFICATE-----
  55472. Network Solutions Certificate Authority
  55473. =======================================
  55474. -----BEGIN CERTIFICATE-----
  55475. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  55476. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  55477. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  55478. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  55479. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  55480. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  55481. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  55482. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  55483. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  55484. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  55485. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  55486. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  55487. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  55488. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  55489. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  55490. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  55491. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  55492. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  55493. -----END CERTIFICATE-----
  55494. COMODO ECC Certification Authority
  55495. ==================================
  55496. -----BEGIN CERTIFICATE-----
  55497. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  55498. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  55499. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  55500. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  55501. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  55502. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  55503. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  55504. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  55505. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  55506. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  55507. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  55508. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  55509. -----END CERTIFICATE-----
  55510. OISTE WISeKey Global Root GA CA
  55511. ===============================
  55512. -----BEGIN CERTIFICATE-----
  55513. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  55514. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  55515. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  55516. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  55517. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  55518. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  55519. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  55520. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  55521. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  55522. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  55523. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  55524. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  55525. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  55526. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  55527. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  55528. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  55529. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  55530. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  55531. -----END CERTIFICATE-----
  55532. Certigna
  55533. ========
  55534. -----BEGIN CERTIFICATE-----
  55535. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  55536. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  55537. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  55538. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  55539. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  55540. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  55541. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  55542. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  55543. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  55544. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  55545. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  55546. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  55547. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  55548. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  55549. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  55550. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  55551. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  55552. -----END CERTIFICATE-----
  55553. Cybertrust Global Root
  55554. ======================
  55555. -----BEGIN CERTIFICATE-----
  55556. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  55557. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  55558. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  55559. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  55560. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  55561. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  55562. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  55563. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  55564. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  55565. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  55566. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  55567. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  55568. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  55569. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  55570. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  55571. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  55572. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  55573. -----END CERTIFICATE-----
  55574. ePKI Root Certification Authority
  55575. =================================
  55576. -----BEGIN CERTIFICATE-----
  55577. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  55578. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  55579. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  55580. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  55581. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  55582. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  55583. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  55584. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  55585. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  55586. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  55587. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  55588. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  55589. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  55590. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  55591. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  55592. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  55593. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  55594. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  55595. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  55596. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  55597. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  55598. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  55599. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  55600. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  55601. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  55602. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  55603. -----END CERTIFICATE-----
  55604. certSIGN ROOT CA
  55605. ================
  55606. -----BEGIN CERTIFICATE-----
  55607. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  55608. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  55609. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  55610. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  55611. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  55612. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  55613. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  55614. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  55615. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  55616. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  55617. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  55618. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  55619. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  55620. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  55621. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  55622. -----END CERTIFICATE-----
  55623. GeoTrust Primary Certification Authority - G3
  55624. =============================================
  55625. -----BEGIN CERTIFICATE-----
  55626. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  55627. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  55628. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  55629. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  55630. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  55631. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  55632. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  55633. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  55634. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  55635. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  55636. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  55637. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  55638. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  55639. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  55640. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  55641. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  55642. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  55643. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  55644. -----END CERTIFICATE-----
  55645. thawte Primary Root CA - G2
  55646. ===========================
  55647. -----BEGIN CERTIFICATE-----
  55648. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  55649. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  55650. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  55651. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  55652. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  55653. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  55654. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  55655. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  55656. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  55657. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  55658. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  55659. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  55660. -----END CERTIFICATE-----
  55661. thawte Primary Root CA - G3
  55662. ===========================
  55663. -----BEGIN CERTIFICATE-----
  55664. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  55665. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  55666. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  55667. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  55668. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  55669. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  55670. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  55671. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  55672. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  55673. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  55674. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  55675. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  55676. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  55677. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  55678. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  55679. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  55680. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  55681. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  55682. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  55683. -----END CERTIFICATE-----
  55684. GeoTrust Primary Certification Authority - G2
  55685. =============================================
  55686. -----BEGIN CERTIFICATE-----
  55687. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  55688. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  55689. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  55690. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  55691. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  55692. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  55693. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  55694. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  55695. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  55696. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  55697. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  55698. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  55699. npaqBA+K
  55700. -----END CERTIFICATE-----
  55701. VeriSign Universal Root Certification Authority
  55702. ===============================================
  55703. -----BEGIN CERTIFICATE-----
  55704. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  55705. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55706. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55707. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  55708. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  55709. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  55710. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  55711. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  55712. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  55713. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  55714. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  55715. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  55716. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  55717. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  55718. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  55719. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  55720. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  55721. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  55722. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  55723. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  55724. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  55725. mJO37M2CYfE45k+XmCpajQ==
  55726. -----END CERTIFICATE-----
  55727. VeriSign Class 3 Public Primary Certification Authority - G4
  55728. ============================================================
  55729. -----BEGIN CERTIFICATE-----
  55730. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  55731. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  55732. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  55733. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  55734. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  55735. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  55736. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  55737. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  55738. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  55739. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  55740. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  55741. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  55742. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  55743. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  55744. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  55745. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  55746. -----END CERTIFICATE-----
  55747. NetLock Arany (Class Gold) Főtanúsítvány
  55748. ========================================
  55749. -----BEGIN CERTIFICATE-----
  55750. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  55751. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  55752. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  55753. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  55754. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  55755. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  55756. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  55757. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  55758. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  55759. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  55760. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  55761. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  55762. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  55763. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  55764. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  55765. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  55766. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  55767. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  55768. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  55769. -----END CERTIFICATE-----
  55770. Staat der Nederlanden Root CA - G2
  55771. ==================================
  55772. -----BEGIN CERTIFICATE-----
  55773. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  55774. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  55775. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  55776. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  55777. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  55778. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  55779. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  55780. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  55781. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  55782. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  55783. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  55784. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  55785. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  55786. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  55787. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  55788. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  55789. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  55790. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  55791. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  55792. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  55793. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  55794. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  55795. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  55796. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  55797. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  55798. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  55799. 66+KAQ==
  55800. -----END CERTIFICATE-----
  55801. Hongkong Post Root CA 1
  55802. =======================
  55803. -----BEGIN CERTIFICATE-----
  55804. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  55805. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  55806. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  55807. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  55808. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  55809. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  55810. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  55811. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  55812. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  55813. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  55814. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  55815. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  55816. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  55817. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  55818. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  55819. -----END CERTIFICATE-----
  55820. SecureSign RootCA11
  55821. ===================
  55822. -----BEGIN CERTIFICATE-----
  55823. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  55824. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  55825. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  55826. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  55827. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  55828. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  55829. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  55830. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  55831. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  55832. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  55833. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  55834. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  55835. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  55836. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  55837. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  55838. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  55839. -----END CERTIFICATE-----
  55840. Microsec e-Szigno Root CA 2009
  55841. ==============================
  55842. -----BEGIN CERTIFICATE-----
  55843. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  55844. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  55845. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  55846. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  55847. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  55848. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  55849. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  55850. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  55851. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  55852. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  55853. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  55854. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  55855. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  55856. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  55857. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  55858. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  55859. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  55860. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  55861. LXpUq3DDfSJlgnCW
  55862. -----END CERTIFICATE-----
  55863. GlobalSign Root CA - R3
  55864. =======================
  55865. -----BEGIN CERTIFICATE-----
  55866. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  55867. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  55868. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  55869. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  55870. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  55871. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  55872. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  55873. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  55874. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  55875. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  55876. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  55877. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  55878. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  55879. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  55880. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  55881. kpeDMdmztcpHWD9f
  55882. -----END CERTIFICATE-----
  55883. Autoridad de Certificacion Firmaprofesional CIF A62634068
  55884. =========================================================
  55885. -----BEGIN CERTIFICATE-----
  55886. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  55887. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  55888. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  55889. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  55890. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  55891. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  55892. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  55893. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  55894. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  55895. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  55896. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  55897. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  55898. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  55899. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  55900. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  55901. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  55902. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  55903. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  55904. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  55905. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  55906. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  55907. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  55908. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  55909. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  55910. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  55911. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  55912. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  55913. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  55914. -----END CERTIFICATE-----
  55915. Izenpe.com
  55916. ==========
  55917. -----BEGIN CERTIFICATE-----
  55918. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  55919. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  55920. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  55921. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  55922. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  55923. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  55924. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  55925. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  55926. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  55927. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  55928. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  55929. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  55930. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  55931. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  55932. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  55933. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  55934. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55935. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  55936. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  55937. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  55938. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  55939. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  55940. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  55941. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  55942. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  55943. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  55944. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  55945. -----END CERTIFICATE-----
  55946. Chambers of Commerce Root - 2008
  55947. ================================
  55948. -----BEGIN CERTIFICATE-----
  55949. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  55950. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55951. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55952. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  55953. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  55954. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  55955. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  55956. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  55957. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  55958. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  55959. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  55960. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  55961. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  55962. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  55963. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  55964. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  55965. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  55966. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  55967. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  55968. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  55969. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  55970. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  55971. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  55972. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  55973. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  55974. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  55975. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  55976. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  55977. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  55978. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  55979. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  55980. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  55981. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  55982. -----END CERTIFICATE-----
  55983. Global Chambersign Root - 2008
  55984. ==============================
  55985. -----BEGIN CERTIFICATE-----
  55986. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  55987. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55988. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55989. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  55990. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  55991. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  55992. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  55993. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  55994. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  55995. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  55996. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  55997. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  55998. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  55999. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  56000. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  56001. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  56002. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  56003. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  56004. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  56005. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  56006. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  56007. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  56008. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  56009. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  56010. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  56011. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  56012. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  56013. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  56014. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  56015. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  56016. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  56017. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  56018. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  56019. -----END CERTIFICATE-----
  56020. Go Daddy Root Certificate Authority - G2
  56021. ========================================
  56022. -----BEGIN CERTIFICATE-----
  56023. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56024. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  56025. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  56026. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  56027. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  56028. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  56029. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  56030. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  56031. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  56032. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  56033. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  56034. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  56035. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  56036. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  56037. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  56038. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  56039. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  56040. -----END CERTIFICATE-----
  56041. Starfield Root Certificate Authority - G2
  56042. =========================================
  56043. -----BEGIN CERTIFICATE-----
  56044. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56045. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  56046. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  56047. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  56048. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  56049. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  56050. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  56051. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  56052. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  56053. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  56054. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  56055. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56056. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  56057. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  56058. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  56059. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  56060. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  56061. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  56062. -----END CERTIFICATE-----
  56063. Starfield Services Root Certificate Authority - G2
  56064. ==================================================
  56065. -----BEGIN CERTIFICATE-----
  56066. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56067. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  56068. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  56069. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  56070. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  56071. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  56072. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  56073. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  56074. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  56075. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  56076. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  56077. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  56078. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  56079. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  56080. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  56081. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  56082. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  56083. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  56084. -----END CERTIFICATE-----
  56085. AffirmTrust Commercial
  56086. ======================
  56087. -----BEGIN CERTIFICATE-----
  56088. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  56089. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  56090. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  56091. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  56092. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  56093. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  56094. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  56095. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  56096. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  56097. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56098. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  56099. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  56100. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  56101. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  56102. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  56103. -----END CERTIFICATE-----
  56104. AffirmTrust Networking
  56105. ======================
  56106. -----BEGIN CERTIFICATE-----
  56107. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  56108. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  56109. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  56110. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  56111. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  56112. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  56113. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  56114. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  56115. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  56116. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56117. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  56118. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  56119. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  56120. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  56121. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  56122. -----END CERTIFICATE-----
  56123. AffirmTrust Premium
  56124. ===================
  56125. -----BEGIN CERTIFICATE-----
  56126. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  56127. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  56128. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  56129. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  56130. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  56131. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  56132. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  56133. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  56134. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  56135. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  56136. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  56137. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  56138. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  56139. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  56140. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  56141. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  56142. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  56143. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  56144. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  56145. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  56146. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  56147. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  56148. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  56149. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  56150. -----END CERTIFICATE-----
  56151. AffirmTrust Premium ECC
  56152. =======================
  56153. -----BEGIN CERTIFICATE-----
  56154. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  56155. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  56156. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  56157. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  56158. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  56159. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  56160. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  56161. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  56162. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  56163. eQ==
  56164. -----END CERTIFICATE-----
  56165. Certum Trusted Network CA
  56166. =========================
  56167. -----BEGIN CERTIFICATE-----
  56168. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  56169. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  56170. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  56171. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  56172. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  56173. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  56174. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  56175. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  56176. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  56177. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  56178. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  56179. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  56180. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  56181. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  56182. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  56183. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  56184. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  56185. -----END CERTIFICATE-----
  56186. TWCA Root Certification Authority
  56187. =================================
  56188. -----BEGIN CERTIFICATE-----
  56189. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  56190. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  56191. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  56192. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  56193. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  56194. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  56195. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  56196. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  56197. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  56198. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  56199. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  56200. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  56201. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  56202. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  56203. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  56204. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  56205. -----END CERTIFICATE-----
  56206. Security Communication RootCA2
  56207. ==============================
  56208. -----BEGIN CERTIFICATE-----
  56209. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  56210. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  56211. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  56212. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  56213. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  56214. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  56215. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  56216. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  56217. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  56218. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  56219. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  56220. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  56221. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  56222. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  56223. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  56224. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  56225. -----END CERTIFICATE-----
  56226. EC-ACC
  56227. ======
  56228. -----BEGIN CERTIFICATE-----
  56229. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  56230. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  56231. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  56232. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  56233. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  56234. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  56235. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  56236. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  56237. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  56238. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  56239. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  56240. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  56241. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  56242. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  56243. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  56244. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  56245. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  56246. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  56247. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  56248. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  56249. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  56250. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  56251. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  56252. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  56253. 5EI=
  56254. -----END CERTIFICATE-----
  56255. Hellenic Academic and Research Institutions RootCA 2011
  56256. =======================================================
  56257. -----BEGIN CERTIFICATE-----
  56258. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  56259. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  56260. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  56261. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  56262. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  56263. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  56264. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  56265. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  56266. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  56267. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  56268. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  56269. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  56270. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  56271. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  56272. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  56273. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  56274. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  56275. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  56276. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  56277. -----END CERTIFICATE-----
  56278. Actalis Authentication Root CA
  56279. ==============================
  56280. -----BEGIN CERTIFICATE-----
  56281. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  56282. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  56283. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  56284. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  56285. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  56286. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  56287. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  56288. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  56289. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  56290. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  56291. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  56292. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  56293. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  56294. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  56295. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  56296. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  56297. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  56298. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  56299. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  56300. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  56301. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  56302. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  56303. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  56304. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  56305. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  56306. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  56307. -----END CERTIFICATE-----
  56308. Trustis FPS Root CA
  56309. ===================
  56310. -----BEGIN CERTIFICATE-----
  56311. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  56312. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  56313. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  56314. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  56315. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  56316. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  56317. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  56318. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  56319. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  56320. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  56321. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  56322. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  56323. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  56324. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  56325. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  56326. iB6XzCGcKQENZetX2fNXlrtIzYE=
  56327. -----END CERTIFICATE-----
  56328. Buypass Class 2 Root CA
  56329. =======================
  56330. -----BEGIN CERTIFICATE-----
  56331. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  56332. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  56333. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  56334. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  56335. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  56336. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  56337. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  56338. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  56339. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  56340. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  56341. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  56342. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  56343. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  56344. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  56345. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  56346. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  56347. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  56348. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  56349. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  56350. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  56351. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  56352. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  56353. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  56354. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  56355. rJgWVqA=
  56356. -----END CERTIFICATE-----
  56357. Buypass Class 3 Root CA
  56358. =======================
  56359. -----BEGIN CERTIFICATE-----
  56360. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  56361. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  56362. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  56363. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  56364. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  56365. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  56366. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  56367. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  56368. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  56369. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  56370. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  56371. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  56372. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  56373. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  56374. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  56375. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  56376. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  56377. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  56378. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  56379. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  56380. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  56381. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  56382. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  56383. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  56384. Cp/HuZc=
  56385. -----END CERTIFICATE-----
  56386. T-TeleSec GlobalRoot Class 3
  56387. ============================
  56388. -----BEGIN CERTIFICATE-----
  56389. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  56390. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  56391. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  56392. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  56393. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  56394. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  56395. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  56396. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  56397. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  56398. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  56399. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  56400. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  56401. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  56402. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  56403. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  56404. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  56405. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  56406. -----END CERTIFICATE-----
  56407. EE Certification Centre Root CA
  56408. ===============================
  56409. -----BEGIN CERTIFICATE-----
  56410. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  56411. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  56412. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  56413. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  56414. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  56415. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  56416. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  56417. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  56418. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  56419. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  56420. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  56421. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  56422. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  56423. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  56424. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  56425. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  56426. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  56427. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  56428. dcGWxZ0=
  56429. -----END CERTIFICATE-----
  56430. D-TRUST Root Class 3 CA 2 2009
  56431. ==============================
  56432. -----BEGIN CERTIFICATE-----
  56433. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56434. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  56435. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  56436. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  56437. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  56438. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  56439. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  56440. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  56441. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  56442. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  56443. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  56444. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  56445. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  56446. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  56447. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  56448. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  56449. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  56450. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  56451. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  56452. -----END CERTIFICATE-----
  56453. D-TRUST Root Class 3 CA 2 EV 2009
  56454. =================================
  56455. -----BEGIN CERTIFICATE-----
  56456. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56457. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  56458. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56459. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  56460. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  56461. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  56462. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  56463. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  56464. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  56465. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  56466. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  56467. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  56468. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  56469. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  56470. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  56471. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  56472. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  56473. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  56474. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  56475. w9y4AyHqnxbxLFS1
  56476. -----END CERTIFICATE-----
  56477. CA Disig Root R2
  56478. ================
  56479. -----BEGIN CERTIFICATE-----
  56480. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  56481. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  56482. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  56483. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  56484. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  56485. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  56486. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  56487. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  56488. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  56489. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  56490. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  56491. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  56492. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  56493. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  56494. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  56495. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  56496. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  56497. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  56498. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  56499. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  56500. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  56501. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  56502. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  56503. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  56504. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  56505. -----END CERTIFICATE-----
  56506. ACCVRAIZ1
  56507. =========
  56508. -----BEGIN CERTIFICATE-----
  56509. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  56510. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  56511. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  56512. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  56513. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  56514. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  56515. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  56516. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  56517. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  56518. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  56519. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  56520. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  56521. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  56522. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  56523. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  56524. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  56525. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  56526. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  56527. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  56528. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  56529. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  56530. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  56531. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  56532. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  56533. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  56534. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  56535. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  56536. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  56537. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  56538. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  56539. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  56540. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  56541. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  56542. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  56543. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  56544. EfbRD0tVNEYqi4Y7
  56545. -----END CERTIFICATE-----
  56546. TWCA Global Root CA
  56547. ===================
  56548. -----BEGIN CERTIFICATE-----
  56549. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  56550. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  56551. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  56552. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  56553. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  56554. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  56555. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  56556. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  56557. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  56558. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  56559. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  56560. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  56561. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  56562. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  56563. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  56564. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  56565. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  56566. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  56567. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  56568. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  56569. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  56570. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  56571. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  56572. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  56573. -----END CERTIFICATE-----
  56574. TeliaSonera Root CA v1
  56575. ======================
  56576. -----BEGIN CERTIFICATE-----
  56577. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  56578. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  56579. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  56580. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  56581. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  56582. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  56583. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  56584. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  56585. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  56586. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  56587. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  56588. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  56589. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  56590. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  56591. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  56592. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  56593. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  56594. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  56595. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  56596. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  56597. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  56598. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  56599. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  56600. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  56601. -----END CERTIFICATE-----
  56602. E-Tugra Certification Authority
  56603. ===============================
  56604. -----BEGIN CERTIFICATE-----
  56605. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  56606. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  56607. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  56608. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  56609. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  56610. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  56611. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  56612. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  56613. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  56614. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  56615. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  56616. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  56617. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  56618. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  56619. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  56620. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  56621. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  56622. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  56623. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  56624. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  56625. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  56626. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  56627. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  56628. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  56629. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  56630. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  56631. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  56632. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  56633. C7TbO6Orb1wdtn7os4I07QZcJA==
  56634. -----END CERTIFICATE-----
  56635. T-TeleSec GlobalRoot Class 2
  56636. ============================
  56637. -----BEGIN CERTIFICATE-----
  56638. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  56639. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  56640. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  56641. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  56642. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  56643. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  56644. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  56645. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  56646. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  56647. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  56648. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  56649. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  56650. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  56651. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  56652. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  56653. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  56654. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  56655. -----END CERTIFICATE-----
  56656. Atos TrustedRoot 2011
  56657. =====================
  56658. -----BEGIN CERTIFICATE-----
  56659. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  56660. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  56661. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  56662. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  56663. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  56664. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  56665. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  56666. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  56667. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  56668. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  56669. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  56670. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  56671. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  56672. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  56673. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  56674. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  56675. -----END CERTIFICATE-----
  56676. QuoVadis Root CA 1 G3
  56677. =====================
  56678. -----BEGIN CERTIFICATE-----
  56679. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56680. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56681. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  56682. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  56683. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  56684. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  56685. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  56686. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  56687. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  56688. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  56689. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  56690. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  56691. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  56692. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56693. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  56694. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  56695. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  56696. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  56697. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  56698. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  56699. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  56700. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  56701. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  56702. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  56703. hMJKzRwuJIczYOXD
  56704. -----END CERTIFICATE-----
  56705. QuoVadis Root CA 2 G3
  56706. =====================
  56707. -----BEGIN CERTIFICATE-----
  56708. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56709. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56710. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  56711. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  56712. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  56713. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  56714. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  56715. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  56716. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  56717. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  56718. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  56719. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  56720. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  56721. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56722. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  56723. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  56724. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  56725. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  56726. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  56727. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  56728. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  56729. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  56730. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  56731. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  56732. O3jtZsSOeWmD3n+M
  56733. -----END CERTIFICATE-----
  56734. QuoVadis Root CA 3 G3
  56735. =====================
  56736. -----BEGIN CERTIFICATE-----
  56737. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  56738. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56739. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  56740. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  56741. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  56742. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  56743. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  56744. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  56745. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  56746. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  56747. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  56748. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  56749. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  56750. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56751. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  56752. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  56753. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  56754. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  56755. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  56756. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  56757. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  56758. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  56759. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  56760. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  56761. PpxxVJkES/1Y+Zj0
  56762. -----END CERTIFICATE-----
  56763. DigiCert Assured ID Root G2
  56764. ===========================
  56765. -----BEGIN CERTIFICATE-----
  56766. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  56767. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  56768. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  56769. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  56770. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  56771. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  56772. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  56773. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  56774. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  56775. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  56776. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  56777. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  56778. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  56779. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  56780. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  56781. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  56782. IhNzbM8m9Yop5w==
  56783. -----END CERTIFICATE-----
  56784. DigiCert Assured ID Root G3
  56785. ===========================
  56786. -----BEGIN CERTIFICATE-----
  56787. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  56788. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  56789. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56790. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56791. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  56792. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  56793. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  56794. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  56795. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  56796. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  56797. 1vUhZscv6pZjamVFkpUBtA==
  56798. -----END CERTIFICATE-----
  56799. DigiCert Global Root G2
  56800. =======================
  56801. -----BEGIN CERTIFICATE-----
  56802. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  56803. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  56804. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  56805. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  56806. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  56807. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  56808. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  56809. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  56810. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  56811. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  56812. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  56813. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  56814. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  56815. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  56816. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  56817. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  56818. MrY=
  56819. -----END CERTIFICATE-----
  56820. DigiCert Global Root G3
  56821. =======================
  56822. -----BEGIN CERTIFICATE-----
  56823. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  56824. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  56825. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  56826. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  56827. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  56828. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  56829. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  56830. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  56831. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  56832. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  56833. VOKa5Vt8sycX
  56834. -----END CERTIFICATE-----
  56835. DigiCert Trusted Root G4
  56836. ========================
  56837. -----BEGIN CERTIFICATE-----
  56838. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  56839. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  56840. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56841. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56842. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  56843. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  56844. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  56845. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  56846. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  56847. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  56848. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  56849. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  56850. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  56851. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  56852. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  56853. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  56854. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  56855. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  56856. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  56857. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  56858. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  56859. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  56860. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  56861. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  56862. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  56863. 82Z+
  56864. -----END CERTIFICATE-----
  56865. COMODO RSA Certification Authority
  56866. ==================================
  56867. -----BEGIN CERTIFICATE-----
  56868. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  56869. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  56870. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  56871. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  56872. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  56873. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  56874. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  56875. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  56876. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  56877. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  56878. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  56879. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  56880. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  56881. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  56882. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  56883. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  56884. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  56885. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  56886. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  56887. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  56888. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  56889. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  56890. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  56891. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  56892. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  56893. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  56894. LaZRfyHBNVOFBkpdn627G190
  56895. -----END CERTIFICATE-----
  56896. USERTrust RSA Certification Authority
  56897. =====================================
  56898. -----BEGIN CERTIFICATE-----
  56899. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  56900. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56901. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56902. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  56903. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56904. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56905. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  56906. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  56907. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  56908. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  56909. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  56910. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  56911. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  56912. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  56913. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  56914. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  56915. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  56916. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  56917. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  56918. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  56919. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  56920. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  56921. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  56922. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  56923. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  56924. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  56925. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  56926. -----END CERTIFICATE-----
  56927. USERTrust ECC Certification Authority
  56928. =====================================
  56929. -----BEGIN CERTIFICATE-----
  56930. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  56931. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56932. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56933. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  56934. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56935. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56936. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  56937. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  56938. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  56939. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  56940. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  56941. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  56942. -----END CERTIFICATE-----
  56943. GlobalSign ECC Root CA - R4
  56944. ===========================
  56945. -----BEGIN CERTIFICATE-----
  56946. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  56947. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56948. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56949. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56950. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  56951. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  56952. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  56953. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  56954. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  56955. -----END CERTIFICATE-----
  56956. GlobalSign ECC Root CA - R5
  56957. ===========================
  56958. -----BEGIN CERTIFICATE-----
  56959. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  56960. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56961. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56962. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56963. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  56964. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  56965. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  56966. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  56967. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  56968. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  56969. -----END CERTIFICATE-----
  56970. Staat der Nederlanden Root CA - G3
  56971. ==================================
  56972. -----BEGIN CERTIFICATE-----
  56973. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56974. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56975. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  56976. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  56977. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  56978. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  56979. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  56980. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  56981. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  56982. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  56983. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  56984. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  56985. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  56986. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  56987. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  56988. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  56989. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  56990. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  56991. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  56992. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  56993. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  56994. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  56995. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  56996. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  56997. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  56998. -----END CERTIFICATE-----
  56999. Staat der Nederlanden EV Root CA
  57000. ================================
  57001. -----BEGIN CERTIFICATE-----
  57002. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  57003. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  57004. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  57005. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  57006. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  57007. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  57008. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  57009. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  57010. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  57011. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  57012. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  57013. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  57014. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  57015. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  57016. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  57017. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  57018. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  57019. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  57020. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  57021. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  57022. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  57023. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  57024. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  57025. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  57026. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  57027. -----END CERTIFICATE-----
  57028. IdenTrust Commercial Root CA 1
  57029. ==============================
  57030. -----BEGIN CERTIFICATE-----
  57031. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  57032. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  57033. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  57034. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  57035. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  57036. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  57037. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  57038. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  57039. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  57040. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  57041. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  57042. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  57043. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  57044. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  57045. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  57046. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  57047. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  57048. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  57049. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  57050. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  57051. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  57052. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  57053. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  57054. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  57055. cGzM7vRX+Bi6hG6H
  57056. -----END CERTIFICATE-----
  57057. IdenTrust Public Sector Root CA 1
  57058. =================================
  57059. -----BEGIN CERTIFICATE-----
  57060. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  57061. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  57062. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  57063. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  57064. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  57065. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  57066. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  57067. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  57068. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  57069. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  57070. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  57071. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  57072. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  57073. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  57074. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  57075. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  57076. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  57077. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  57078. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  57079. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  57080. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  57081. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  57082. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  57083. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  57084. 3Wl9af0AVqW3rLatt8o+Ae+c
  57085. -----END CERTIFICATE-----
  57086. Entrust Root Certification Authority - G2
  57087. =========================================
  57088. -----BEGIN CERTIFICATE-----
  57089. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  57090. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  57091. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  57092. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  57093. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  57094. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  57095. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  57096. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  57097. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  57098. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  57099. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  57100. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  57101. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  57102. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  57103. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  57104. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  57105. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  57106. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  57107. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  57108. e4pIb4tF9g==
  57109. -----END CERTIFICATE-----
  57110. Entrust Root Certification Authority - EC1
  57111. ==========================================
  57112. -----BEGIN CERTIFICATE-----
  57113. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  57114. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  57115. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  57116. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  57117. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  57118. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  57119. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  57120. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  57121. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  57122. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  57123. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  57124. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  57125. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  57126. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  57127. -----END CERTIFICATE-----
  57128. CFCA EV ROOT
  57129. ============
  57130. -----BEGIN CERTIFICATE-----
  57131. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  57132. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  57133. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  57134. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  57135. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  57136. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  57137. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  57138. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  57139. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  57140. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  57141. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  57142. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  57143. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  57144. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  57145. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  57146. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  57147. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  57148. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  57149. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  57150. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  57151. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  57152. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  57153. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  57154. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  57155. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  57156. -----END CERTIFICATE-----
  57157. OISTE WISeKey Global Root GB CA
  57158. ===============================
  57159. -----BEGIN CERTIFICATE-----
  57160. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  57161. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  57162. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  57163. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  57164. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  57165. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  57166. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  57167. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  57168. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  57169. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  57170. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  57171. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  57172. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  57173. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  57174. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  57175. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  57176. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  57177. -----END CERTIFICATE-----
  57178. SZAFIR ROOT CA2
  57179. ===============
  57180. -----BEGIN CERTIFICATE-----
  57181. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  57182. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  57183. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  57184. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  57185. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  57186. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  57187. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  57188. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  57189. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  57190. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  57191. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  57192. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  57193. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  57194. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  57195. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  57196. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  57197. -----END CERTIFICATE-----
  57198. Certum Trusted Network CA 2
  57199. ===========================
  57200. -----BEGIN CERTIFICATE-----
  57201. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  57202. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  57203. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  57204. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  57205. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  57206. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  57207. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  57208. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  57209. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  57210. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  57211. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  57212. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  57213. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  57214. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  57215. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  57216. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  57217. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  57218. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  57219. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  57220. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  57221. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  57222. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  57223. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  57224. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  57225. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  57226. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  57227. zAYspsbiDrW5viSP
  57228. -----END CERTIFICATE-----
  57229. Hellenic Academic and Research Institutions RootCA 2015
  57230. =======================================================
  57231. -----BEGIN CERTIFICATE-----
  57232. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  57233. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  57234. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  57235. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  57236. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  57237. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  57238. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  57239. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  57240. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  57241. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  57242. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  57243. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  57244. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  57245. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  57246. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  57247. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  57248. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  57249. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  57250. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  57251. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  57252. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  57253. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  57254. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  57255. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  57256. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  57257. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  57258. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  57259. p/UsQu0yrbYhnr68
  57260. -----END CERTIFICATE-----
  57261. Hellenic Academic and Research Institutions ECC RootCA 2015
  57262. ===========================================================
  57263. -----BEGIN CERTIFICATE-----
  57264. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  57265. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  57266. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  57267. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  57268. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  57269. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  57270. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  57271. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  57272. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  57273. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  57274. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  57275. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  57276. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  57277. -----END CERTIFICATE-----
  57278. ISRG Root X1
  57279. ============
  57280. -----BEGIN CERTIFICATE-----
  57281. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  57282. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  57283. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  57284. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  57285. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  57286. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  57287. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  57288. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  57289. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  57290. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  57291. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  57292. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  57293. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  57294. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  57295. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  57296. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  57297. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  57298. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  57299. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  57300. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  57301. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  57302. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  57303. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  57304. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  57305. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  57306. -----END CERTIFICATE-----
  57307. AC RAIZ FNMT-RCM
  57308. ================
  57309. -----BEGIN CERTIFICATE-----
  57310. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  57311. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  57312. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  57313. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  57314. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  57315. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  57316. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  57317. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  57318. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  57319. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  57320. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  57321. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  57322. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  57323. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  57324. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  57325. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  57326. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  57327. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  57328. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  57329. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  57330. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  57331. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  57332. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  57333. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  57334. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  57335. -----END CERTIFICATE-----
  57336. Amazon Root CA 1
  57337. ================
  57338. -----BEGIN CERTIFICATE-----
  57339. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  57340. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  57341. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  57342. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  57343. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  57344. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  57345. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  57346. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  57347. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  57348. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  57349. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  57350. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  57351. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  57352. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  57353. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  57354. -----END CERTIFICATE-----
  57355. Amazon Root CA 2
  57356. ================
  57357. -----BEGIN CERTIFICATE-----
  57358. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  57359. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  57360. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  57361. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  57362. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  57363. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  57364. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  57365. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  57366. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  57367. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  57368. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  57369. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  57370. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  57371. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  57372. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  57373. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  57374. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  57375. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  57376. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  57377. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  57378. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  57379. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  57380. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  57381. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  57382. -----END CERTIFICATE-----
  57383. Amazon Root CA 3
  57384. ================
  57385. -----BEGIN CERTIFICATE-----
  57386. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  57387. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  57388. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  57389. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  57390. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  57391. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  57392. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  57393. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  57394. -----END CERTIFICATE-----
  57395. Amazon Root CA 4
  57396. ================
  57397. -----BEGIN CERTIFICATE-----
  57398. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  57399. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  57400. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  57401. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  57402. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  57403. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  57404. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  57405. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  57406. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  57407. -----END CERTIFICATE-----
  57408. LuxTrust Global Root 2
  57409. ======================
  57410. -----BEGIN CERTIFICATE-----
  57411. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  57412. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  57413. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  57414. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  57415. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  57416. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  57417. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  57418. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  57419. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  57420. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  57421. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  57422. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  57423. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  57424. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  57425. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  57426. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  57427. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  57428. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  57429. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  57430. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  57431. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  57432. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  57433. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  57434. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  57435. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  57436. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  57437. -----END CERTIFICATE-----
  57438. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  57439. =============================================
  57440. -----BEGIN CERTIFICATE-----
  57441. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  57442. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  57443. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  57444. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  57445. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  57446. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  57447. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  57448. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  57449. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  57450. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  57451. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  57452. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  57453. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  57454. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  57455. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  57456. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  57457. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  57458. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  57459. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  57460. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  57461. -----END CERTIFICATE-----
  57462. GDCA TrustAUTH R5 ROOT
  57463. ======================
  57464. -----BEGIN CERTIFICATE-----
  57465. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  57466. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  57467. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  57468. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  57469. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  57470. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  57471. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  57472. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  57473. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  57474. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  57475. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  57476. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  57477. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  57478. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  57479. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  57480. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  57481. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  57482. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  57483. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  57484. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  57485. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  57486. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  57487. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  57488. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  57489. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  57490. -----END CERTIFICATE-----
  57491. TrustCor RootCert CA-1
  57492. ======================
  57493. -----BEGIN CERTIFICATE-----
  57494. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  57495. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  57496. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  57497. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  57498. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  57499. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  57500. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  57501. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  57502. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  57503. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  57504. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  57505. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  57506. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  57507. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  57508. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  57509. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  57510. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  57511. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  57512. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  57513. -----END CERTIFICATE-----
  57514. TrustCor RootCert CA-2
  57515. ======================
  57516. -----BEGIN CERTIFICATE-----
  57517. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  57518. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  57519. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  57520. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  57521. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  57522. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  57523. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  57524. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  57525. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  57526. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  57527. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  57528. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  57529. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  57530. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  57531. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  57532. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  57533. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  57534. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  57535. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  57536. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  57537. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  57538. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  57539. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  57540. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  57541. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  57542. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  57543. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  57544. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  57545. -----END CERTIFICATE-----
  57546. TrustCor ECA-1
  57547. ==============
  57548. -----BEGIN CERTIFICATE-----
  57549. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  57550. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  57551. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  57552. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  57553. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  57554. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  57555. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  57556. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  57557. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  57558. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  57559. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  57560. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  57561. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  57562. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  57563. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  57564. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  57565. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  57566. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  57567. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  57568. -----END CERTIFICATE-----
  57569. SSL.com Root Certification Authority RSA
  57570. ========================================
  57571. -----BEGIN CERTIFICATE-----
  57572. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  57573. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  57574. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  57575. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  57576. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  57577. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  57578. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  57579. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  57580. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  57581. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  57582. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  57583. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  57584. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  57585. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  57586. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  57587. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  57588. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  57589. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  57590. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  57591. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  57592. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  57593. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  57594. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  57595. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  57596. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  57597. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  57598. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  57599. -----END CERTIFICATE-----
  57600. SSL.com Root Certification Authority ECC
  57601. ========================================
  57602. -----BEGIN CERTIFICATE-----
  57603. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  57604. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  57605. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  57606. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  57607. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  57608. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  57609. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  57610. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  57611. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  57612. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  57613. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  57614. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  57615. -----END CERTIFICATE-----
  57616. SSL.com EV Root Certification Authority RSA R2
  57617. ==============================================
  57618. -----BEGIN CERTIFICATE-----
  57619. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  57620. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  57621. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  57622. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  57623. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  57624. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  57625. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  57626. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  57627. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  57628. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  57629. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  57630. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  57631. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  57632. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  57633. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  57634. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  57635. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  57636. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  57637. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  57638. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  57639. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  57640. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  57641. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  57642. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  57643. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  57644. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  57645. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  57646. -----END CERTIFICATE-----
  57647. SSL.com EV Root Certification Authority ECC
  57648. ===========================================
  57649. -----BEGIN CERTIFICATE-----
  57650. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  57651. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  57652. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  57653. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  57654. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  57655. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  57656. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  57657. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  57658. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  57659. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  57660. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  57661. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  57662. -----END CERTIFICATE-----
  57663. GlobalSign Root CA - R6
  57664. =======================
  57665. -----BEGIN CERTIFICATE-----
  57666. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  57667. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  57668. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  57669. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  57670. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  57671. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  57672. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  57673. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  57674. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  57675. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  57676. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  57677. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  57678. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  57679. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  57680. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  57681. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  57682. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  57683. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  57684. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  57685. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  57686. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  57687. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  57688. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  57689. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  57690. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  57691. -----END CERTIFICATE-----
  57692. OISTE WISeKey Global Root GC CA
  57693. ===============================
  57694. -----BEGIN CERTIFICATE-----
  57695. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  57696. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  57697. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  57698. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  57699. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  57700. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  57701. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  57702. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  57703. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  57704. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  57705. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  57706. -----END CERTIFICATE-----
  57707. GTS Root R1
  57708. ===========
  57709. -----BEGIN CERTIFICATE-----
  57710. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57711. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57712. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57713. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  57714. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  57715. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  57716. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  57717. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  57718. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  57719. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  57720. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  57721. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  57722. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  57723. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57724. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  57725. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  57726. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  57727. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  57728. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  57729. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  57730. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  57731. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  57732. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  57733. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  57734. CFF1pkgl
  57735. -----END CERTIFICATE-----
  57736. GTS Root R2
  57737. ===========
  57738. -----BEGIN CERTIFICATE-----
  57739. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57740. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57741. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57742. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  57743. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  57744. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  57745. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  57746. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  57747. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  57748. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  57749. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  57750. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  57751. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  57752. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57753. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  57754. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  57755. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  57756. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  57757. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  57758. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  57759. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  57760. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  57761. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  57762. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  57763. o/DUhgkC
  57764. -----END CERTIFICATE-----
  57765. GTS Root R3
  57766. ===========
  57767. -----BEGIN CERTIFICATE-----
  57768. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57769. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57770. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57771. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  57772. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  57773. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  57774. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  57775. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  57776. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  57777. KaqW04MjyaR7YbPMAuhd
  57778. -----END CERTIFICATE-----
  57779. GTS Root R4
  57780. ===========
  57781. -----BEGIN CERTIFICATE-----
  57782. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57783. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57784. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57785. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  57786. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  57787. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  57788. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  57789. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  57790. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  57791. zPKwTdb+mciUqXWi4w==
  57792. -----END CERTIFICATE-----
  57793. UCA Global G2 Root
  57794. ==================
  57795. -----BEGIN CERTIFICATE-----
  57796. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  57797. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  57798. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  57799. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  57800. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  57801. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  57802. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  57803. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  57804. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  57805. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  57806. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  57807. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  57808. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  57809. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  57810. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  57811. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  57812. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  57813. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  57814. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  57815. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  57816. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  57817. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  57818. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  57819. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  57820. -----END CERTIFICATE-----
  57821. UCA Extended Validation Root
  57822. ============================
  57823. -----BEGIN CERTIFICATE-----
  57824. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  57825. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  57826. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  57827. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  57828. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  57829. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  57830. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  57831. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  57832. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  57833. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  57834. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  57835. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  57836. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  57837. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  57838. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  57839. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  57840. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  57841. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  57842. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  57843. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  57844. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  57845. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  57846. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  57847. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  57848. dhh2n1ax
  57849. -----END CERTIFICATE-----
  57850. Certigna Root CA
  57851. ================
  57852. -----BEGIN CERTIFICATE-----
  57853. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  57854. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  57855. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  57856. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  57857. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  57858. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  57859. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  57860. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  57861. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  57862. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  57863. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  57864. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  57865. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  57866. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  57867. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  57868. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  57869. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  57870. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  57871. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  57872. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  57873. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  57874. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  57875. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  57876. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  57877. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  57878. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  57879. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  57880. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  57881. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  57882. -----END CERTIFICATE-----
  57883. emSign Root CA - G1
  57884. ===================
  57885. -----BEGIN CERTIFICATE-----
  57886. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  57887. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  57888. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  57889. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  57890. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  57891. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  57892. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  57893. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  57894. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  57895. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  57896. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  57897. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  57898. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  57899. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  57900. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  57901. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  57902. iN66zB+Afko=
  57903. -----END CERTIFICATE-----
  57904. emSign ECC Root CA - G3
  57905. =======================
  57906. -----BEGIN CERTIFICATE-----
  57907. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  57908. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  57909. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  57910. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  57911. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  57912. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  57913. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  57914. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  57915. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  57916. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  57917. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  57918. -----END CERTIFICATE-----
  57919. emSign Root CA - C1
  57920. ===================
  57921. -----BEGIN CERTIFICATE-----
  57922. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  57923. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  57924. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  57925. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  57926. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  57927. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  57928. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  57929. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  57930. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  57931. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  57932. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  57933. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  57934. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  57935. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  57936. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  57937. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  57938. -----END CERTIFICATE-----
  57939. emSign ECC Root CA - C3
  57940. =======================
  57941. -----BEGIN CERTIFICATE-----
  57942. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  57943. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  57944. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  57945. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  57946. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  57947. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  57948. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  57949. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  57950. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  57951. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  57952. -----END CERTIFICATE-----
  57953. Hongkong Post Root CA 3
  57954. =======================
  57955. -----BEGIN CERTIFICATE-----
  57956. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  57957. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  57958. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  57959. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  57960. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  57961. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  57962. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  57963. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  57964. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  57965. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  57966. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  57967. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  57968. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  57969. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  57970. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  57971. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  57972. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  57973. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  57974. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  57975. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  57976. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  57977. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  57978. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  57979. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  57980. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  57981. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  57982. dBb9HxEGmpv0
  57983. -----END CERTIFICATE-----
  57984. Entrust Root Certification Authority - G4
  57985. =========================================
  57986. -----BEGIN CERTIFICATE-----
  57987. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  57988. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  57989. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  57990. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  57991. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  57992. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  57993. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  57994. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  57995. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  57996. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  57997. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  57998. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  57999. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  58000. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  58001. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  58002. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  58003. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  58004. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  58005. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  58006. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  58007. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  58008. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  58009. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  58010. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  58011. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  58012. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  58013. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  58014. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  58015. kcpG2om3PVODLAgfi49T3f+sHw==
  58016. -----END CERTIFICATE-----
  58017. <?php
  58018. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  58019. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  58020. }
  58021. setlocale(LC_ALL, 'C');
  58022. require __DIR__.'/../src/bootstrap.php';
  58023. use Composer\Console\Application;
  58024. use Composer\XdebugHandler\XdebugHandler;
  58025. error_reporting(-1);
  58026. // Restart without Xdebug
  58027. $xdebug = new XdebugHandler('Composer', '--ansi');
  58028. $xdebug->check();
  58029. unset($xdebug);
  58030. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  58031. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  58032. exit(1);
  58033. }
  58034. if (function_exists('ini_set')) {
  58035. @ini_set('display_errors', 1);
  58036. $memoryInBytes = function ($value) {
  58037. $unit = strtolower(substr($value, -1, 1));
  58038. $value = (int) $value;
  58039. switch($unit) {
  58040. case 'g':
  58041. $value *= 1024;
  58042. // no break (cumulative multiplier)
  58043. case 'm':
  58044. $value *= 1024;
  58045. // no break (cumulative multiplier)
  58046. case 'k':
  58047. $value *= 1024;
  58048. }
  58049. return $value;
  58050. };
  58051. $memoryLimit = trim(ini_get('memory_limit'));
  58052. // Increase memory_limit if it is lower than 1.5GB
  58053. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  58054. @ini_set('memory_limit', '1536M');
  58055. }
  58056. // Set user defined memory limit
  58057. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  58058. @ini_set('memory_limit', $memoryLimit);
  58059. }
  58060. unset($memoryInBytes, $memoryLimit);
  58061. }
  58062. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  58063. // run the command application
  58064. $application = new Application();
  58065. $application->run();
  58066. Copyright (c) Nils Adermann, Jordi Boggiano
  58067. Permission is hereby granted, free of charge, to any person obtaining a copy
  58068. of this software and associated documentation files (the "Software"), to deal
  58069. in the Software without restriction, including without limitation the rights
  58070. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58071. copies of the Software, and to permit persons to whom the Software is furnished
  58072. to do so, subject to the following conditions:
  58073. The above copyright notice and this permission notice shall be included in all
  58074. copies or substantial portions of the Software.
  58075. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  58076. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  58077. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  58078. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  58079. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  58080. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58081. THE SOFTWARE.
  58082. ýŒý¹ŠA[š TaM†“Ú˜Ä���GBMB